Example #1
0
 protected function processBeforeAction($actionName)
 {
     parent::processBeforeAction($actionName);
     if (!CBPDocument::canUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $this->getUser()->getID(), $this->arResult['DOCUMENT_DATA']['DISK']['DOCUMENT_ID'], array())) {
         $this->showAccessDenied();
         return false;
     }
     return true;
 }
Example #2
0
 /**
  * Common operations before run action.
  */
 protected function processBeforeAction($actionName)
 {
     parent::processBeforeAction($actionName);
     $this->initializeStorage();
     $bodyClass = $this->getApplication()->getPageProperty("BodyClass");
     $bodyClass = $bodyClass . " page-one-column";
     $this->getApplication()->setPageProperty("BodyClass", $bodyClass);
     return true;
 }
Example #3
0
 protected function processBeforeAction($actionName)
 {
     parent::processBeforeAction($actionName);
     if (strlen($this->arParams['STORAGE_ID']) <= 0) {
         ShowError(Loc::getMessage('ACCESS_DENIED') . ' ' . Loc::getMessage('BIZPROC_WFEDIT_ERROR_TYPE'));
         return false;
     }
     if ($this->arResult['ID'] > 0) {
         $templatesList = CBPWorkflowTemplateLoader::getList(array(), array('ID' => $this->arResult['ID']));
         if ($template = $templatesList->fetch()) {
             if (!CBPDocument::canUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $this->getUser()->getID(), $template['DOCUMENT_TYPE'])) {
                 $this->showAccessDenied();
                 return false;
             }
             $this->arResult['TEMPLATE_NAME'] = $template['NAME'];
             $this->arResult['TEMPLATE_DESC'] = $template['DESCRIPTION'];
             $this->arResult['TEMPLATE_AUTOSTART'] = $template['AUTO_EXECUTE'];
             $this->arResult['TEMPLATE'] = $template['TEMPLATE'];
             $this->arResult['PARAMETERS'] = $template['PARAMETERS'];
             $this->arResult['VARIABLES'] = $template['VARIABLES'];
             $this->arResult['CONSTANTS'] = $template['CONSTANTS'];
         } else {
             $this->arResult['ID'] = 0;
         }
         if ($template["ENTITY"] == Bitrix\Disk\BizProcDocument::className()) {
             $this->arResult['DOCUMENT_COMPLEX_TYPE'] = \Bitrix\Disk\BizProcDocument::generateDocumentComplexType($this->arParams['STORAGE_ID']);
             $this->arResult['ENTITY'] = $template['ENTITY'];
         } else {
             $this->arResult['DOCUMENT_COMPLEX_TYPE'] = \Bitrix\Disk\BizProcDocumentCompatible::generateDocumentComplexType($this->arParams['STORAGE_ID']);
             $this->arResult['ENTITY'] = $template['ENTITY'];
         }
     } else {
         $this->arResult['ENTITY'] = Bitrix\Disk\BizProcDocument::className();
         $this->arResult['DOCUMENT_COMPLEX_TYPE'] = \Bitrix\Disk\BizProcDocument::generateDocumentComplexType($this->arParams['STORAGE_ID']);
         if (!CBPDocument::canUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $this->getUser()->getID(), $this->arResult['DOCUMENT_COMPLEX_TYPE'])) {
             $this->showAccessDenied();
             return false;
         }
         $this->arResult['TEMPLATE_NAME'] = Loc::getMessage("BIZPROC_WFEDIT_DEFAULT_TITLE");
         $this->arResult['TEMPLATE_DESC'] = '';
         $this->arResult['TEMPLATE_AUTOSTART'] = 1;
         $this->arResult['PARAMETERS'] = array();
         $this->arResult['VARIABLES'] = array();
         $this->arResult['CONSTANTS'] = array();
         if ($this->request->getQuery('init') == 'statemachine') {
             $this->arResult['TEMPLATE'] = array(array('Type' => 'StateMachineWorkflowActivity', 'Name' => 'Template', 'Properties' => array(), 'Children' => array()));
         } else {
             $this->arResult['TEMPLATE'] = array(array('Type' => 'SequentialWorkflowActivity', 'Name' => 'Template', 'Properties' => array(), 'Children' => array()));
         }
     }
     return true;
 }
Example #4
0
 protected function prepareParams()
 {
     parent::prepareParams();
     if (isset($this->arParams['BREADCRUMBS_ID']) && $this->arParams['BREADCRUMBS_ID'] !== '') {
         $this->arParams['BREADCRUMBS_ID'] = preg_replace('/[^a-z0-9_]/i', '', $this->arParams['BREADCRUMBS_ID']);
     } else {
         $this->arParams['BREADCRUMBS_ID'] = 'breadcrumbs_' . strtolower(randString(5));
     }
     if (!isset($this->arParams['SHOW_ONLY_DELETED'])) {
         $this->arParams['SHOW_ONLY_DELETED'] = false;
     }
     if (!isset($this->arParams['BREADCRUMBS'])) {
         $this->arParams['BREADCRUMBS'] = array();
     }
     return $this;
 }
Example #5
0
 protected function prepareParams()
 {
     parent::prepareParams();
     if (empty($this->arParams['BUTTONS']) || !is_array($this->arParams['BUTTONS'])) {
         $this->arParams['BUTTONS'] = array();
     }
     if (isset($this->arParams['TOOLBAR_ID']) && $this->arParams['TOOLBAR_ID'] !== '') {
         $this->arParams['TOOLBAR_ID'] = preg_replace('/[^a-z0-9_]/i', '', $this->arParams['TOOLBAR_ID']);
     } else {
         $this->arParams['TOOLBAR_ID'] = 'toolbar_' . strtolower(randString(5));
     }
     if (empty($this->arParams['DROPDOWN_FILTER']) || !is_array($this->arParams['DROPDOWN_FILTER'])) {
         $this->arParams['DROPDOWN_FILTER'] = null;
         $this->arParams['DROPDOWN_FILTER_CURRENT_LABEL'] = null;
     }
     if (empty($this->arParams['CLASS_NAME'])) {
         $this->arParams['CLASS_NAME'] = '';
     }
     return $this;
 }
Example #6
0
 /**
  * Processes operations before runs action.
  * @param string $actionName Action name which will run.
  * @return bool
  */
 protected function processBeforeAction($actionName)
 {
     parent::processBeforeAction($actionName);
     $this->initializeStorage();
     $this->getApplication()->setPageProperty('BodyClass', $this->getApplication()->getPageProperty('BodyClass') . ' page-one-column');
     return true;
 }