本文整理汇总了PHP中VTWorkflowUtils类的典型用法代码示例。如果您正苦于以下问题:PHP VTWorkflowUtils类的具体用法?PHP VTWorkflowUtils怎么用?PHP VTWorkflowUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VTWorkflowUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vtDisplayWorkflowList
function vtDisplayWorkflowList($adb, $request, $requestUrl, $app_strings, $current_language)
{
global $theme;
$image_path = "themes/{$theme}/images/";
$module = new VTWorkflowApplication("workflowlist");
$util = new VTWorkflowUtils();
$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();
$wfs = new VTWorkflowManager($adb);
$smarty->assign("moduleNames", $util->vtGetModules($adb));
$smarty->assign("returnUrl", $requestUrl);
$listModule = $request['list_module'];
$smarty->assign("listModule", $listModule);
if ($listModule == null || strtolower($listModule) == "all") {
$smarty->assign("workflows", $wfs->getWorkflows());
} else {
$smarty->assign("workflows", $wfs->getWorkflowsForModule($listModule));
}
$smarty->assign("MOD", array_merge(return_module_language($current_language, 'Settings'), return_module_language($current_language, $module->name)));
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("MODULE_NAME", $module->label);
$smarty->assign("PAGE_NAME", $mod['LBL_WORKFLOW_LIST']);
$smarty->assign("PAGE_TITLE", $mod['LBL_AVAILABLE_WORKLIST_LIST']);
$smarty->assign("module", $module);
$smarty->assign('MODULE', $module->name);
$smarty->assign("CRON_TASK", Vtiger_Cron::getInstance('Workflow'));
$smarty->display("{$module->name}/ListWorkflows.tpl");
}
示例2: doTask
public function doTask($entity)
{
if (SMSNotifier::checkServer()) {
global $adb, $current_user, $log;
$util = new VTWorkflowUtils();
$admin = $util->adminUser();
$ws_id = $entity->getId();
$entityCache = new VTEntityCache($admin);
$et = new VTSimpleTemplate($this->sms_recepient);
$recepient = $et->render($entityCache, $ws_id);
$recepients = explode(',', $recepient);
$ct = new VTSimpleTemplate($this->content);
$content = $ct->render($entityCache, $ws_id);
$relatedCRMid = substr($ws_id, stripos($ws_id, 'x') + 1);
$relatedModule = $entity->getModuleName();
/** Pickup only non-empty numbers */
$tonumbers = array();
foreach ($recepients as $tonumber) {
if (!empty($tonumber)) {
$tonumbers[] = $tonumber;
}
}
SMSNotifier::sendsms($content, $tonumbers, $current_user->id, $relatedCRMid, $relatedModule);
}
}
示例3: vtDeleteWorkflow
function vtDeleteWorkflow($adb, $request)
{
$util = new VTWorkflowUtils();
$module = new VTWorkflowApplication("deltetask");
$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;
}
$wm = new VTTaskManager($adb);
$wm->deleteTask($request['task_id']);
if (isset($request["return_url"])) {
$returnUrl = vtlib_purify($request["return_url"]);
} else {
$returnUrl = $module->editWorkflowUrl($wf->id);
}
?>
<script type="text/javascript" charset="utf-8">
window.location="<?php
echo $returnUrl;
?>
";
</script>
<a href="<?php
echo $returnUrl;
?>
">Return</a>
<?php
}
示例4: vtDisplayTaskList
function vtDisplayTaskList($adb, $requestUrl, $current_language)
{
global $theme, $app_strings;
$image_path = "themes/{$theme}/images/";
$util = new VTWorkflowUtils();
$module = new VTWorkflowApplication("tasklist");
$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("tasks", $tm->getTasks());
$smarty->assign("moduleNames", array("Contacts", "Applications"));
$smarty->assign("taskTypes", array("VTEmailTask", "VTDummyTask"));
$smarty->assign("returnUrl", $requestUrl);
$smarty->assign("MOD", return_module_language($current_language, 'Settings'));
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("MODULE_NAME", $module->label);
$smarty->assign("PAGE_NAME", 'Task List');
$smarty->assign("PAGE_TITLE", 'List available tasks');
$smarty->assign("moduleName", $moduleName);
$smarty->display("{$module->name}/ListTasks.tpl");
}
示例5: vtSaveWorkflowTemplate
function vtSaveWorkflowTemplate($adb, $request)
{
$util = new VTWorkflowUtils();
$module = new VTWorkflowApplication("savetemplate");
$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;
}
$title = vtlib_purifyForSql($request['title']);
$workflowId = $request['workflow_id'];
$wfs = new VTworkflowManager($adb);
$workflow = $wfs->retrieve($workflowId);
$tm = new VTWorkflowTemplateManager($adb);
$tpl = $tm->newTemplate($title, $workflow);
$tm->saveTemplate($tpl);
$returnUrl = vtlib_purify($request['return_url']);
?>
<script type="text/javascript" charset="utf-8">
window.location="<?php
echo $returnUrl;
?>
";
</script>
<a href="<?php
echo $returnUrl;
?>
">Return</a>
<?php
}
示例6: handleEvent
function handleEvent($eventName, $data)
{
if ($eventName == 'vtiger.entity.beforesave') {
// Entity is about to be saved, take required action
}
if ($eventName == 'vtiger.entity.aftersave') {
$db = PearDatabase::getInstance();
$relatedToId = $data->get('related_to');
if ($relatedToId) {
$moduleName = getSalesEntityType($relatedToId);
$focus = CRMEntity::getInstance($moduleName);
$focus->retrieve_entity_info($relatedToId, $moduleName);
$focus->id = $relatedToId;
$fromPortal = $data->get('from_portal');
if ($fromPortal) {
$focus->column_fields['from_portal'] = $fromPortal;
}
$entityData = VTEntityData::fromCRMEntity($focus);
$wfs = new VTWorkflowManager($db);
$relatedToEventHandler = new VTWorkflowEventHandler();
$relatedToEventHandler->workflows = $wfs->getWorkflowsForModuleSupportingComments($entityData->getModuleName());
$wsId = vtws_getWebserviceEntityId($entityData->getModuleName(), $entityData->getId());
$fromPortal = $entityData->get('from_portal');
$util = new VTWorkflowUtils();
$entityCache = new VTEntityCache($util->adminUser());
$entityCacheData = $entityCache->forId($wsId);
$entityCacheData->set('from_portal', $fromPortal);
$entityCache->cache[$wsId] = $entityCacheData;
$relatedToEventHandler->handleEvent($eventName, $entityData, $entityCache);
$util->revertUser();
}
}
}
示例7: __construct
public function __construct($adb)
{
$util = new VTWorkflowUtils();
$adminUser = $util->adminUser();
$this->user = $adminUser;
$this->db = $adb;
}
示例8: 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
}
示例9: vtWorkflowSave
function vtWorkflowSave($adb, $request)
{
$util = new VTWorkflowUtils();
$module = new VTWorkflowApplication("saveworkflow");
$mod = return_module_language($current_language, $module->name);
$request = vtlib_purify($request);
// this cleans all values of the array
if (!$util->checkAdminAccess()) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
return;
}
$description = from_html($request["description"]);
$moduleName = $request["module_name"];
$conditions = $request["conditions"];
$taskId = $request["task_id"];
$saveType = $request["save_type"];
$executionCondition = $request['execution_condition'];
$wm = new VTWorkflowManager($adb);
if ($saveType == 'new') {
$wf = $wm->newWorkflow($moduleName);
$wf->description = $description;
$wf->test = $conditions;
$wf->taskId = $taskId;
$wf->executionConditionAsLabel($executionCondition);
$wm->save($wf);
} else {
if ($saveType == 'edit') {
$wf = $wm->retrieve($request["workflow_id"]);
$wf->description = $description;
$wf->test = $conditions;
$wf->taskId = $taskId;
$wf->executionConditionAsLabel($executionCondition);
$wm->save($wf);
} else {
throw new Exception();
}
}
if (isset($request["return_url"])) {
$returnUrl = $request["return_url"];
} else {
$returnUrl = $module->editWorkflowUrl($wf->id);
}
?>
<script type="text/javascript" charset="utf-8">
window.location="<?php
echo $returnUrl;
?>
";
</script>
<a href="<?php
echo $returnUrl;
?>
">Return</a>
<?php
}
示例10: 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");
}
示例11: 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);
}
}
示例12: getSettingLinks
/**
* Function to get Settings links
* @return <Array>
*/
public function getSettingLinks()
{
vimport('~~modules/com_vtiger_workflow/VTWorkflowUtils.php');
$editWorkflowsImagePath = Vtiger_Theme::getImagePath('EditWorkflows.png');
$settingsLinks = array();
if (VTWorkflowUtils::checkModuleWorkflow($this->getName())) {
$settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_EDIT_WORKFLOWS', 'linkurl' => 'index.php?parent=Settings&module=Workflows&view=List&sourceModule=' . $this->getName(), 'linkicon' => $editWorkflowsImagePath);
}
return $settingsLinks;
}
示例13: evalwfEmailTask
function evalwfEmailTask($entityid, $task)
{
global $entityCache, $HELPDESK_SUPPORT_EMAIL_ID;
$util = new VTWorkflowUtils();
$admin = $util->adminUser();
$from_name = $from_email = '';
if (!empty($task->fromname)) {
$fnt = new VTEmailRecipientsTemplate($task->fromname);
$from_name = $fnt->render($entityCache, $entityid);
}
$fromname = $from_name;
if (!empty($task->fromemail)) {
$fet = new VTEmailRecipientsTemplate($task->fromemail);
$from_email = $fet->render($entityCache, $entityid);
}
$fromemail = $from_email;
if (empty($from_name) and !empty($from_email)) {
$fromname = 'first and last name of user with email: ' . $from_email;
}
if (!empty($from_name) and empty($from_email)) {
$fromname = 'first and last name of user with user_name: ' . $from_name;
$fromemail = 'email of user with user_name: ' . $from_name;
}
if (empty($from_name) and empty($from_email)) {
$fromemail = $HELPDESK_SUPPORT_EMAIL_ID;
$fromname = 'first and last name of user with user_name: ' . $HELPDESK_SUPPORT_EMAIL_ID;
}
$et = new VTEmailRecipientsTemplate($task->recepient);
$to_email = $et->render($entityCache, $entityid);
$ecct = new VTEmailRecipientsTemplate($task->emailcc);
$cc = $ecct->render($entityCache, $entityid);
$ebcct = new VTEmailRecipientsTemplate($task->emailbcc);
$bcc = $ebcct->render($entityCache, $entityid);
$to_email = preg_replace('/,,+/', ',', $to_email);
$cc = preg_replace('/,,+/', ',', $cc);
$bcc = preg_replace('/,,+/', ',', $bcc);
$st = new VTSimpleTemplate($task->subject);
$subject = $st->render($entityCache, $entityid);
$ct = new VTSimpleTemplate($task->content);
$content = $ct->render($entityCache, $entityid);
$util->revertUser();
return array('from_name' => $fromname, 'from_email' => $fromemail, 'to_email' => $to_email, 'cc' => $cc, 'bcc' => $bcc, 'subject' => $subject, 'content' => $content);
}
示例14: getSettingLinks
/**
* Function to get Settings links
* @return <Array>
*/
public function getSettingLinks()
{
if (!$this->isEntityModule()) {
return array();
}
vimport('~~modules/com_vtiger_workflow/VTWorkflowUtils.php');
$layoutEditorImagePath = Vtiger_Theme::getImagePath('LayoutEditor.gif');
$editWorkflowsImagePath = Vtiger_Theme::getImagePath('EditWorkflows.png');
$settingsLinks = array();
if (VTWorkflowUtils::checkModuleWorkflow($this->getName())) {
$settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_EDIT_WORKFLOWS', 'linkurl' => 'index.php?parent=Settings&module=Workflows&view=List&sourceModule=' . $this->getName(), 'linkicon' => $editWorkflowsImagePath);
}
$settingsLinks[] = array('linktype' => 'LISTVIEWSETTINGS', 'linklabel' => 'LBL_SERVER_CONFIGURATION', 'linkurl' => 'index.php?parent=Settings&module=PBXManager&view=Index', 'linkicon' => '');
return $settingsLinks;
}
示例15: getSettingLinks
public function getSettingLinks()
{
vimport('~~modules/com_vtiger_workflow/VTWorkflowUtils.php');
$layoutEditorImagePath = Vtiger_Theme::getImagePath('LayoutEditor.gif');
$editWorkflowsImagePath = Vtiger_Theme::getImagePath('EditWorkflows.png');
$settingsLinks = array();
$settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_EDIT_FIELDS', 'linkurl' => 'index.php?parent=Settings&module=LayoutEditor&sourceModule=' . $this->getName(), 'linkicon' => $layoutEditorImagePath);
if (VTWorkflowUtils::checkModuleWorkflow($this->getName())) {
$settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_EDIT_WORKFLOWS', 'linkurl' => 'index.php?parent=Settings&module=Workflow&sourceModule=' . $this->getName(), 'linkicon' => $editWorkflowsImagePath);
}
$settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_EDIT_PICKLIST_VALUES', 'linkurl' => 'index.php?parent=Settings&module=Picklist&source_module=' . $this->getName(), 'linkicon' => '');
if ($this->hasSequenceNumberField()) {
$settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_MODULE_SEQUENCE_NUMBERING', 'linkurl' => 'index.php?parent=Settings&module=Vtiger&view=CustomRecordNumbering&sourceModule=' . $this->getName(), 'linkicon' => '');
}
return $settingsLinks;
}