[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Settings/Workflows/models/ -> Field.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  class Settings_Workflows_Field_Model extends Vtiger_Field_Model {
  12  
  13      /**
  14       * Function to get all the supported advanced filter operations
  15       * @return <Array>
  16       */
  17  	public static function getAdvancedFilterOptions() {
  18          return array(
  19              'is' => 'is',
  20              'contains' => 'contains',
  21              'does not contain' => 'does not contain',
  22              'starts with' => 'starts with',
  23              'ends with' => 'ends with',
  24              'has changed' => 'has changed',
  25              'has changed to' => 'has changed to',
  26              'is empty' => 'is empty',
  27              'is not empty' => 'is not empty',
  28              'less than' => 'less than',
  29              'greater than' => 'greater than',
  30              'does not equal' => 'does not equal',
  31              'less than or equal to' => 'less than or equal to',
  32              'greater than or equal to' => 'greater than or equal to',
  33              'has changed' => 'has changed',
  34              'before' => 'before',
  35              'after' => 'after',
  36              'between' => 'between',
  37              'is added' => 'is added',
  38          );
  39      }
  40  
  41      /**
  42       * Function to get the advanced filter option names by Field type
  43       * @return <Array>
  44       */
  45  	public static function getAdvancedFilterOpsByFieldType() {
  46          return array(
  47              'string' => array('is', 'contains', 'does not contain', 'starts with', 'ends with', 'has changed', 'is empty', 'is not empty'),
  48              'salutation' => array('is', 'contains', 'does not contain', 'starts with', 'ends with', 'has changed', 'is empty', 'is not empty'),
  49              'text' => array('is', 'contains', 'does not contain', 'starts with', 'ends with', 'has changed', 'is empty', 'is not empty'),
  50              'url' => array('is', 'contains', 'does not contain', 'starts with', 'ends with', 'has changed', 'is empty', 'is not empty'),
  51              'email' => array('is', 'contains', 'does not contain', 'starts with', 'ends with', 'has changed', 'is empty', 'is not empty'),
  52              'phone' => array('is', 'contains', 'does not contain', 'starts with', 'ends with', 'has changed', 'is empty', 'is not empty'),
  53              'integer' => array('equal to', 'less than', 'greater than', 'does not equal', 'less than or equal to', 'greater than or equal to', 'has changed'),
  54              'double' => array('equal to', 'less than', 'greater than', 'does not equal', 'less than or equal to', 'greater than or equal to', 'has changed'),
  55              'currency' => array('equal to', 'less than', 'greater than', 'does not equal', 'less than or equal to', 'greater than or equal to', 'has changed', 'is not empty'),
  56              'picklist' => array('is', 'is not', 'has changed', 'has changed to', 'starts with', 'ends with', 'contains', 'does not contain', 'is empty', 'is not empty'),
  57              'multipicklist' => array('is', 'is not', 'has changed', 'has changed to'),
  58              'datetime' => array('is', 'is not', 'has changed','less than hours before', 'less than hours later', 'more than hours before', 'more than hours later', 'is not empty'),
  59              'time' => array('is', 'is not', 'has changed', 'is not empty'),
  60              'date' => array('is', 'is not', 'has changed', 'between', 'before', 'after', 'is today', 'less than days ago', 'more than days ago', 'in less than', 'in more than',
  61                              'days ago', 'days later', 'is not empty'),
  62              'boolean' => array('is', 'is not', 'has changed'),
  63              'reference' => array('has changed'),
  64              'owner' => array('has changed','is','is not'),
  65              'recurrence' => array('is', 'is not', 'has changed'),
  66              'comment' => array('is added'),
  67              'image' => array('is', 'is not', 'contains', 'does not contain', 'starts with', 'ends with', 'is empty', 'is not empty'),
  68              'percentage' => array('equal to', 'less than', 'greater than', 'does not equal', 'less than or equal to', 'greater than or equal to', 'has changed', 'is not empty'),
  69          );
  70      }
  71  
  72      /**
  73       * Function to get comment field which will useful in creating conditions
  74       * @param <Vtiger_Module_Model> $moduleModel
  75       * @return <Vtiger_Field_Model>
  76       */
  77  	public static function getCommentFieldForFilterConditions($moduleModel) {
  78          $commentField = new Vtiger_Field_Model();
  79          $commentField->set('name', '_VT_add_comment');
  80          $commentField->set('label', 'Comment');
  81          $commentField->setModule($moduleModel);
  82          $commentField->fieldDataType = 'comment';
  83  
  84          return $commentField;
  85      }
  86  
  87      /**
  88       * Function to get comment fields list which are useful in tasks
  89       * @param <Vtiger_Module_Model> $moduleModel
  90       * @return <Array> list of Field models <Vtiger_Field_Model>
  91       */
  92  	public static function getCommentFieldsListForTasks($moduleModel) {
  93          $commentsFieldsInfo = array('lastComment' => 'Last Comment', 'last5Comments' => 'Last 5 Comments', 'allComments' => 'All Comments');
  94  
  95          $commentFieldModelsList = array();
  96          foreach ($commentsFieldsInfo as $fieldName => $fieldLabel) {
  97              $commentField = new Vtiger_Field_Model();
  98              $commentField->setModule($moduleModel);
  99              $commentField->set('name', $fieldName);
 100              $commentField->set('label', $fieldLabel);
 101              $commentFieldModelsList[$fieldName] = $commentField;
 102          }
 103          return $commentFieldModelsList;
 104      }
 105  }


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