[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Users/ -> RoleDragDrop.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  require_once ('include/utils/UserInfoUtil.php');
  13  $toid=$_REQUEST['parentId'];
  14  $fromid=$_REQUEST['childId'];
  15  
  16  
  17  global $adb;
  18  $query = "select * from vtiger_role where roleid='".$toid."'";
  19  $result=$adb->query($query);
  20  $parentRoleList=$adb->query_result($result,0,'parentrole');
  21  $replace_with=$parentRoleList;
  22  $orgDepth=$adb->query_result($result,0,'depth');
  23  
  24  //echo 'replace with is '.$replace_with;
  25  //echo '<BR>org depth '.$orgDepth;
  26  $parentRoles=explode('::',$parentRoleList);
  27  
  28  if(in_array($fromid,$parentRoles))
  29  {
  30      echo 'You cannot move a Parent Node under a Child Node';
  31          die;
  32  }
  33  
  34  
  35  $roleInfo=getRoleAndSubordinatesInformation($fromid);
  36  
  37  $fromRoleInfo=$roleInfo[$fromid];
  38  $replaceToStringArr=explode('::'.$fromid,$fromRoleInfo[1]);
  39  $replaceToString=$replaceToStringArr[0];
  40  //echo '<BR>to be replaced string '.$replaceToString;
  41  
  42  
  43  $stdDepth=$fromRoleInfo['2'];
  44  //echo '<BR> std depth '.$stdDepth;
  45  
  46  //Constructing the query
  47  foreach($roleInfo as $mvRoleId=>$mvRoleInfo)
  48  {
  49      $subPar=explode($replaceToString,$mvRoleInfo[1]);
  50      $mvParString=$replace_with.$subPar[1];
  51      $subDepth=$mvRoleInfo[2];
  52      $mvDepth=$orgDepth+(($subDepth-$stdDepth)+1);
  53      $query="update vtiger_role set parentrole='".$mvParString."',depth=".$mvDepth." where roleid='".$mvRoleId."'";
  54      //echo $query;
  55      $adb->query($query);
  56          
  57  }
  58  
  59  
  60  
  61  header("Location: index.php?action=UsersAjax&module=Users&file=listroles&ajax=true");
  62  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7