本文整理汇总了PHP中VTWorkflowManager::getWorkflowsForModule方法的典型用法代码示例。如果您正苦于以下问题:PHP VTWorkflowManager::getWorkflowsForModule方法的具体用法?PHP VTWorkflowManager::getWorkflowsForModule怎么用?PHP VTWorkflowManager::getWorkflowsForModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VTWorkflowManager
的用法示例。
在下文中一共展示了VTWorkflowManager::getWorkflowsForModule方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$record = $request->get('record');
vimport('~~modules/com_vtiger_workflow/include.inc');
vimport('~~modules/com_vtiger_workflow/VTEntityCache.inc');
vimport('~~modules/com_vtiger_workflow/include.inc');
vimport('~~include/Webservices/Utils.php');
vimport('~~include/Webservices/Retrieve.php');
$adb = PearDatabase::getInstance();
$wfs = new VTWorkflowManager($adb);
$workflows = $wfs->getWorkflowsForModule($moduleName, VTWorkflowManager::$TRIGGER);
$currentUser = Users_Record_Model::getCurrentUserModel();
$wsId = vtws_getWebserviceEntityId($moduleName, $record);
$entityCache = new VTEntityCache($currentUser);
$entityData = $entityCache->forId($wsId);
foreach ($workflows as $id => $workflow) {
if (!$workflow->evaluate($entityCache, $entityData->getId())) {
unset($workflows[$id]);
}
}
$viewer = $this->getViewer($request);
$viewer->assign('RECORD', $record);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('WORKFLOWS', $workflows);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->view('WorkflowTrigger.tpl', $moduleName);
}
示例2: 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");
}
示例3: getDetailViewLinks
/**
* Function to get the detail view links (links and widgets)
* @param <array> $linkParams - parameters which will be used to calicaulate the params
* @return <array> - array of link models in the format as below
* array('linktype'=>list of link models);
*/
public function getDetailViewLinks($linkParams)
{
$linkTypes = array('DETAILVIEWBASIC', 'DETAILVIEW');
$moduleModel = $this->getModule();
$recordModel = $this->getRecord();
$currentUserModel = Users_Record_Model::getCurrentUserModel();
$moduleName = $moduleModel->getName();
$recordId = $recordModel->getId();
$detailViewLinks = [];
$adb = PearDatabase::getInstance();
vimport('~~modules/com_vtiger_workflow/include.inc');
vimport('~~modules/com_vtiger_workflow/VTEntityMethodManager.inc');
$wfs = new VTWorkflowManager($adb);
$workflows = $wfs->getWorkflowsForModule($moduleName, VTWorkflowManager::$TRIGGER);
if (Users_Privileges_Model::isPermitted($moduleName, 'WorkflowTrigger') && count($workflows) > 0) {
$detailViewLinks[] = array('linktype' => 'DETAILVIEWBASIC', 'linklabel' => '', 'linkurl' => 'Vtiger_Detail_Js.showWorkflowTriggerView(this)', 'linkicon' => 'glyphicon glyphicon-plus-sign', 'linkhint' => 'BTN_WORKFLOW_TRIGGER');
}
$lockEdit = Users_Privileges_Model::checkLockEdit($moduleName, $recordId);
$currentUserPriviligesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
if (Users_Privileges_Model::isPermitted($moduleName, 'EditView', $recordId) && !$lockEdit) {
$detailViewLinks[] = array('linktype' => 'DETAILVIEWBASIC', 'linklabel' => '', 'linkurl' => $recordModel->getEditViewUrl(), 'linkicon' => 'glyphicon glyphicon-pencil', 'linkclass' => 'btn', 'linkhint' => 'BTN_RECORD_EDIT');
}
foreach ($detailViewLinks as $detailViewLink) {
$linkModelList['DETAILVIEWBASIC'][] = Vtiger_Link_Model::getInstanceFromValues($detailViewLink);
}
$linkModelListDetails = Vtiger_Link_Model::getAllByType($moduleModel->getId(), $linkTypes, $linkParams);
//Mark all detail view basic links as detail view links.
//Since ui will be look ugly if you need many basic links
$detailViewBasiclinks = $linkModelListDetails['DETAILVIEWBASIC'];
unset($linkModelListDetails['DETAILVIEWBASIC']);
if (Users_Privileges_Model::isPermitted($moduleName, 'Delete', $recordId) && $recordPermissionToEditView) {
$deletelinkModel = array('linktype' => 'DETAILVIEW', 'linklabel' => sprintf("%s %s", getTranslatedString('LBL_DELETE', $moduleName), vtranslate('SINGLE_' . $moduleName, $moduleName)), 'linkurl' => 'javascript:Vtiger_Detail_Js.deleteRecord("' . $recordModel->getDeleteUrl() . '")', 'linkicon' => 'glyphicon glyphicon-trash', 'title' => vtranslate('LBL_DELETE_RECORD'));
$linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($deletelinkModel);
}
if (Users_Privileges_Model::isPermitted($moduleName, 'DuplicateRecord')) {
$duplicateLinkModel = array('linktype' => 'DETAILVIEWBASIC', 'linklabel' => 'LBL_DUPLICATE', 'linkurl' => $recordModel->getDuplicateRecordUrl(), 'linkicon' => 'glyphicon glyphicon-retweet', 'title' => vtranslate('LBL_DUPLICATE_RECORD'));
$linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($duplicateLinkModel);
}
if (!empty($detailViewBasiclinks)) {
foreach ($detailViewBasiclinks as $linkModel) {
// Remove view history, needed in vtiger5 to see history but not in vtiger6
if ($linkModel->linklabel == 'View History') {
continue;
}
$linkModelList['DETAILVIEW'][] = $linkModel;
}
}
$relatedLinks = $this->getDetailViewRelatedLinks();
foreach ($relatedLinks as $relatedLinkEntry) {
$relatedLink = Vtiger_Link_Model::getInstanceFromValues($relatedLinkEntry);
$linkModelList[$relatedLink->getType()][] = $relatedLink;
}
if ($currentUserModel->isAdminUser()) {
$settingsLinks = $moduleModel->getSettingLinks();
foreach ($settingsLinks as $settingsLink) {
$linkModelList['DETAILVIEWSETTING'][] = Vtiger_Link_Model::getInstanceFromValues($settingsLink);
}
}
return $linkModelList;
}
示例4: deleteRecord
/**
* Function to delete a given record model of the current module
* @param Vtiger_Record_Model $recordModel
*/
public function deleteRecord($recordModel)
{
$moduleName = $this->get('name');
$focus = CRMEntity::getInstance($moduleName);
$focus->trash($moduleName, $recordModel->getId());
if (method_exists($focus, 'transferRelatedRecords')) {
if ($recordModel->get('transferRecordIDs')) {
$focus->transferRelatedRecords($moduleName, $recordModel->get('transferRecordIDs'), $recordModel->getId());
}
}
vimport('~~modules/com_vtiger_workflow/include.inc');
vimport('~~modules/com_vtiger_workflow/VTEntityMethodManager.inc');
$wfs = new VTWorkflowManager(PearDatabase::getInstance());
$workflows = $wfs->getWorkflowsForModule($moduleName, VTWorkflowManager::$ON_DELETE);
if (count($workflows)) {
$wsId = vtws_getWebserviceEntityId($moduleName, $recordModel->getId());
$entityCache = new VTEntityCache(Users_Record_Model::getCurrentUserModel());
$entityData = $entityCache->forId($wsId);
foreach ($workflows as $id => $workflow) {
if ($workflow->evaluate($entityCache, $entityData->getId())) {
$workflow->performTasks($entityData);
}
}
}
}
示例5: checkLockEdit
public static function checkLockEdit($moduleName, $record)
{
if (isset(self::$lockEditCache[$moduleName . $record])) {
return self::$lockEditCache[$moduleName . $record];
}
$return = false;
if (empty($record)) {
self::$lockEditCache[$moduleName . $record] = $return;
return $return;
}
$currentUserModel = Users_Record_Model::getCurrentUserModel();
$currentUserId = $currentUserModel->getId();
vimport('~~modules/com_vtiger_workflow/include.inc');
vimport('~~modules/com_vtiger_workflow/VTEntityMethodManager.inc');
vimport('~~modules/com_vtiger_workflow/VTEntityCache.inc');
vimport('~~include/Webservices/Retrieve.php');
$wfs = new VTWorkflowManager(PearDatabase::getInstance());
$workflows = $wfs->getWorkflowsForModule($moduleName, VTWorkflowManager::$BLOCK_EDIT);
if (count($workflows)) {
$wsId = vtws_getWebserviceEntityId($moduleName, $record);
$entityCache = new VTEntityCache($currentUserModel);
$entityData = $entityCache->forId($wsId);
foreach ($workflows as $id => $workflow) {
if ($workflow->evaluate($entityCache, $entityData->getId())) {
$return = true;
}
}
}
self::$lockEditCache[$moduleName . $record] = $return;
return $return;
}