Example #1
0
 /**
  * Function to get the instance of the Tracker Record Model from the list of key-value mapping
  * @param <Array> $valueMap
  * @return Vtiger_TrackRecord_Model instance
  */
 public static function getInstance($valueMap)
 {
     $instance = new self();
     $instance->setData($valueMap);
     $instance->setModule($valueMap['module_name']);
     return $instance;
 }
Example #2
0
 /**
  * Function to get the instance of the Tracker Record Model from the list of key-value mapping
  * @param <Array> $valueMap
  * @return Vtiger_TrackRecord_Model instance
  */
 public static function getInstance($valueMap)
 {
     global $log;
     $log->debug("Entering ./models/TrackRecord.php::staticgetInstance");
     $instance = new self();
     $instance->setData($valueMap);
     $instance->setModule($valueMap['module_name']);
     return $instance;
 }
Example #3
0
 /**
  * Creates a Dispatcher instance from MVC parameters.
  *
  * @param string $module     Module name.
  * @param string $controller Controller name.
  * @param string $action     Action name.
  * @param array  $params     Parameters.
  *
  * @return Dispatcher
  */
 public static function mvcDispatcher($module, $controller, $action, $params)
 {
     $dispatcher = new self();
     $dispatcher->setModule($module);
     $dispatcher->setController($controller);
     $dispatcher->setAction($action);
     $dispatcher->setParams($params);
     // get current application config
     $applicationConfig = Bootstrap::getInstance()->getEnvironment()->getApplicationConfig();
     // build the class name
     $className = '\\' . $applicationConfig->Namespace . '\\Modules\\' . $dispatcher->getModule() . '\\Controllers\\' . $dispatcher->getController();
     $dispatcher->setClassName($className);
     return $dispatcher;
 }
Example #4
0
 public static function getInstance($module)
 {
     $self = new self();
     $moduleModel = Vtiger_Module_Model::getInstance($module);
     $self->setModule($moduleModel);
     return $self;
 }
Example #5
0
 /**
  * Function to get clean record instance by using moduleName
  * @param <String> $qualifiedModuleName
  * @return <Settings_SMSNotifier_Record_Model>
  */
 public static function getCleanInstance($qualifiedModuleName)
 {
     $recordModel = new self();
     return $recordModel->setModule($qualifiedModuleName);
 }
Example #6
0
 public static function getInstanceFromWorkflowObject($wf)
 {
     $workflowModel = new self();
     $workflowModel->set('summary', $wf->description);
     $workflowModel->set('conditions', Zend_Json::decode($wf->test));
     $workflowModel->set('execution_condition', $wf->executionCondition);
     $workflowModel->set('module_name', $wf->moduleName);
     $workflowModel->set('workflow_id', $wf->id);
     $workflowModel->set('filtersavedinnew', $wf->filtersavedinnew);
     $workflowModel->setWorkflowObject($wf);
     $workflowModel->setModule($wf->moduleName);
     return $workflowModel;
 }
Example #7
0
 /**
  * Function to get all fields list for all blocks
  * @param <Array> List of block ids
  * @param <Vtiger_Module_Model> $moduleInstance
  * @return <Array> List of Field models <Settings_LayoutEditor_Field_Model>
  */
 public static function getInstanceFromBlockIdList($blockId, $moduleInstance = false)
 {
     $db = PearDatabase::getInstance();
     if (!is_array($blockId)) {
         $blockId = array($blockId);
     }
     $query = 'SELECT * FROM vtiger_field WHERE block IN(' . generateQuestionMarks($blockId) . ') AND vtiger_field.displaytype IN (1,2,4,10) ORDER BY sequence';
     $result = $db->pquery($query, $blockId);
     $numOfRows = $db->num_rows($result);
     $fieldModelsList = array();
     for ($i = 0; $i < $numOfRows; $i++) {
         $rowData = $db->query_result_rowdata($result, $i);
         //static is use to refer to the called class instead of defined class
         //http://php.net/manual/en/language.oop5.late-static-bindings.php
         $fieldModel = new self();
         $fieldModel->initialize($rowData);
         if ($moduleInstance) {
             $fieldModel->setModule($moduleInstance);
         }
         $fieldModelsList[] = $fieldModel;
     }
     return $fieldModelsList;
 }
Example #8
0
 /**
  * Function to get clean record instance by using moduleName
  * @param <String> $qualifiedModuleName
  * @return <Settings_SMSNotifier_Record_Model>
  */
 public static function getCleanInstance($qualifiedModuleName)
 {
     $recordModel = new self();
     $moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
     return $recordModel->setModule($moduleModel);
 }
Example #9
0
 /**
  * Function to get Clean instance of this record
  * @return <Settings_MailConverter_Record_Model>
  */
 public static function getCleanInstance()
 {
     $recordModel = new self();
     return $recordModel->setModule(Settings_Vtiger_Module_Model::getInstance('Settings:MailConverter'));
 }
Example #10
0
 public static function getInstance($module)
 {
     global $log;
     $log->debug("Entering ./models/FindDuplicate.php::staticgetInstance");
     $self = new self();
     $moduleModel = Vtiger_Module_Model::getInstance($module);
     $self->setModule($moduleModel);
     return $self;
 }