This is sub-form for filtering by workflow states utilized by the data grid.
More...
List of all members.
Detailed Description
This is sub-form for filtering by workflow states utilized by the data grid.
- Copyright:
- 2011-2012 Perforce Software. All rights reserved
- License:
- Please see LICENSE.txt in top-level folder of this distribution.
- Version:
- 2012.2/486814
Member Function Documentation
Workflow_Form_GridStateFilter::_getWorkflowStatesOptions |
( |
| ) |
[protected] |
Return list with workflow states organized by worfkflows suitable for using as options for NestedCheckbox form element.
- Returns:
- array list with workflow states options.
{
$workflows = Workflow_Model_Workflow::fetchAll();
$options = array();
foreach ($workflows as $workflow) {
$prefix = $workflow->getId() . '/';
$options[$prefix . '*'] = $workflow->getLabel();
$states = $workflow->getStateModels();
foreach ($states as $state) {
$options[$prefix][$prefix . $state->getId()] = $state->getLabel();
}
}
return $options;
}
Workflow_Form_GridStateFilter::getSelectedStates |
( |
| ) |
|
Returns list of selected values from 'states' element as an array containing workflow => workflow states.
- Returns:
- array list of selected workflow states grouped by workflows.
{
$statesElement = $this->getElement('states');
$states = $statesElement->getValue();
if (!is_array($states)) {
return array();
}
$workflowStates = array();
foreach ($states as $state) {
$stateValue = substr($state, -2) == '/*'
? array_keys($statesElement->getMultiOption(substr($state, 0, -1)))
: array($state);
foreach ($stateValue as $workflowStatePair) {
if (strpos($workflowStatePair, '/') === false) {
continue;
}
list($workflow, $state) = explode('/', $workflowStatePair);
if (!isset($workflowStates[$workflow])) {
$workflowStates[$workflow] = array($state);
} else if (!in_array($state, $workflowStates[$workflow])) {
$workflowStates[$workflow][] = $state;
}
}
}
return $workflowStates;
}
Workflow_Form_GridStateFilter::init |
( |
| ) |
|
Initialize workflow states form.
{
$this->setName('workflow')
->setOrder(17);
$this->addElement(
'Select',
'targetState',
array(
'label' => 'Workflow',
'multiOptions' => array(
'current' => 'Current Status',
'scheduled' => 'Scheduled Status',
'either' => 'Current or Scheduled Status'
),
'autoApply' => true
)
);
$this->addElement(
'Radio',
'workflow',
array(
'multiOptions' => array(
'' => 'Any State',
static::OPTION_ONLY_PUBLISHED => 'Published Content',
static::OPTION_ONLY_UNPUBLISHED => 'Unpublished Content',
static::OPTION_USER_SELECTED => 'Specific Workflow States'
),
'autoApply' => true,
'value' => '',
'onClick' => ""
. "if (this.value == '" . static::OPTION_USER_SELECTED . "') {\n"
. " p4cms.ui.show('fieldset-workflowStates');\n"
. "} else {\n"
. " p4cms.ui.hide('fieldset-workflowStates');\n"
. "}"
)
);
$this->addElement(
'NestedCheckbox',
'states',
array(
'multiOptions' => $this->_getWorkflowStatesOptions(),
'autoApply' => true,
'onClick' => "
if (this.value.slice(-2) == '/*') {
p4cms.ui.toggleChildCheckboxes(this);
} else {
p4cms.ui.toggleParentCheckbox(this);
}
"
)
);
$this->addDisplayGroup(
array('states'),
'workflowStates',
array('class' => 'workflow-states hidden')
);
}
Member Data Documentation
The documentation for this class was generated from the following file: