[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/include/utils/ -> GetParentGroups.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  
  12  /** Class to retreive all the Parent Groups of the specified Group
  13   *
  14   */
  15  class GetParentGroups { 
  16  
  17      var $parent_groups=Array();
  18  
  19      /** to get all the parent vtiger_groups of the specified group
  20       * @params $groupId --> Group Id :: Type Integer
  21           * @returns updates the parent group in the varibale $parent_groups of the class
  22           */
  23  	function getAllParentGroups($groupid)
  24      {
  25          global $adb,$log;
  26          $log->debug("Entering getAllParentGroups(".$groupid.") method...");
  27          $query="select groupid from vtiger_group2grouprel where containsgroupid=?";
  28          $result = $adb->pquery($query, array($groupid));
  29          $num_rows=$adb->num_rows($result);
  30          if($num_rows > 0)
  31          {
  32              for($i=0;$i<$num_rows;$i++)
  33              {
  34                  $group_id=$adb->query_result($result,$i,'groupid');
  35                  if(! in_array($group_id,$this->parent_groups))
  36                  {
  37                      $this->parent_groups[]=$group_id;
  38                      $this->getAllParentGroups($group_id);
  39                  }
  40              }
  41          }
  42          $log->debug("Exiting getAllParentGroups method...");
  43      }
  44  }
  45  
  46  ?>


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