[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
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 * Sharing Access Action Model Class 13 */ 14 class Settings_SharingAccess_Action_Model extends Vtiger_Base_Model { 15 16 static $nonConfigurableActions = array('Hide Details', 'Hide Details and Add Events', 'Show Details', 'Show Details and Add Events'); 17 18 public function getId() { 19 return $this->get('share_action_id'); 20 } 21 22 public function getName() { 23 return $this->get('share_action_name'); 24 } 25 26 public function isUtilityTool() { 27 return false; 28 } 29 30 public function isModuleEnabled($module) { 31 $db = PearDatabase::getInstance(); 32 $tabId = $module->getId(); 33 34 $sql = 'SELECT 1 FROM vtiger_org_share_action2tab WHERE tabid = ? AND share_action_id = ?'; 35 $params = array($tabId, $this->getId()); 36 $result = $db->pquery($sql, $params); 37 if($result && $db->num_rows($result) > 0) { 38 return true; 39 } 40 return false; 41 } 42 43 public static function getInstanceFromQResult($result, $rowNo=0) { 44 $db = PearDatabase::getInstance(); 45 $row = $db->query_result_rowdata($result, $rowNo); 46 $actionModel = new Settings_SharingAccess_Action_Model(); 47 return $actionModel->setData($row); 48 } 49 50 public static function getInstance($value) { 51 $db = PearDatabase::getInstance(); 52 53 if(Vtiger_Utils::isNumber($value)) { 54 $sql = 'SELECT * FROM vtiger_org_share_action_mapping WHERE share_action_id = ?'; 55 } else { 56 $sql = 'SELECT * FROM vtiger_org_share_action_mapping WHERE share_action_name = ?'; 57 } 58 $params = array($value); 59 $result = $db->pquery($sql, $params); 60 if($db->num_rows($result) > 0) { 61 return self::getInstanceFromQResult($result); 62 } 63 return null; 64 } 65 66 public static function getAll($configurable=true) { 67 $db = PearDatabase::getInstance(); 68 69 $sql = 'SELECT * FROM vtiger_org_share_action_mapping'; 70 $params = array(); 71 if($configurable) { 72 $sql .= ' WHERE share_action_name NOT IN ('. generateQuestionMarks(self::$nonConfigurableActions) .')'; 73 array_push($params, self::$nonConfigurableActions); 74 } 75 $result = $db->pquery($sql, $params); 76 $noOfRows = $db->num_rows($result); 77 $actionModels = array(); 78 for($i=0; $i<$noOfRows; ++$i) { 79 $actionModels[] = self::getInstanceFromQResult($result, $i); 80 } 81 return $actionModels; 82 } 83 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |