本文整理汇总了PHP中VTWorkflowManager::getScheduledWorkflows方法的典型用法代码示例。如果您正苦于以下问题:PHP VTWorkflowManager::getScheduledWorkflows方法的具体用法?PHP VTWorkflowManager::getScheduledWorkflows怎么用?PHP VTWorkflowManager::getScheduledWorkflows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VTWorkflowManager
的用法示例。
在下文中一共展示了VTWorkflowManager::getScheduledWorkflows方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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;
}