Cheetah
ChBaseMenu.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbMenu');
9 
10 class ChBaseMenu extends ChWsbMenu
11 {
14 
15  var $sSiteUrl;
16 
18 
23 
25 
27 
28  var $sWidth;
29 
30  function __construct()
31  {
32  parent::__construct();
33  $this->bGroupInMore = true;
34  $this->iElementsCntInLine = (int)getParam('nav_menu_elements_on_line_' . (isLogged() ? 'usr' : 'gst'));
35 
36  $this->sSiteUrl = CH_WSB_URL_ROOT;
37  $this->iJumpedMenuID = 0;
38  $this->sCustomSubIconUrl = '';
39  $this->sCustomSubHeader = '';
40  $this->sCustomSubHeaderUrl = '';
41  $this->sCustomActions = '';
42 
43  $this->sBreadCrumb = '';
44 
45  $this->bDebugMode = false;
46 
47  $this->sWidth = $GLOBALS['oSysTemplate']->getPageWidth();
48  }
49 
51  {
52  $this->sCustomSubIconUrl = $sCustomSubIconUrl;
53  }
54 
56  {
57  $this->sCustomSubHeader = $sCustomSubHeader;
58  }
59 
61  {
62  $this->sCustomSubHeaderUrl = $sCustomSubHeaderUrl;
63  }
64 
65  /*
66  * Generate actions in submenu place at right.
67  */
68  function setCustomSubActions(&$aKeys, $sActionsType, $bSubMenuMode = true)
69  {
70  $this->sCustomActions = '';
71  if(!$sActionsType)
72  return;
73 
74  // prepare all needed keys
75  $aKeys['url'] = $this->sSiteUrl;
76  $aKeys['window_width'] = $this->oTemplConfig->popUpWindowWidth;
77  $aKeys['window_height'] = $this->oTemplConfig->popUpWindowHeight;
78  $aKeys['anonym_mode'] = $this->oTemplConfig->bAnonymousMode;
79 
80  // $aKeys['member_id'] = $iMemberID;
81  // $aKeys['member_pass'] = getPassword($iMemberID);
82 
83  //$GLOBALS['oFunctions']->iDhtmlPopupMenu = 1;
84  $this->sCustomActions = $GLOBALS['oFunctions']->genObjectsActions($aKeys, $sActionsType, $bSubMenuMode, 'actions_submenu', 'action_submenu');
85  }
86 
90  function setCustomSubActions2($aCustomActions)
91  {
92  if (is_array($aCustomActions) && count($aCustomActions) > 0) {
93  $sActions = '';
94  foreach ($aCustomActions as $iID => $aCustomAction) {
95  $sTitle = $sLink = $sIcon = '';
96  $sTitle = $aCustomAction['title'];
97  $sLink = $aCustomAction['url'];
98  $sIcon = $aCustomAction['icon'];
99 
100  $sActions .= <<<EOF
101 <div class="button_wrapper" style="width:48%;margin-right:1%;margin-left:1%;" onclick="window.open ('{$sLink}','_self');">
102  <img alt="{$sTitle}" src="{$sIcon}" style="float:left;" />
103  <input class="form_input_submit" type="submit" value="{$sTitle}" class="menuLink" />
104  <div class="button_wrapper_close"></div>
105 </div>
106 EOF;
107  }
108 
109  $this->sCustomActions = $sActions;
110  }
111  }
112 
113  /*
114  * Generate navigation menu source
115  */
116  function getCode()
117  {
119 
120  if(isset($GLOBALS['ch_profiler']))
121  $GLOBALS['ch_profiler']->beginMenu('Main Menu');
122 
123  $this->getMenuInfo();
124 
125  //--- Main Menu ---//
126  $sMainMenu = $this->genTopItems();
127 
128  //--- Submenu Menu ---//
129  $sSubMenu = '';
130  if(!defined('CH_INDEX_PAGE') && !defined('CH_JOIN_PAGE'))
131  $sSubMenu = $this->genSubMenus();
132 
133  $sResult = $oSysTemplate->parseHtmlByName('navigation_menu.html', array(
134  'main_menu' => $sMainMenu,
135  'sub_menu' => $sSubMenu
136  ));
137 
138  if(isset($GLOBALS['ch_profiler']))
139  $GLOBALS['ch_profiler']->endMenu('Main Menu');
140 
141  return $sResult;
142  }
143 
144  /*
145  * Generate top menu elements
146  */
147  function genTopItems($aParams = array())
148  {
149  $bWrap = isset($aParams['wrap']) ? (bool)$aParams['wrap'] : true;
150  $bGroupInMore = isset($aParams['group_in_more']) ? (bool)$aParams['group_in_more'] : $this->bGroupInMore;
151 
152  $iCounter = 0;
153  foreach( $this->aTopMenu as $iItemID => $aItem ) {
154  if( $aItem['Type'] != 'top' )
155  continue;
156  if( !$this->checkToShow( $aItem ) )
157  continue;
158  if ($aItem['Caption'] == "{profileNick}" && $this->aMenuInfo['profileNick']=='') continue;
159 
160  $bActive = ( $iItemID == $this->aMenuInfo['currentTop'] );
161 
162  if ($bActive && $bGroupInMore && $iCounter >= $this->iElementsCntInLine) {
163  $this->iJumpedMenuID = $iItemID;
164  break;
165  }
166  $iCounter++;
167  }
168 
169  $sCode = '';
170  $iCounter = 0;
171  foreach( $this->aTopMenu as $iItemID => $aItem ) {
172  if( $aItem['Type'] != 'top' )
173  continue;
174 
175  if( !$this->checkToShow( $aItem ) )
176  continue;
177 
178  //generate
179  list( $aItem['Link'] ) = explode( '|', $aItem['Link'] );
180 
181  $aItem['Caption'] = $this->replaceMetas( $aItem['Caption'] );
182  $aItem['Link'] = $this->replaceMetas( $aItem['Link'] );
183  $aItem['Onclick'] = $this->replaceMetas( $aItem['Onclick'] );
184 
185  $bActive = ( $iItemID == $this->aMenuInfo['currentTop'] );
186  $bActive = ($aItem['Link']=='index.php' && $this->aMenuInfo['currentTop']==0) ? true : $bActive;
187 
188  if ($this->bDebugMode)
189  print $iItemID . $aItem['Caption'] . '__' . $aItem['Link'] . '__' . $bActive . '<br />';
190 
191  $isBold = false;
192  $sImage = ($aItem['Icon'] != '') ? $aItem['Icon'] : $aItem['Picture'];
193 
194  //Draw jumped element
195  if ($this->iJumpedMenuID > 0 && $bGroupInMore && $iCounter == $this->iElementsCntInLine) {
196  $aItemJmp = $this->aTopMenu[$this->iJumpedMenuID];
197  list( $aItemJmp['Link'] ) = explode( '|', $aItemJmp['Link'] );
198  $aItemJmp['Link'] = $this->replaceMetas( $aItemJmp['Link'] );
199  $aItemJmp['Onclick'] = $this->replaceMetas( $aItemJmp['Onclick'] );
200 
201  $bJumpActive = ( $this->iJumpedMenuID == $this->aMenuInfo['currentTop'] );
202  $bJumpActive = ($aItemJmp['Link']=='index.php' && $this->aMenuInfo['currentTop']==0) ? true : $bJumpActive;
203 
204  $sCode .= $this->genTopItem(_t($aItemJmp['Caption']), $aItemJmp['Link'], $aItemJmp['Target'], $aItemJmp['Onclick'], $bJumpActive, $this->iJumpedMenuID, $isBold);
205 
206  if ($this->bDebugMode)
207  print '<br />pre_pop: ' . $this->iJumpedMenuID . $aItemJmp['Caption'] . '__' . $aItemJmp['Link'] . '__' . $bJumpActive . '<br /><br />';
208  }
209 
210  if ($bGroupInMore && $iCounter == $this->iElementsCntInLine) {
211  $sCode .= $this->GenMoreElementBegin();
212 
213  if ($this->bDebugMode)
214  print '<br />more begin here ' . '<br /><br />';
215  }
216 
217  if($this->iJumpedMenuID == 0 || $iItemID != $this->iJumpedMenuID) {
218  if ($bGroupInMore && $this->iElementsCntInLine <= $iCounter)
219  $sCode .= $this->genTopItemMore(_t($aItem['Caption']), $aItem['Link'], $aItem['Target'], $aItem['Onclick'], $bActive, $iItemID);
220  else
221  $sCode .= $this->genTopItem(_t($aItem['Caption']), $aItem['Link'], $aItem['Target'], $aItem['Onclick'], $bActive, $iItemID, $isBold, $sImage);
222  }
223 
224  $iCounter++;
225  }
226 
227  if($bGroupInMore && $this->iElementsCntInLine < $iCounter)
228  $sCode .= $this->GenMoreElementEnd();
229 
230  if(!$bWrap)
231  return $sCode;
232 
233  return $GLOBALS['oSysTemplate']->parseHtmlByName('navigation_menu_main.html', array(
234  'main_menu' => $sCode
235  ));
236  }
237 
238  /*
239  * Generate sub menu elements
240  */
241  function genSubMenus()
242  {
243  foreach( $this->aTopMenu as $iTItemID => $aTItem ) {
244  if( $aTItem['Type'] != 'top' && $aTItem['Type'] !='system')
245  continue;
246 
247  if( !$this->checkToShow( $aTItem ) )
248  continue;
249 
250  if( $this->aMenuInfo['currentTop'] == $iTItemID && $this->checkShowCurSub() )
251  $sDisplay = 'block';
252  else {
253  $sDisplay = 'none';
254  if ($aTItem['Caption']=='_Home' && $this->aMenuInfo['currentTop']==0)
255  $sDisplay = 'block';
256  }
257 
258  $sCaption = _t( $aTItem['Caption'] );
259  $sCaption = $this->replaceMetas($sCaption);
260 
261  //generate
262  if ($sDisplay == 'block') {
263  $sPicture = $aTItem['Picture'];
264 
265  $iFirstID = $this->genSubFirstItem( $iTItemID );
266  $this->genSubHeader( $iTItemID, $iFirstID, $sCaption, $sDisplay, $sPicture );
267  }
268  }
269 
270  return $GLOBALS['oSysTemplate']->parseHtmlByName('navigation_menu_sub.html', array(
271  'sub_menu' => $this->sCode
272  ));
273  }
274 
275  /*
276  * Generate sub items of sub menu elements
277  */
278  function genSubItems($iTItemID = 0)
279  {
280  if(!$iTItemID)
281  $iTItemID = $this->aMenuInfo['currentTop'];
282 
283  $bFirst = true;
284  $sSubItems = '';
285  foreach( $this->aTopMenu as $iItemID => $aItem ) {
286  if( $aItem['Type'] != 'custom' )
287  continue;
288  if( $aItem['Parent'] != $iTItemID )
289  continue;
290  if( !$this->checkToShow( $aItem ) )
291  continue;
292 
293  //generate
294  list( $aItem['Link'] ) = explode( '|', $aItem['Link'] );
295 
296  $aItem['Link'] = $this->replaceMetas( $aItem['Link'] );
297  $aItem['Onclick'] = $this->replaceMetas( $aItem['Onclick'] );
298  $sSubItems .= (!$bFirst ? '<div class="sys-bullet"></div>' : '') . $this->genSubItem( _t( $aItem['Caption'] ), $aItem['Link'], $aItem['Target'], $aItem['Onclick'], $iItemID == $this->aMenuInfo['currentCustom']);
299 
300  $bFirst = false;
301  }
302 
303  return $sSubItems;
304  }
305 
306  function genSubItem( $sCaption, $sLink, $sTarget, $sOnclick, $bActive )
307  {
308  $sOnclick = $sOnclick ? ' onclick="' . $sOnclick . '"' : '';
309  $sTarget = $sTarget ? ' target="' . $sTarget . '"' : '';
310 
311  if(strpos( $sLink, 'http://' ) === false && strpos( $sLink, 'https://' ) === false && !strlen($sOnclick))
312  $sLink = $this->sSiteUrl . $sLink;
313 
314  return '<div class="' . ($bActive ? 'act' : 'pas') . '"><a class="sublinks" href="' . $sLink . '"' . $sTarget . $sOnclick . '>' . $sCaption . '</a></div>';
315  }
316 
317  /*
318  * Generate top menu elements
319  */
320  function genTopItem($sText, $sLink, $sTarget, $sOnclick, $bActive, $iItemID, $isBold = false, $sPicture = '')
321  {
322  $sLink = (strpos($sLink, 'http://') === false && strpos($sLink, 'https://') === false && strpos($sLink, 'javascript') === false && !strlen($sOnclick)) ? $this->sSiteUrl . $sLink : $sLink;
323 
324  return $GLOBALS['oSysTemplate']->parseHtmlByName('navigation_menu_mm_item.html', array(
325  'link' => $sLink,
326  'ch_if:show_active' => array(
327  'condition' => $bActive,
328  'content' => array()
329  ),
330  'ch_if:show_onclick' => array(
331  'condition' => !$bActive && $sOnclick,
332  'content' => array(
333  'onclick' => $sOnclick
334  )
335  ),
336  'ch_if:show_target' => array(
337  'condition' => !$bActive && $sTarget,
338  'content' => array(
339  'target' => $sTarget
340  )
341  ),
342  'ch_if:show_style' => array(
343  'condition' => $isBold,
344  'content' => array(
345  'style' => 'font-weight:bold;'
346  )
347  ),
348  'ch_if:show_picture' => array(
349  'condition' => $sText == '' && $isBold && $sPicture != '',
350  'content' => array(
351  'src' => getTemplateIcon($sPicture)
352  )
353  ),
354  'text' => $sText,
355  'sub_menus' => $this->genTopSubitems($iItemID)
356  ));
357  }
358 
359  function genTopSubitems($iItemID)
360  {
361  $sSubMenus = $this->getAllSubMenus($iItemID);
362  if($sSubMenus == '')
363  return '';
364 
365  return $GLOBALS['oSysTemplate']->parseHtmlByName('navigation_menu_mm_subitems.html', array(
366  'content' => $sSubMenus,
367  ));
368  }
369 
370  /*
371  * Get parent of submenu element
372  */
373  function genSubFirstItem( $iTItemID = 0 )
374  {
375  return $this->aMenuInfo['currentTop'];
376  }
377 
378  /*
379  * Generate header for sub items of sub menu elements
380  */
381  function genSubHeader( $iTItemID, $iFirstID, $sCaption, $sDisplay, $sPicture = '' )
382  {
383  $sLoginSection = $sSubElementCaption = $sProfStatusMessage = $sProfStatusMessageWhen = $sProfileActions = '';
384  $sCaptionWL = $sProfStatusMessageEl = $sMiddleImg = '';
385 
386  if ($this->aMenuInfo['currentCustom'] == 0 && $iFirstID > 0) $this->aMenuInfo['currentCustom'] = $iFirstID;
387  //comment need when take header for profile page
388  if ($this->sCustomSubHeader == '' && $this->aMenuInfo['currentCustom'] > 0) {
389  $sSubCapIcon = getTemplateIcon('_submenu_capt_right.gif');
390  $sSubElementCaption = _t($this->aTopMenu[$this->aMenuInfo['currentCustom']]['Caption']);
391 
392  $sCustomPic = $this->aTopMenu[$this->aMenuInfo['currentCustom']]['Picture'];
393  $sPicture = ($sCustomPic != '') ? $sCustomPic : $sPicture;
394 
395  $sMiddleImg = '<img src="'.$sSubCapIcon.'" />';
396  $sSubElementCaption = <<<EOF
397 <font style="font-weight:normal;">{$sSubElementCaption}</font>
398 EOF;
399  }
400 
401  if(!isMember())
402  $sLoginSection = $this->genSubHeaderLogin();
403 
405  if ($this->sCustomSubHeader == '' && !empty($this->aMenuInfo['profileID'])) {
406  $sPictureEl = get_member_icon($this->aMenuInfo['profileID'], 'left');
407 
408  $sSubCapIcon = getTemplateIcon('_submenu_capt_right.gif');
409  $aProfInfo = getProfileInfo($this->aMenuInfo['profileID']);
410  $sProfStatusMessage = process_line_output($aProfInfo['UserStatusMessage']);
411  $sRealWhen = ($aProfInfo['UserStatusMessageWhen'] != 0) ? $aProfInfo['UserStatusMessageWhen'] : time();
412  $sProfStatusMessageWhen = defineTimeInterval($sRealWhen);
413 
414  if($this->aMenuInfo['memberID'] == $this->aMenuInfo['profileID']) {
415  $aTmplVars = array(
416  'ch_if:show_script' => array(
417  'condition' => true,
418  'content' => array()
419  ),
420  'ch_if:show_when' => array(
421  'condition' => false && $sProfStatusMessage != '',
422  'content' => array(
423  'when' => $sProfStatusMessageWhen
424  )
425  ),
426  'ch_if:show_update' => array(
427  'condition' => true,
428  'content' => array()
429  ),
430  'message' => $sProfStatusMessage != '' ? $sProfStatusMessage : _t('_sys_status_default')
431  );
432  $sProfStatusMessage = $GLOBALS['oSysTemplate']->parseHtmlByName('navigation_menu_status.html', $aTmplVars);
433  } else if ($sProfStatusMessage != '') {
434  $aTmplVars = array(
435  'ch_if:show_script' => array(
436  'condition' => false,
437  'content' => array()
438  ),
439  'ch_if:show_when' => array(
440  'condition' => false && $sProfStatusMessage != '',
441  'content' => array(
442  'when' => $sProfStatusMessageWhen
443  )
444  ),
445  'ch_if:show_update' => array(
446  'condition' => false,
447  'content' => array()
448  ),
449  'message' => $sProfStatusMessage
450  );
451  $sProfStatusMessage = $GLOBALS['oSysTemplate']->parseHtmlByName('navigation_menu_status.html', $aTmplVars);
452  $sProfileActions = $this->getProfileActions($aProfInfo, $this->aMenuInfo['memberID']);
453  }
454 
455  } else {
456  $sPictureEl = '';
457  if (!empty($sPicture) && false === strpos($sPicture, '.'))
458  $sPictureEl = '<i class="img_submenu sys-icon ' . $sPicture . '"></i>';
459  elseif (!empty($sPicture))
460  $sPictureEl = '<img class="img_submenu" src="' . getTemplateIcon($sPicture) . '" alt="" />';
461 
462  $sPictureEl = $this->genSubHeaderIcon($this->aTopMenu[$iFirstID], $sPictureEl);
463  }
464 
465  if ($this->sCustomSubIconUrl && false === strpos($this->sCustomSubIconUrl, '.'))
466  $sPictureEl = '<i class="img_submenu sys-icon ' . $this->sCustomSubIconUrl . '"></i>';
467  elseif ($this->sCustomSubIconUrl)
468  $sPictureEl = '<img class="img_submenu" src="' . $this->sCustomSubIconUrl. ' " alt="" />';
470 
471  $sCaptionWL = $this->sCustomSubHeader != '' ? $this->sCustomSubHeader : $this->genSubHeaderCaption($this->aTopMenu[$iFirstID], $sCaption);
472 
473  if ($this->sCustomActions != '')
474  $sProfileActions = $this->sCustomActions;
475 
476  $sSubmenu = $this->genSubItems($iTItemID);
477 
478  // array of keys
479  $aTemplateKeys = array (
480  'submenu_id' => $iTItemID,
481  'display_value' => $sDisplay,
482  'picture' => $sPictureEl,
483  'ch_if:show_caption' => array(
484  'condition' => !empty($sCaptionWL),
485  'content' => array(
486  'caption' => $sCaptionWL,
487  )
488  ),
489  'ch_if:show_status' => array(
490  'condition' => $sProfStatusMessage != '',
491  'content' => array(
492  'status' => $sProfStatusMessage
493  )
494  ),
495  'ch_if:show_submenu' => array(
496  'condition' => $sProfStatusMessage == '' && $sSubmenu != '',
497  'content' => array(
498  'submenu' => $sSubmenu
499  )
500  ),
501  'ch_if:show_empty' => array(
502  'condition' => $sProfStatusMessage == '' && $sSubmenu == '',
503  'content' => array(
504  'content' => ''
505  )
506  ),
507  'ch_if:show_submenu_bottom' => array(
508  'condition' => $sProfStatusMessage != '' && $sSubmenu != '',
509  'content' => array(
510  'submenu' => $sSubmenu
511  )
512  ),
513  'login_section' => $sLoginSection,
514  'profile_actions' => $sProfileActions,
515  'injection_title_zone' => $sProfileActions
516  );
517  $this->sCode .= $GLOBALS['oSysTemplate']->parseHtmlByName('navigation_menu_sub_header.html', $aTemplateKeys);
518 
519  //--- BreadCrumb ---//
520  $sCaption = $this->genSubHeaderCaptionBreadcrumb($this->aTopMenu[$iFirstID], $sCaption);
521 
522  $aBreadcrumb = array();
523  if($iFirstID > 0 && $sCaption != '')
524  $aBreadcrumb[] = $sCaption;
525  if($sSubElementCaption != '')
526  $aBreadcrumb[] = $sSubElementCaption;
527 
528  $this->sBreadCrumb = $this->genBreadcrumb($aBreadcrumb);
529  }
530 
531  function genSubHeaderLogin($sTemplateFile = 'login_join.html')
532  {
533  return $GLOBALS['oSysTemplate']->parseHtmlByName('login_join.html', array());
534  }
535 
536  function genSubHeaderIcon($aItem, $sCaption, $sTemplateFile = 'navigation_menu_sub_header_caption.html')
537  {
538  return $this->_genSubHeaderCaption($aItem, $sCaption, $sTemplateFile);
539  }
540 
541  function genSubHeaderCaption($aItem, $sCaption, $sTemplateFile = 'navigation_menu_sub_header_caption.html')
542  {
543  return $this->_genSubHeaderCaption($aItem, $sCaption, $sTemplateFile);
544  }
545 
546  function genSubHeaderCaptionBreadcrumb($aItem, $sCaption, $sTemplateFile = 'navigation_menu_sub_header_caption_breadcrumb.html')
547  {
548  return $this->_genSubHeaderCaption($aItem, $sCaption, $sTemplateFile);
549  }
550 
551  function _genSubHeaderCaption($aItem, $sCaption, $sTemplateFile)
552  {
553  $sSubMainLink = $this->sCustomSubHeaderUrl;
554  if (!$sSubMainLink && !empty($aItem['Link'])) {
555  list($sSubMainLinkFirst) = explode('|', $aItem['Link']);
556  $sSubMainLink = $this->replaceMetas($sSubMainLinkFirst);
557 
558  //try define the parent menu's item url
559  if (empty($sSubMainLink))
560  $sSubMainLink = $this->sSiteUrl . $this->aTopMenu[$this->aMenuInfo['currentTop']]['Link'];
561  }
562 
563  $sSubMainOnclick = $this->replaceMetas($aItem['Onclick']);
564  return $GLOBALS['oSysTemplate']->parseHtmlByName($sTemplateFile, array(
565  'href' => $sSubMainLink,
566  'ch_if:show_onclick' => array(
567  'condition' => !empty($sSubMainOnclick),
568  'content' => array(
569  'onclick' => $sSubMainOnclick
570  )
571  ),
572  'content' => $sCaption,
573  ));
574  }
575 
576  function getProfileActions($p_arr, $iMemberID)
577  {
578  $iViewedMemberID = (int)$p_arr['ID'];
579 
580  if( (!$iMemberID or !$iViewedMemberID) or ($iMemberID == $iViewedMemberID) )
581  return null;
582 
583  // prepare all needed keys
584  $p_arr['url'] = $this->sSiteUrl;
585  $p_arr['window_width'] = $this->oTemplConfig->popUpWindowWidth;
586  $p_arr['window_height'] = $this->oTemplConfig->popUpWindowHeight;
587  $p_arr['anonym_mode'] = $this->oTemplConfig->bAnonymousMode;
588 
589  $p_arr['member_id'] = $iMemberID;
590  $p_arr['member_pass'] = getPassword( $iMemberID );
591 
592  $GLOBALS['oFunctions']->iDhtmlPopupMenu = 1;
593  return $GLOBALS['oFunctions']->genObjectsActions($p_arr, 'Profile', true);
594  }
595 
596  function getAllSubMenus($iItemID, $bActive = false)
597  {
599 
600  $ret = '';
601 
602  $aTTopMenu = $this->aTopMenu;
603 
604  foreach( $aTTopMenu as $iTItemID => $aTItem ) {
605 
606  if( !$this->checkToShow( $aTItem ) )
607  continue;
608 
609  if ($iItemID == $aTItem['Parent']) {
610  //generate
611  list( $aTItem['Link'] ) = explode( '|', $aTItem['Link'] );
612 
613  $aTItem['Link'] = str_replace( "{memberID}", isset($aMenuInfo['memberID']) ? $aMenuInfo['memberID'] : '', $aTItem['Link'] );
614  $aTItem['Link'] = str_replace( "{memberNick}", isset($aMenuInfo['memberNick']) ? $aMenuInfo['memberNick'] : '', $aTItem['Link'] );
615  $aTItem['Link'] = str_replace( "{memberLink}", isset($aMenuInfo['memberLink']) ? $aMenuInfo['memberLink'] : '', $aTItem['Link'] );
616 
617  $aTItem['Link'] = str_replace( "{profileID}", isset($aMenuInfo['profileID']) ? $aMenuInfo['profileID'] : '', $aTItem['Link'] );
618  $aTItem['Onclick'] = str_replace( "{profileID}", isset($aMenuInfo['profileID']) ? $aMenuInfo['profileID'] : '', $aTItem['Onclick'] );
619 
620  $aTItem['Link'] = str_replace( "{profileNick}", isset($aMenuInfo['profileNick']) ? $aMenuInfo['profileNick'] : '', $aTItem['Link'] );
621  $aTItem['Onclick'] = str_replace( "{profileNick}", isset($aMenuInfo['profileNick']) ? $aMenuInfo['profileNick'] : '', $aTItem['Onclick'] );
622 
623  $aTItem['Link'] = str_replace( "{profileLink}", isset($aMenuInfo['profileLink']) ? $aMenuInfo['profileLink'] : '', $aTItem['Link'] );
624 
625  $aTItem['Onclick'] = str_replace( "{memberID}", isset($aMenuInfo['memberID']) ? $aMenuInfo['memberID'] : '', $aTItem['Onclick'] );
626  $aTItem['Onclick'] = str_replace( "{memberNick}", isset($aMenuInfo['memberNick']) ? $aMenuInfo['memberNick'] : '', $aTItem['Onclick'] );
627  $aTItem['Onclick'] = str_replace( "{memberPass}", getPassword( isset($aMenuInfo['memberID']) ? $aMenuInfo['memberID'] : ''), $aTItem['Onclick'] );
628 
629  $sElement = $this->getCustomMenuItem( _t( $aTItem['Caption'] ), $aTItem['Link'], $aTItem['Target'], $aTItem['Onclick'], ( $iTItemID == $aMenuInfo['currentCustom'] ) );
630 
631  $ret .= $sElement;
632  }
633  }
634 
635  return $ret;
636  }
637 
638  function getCustomMenuItem($sText, $sLink, $sTarget, $sOnclick, $bActive, $bSub = false)
639  {
640  $sIActiveClass = ($bActive) ? ' active' : '';
641  $sITarget = (strlen($sTarget)) ? $sTarget : '_self';
642  $sILink = (strpos($sLink, 'http://') === false && strpos($sLink, 'https://') === false && !strlen($sOnclick)) ? $this->sSiteUrl . $sLink : $sLink;
643  $sIOnclick = (strlen($sOnclick)) ? 'onclick="'.$sOnclick.'"' : '';
644 
645  return <<<EOF
646 <li>
647  <a href="{$sILink}" target="{$sITarget}" {$sIOnclick} class="button more_ntop_element{$sIActiveClass}">{$sText}</a>
648 </li>
649 EOF;
650  }
651 
653  {
654  $sMoreIcon = getTemplateIcon("tm_sitem_down.gif");
655 
656  $sMoreMainCaption = _t('_sys_top_menu_more');
657 
658  return <<<EOF
659 <td class="top">
660  <a href="javascript: void(0);" onclick="void(0);" class="top_link">
661  <span class="down ch-def-padding-sec-leftright">{$sMoreMainCaption}</span>
662  <!--[if gte IE 7]><!--></a><!--<![endif]-->
663  <!--[if lte IE 6]><table id="mmm"><tr><td><![endif]-->
664  <div style="position:relative;display:block;">
665  <ul class="sub">
666 EOF;
667  }
668 
669  function genTopItemMore($sText, $sLink, $sTarget, $sOnclick, $bActive, $iItemID)
670  {
671  if(strpos($sLink, 'http://') === false && strpos($sLink, 'https://') === false && !strlen($sOnclick))
672  $sLink = $this->sSiteUrl . $sLink;
673 
674  $sSubMenus = $this->getAllSubMenus($iItemID);
675 
676  return $GLOBALS['oSysTemplate']->parseHtmlByName('navigation_menu_mm_more_subitem.html', array(
677  'wrapper_class' => $bActive ? 'active' : '',
678  'item_class' => $bActive ? ' active' : '',
679  'link' => $sLink,
680  'ch_if:show_onclick' => array(
681  'condition' => strlen($sOnclick) > 0,
682  'content' => array(
683  'onclick' => $sOnclick
684  )
685  ),
686  'ch_if:show_target' => array(
687  'condition' => strlen($sTarget) > 0,
688  'content' => array(
689  'target' => $sTarget
690  )
691  ),
692  'text' => $sText,
693  'ch_if:show_submenus' => array(
694  'condition' => !empty($sSubMenus),
695  'content' => array(
696  'sub_menus' => $sSubMenus
697  )
698  )
699  ));
700  }
701 
702  function GenMoreElementEnd()
703  {
704  return <<<EOF
705  <li class="li_last_round">&nbsp;</li>
706  </ul>
707  </div>
708  <div class="clear_both"></div>
709  <!--[if lte IE 6]></td></tr></table></a><![endif]-->
710 </td>
711 EOF;
712  }
713 
714  /*
715  * param is array of Path like
716  * $aPath[0] = '<a href="">XXX</a>'
717  * $aPath[1] = '<a href="">XXX1</a>'
718  * $aPath[2] = 'XXX2'
719  */
720  function genBreadcrumb($aPath = array())
721  {
722  $sRootItem = '<a href="' . $this->sSiteUrl . '">' . _t('_Home') . '</a>';
723 
724  if (!empty($this->aCustomBreadcrumbs)) {
725  $a = array();
726  foreach ($this->aCustomBreadcrumbs as $sTitle => $sLink)
727  if ($sTitle)
728  $a[] = $sLink ? '<a href="' . $sLink . '">' . $sTitle . '</a>' : $sTitle;
729  $aPath = array_merge(array($sRootItem), $a);
730  } elseif(!is_array($aPath) || empty($aPath)) {
731  $aPath = array($sRootItem);
732  } else {
733  $aPath = array_merge(array($sRootItem), $aPath);
734  }
735 
736  //define current url for single page (not contain any child pages)
737  if( $this -> aMenuInfo['currentTop'] != -1 && count($aPath) == 1) {
738  $aPath[] = _t($this -> aTopMenu[ $this -> aMenuInfo['currentTop'] ]['Caption']);
739  }
740 
741  //--- Get breadcrumb path(left side) ---//
742  $sDivider = '<div class="bc_divider ch-def-margin-sec-left">&#8250;</div>';
743  $aPathLinks = array();
744  foreach($aPath as $sLink)
745  $aPathLinks[] = '<div class="bc_unit ch-def-margin-sec-left">' . $sLink . '</div>';
746  $sPathLinks = implode($sDivider, $aPathLinks);
747 
748  //--- Get additional links(right side) ---//
749  $sAddons = "";
750  return '<div class="sys_bc ch-def-margin-leftright">' . $sPathLinks . '<div class="bc_addons">' . $sAddons . '</div></div>';
751  }
752 
753  function getScriptFriendAdd($iId, $iMemberId, $bShowResult = true)
754  {
756  return;
757 
758  $sOnResult = $bShowResult ? "$('#ajaxy_popup_result_div_" . $iId . "').html(sData);" : "document.location.href=document.location.href;";
759  return "$.post('list_pop.php?action=friend', {ID: " . $iId . "}, function(sData){" . $sOnResult . "}); return false;";
760  }
761  function getScriptFriendAccept($iId, $iMemberId, $bShowResult = true)
762  {
764  return;
765 
766  $sOnResult = $bShowResult ? "$('#ajaxy_popup_result_div_" . $iId . "').html(sData);" : "document.location.href=document.location.href;";
767  return "$.post('list_pop.php?action=friend', {ID: " . $iId . "}, function(sData){" . $sOnResult . "}); return false;";
768  }
769  function getScriptFriendCancel($iId, $iMemberId, $bShowResult = true)
770  {
771  if(!isLogged() || $iId == $iMemberId || !is_friends($iId, $iMemberId))
772  return;
773 
774  $sOnResult = $bShowResult ? "$('#ajaxy_popup_result_div_" . $iId . "').html(sData);" : "document.location.href=document.location.href;";
775  return "$.post('list_pop.php?action=remove_friend', {ID: " . $iId . "}, function(sData){" . $sOnResult . "}); return false;";
776  }
777 
778  function getScriptFaveAdd($iId, $iMemberId, $bShowResult = true)
779  {
780  if(!isLogged() || $iId == $iMemberId || isFaved($iMemberId, $iId))
781  return;
782 
783  $sOnResult = $bShowResult ? "$('#ajaxy_popup_result_div_" . $iId . "').html(sData);" : "document.location.href=document.location.href;";
784  return "$.post('list_pop.php?action=hot', {ID: " . $iId . "}, function(sData){" . $sOnResult . "}); return false;";
785  }
786  function getScriptFaveCancel($iId, $iMemberId, $bShowResult = true)
787  {
788  if(!isLogged() || $iId == $iMemberId || !isFaved($iMemberId, $iId))
789  return;
790 
791  $sOnResult = $bShowResult ? "$('#ajaxy_popup_result_div_" . $iId . "').html(sData);" : "document.location.href=document.location.href;";
792  return "$.post('list_pop.php?action=remove_hot', {ID: " . $iId . "}, function(sData){" . $sOnResult . "}); return false;";
793  }
794 
796  {
797  if(!isLogged() || $iId == getLoggedId())
798  return;
799 
800  return CH_WSB_URL_ROOT . 'mail.php?mode=compose&recipient_id=' . $iId;
801  }
803  {
804  if(!isLogged() || $iId != getLoggedId())
805  return;
806 
807  return getProfileLink($iId);
808  }
810  {
811  if(!isLogged() || $iId != getLoggedId())
812  return;
813 
814  return CH_WSB_URL_ROOT . 'member.php';
815  }
816  function getSubItems($iParentId = 0)
817  {
818  if(empty($this->aMenuInfo))
819  $this->getMenuInfo();
820 
821  if(!$iParentId)
822  $iParentId = $this->aMenuInfo['currentTop'];
823 
824  $aSubItems = array();
825  foreach($this->aTopMenu as $iItemID => $aItem) {
826  if($aItem['Type'] != 'custom' || $aItem['Parent'] != $iParentId || !$this->checkToShow($aItem))
827  continue;
828 
829  list($aItem['Link']) = explode('|', $aItem['Link']);
830 
831  $aItem['Link'] = $this->replaceMetas($aItem['Link']);
832  $aItem['Onclick'] = $this->replaceMetas($aItem['Onclick']);
833  $aItem['Active'] = $iItemID == $this->aMenuInfo['currentCustom'];
834 
835  if(strpos($aItem['Link'], 'http://') === false && strpos($aItem['Link'], 'https://') === false && !strlen($aItem['Onclick']))
836  $aItem['Link'] = $this->sSiteUrl . $aItem['Link'];
837 
838  $aSubItems[] = $aItem;
839  }
840 
841  return $aSubItems;
842  }
843 }
ChBaseMenu\setCustomSubActions2
setCustomSubActions2($aCustomActions)
Definition: ChBaseMenu.php:90
ChBaseMenu\$sBreadCrumb
$sBreadCrumb
Definition: ChBaseMenu.php:24
ChBaseMenu\setCustomSubIconUrl
setCustomSubIconUrl($sCustomSubIconUrl)
Definition: ChBaseMenu.php:50
ChBaseMenu\getProfileActions
getProfileActions($p_arr, $iMemberID)
Definition: ChBaseMenu.php:576
ChBaseMenu\__construct
__construct()
Definition: ChBaseMenu.php:30
$iMemberId
$iMemberId
Definition: profile.php:91
ChBaseMenu\genSubHeaderIcon
genSubHeaderIcon($aItem, $sCaption, $sTemplateFile='navigation_menu_sub_header_caption.html')
Definition: ChBaseMenu.php:536
ChBaseMenu\$sCustomSubHeaderUrl
$sCustomSubHeaderUrl
Definition: ChBaseMenu.php:21
is_friends
is_friends($id1, $id2)
Definition: utils.inc.php:140
ChBaseMenu\$sCustomSubHeader
$sCustomSubHeader
Definition: ChBaseMenu.php:20
defineTimeInterval
defineTimeInterval($iTime, $bAutoDateConvert=true, $bShort=false)
Definition: utils.inc.php:831
ChBaseMenu\genSubHeaderCaption
genSubHeaderCaption($aItem, $sCaption, $sTemplateFile='navigation_menu_sub_header_caption.html')
Definition: ChBaseMenu.php:541
ChBaseMenu\genSubFirstItem
genSubFirstItem( $iTItemID=0)
Definition: ChBaseMenu.php:373
get_member_icon
get_member_icon($ID, $float='none', $bGenProfLink=false)
Definition: design.inc.php:170
$sResult
$sResult
Definition: advanced_settings.php:26
ChBaseMenu\getUrlProfilePage
getUrlProfilePage($iId)
Definition: ChBaseMenu.php:802
$ret
$ret
Definition: index.php:39
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ChBaseMenu\setCustomSubHeaderUrl
setCustomSubHeaderUrl($sCustomSubHeaderUrl)
Definition: ChBaseMenu.php:60
ChBaseMenu\getScriptFriendAdd
getScriptFriendAdd($iId, $iMemberId, $bShowResult=true)
Definition: ChBaseMenu.php:753
ChBaseMenu\genSubMenus
genSubMenus()
Definition: ChBaseMenu.php:241
getPassword
getPassword( $ID='')
Definition: profiles.inc.php:475
php
$iId
$iId
Definition: license.php:15
ChBaseMenu\getScriptFaveAdd
getScriptFaveAdd($iId, $iMemberId, $bShowResult=true)
Definition: ChBaseMenu.php:778
ChBaseMenu\$iElementsCntInLine
$iElementsCntInLine
Definition: ChBaseMenu.php:13
isLogged
isLogged()
Definition: profiles.inc.php:24
ChBaseMenu\genSubHeaderCaptionBreadcrumb
genSubHeaderCaptionBreadcrumb($aItem, $sCaption, $sTemplateFile='navigation_menu_sub_header_caption_breadcrumb.html')
Definition: ChBaseMenu.php:546
ChBaseMenu\getScriptFriendAccept
getScriptFriendAccept($iId, $iMemberId, $bShowResult=true)
Definition: ChBaseMenu.php:761
ChBaseMenu\$sCustomActions
$sCustomActions
Definition: ChBaseMenu.php:22
ChWsbMenu\$sCode
$sCode
Definition: ChWsbMenu.php:18
ChBaseMenu\GenMoreElementBegin
GenMoreElementBegin()
Definition: ChBaseMenu.php:652
ChBaseMenu\GenMoreElementEnd
GenMoreElementEnd()
Definition: ChBaseMenu.php:702
a
Filter ExtractStyleBlocks Scope FilterParam ExtractStyleBlocksScope DESCRIPTION< p > If you would like users to be able to define external but only allow them to specify CSS declarations for a specific node and prevent them from fiddling with other use this directive It accepts any valid CSS and will prepend this to any CSS declaration extracted from the document For if this directive is set to< code > selector< code > a
Definition: Filter.ExtractStyleBlocks.Scope.txt:15
ChBaseMenu\genSubHeaderLogin
genSubHeaderLogin($sTemplateFile='login_join.html')
Definition: ChBaseMenu.php:531
ChBaseMenu\getUrlProfileMessage
getUrlProfileMessage($iId)
Definition: ChBaseMenu.php:795
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
ChBaseMenu\getScriptFaveCancel
getScriptFaveCancel($iId, $iMemberId, $bShowResult=true)
Definition: ChBaseMenu.php:786
ChBaseMenu\$bDebugMode
$bDebugMode
Definition: ChBaseMenu.php:26
getLoggedId
getLoggedId()
Definition: profiles.inc.php:32
$sTitle
$sTitle
Definition: actions.inc.php:13
table
and distribute a copy of this License along with the Library You may charge a fee for the physical act of transferring a and you may at your option offer warranty protection in exchange for a fee You may modify your copy or copies of the Library or any portion of thus forming a work based on the and copy and distribute such modifications or work under the terms of Section provided that you also meet all of these other than as an argument passed when the facility is then you must make a good faith effort to ensure in the event an application does not supply such function or table
Definition: license.txt:180
getTemplateIcon
getTemplateIcon($sFileName)
Definition: design.inc.php:193
ChBaseMenu\$sSiteUrl
$sSiteUrl
Definition: ChBaseMenu.php:15
ChBaseMenu\genSubItems
genSubItems($iTItemID=0)
Definition: ChBaseMenu.php:278
ChBaseMenu\$iJumpedMenuID
$iJumpedMenuID
Definition: ChBaseMenu.php:17
ChBaseMenu\getUrlAccountPage
getUrlAccountPage($iId)
Definition: ChBaseMenu.php:809
type
if(!defined("USER_STATUS_TYPE")) define("USER_STATUS_TYPE" type
Definition: constants.inc.php:13
isFriendRequest
isFriendRequest($iId, $iProfileId)
Definition: profiles.inc.php:377
src
img src
Definition: URI.MungeResources.txt:8
ChBaseMenu\setCustomSubHeader
setCustomSubHeader($sCustomSubHeader)
Definition: ChBaseMenu.php:55
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition: header.inc.php:25
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
time
that in the case of a Adaptation or at a minimum such credit will if a credit for all contributing authors of the Adaptation or Collection then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors For the avoidance of You may only use the credit required by this Section for the purpose of attribution in the manner set out above by exercising Your rights under this You may not implicitly or explicitly assert or imply any connection sponsorship or endorsement by the Original Licensor and or Attribution as of You or Your use of the without the express prior written permission of the Original Licensor and or Attribution Parties Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable if You Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or You must not modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author s honor or reputation Licensor agrees that in those in which any exercise of the right granted in modification or other derogatory action prejudicial to the Original Author s honor and the Licensor will waive or not as this to the fullest extent permitted by the applicable national to enable You to reasonably exercise Your right under Warranties and Disclaimer UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN LICENSOR OFFERS THE WORK AS IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE STATUTORY OR WITHOUT WARRANTIES OF FITNESS FOR A PARTICULAR OR THE ABSENCE OF LATENT OR OTHER OR THE PRESENCE OF ABSENCE OF WHETHER OR NOT DISCOVERABLE SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED SO SUCH EXCLUSION MAY NOT APPLY TO YOU Limitation on Liability EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES Termination This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License Individuals or entities who have received Adaptations or Collections from You under this will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses and will survive any termination of this License Subject to the above terms and the license granted here is Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time
Definition: license.txt:56
value
URI Base such as when URI MakeAbsolute is on You may use a non absolute URI for this value
Definition: URI.Base.txt:11
ChBaseMenu\genSubItem
genSubItem( $sCaption, $sLink, $sTarget, $sOnclick, $bActive)
Definition: ChBaseMenu.php:306
ChBaseMenu\genTopItemMore
genTopItemMore($sText, $sLink, $sTarget, $sOnclick, $bActive, $iItemID)
Definition: ChBaseMenu.php:669
getProfileLink
getProfileLink( $iID, $sLinkAdd='')
Definition: profiles.inc.php:484
ChBaseMenu\genTopItem
genTopItem($sText, $sLink, $sTarget, $sOnclick, $bActive, $iItemID, $isBold=false, $sPicture='')
Definition: ChBaseMenu.php:320
ChBaseMenu\getScriptFriendCancel
getScriptFriendCancel($iId, $iMemberId, $bShowResult=true)
Definition: ChBaseMenu.php:769
ChWsbMenu\$aTopMenu
$aTopMenu
Definition: ChWsbMenu.php:15
process_line_output
process_line_output($text, $maxwordlen=100)
Definition: utils.inc.php:328
ChBaseMenu\$sWidth
$sWidth
Definition: ChBaseMenu.php:28
isFaved
isFaved($iId, $iProfileId)
Definition: profiles.inc.php:365
ChWsbMenu\checkToShow
checkToShow( $aItem)
Definition: ChWsbMenu.php:248
ChBaseMenu\setCustomSubActions
setCustomSubActions(&$aKeys, $sActionsType, $bSubMenuMode=true)
Definition: ChBaseMenu.php:68
ChBaseMenu\$sCustomSubIconUrl
$sCustomSubIconUrl
Definition: ChBaseMenu.php:19
endif
UPGRADE</a > endif
Definition: show_available_updates.php:28
ChWsbMenu\getMenuInfo
getMenuInfo()
Definition: ChWsbMenu.php:101
ChBaseMenu\genSubHeader
genSubHeader( $iTItemID, $iFirstID, $sCaption, $sDisplay, $sPicture='')
Definition: ChBaseMenu.php:381
ChWsbMenu\checkShowCurSub
checkShowCurSub()
Definition: ChWsbMenu.php:240
getProfileInfo
getProfileInfo($iProfileID=0, $checkActiveStatus=false, $forceCache=false)
Definition: profiles.inc.php:249
ChBaseMenu\_genSubHeaderCaption
_genSubHeaderCaption($aItem, $sCaption, $sTemplateFile)
Definition: ChBaseMenu.php:551
$p_arr
$p_arr
Definition: profile.php:68
$sCaption
$sCaption
Definition: tellfriend.php:39
ChBaseMenu\getAllSubMenus
getAllSubMenus($iItemID, $bActive=false)
Definition: ChBaseMenu.php:596
$oSysTemplate
$oSysTemplate
Definition: params.inc.php:22
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
ChBaseMenu\genBreadcrumb
genBreadcrumb($aPath=array())
Definition: ChBaseMenu.php:720
ChWsbMenu\replaceMetas
replaceMetas( $sLink)
Definition: ChWsbMenu.php:299
ChBaseMenu\genTopItems
genTopItems($aParams=array())
Definition: ChBaseMenu.php:147
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
ChBaseMenu\getCustomMenuItem
getCustomMenuItem($sText, $sLink, $sTarget, $sOnclick, $bActive, $bSub=false)
Definition: ChBaseMenu.php:638
ChBaseMenu\getSubItems
getSubItems($iParentId=0)
Definition: ChBaseMenu.php:816
ChBaseMenu\genTopSubitems
genTopSubitems($iItemID)
Definition: ChBaseMenu.php:359
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10
or
Voluntary License Schemes The Licensor waives the right to collect whether individually or
Definition: license.txt:37
isMember
isMember($iId=0)
Definition: profiles.inc.php:44
ChWsbMenu
Definition: ChWsbMenu.php:14
ChBaseMenu\getCode
getCode()
Definition: ChBaseMenu.php:116
ChBaseMenu
Definition: ChBaseMenu.php:11
ChWsbMenu\$aMenuInfo
$aMenuInfo
Definition: ChWsbMenu.php:16
ChBaseMenu\$bGroupInMore
$bGroupInMore
Definition: ChBaseMenu.php:12