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


PHP VTWorkflowUtils::adminUser方法代码示例

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


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

示例1: 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);
     }
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:25,代码来源:VTSMSTask.php

示例2: __construct

 public function __construct($adb)
 {
     $util = new VTWorkflowUtils();
     $adminUser = $util->adminUser();
     $this->user = $adminUser;
     $this->db = $adb;
 }
开发者ID:xrstf,项目名称:vtiger-mirror,代码行数:7,代码来源:WorkFlowScheduler.php

示例3: 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();
         }
     }
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:33,代码来源:ModCommentsHandler.php

示例4: 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);
    }
}
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:14,代码来源:runtaskjob.php

示例5: 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);
}
开发者ID:kduqi,项目名称:corebos,代码行数:43,代码来源:evalwf.php

示例6: runScheduledReports

 public static function runScheduledReports()
 {
     vimport('~~modules/com_vtiger_workflow/VTWorkflowUtils.php');
     $util = new VTWorkflowUtils();
     $util->adminUser();
     $currentModule = vglobal('currentModule');
     $current_language = vglobal('current_language');
     if (empty($currentModule)) {
         $currentModule = 'Reports';
     }
     if (empty($current_language)) {
         vglobal('current_language', 'en_us');
     }
     $scheduledReports = self::getScheduledReports();
     foreach ($scheduledReports as $scheduledReport) {
         $status = $scheduledReport->sendEmail();
         Vtiger_Utils::ModuleLog('ScheduleReprot Send Mail Status ', $status);
         if ($status) {
             $scheduledReport->updateNextTriggerTime();
         }
     }
     $util->revertUser();
     return $status;
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:24,代码来源:ScheduleReports.php

示例7: runScheduledReports

 public static function runScheduledReports($adb)
 {
     require_once 'modules/com_vtiger_workflow/VTWorkflowUtils.php';
     $util = new VTWorkflowUtils();
     $adminUser = $util->adminUser();
     $scheduledReports = self::getScheduledReports($adminUser);
     $util->revertUser();
     foreach ($scheduledReports as $scheduledReport) {
         $ReportOwnerUser = ITS4YouReports::getReports4YouOwnerUser($scheduledReport->reportinformations["owner"]);
         //echo "<pre>";print_r($);echo "</pre>";exit;
         $scheduledReport->sendEmail($ReportOwnerUser);
         $scheduledReport->updateNextTriggerTime();
         $ReportOwnerUser = ITS4YouReports::revertSchedulerUser();
     }
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:15,代码来源:ScheduledReports4You.php

示例8: runScheduledReports

 public static function runScheduledReports($adb)
 {
     require_once 'modules/com_vtiger_workflow/VTWorkflowUtils.php';
     $util = new VTWorkflowUtils();
     $adminUser = $util->adminUser();
     $currentModule = vglobal('currentModule');
     $current_language = vglobal('current_language');
     if (empty($currentModule)) {
         $currentModule = 'Reports';
     }
     if (empty($current_language)) {
         vglobal('current_language', 'en_us');
     }
     $scheduledReports = self::getScheduledReports($adb, $adminUser);
     foreach ($scheduledReports as $scheduledReport) {
         $scheduledReport->sendEmail();
         $scheduledReport->updateNextTriggerTime();
     }
     $util->revertUser();
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:20,代码来源:ScheduledReports.php

示例9: explode

list($wsmod, $crmid) = explode('x', $crm_record_to_evaluate);
$wsrs = $adb->pquery('select name FROM vtiger_ws_entity where id=?', array($wsmod));
if (!$wsrs or $adb->num_rows($wsrs) == 0) {
    echo "<h2>Incorrect crmid:</h2>";
    echo "<b>crmid</b> could not be evaluated as a valid webservice enhanced ID<br>";
    die;
}
$currentModule = $adb->query_result($wsrs, 0, 0);
$semod = getSalesEntityType($crmid);
if ($semod != $currentModule and ($semod != 'Calendar' and $currentModule != 'Events')) {
    echo "<h2>Incorrect crmid:</h2>";
    echo "<b>crmid</b> could not be evaluated as a valid record ID<br>";
    die;
}
$util = new VTWorkflowUtils();
$adminUser = $util->adminUser();
$entityCache = new VTEntityCache($adminUser);
$wfs = new VTWorkflowManager($adb);
$result = $adb->pquery('select workflow_id, module_name, summary, test, execution_condition, type
			from com_vtiger_workflows where workflow_id=?', array($workflowid_to_evaluate));
if (!$result or $adb->num_rows($result) == 0) {
    echo "<h2>Incorrect workflowid:</h2>";
    echo "<b>workflowid</b> could not be found as a valid workflow<br>";
    die;
}
$workflows = $wfs->getWorkflowsForResult($result);
$workflow = $workflows[$workflowid_to_evaluate];
$entityData = $entityCache->forId($crm_record_to_evaluate);
if ($workflows[$workflowid_to_evaluate]->executionCondition == VTWorkflowManager::$ON_SCHEDULE) {
    echo "<h2>Scheduled: SQL for affected records:</h2>";
    $workflowScheduler = new WorkFlowScheduler($adb);
开发者ID:jaimeaga84,项目名称:corebos,代码行数:31,代码来源:evalwf.php

示例10: getContents

 /**
  * Function to get contents of this task
  * @param <Object> $entity
  * @return <Array> contents
  */
 public function getContents($entity, $entityCache = false)
 {
     if (!$this->contents) {
         global $adb, $current_user;
         $taskContents = array();
         $entityId = $entity->getId();
         $utils = new VTWorkflowUtils();
         $adminUser = $utils->adminUser();
         if (!$entityCache) {
             $entityCache = new VTEntityCache($adminUser);
         }
         $fromUserId = Users::getActiveAdminId();
         $entityOwnerId = $entity->get('assigned_user_id');
         if ($entityOwnerId) {
             list($moduleId, $fromUserId) = explode('x', $entityOwnerId);
         }
         $ownerEntity = $entityCache->forId($entityOwnerId);
         if ($ownerEntity->getModuleName() === 'Groups') {
             list($moduleId, $recordId) = vtws_getIdComponents($entityId);
             $fromUserId = Vtiger_Util_Helper::getCreator($recordId);
         }
         if ($this->fromEmail && !($ownerEntity->getModuleName() === 'Groups' && strpos($this->fromEmail, 'assigned_user_id : (Users) ') !== false)) {
             $et = new VTEmailRecipientsTemplate($this->fromEmail);
             $fromEmailDetails = $et->render($entityCache, $entityId);
             $con1 = strpos($fromEmailDetails, '&lt;');
             $con2 = strpos($fromEmailDetails, '&gt;');
             if ($con1 && $con2) {
                 list($fromName, $fromEmail) = explode('&lt;', $fromEmailDetails);
                 list($fromEmail, $rest) = explode('&gt;', $fromEmail);
             } else {
                 $fromName = "";
                 $fromEmail = $fromEmailDetails;
             }
         } else {
             $userObj = CRMEntity::getInstance('Users');
             $userObj->retrieveCurrentUserInfoFromFile($fromUserId);
             if ($userObj) {
                 $fromEmail = $userObj->email1;
                 $fromName = $userObj->user_name;
             } else {
                 $result = $adb->pquery('SELECT user_name, email1 FROM vtiger_users WHERE id = ?', array($fromUserId));
                 $fromEmail = $adb->query_result($result, 0, 'email1');
                 $fromName = $adb->query_result($result, 0, 'user_name');
             }
         }
         if (!$fromEmail) {
             $utils->revertUser();
             return false;
         }
         $taskContents['fromEmail'] = $fromEmail;
         $taskContents['fromName'] = $fromName;
         if ($entity->getModuleName() === 'Events') {
             $contactId = $entity->get('contact_id');
             if ($contactId) {
                 $contactIds = '';
                 list($wsId, $recordId) = explode('x', $entityId);
                 $webserviceObject = VtigerWebserviceObject::fromName($adb, 'Contacts');
                 $result = $adb->pquery('SELECT contactid FROM vtiger_cntactivityrel WHERE activityid = ?', array($recordId));
                 $numOfRows = $adb->num_rows($result);
                 for ($i = 0; $i < $numOfRows; $i++) {
                     $contactIds .= vtws_getId($webserviceObject->getEntityId(), $adb->query_result($result, $i, 'contactid')) . ',';
                 }
             }
             $entity->set('contact_id', trim($contactIds, ','));
             $entityCache->cache[$entityId] = $entity;
         }
         $et = new VTEmailRecipientsTemplate($this->recepient);
         $toEmail = $et->render($entityCache, $entityId);
         $ecct = new VTEmailRecipientsTemplate($this->emailcc);
         $ccEmail = $ecct->render($entityCache, $entityId);
         $ebcct = new VTEmailRecipientsTemplate($this->emailbcc);
         $bccEmail = $ebcct->render($entityCache, $entityId);
         if (strlen(trim($toEmail, " \t\n,")) == 0 && strlen(trim($ccEmail, " \t\n,")) == 0 && strlen(trim($bccEmail, " \t\n,")) == 0) {
             $utils->revertUser();
             return false;
         }
         $taskContents['toEmail'] = $toEmail;
         $taskContents['ccEmail'] = $ccEmail;
         $taskContents['bccEmail'] = $bccEmail;
         $st = new VTSimpleTemplate($this->subject);
         $taskContents['subject'] = $st->render($entityCache, $entityId);
         $ct = new VTSimpleTemplate($this->content);
         $taskContents['content'] = $ct->render($entityCache, $entityId);
         $this->contents = $taskContents;
         $utils->revertUser();
     }
     if (is_array($this->contents)) {
         $this->contents = Zend_Json::encode($this->contents);
     }
     return $this->contents;
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:96,代码来源:VTPDFMakerMailTask.php


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