diff --git a/app/plugins/CoreEnroller/src/View/Cell/AttributeCollectorsCell.php b/app/plugins/CoreEnroller/src/View/Cell/AttributeCollectorsCell.php new file mode 100644 index 000000000..bef6e3072 --- /dev/null +++ b/app/plugins/CoreEnroller/src/View/Cell/AttributeCollectorsCell.php @@ -0,0 +1,89 @@ + + */ + protected $_validCellOptions = [ + 'vv_obj', + 'vv_step', + 'viewVars', + ]; + + /** + * Initialization logic run at the end of object construction. + * + * @return void + */ + public function initialize(): void + { + } + + /** + * Default display method. + * + * @param int $petitionId + * @return void + * @since COmanage Registry v5.1.0 + */ + public function display(int $petitionId): void + { + $vv_enrollment_atttributes_ids = Hash::extract($this->vv_obj->petition_attributes, '{n}.enrollment_attribute_id'); + $vv_enrollment_atttributes_ids = array_unique($vv_enrollment_atttributes_ids); + + $vv_enrollment_attributes = $this->fetchTable('EnrollmentAttributes') + ->find() + ->where(fn(QueryExpression $exp, Query $q) => $exp->in('id', $vv_enrollment_atttributes_ids)) + ->order(['ordr' => 'ASC']) + ->toArray(); + + $this->set('vv_enrollment_attributes', $vv_enrollment_attributes); + $this->set('vv_step', $this->vv_step); + $this->set('vv_obj', $this->vv_obj); + } +} diff --git a/app/plugins/CoreEnroller/src/View/Cell/BasicAttributeCollectorsCell.php b/app/plugins/CoreEnroller/src/View/Cell/BasicAttributeCollectorsCell.php new file mode 100644 index 000000000..16e12361b --- /dev/null +++ b/app/plugins/CoreEnroller/src/View/Cell/BasicAttributeCollectorsCell.php @@ -0,0 +1,81 @@ + + */ + protected $_validCellOptions = [ + 'vv_obj', + 'vv_step', + 'viewVars', + ]; + + /** + * Initialization logic run at the end of object construction. + * + * @return void + */ + public function initialize(): void + { + } + + /** + * Default display method. + * + * @param int $petitionId + * @return string + * @since COmanage Registry v5.1.0 + */ + public function display(int $petitionId): void + { + $vv_petition_basic_attribute_set = $this->fetchTable('PetitionBasicAttributeSets') + ->find() + ->where(['PetitionBasicAttributeSets.petition_id' => $this->vv_obj->id]) + ->firstOrFail(); + + $this->set('vv_petition_basic_attribute_set', $vv_petition_basic_attribute_set); + $this->set('vv_obj', $this->vv_obj); + } +} diff --git a/app/plugins/CoreEnroller/src/View/Cell/EmailVerifiersCell.php b/app/plugins/CoreEnroller/src/View/Cell/EmailVerifiersCell.php new file mode 100644 index 000000000..e855b6e2a --- /dev/null +++ b/app/plugins/CoreEnroller/src/View/Cell/EmailVerifiersCell.php @@ -0,0 +1,85 @@ + + */ + protected $_validCellOptions = [ + 'vv_obj', + 'vv_step', + 'viewVars', + ]; + + /** + * Initialization logic run at the end of object construction. + * + * @return void + */ + public function initialize(): void + { + } + + /** + * Default display method. + * + * @param int $petitionId + * @return void + * @since COmanage Registry v5.1.0 + */ + public function display(int $petitionId): void + { + // Because Petition Verifications are not tracked on a per-step basis, we just pull all + // associated with the Petition + + $vv_pv = $this->fetchTable('CoreEnroller.PetitionVerifications') + ->find() + ->where(['PetitionVerifications.petition_id' => $this->vv_obj->id]) + ->contain(['Verifications']) + ->all(); + + $this->set('vv_pv', $vv_pv); + $this->set('viewVars', $this->viewVars); + } +} diff --git a/app/plugins/CoreEnroller/src/View/Cell/IdentifierCollectorsCell.php b/app/plugins/CoreEnroller/src/View/Cell/IdentifierCollectorsCell.php new file mode 100644 index 000000000..af18eb85b --- /dev/null +++ b/app/plugins/CoreEnroller/src/View/Cell/IdentifierCollectorsCell.php @@ -0,0 +1,80 @@ + + */ + protected $_validCellOptions = [ + 'vv_obj', + 'vv_step', + 'viewVars', + ]; + + /** + * Initialization logic run at the end of object construction. + * + * @return void + */ + public function initialize(): void + { + } + + /** + * Default display method. + * + * @param int $petitionId + * @return void + * @since COmanage Registry v5.1.0 + */ + public function display(int $petitionId): void + { + $vv_pi = $this->fetchTable('CoreEnroller.PetitionIdentifiers') + ->find() + ->where(['petition_id' => $this->vv_obj->id]) + ->first(); + + $this->set('vv_pi', $vv_pi); + } +} diff --git a/app/plugins/CoreEnroller/src/View/Cell/InvitationAcceptersCell.php b/app/plugins/CoreEnroller/src/View/Cell/InvitationAcceptersCell.php new file mode 100644 index 000000000..320b8dc87 --- /dev/null +++ b/app/plugins/CoreEnroller/src/View/Cell/InvitationAcceptersCell.php @@ -0,0 +1,80 @@ + + */ + protected $_validCellOptions = [ + 'vv_obj', + 'vv_step', + 'viewVars', + ]; + + /** + * Initialization logic run at the end of object construction. + * + * @return void + */ + public function initialize(): void + { + } + + /** + * Default display method. + * + * @param int $petitionId + * @return void + * @since COmanage Registry v5.1.0 + */ + public function display(int $petitionId): void + { + $vv_pa = $this->fetchTable('CoreEnroller.PetitionAcceptances') + ->find() + ->where(['petition_id' => $this->vv_obj->id]) + ->first(); + + $this->set('vv_pa', $vv_pa); + } +} diff --git a/app/plugins/CoreEnroller/templates/element/petition/attributeCollectorsStep.php b/app/plugins/CoreEnroller/templates/cell/AttributeCollectors/display.php similarity index 85% rename from app/plugins/CoreEnroller/templates/element/petition/attributeCollectorsStep.php rename to app/plugins/CoreEnroller/templates/cell/AttributeCollectors/display.php index 0293a519f..e2d44c602 100644 --- a/app/plugins/CoreEnroller/templates/element/petition/attributeCollectorsStep.php +++ b/app/plugins/CoreEnroller/templates/cell/AttributeCollectors/display.php @@ -1,6 +1,6 @@ petition_attributes, '{n}.enrollment_attribute_id'); -$vv_enrollment_atttributes_ids = array_unique($vv_enrollment_atttributes_ids); - -$enrollmentAttributesTable = $this->Petition->getTable('EnrollmentAttributes'); -$vv_enrollment_attributes = $enrollmentAttributesTable->find() - ->where(fn(QueryExpression $exp, Query $q) => $exp->in('id', $vv_enrollment_atttributes_ids)) - ->order(['ordr' => 'ASC']) - ->toArray(); - ?>