XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
mymenu.php
Go to the documentation of this file.
1 <?php
2 // Skip for ORETEKI XOOPS
3 if( defined( 'XOOPS_ORETEKI' ) ) return ;
4 
5 global $xoopsModule;
6 $mydirpath = dirname( dirname( __FILE__ ) ) ;
7 
8 if( ! is_object( $xoopsModule ) ) die( '$xoopsModule is not set' ) ;
9 
10 // language files (modinfo.php)
11 $language = empty( $xoopsConfig['language'] ) ? 'english' : $xoopsConfig['language'] ;
12 if( file_exists( "$mydirpath/language/$language/modinfo.php" ) ) {
13  // user customized language file
14  include_once "$mydirpath/language/$language/modinfo.php" ;
15 } else if( file_exists( "$mytrustdirpath/language/$language/modinfo.php" ) ) {
16  // default language file
17  include_once "$mytrustdirpath/language/$language/modinfo.php" ;
18 } else {
19  // fallback english
20  include_once "$mytrustdirpath/language/english/modinfo.php" ;
21 
22 
23 }
24 
25 include dirname(dirname(__FILE__)).'/admin_menu.php' ;
26 
27 if( file_exists( XOOPS_TRUST_PATH.'/libs/altsys/mytplsadmin.php' ) ) {
28  // mytplsadmin (TODO check if this module has tplfile)
29  $title = defined( '_MD_A_MYMENU_MYTPLSADMIN' ) ? _MD_A_MYMENU_MYTPLSADMIN : 'tplsadmin' ;
30  array_push( $adminmenu , array( 'title' => $title , 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mytplsadmin' ) ) ;
31 }
32 
33 if( file_exists( XOOPS_TRUST_PATH.'/libs/altsys/myblocksadmin.php' ) ) {
34  // myblocksadmin
35  $title = defined( '_MD_A_MYMENU_MYBLOCKSADMIN' ) ? _MD_A_MYMENU_MYBLOCKSADMIN : 'blocksadmin' ;
36  array_push( $adminmenu , array( 'title' => $title , 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin' ) ) ;
37 }
38 
39 // preferences
41 if( count( $config_handler->getConfigs( new Criteria( 'conf_modid' , $xoopsModule->mid() ) ) ) > 0 ) {
42  if( file_exists( XOOPS_TRUST_PATH.'/libs/altsys/mypreferences.php' ) ) {
43  // mypreferences
44  $title = defined( '_MD_A_MYMENU_MYPREFERENCES' ) ? _MD_A_MYMENU_MYPREFERENCES : _PREFERENCES ;
45  array_push( $adminmenu , array( 'title' => $title , 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mypreferences' ) ) ;
46  } else {
47  // system->preferences
48  array_push( $adminmenu , array( 'title' => _PREFERENCES , 'link' => XOOPS_URL.'/modules/system/admin.php?fct=preferences&op=showmod&mod='.$xoopsModule->mid() ) ) ;
49  }
50 }
51 
52 $mymenu_uri = empty( $mymenu_fake_uri ) ? $_SERVER['REQUEST_URI'] : $mymenu_fake_uri ;
53 $mymenu_link = substr( strstr( $mymenu_uri , '/admin/' ) , 1 ) ;
54 
55 
56 
57 // highlight (you can customize the colors)
58 foreach( array_keys( $adminmenu ) as $i ) {
59  if( $mymenu_link == $adminmenu[$i]['link'] ) {
60  $adminmenu[$i]['color'] = '#FFCCCC' ;
61  $adminmenu_hilighted = true ;
62  $GLOBALS['altsysAdminPageTitle'] = $adminmenu[$i]['title'] ;
63  } else {
64  $adminmenu[$i]['color'] = '#DDDDDD' ;
65  }
66 }
67 if( empty( $adminmenu_hilighted ) ) {
68  foreach( array_keys( $adminmenu ) as $i ) {
69  if( stristr( $mymenu_uri , $adminmenu[$i]['link'] ) ) {
70  $adminmenu[$i]['color'] = '#FFCCCC' ;
71  $GLOBALS['altsysAdminPageTitle'] = $adminmenu[$i]['title'] ;
72  break ;
73  }
74  }
75 }
76 
77 // link conversion from relative to absolute
78 foreach( array_keys( $adminmenu ) as $i ) {
79  if( stristr( $adminmenu[$i]['link'] , XOOPS_URL ) === false ) {
80  $adminmenu[$i]['link'] = XOOPS_URL."/modules/$mydirname/" . $adminmenu[$i]['link'] ;
81  }
82 }
83 // start hack by Mage
84 /*
85 // display (you can customize htmls)
86 echo "<div style='text-align:left;width:98%;'>" ;
87 foreach( $adminmenu as $menuitem ) {
88  echo "<div style='float:left;height:1.5em;'><nobr><a href='".htmlspecialchars($menuitem['link'],ENT_QUOTES)."' style='background-color:{$menuitem['color']};font:normal normal bold 9pt/12pt;'>".htmlspecialchars($menuitem['title'],ENT_QUOTES)."</a> | </nobr></div>\n" ;
89 }
90 echo "</div>\n<hr style='clear:left;display:block;' />\n" ;
91 */
92 // end hack by Mage
93 ?>