当前位置: 首页>>代码示例>>PHP>>正文


PHP VTTaskManager::getTasksForWorkflow方法代码示例

本文整理汇总了PHP中VTTaskManager::getTasksForWorkflow方法的典型用法代码示例。如果您正苦于以下问题:PHP VTTaskManager::getTasksForWorkflow方法的具体用法?PHP VTTaskManager::getTasksForWorkflow怎么用?PHP VTTaskManager::getTasksForWorkflow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VTTaskManager的用法示例。


在下文中一共展示了VTTaskManager::getTasksForWorkflow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: queueScheduledWorkflowTasks

 public function queueScheduledWorkflowTasks()
 {
     global $default_timezone;
     $adb = $this->db;
     $vtWorflowManager = new VTWorkflowManager($adb);
     $taskQueue = new VTTaskQueue($adb);
     $entityCache = new VTEntityCache($this->user);
     // set the time zone to the admin's time zone, this is needed so that the scheduled workflow will be triggered
     // at admin's time zone rather than the systems time zone. This is specially needed for Hourly and Daily scheduled workflows
     $admin = Users::getActiveAdminUser();
     $adminTimeZone = $admin->time_zone;
     @date_default_timezone_set($adminTimeZone);
     $currentTimestamp = date("Y-m-d H:i:s");
     @date_default_timezone_set($default_timezone);
     $scheduledWorkflows = $vtWorflowManager->getScheduledWorkflows($currentTimestamp);
     $noOfScheduledWorkflows = count($scheduledWorkflows);
     foreach ($scheduledWorkflows as $workflow) {
         $tm = new VTTaskManager($adb);
         $tasks = $tm->getTasksForWorkflow($workflow->id);
         if ($tasks) {
             $records = $this->getEligibleWorkflowRecords($workflow);
             $noOfRecords = count($records);
             for ($j = 0; $j < $noOfRecords; ++$j) {
                 $recordId = $records[$j];
                 // We need to pass proper module name to get the webservice
                 if ($workflow->moduleName == 'Calendar') {
                     $moduleName = vtws_getCalendarEntityType($recordId);
                 } else {
                     $moduleName = $workflow->moduleName;
                 }
                 $wsEntityId = vtws_getWebserviceEntityId($moduleName, $recordId);
                 $entityData = $entityCache->forId($wsEntityId);
                 $data = $entityData->getData();
                 foreach ($tasks as $task) {
                     if ($task->active) {
                         $trigger = $task->trigger;
                         if ($trigger != null) {
                             $delay = strtotime($data[$trigger['field']]) + $trigger['days'] * 86400;
                         } else {
                             $delay = 0;
                         }
                         if ($task->executeImmediately == true) {
                             if (empty($task->test) or $task->evaluate($entityCache, $entityData->getId())) {
                                 $task->doTask($entityData);
                             }
                         } else {
                             $taskQueue->queueTask($task->id, $entityData->getId(), $delay);
                         }
                     }
                 }
             }
         }
         $vtWorflowManager->updateNexTriggerTime($workflow);
     }
     $scheduledWorkflows = null;
 }
开发者ID:kikojover,项目名称:corebos,代码行数:56,代码来源:WorkFlowScheduler.php

示例2: vtWorkflowEdit

function vtWorkflowEdit($adb, $request, $requestUrl, $current_language, $app_strings)
{
    global $theme;
    $util = new VTWorkflowUtils();
    $image_path = "themes/{$theme}/images/";
    $module = new VTWorkflowApplication("editworkflow");
    $mod = return_module_language($current_language, $module->name);
    if (!$util->checkAdminAccess()) {
        $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
        $util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
        return;
    }
    $smarty = new vtigerCRM_Smarty();
    if ($request['source'] == 'from_template') {
        $tm = new VTWorkflowTemplateManager($adb);
        $template = $tm->retrieveTemplate($request['template_id']);
        $workflow = $tm->createWorkflow($template);
    } else {
        $wfs = new VTWorkflowManager($adb);
        if (isset($request["workflow_id"])) {
            $workflow = $wfs->retrieve($request["workflow_id"]);
        } else {
            $moduleName = $request["module_name"];
            $workflow = $wfs->newWorkflow($moduleName);
        }
    }
    if ($workflow == null) {
        $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_WORKFLOW']);
        $util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_WORKFLOW']);
        return;
    }
    $workflow->test = addslashes($workflow->test);
    $tm = new VTTaskManager($adb);
    $tasks = $tm->getTasksForWorkflow($workflow->id);
    $smarty->assign("tasks", $tasks);
    $taskTypes = $tm->getTaskTypes($workflow->moduleName);
    $smarty->assign("taskTypes", $taskTypes);
    $smarty->assign("newTaskReturnUrl", vtlib_purify($requestUrl));
    $smarty->assign("returnUrl", vtlib_purify($request["return_url"]));
    $smarty->assign("APP", $app_strings);
    $smarty->assign("MOD", array_merge(return_module_language($current_language, 'Settings'), return_module_language($current_language, $module->name)));
    $smarty->assign("THEME", $theme);
    $smarty->assign("IMAGE_PATH", $image_path);
    $smarty->assign("MODULE_NAME", $module->label);
    $smarty->assign("PAGE_NAME", $mod['LBL_EDIT_WORKFLOW']);
    $smarty->assign("PAGE_TITLE", $mod['LBL_EDIT_WORKFLOW_TITLE']);
    $smarty->assign("workflow", $workflow);
    $smarty->assign("saveType", isset($workflow->id) ? "edit" : "new");
    $smarty->assign("module", $module);
    $smarty->assign("WORKFLOW_TRIGGER_TYPES_HELP_LINK", WORKFLOW_TRIGGER_TYPES);
    $smarty->display("{$module->name}/EditWorkflow.tpl");
}
开发者ID:mslokhat,项目名称:corebos,代码行数:52,代码来源:editworkflow.php

示例3: getAllForWorkflow

 public static function getAllForWorkflow($workflowModel, $active = false)
 {
     $db = PearDatabase::getInstance();
     $tm = new VTTaskManager($db);
     $tasks = $tm->getTasksForWorkflow($workflowModel->getId());
     $taskModels = array();
     foreach ($tasks as $task) {
         if (!$active || $task->active == self::TASK_STATUS_ACTIVE) {
             $taskModels[$task->id] = self::getInstanceFromTaskObject($task, $workflowModel, $tm);
         }
     }
     return $taskModels;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:13,代码来源:TaskRecord.php

示例4: queueScheduledWorkflowTasks

 public function queueScheduledWorkflowTasks()
 {
     global $default_timezone;
     $adb = $this->db;
     $vtWorflowManager = new VTWorkflowManager($adb);
     $entityCache = new VTEntityCache($this->user);
     // set the time zone to the admin's time zone, this is needed so that the scheduled workflow will be triggered
     // at admin's time zone rather than the systems time zone. This is specially needed for Hourly and Daily scheduled workflows
     $admin = Users::getActiveAdminUser();
     $adminTimeZone = $admin->time_zone;
     @date_default_timezone_set($adminTimeZone);
     $currentTimestamp = date("Y-m-d H:i:s");
     @date_default_timezone_set($default_timezone);
     $scheduledWorkflows = $vtWorflowManager->getScheduledWorkflows($currentTimestamp);
     $noOfScheduledWorkflows = count($scheduledWorkflows);
     for ($i = 0; $i < $noOfScheduledWorkflows; ++$i) {
         $workflow = $scheduledWorkflows[$i];
         if ($workflow->active != 1) {
             continue;
         }
         $tm = new VTTaskManager($adb);
         $tasks = $tm->getTasksForWorkflow($workflow->id);
         if ($tasks) {
             $records = $this->getEligibleWorkflowRecords($workflow);
             $noOfRecords = count($records);
             for ($j = 0; $j < $noOfRecords; ++$j) {
                 $recordId = $records[$j];
                 // We need to pass proper module name to get the webservice
                 if ($workflow->moduleName == 'Calendar') {
                     $moduleName = vtws_getCalendarEntityType($recordId);
                 } else {
                     $moduleName = $workflow->moduleName;
                 }
                 $wsEntityId = vtws_getWebserviceEntityId($moduleName, $recordId);
                 $entityData = $entityCache->forId($wsEntityId);
                 $tm->performTasks($entityData, false);
             }
         }
         $vtWorflowManager->updateNexTriggerTime($workflow);
     }
     $scheduledWorkflows = null;
 }
开发者ID:Wasage,项目名称:werpa,代码行数:42,代码来源:WorkFlowScheduler.php

示例5: vtWorkflowEdit

function vtWorkflowEdit($adb, $request, $requestUrl, $current_language, $app_strings)
{
    global $theme, $current_user;
    $util = new VTWorkflowUtils();
    $image_path = "themes/{$theme}/images/";
    $module = new VTWorkflowApplication("editworkflow");
    $mod = return_module_language($current_language, $module->name);
    if (!$util->checkAdminAccess()) {
        $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
        $util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
        return;
    }
    $smarty = new vtigerCRM_Smarty();
    if ($request['source'] == 'from_template') {
        $tm = new VTWorkflowTemplateManager($adb);
        $template = $tm->retrieveTemplate($request['template_id']);
        $workflow = $tm->createWorkflow($template);
    } else {
        $wfs = new VTWorkflowManager($adb);
        if (isset($request["workflow_id"])) {
            $workflow = $wfs->retrieve($request["workflow_id"]);
        } else {
            $moduleName = $request["module_name"];
            $workflow = $wfs->newWorkflow($moduleName);
        }
        $smarty->assign('ScheduledWorkflowsCount', $wfs->getScheduledWorkflowsCount());
        $smarty->assign('MaxAllowedScheduledWorkflows', $wfs->getMaxAllowedScheduledWorkflows());
        $smarty->assign('schdtime_12h', date('h:ia', strtotime(substr($workflow->schtime, 0, strrpos($workflow->schtime, ':')))));
        $schannualdates = json_decode($workflow->schannualdates);
        if (count($schannualdates) > 0) {
            $schannualdates = DateTimeField::convertToUserFormat($schannualdates[0]);
        } else {
            $schannualdates = '';
        }
        $smarty->assign('schdate', $schannualdates);
        $smarty->assign('selected_days1_31', json_decode($workflow->schdayofmonth));
        $smarty->assign('dayOfWeek', json_decode($workflow->schdayofweek));
    }
    if ($workflow == null) {
        $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_WORKFLOW']);
        $util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_WORKFLOW']);
        return;
    }
    $workflow->test = addslashes($workflow->test);
    $tm = new VTTaskManager($adb);
    $tasks = $tm->getTasksForWorkflow($workflow->id);
    $smarty->assign("tasks", $tasks);
    $taskTypes = $tm->getTaskTypes($workflow->moduleName);
    $smarty->assign("taskTypes", $taskTypes);
    $smarty->assign("newTaskReturnUrl", vtlib_purify($requestUrl));
    $dayrange = array();
    for ($d = 1; $d <= 31; $d++) {
        $dayrange[$d] = $d;
    }
    $smarty->assign('days1_31', $dayrange);
    $smarty->assign('wfnexttrigger_time', DateTimeField::convertToUserFormat($workflow->nexttrigger_time));
    $smarty->assign("dateFormat", parse_calendardate($current_user->date_format));
    $smarty->assign("returnUrl", vtlib_purify($request["return_url"]));
    $smarty->assign("APP", $app_strings);
    $smarty->assign("MOD", array_merge(return_module_language($current_language, 'Settings'), return_module_language($current_language, $module->name)));
    $smarty->assign("THEME", $theme);
    $smarty->assign("IMAGE_PATH", $image_path);
    $smarty->assign("MODULE_NAME", $module->label);
    $smarty->assign("PAGE_NAME", $mod['LBL_EDIT_WORKFLOW']);
    $smarty->assign("PAGE_TITLE", $mod['LBL_EDIT_WORKFLOW_TITLE']);
    $smarty->assign("workflow", $workflow);
    $smarty->assign("saveType", isset($workflow->id) ? "edit" : "new");
    $smarty->assign("module", $module);
    $smarty->assign("WORKFLOW_TRIGGER_TYPES_HELP_LINK", WORKFLOW_TRIGGER_TYPES);
    $smarty->display("{$module->name}/EditWorkflow.tpl");
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:71,代码来源:editworkflow.php

示例6: VALUES

    Migration_Index_View::ExecuteQuery('INSERT INTO vtiger_currencies (currencyid,currency_name,currency_code,currency_symbol) VALUES (' . $adb->getUniqueID("vtiger_currencies") . ',"Sudanese Pound","SDG","£")', array());
    Vtiger_Utils::AddColumn('vtiger_mailmanager_mailattachments', 'cid', 'VARCHAR(100)');
}
//73 ends
//74 starts
//Start: Moving Entity methods of Tickets to Workflows
$result = $adb->pquery('SELECT DISTINCT workflow_id FROM com_vtiger_workflowtasks WHERE workflow_id IN
                                (SELECT workflow_id FROM com_vtiger_workflows WHERE module_name IN (?) AND defaultworkflow = ?)
                                AND task LIKE ?', array($moduleName, 1, '%VTEntityMethodTask%'));
$numOfRows = $adb->num_rows($result);
for ($i = 0; $i < $numOfRows; $i++) {
    $wfs = new VTWorkflowManager($adb);
    $workflowModel = $wfs->retrieve($adb->query_result($result, $i, 'workflow_id'));
    $workflowModel->filtersavedinnew = 6;
    $tm = new VTTaskManager($adb);
    $tasks = $tm->getTasksForWorkflow($workflowModel->id);
    foreach ($tasks as $task) {
        $properties = get_object_vars($task);
        $emailTask = new VTEmailTask();
        $emailTask->executeImmediately = 0;
        $emailTask->summary = $properties['summary'];
        $emailTask->active = $properties['active'];
        switch ($properties['methodName']) {
            case 'NotifyOnPortalTicketCreation':
                $conditions = Zend_Json::decode($workflowModel->test);
                $oldCondtions = array();
                if (!empty($conditions)) {
                    $previousConditionGroupId = 0;
                    foreach ($conditions as $condition) {
                        $fieldName = $condition['fieldname'];
                        $fieldNameContents = explode(' ', $fieldName);
开发者ID:lsmonki,项目名称:vtigercrm,代码行数:31,代码来源:600_to_610.php


注:本文中的VTTaskManager::getTasksForWorkflow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。