[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Users/models/ -> QuickCreateRecordStructure.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 Users_QuickCreateRecordStructure_Model extends Vtiger_QuickCreateRecordStructure_Model {
  12  
  13      /**
  14       * Function to get the values in stuctured format
  15       * @return <array> - values in structure array('block'=>array(fieldinfo));
  16       */
  17  	public function getStructure() {
  18          if(!empty($this->structuredValues)) {
  19              return $this->structuredValues;
  20          }
  21  
  22          $values = array();
  23          $recordModel = $this->getRecord();
  24          $moduleModel = $this->getModule();
  25  
  26          $fieldModelList = array();
  27          $quickCreateFields = array('user_name', 'email1', 'first_name', 'last_name', 'user_password', 'confirm_password', 'roleid', 'is_admin', 'status');
  28          foreach($quickCreateFields as $field) {
  29              $fieldModelList[$field] = $moduleModel->getField($field);
  30          }
  31  
  32          foreach($fieldModelList as $fieldName=>$fieldModel) {
  33              $recordModelFieldValue = $recordModel->get($fieldName);
  34              if(!empty($recordModelFieldValue)) {
  35                  $fieldModel->set('fieldvalue', $recordModelFieldValue);
  36              }else{
  37                  $defaultValue = $fieldModel->getDefaultFieldValue();
  38                  if($defaultValue) {
  39                      $fieldModel->set('fieldvalue', $defaultValue);
  40                  }
  41              }
  42              $values[$fieldName] = $fieldModel;
  43          }
  44          $this->structuredValues = $values;
  45          return $values;
  46      }
  47  }


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