本文整理汇总了PHP中Workflow::getStagePermissions方法的典型用法代码示例。如果您正苦于以下问题:PHP Workflow::getStagePermissions方法的具体用法?PHP Workflow::getStagePermissions怎么用?PHP Workflow::getStagePermissions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workflow
的用法示例。
在下文中一共展示了Workflow::getStagePermissions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetStagePermissions
public function testGetStagePermissions()
{
$workflow = $this->workflows('workflow2');
$status = Workflow::getWorkflowStatus($workflow->id);
$permissions = Workflow::getStagePermissions($status);
// admin should have permissions for all stages
$this->assertTrue(!in_array(0, $permissions));
$this->assertTrue(TestingAuxLib::suLogin('testuser'));
$status = Workflow::getWorkflowStatus($workflow->id);
$permissions = Workflow::getStagePermissions($status);
X2_TEST_DEBUG_LEVEL > 1 && print_r($permissions);
// testuser does not have permission for stage 4
$this->assertFalse($permissions[3]);
$this->assertTrue(TestingAuxLib::suLogin('admin'));
}
示例2:
* You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
* California 95067, USA. or at email address contact@x2engine.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* X2Engine" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by X2Engine".
*****************************************************************************************/
/**
* Used by inline workflow widget to render the funnel
*/
if (AuxLib::isIE8()) {
Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl() . '/js/jqplot/excanvas.js');
}
if ($this->id !== 'Workflow') {
$assetsUrl = Yii::app()->assetManager->publish(Yii::getPathOfAlias('application.modules.workflow.assets'), false, -1, YII_DEBUG ? true : null);
} else {
$assetsUrl = $this->module->assetsUrl;
}
Yii::app()->clientScript->registerScriptFile($assetsUrl . '/js/X2Geometry.js', CClientScript::POS_END);
Yii::app()->clientScript->registerScriptFile($assetsUrl . '/js/BaseFunnel.js', CClientScript::POS_END);
Yii::app()->clientScript->registerScriptFile($assetsUrl . '/js/InlineFunnel.js', CClientScript::POS_END);
Yii::app()->clientScript->registerScript('_funnelJS', "\n\nx2.inlineFunnel = new x2.InlineFunnel ({\n workflowStatus: " . CJSON::encode($workflowStatus) . ",\n translations: " . CJSON::encode(array('Completed' => Yii::t('workflow', 'Completed'), 'Started' => Yii::t('workflow', 'Started'), 'Details' => Yii::t('workflow', 'Details'), 'Revert Stage' => Yii::t('workflow', 'Revert Stage'), 'Complete Stage' => Yii::t('workflow', 'Complete Stage'), 'Start' => Yii::t('workflow', 'Start'), 'noRevertPermissions' => Yii::t('workflow', 'You do not have permission to revert this stage.'), 'noCompletePermissions' => Yii::t('workflow', 'You do not have permission to complete this stage.'))) . ",\n stageCount: " . $stageCount . ",\n containerSelector: '#funnel-container',\n colors: " . CJSON::encode($colors) . ",\n revertButtonUrl: '" . Yii::app()->theme->getBaseUrl() . "/images/icons/Uncomplete.png',\n completeButtonUrl: '" . Yii::app()->theme->getBaseUrl() . "/images/icons/Complete.png',\n stageNames: " . CJSON::encode(Workflow::getStageNames($workflowStatus)) . ",\n stagePermissions: " . CJSON::encode(Workflow::getStagePermissions($workflowStatus)) . ",\n uncompletionPermissions: " . CJSON::encode(Workflow::getStageUncompletionPermissions($workflowStatus)) . ",\n stagesWhichRequireComments: " . CJSON::encode(Workflow::getStageCommentRequirements($workflowStatus)) . "\n});\n\n", CClientScript::POS_END);
?>
<div id='funnel-container'></div>
示例3: checkPermissions
/**
* This method is equivalent to the JS _checkPermissions method of DragAndDropViewManager
* @param int $stageA
* @param int $stageB
* @param array $workflowStatus
* @return bool true if user has permissions for all stages in range [$stageA, $stageB].
*/
private static function checkPermissions($stageA, $stageB = null, $workflowStatus)
{
$stagePermissions = Workflow::getStagePermissions($workflowStatus);
$hasPermission = true;
if ($stageB === null) {
return $stagePermissions[$stageA - 1];
}
$stageRange = array($stageA, $stageB);
sort($stageRange);
$hasPermission = array_reduce(array_slice($stagePermissions, $stageRange[0] - 1, $stageRange[1] - $stageRange[0] + 1), function ($a, $b) {
return $a & $b;
}, true);
return $hasPermission;
}
示例4: getDragAndDropViewParams
private function getDragAndDropViewParams($id, $users = '')
{
$model = $this->loadModel($id);
$modelType = isset($_GET['modelType']) ? self::parseModelType($_GET['modelType']) : '';
$dateRange = self::getDateRange();
$expectedCloseDateDateRange = self::getDateRange('expectedCloseDateStart', 'expectedCloseDateEnd', 'expectedCloseDateRange');
$memberListContainerSelectors = array();
$stageValues = Workflow::getStageValues($model, $users, $modelType, $dateRange, $expectedCloseDateDateRange);
$stageCount = count($model->stages);
for ($i = 1; $i <= $stageCount; $i++) {
$memberListContainerSelectors[] = '#workflow-stage-' . $i . ' .items';
}
$workflowStatus = Workflow::getWorkflowStatus($id);
$stagePermissions = Workflow::getStagePermissions($workflowStatus);
$stagesWhichRequireComments = Workflow::getStageCommentRequirements($workflowStatus);
$stageNames = Workflow::getStageNames($workflowStatus);
$colors = $model->getWorkflowStageColors($stageCount, true);
return array('model' => $model, 'modelType' => $modelType, 'dateRange' => $dateRange, 'expectedCloseDateDateRange' => $expectedCloseDateDateRange, 'users' => $users, 'colors' => $colors, 'listItemColors' => Workflow::getPipelineListItemColors($colors), 'memberListContainerSelectors' => $memberListContainerSelectors, 'stagePermissions' => $stagePermissions, 'stagesWhichRequireComments' => $stagesWhichRequireComments, 'stageNames' => $stageNames, 'stageValues' => $stageValues);
}
示例5: getDragAndDropViewParams
private function getDragAndDropViewParams($id, $users = '')
{
$model = $this->loadModel($id);
if (isset($_GET['modelType'])) {
$modelType = $_GET['modelType'];
} elseif (!empty($model->financialModel)) {
if (X2Model::getModelName($model->financialModel)) {
$modelType = $model->financialModel;
} else {
$modelType = 'contacts';
}
} else {
$modelType = 'contacts';
}
$dateRange = self::getDateRange();
$memberListContainerSelectors = array();
$stageCount = count($model->stages);
for ($i = 1; $i <= $stageCount; $i++) {
$memberListContainerSelectors[] = '#workflow-stage-' . $i . ' .items';
}
$workflowStatus = Workflow::getWorkflowStatus($id);
$stagePermissions = Workflow::getStagePermissions($workflowStatus);
$stagesWhichRequireComments = Workflow::getStageCommentRequirements($workflowStatus);
$stageNames = Workflow::getStageNames($workflowStatus);
$colors = $model->getWorkflowStageColors($stageCount, true);
$stageCounts = Workflow::getStageCounts($workflowStatus, $dateRange, $users, $modelType);
$stageValues = Workflow::getStageValues($workflowStatus, $dateRange, $users, $modelType);
return array('model' => $model, 'modelType' => $modelType, 'dateRange' => $dateRange, 'users' => $users, 'colors' => $colors, 'listItemColors' => Workflow::getPipelineListItemColors($colors), 'memberListContainerSelectors' => $memberListContainerSelectors, 'stagePermissions' => $stagePermissions, 'stagesWhichRequireComments' => $stagesWhichRequireComments, 'stageNames' => $stageNames, 'stageCounts' => $stageCounts, 'stageValues' => $stageValues);
}