-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save petition attribute collection data
Save form and display.php render phpv8.2 deprecation Petition preview parse people picker value Petition Preview new structure Add collapsable behavior fix people link Fix disabled fields. Fix affiliation_type petition render. More improvements Fixing Petition resume view
- Loading branch information
Showing
16 changed files
with
276 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
app/plugins/CoreEnroller/templates/AttributeCollectors/display.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?php | ||
| $petition_attributes = $vv_petition_attributes->toArray(); | ||
| ?> | ||
| <ul> | ||
| <?php foreach ($petition_attributes as $attribute): ?> | ||
| <li>ID: <?= $attribute->id?>, Value: <?= $attribute->value?>, Column Name: <?= $attribute->column_name ?></li> | ||
| <?php endforeach; ?> | ||
| </ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <?php | ||
| /* | ||
| * COmanage Registry Enrollment Flow Step | ||
| * | ||
| * Portions licensed to the University Corporation for Advanced Internet | ||
| * Development, Inc. ("UCAID") under one or more contributor license agreements. | ||
| * See the NOTICE file distributed with this work for additional information | ||
| * regarding copyright ownership. | ||
| * | ||
| * UCAID licenses this file to you under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with the | ||
| * License. You may obtain a copy of the License at: | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| * @link https://www.internet2.edu/comanage COmanage Project | ||
| * @package registry | ||
| * @since COmanage Registry v5.1.0 | ||
| * @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
| * | ||
| * This generic modal dialog stub is used for confirmations, e.g. when deleting a record. | ||
| * The text of the box is overridden with JavaScript, and the confirm button is intended to | ||
| * click a CakePHP postLink or postButton in the DOM. Use jsConfirmGeneric() to call it. | ||
| */ | ||
|
|
||
| declare(strict_types = 1); | ||
|
|
||
| $parsePluginName = explode('.', $vv_step->plugin); | ||
| $modelName = array_pop($parsePluginName); | ||
| $elementName = lcfirst($modelName) . 'Step'; | ||
|
|
||
| // The convention is that the element name for each step is the name of the EnrollmentFlow Step model followed by | ||
| // the word Step | ||
| print $this->element("petition/enrollmentFlowSteps/$elementName", ['vv_step' => $vv_step]); |
91 changes: 91 additions & 0 deletions
91
app/templates/element/petition/enrollmentFlowSteps/attributeCollectorsStep.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| <?php | ||
| /* | ||
| * COmanage Registry Attibutte Collectors Step | ||
| * | ||
| * Portions licensed to the University Corporation for Advanced Internet | ||
| * Development, Inc. ("UCAID") under one or more contributor license agreements. | ||
| * See the NOTICE file distributed with this work for additional information | ||
| * regarding copyright ownership. | ||
| * | ||
| * UCAID licenses this file to you under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with the | ||
| * License. You may obtain a copy of the License at: | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| * @link https://www.internet2.edu/comanage COmanage Project | ||
| * @package registry | ||
| * @since COmanage Registry v5.1.0 | ||
| * @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
| * | ||
| * This generic modal dialog stub is used for confirmations, e.g. when deleting a record. | ||
| * The text of the box is overridden with JavaScript, and the confirm button is intended to | ||
| * click a CakePHP postLink or postButton in the DOM. Use jsConfirmGeneric() to call it. | ||
| */ | ||
|
|
||
| declare(strict_types = 1); | ||
|
|
||
| use Cake\Database\Expression\QueryExpression; | ||
| use Cake\ORM\Query; | ||
| use Cake\Utility\Hash; | ||
|
|
||
| // Extract unique enrollment attribute IDs | ||
| $vv_enrollment_atttributes_ids = Hash::extract($vv_obj->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)) | ||
| ->toArray(); | ||
|
|
||
| ?> | ||
|
|
||
| <ul> | ||
| <?php foreach ($vv_enrollment_attributes as $attribute): ?> | ||
| <?php $vv_petition_atttributes = collection($vv_obj->petition_attributes)->filter(fn($attr) => $attr->enrollment_attribute_id === $attribute->id) ?> | ||
| <?php if($vv_petition_atttributes->count() === 1): ?> | ||
| <?php | ||
| $attr = $vv_petition_atttributes->first(); | ||
| $value = $attr->value ?? 'N/A'; | ||
| if(!empty($value) && str_ends_with($attribute->attribute, 'person_id')) { | ||
| // We need to load the associated model data | ||
| $associatedModel = $this->Petition->getRecordForId('person_id', $attr->value, ['PrimaryName']); | ||
| $value = $associatedModel[0]->primary_name->given . ' ' | ||
| . $associatedModel[0]->primary_name->family . ' ' | ||
| . '(ID: ' . $associatedModel[0]->id . ')'; | ||
| $value = $this->Html->link($value, | ||
| ['controller' => 'people', 'action' => 'edit', $attr->value]); | ||
| } elseif(!empty($value) && str_ends_with($attribute->attribute, '_id')) { | ||
| // We need to load the associated model data | ||
| $associatedModel = $this->Petition->getRecordForId($attribute->attribute, $attr->value); | ||
| $value = $associatedModel['name'] ?? $associatedModel['value'] ?? $associatedModel['description'] ?? 'N/A'; | ||
| $value = $this->Html->link($value, | ||
| ['controller' => \App\Lib\Util\StringUtilities::foreignKeyToController($attribute->attribute), 'action' => 'edit', $attr->value]); | ||
| } | ||
| ?> | ||
| <li class="petition-attr-<?= $this->Petition->getClassPostfixFromAttributeName($attribute->attribute) ?>"> | ||
| <h4 class="petition-attr-label"><?= $attribute->label ?></h4> | ||
| <div class="petition-attr-value"><?= $value ?> | ||
| </div> | ||
| </li> | ||
| <?php else: ?> | ||
| <li class="petition-attr-<?= $this->Petition->getClassPostfixFromAttributeName($attribute->attribute) ?>"> | ||
| <h4 class="petition-attr-label"><?= $attribute->label ?></h4> | ||
| <ul class="petition-attrs-subset"> | ||
| <?php foreach ($vv_petition_atttributes as $attr): ?> | ||
| <li> | ||
| <div class="petition-attrs-subset-label"><?= $attr->column_name ?></div> | ||
| <div class="petition-attr-subset-value"><?= $attr->value ?></div> | ||
| </li> | ||
| <?php endforeach; ?> | ||
| </ul> | ||
| </li> | ||
| <?php endif; ?> | ||
| <?php endforeach; ?> | ||
| </ul> |
Oops, something went wrong.