[ 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 include_once dirname(__FILE__) . '/cache/Connector.php'; 12 13 class Vtiger_Cache { 14 private static $selfInstance = false; 15 public static $cacheEnable = true; 16 17 protected $connector; 18 19 private function __construct() { 20 $this->connector = Vtiger_Cache_Connector::getInstance(); 21 } 22 23 public static function getInstance(){ 24 if(self::$selfInstance){ 25 return self::$selfInstance; 26 } else{ 27 self::$selfInstance = new self(); 28 return self::$selfInstance; 29 } 30 } 31 32 public static function get($ns, $key) { 33 $self = self::getInstance(); 34 if($key && self::$cacheEnable) { 35 return $self->connector->get($ns, $key); 36 } 37 return false; 38 } 39 40 public static function set($ns, $key, $value) { 41 $self = self::getInstance(); 42 if(self::$cacheEnable) { 43 $self->connector->set($ns, $key, $value); 44 } 45 } 46 47 public static function flush(){ 48 $self = self::getInstance(); 49 $self->connector->flush(); 50 } 51 52 53 private static $_user_list; 54 55 public function getUserList($module,$currentUser){ 56 if(isset(self::$_user_list[$currentUser][$module])){ 57 return self::$_user_list[$currentUser][$module]; 58 } 59 return false; 60 } 61 62 public function setUserList($module,$userList,$currentUser){ 63 if(self::$cacheEnable){ 64 self::$_user_list[$currentUser][$module]=$userList; 65 } 66 } 67 68 private static $_group_list; 69 70 public function getGroupList($module,$currentUser){ 71 if(isset(self::$_group_list[$currentUser][$module])){ 72 return self::$_group_list[$currentUser][$module]; 73 } 74 return false; 75 } 76 77 public function setGroupList($module,$GroupList,$currentUser){ 78 if(self::$cacheEnable){ 79 self::$_group_list[$currentUser][$module]=$GroupList; 80 } 81 } 82 83 private static $_picklist_values; 84 85 public function getPicklistValues($fieldName){ 86 if(isset(self::$_picklist_values[$fieldName])){ 87 return self::$_picklist_values[$fieldName]; 88 } 89 return false; 90 } 91 92 public function setPicklistValues($fieldName,$values){ 93 if(self::$cacheEnable){ 94 self::$_picklist_values[$fieldName]=$values; 95 } 96 } 97 98 private static $_picklist_details; 99 100 public function getPicklistDetails($module,$field){ 101 if(isset(self::$_picklist_details[$module][$field])){ 102 return self::$_picklist_details[$module][$field]; 103 } 104 return false; 105 } 106 107 public function setPicklistDetails($module,$field,$picklistDetails){ 108 if(self::$cacheEnable){ 109 self::$_picklist_details[$module][$field] = $picklistDetails; 110 } 111 } 112 113 private static $_module_ownedby; 114 115 public function getModuleOwned($module){ 116 if(isset(self::$_module_ownedby[$module])){ 117 return self::$_module_ownedby[$module]; 118 } 119 return false; 120 } 121 122 public function setModuleOwned($module,$ownedby){ 123 if(self::$cacheEnable){ 124 self::$_module_ownedby[$module] = $ownedby; 125 } 126 } 127 128 private static $_block_instance; 129 130 public function getBlockInstance($block, $moduleName){ 131 if(isset(self::$_block_instance[$moduleName][$block])){ 132 return self::$_block_instance[$moduleName][$block]; 133 } 134 return false; 135 } 136 137 public function setBlockInstance($block, $moduleName, $instance){ 138 if(self::$cacheEnable){ 139 self::$_block_instance[$moduleName][$block] = $instance; 140 } 141 } 142 143 144 private static $_field_instance; 145 146 public function getFieldInstance($field,$moduleId){ 147 if(isset(self::$_field_instance[$moduleId][$field])){ 148 return self::$_field_instance[$moduleId][$field]; 149 } 150 return false; 151 } 152 153 public function setFieldInstance($field,$moduleId,$instance){ 154 if(self::$cacheEnable){ 155 self::$_field_instance[$moduleId][$field] = $instance; 156 } 157 } 158 159 private static $_admin_user_id = false; 160 161 public function getAdminUserId(){ 162 return self::$_admin_user_id; 163 } 164 165 public function setAdminUserId($userId){ 166 if(self::$cacheEnable){ 167 self::$_admin_user_id = $userId; 168 } 169 } 170 171 //cache for the module Instance 172 private static $_module_name = array(); 173 174 public function getModuleName($moduleId){ 175 if(isset(self::$_module_name[$moduleId])){ 176 return self::$_module_name[$moduleId]; 177 } 178 return false; 179 } 180 181 public function setModuleName($moduleId,$moduleName){ 182 if(self::$cacheEnable){ 183 self::$_module_name[$moduleId] = $moduleName; 184 } 185 } 186 187 //cache for the module Instance 188 private static $_workflow_for_module = array(); 189 190 public function getWorkflowForModule($module){ 191 if(isset(self::$_workflow_for_module[$module])){ 192 return self::$_workflow_for_module[$module]; 193 } 194 return false; 195 } 196 197 public function setWorkflowForModule($module,$workflows){ 198 if(self::$cacheEnable){ 199 self::$_workflow_for_module[$module] = $workflows; 200 } 201 } 202 203 //cache for the module Instance 204 private static $_workflow_for_module_supporting_comments = array(); 205 206 public function getWorkflowForModuleSupportingComments($module){ 207 if(isset(self::$_workflow_for_module_supporting_comments[$module])){ 208 return self::$_workflow_for_module_supporting_comments[$module]; 209 } 210 return false; 211 } 212 213 public function setWorkflowForModuleSupportingComments($module,$workflows){ 214 if(self::$cacheEnable){ 215 self::$_workflow_for_module_supporting_comments[$module] = $workflows; 216 } 217 } 218 219 220 private static $_user_id ; 221 222 public function getUserId($userName){ 223 if(isset(self::$_user_id[$userName])){ 224 return self::$_user_id[$userName]; 225 } 226 return false; 227 } 228 229 public function setUserId($userName,$userId){ 230 if(self::$cacheEnable){ 231 self::$_user_id[$userName] = $userId; 232 } 233 } 234 235 private static $_table_exists ; 236 237 public function getTableExists($tableName){ 238 if(isset(self::$_table_exists[$tableName])){ 239 return self::$_table_exists[$tableName]; 240 } 241 return false; 242 } 243 244 public function setTableExists($tableName,$exists){ 245 if(self::$cacheEnable){ 246 self::$_table_exists[$tableName] = $exists; 247 } 248 } 249 250 private static $_picklist_id; 251 252 public function getPicklistId($fieldName,$moduleName){ 253 if(isset(self::$_picklist_id[$moduleName][$fieldName])){ 254 return self::$_picklist_id[$moduleName][$fieldName]; 255 } 256 return false; 257 } 258 public function setPicklistId($fieldName,$moduleName,$picklistId){ 259 if(self::$cacheEnable){ 260 self::$_picklist_id[$moduleName][$fieldName] = $picklistId; 261 } 262 } 263 264 private static $_group_id; 265 266 public function getGroupId($groupName){ 267 if(isset(self::$_group_id[$groupName])){ 268 return self::$_group_id[$groupName]; 269 } 270 return false; 271 } 272 273 public function setGroupId($groupName,$groupId){ 274 if(self::$cacheEnable){ 275 self::$_group_id[$groupName]=$groupId; 276 } 277 } 278 279 private static $_assigned_picklist_values; 280 281 public function getAssignedPicklistValues($tableName,$roleId){ 282 if(isset(self::$_assigned_picklist_values[$tableName][$roleId])){ 283 return self::$_assigned_picklist_values[$tableName][$roleId]; 284 } 285 return false; 286 } 287 288 public function setAssignedPicklistValues($tableName,$roleId,$values){ 289 if(self::$cacheEnable){ 290 self::$_assigned_picklist_values[$tableName][$roleId]=$values; 291 } 292 } 293 294 public function hasAssignedPicklistValues($tableName, $roleId) { 295 $values = $this->getAssignedPicklistValues($tableName, $roleId); 296 return $values !== false; 297 } 298 299 private static $_block_fields; 300 301 public function getBlockFields($block,$module){ 302 if(isset(self::$_block_fields[$module][$block])){ 303 return self::$_block_fields[$module][$block]; 304 } 305 return false; 306 } 307 308 public function setBlockFields($block,$module,$fields){ 309 if(self::$cacheEnable){ 310 self::$_block_fields[$module][$block] = $fields; 311 } 312 } 313 314 private static $_name_fields; 315 316 public function getNameFields($module){ 317 if(isset(self::$_name_fields[$module])){ 318 return self::$_name_fields[$module]; 319 } 320 return false; 321 } 322 323 public function setNameFields($module,$nameFields){ 324 if(self::$cacheEnable){ 325 self::$_name_fields[$module] = $nameFields; 326 } 327 } 328 329 public function purifyGet($key) { 330 if (self::$cacheEnable) { 331 return $this->connector->get('purify', $key); 332 } 333 return false; 334 } 335 336 public function purifySet($key, $value) { 337 if (self::$cacheEnable) { 338 $this->connector->set('purify', $key, $value); 339 } 340 } 341 342 private static $_owners_names_list; 343 344 public function getOwnerName($id){ 345 if(isset(self::$_owners_names_list[$id])) { 346 return self::$_owners_names_list[$id]; 347 } 348 return false; 349 } 350 351 public function setOwnerName($id, $value){ 352 if(self::$cacheEnable){ 353 self::$_owners_names_list[$id] = $value; 354 } 355 } 356 357 public function hasOwnerName($id) { 358 $value = $this->getOwnerName($id); 359 return $value !== false; 360 } 361 362 private static $_owners_db_names_list; 363 364 public function getOwnerDbName($id){ 365 if(isset(self::$_owners_db_names_list[$id])) { 366 return self::$_owners_db_names_list[$id]; 367 } 368 return false; 369 } 370 371 public function setOwnerDbName($id, $value){ 372 if(self::$cacheEnable){ 373 self::$_owners_db_names_list[$id] = $value; 374 } 375 } 376 377 public function hasOwnerDbName($id) { 378 $value = $this->getOwnerDbName($id); 379 return $value !== false; 380 } 381 382 private static $_creator_ids_list; 383 384 public function getCreator($id){ 385 if(isset(self::$_creator_ids_list[$id])) { 386 return self::$_creator_ids_list[$id]; 387 } 388 return false; 389 } 390 391 public function setCreator($id, $value){ 392 if(self::$cacheEnable){ 393 self::$_creator_ids_list[$id] = $value; 394 } 395 } 396 397 public function hasCreator($id) { 398 $value = $this->getCreator($id); 399 return $value !== false; 400 } 401 }
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 |