[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Settings/Workflows/models/ -> Module.php (source)

   1  <?php
   2  /*+***********************************************************************************
   3   * The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9   *************************************************************************************/
  10  
  11  require_once  'modules/com_vtiger_workflow/include.inc';
  12  require_once  'modules/com_vtiger_workflow/expression_engine/VTExpressionsManager.inc';
  13  
  14  class Settings_Workflows_Module_Model extends Settings_Vtiger_Module_Model {
  15  
  16      var $baseTable = 'com_vtiger_workflows';
  17      var $baseIndex = 'workflow_id';
  18      var $listFields = array('summary' => 'Summary', 'module_name' => 'Module', 'execution_condition' => 'Execution Condition');
  19      var $name = 'Workflows';
  20  
  21      static $metaVariables = array(
  22          'Current Date' => '(general : (__VtigerMeta__) date) ($_DATE_FORMAT_)',
  23          'Current Time' => '(general : (__VtigerMeta__) time)',
  24          'System Timezone' => '(general : (__VtigerMeta__) dbtimezone)',
  25          'User Timezone' => '(general : (__VtigerMeta__) usertimezone)',
  26          'CRM Detail View URL' => '(general : (__VtigerMeta__) crmdetailviewurl)',
  27          'Portal Detail View URL' => '(general : (__VtigerMeta__) portaldetailviewurl)',
  28          'Site Url' => '(general : (__VtigerMeta__) siteurl)',
  29          'Portal Url' => '(general : (__VtigerMeta__) portalurl)',
  30          'Record Id' => '(general : (__VtigerMeta__) recordId)',
  31          'LBL_HELPDESK_SUPPORT_NAME' => '(general : (__VtigerMeta__) supportName)',
  32          'LBL_HELPDESK_SUPPORT_EMAILID' => '(general : (__VtigerMeta__) supportEmailid)',
  33      );
  34  
  35      static $triggerTypes = array(
  36          1 => 'ON_FIRST_SAVE',
  37          2 => 'ONCE',
  38          3 => 'ON_EVERY_SAVE',
  39          4 => 'ON_MODIFY',
  40          // Reserving 5 & 6 for ON_DELETE and ON_SCHEDULED types.
  41          6=>     'ON_SCHEDULE'
  42      );
  43  
  44      /**
  45       * Function to get the url for default view of the module
  46       * @return <string> - url
  47       */
  48  	public static function getDefaultUrl() {
  49          return 'index.php?module=Workflows&parent=Settings&view=List';
  50      }
  51  
  52      /**
  53       * Function to get the url for create view of the module
  54       * @return <string> - url
  55       */
  56  	public static function getCreateViewUrl() {
  57          return "javascript:Settings_Workflows_List_Js.triggerCreate('index.php?module=Workflows&parent=Settings&view=Edit')";
  58      }
  59  
  60  	public static function getCreateRecordUrl() {
  61          return 'index.php?module=Workflows&parent=Settings&view=Edit';
  62      }
  63  
  64  	public static function getSupportedModules() {
  65          $moduleModels = Vtiger_Module_Model::getAll(array(0,2));
  66          $supportedModuleModels = array();
  67          foreach($moduleModels as $tabId => $moduleModel) {
  68              if($moduleModel->isWorkflowSupported() && $moduleModel->getName() != 'Webmails') {
  69                  $supportedModuleModels[$tabId] = $moduleModel;
  70              }
  71          }
  72          return $supportedModuleModels;
  73      }
  74  
  75  	public static function getTriggerTypes() {
  76          return self::$triggerTypes;
  77      }
  78  
  79  	public static function getExpressions() {
  80          $db = PearDatabase::getInstance();
  81  
  82          $mem = new VTExpressionsManager($db);
  83          return $mem->expressionFunctions();
  84      }
  85  
  86  	public static function getMetaVariables() {
  87          return self::$metaVariables;
  88      }
  89  
  90  	public function getListFields() {
  91          if(!$this->listFieldModels) {
  92              $fields = $this->listFields;
  93              $fieldObjects = array();
  94              foreach($fields as $fieldName => $fieldLabel) {
  95                  if($fieldName == 'module_name' || $fieldName == 'execution_condition') {
  96                      $fieldObjects[$fieldName] = new Vtiger_Base_Model(array('name' => $fieldName, 'label' => $fieldLabel, 'sort'=>false));
  97                  } else {
  98                      $fieldObjects[$fieldName] = new Vtiger_Base_Model(array('name' => $fieldName, 'label' => $fieldLabel));
  99                  }
 100              }
 101              $this->listFieldModels = $fieldObjects;
 102          }
 103          return $this->listFieldModels;
 104      }
 105  }


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1