-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attribute Collection view FieldGroups
- Loading branch information
Showing
6 changed files
with
212 additions
and
35 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
54 changes: 54 additions & 0 deletions
54
app/plugins/CoreEnroller/templates/AttributeCollectors/fieldset-field.inc
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,54 @@ | ||
<?php | ||
/** | ||
* COmanage Registry Fields Set Field | ||
* | ||
* 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.0.0 | ||
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
use \Cake\Utility\Inflector; | ||
|
||
// We get the Permitted Address fields from the resources. As a result we need to | ||
// bring them to a proper form. The following action will have not affect the rest of the fields | ||
$field = str_replace(' ', '_', Inflector::underscore($field)); | ||
$label = Inflector::humanize($field); | ||
|
||
// Construct the field arguments | ||
$formArguments = [ | ||
// We prefix the attribute ID with a string because Cake seems to sometimes have | ||
// problems with field names that are purely integers (even if cast to strings) | ||
'fieldName' => "field-$field-$attr->id", | ||
'fieldLabel' => $attr->label, // fieldLabel is only applicable to checkboxes | ||
'fieldType' => $supportedAttributes['fieldType'], | ||
'fieldNameAlias' => $attr->attribute // the field name to its enrollment attribute field name | ||
]; | ||
?> | ||
|
||
<div class="fieldset-field"> | ||
<label for="<?= $field ?>"><?= $label ?></label> | ||
<?= \in_array($field, $required_fields_list, true) ? $this->element('form/requiredSpan') : ''?> | ||
<div class="input text"> | ||
<?= $this->Field->formField(...$formArguments) ?> | ||
</div> | ||
</div> |
54 changes: 54 additions & 0 deletions
54
app/plugins/CoreEnroller/templates/AttributeCollectors/fieldset-group.inc
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,54 @@ | ||
<?php | ||
/** | ||
* COmanage Registry Fields Set Group | ||
* | ||
* 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.0.0 | ||
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
use \Cake\Utility\Inflector; | ||
|
||
?> | ||
|
||
<?php foreach($groupedFieldsArray as $idx => $fields): ?> | ||
<div class="fieldset-subgroup"> | ||
<?php | ||
foreach($fields as $field) { | ||
// Remove the field we render from the permitted list. | ||
$permitted_fields_list = $permitted_fields_list->filter(fn($value) => str_replace(' ', '_', Inflector::underscore($value)) !== $field); | ||
include($vv_template_path . DS . 'fieldset-field.inc'); | ||
} | ||
?> | ||
</div> | ||
<?php endforeach; ?> | ||
|
||
<?php | ||
|
||
// For all the remaining fields we do not need a group | ||
foreach ($permitted_fields_list as $field) { | ||
include($vv_template_path . DS . 'fieldset-field.inc'); | ||
} | ||
?> | ||
|
||
|
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,38 @@ | ||
<?php | ||
/** | ||
* COmanage Registry Required Address Fields Enum | ||
* | ||
* 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.0.0 | ||
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace App\Lib\Enum; | ||
|
||
class GroupedAddressFieldsEnum extends StandardEnum { | ||
// The order needs to be from local to country. Since this is the | ||
// ordering that will be used for rendering | ||
const StreetRoom = 'street,room'; | ||
const CityLocality = 'city,locality'; | ||
const StatePostalCountry = 'state,postal_code,country'; | ||
} |