aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/AMenuManager/amm_pip.class.inc.php
diff options
context:
space:
mode:
authorgrum <grum@piwigo.org>2008-08-07 21:52:45 +0000
committergrum <grum@piwigo.org>2008-08-07 21:52:45 +0000
commit526d8006a16bd8b666d94aaf152346537045a0a5 (patch)
treebe1a62befe2bdbe3d0d03a8155aa1d1b228093e5 /plugins/AMenuManager/amm_pip.class.inc.php
parent5e3d71c9cab75c7796c566823df96765522c8965 (diff)
updating files for the Menu class (test_menu)
+ add functionnalities updating files for the AMenuManager plugin + fixes some bugs + add functionnalities updating common classes grum_plugins_classes-2 (needed for the AMenuManager plugin) + add functionalities for google_translator use git-svn-id: http://piwigo.org/svn/trunk@2468 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--plugins/AMenuManager/amm_pip.class.inc.php80
1 files changed, 78 insertions, 2 deletions
diff --git a/plugins/AMenuManager/amm_pip.class.inc.php b/plugins/AMenuManager/amm_pip.class.inc.php
index 57ba0db78..dc34e1d84 100644
--- a/plugins/AMenuManager/amm_pip.class.inc.php
+++ b/plugins/AMenuManager/amm_pip.class.inc.php
@@ -49,7 +49,6 @@ class AMM_PIP extends AMM_root
global $menu, $user;
-
/*
Add a new section (links)
*/
@@ -67,11 +66,72 @@ class AMM_PIP extends AMM_root
$section = new Section('mbAMM_links', base64_decode($this->my_config['amm_links_title'][$user['language']]), dirname(__FILE__).'/menu_templates/menubar_links.tpl');
$section->set_items(array(
'LINKS' => $urls,
- 'icons' => 'y'
+ 'icons' => $this->my_config['amm_links_show_icons']
));
$menu->add($section->get());
}
+
+ /*
+ Add a new random picture section
+ */
+ if($this->my_config['amm_randompicture_active']=='y')
+ {
+ $sql="SELECT i.id as image_id, i.file as image_file, i.comment, i.path, i.tn_ext, c.id as catid, c.name, c.permalink, RAND() as rndvalue, i.name as imgname
+FROM ".CATEGORIES_TABLE." c, ".IMAGES_TABLE." i, ".IMAGE_CATEGORY_TABLE." ic
+WHERE c.status='public'
+ AND c.id = ic.category_id
+ AND ic.image_id = i.id
+ORDER BY rndvalue
+LIMIT 0,1
+";
+ $result=pwg_query($sql);
+ if($result)
+ {
+ $nfo = mysql_fetch_array($result);
+ $nfo['section']='category';
+ $nfo['category']=array(
+ 'id' => $nfo['catid'],
+ 'name' => $nfo['name'],
+ 'permalink' => $nfo['permalink']
+ );
+
+ $section = new Section('mbAMM_randompict', base64_decode($this->my_config['amm_randompicture_title'][$user['language']]), dirname(__FILE__).'/menu_templates/menubar_randompic.tpl');
+ $section->set_items(array(
+ 'LINK' => make_picture_url($nfo),
+ 'IMG' => get_thumbnail_url($nfo),
+ 'IMGNAME' => $nfo['imgname'],
+ 'IMGCOMMENT' => $nfo['comment'],
+ 'SHOWNAME' => $this->my_config['amm_randompicture_showname'],
+ 'SHOWCOMMENT' => $this->my_config['amm_randompicture_showcomment']
+ ));
+ $menu->add($section->get());
+ }
+ }
+
+ /*
+ Add personnal blocks random picture section
+ */
+ $sections=$this->get_sections(true);
+
+ if(count($sections))
+ {
+ $id_done=array();
+ foreach($sections as $key => $val)
+ {
+ if(!isset($id_done[$val['id']]))
+ {
+ $section = new Section('mbAMM_personalised'.$val['id'], $val['title'], dirname(__FILE__).'/menu_templates/menubar_personalised.tpl');
+ $section->set_items(array(
+ 'CONTENT' => stripslashes($val['content'])));
+ $menu->add($section->get());
+
+ $id_done[$val['id']]="";
+ }
+ }
+ }
+
+
/*
Hide sections
*/
@@ -83,6 +143,22 @@ class AMM_PIP extends AMM_root
}
}
+ /*
+ hide items from special & menu sections
+ */
+ foreach(array('mbMenu' => 'amm_sections_modmenu', 'mbSpecial' =>'amm_sections_modspecial') as $key0 => $val0)
+ {
+ $section_menu=$menu->section($key0);
+ foreach($this->my_config[$val0] as $key => $val)
+ {
+ if($val=='n')
+ {
+ unset($section_menu['ITEMS'][$key]);
+ }
+ }
+ $menu->replace($section_menu);
+ }
+
}