Skip to content

Move petition Enrollment Flow steps preview to cells #288

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
89 changes: 89 additions & 0 deletions app/plugins/CoreEnroller/src/View/Cell/AttributeCollectorsCell.php
@@ -0,0 +1,89 @@
<?php
/*
* COmanage Registry Attribute Collectors Cell
*
* 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);

namespace CoreEnroller\View\Cell;

use Cake\View\Cell;
use Cake\Database\Expression\QueryExpression;
use Cake\ORM\Query;
use Cake\Utility\Hash;

/**
* AttributeCollectors cell
*/
class AttributeCollectorsCell extends Cell
{
/**
* List of valid options that can be passed into this
* cell's constructor.
*
* @var array<string, mixed>
*/
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);
}
}
@@ -0,0 +1,81 @@
<?php
/*
* COmanage Registry Basic Attribute Collectors Cell
*
* 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);

namespace CoreEnroller\View\Cell;

use Cake\View\Cell;

/**
* BasicAttributeCollectors cell
*/
class BasicAttributeCollectorsCell extends Cell
{
/**
* List of valid options that can be passed into this
* cell's constructor.
*
* @var array<string, mixed>
*/
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);
}
}
85 changes: 85 additions & 0 deletions app/plugins/CoreEnroller/src/View/Cell/EmailVerifiersCell.php
@@ -0,0 +1,85 @@
<?php
/*
* COmanage Registry Email Verifiers Cell
*
* 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);

namespace CoreEnroller\View\Cell;

use Cake\View\Cell;

/**
* EmailVerifiers cell
*/
class EmailVerifiersCell extends Cell
{
/**
* List of valid options that can be passed into this
* cell's constructor.
*
* @var array<string, mixed>
*/
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);
}
}
@@ -0,0 +1,80 @@
<?php
/*
* COmanage Registry Identifiers Collectors Cell
*
* 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);

namespace CoreEnroller\View\Cell;

use Cake\View\Cell;

/**
* IdentifierCollectors cell
*/
class IdentifierCollectorsCell extends Cell
{
/**
* List of valid options that can be passed into this
* cell's constructor.
*
* @var array<string, mixed>
*/
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);
}
}