Cheetah
ChSctrConfig.php
Go to the documentation of this file.
1 <?php
2 
8 require_once(CH_DIRECTORY_PATH_CLASSES . 'ChWsbConfig.php');
9 
11 {
12  var $_oDb;
20 
25  {
26  parent::__construct($aModule);
27 
28  $this->_sSessionKeyOpen = 'ch_sctr_open';
29  $this->_sSessionKeyData = 'ch_sctr_data';
30  $this->_sSessionDataDivider = '#';
31  $this->_aJsClasses = array('main' => 'ChSctrMain');
32  $this->_aJsObjects = array('main' => 'oChSctrMain');
33  }
34 
35  function init(&$oDb)
36  {
37  $this->_oDb = &$oDb;
38  $this->_oSession = ChWsbSession::getInstance();
39 
40  $this->_bEnabled = getParam('ch_sctr_enable') == 'on';
41  }
42 
43  function isEnabled()
44  {
46  return $this->_bEnabled && in_array($oSysTemplate->getCode(), array('uni', 'alt', 'evo'));
47  }
48 
49  function getOpenKey()
50  {
52  }
53 
54  function isOpen()
55  {
56  return (int)$this->_oSession->getValue($this->getOpenKey()) != 0;
57  }
58 
59  function doOpen()
60  {
61  $this->_oSession->setValue($this->getOpenKey(), 1);
62  }
63 
64  function doClose()
65  {
66  $this->_oSession->unsetValue($this->getOpenKey());
67  $this->cancelSession();
68  }
69 
70  function getSessionKey()
71  {
73  }
74 
75  function isSession()
76  {
77  $sData = $this->_oSession->getValue($this->getSessionKey());
78  return !empty($sData);
79  }
80 
81  function getSessionData()
82  {
83  $sData = $this->_oSession->getValue($this->getSessionKey());
84  return explode($this->_sSessionDataDivider, $sData);
85  }
86 
87  function setSessionData($aData)
88  {
89  $sData = implode($this->_sSessionDataDivider, $aData);
90  $this->_oSession->setValue($this->getSessionKey(), $sData);
91  }
92 
93  function cancelSession()
94  {
95  $this->_oSession->unsetValue($this->getSessionKey());
96  }
97 
98  function getJsClass($sType = 'main')
99  {
100  if(empty($sType))
101  return $this->_aJsClasses;
102 
103  return $this->_aJsClasses[$sType];
104  }
105 
106  function getJsObject($sType = 'main')
107  {
108  if(empty($sType))
109  return $this->_aJsObjects;
110 
111  return $this->_aJsObjects[$sType];
112  }
113 }
ChSctrConfig\getJsClass
getJsClass($sType='main')
Definition: ChSctrConfig.php:98
ChSctrConfig\isSession
isSession()
Definition: ChSctrConfig.php:75
ChSctrConfig\$_bEnabled
$_bEnabled
Definition: ChSctrConfig.php:14
ChSctrConfig\getOpenKey
getOpenKey()
Definition: ChSctrConfig.php:49
ChSctrConfig\$_sSessionKeyOpen
$_sSessionKeyOpen
Definition: ChSctrConfig.php:15
ChSctrConfig\$_aJsClasses
$_aJsClasses
Definition: ChSctrConfig.php:18
ChSctrConfig\doClose
doClose()
Definition: ChSctrConfig.php:64
ChSctrConfig\$_oDb
$_oDb
Definition: ChSctrConfig.php:12
ChSctrConfig\$_oSession
$_oSession
Definition: ChSctrConfig.php:13
ChSctrConfig\isEnabled
isEnabled()
Definition: ChSctrConfig.php:43
ChSctrConfig\$_sSessionKeyData
$_sSessionKeyData
Definition: ChSctrConfig.php:16
$aModule
$aModule
Definition: classifieds.php:21
ChSctrConfig\doOpen
doOpen()
Definition: ChSctrConfig.php:59
php
ChSctrConfig\getSessionKey
getSessionKey()
Definition: ChSctrConfig.php:70
ChSctrConfig\getJsObject
getJsObject($sType='main')
Definition: ChSctrConfig.php:106
ChSctrConfig\__construct
__construct($aModule)
Definition: ChSctrConfig.php:24
ChSctrConfig\getSessionData
getSessionData()
Definition: ChSctrConfig.php:81
$sType
$sType
Definition: actions.inc.php:11
ChSctrConfig\init
init(&$oDb)
Definition: ChSctrConfig.php:35
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
$oDb
global $oDb
Definition: db.inc.php:39
ChSctrConfig
Definition: ChSctrConfig.php:11
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition: header.inc.php:25
ChWsbSession\getInstance
static getInstance()
Definition: ChWsbSession.php:28
ChWsbConfig
Definition: ChWsbConfig.php:38
ChSctrConfig\$_aJsObjects
$_aJsObjects
Definition: ChSctrConfig.php:19
ChSctrConfig\cancelSession
cancelSession()
Definition: ChSctrConfig.php:93
ChSctrConfig\$_sSessionDataDivider
$_sSessionDataDivider
Definition: ChSctrConfig.php:17
$oSysTemplate
$oSysTemplate
Definition: params.inc.php:22
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
ChSctrConfig\isOpen
isOpen()
Definition: ChSctrConfig.php:54
ChSctrConfig\setSessionData
setSessionData($aData)
Definition: ChSctrConfig.php:87