本文整理汇总了PHP中VTTaskManager::retrieveTask方法的典型用法代码示例。如果您正苦于以下问题:PHP VTTaskManager::retrieveTask方法的具体用法?PHP VTTaskManager::retrieveTask怎么用?PHP VTTaskManager::retrieveTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VTTaskManager
的用法示例。
在下文中一共展示了VTTaskManager::retrieveTask方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vtSaveTask
function vtSaveTask($adb, $request)
{
$util = new VTWorkflowUtils();
$module = new VTWorkflowApplication("savetask");
$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;
}
$tm = new VTTaskManager($adb);
if (isset($request["task_id"])) {
$task = $tm->retrieveTask($request["task_id"]);
} else {
$taskType = vtlib_purifyForSql($request["task_type"]);
$workflowId = $request["workflow_id"];
$task = $tm->createTask($taskType, $workflowId);
}
$task->summary = $request["summary"];
if ($request["active"] == "true") {
$task->active = true;
} else {
if ($request["active"] == "false") {
$task->active = false;
}
}
if (isset($request['check_select_date'])) {
$trigger = array('days' => ($request['select_date_direction'] == 'after' ? 1 : -1) * (int) $request['select_date_days'], 'field' => $request['select_date_field']);
$task->trigger = $trigger;
} else {
$task->trigger = null;
}
$fieldNames = $task->getFieldNames();
foreach ($fieldNames as $fieldName) {
$task->{$fieldName} = $request[$fieldName];
if ($fieldName == 'calendar_repeat_limit_date') {
$task->{$fieldName} = DateTimeField::convertToDBFormat($request[$fieldName]);
}
}
$tm->saveTask($task);
if (isset(vtlib_purify($request["return_url"]))) {
$returnUrl = vtlib_purify($request["return_url"]);
} else {
$returnUrl = $module->editTaskUrl($task->id);
}
?>
<script type="text/javascript" charset="utf-8">
window.location="<?php
echo $returnUrl;
?>
";
</script>
<a href="<?php
echo $returnUrl;
?>
">Return</a>
<?php
}
示例2: vtRunTaskJob
function vtRunTaskJob($adb)
{
$util = new VTWorkflowUtils();
$adminUser = $util->adminUser();
$tq = new VTTaskQueue($adb);
$readyTasks = $tq->getReadyTasks();
$tm = new VTTaskManager($adb);
foreach ($readyTasks as $pair) {
list($taskId, $entityId) = $pair;
$task = $tm->retrieveTask($taskId);
$entity = new VTWorkflowEntity($adminUser, $entityId);
$task->doTask($entity);
}
}
示例3: vtTaskEdit
function vtTaskEdit($adb, $request, $current_language, $app_strings)
{
global $theme;
$util = new VTWorkflowUtils();
$image_path = "themes/{$theme}/images/";
$module = new VTWorkflowApplication('edittask');
$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();
$tm = new VTTaskManager($adb);
$smarty->assign('edit', isset($request["task_id"]));
if (isset($request["task_id"])) {
$task = $tm->retrieveTask($request["task_id"]);
$workflowId = $task->workflowId;
} else {
$workflowId = $request["workflow_id"];
$taskClass = $request["task_type"];
$task = $tm->createTask($taskClass, $workflowId);
}
if ($task == null) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_TASK']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_TASK']);
return;
}
$wm = new VTWorkflowManager($adb);
$workflow = $wm->retrieve($workflowId);
if ($workflow == null) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_WORKFLOW']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_WORKFLOW']);
return;
}
$smarty->assign("workflow", $workflow);
$smarty->assign("returnUrl", $request["return_url"]);
$smarty->assign("task", $task);
$smarty->assign("taskType", $taskClass);
$smarty->assign("saveType", $request['save_type']);
$taskClass = get_class($task);
$smarty->assign("taskTemplate", "{$module->name}/taskforms/{$taskClass}.tpl");
$et = VTWSEntityType::usingGlobalCurrentUser($workflow->moduleName);
$smarty->assign("entityType", $et);
$smarty->assign('entityName', $workflow->moduleName);
$smarty->assign("fieldNames", $et->getFieldNames());
$dateFields = array();
$fieldTypes = $et->getFieldTypes();
$fieldLabels = $et->getFieldLabels();
foreach ($fieldTypes as $name => $type) {
if ($type->type == 'Date' || $type->type == 'DateTime') {
$dateFields[$name] = $fieldLabels[$name];
}
}
$smarty->assign('dateFields', $dateFields);
if ($task->trigger != null) {
$trigger = $task->trigger;
$days = $trigger['days'];
if ($days < 0) {
$days *= -1;
$direction = 'before';
} else {
$direction = 'after';
}
$smarty->assign('trigger', array('days' => $days, 'direction' => $direction, 'field' => $trigger['field']));
}
$curr_date = "(general : (__VtigerMeta__) date)";
$curr_time = '(general : (__VtigerMeta__) time)';
$smarty->assign("DATE", $curr_date);
$smarty->assign("TIME", $curr_time);
$smarty->assign("MOD", array_merge(return_module_language($current_language, 'Settings'), return_module_language($current_language, 'Calendar'), return_module_language($current_language, $module->name)));
$smarty->assign("APP", $app_strings);
$smarty->assign("dateFormat", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("THEME", $theme);
$smarty->assign("MODULE_NAME", $module->label);
$smarty->assign("PAGE_NAME", $mod['LBL_EDIT_TASK']);
$smarty->assign("PAGE_TITLE", $mod['LBL_EDIT_TASK_TITLE']);
$smarty->assign("module", $module);
$smarty->display("{$module->name}/EditTask.tpl");
}
示例4: foreach
foreach ($dateTimeFieldsList as $moduleName => $fieldNamesList) {
foreach ($fieldNamesList as $fieldName) {
$propertyValue = str_replace("({$moduleName}) {$fieldName}) {$timeZone}", "({$moduleName}) {$fieldName})", $propertyValue);
}
}
$emailTask->{$propertyName} = $propertyValue;
}
$tm->saveTask($emailTask);
}
$result = $adb->pquery('SELECT task_id FROM com_vtiger_workflowtasks WHERE workflow_id IN
(SELECT workflow_id FROM com_vtiger_workflows WHERE module_name IN (?, ?))
AND task LIKE ?', array('Calendar', 'Events', '%VTSendNotificationTask%'));
$numOfRowas = $adb->num_rows($result);
for ($i = 0; $i < $numOfRows; $i++) {
$tm = new VTTaskManager($adb);
$task = $tm->retrieveTask($adb->query_result($result, $i, 'task_id'));
$emailTask = new VTEmailTask();
$properties = get_object_vars($task);
foreach ($properties as $propertyName => $propertyValue) {
$propertyValue = str_replace('$date_start $time_start ( $(general : (__VtigerMeta__) usertimezone) ) ', '$date_start', $propertyValue);
$propertyValue = str_replace('$due_date $time_end ( $(general : (__VtigerMeta__) usertimezone) )', '$due_date', $propertyValue);
$propertyValue = str_replace('$due_date ( $(general : (__VtigerMeta__) usertimezone) )', '$due_date', $propertyValue);
$propertyValue = str_replace('$(contact_id : (Contacts) lastname) $(contact_id : (Contacts) firstname)', '$contact_id', $propertyValue);
$emailTask->{$propertyName} = $propertyValue;
}
$tm->saveTask($emailTask);
}
// $maxActionIdResult = $adb->pquery('SELECT MAX(actionid) AS maxid FROM vtiger_actionmapping', array());
// $maxActionId = $adb->query_result($maxActionIdResult, 0, 'maxid');
// Migration_Index_View::ExecuteQuery('INSERT INTO vtiger_actionmapping(actionid, actionname, securitycheck) VALUES(?,?,?)', array($maxActionId+1 ,'Print', '0'));
// echo "<br> added print to vtiger_actionnmapping";
示例5: vtTaskEdit
function vtTaskEdit($adb, $request, $current_language, $app_strings)
{
global $theme;
$util = new VTWorkflowUtils();
$request = vtlib_purify($request);
// this cleans all values of the array
$image_path = "themes/{$theme}/images/";
$module = new VTWorkflowApplication('edittask');
$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();
$tm = new VTTaskManager($adb);
$smarty->assign('edit', isset($request["task_id"]));
if (isset($request["task_id"])) {
$task = $tm->retrieveTask($request["task_id"]);
$taskClass = get_class($task);
$workflowId = $task->workflowId;
} else {
$workflowId = $request["workflow_id"];
$taskClass = vtlib_purifyForSql($request["task_type"]);
$task = $tm->createTask($taskClass, $workflowId);
}
if ($task == null) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_TASK']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_TASK']);
return;
}
$wm = new VTWorkflowManager($adb);
$workflow = $wm->retrieve($workflowId);
if ($workflow == null) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_WORKFLOW']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_WORKFLOW']);
return;
}
$smarty->assign("workflow", $workflow);
$smarty->assign("returnUrl", $request["return_url"]);
$smarty->assign("task", $task);
$smarty->assign("taskType", $taskClass);
$smarty->assign("saveType", $request['save_type']);
$taskTypeInstance = VTTaskType::getInstanceFromTaskType($taskClass);
$taskTemplateClass = $tm->retrieveTemplatePath($module->name, $taskTypeInstance);
$smarty->assign("taskTemplate", $taskTemplateClass);
$et = VTWSEntityType::usingGlobalCurrentUser($workflow->moduleName);
$smarty->assign("entityType", $et);
$smarty->assign('entityName', $workflow->moduleName);
$smarty->assign("fieldNames", $et->getFieldNames());
$repeat_date = $task->calendar_repeat_limit_date;
if (!empty($repeat_date)) {
$repeat_date = DateTimeField::convertToUserFormat($repeat_date);
}
$smarty->assign('REPEAT_DATE', $repeat_date);
$dateFields = array();
$fieldTypes = $et->getFieldTypes();
$fieldLabels = $et->getFieldLabels();
foreach ($fieldTypes as $name => $type) {
if ($type->type == 'Date' || $type->type == 'DateTime') {
$dateFields[$name] = $fieldLabels[$name];
}
}
$smarty->assign('dateFields', $dateFields);
if ($task->trigger != null) {
$trigger = $task->trigger;
$days = $trigger['days'];
if ($days < 0) {
$days *= -1;
$direction = 'before';
} else {
$direction = 'after';
}
$smarty->assign('trigger', array('days' => $days, 'direction' => $direction, 'field' => $trigger['field']));
}
$metaVariables = $task->getMetaVariables();
$date = new DateTimeField(null);
$time = substr($date->getDisplayTime(), 0, 5);
$smarty->assign("META_VARIABLES", $metaVariables);
$smarty->assign("SYSTEM_TIMEZONE", $db_timezone);
$smarty->assign("USER_TIME", $task->formatTimeForTimePicker($time));
$smarty->assign("USER_DATE", $date->getDisplayDate());
$smarty->assign("MOD", array_merge(return_module_language($current_language, 'Settings'), return_module_language($current_language, 'Calendar'), return_module_language($current_language, $module->name)));
$smarty->assign("APP", $app_strings);
$smarty->assign("dateFormat", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("THEME", $theme);
$smarty->assign("MODULE_NAME", $module->label);
$smarty->assign("PAGE_NAME", $mod['LBL_EDIT_TASK']);
$smarty->assign("PAGE_TITLE", $mod['LBL_EDIT_TASK_TITLE']);
$users = $group = array();
$users['user'] = get_user_array();
$users['group'] = get_group_array();
$smarty->assign('ASSIGNED_TO', $users);
$smarty->assign("module", $module);
$smarty->display("{$module->name}/EditTask.tpl");
}
示例6: array
$dateTimeFields = array();
foreach ($dateTimeFieldsList as $moduleName => $fieldNamesList) {
$dateTimeFields = array_merge($dateTimeFields, $fieldNamesList);
}
$taskIdsList = array();
$result = $adb->pquery('SELECT task_id, module_name FROM com_vtiger_workflowtasks
INNER JOIN com_vtiger_workflows ON com_vtiger_workflows.workflow_id = com_vtiger_workflowtasks.workflow_id
WHERE task LIKE ?', array('%VTEmailTask%'));
while ($rowData = $adb->fetch_array($result)) {
$taskIdsList[$rowData['task_id']] = $rowData['module_name'];
}
$dateFormat = '($_DATE_FORMAT_)';
$timeZone = '($(general : (__VtigerMeta__) usertimezone))';
foreach ($taskIdsList as $taskId => $taskModuleName) {
$tm = new VTTaskManager($adb);
$task = $tm->retrieveTask($taskId);
$emailTask = new VTEmailTask();
$properties = get_object_vars($task);
foreach ($properties as $propertyName => $propertyValue) {
$propertyValue = str_replace('$(general : (__VtigerMeta__) date)', "(general : (__VtigerMeta__) date) {$dateFormat}", $propertyValue);
foreach ($dateFields as $fieldName) {
if ($taskModuleName === 'Events' && $fieldName === 'due_date') {
continue;
}
$propertyValue = str_replace("\${$fieldName}", "\${$fieldName} {$dateFormat}", $propertyValue);
}
foreach ($dateTimeFields as $fieldName) {
if ($taskModuleName === 'Calendar' && $fieldName === 'due_date') {
continue;
}
$propertyValue = str_replace("\${$fieldName}", "\${$fieldName} {$timeZone}", $propertyValue);
示例7: getInstance
public static function getInstance($taskId, $workflowModel=null) {
$db = PearDatabase::getInstance();
$tm = new VTTaskManager($db);
$task = $tm->retrieveTask($taskId);
if($workflowModel == null) {
$workflowModel = Settings_Workflows_Record_Model::getInstance($task->workflowId);
}
return self::getInstanceFromTaskObject($task, $workflowModel, $tm);
}
示例8: saveActivityTask
function saveActivityTask($wf_task, $activity) {
global $adb;
require_once("modules/com_vtiger_workflow/VTTaskManager.inc");
$tm = new VTTaskManager($adb);
for ($i=0; $i<count($wf_task); $i++) {
$task_res = $adb->pquery("select task_id from com_vtiger_workflowtasks ".
"where summary = ?", array($wf_task[$i]));
if ($task_res) {
if ($adb->num_rows($task_res) > 0) {
$task_id = $adb->query_result($task_res, 0, 'task_id');
$task = $tm->retrieveTask($task_id);
$task->active = $activity;
$tm->saveTask($task);
}
}
}
}