public function checkState() {
     $data = getEndAction($this->workflowTemplateSettings['endaction']);
     if($data[1] == 1) {
         return 1;
     }
     else {
         return 0;
     }
 }
Example #2
0
    /**
     * Load all data, wich is needed to fill out an workflow
     * generalData like sender, creation date is loaded
     * slotData, all slots to fill out
     * workflowAttachment, load public attachments
     * userData: tree on left side, to show current process
     * showName: flag if users can be shown in the left side or not
     *
     * @param sfWebRequest $request
     * @return <type>
     */
    public function executeLoadWorkflowData(sfWebRequest $request) {
        sfLoader::loadHelpers('EndAction');
        $detailsObj = new WorkflowDetail();
        $detailsObj->setUser($this->getUser());
        $detailsObj->setCulture($this->getUser()->getCulture());
        $detailsObj->setContext($this->getContext());
        $workflowsettings = WorkflowVersionTable::instance()->getWorkflowVersionById($request->getParameter('versionid'));
        $generalData = $detailsObj->buildHeadLine($workflowsettings);
        $attachments = $detailsObj->buildAttachments($workflowsettings, $request->getParameter('versionid'));
        $userData = $detailsObj->buildUserData($workflowsettings, $request->getParameter('versionid'));
        $workflowDecission = WorkflowTemplateTable::instance()->getWorkflowTemplateById($workflowsettings[0]->getWorkflowtemplateId())->toArray();        
        $endAction = getEndAction($workflowDecission[0]['endaction']);

        $slotObj = new WorkflowEdit();
        $slotObj->setUser($this->getUser());
        $slotObj->setCulture($this->getUser()->getCulture());
        $slotObj->setContext($this->getContext());
        $slotData = $slotObj->buildSlots($workflowsettings, $request->getParameter('versionid'));
        
        $this->renderText('{"generalData":'.json_encode($generalData).',"slotData":'.json_encode($slotData).', "workflowAttachment" : '.json_encode($attachments).', "userData" : '.json_encode($userData).',"showName": '.$endAction[0].'}');
        return sfView::NONE;
    }
    public function checkEndAction() {
        sfLoader::loadHelpers('EndAction');
        $data = getEndAction($this->workflowversion[0]['endaction']);
        if($data[0] == 1) { // send notification when workflow is completed
            $email = new SendWorkflowCompleted($this->workflowversion[0], $this->workflow[0]['id']);
        }
        if($data[2] == 1) { // archive workflow
            WorkflowTemplateTable::instance()->archiveWorkflow($this->workflowversion[0]['id']);
        }

        if($data[3] == 1) { // delete workflow
            WorkflowTemplateTable::instance()->deleteWorkflow($this->workflowversion[0]['id']);
        }
    }