Cheetah
ChGSearchModule.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbModule');
9 
45 {
47  var $_sProto = 'http';
48 
49  function __construct(&$aModule)
50  {
51  parent::__construct($aModule);
52  $GLOBALS['aModule'] = $aModule;
53  $this->_iProfileId = getLoggedId();
54  $this->_sProto = ch_proto();
55  }
56 
57  function actionHome ()
58  {
59  ch_import ('PageMain', $this->_aModule);
60  $oPage = new ChGSearchPageMain ($this);
61  $this->_oTemplate->pageStart();
62  echo $oPage->getCode();
63  $this->_oTemplate->pageCode(_t('_ch_gsearch'), false, false);
64  }
65 
67  {
68  if (!$this->isAdmin()) {
69  $this->_oTemplate->displayAccessDenied ();
70  return;
71  }
72 
73  $iId = $this->_oDb->getSettingsCategory('Google Search');
74  if(empty($iId)) {
75  $this->_oTemplate->displayPageNotFound ();
76  return;
77  }
78 
79  $this->_oTemplate->pageStart();
80 
81  ch_import('ChWsbAdminSettings');
82 
83  $mixedResult = '';
84  if(isset($_POST['save']) && isset($_POST['cat'])) {
86  $mixedResult = $oSettings->saveChanges($_POST);
87  }
88 
90  $sResult = $oSettings->getForm();
91 
92  if($mixedResult !== true && !empty($mixedResult))
93  $sResult = $mixedResult . $sResult;
94 
95  echo $this->_oTemplate->adminBlock (_t('_ch_gsearch_help_text', CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri()), _t('_ch_gsearch_help_title'), false, false, 11);
96 
97  echo $this->_oTemplate->adminBlock ($sResult, _t('_ch_gsearch_administration'), false, false, 11);
98 
99  $this->_oTemplate->addCssAdmin ('forms_adv.css');
100  $this->_oTemplate->pageCodeAdmin (_t('_ch_gsearch_administration'));
101  }
102 
103  // ================================== service actions
104 
110  {
111  $aVars = array (
112  'msg' => !getParam('ch_gsearch_id') ? MsgBox(_t('_ch_gsearch_no_search_engine_id')) : '',
113  'cx' => getParam('ch_gsearch_id'),
114  );
115  return array($this->_oTemplate->parseHtmlByName('search', $aVars));
116  }
117 
118  // ================================== other functions
119 
120  function isAdmin ()
121  {
122  return $GLOBALS['logged']['admin'] || $GLOBALS['logged']['moderator'];
123  }
124 }
$oSettings
$oSettings
Definition: advanced_settings.php:20
MsgBox
MsgBox($sText, $iTimer=0)
Definition: design.inc.php:175
ChGSearchModule\serviceGetSearchControl
serviceGetSearchControl()
Definition: ChGSearchModule.php:109
$sResult
$sResult
Definition: advanced_settings.php:26
$aModule
$aModule
Definition: classifieds.php:21
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
php
ChGSearchModule\$_iProfileId
$_iProfileId
Definition: ChGSearchModule.php:46
$iId
$iId
Definition: license.php:15
$oPage
$oPage
Definition: search_home.php:83
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
getLoggedId
getLoggedId()
Definition: profiles.inc.php:32
ChWsbModule
Definition: ChWsbModule.php:41
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
ch_proto
ch_proto($sUrl=CH_WSB_URL_ROOT)
Definition: utils.inc.php:1848
ChWsbAdminSettings
Definition: ChWsbAdminSettings.php:35
ChGSearchModule\$_sProto
$_sProto
Definition: ChGSearchModule.php:47
$aVars
$aVars
Definition: license.php:101
ChGSearchModule\__construct
__construct(&$aModule)
Definition: ChGSearchModule.php:49
ChGSearchModule\isAdmin
isAdmin()
Definition: ChGSearchModule.php:120
ChGSearchModule\actionHome
actionHome()
Definition: ChGSearchModule.php:57
ChGSearchPageMain
Definition: ChGSearchPageMain.php:11
ChGSearchModule\actionAdministration
actionAdministration()
Definition: ChGSearchModule.php:66
ChGSearchModule
Definition: ChGSearchModule.php:45
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10