[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/include/ -> ComboUtil.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 ('include/utils/CommonUtils.php');
  12  require_once ('include/database/PearDatabase.php');
  13  /** Function to  returns the combo field values in array format
  14    * @param $combofieldNames -- combofieldNames:: Type string array
  15    * @returns $comboFieldArray -- comboFieldArray:: Type string array
  16   */
  17  function getComboArray($combofieldNames)
  18  {
  19      global $log,$mod_strings;
  20          $log->debug("Entering getComboArray(".$combofieldNames.") method ...");
  21      global $adb,$current_user;
  22          $roleid=$current_user->roleid;
  23      $comboFieldArray = Array();
  24      foreach ($combofieldNames as $tableName => $arrayName)
  25      {
  26          $fldArrName= $arrayName;
  27          $arrayName = Array();
  28          
  29          $sql = "select $tableName from vtiger_$tableName";
  30          $params = array();
  31          if(!is_admin($current_user))
  32          {
  33              $subrole = getRoleSubordinates($roleid);
  34              if(count($subrole)> 0)
  35              {
  36                  $roleids = $subrole;
  37                  array_push($roleids, $roleid);
  38              }
  39              else
  40              {
  41                  $roleids = $roleid;
  42              }
  43              $sql = "select distinct $tableName from vtiger_$tableName  inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_$tableName.picklist_valueid where roleid in(". generateQuestionMarks($roleids) .") order by sortid";
  44              $params = array($roleids);
  45          }
  46          $result = $adb->pquery($sql, $params);    
  47          while($row = $adb->fetch_array($result))
  48          {
  49              $val = $row[$tableName];
  50              $arrayName[$val] = getTranslatedString($val);
  51          }
  52          $comboFieldArray[$fldArrName] = $arrayName;
  53      }
  54      $log->debug("Exiting getComboArray method ...");
  55      return $comboFieldArray;    
  56  }
  57  function getUniquePicklistID()
  58  {
  59      global $adb;
  60      /*$sql="select id from vtiger_picklistvalues_seq";
  61      $picklistvalue_id = $adb->query_result($adb->pquery($sql, array()),0,'id');
  62  
  63      $qry = "update vtiger_picklistvalues_seq set id =?";
  64      $adb->pquery($qry, array(++$picklistvalue_id));*/
  65      return $adb->getUniqueID('vtiger_picklistvalues');
  66  }
  67  
  68  ?>


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