コード例 #1
0
 public function getDecission (WorkflowSlotUser $user, $templateversion_id) {
     $result = array();
     $a = 0;
     $processUsers = WorkflowProcessUserTable::instance()->getProcessUserByWorkflowSlotUserId($user->getId());
     foreach($processUsers as $processUser) {
         $result[$a] = $processUser->toArray();
         $result[$a]['received'] = format_date($result[$a]['inprogresssince'], 'g', $this->culture);
         $result[$a]['decission_id'] = $result[$a]['id'];
         $result[$a]['endreasion'] = '';
         $result[$a]['useragent_id'] = $result[$a]['user_id'];
         $result[$a]['isuseragentof'] = $result[$a]['isuseragentof'];
         $usersettings = $this->user->getAttribute('userSettings');
         $inProgress = createDayOutOfDateSince(date('Y-m-d', $result[$a]['inprogresssince']));
         $inProgress = addColor($inProgress, $usersettings['markred'],$usersettings['markorange'],$usersettings['markyellow']);
         $result[$a]['inprogresssince'] = '<table><tr><td width="20">' . $inProgress . ' </td><td>' . $this->context->getI18N()->__('Days' ,null,'workflowmanagement') . '</td></tr></table>';
         $result[$a]['decissioninwords'] = '<table><tr><td>'.AddStateIcon($result[$a]['decissionstate']).'</td><td>' . $this->context->getI18N()->__($result[$a]['decissionstate'],null,'workflowmanagement') . '</td></tr></table>';
         if($result[$a]['decissionstate'] == 'STOPPEDBYADMIN') {
             $result[$a]['inprogresssince'] = '-';
         }
         elseif($result[$a]['decissionstate'] == 'STOPPEDBYUSER') {
             $endReasion = WorkflowVersionTable::instance()->getWorkflowVersionById($templateversion_id);
             $result[$a]['endreasion'] = $endReasion[0]->getEndreason();
         }
         $a++;
     }
     return $result;
 }
コード例 #2
0
    public function buildData(Doctrine_Collection $data, $counter) {
        $result = array();
        $a = 0;
        $counter++;
        $authSettings = new CreateWorkflowAuthorizationRights();
        $authSettings->setDefaultRole();
        $authSettings->setUserRole($this->userId);
        $userSettings = $this->user->getAttribute('userSettings');
        foreach($data as $item) {
            $sender = UserLoginTable::instance()->findActiveUserById($item->getSenderId());
            $mailinglist = MailinglistTemplateTable::instance()->getMailinglistByVersionId($item->getMailinglisttemplateversionId());
            $inProgress = createDayOutOfDateSince($item->getVersioncreatedAt());
            $inProgress = addColor($inProgress, $userSettings['markred'],$userSettings['markorange'],$userSettings['markyellow']);
            $userdata = $sender[0]->getUserData()->toArray();
            $username = $sender[0]->getUsername() . ' (' . $userdata['firstname'] . ' ' . $userdata['lastname'] . ')';
            $result[$a]['#'] = $counter++;;
            $result[$a]['id'] = $item->getId();
            $result[$a]['mailinglisttemplate_id'] = $item->getMailinglisttemplateversionId();
            $result[$a]['mailinglisttemplate'] = $mailinglist[0]->getName();
            $result[$a]['sender_id'] = $item->getSenderId();
            $result[$a]['sendername'] = $username;
            
            $result[$a]['name'] = $item->getName();
            $result[$a]['isstopped'] = $item->getIsstopped();
            $result[$a]['process'] = $this->getProcess($item->getActiveversionId());
            $result[$a]['auth'] = $authSettings->getRights($item->getMailinglisttemplateversionId(), $item->getActiveversionId());
            if($item->getIscompleted() == 0 OR $item->getIscompleted() == '') {
                 $result[$a]['iscompleted'] = 0;
            }
            else {
                $result[$a]['iscompleted'] = 1;
                $result[$a]['process'] = '<div style="background-color:#00FF00; width:100px;">100 %'.'</div>';
            }

            $result[$a]['workflowisstarted'] = $item->getWorkflowisstarted();
            if($item->getIsstopped() == 1) {
                $result[$a]['currentstation'] = '<table><tr><td width="16"><img src="/images/icons/circ_stop.gif" /></td><td>'.$this->context->getI18N()->__('Workflow stopped' ,null,'workflowmanagement').'</td></tr></table>';
                $result[$a]['currentlyrunning'] = '-';
                $result[$a]['stationrunning'] = '-';
               // $result[$a]['process'] = '-';
            }
            elseif($item->getIscompleted() == 1) {
                $result[$a]['currentstation'] = '<table><tr><td width="16"><img src="/images/icons/circ_done.gif" /></td><td>'.$this->context->getI18N()->__('Workflow completed' ,null,'workflowmanagement').'</td></tr></table>';
                $result[$a]['currentlyrunning'] = '-';
                $result[$a]['stationrunning'] = '-';
            }
            elseif($item->getWorkflowisstarted() == 0) {
                $startdateofWorkflow = date('Y-m-d',$item->getStartworkflowAt());
                $startdateofWorkflow = format_date($startdateofWorkflow, 'p', $this->culture);
                $result[$a]['currentstation'] = '<table><tr><td width="16"><img src="/images/icons/circ_waiting.gif" /></td><td>'.$this->context->getI18N()->__('Startdate' ,null,'workflowmanagement').': '.$startdateofWorkflow.'</td></tr></table>';
                $result[$a]['currentlyrunning'] = '-';
                $result[$a]['stationrunning'] = '-';
            }
            else {
                $stationSettings =  $this->getCurrentStation($item->getActiveversionId(), $item->getSenderId());
                if(!empty($stationSettings)) {
                    $result[$a]['currentstation'] = $stationSettings[0];
                    $result[$a]['currentlyrunning'] = '<table><tr><td width="20">' . $inProgress . ' </td><td>' . $this->context->getI18N()->__('Day(s)' ,null,'workflowmanagement') . '</td></tr></table>';
                    $slotRunning = createDayOutOfDateSince($stationSettings[1]);
                    $slotRunning = addColor($slotRunning, $userSettings['markred'],$userSettings['markorange'],$userSettings['markyellow']);
                    $result[$a]['stationrunning'] = '<table><tr><td width="20">' . $slotRunning . ' </td><td>' . $this->context->getI18N()->__('Day(s)' ,null,'workflowmanagement') . '</td></tr></table>';
                }
                else {
                    $result[$a]['currentstation'] = '-';
                    $result[$a]['currentlyrunning'] = '-';
                    $result[$a]['stationrunning'] = '-';
                }
            }

            if($item->getIsarchived() == 1) {
                $result[$a]['currentstation'] = '<table><tr><td width="16"><img src="/images/icons/circ_archived.gif" /></td><td>'.$this->context->getI18N()->__('Workflow archived' ,null,'workflowmanagement').'</td></tr></table>';
                $result[$a]['currentlyrunning'] = '-';
                $result[$a]['stationrunning'] = '-';
            }


            $result[$a]['userdefined1'] = $this->getFields('userdefined1',$item->getActiveversionId());
            $result[$a]['userdefined2'] = $this->getFields('userdefined2',$item->getActiveversionId());

            $result[$a]['versioncreated_at'] = format_date($item->getVersioncreatedAt(), 'g', $this->culture);   
            $result[$a++]['activeversion_id'] = $item->getActiveversionId();
        }
        #print_r ($result);die;
        return $result;

    }