Cheetah
ChProfileCustomizeTemplate.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbModuleTemplate');
9 ch_import('ChTemplProfileView');
10 ch_import('ChTemplProfileGenerator');
11 ch_import('ChTemplFormView');
12 ch_import('ChTemplSearchResult');
13 ch_import('ChWsbAdminSettings');
14 
15 class ChProfileCustomizeTemplate extends ChWsbModuleTemplate
16 {
17  var $_oModule;
18 
22  function __construct(&$oConfig, &$oDb)
23  {
24  parent::__construct($oConfig, $oDb);
25 
26  if (isset($GLOBALS['oAdmTemplate']))
27  $GLOBALS['oAdmTemplate']->addDynamicLocation($this->_oConfig->getHomePath(), $this->_oConfig->getHomeUrl());
28  }
29 
30  function setModule(&$oModule)
31  {
32  $this->_oModule = $oModule;
33  }
34 
35  function profileCustomizeBlock($aTopMenu, $sPage, $aTargets, $sTarget, $aVars)
36  {
37  $sContent = '';
38  $sBlockName = 'profile_customize';
39  $aMenuItems = array();
40  $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri();
41 
42  $aItems = array();
43 
44  foreach ($aTopMenu as $sName => $aItem) {
45  $aItems[] = array(
46  'title' => $sName,
47  'active' => $aItem['active'],
48  'href' => $aItem['href'],
49  'onclick' => 'oCustomizer.reloadCustomizeBlock(this.href, false); return false;'
50  );
51  }
52 
53  $sTopMenu = ChWsbPageView::getBlockCaptionMenu('profile_customizer', $aItems);
54 
55  // content for box
56  if ($sPage != 'themes') {
57  $sTopControls = $this->parsePageByName('designbox_top_controls.html', array(
58  'top_controls' => $this->parseHtmlByName('content_box_top_controls.html', array(
59  'name_box' => _t('_ch_profile_customize_select_target'),
60  'name_targets_box' => 'background_box',
61  'ch_repeat:targets' => $aTargets
62  ))
63  ));
64 
65  $sBoxContent = $this->parseHtmlByName('content_box.html', array(
66  'ch_if:select_target' => array(
67  'condition' => !empty($aTargets),
68  'content' => array(
69  'top_controls' => $sTopControls
70  )
71  ),
72  'content' => call_user_func_array(array($this, '_customPage' . ucfirst($sPage)), array($sPage, $sTarget, $aVars)),
73  'ch_repeat:buttons' => array(
74  array(
75  'btn_type' => 'button',
76  'btn_name' => 'save',
77  'btn_value' => _t('_ch_profile_customize_btn_save'),
78  'btn_action' => "oCustomizer.reloadCustom('" . $sBaseUrl . "customizepage/" . $sPage . '/' . $sTarget . "', '" . $sBaseUrl . "profileblock/save');"
79  ),
80  array(
81  'btn_type' => 'button',
82  'btn_name' => 'reset',
83  'btn_value' => _t('_ch_profile_customize_btn_reset'),
84  'btn_action' => "oCustomizer.resetCustom('" . $sBaseUrl . "customizepage/" . $sPage . '/' . $sTarget . "', '" . $sBaseUrl . "profileblock/preview');"
85  ),
86  array(
87  'btn_type' => 'button',
88  'btn_name' => 'preview',
89  'btn_value' => _t('_ch_profile_customize_btn_preview'),
90  'btn_action' => "oCustomizer.reloadCustom('" . $sBaseUrl . "customizepage/" . $sPage . '/' . $sTarget . "', '" . $sBaseUrl . "profileblock/preview');"
91  ),
92  array(
93  'btn_type' => 'button',
94  'btn_name' => 'publish',
95  'btn_value' => _t('_ch_profile_customize_btn_publish'),
96  'btn_action' => "oCustomizer.showPublish('{$sBaseUrl}publish');"
97  ),
98  )
99  ));
100  } else {
101  $iUserId = $sTarget == 'my' ? $this->_oModule->iUserId : 0;
102  $sPageThemes = $this->_customPageThemes($iUserId, true);
103 
104  if ($sPageThemes)
105  $aButtons = array(
106  array(
107  'btn_type' => 'button',
108  'btn_name' => 'save',
109  'btn_value' => _t('_ch_profile_customize_btn_save'),
110  'btn_action' => "oCustomizer.saveTheme();"
111  ),
112  array(
113  'btn_type' => 'button',
114  'btn_name' => 'preview',
115  'btn_value' => _t('_ch_profile_customize_btn_preview'),
116  'btn_action' => "oCustomizer.previewTheme();"
117  ),
118  );
119  else
120  $aButtons = array();
121 
122  if ($sPageThemes && $sTarget != 'shared')
123  $aButtons[] = array(
124  'btn_type' => 'button',
125  'btn_name' => 'delete',
126  'btn_value' => _t('_ch_profile_customize_btn_delete'),
127  'btn_action' => "oCustomizer.deleteTheme('" . $sBaseUrl . "deletetheme/');"
128  );
129 
130  $aButtons[] = array(
131  'btn_type' => 'button',
132  'btn_name' => 'reset',
133  'btn_value' => _t('_ch_profile_customize_btn_reset_all'),
134  'btn_action' => "oCustomizer.resetAll('{$sBaseUrl}resetall');"
135  );
136 
137  $sTopControls = $this->parsePageByName('designbox_top_controls.html', array(
138  'top_controls' => $this->parseHtmlByName('content_box_top_controls.html', array(
139  'name_box' => _t('_ch_profile_customize_select_target'),
140  'name_targets_box' => 'background_box',
141  'ch_repeat:targets' => $aTargets
142  ))
143  ));
144 
145  $sBoxContent = $this->parseHtmlByName('content_box.html', array(
146  'ch_if:select_target' => array(
147  'condition' => !empty($aTargets),
148  'content' => array(
149  'top_controls' => $sTopControls
150  )
151  ),
152  'content' => $sPageThemes ? $sPageThemes : MsgBox(_t('_Empty')),
153  'ch_repeat:buttons' => $aButtons
154  ));
155  }
156 
157  // customize box
158  $sContent = $this->parseHtmlByName('customize_block.html', array(
159  'js_code' => $this->getJsCode(true),
160  'name' => $sBlockName,
161  'content' => $GLOBALS['oFunctions']->transBox(
162  DesignBoxContent(_t('_ch_profile_customize'), $sBoxContent, 1, $sTopMenu), false
163  )
164  ));
165 
166  $this->addCss(array('main.css'));
167  $this->addJs(array('colorinput.js', 'main.js'));
168  return $sContent;
169  }
170 
171  function profilePage($iUserId, $sCss)
172  {
173  global $p_arr;
174 
175  $oProfile = new ChTemplProfileGenerator($iUserId);
177 
178  $oProfile->oCmtsView->getExtraCss();
179  $oProfile->oCmtsView->getExtraJs();
180  $oProfile->oVotingView->getExtraJs();
181  $p_arr = $oProfile->_aProfile;
182 
183  return $this->parseHtmlByName('profile_page.html', array(
184  'page_main_css' => $sCss,
185  'page_main_code' => $oPPV->getCode()
186  ));
187  }
188 
189  function getPublishForm($sComplete = '')
190  {
191  $sName = 'dynamicPopup';
192  $sContent = '';
193 
194  if($sComplete) {
195  $sContent = $this->parseHtmlByName('confirm_box.html', array(
196  'text' => MsgBox($sComplete),
197  'btn_value' => _t('_ch_profile_customize_btn_close'),
198  'box_name' => $sName
199  ));
200  } else {
201  $aForm = array(
202  'form_attrs' => array(
203  'name' => 'publish_form',
204  'action' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'publish/1',
205  'method' => 'post',
206  'enctype' => 'multipart/form-data',
207  ),
208 
209  'params' => array (),
210 
211  'inputs' => array(
212  'name_theme' => array(
213  'type' => 'text',
214  'name' => 'name_theme',
215  'value' => '',
216  'caption' => _t('_ch_profile_customize_name_theme'),
217  'display' => true,
218  ),
219  'thumbnail' => array(
220  'type' => 'file',
221  'name' => 'thumbnail',
222  'value' => '',
223  'caption' => _t('_ch_profile_customize_thumbnail'),
224  'display' => true,
225  ),
226  'destination' => array(
227  'type' => 'radio_set',
228  'name' => 'destination',
229  'caption' => _t('_ch_profile_customize_destination'),
230  'value' => $this->_oModule->iUserId,
231  'values' => array(
232  $this->_oModule->iUserId => _t('_ch_profile_customize_page_themes_my'),
233  0 => _t('_ch_profile_customize_page_themes_shared')
234  )
235  ),
236  'submit' => array (
237  'type' => 'button',
238  'name' => 'submit_form',
239  'value' => _t('_ch_profile_customize_btn_save'),
240  'colspan' => true,
241  'attrs' => array(
242  'onclick' => "oCustomizer.savePublish();"
243  ),
244  ),
245  )
246  );
247 
248  if(!$this->_oModule->isAdmin())
249  unset($aForm['inputs']['destination']);
250 
252  $sContent = $this->parseHtmlByName('default_margin.html', array(
253  'content' => $oForm->getCode()
254  ));
255  }
256 
257  return PopupBox(
258  $sName, _t('_ch_profile_customize_publish'), $sContent
259  );
260  }
261 
265  function adminBlock($sContent, $sTitle, $aMenu = array())
266  {
268  }
269 
270  function pageCodeAdmin($sTitle, $sType = '', $iUnitId = '', $sResult = '')
271  {
272  global $_page;
274 
275  $_page['name_index'] = 9;
276 
277  $_page['header'] = $sTitle ? $sTitle : $GLOBALS['site']['title'];
278  $_page['header_text'] = $sTitle;
279 
280  $_page_cont[$_page['name_index']]['page_main_code'] = ($sResult ? MsgBox($sResult) : '') . $this->getAdminPage($sType, $iUnitId);
281 
282  PageCodeAdmin();
283  }
284 
285  function getAdminPage($sType = '', $iUnitId = '')
286  {
287  if (!$sType)
288  $sType = 'background';
289 
290  if ($iUnitId)
291  $sCaption = _t('_ch_profile_customize_form_edit');
292  else
293  $sCaption = _t('_ch_profile_customize_form_add');
294 
295  $sContent = $this->adminBlock($this->getAdminBlockForm($sType, $iUnitId), $sCaption);
296 
297  $aMenu = array();
298  $aItems = array('background', 'font', 'border');
299  if (in_array($sType, $aItems))
300  $sSelType = $sType;
301  else
302  $sSelType = $aItems[0];
303  foreach ($aItems as $sPageType) {
304  $aMenu[$sPageType] = array(
305  'title' => _t('_ch_profile_customize_page_' . $sPageType),
306  'href' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/' . $sPageType,
307  'active' => $sSelType == $sPageType ? 1 : 0
308  );
309  }
310  $sContent .= $this->adminBlock($this->getAdminBlockUnits($sSelType), _t('_ch_profile_customize_units'), $aMenu);
311 
312  $aMenu = array();
313  $aItems = array('themes', 'import');
314  if (in_array($sType, $aItems))
315  $sSelType = $sType;
316  else
317  $sSelType = $aItems[0];
318  foreach ($aItems as $sPageType) {
319  $aMenu[$sPageType] = array(
320  'title' => _t('_ch_profile_customize_page_' . $sPageType),
321  'href' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/' . $sPageType,
322  'active' => $sSelType == $sPageType ? 1 : 0
323  );
324  }
325 
326  switch ($sSelType) {
327  case 'themes':
328  $sContent .= $this->adminBlock($this->getAdminPageThemes($sSelType), _t('_ch_profile_customize_page_themes'), $aMenu);
329  break;
330 
331  case 'import':
332  $sContent .= $this->adminBlock($this->getAdminPageImport($sSelType), _t('_ch_profile_customize_page_import'), $aMenu);
333  break;
334  }
335 
336  return $this->getJsCode(true) . $sContent;
337  }
338 
339  function getAdminBlockForm($sType = '', $iUnitId = '')
340  {
341  if ($iUnitId) {
342  $aUnit = $this->_oDb->getUnitById($iUnitId);
343  } else
344  $aUnit = array(
345  'type' => $sType
346  );
347 
348  $oForm = $this->_getCustomUnitForm($aUnit);
349  $oForm->initChecker();
350 
351  if ($oForm->isSubmittedAndValid()) {
352  if ($iUnitId)
353  $iRes = $oForm->update($iUnitId);
354  else
355  $iRes = $oForm->insert();
356 
357  if ($iRes)
358  header('Location:' . CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/' . $sType);
359  }
360 
361  return $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $oForm->getCode()));
362  }
363 
364  function getAdminBlockUnits($sType)
365  {
366  // check delete
367  if ($_POST['action_delete'] && is_array($_POST['entry'])) {
368  foreach ($_POST['entry'] as $iUnitId)
369  $this->_oDb->deleteUnit($iUnitId);
370  }
371 
372  $oMain = ChWsbModule::getInstance('ChProfileCustomizeModule');
373  ch_import ('SearchResult', $oMain->_aModule);
374  $oSearch = new ChProfileCustomizeSearchResult($sType);
375  $sUnits = $oSearch->displayResultBlock();
376  if ($sUnits) {
377  $sFormName = 'custom_units_form';
378  $aButtons['action_delete'] = '_ch_profile_customize_btn_delete';
379  $aPageTypes = array();
380 
381  foreach (array('background', 'font', 'border') as $sPageType) {
382  $aPageTypes[] = array(
383  'value' => $sPageType,
384  'caption' => _t('_ch_profile_customize_page_' . $sPageType),
385  'selected' => $sType == $sPageType ? 'selected="selected"' : ''
386  );
387  }
388 
389  $sContent = $this->parseHtmlByName('admin_form_units.html', array(
390  'form_name' => $sFormName,
391  'action' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/' . $sType,
392  'units' => $sUnits,
393  'actions_panel' => $oSearch->showAdminActionsPanel($sFormName, $aButtons),
394  ));
395  } else
396  $sContent = MsgBox(_t('_Empty'));
397 
398  return $sContent;
399  }
400 
401  function getAdminPageThemes($sType)
402  {
403  $sPageThemes = $this->_customPageThemes();
404  if ($sPageThemes) {
405  $sFormName = 'custom_themes_form';
406  $aButtons = array(
407  'action_theme_export' => '_ch_profile_customize_btn_export',
408  'action_theme_delete' => '_ch_profile_customize_btn_delete'
409  );
410 
411  $sContent = $this->parseHtmlByName('admin_form_units.html', array(
412  'form_name' => $sFormName,
413  'action' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/' . $sType,
414  'units' => $sPageThemes,
415  'actions_panel' => ChTemplSearchResult::showAdminActionsPanel($sFormName, $aButtons, 'entry', false),
416  ));
417  } else
418  $sContent = MsgBox(_t('_Empty'));
419 
420  return $sContent;
421  }
422 
423  function getAdminPageImport($sType)
424  {
425  $sResult = '';
426  $sFile = 'theme_file';
427  $oForm = $this->_getImportForm($sType);
428 
429  return $sResult . $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $oForm->getCode()));
430  }
431 
432  function getJsCode($bWrap = false)
433  {
434  $sJsMainClass = $this->_oConfig->getJsClass();
435  $sJsMainObject = $this->_oConfig->getJsObject();
436  ob_start();
437 ?>
438  var <?php echo $sJsMainObject; ?> = new <?php echo $sJsMainClass; ?>({
439  sReset: '<?php echo ch_js_string(_t('_ch_profile_customize_js_reset')); ?>',
440  sErrThemeName: '<?php echo ch_js_string(_t('_ch_profile_customize_js_err_theme_name')); ?>',
441  sErrChooseTheme: '<?php echo ch_js_string(_t('_ch_profile_customize_js_err_choose_theme')); ?>',
442  sDeleteTheme: '<?php echo ch_js_string(_t('_ch_profile_customize_js_delete_theme')); ?>',
443  sResetPage: '<?php echo ch_js_string(_t('_ch_profile_customize_js_reset_page')); ?>'
444  });
445 <?php
446  $sContent = ob_get_clean();
447  return $bWrap ? $this->_wrapInTagJsCode($sContent) : $sContent;
448  }
449 
454  function _getImportForm($sType)
455  {
456  return new ChTemplFormView(array(
457 
458  'form_attrs' => array(
459  'name' => 'publish_form',
460  'action' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/' . $sType,
461  'method' => 'post',
462  'enctype' => 'multipart/form-data',
463  ),
464 
465  'inputs' => array(
466  'theme_file' => array(
467  'type' => 'file',
468  'name' => 'theme_file',
469  'value' => '',
470  'caption' => _t('_ch_profile_customize_theme'),
471  'display' => true,
472  ),
473  'submit' => array (
474  'type' => 'submit',
475  'name' => 'submit_import',
476  'value' => _t('_ch_profile_customize_btn_import'),
477  'colspan' => true,
478  ),
479  )
480  ));
481  }
482 
483  function _getCustomUnitForm($aUnit = array())
484  {
485  $aForm = array(
486 
487  'form_attrs' => array(
488  'name' => 'unit_form',
489  'action' => $_SERVER['REQUEST_URI'],
490  'method' => 'post',
491  'enctype' => 'multipart/form-data',
492  ),
493 
494  'params' => array (
495  'db' => array(
496  'table' => 'ch_profile_custom_units',
497  'key' => 'id',
498  'submit_name' => 'submit_save',
499  ),
500  ),
501 
502  'inputs' => array(
503 
504  'name' => array(
505  'type' => 'text',
506  'name' => 'name',
507  'value' => isset($aUnit['name']) ? $aUnit['name'] : '',
508  'caption' => _t('_ch_profile_customize_name'),
509  'required' => true,
510  'checker' => array (
511  'func' => 'length',
512  'params' => array(1,100),
513  'error' => _t('_ch_profile_customize_form_field_err'),
514  ),
515  'db' => array(
516  'pass' => 'Xss'
517  ),
518  'display' => true,
519  ),
520  'caption' => array(
521  'type' => 'text',
522  'name' => 'caption',
523  'value' => isset($aUnit['caption']) ? $aUnit['caption'] : '',
524  'caption' => _t('_ch_profile_customize_caption'),
525  'required' => true,
526  'checker' => array (
527  'func' => 'length',
528  'params' => array(1,100),
529  'error' => _t('_ch_profile_customize_form_field_err'),
530  ),
531  'db' => array(
532  'pass' => 'Xss'
533  ),
534  'display' => true,
535  ),
536  'css_name' => array(
537  'type' => 'text',
538  'name' => 'css_name',
539  'value' => isset($aUnit['css_name']) ? $aUnit['css_name'] : '',
540  'caption' => _t('_ch_profile_customize_css_name'),
541  'required' => true,
542  'checker' => array (
543  'func' => 'length',
544  'params' => array(1,500),
545  'error' => _t('_ch_profile_customize_form_field_err'),
546  ),
547  'db' => array(
548  'pass' => 'Xss'
549  ),
550  'display' => true,
551  ),
552  'type' => array(
553  'type' => 'select',
554  'name' => 'type',
555  'required' => true,
556  'values' => array(
557  'background' => _t('_ch_profile_customize_page_background'),
558  'font' => _t('_ch_profile_customize_page_font'),
559  'border' => _t('_ch_profile_customize_page_border'),
560  ),
561  'value' => isset($aUnit['type']) ? $aUnit['type'] : '',
562  'caption' => _t('_ch_profile_customize_type'),
563  'attrs' => array(
564  'multiplyable' => false
565  ),
566  'display' => true,
567  'db' => array(
568  'pass' => 'Xss'
569  ),
570  ),
571  'submit' => array (
572  'type' => 'submit',
573  'name' => 'submit_save',
574  'value' => isset($aUnit['id']) ? _t('_ch_profile_customize_btn_save') : _t('_ch_profile_customize_btn_add'),
575  'colspan' => true,
576  ),
577  )
578  );
579 
580  return new ChTemplFormView($aForm);
581  }
582 
583  function _customPageThemes($iUserId = 0, $bForm = false)
584  {
585  $aItems = array();
586  $aThemes = $this->_oDb->getAllThemesByUserId($iUserId);
587  if(empty($aThemes))
588  return '';
589 
590  foreach ($aThemes as $aTheme) {
592  if (file_exists($this->_oModule->_getImagesDir() . $sFileName))
593  $sThumb = $this->_oModule->_getImagesPath() . $sFileName;
594  else
595  $sThumb = $this->getIconUrl('no-photo-64.png');
596 
597  $aItems[] = array(
598  'id' => $aTheme['id'],
599  'name' => $aTheme['name'],
600  'thumbnail' => $sThumb,
601  'spacer' => $this->getImageUrl('spacer.gif')
602  );
603  }
604 
605  $sContent = $this->parseHtmlByName('themes_box.html', array(
606  'ch_repeat:items' => $aItems,
607  'preview_url' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'profileblock/theme/',
608  'save_url' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'savetheme/'
609  ));
610 
611  if($bForm)
612  $sContent = $this->parseHtmlByName('themes_box_form.html', array(
613  'name' => 'themes_form',
614  'content' => $sContent
615  ));
616 
617  return $sContent;
618  }
619 
620  function _customPageBackground($sPage, $sTarget, $aVars)
621  {
622  $aForm = array(
623 
624  'form_attrs' => array(
625  'name' => 'background_form',
626  'action' => $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'save',
627  'method' => 'POST',
628  'enctype' => 'multipart/form-data',
629  'id' => 'custom_themes_form',
630  ),
631 
632  'params' => array (),
633 
634  'inputs' => array(
635 
636  'color' => array(
637  'type' => 'text',
638  'name' => 'color',
639  'value' => isset($aVars['color']) ? $aVars['color'] : '',
640  'caption' => _t('_ch_profile_customize_color'),
641  'display' => true,
642  ),
643  'useimage' => array(
644  'type' => 'custom',
645  'name' => 'useimage',
646  'caption' => _t('_ch_profile_customize_use_image'),
647  'content' => ''
648  ),
649  'image' => array(
650  'type' => 'file',
651  'name' => 'image',
652  'value' => isset($aVars['image']) ? $aVars['image'] : '',
653  'caption' => _t('_ch_profile_customize_image'),
654  'display' => true,
655  ),
656  'repeat' => array(
657  'type' => 'select',
658  'name' => 'repeat',
659  'values' => array(
660  'default' => _t('_ch_profile_customize_default'),
661  'no-repeat' => _t('_ch_profile_customize_no'),
662  'repeat' => _t('_ch_profile_customize_repeat'),
663  'repeat-x' => _t('_ch_profile_customize_repeat_x'),
664  'repeat-y' => _t('_ch_profile_customize_repeat_y'),
665  ),
666  'value' => isset($aVars['repeat']) ? $aVars['repeat'] : '',
667  'caption' => _t('_ch_profile_customize_repeat'),
668  'attrs' => array(
669  'multiplyable' => false
670  ),
671  'display' => true,
672  ),
673  'position' => array(
674  'type' => 'select',
675  'name' => 'position',
676  'values' => array(
677  'default' => _t('_ch_profile_customize_default'),
678  'left top' => _t('_ch_profile_customize_top_left'),
679  'center top' => _t('_ch_profile_customize_top_center'),
680  'right top' => _t('_ch_profile_customize_top_right'),
681  'left center' => _t('_ch_profile_customize_center_left'),
682  'center center' => _t('_ch_profile_customize_center'),
683  'right center' => _t('_ch_profile_customize_center_right'),
684  'left bottom' => _t('_ch_profile_customize_bottom_left'),
685  'center bottom' => _t('_ch_profile_customize_bottom_center'),
686  'right bottom' => _t('_ch_profile_customize_bottom_right')
687  ),
688  'value' => isset($aVars['position']) ? $aVars['position'] : 'default',
689  'caption' => _t('_ch_profile_customize_position'),
690  'attrs' => array(
691  'multiplyable' => false
692  ),
693  'display' => true,
694  ),
695  'page' => array(
696  'type' => 'hidden',
697  'name' => 'page',
698  'value' => $sPage,
699  ),
700  'trg' => array(
701  'type' => 'hidden',
702  'name' => 'trg',
703  'value' => $sTarget,
704  ),
705  )
706  );
707 
708  if (isset($aVars['image']) &&
709  file_exists($this->_oModule->_getImagesDir() . CH_PROFILE_CUSTOMIZE_SMALL_PREFIX . $aVars['image']))
710  {
711  $aForm['inputs']['useimage']['content'] = $this->parseHtmlByName('thumb.html', array(
712  'thumbnail' => $this->_oModule->_getImagesPath() . CH_PROFILE_CUSTOMIZE_SMALL_PREFIX . $aVars['image'],
713  'spacer' => $this->getImageUrl('spacer.gif'),
714  'name' => 'useimage',
715  'checked' => isset($aVars['useimage']) ? 'checked="1"' : '',
716 
717  ));
718  $aForm['inputs']['image']['caption'] = _t('_ch_profile_customize_other_image');
719  } else
720  unset($aForm['inputs']['useimage']);
721 
723 
724  return $oForm->getCode();
725  }
726 
727  function _customPageFont($sPage, $sTarget, $aVars)
728  {
729  $oForm = new ChTemplFormView(array(
730 
731  'form_attrs' => array(
732  'name' => 'fonts_form',
733  'action' => $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'save',
734  'method' => 'POST',
735  'enctype' => 'multipart/form-data',
736  ),
737 
738  'params' => array (),
739 
740  'inputs' => array(
741  'size' => array(
742  'type' => 'select',
743  'name' => 'size',
744  'values' => array(
745  -1 => _t('_ch_profile_customize_default'),
746  8 => '8',
747  9 => '9',
748  10 => '10',
749  11 => '11',
750  12 => '12',
751  14 => '14',
752  16 => '16',
753  18 => '18',
754  20 => '20',
755  22 => '22',
756  24 => '24',
757  ),
758  'value' => isset($aVars['size']) ? (int)$aVars['size'] : -1,
759  'caption' => _t('_ch_profile_customize_size'),
760  'attrs' => array(
761  'multiplyable' => false
762  ),
763  'display' => true,
764  ),
765  'color' => array(
766  'type' => 'text',
767  'name' => 'color',
768  'value' => isset($aVars['color']) ? $aVars['color'] : '',
769  'caption' => _t('_ch_profile_customize_color'),
770  'display' => true,
771  ),
772  'name' => array(
773  'type' => 'select',
774  'name' => 'name',
775  'values' => array(
776  'inherit' => _t('_ch_profile_customize_default'),
777  'Arial, Helvetica, sans-serif' => 'Arial',
778  'comicsans' => 'Comic Sans',
779  'Courier New, Courier, monospace' => 'Courier New',
780  'Georgia, lucida grande, Times New Roman, Times, serif' => 'Georgia',
781  'Tahoma, Verdana, Arial, Helvetica, sans-serif' => 'Tahoma',
782  'Times New Roman, Times, serif' => 'Times Roman',
783  'Trebuchet, Trebuchet MS, Helvetica, sans-serif' => 'Trebuchet',
784  'Verdana, Arial, Helvetica, sans-serif' => 'Verdana'
785  ),
786  'value' => isset($aVars['name']) ? $aVars['name'] : '',
787  'caption' => _t('_ch_profile_customize_name'),
788  'attrs' => array(
789  'multiplyable' => false
790  ),
791  'display' => true,
792  ),
793  'style' => array(
794  'type' => 'select',
795  'name' => 'style',
796  'values' => array(
797  'default' => _t('_ch_profile_customize_default'),
798  'normal' => _t('_ch_profile_customize_normal'),
799  'bold' => _t('_ch_profile_customize_bold'),
800  'italic' => _t('_ch_profile_customize_italic')
801  ),
802  'value' => isset($aVars['style']) ? $aVars['style'] : 'default',
803  'caption' => _t('_ch_profile_customize_style'),
804  'attrs' => array(
805  'multiplyable' => false
806  ),
807  'display' => true,
808  ),
809  'page' => array(
810  'type' => 'hidden',
811  'name' => 'page',
812  'value' => $sPage,
813  ),
814  'trg' => array(
815  'type' => 'hidden',
816  'name' => 'trg',
817  'value' => $sTarget,
818  )
819  )
820  ));
821 
822  return $oForm->getCode();
823  }
824 
825  function _customPageBorder($sPage, $sTarget, $aVars)
826  {
827  $oForm = new ChTemplFormView(array(
828 
829  'form_attrs' => array(
830  'name' => 'border_form',
831  'action' => $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'save',
832  'method' => 'POST',
833  'enctype' => 'multipart/form-data',
834  ),
835 
836  'params' => array (),
837 
838  'inputs' => array(
839 
840  'size' => array(
841  'type' => 'select',
842  'name' => 'size',
843  'values' => array(
844  -1 => _t('_ch_profile_customize_default'),
845  0 => _t('_ch_profile_customize_none'),
846  1 => '1',
847  2 => '2',
848  3 => '3',
849  4 => '4',
850  5 => '5',
851  6 => '6',
852  7 => '7',
853  8 => '8',
854  9 => '9',
855  10 => '10',
856  ),
857  'value' => isset($aVars['size']) ? (int)$aVars['size'] : -1,
858  'caption' => _t('_ch_profile_customize_size'),
859  'attrs' => array(
860  'multiplyable' => false
861  ),
862  'display' => true,
863  ),
864  'color' => array(
865  'type' => 'text',
866  'name' => 'color',
867  'value' => isset($aVars['color']) ? $aVars['color'] : '',
868  'caption' => _t('_ch_profile_customize_color'),
869  'display' => true,
870  ),
871  'style' => array(
872  'type' => 'select',
873  'name' => 'style',
874  'values' => array(
875  'default' => _t('_ch_profile_customize_default'),
876  'dotted' => _t('_ch_profile_customize_dotted'),
877  'dashed' => _t('_ch_profile_customize_dashed'),
878  'solid' => _t('_ch_profile_customize_solid'),
879  'double' => _t('_ch_profile_customize_double'),
880  'groove' => _t('_ch_profile_customize_groove'),
881  'ridge' => _t('_ch_profile_customize_ridge'),
882  'inset' => _t('_ch_profile_customize_inset'),
883  'outset' => _t('_ch_profile_customize_outset'),
884  ),
885  'value' => isset($aVars['style']) ? $aVars['style'] : 'default',
886  'caption' => _t('_ch_profile_customize_style'),
887  'attrs' => array(
888  'multiplyable' => false
889  ),
890  'display' => true,
891  ),
892  'position' => array(
893  'type' => 'select',
894  'name' => 'position',
895  'values' => array(
896  'default' => _t('_ch_profile_customize_default'),
897  'full' => _t('_ch_profile_customize_border_full'),
898  'top' => _t('_ch_profile_customize_border_top'),
899  'right' => _t('_ch_profile_customize_border_right'),
900  'bottom' => _t('_ch_profile_customize_border_bottom'),
901  'left' => _t('_ch_profile_customize_border_left'),
902  'left_right' => _t('_ch_profile_customize_border_left_right'),
903  'top_bottom' => _t('_ch_profile_customize_border_top_bottom'),
904  'top_right' => _t('_ch_profile_customize_border_top_right'),
905  'right_bottom' => _t('_ch_profile_customize_border_right_bottom'),
906  'bottom_left' => _t('_ch_profile_customize_border_bottom_left'),
907  'left_top' => _t('_ch_profile_customize_border_left_top'),
908  ),
909  'value' => isset($aVars['position']) ? $aVars['position'] : 'default',
910  'caption' => _t('_ch_profile_customize_position'),
911  'attrs' => array(
912  'multiplyable' => false
913  ),
914  'display' => true,
915  ),
916  'page' => array(
917  'type' => 'hidden',
918  'name' => 'page',
919  'value' => $sPage,
920  ),
921  'trg' => array(
922  'type' => 'hidden',
923  'name' => 'trg',
924  'value' => $sTarget,
925  ),
926  )
927  ));
928 
929  return $oForm->getCode();
930  }
931 
932 }
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
ChProfileCustomizeSearchResult
Definition: ChProfileCustomizeSearchResult.php:12
CH_PROFILE_CUSTOMIZE_THUMB_EXT
const CH_PROFILE_CUSTOMIZE_THUMB_EXT
Definition: ChProfileCustomizeModule.php:16
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_PROFILE_CUSTOMIZE_SMALL_PREFIX
const CH_PROFILE_CUSTOMIZE_SMALL_PREFIX
Definition: ChProfileCustomizeModule.php:14
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
ChTemplProfileGenerator
Definition: ChTemplProfileGenerator.php:11
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
$site
$site['ver']
Definition: version.inc.php:8
$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
ChTemplProfileView
Definition: ChTemplProfileView.php:11
$aMenu
$aMenu
Definition: categories.php:257
$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
$oPPV
$oPPV
Definition: profile.php:76
ChBaseSearchResult\showAdminActionsPanel
static showAdminActionsPanel($sWrapperId, $aButtons, $sCheckboxName='entry', $bSelectAll=true, $bSelectAllChecked=false, $sCustomHtml='')
Definition: ChBaseSearchResult.php:81
$p_arr
$p_arr
Definition: profile.php:68
$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
$oProfile
if($profileID !=$memberID) $oProfile
Definition: profile.php:55
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10
$dir
$dir
Definition: config.php:10
CH_PROFILE_CUSTOMIZE_THEME_PREFIX
const CH_PROFILE_CUSTOMIZE_THEME_PREFIX
Definition: ChProfileCustomizeModule.php:15