122 $this -> sMemberMenuPosition = ( isset($_COOKIE[
'menu_position']) )
123 ? $_COOKIE[
'menu_position']
124 :
getParam(
'ext_nav_menu_top_position' );
144 $aTemplateKeys = array(
146 'item_img' =>
$GLOBALS[
'oFunctions']->sysImage($aLinkInfo[
'item_img_src'],
'', $aLinkInfo[
'item_title'],
'',
'icon'),
147 'item_link' => $aLinkInfo[
'item_link'],
148 'item_onclick' => ($aLinkInfo[
'item_onclick']) ?
' onclick="' . $aLinkInfo[
'item_onclick'] .
';return false"' :
null,
149 'item_title' => $aLinkInfo[
'item_title'],
151 'extra_info' => ($aLinkInfo[
'extra_info']) ?
' (' . $aLinkInfo[
'extra_info'] .
')' :
null,
154 $sOutputCode =
$oSysTemplate -> parseHtmlByName(
'member_menu_sub_item.html', $aTemplateKeys );
168 $aTemplateKeys = array(
169 'description' => $sDescription,
172 $sOutputCode =
$oSysTemplate -> parseHtmlByName(
'member_menu_descr_window.html', $aTemplateKeys );
183 if ($this -> oCacheObject !=
null) {
186 $sEngine =
getParam(
'sys_mm_cache_engine');
187 $this->oCacheObject =
ch_instance (
'ChWsbCache'.$sEngine);
188 if (!$this->oCacheObject->isAvailable())
189 $this->oCacheObject =
ch_instance (
'ChWsbCacheFile');
205 if(!$aMenuStructure) {
213 $aReplaced = $aDefinedMenuItems = array();
216 $sStartPosition =
'';
219 $aDefinedMenuItems =
$oCache->getData(
222 if(!$aDefinedMenuItems) {
223 foreach($aMenuStructure AS $sPosition => $aMenuItems ) {
224 foreach($aMenuItems
as $iKey => $aItems) {
226 foreach($aItems AS $sMenuKey => $sValue ) {
227 if ( $sMenuKey !=
'PopupMenu' && $sMenuKey !=
'linked_items' ) {
228 if ( $sMenuKey ==
'Caption' ) {
229 $aReplaced[$sPosition][$iKey][$sMenuKey] =
$oFunctions -> markerReplace(
$aMemberInfo, $sValue, $aItems[
'Eval'],
true);
231 $aReplaced[$sPosition][$iKey][$sMenuKey] =
$oFunctions -> markerReplace(
$aMemberInfo, $sValue, $aItems[
'Eval']);
234 $aReplaced[$sPosition][$iKey][$sMenuKey] = $sValue;
238 if($sStartPosition != $sPosition) {
240 $sStartPosition = $sPosition;
245 if ( $aReplaced[$sPosition][$iKey][
'Type'] ==
'link'
246 && $aReplaced[$sPosition][$iKey][
'Caption']
247 && ($aReplaced[$sPosition][$iKey][
'Link'] || $aReplaced[$sPosition][$iKey][
'Script']) ) {
250 if($sPosition ==
'top_extra') {
251 $sMenuClass =
'extra_item {evalResultCssClassWrapper}';
255 $sPartCaption = $aReplaced[$sPosition][$iKey][
'Caption'];
258 if($aReplaced[$sPosition][$iKey][
'Name'] ==
'MemberBlock') {
262 $sUserThumbnailDouble =
$GLOBALS[
'oFunctions']->getMemberAvatar(
$aMemberInfo[
'ID'],
'small',
true);
263 if(
empty($sUserThumbnailDouble))
264 $sUserThumbnailDouble = $sUserThumbnail;
266 $bUserThumbnail = !
empty($sUserThumbnail);
268 $sMenuImage =
$GLOBALS[
'oSysTemplate']->parseHtmlByName(
'member_menu_thumbnail.html', array(
269 'ch_if:show_thumbnail_image' => array(
270 'condition' => $bUserThumbnail,
272 'thumbnail_url' => $sUserThumbnail,
273 'thumbnail_url_2x' => $sUserThumbnailDouble,
276 'ch_if:show_thumbnail_icon' => array(
277 'condition' => !$bUserThumbnail,
287 $sMenuImage = $aReplaced[$sPosition][$iKey][
'Icon'];
288 if(strpos($sMenuImage,
'.') !==
false)
291 $sReduceImage = $sMenuImage;
292 $sMenuImage = $this->
getImage($sMenuImage);
295 if ($aReplaced[$sPosition][$iKey][
'Caption'] ==
'{system}') {
296 $sMenuImage = $aReplaced[$sPosition][$iKey][
'Icon'] ? $aReplaced[$sPosition][$iKey][
'Icon'] :
'spacer.gif';
297 if(strpos($sMenuImage,
'.') !==
false)
299 $sMenuImage = $this->
getImage($sMenuImage);
301 $sPartCaption = eval($aReplaced[$sPosition][$iKey][
'Eval']);
304 if ($aReplaced[$sPosition][$iKey][
'Bubble']) {
305 $sCode = str_replace(
'{iOldCount}', 0, $aReplaced[$sPosition][$iKey][
'Bubble']);
309 $this -> sBubbles .=
"\"{$aReplaced[$sPosition][$iKey]['Name']}\" : {count:'{$aRetEval['count']}'}, \n";
315 $sDescription =
_t(!
empty($aReplaced[$sPosition][$iKey][
'Description']) ? $aReplaced[$sPosition][$iKey][
'Description'] : $aReplaced[$sPosition][$iKey][
'Caption']);
317 $aDefinedMenuItems[$sPosition][
$iIndex] = array
319 'ch_if:show_class' => array(
320 'condition' => !
empty($sMenuClass),
322 'class' => $sMenuClass
327 'menu_caption' => $aReplaced[$sPosition][$iKey][
'Name'] ==
'MemberBlock'
328 || $aReplaced[$sPosition][$iKey][
'Caption'] ==
'{system}'
332 'menu_link' => $aReplaced[$sPosition][$iKey][
'Script']
333 ?
'javascript:void(0)'
334 : $oPermalinks->permalink($aReplaced[$sPosition][$iKey][
'Link']),
336 'extended_action' => $aReplaced[$sPosition][$iKey][
'Script']
337 ?
'onclick="' . $aReplaced[$sPosition][$iKey][
'Script'] .
'"'
340 'target' => $aReplaced[$sPosition][$iKey][
'Target'] ==
'_blank'
344 'menu_image' => $sMenuImage,
346 'bubble_box' => $aReplaced[$sPosition][$iKey][
'Bubble']
347 ?
$oSysTemplate -> parseHtmlByName(
'member_menu_bubble.html',
349 'extra_styles' => ( $aRetEval[
'count'] ) ?
null :
'style="display:none"',
350 'count' => $aRetEval[
'count'],
351 'bubble_id' => $this -> sBubblePrefix . $aReplaced[$sPosition][$iKey][
'Name']))
354 'indent' => ( $this -> sMemberMenuPosition ==
'bottom' ) ?
'menu_item_bottom' :
'menu_item_top',
355 'item_link_indent' => ( $this -> sMemberMenuPosition ==
'bottom' ) ?
'bottom_indent' :
'top_indent',
357 'menu_id' => $aReplaced[$sPosition][$iKey][
'ID'],
360 'ch_if:menu_desc' => array(
361 'condition' => !
empty($sDescription),
363 'menu_id' => $aReplaced[$sPosition][$iKey][
'ID'],
365 'desc_indent' => ( $this -> sMemberMenuPosition ==
'bottom' ) ?
'description_bottom' :
'description_top',
370 if($aReplaced[$sPosition][$iKey][
'Caption'] ==
'{system}') {
371 $sPartCaption =
_t($aReplaced[$sPosition][$iKey][
'Description']);
375 $aContentKeys = array (
376 'menu_id' => $aReplaced[$sPosition][$iKey][
'ID'],
377 'menu_name' => $aReplaced[$sPosition][$iKey][
'Name'],
380 'ch_if:reduce_element_top' => array (
381 'condition' => ( $this -> sMemberMenuPosition ==
'bottom' ),
383 'menu_id' => $aReplaced[$sPosition][$iKey][
'ID'],
384 'item_link' => $aReplaced[$sPosition][$iKey][
'Link'],
385 'extended_action' =>
empty($aReplaced[$sPosition][$iKey][
'extended_action']) ?
'' : $aReplaced[$sPosition][$iKey][
'extended_action'],
386 'cover' =>
'top_cover',
387 'item_name' => $sPartCaption,
389 'ch_if:part_image' => array(
390 'condition' => ($sReduceImage),
392 'item_img' => $this->
getImage($sReduceImage, strip_tags($aReplaced[$sPosition][$iKey][
'Caption'])),
399 'ch_if:reduce_element_bottom' => array (
400 'condition' => ( $this -> sMemberMenuPosition ==
'top' || $this -> sMemberMenuPosition ==
'static' ),
402 'menu_id' => $aReplaced[$sPosition][$iKey][
'ID'],
403 'item_link' => $aReplaced[$sPosition][$iKey][
'Link'],
404 'extended_action' =>
empty($aReplaced[$sPosition][$iKey][
'extended_action']) ?
'' : $aReplaced[$sPosition][$iKey][
'extended_action'],
405 'cover' =>
'bottom_cover',
406 'item_name' => $sPartCaption,
408 'ch_if:part_image' => array(
409 'condition' => ($sReduceImage),
411 'item_img' => $this->
getImage($sReduceImage, strip_tags($aReplaced[$sPosition][$iKey][
'Caption'])),
418 if ( $aReplaced[$sPosition][$iKey][
'PopupMenu'] ) {
419 $aDefinedMenuItems[$sPosition][
$iIndex][
'menu_link'] =
'javascript:void(0)';
420 $aDefinedMenuItems[$sPosition][
$iIndex][
'extended_action'] =
null;
423 $aDefinedMenuItems[$sPosition][
$iIndex][
'ch_if:sub_menu'] = array (
424 'condition' => $aReplaced[$sPosition][$iKey][
'PopupMenu'],
425 'content' => $aContentKeys,
435 $aBubbles = array(
'bubbles' => $this -> sBubbles);
436 $aDefinedMenuItems = array_merge($aDefinedMenuItems, $aBubbles);
438 , $aDefinedMenuItems, $this -> iKeysFileTTL);
443 ChWsbService::call(
'pageac',
'menu_items_filter', array(
'member', &$aDefinedMenuItems));
447 $sBubbleList = isset($aDefinedMenuItems[
'bubbles'])
448 ? trim($aDefinedMenuItems[
'bubbles'])
449 : trim($this -> sBubbles);
452 $aTemplateKeys = array (
453 'items' =>
$oSysTemplate->parseHtmlByName(
'extra_top_menu_items.html', array(
'ch_repeat:items' => $aDefinedMenuItems[
'top'])),
454 'items_extra' =>
$oSysTemplate->parseHtmlByName(
'extra_top_menu_items.html', array(
'ch_repeat:items' => $aDefinedMenuItems[
'top_extra'])),
455 'site_url' => CH_WSB_URL_ROOT,
456 'menu_position' => $this -> sMemberMenuPosition,
457 'is_profile_page' => defined(
'CH_PROFILE_PAGE') ?
'true' :
'false',
458 'bubbles_list' => preg_replace(
'/,$/',
'', $sBubbleList),
459 'bubbles_update_time' => $this -> iBubblesUpdateTime,
460 'notify_destroy_time' => $this -> iNotifyDestroyTime,
461 'page_reciver' => $this -> sQueryPageReciver,
462 'bubble_prefix' => $this -> sBubblePrefix,
463 'menu_popup_prefix' => $this->sMenuPopupPrefix,
464 'description_prefix' => $this->sDescriptionPrefix
468 return $oSysTemplate -> parseHtmlByName(
'extra_top_menu.html', $aTemplateKeys);
479 if (isset(
$GLOBALS[
'ch_profiler']))
$GLOBALS[
'ch_profiler']->beginMenu(
'Member Menu');
495 if (isset(
$GLOBALS[
'ch_profiler']))
$GLOBALS[
'ch_profiler']->endMenu(
'Member Menu');
501 $aMenuStructure =
$oCache->getData(
$GLOBALS[
'MySQL']->genDbCacheKey($this -> sMenuCacheFile));
502 if(!$aMenuStructure) {
508 if (isset(
$GLOBALS[
'ch_profiler']))
$GLOBALS[
'ch_profiler']->endMenu(
'Member Menu');
531 foreach($aLinkedItems
as $iKey => $aItems) {
536 return $sSubMenuCode;
551 .
$GLOBALS[
'oSysTemplate']->getCode()) .
'.php';
575 $oCache->removeAllByPrefix($this -> sMenuMemberKeysCache);
577 return $GLOBALS[
'MySQL']->cleanCache($this -> sMenuCacheFile);
590 $aCacheData = array();
592 $sQuery =
"SELECT * FROM `sys_menu_member` WHERE `Active` = '1' ORDER BY `Order`";
593 $rResult =
db_res($sQuery);
595 while(
true == ($aRow = $rResult->fetch()) ) {
596 $aRow[
'Link'] = $oPermalink -> permalink($aRow[
'Link']);
599 $aCacheData[$aRow[
'Position']][$aRow[
'ID']] = $aRow;
603 if ( !$rResult->rowCount() ) {
608 if (!
empty($aCacheData) && is_array($aCacheData)) {
609 $oCache->setData (
$GLOBALS[
'MySQL']->genDbCacheKey($this -> sMenuCacheFile), $aCacheData);
624 $iMenuId = (int) $iMenuId;
625 $sQuery =
"SELECT `Eval` FROM `sys_menu_member` WHERE `Parent` = {$iMenuId} AND `Type` = 'linked_item'";
626 $rResult =
db_res($sQuery);
628 $aLinkedItems = array();
629 while (
true == ($aRow = $rResult->fetch()) ) {
630 $aLinkedItems[] = array(
631 'code' => $aRow[
'Eval']
635 return $aLinkedItems;
640 return $GLOBALS[
'oFunctions']->sysImage($sImg,
'', $sAlt, $sAttr);