Cheetah
ChSctrTemplate.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbModuleTemplate');
9 ch_import('ChTemplProfileView');
10 ch_import('ChTemplFormView');
11 ch_import('ChTemplSearchResult');
12 ch_import('ChWsbAdminSettings');
13 
14 class ChSctrTemplate extends ChWsbModuleTemplate
15 {
16  var $_oModule;
17 
21  function __construct(&$oConfig, &$oDb)
22  {
23  parent::__construct($oConfig, $oDb);
24 
25  if (isset($GLOBALS['oAdmTemplate']))
26  $GLOBALS['oAdmTemplate']->addDynamicLocation($this->_oConfig->getHomePath(), $this->_oConfig->getHomeUrl());
27  }
28 
32  function initialize(&$oModule, &$oDb)
33  {
34  $this->_oModule = $oModule;
35  $this->_oDb = $oDb;
36  }
37 
38  function profileCustomizeBlock($aTopMenu, $sPage, $aTargets, $sTarget, $aVars)
39  {
40  $sContent = '';
41  $aMenuItems = array();
42  $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri();
43 
44  $aItems = array();
45 
46  foreach ($aTopMenu as $sName => $aItem) {
47  $aItems[] = array(
48  'title' => $sName,
49  'active' => $aItem['active'],
50  'href' => $aItem['href'],
51  'onclick' => 'oChSctrMain.reloadCustomizeBlock(this.href, false); return false;'
52  );
53  }
54 
55  $sTopMenu = ChWsbPageView::getBlockCaptionMenu('site_customize', $aItems);
56 
57  // content for box
58  if ($sPage != 'themes') {
59  $sTopControls = $this->parsePageByName('designbox_top_controls.html', array(
60  'top_controls' => $this->parseHtmlByName('content_box_top_controls.html', array(
61  'name_box' => _t('_ch_sctr_select_target'),
62  'name_targets_box' => 'background_box',
63  'ch_repeat:targets' => $aTargets
64  ))
65  ));
66 
67  $sBoxContent = $this->parseHtmlByName('content_box.html', array(
68  'ch_if:select_target' => array(
69  'condition' => !empty($aTargets),
70  'content' => array(
71  'top_controls' => $sTopControls
72  )
73  ),
74  'content' => call_user_func_array(array($this, '_customPage' . ucfirst($sPage)), array($sPage, $sTarget, $aVars)),
75  'ch_repeat:buttons' => array(
76  array(
77  'btn_type' => 'button',
78  'btn_name' => 'preview',
79  'btn_value' => _t('_ch_sctr_btn_preview'),
80  'btn_action' => "oChSctrMain.reloadCustom('" . $sPage . "', '" . $sTarget . "', 'preview');"
81  ),
82  array(
83  'btn_type' => 'button',
84  'btn_name' => 'reset',
85  'btn_value' => _t('_ch_sctr_btn_reset'),
86  'btn_action' => "oChSctrMain.resetCustom('" . $sPage . "', '" . $sTarget . "', 'reset');"
87  ),
88  array(
89  'btn_type' => 'button',
90  'btn_name' => 'save',
91  'btn_value' => _t('_ch_sctr_btn_save'),
92  'btn_action' => "oChSctrMain.reloadCustom('" . $sPage . "', '" . $sTarget . "', 'save');"
93  ),
94  array(
95  'btn_type' => 'button',
96  'btn_name' => 'publish',
97  'btn_value' => _t('_ch_sctr_btn_publish'),
98  'btn_action' => "oChSctrMain.showPublish('{$sBaseUrl}publish');"
99  ),
100  )
101  ));
102  } else {
103  $iUserId = $sTarget == 'my' ? $this->_oModule->iUserId : 0;
104  $sPageThemes = $this->_customPageThemes($iUserId, true);
105 
106  if ($sPageThemes)
107  $aButtons = array(
108  array(
109  'btn_type' => 'button',
110  'btn_name' => 'preview',
111  'btn_value' => _t('_ch_sctr_btn_preview'),
112  'btn_action' => "oChSctrMain.previewTheme();"
113  ),
114  array(
115  'btn_type' => 'button',
116  'btn_name' => 'reset',
117  'btn_value' => _t('_ch_sctr_btn_reset'),
118  'btn_action' => "oChSctrMain.resetCustom('', '', 'reset');"
119  ),
120  array(
121  'btn_type' => 'button',
122  'btn_name' => 'save',
123  'btn_value' => _t('_ch_sctr_btn_save'),
124  'btn_action' => "oChSctrMain.saveTheme();"
125  ),
126  );
127  else
128  $aButtons = array();
129 
130  if ($sPageThemes && $sTarget != 'shared')
131  $aButtons[] = array(
132  'btn_type' => 'button',
133  'btn_name' => 'delete',
134  'btn_value' => _t('_ch_sctr_btn_delete'),
135  'btn_action' => "oChSctrMain.deleteTheme('" . $sBaseUrl . "deletetheme/');"
136  );
137 
138  $aButtons[] = array(
139  'btn_type' => 'button',
140  'btn_name' => 'reset',
141  'btn_value' => _t('_ch_sctr_btn_reset_all'),
142  'btn_action' => "oChSctrMain.resetAll('{$sBaseUrl}resetall');"
143  );
144 
145  $sTopControls = $this->parsePageByName('designbox_top_controls.html', array(
146  'top_controls' => $this->parseHtmlByName('content_box_top_controls.html', array(
147  'name_box' => _t('_ch_sctr_select_target'),
148  'name_targets_box' => 'background_box',
149  'ch_repeat:targets' => $aTargets
150  ))
151  ));
152 
153  $sBoxContent = $this->parseHtmlByName('content_box.html', array(
154  'ch_if:select_target' => array(
155  'condition' => !empty($aTargets),
156  'content' => array(
157  'top_controls' => $sTopControls
158  )
159  ),
160  'content' => $sPageThemes ? $sPageThemes : MsgBox(_t('_Empty')),
161  'ch_repeat:buttons' => $aButtons
162  ));
163  }
164 
165  // customize box
166  $sContent = $this->parseHtmlByName('customize_block.html', array(
167  'js_code' => $this->getJsCode(true),
168  'content' => $GLOBALS['oFunctions']->transBox(
169  DesignBoxContent(_t('_ch_sctr'), $sBoxContent, 1, $sTopMenu), false
170  )
171  ));
172 
173  $this->addCss(array('main.css'));
174  $this->addJs(array('colorinput.js', 'main.js'));
175  return $sContent;
176  }
177 
178  function getPublishForm($sComplete = '')
179  {
180  $sName = 'site_customize_popup';
181  $sContent = '';
182 
183  if($sComplete) {
184  $sContent = $this->parseHtmlByName('confirm_box.html', array(
185  'text' => MsgBox($sComplete),
186  'btn_value' => _t('_ch_sctr_btn_close'),
187  'box_name' => $sName
188  ));
189  } else {
190  $oForm = new ChTemplFormView(array(
191  'form_attrs' => array(
192  'name' => 'publish_form',
193  'action' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'publish/1',
194  'method' => 'post',
195  'enctype' => 'multipart/form-data',
196  ),
197 
198  'params' => array (),
199 
200  'inputs' => array(
201  'name_theme' => array(
202  'type' => 'text',
203  'name' => 'name_theme',
204  'value' => '',
205  'caption' => _t('_ch_sctr_name_theme'),
206  'display' => true,
207  ),
208  'thumbnail' => array(
209  'type' => 'file',
210  'name' => 'thumbnail',
211  'value' => '',
212  'caption' => _t('_ch_sctr_thumbnail'),
213  'display' => true,
214  ),
215  'submit' => array (
216  'type' => 'button',
217  'name' => 'submit_form',
218  'value' => _t('_ch_sctr_btn_save'),
219  'colspan' => true,
220  'attrs' => array(
221  'onclick' => "oChSctrMain.savePublish();"
222  ),
223  ),
224  )
225  ));
226 
227  $sContent = $this->parseHtmlByName('default_margin.html', array(
228  'content' => $oForm->getCode()
229  ));
230  }
231 
232  return PopupBox($sName, _t('_ch_sctr_publish'), $sContent);
233  }
234 
238  function adminBlock($sContent, $sTitle, $aMenu = array())
239  {
241  }
242 
243  function pageCodeAdmin($sTitle, $sType = '', $iUnitId = '', $sResult = '')
244  {
245  global $_page;
247 
248  $_page['name_index'] = 9;
249 
250  $_page['header'] = $sTitle ? $sTitle : $GLOBALS['site']['title'];
251  $_page['header_text'] = $sTitle;
252 
253  $_page_cont[$_page['name_index']]['page_main_code'] = ($sResult ? MsgBox($sResult) : '') . $this->getAdminPage($sType, $iUnitId);
254 
255  PageCodeAdmin();
256  }
257 
258  function getAdminPage($sType = '', $iUnitId = '')
259  {
260  if (!$sType)
261  $sType = 'background';
262 
263  if ($iUnitId)
264  $sCaption = _t('_ch_sctr_form_edit');
265  else
266  $sCaption = _t('_ch_sctr_form_add');
267 
268  $sContent = $this->adminBlock($this->getAdminBlockForm($sType, $iUnitId), $sCaption);
269 
270  $aMenu = array();
271  $aItems = array('background', 'font', 'border');
272  if (in_array($sType, $aItems))
273  $sSelType = $sType;
274  else
275  $sSelType = $aItems[0];
276  foreach ($aItems as $sPageType) {
277  $aMenu[$sPageType] = array(
278  'title' => _t('_ch_sctr_page_' . $sPageType),
279  'href' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/' . $sPageType,
280  'active' => $sSelType == $sPageType ? 1 : 0
281  );
282  }
283  $sContent .= $this->adminBlock($this->getAdminBlockUnits($sSelType), _t('_ch_sctr_units'), $aMenu);
284 
285  $aMenu = array();
286  $aItems = array('themes', 'import');
287  if (in_array($sType, $aItems))
288  $sSelType = $sType;
289  else
290  $sSelType = $aItems[0];
291  foreach ($aItems as $sPageType) {
292  $aMenu[$sPageType] = array(
293  'title' => _t('_ch_sctr_page_' . $sPageType),
294  'href' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/' . $sPageType,
295  'active' => $sSelType == $sPageType ? 1 : 0
296  );
297  }
298 
299  switch ($sSelType) {
300  case 'themes':
301  $sContent .= $this->adminBlock($this->getAdminPageThemes($sSelType), _t('_ch_sctr_page_themes'), $aMenu);
302  break;
303 
304  case 'import':
305  $sContent .= $this->adminBlock($this->getAdminPageImport($sSelType), _t('_ch_sctr_page_import'), $aMenu);
306  break;
307  }
308 
309  return $this->getJsCode(true) . $sContent;
310  }
311 
312  function getAdminBlockForm($sType = '', $iUnitId = '')
313  {
314  $aUnit = $iUnitId ? $this->_oDb->getUnitById($iUnitId) : array('type' => $sType);
315 
316  $oForm = $this->_getCustomUnitForm($aUnit);
317  $oForm->initChecker();
318 
319  if ($oForm->isSubmittedAndValid()) {
320  $iRes = $iUnitId ? $oForm->update($iUnitId) : $oForm->insert();
321  if ($iRes)
322  header('Location:' . CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/' . $sType);
323  }
324 
325  return $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $oForm->getCode()));
326  }
327 
328  function getAdminBlockUnits($sType)
329  {
330  // check delete
331  if ($_POST['action_delete'] && is_array($_POST['entry'])) {
332  foreach ($_POST['entry'] as $iUnitId)
333  $this->_oDb->deleteUnit($iUnitId);
334  }
335 
336  $oMain = ChWsbModule::getInstance('ChSctrModule');
337  ch_import ('SearchResult', $oMain->_aModule);
338  $oSearch = new ChSctrSearchResult($sType);
339  $sUnits = $oSearch->displayResultBlock();
340  if ($sUnits) {
341  $sFormName = 'custom_units_form';
342  $aButtons['action_delete'] = '_ch_sctr_btn_delete';
343  $aPageTypes = array();
344 
345  foreach (array('background', 'font', 'border') as $sPageType) {
346  $aPageTypes[] = array(
347  'value' => $sPageType,
348  'caption' => _t('_ch_sctr_page_' . $sPageType),
349  'selected' => $sType == $sPageType ? 'selected="selected"' : ''
350  );
351  }
352 
353  $sContent = $this->parseHtmlByName('admin_form_units.html', array(
354  'form_name' => $sFormName,
355  'action' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/' . $sType,
356  'units' => $sUnits,
357  'actions_panel' => $oSearch->showAdminActionsPanel($sFormName, $aButtons),
358  ));
359  } else
360  $sContent = MsgBox(_t('_Empty'));
361 
362  return $sContent;
363  }
364 
365  function getAdminPageThemes($sType)
366  {
367  $sPageThemes = $this->_customPageThemes();
368  if ($sPageThemes) {
369  $sFormName = 'sctr_custom_themes_form';
370  $aButtons = array(
371  'action_theme_export' => '_ch_sctr_btn_export',
372  'action_theme_delete' => '_ch_sctr_btn_delete'
373  );
374 
375  $sContent = $this->parseHtmlByName('admin_form_units.html', array(
376  'form_name' => $sFormName,
377  'action' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/' . $sType,
378  'units' => $sPageThemes,
379  'actions_panel' => ChTemplSearchResult::showAdminActionsPanel($sFormName, $aButtons, 'entry', false),
380  ));
381  } else
382  $sContent = MsgBox(_t('_Empty'));
383 
384  return $sContent;
385  }
386 
387  function getAdminPageImport($sType)
388  {
389  $sResult = '';
390  $sFile = 'theme_file';
391  $oForm = $this->_getImportForm($sType);
392 
393  return $sResult . $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $oForm->getCode()));
394  }
395 
396  function getJsCode($bWrap = false)
397  {
398  $sJsMainClass = $this->_oConfig->getJsClass();
399  $sJsMainObject = $this->_oConfig->getJsObject();
400  ob_start();
401 ?>
402  var <?php echo $sJsMainObject; ?> = new <?php echo $sJsMainClass; ?>({
403  sBaseUrl: '<?php echo CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri(); ?>',
404  sReset: '<?php echo ch_js_string(_t('_ch_sctr_js_reset')); ?>',
405  sErrThemeName: '<?php echo ch_js_string(_t('_ch_sctr_js_err_theme_name')); ?>',
406  sErrChooseTheme: '<?php echo ch_js_string(_t('_ch_sctr_js_err_choose_theme')); ?>',
407  sDeleteTheme: '<?php echo ch_js_string(_t('_ch_sctr_js_delete_theme')); ?>',
408  sResetPage: '<?php echo ch_js_string(_t('_ch_sctr_js_reset_page')); ?>'
409  });
410 <?php
411  $sContent = ob_get_clean();
412  return $bWrap ? $this->_wrapInTagJsCode($sContent) : $sContent;
413  }
414 
418  function _getImportForm($sType)
419  {
420  $aForm = array(
421  'form_attrs' => array(
422  'name' => 'publish_form',
423  'action' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/' . $sType,
424  'method' => 'post',
425  'enctype' => 'multipart/form-data',
426  ),
427  'inputs' => array(
428  'theme_file' => array(
429  'type' => 'file',
430  'name' => 'theme_file',
431  'value' => '',
432  'caption' => _t('_ch_sctr_theme'),
433  'display' => true,
434  ),
435  'submit' => array (
436  'type' => 'submit',
437  'name' => 'submit_import',
438  'value' => _t('_ch_sctr_btn_import'),
439  'colspan' => true,
440  ),
441  )
442  );
443 
444  return new ChTemplFormView($aForm);
445  }
446 
447  function _getCustomUnitForm($aUnit = array())
448  {
449  $aForm = array(
450  'form_attrs' => array(
451  'name' => 'unit_form',
452  'action' => $_SERVER['REQUEST_URI'],
453  'method' => 'post',
454  'enctype' => 'multipart/form-data',
455  ),
456  'params' => array (
457  'db' => array(
458  'table' => $this->_oDb->getPrefix() . 'units',
459  'key' => 'id',
460  'submit_name' => 'submit_save',
461  ),
462  ),
463  'inputs' => array(
464 
465  'name' => array(
466  'type' => 'text',
467  'name' => 'name',
468  'value' => isset($aUnit['name']) ? $aUnit['name'] : '',
469  'caption' => _t('_ch_sctr_name'),
470  'required' => true,
471  'checker' => array (
472  'func' => 'length',
473  'params' => array(1,100),
474  'error' => _t('_ch_sctr_form_field_err'),
475  ),
476  'db' => array(
477  'pass' => 'Xss'
478  ),
479  'display' => true,
480  ),
481  'caption' => array(
482  'type' => 'text',
483  'name' => 'caption',
484  'value' => isset($aUnit['caption']) ? $aUnit['caption'] : '',
485  'caption' => _t('_ch_sctr_caption'),
486  'required' => true,
487  'checker' => array (
488  'func' => 'length',
489  'params' => array(1,100),
490  'error' => _t('_ch_sctr_form_field_err'),
491  ),
492  'db' => array(
493  'pass' => 'Xss'
494  ),
495  'display' => true,
496  ),
497  'css_name' => array(
498  'type' => 'text',
499  'name' => 'css_name',
500  'value' => isset($aUnit['css_name']) ? $aUnit['css_name'] : '',
501  'caption' => _t('_ch_sctr_css_name'),
502  'required' => true,
503  'checker' => array (
504  'func' => 'length',
505  'params' => array(1,500),
506  'error' => _t('_ch_sctr_form_field_err'),
507  ),
508  'db' => array(
509  'pass' => 'Xss'
510  ),
511  'display' => true,
512  ),
513  'type' => array(
514  'type' => 'select',
515  'name' => 'type',
516  'required' => true,
517  'values' => array(
518  'background' => _t('_ch_sctr_page_background'),
519  'font' => _t('_ch_sctr_page_font'),
520  'border' => _t('_ch_sctr_page_border'),
521  ),
522  'value' => isset($aUnit['type']) ? $aUnit['type'] : '',
523  'caption' => _t('_ch_sctr_type'),
524  'attrs' => array(
525  'multiplyable' => false
526  ),
527  'display' => true,
528  'db' => array(
529  'pass' => 'Xss'
530  ),
531  ),
532  'submit' => array (
533  'type' => 'submit',
534  'name' => 'submit_save',
535  'value' => isset($aUnit['id']) ? _t('_ch_sctr_btn_save') : _t('_ch_sctr_btn_add'),
536  'colspan' => true,
537  ),
538  )
539  );
540 
541  return new ChTemplFormView($aForm);
542  }
543 
544  function _customPageThemes($iUserId = 0, $bForm = false)
545  {
546  $aThemes = $this->_oDb->getAllThemes();
547  if(empty($aThemes))
548  return '';
549 
550  $aItems = array();
551  foreach ($aThemes as $aTheme) {
552  $sFileName = CH_SCTR_THEME_PREFIX . $aTheme['id'] . CH_SCTR_THUMB_EXT;
553  if (file_exists($this->_oModule->_getImagesDir() . $sFileName))
554  $sThumb = $this->_oModule->_getImagesPath() . $sFileName;
555  else
556  $sThumb = $this->getIconUrl('no-photo-64.png');
557 
558  $aItems[] = array(
559  'id' => $aTheme['id'],
560  'name' => $aTheme['name'],
561  'thumbnail' => $sThumb,
562  'spacer' => $this->getImageUrl('spacer.gif')
563  );
564  }
565 
566  $sContent = $this->parseHtmlByName('themes_box.html', array(
567  'ch_repeat:items' => $aItems,
568  'save_url' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'savetheme/'
569  ));
570 
571  if($bForm)
572  $sContent = $this->parseHtmlByName('themes_box_form.html', array(
573  'name' => 'themes_form',
574  'action' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'save',
575  'content' => $sContent
576  ));
577 
578  return $sContent;
579  }
580 
581  function _customPageBackground($sPage, $sTarget, $aVars)
582  {
583  $aForm = array(
584  'form_attrs' => array(
585  'name' => 'background_form',
586  'action' => $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'save',
587  'method' => 'POST',
588  'enctype' => 'multipart/form-data',
589  'id' => 'sctr_custom_themes_form',
590  ),
591  'inputs' => array(
592  'color' => array(
593  'type' => 'text',
594  'name' => 'color',
595  'value' => isset($aVars['color']) ? $aVars['color'] : '',
596  'caption' => _t('_ch_sctr_color'),
597  'display' => true,
598  ),
599  'useimage' => array(
600  'type' => 'custom',
601  'name' => 'useimage',
602  'caption' => _t('_ch_sctr_use_image'),
603  'content' => ''
604  ),
605  'image' => array(
606  'type' => 'file',
607  'name' => 'image',
608  'value' => isset($aVars['image']) ? $aVars['image'] : '',
609  'caption' => _t('_ch_sctr_image'),
610  'display' => true,
611  ),
612  'repeat' => array(
613  'type' => 'select',
614  'name' => 'repeat',
615  'values' => array(
616  'default' => _t('_ch_sctr_default'),
617  'no-repeat' => _t('_ch_sctr_no'),
618  'repeat' => _t('_ch_sctr_repeat'),
619  'repeat-x' => _t('_ch_sctr_repeat_x'),
620  'repeat-y' => _t('_ch_sctr_repeat_y'),
621  ),
622  'value' => isset($aVars['repeat']) ? $aVars['repeat'] : '',
623  'caption' => _t('_ch_sctr_repeat'),
624  'attrs' => array(
625  'multiplyable' => false
626  ),
627  'display' => true,
628  ),
629  'position' => array(
630  'type' => 'select',
631  'name' => 'position',
632  'values' => array(
633  'default' => _t('_ch_sctr_default'),
634  'left top' => _t('_ch_sctr_top_left'),
635  'center top' => _t('_ch_sctr_top_center'),
636  'right top' => _t('_ch_sctr_top_right'),
637  'left center' => _t('_ch_sctr_center_left'),
638  'center center' => _t('_ch_sctr_center'),
639  'right center' => _t('_ch_sctr_center_right'),
640  'left bottom' => _t('_ch_sctr_bottom_left'),
641  'center bottom' => _t('_ch_sctr_bottom_center'),
642  'right bottom' => _t('_ch_sctr_bottom_right')
643  ),
644  'value' => isset($aVars['position']) ? $aVars['position'] : 'default',
645  'caption' => _t('_ch_sctr_position'),
646  'attrs' => array(
647  'multiplyable' => false
648  ),
649  'display' => true,
650  ),
651  'page' => array(
652  'type' => 'hidden',
653  'name' => 'page',
654  'value' => $sPage,
655  ),
656  'trg' => array(
657  'type' => 'hidden',
658  'name' => 'trg',
659  'value' => $sTarget,
660  ),
661  'action' => array(
662  'type' => 'hidden',
663  'name' => 'action',
664  'value' => '',
665  ),
666  )
667  );
668 
669  if (isset($aVars['image']) && file_exists($this->_oModule->_getImagesDir() . CH_SCTR_SMALL_PREFIX . $aVars['image'])) {
670  $aForm['inputs']['useimage']['content'] = $this->parseHtmlByName('thumb.html', array(
671  'thumbnail' => $this->_oModule->_getImagesPath() . CH_SCTR_SMALL_PREFIX . $aVars['image'],
672  'spacer' => $this->getImageUrl('spacer.gif'),
673  'name' => 'useimage',
674  'checked' => isset($aVars['useimage']) ? 'checked="1"' : '',
675 
676  ));
677  $aForm['inputs']['image']['caption'] = _t('_ch_sctr_other_image');
678  }
679  else
680  unset($aForm['inputs']['useimage']);
681 
683  return $oForm->getCode();
684  }
685 
686  function _customPageFont($sPage, $sTarget, $aVars)
687  {
688  $aForm = array(
689  'form_attrs' => array(
690  'name' => 'fonts_form',
691  'action' => $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'save',
692  'method' => 'POST',
693  'enctype' => 'multipart/form-data',
694  ),
695  'inputs' => array(
696  'size' => array(
697  'type' => 'select',
698  'name' => 'size',
699  'values' => array(
700  -1 => _t('_ch_sctr_default'),
701  8 => '8',
702  9 => '9',
703  10 => '10',
704  11 => '11',
705  12 => '12',
706  14 => '14',
707  16 => '16',
708  18 => '18',
709  20 => '20',
710  22 => '22',
711  24 => '24',
712  ),
713  'value' => isset($aVars['size']) ? (int)$aVars['size'] : -1,
714  'caption' => _t('_ch_sctr_size'),
715  'attrs' => array(
716  'multiplyable' => false
717  ),
718  'display' => true,
719  ),
720  'color' => array(
721  'type' => 'text',
722  'name' => 'color',
723  'value' => isset($aVars['color']) ? $aVars['color'] : '',
724  'caption' => _t('_ch_sctr_color'),
725  'display' => true,
726  ),
727  'name' => array(
728  'type' => 'select',
729  'name' => 'name',
730  'values' => array(
731  'default' => _t('_ch_sctr_default'),
732  'Arial, Helvetica, sans-serif' => 'Arial',
733  'comicsans' => 'Comic Sans',
734  'Courier New, Courier, monospace' => 'Courier New',
735  'Georgia, lucida grande, Times New Roman, Times, serif' => 'Georgia',
736  'Tahoma, Verdana, Arial, Helvetica, sans-serif' => 'Tahoma',
737  'Times New Roman, Times, serif' => 'Times Roman',
738  'Trebuchet, Trebuchet MS, Helvetica, sans-serif' => 'Trebuchet',
739  'Verdana, Arial, Helvetica, sans-serif' => 'Verdana'
740  ),
741  'value' => isset($aVars['name']) ? $aVars['name'] : '',
742  'caption' => _t('_ch_sctr_name'),
743  'attrs' => array(
744  'multiplyable' => false
745  ),
746  'display' => true,
747  ),
748  'style' => array(
749  'type' => 'select',
750  'name' => 'style',
751  'values' => array(
752  'default' => _t('_ch_sctr_default'),
753  'normal' => _t('_ch_sctr_normal'),
754  'bold' => _t('_ch_sctr_bold'),
755  'italic' => _t('_ch_sctr_italic')
756  ),
757  'value' => isset($aVars['style']) ? $aVars['style'] : 'default',
758  'caption' => _t('_ch_sctr_style'),
759  'attrs' => array(
760  'multiplyable' => false
761  ),
762  'display' => true,
763  ),
764  'page' => array(
765  'type' => 'hidden',
766  'name' => 'page',
767  'value' => $sPage,
768  ),
769  'trg' => array(
770  'type' => 'hidden',
771  'name' => 'trg',
772  'value' => $sTarget,
773  ),
774  'action' => array(
775  'type' => 'hidden',
776  'name' => 'action',
777  'value' => '',
778  ),
779  )
780  );
781 
783  return $oForm->getCode();
784  }
785 
786  function _customPageBorder($sPage, $sTarget, $aVars)
787  {
788  $aForm = array(
789  'form_attrs' => array(
790  'name' => 'border_form',
791  'action' => $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'save',
792  'method' => 'POST',
793  'enctype' => 'multipart/form-data',
794  ),
795  'inputs' => array(
796  'size' => array(
797  'type' => 'select',
798  'name' => 'size',
799  'values' => array(
800  -1 => _t('_ch_sctr_default'),
801  0 => _t('_ch_sctr_none'),
802  1 => '1',
803  2 => '2',
804  3 => '3',
805  4 => '4',
806  5 => '5',
807  6 => '6',
808  7 => '7',
809  8 => '8',
810  9 => '9',
811  10 => '10',
812  ),
813  'value' => isset($aVars['size']) ? (int)$aVars['size'] : -1,
814  'caption' => _t('_ch_sctr_size'),
815  'attrs' => array(
816  'multiplyable' => false
817  ),
818  'display' => true,
819  ),
820  'color' => array(
821  'type' => 'text',
822  'name' => 'color',
823  'value' => isset($aVars['color']) ? $aVars['color'] : '',
824  'caption' => _t('_ch_sctr_color'),
825  'display' => true,
826  ),
827  'style' => array(
828  'type' => 'select',
829  'name' => 'style',
830  'values' => array(
831  'default' => _t('_ch_sctr_default'),
832  'dotted' => _t('_ch_sctr_dotted'),
833  'dashed' => _t('_ch_sctr_dashed'),
834  'solid' => _t('_ch_sctr_solid'),
835  'double' => _t('_ch_sctr_double'),
836  'groove' => _t('_ch_sctr_groove'),
837  'ridge' => _t('_ch_sctr_ridge'),
838  'inset' => _t('_ch_sctr_inset'),
839  'outset' => _t('_ch_sctr_outset'),
840  ),
841  'value' => isset($aVars['style']) ? $aVars['style'] : 'default',
842  'caption' => _t('_ch_sctr_style'),
843  'attrs' => array(
844  'multiplyable' => false
845  ),
846  'display' => true,
847  ),
848  'position' => array(
849  'type' => 'select',
850  'name' => 'position',
851  'values' => array(
852  'default' => _t('_ch_sctr_default'),
853  'full' => _t('_ch_sctr_border_full'),
854  'top' => _t('_ch_sctr_border_top'),
855  'right' => _t('_ch_sctr_border_right'),
856  'bottom' => _t('_ch_sctr_border_bottom'),
857  'left' => _t('_ch_sctr_border_left'),
858  'left_right' => _t('_ch_sctr_border_left_right'),
859  'top_bottom' => _t('_ch_sctr_border_top_bottom'),
860  'top_right' => _t('_ch_sctr_border_top_right'),
861  'right_bottom' => _t('_ch_sctr_border_right_bottom'),
862  'bottom_left' => _t('_ch_sctr_border_bottom_left'),
863  'left_top' => _t('_ch_sctr_border_left_top'),
864  ),
865  'value' => isset($aVars['position']) ? $aVars['position'] : 'default',
866  'caption' => _t('_ch_sctr_position'),
867  'attrs' => array(
868  'multiplyable' => false
869  ),
870  'display' => true,
871  ),
872  'page' => array(
873  'type' => 'hidden',
874  'name' => 'page',
875  'value' => $sPage,
876  ),
877  'trg' => array(
878  'type' => 'hidden',
879  'name' => 'trg',
880  'value' => $sTarget,
881  ),
882  'action' => array(
883  'type' => 'hidden',
884  'name' => 'action',
885  'value' => '',
886  ),
887  )
888  );
889 
891  return $oForm->getCode();
892  }
893 
894 }
header
</code > Be careful enabling this directive if you have a redirector script that does not use the< code > Location</code > HTTP header
Definition: URI.MungeResources.txt:10
ChWsbModuleTemplate\pageCodeAdmin
pageCodeAdmin($sTitle)
Definition: ChWsbModuleTemplate.php:58
$oModule
if(! @isAdmin()) $oModule
Definition: admin.php:25
ChTemplFormView
Definition: ChTemplFormView.php:11
ChWsbTemplate\parsePageByName
parsePageByName($sName, $aVariables)
Definition: ChWsbTemplate.php:720
MsgBox
MsgBox($sText, $iTimer=0)
Definition: design.inc.php:175
ChWsbModule\getInstance
static getInstance($sClassName)
Definition: ChWsbModule.php:89
$sBoxContent
$sBoxContent
Definition: db.php:35
$aUnit
$aUnit
Definition: short_profile_info.php:31
$sResult
$sResult
Definition: advanced_settings.php:26
$_page
$_page['name_index']
Definition: about_us.php:13
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
$_page_cont
$_page_cont[$_ni]['page_main_code']
Definition: about_us.php:24
ChWsbPageView\getBlockCaptionMenu
static getBlockCaptionMenu( $iBlockID, $aLinks)
Definition: ChWsbPageView.php:586
ChWsbTemplate\addCss
addCss($mixedFiles, $bDynamic=false)
Definition: ChWsbTemplate.php:1114
CH_SCTR_SMALL_PREFIX
const CH_SCTR_SMALL_PREFIX
Definition: ChSctrModule.php:14
ChWsbTemplate\getIconUrl
getIconUrl($sName, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH)
Definition: ChWsbTemplate.php:569
php
$oForm
$oForm
Definition: host_tools.php:42
DesignBoxAdmin
DesignBoxAdmin($sTitle, $sContent, $mixedTopItems='', $sBottomItems='', $iIndex=1)
Definition: admin_design.inc.php:50
$sType
$sType
Definition: actions.inc.php:11
$sFile
$sFile
Definition: index.php:20
ChWsbTemplate\_wrapInTagJsCode
_wrapInTagJsCode($sCode)
Definition: ChWsbTemplate.php:1102
ChWsbTemplate\getImageUrl
getImageUrl($sName, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH)
Definition: ChWsbTemplate.php:595
$sTitle
$sTitle
Definition: actions.inc.php:13
$oDb
global $oDb
Definition: db.inc.php:39
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition: header.inc.php:25
PageCodeAdmin
PageCodeAdmin($oTemplate=null)
Definition: admin_design.inc.php:45
$sContent
$sContent
Definition: bottom_menu_compose.php:169
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
CH_SCTR_THUMB_EXT
const CH_SCTR_THUMB_EXT
Definition: ChSctrModule.php:16
$aMenu
$aMenu
Definition: categories.php:257
CH_SCTR_THEME_PREFIX
const CH_SCTR_THEME_PREFIX
Definition: ChSctrModule.php:15
$aVars
$aVars
Definition: license.php:101
ChWsbTemplate\addJs
addJs($mixedFiles, $bDynamic=false)
Definition: ChWsbTemplate.php:999
PopupBox
PopupBox($sName, $sTitle, $sContent, $aActions=array())
Definition: design.inc.php:189
ChWsbModuleTemplate
Definition: ChWsbModuleTemplate.php:11
$aForm
$aForm
Definition: forgot.php:43
ChSctrSearchResult
Definition: ChSctrSearchResult.php:12
ChBaseSearchResult\showAdminActionsPanel
static showAdminActionsPanel($sWrapperId, $aButtons, $sCheckboxName='entry', $bSelectAll=true, $bSelectAllChecked=false, $sCustomHtml='')
Definition: ChBaseSearchResult.php:81
$sCaption
$sCaption
Definition: tellfriend.php:39
ChWsbModuleTemplate\__construct
__construct(&$oConfig, &$oDb, $sRootPath=CH_DIRECTORY_PATH_ROOT, $sRootUrl=CH_WSB_URL_ROOT)
Definition: ChWsbModuleTemplate.php:19
DesignBoxContent
DesignBoxContent($title, $content, $db_num=0, $caption_item='', $bottom_item='')
Definition: design.inc.php:78
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
$sName
$sName
Definition: ChWsbAdminTools.php:853
ChWsbTemplate\parseHtmlByName
parseHtmlByName($sName, $aVariables, $mixedKeyWrapperHtml=null, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH)
Definition: ChWsbTemplate.php:660
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10