aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/AMenuManager/amm_root.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_root.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 'plugins/AMenuManager/amm_root.class.inc.php')
-rw-r--r--plugins/AMenuManager/amm_root.class.inc.php82
1 files changed, 78 insertions, 4 deletions
diff --git a/plugins/AMenuManager/amm_root.class.inc.php b/plugins/AMenuManager/amm_root.class.inc.php
index 50d9742e2..2dfa604e0 100644
--- a/plugins/AMenuManager/amm_root.class.inc.php
+++ b/plugins/AMenuManager/amm_root.class.inc.php
@@ -26,7 +26,7 @@ class AMM_root extends common_plugin
$this->plugin_name_files="amm";
parent::__construct($prefixeTable, $filelocation);
- $list=array('urls');
+ $list=array('urls', 'personalised');
$this->set_tables_list($list);
}
@@ -43,7 +43,28 @@ class AMM_root extends common_plugin
'amm_links_show_icons' => 'y',
'amm_links_active' => 'y',
'amm_links_title' => array(),
- 'amm_sections_visible' => array()
+ 'amm_sections_visible' => array(),
+ 'amm_randompicture_active' => 'n',
+ 'amm_randompicture_showname' => 'n', //n:no, o:over, u:under
+ 'amm_randompicture_showcomment' => 'n', //n:no, o:over, u:under
+ 'amm_randompicture_title' => array(),
+ 'amm_sections_modspecial' => array(
+ 'favorite_cat' => 'y',
+ 'most_visited_cat' => 'y',
+ 'best_rated_cat' => 'y',
+ 'random_cat' => 'y',
+ 'recent_pics_cat' => 'y',
+ 'recent_cats_cat' => 'y',
+ 'calendar' => 'y'
+ ),
+ 'amm_sections_modmenu' => array(
+ 'qsearch' => 'y',
+ 'Tags' => 'y',
+ 'Search' => 'y',
+ 'comments' => 'y',
+ 'About' => 'y',
+ 'Notification' => 'y'
+ )
);
$languages=get_languages();
@@ -51,11 +72,13 @@ class AMM_root extends common_plugin
{
if($key=='fr_FR')
{
- $this->my_config['amm_links_title'][$key]='Liens';
+ $this->my_config['amm_links_title'][$key]=base64_encode('Liens');
+ $this->my_config['amm_randompicture_title'][$key]=base64_encode('Une image au hasard');
}
else
{
- $this->my_config['amm_links_title'][$key]='Links';
+ $this->my_config['amm_links_title'][$key]=base64_encode('Links');
+ $this->my_config['amm_randompicture_title'][$key]=base64_encode('A random picture');
}
}
@@ -66,6 +89,22 @@ class AMM_root extends common_plugin
}
}
+ public function load_config()
+ {
+ global $menu;
+
+ parent::load_config();
+
+ $sections=$menu->registered();
+ foreach($sections as $key => $val)
+ {
+ if(!isset($this->my_config['amm_sections_visible'][$key]))
+ {
+ $this->my_config['amm_sections_visible'][$key]='y';
+ }
+ }
+
+ }
// return an array of urls (each url is an array)
protected function get_urls($only_visible=false)
@@ -82,6 +121,7 @@ class AMM_root extends common_plugin
{
while($row=mysql_fetch_array($result))
{
+ $row['label']=stripslashes($row['label']);
$returned[]=$row;
}
}
@@ -106,6 +146,40 @@ class AMM_root extends common_plugin
return($returned);
}
+ // return an array of sections (each section is an array)
+ protected function get_sections($only_visible=false, $lang="", $only_with_content=true)
+ {
+ global $user;
+
+ if($lang=="")
+ {
+ $lang=$user['language'];
+ }
+
+ $returned=array();
+ $sql="SELECT * FROM ".$this->tables['personalised']."
+WHERE (lang = '*' OR lang = '".$lang."') ";
+ if($only_visible)
+ {
+ $sql.=" AND visible = 'y' ";
+ }
+ if($only_with_content)
+ {
+ $sql.=" AND content != '' ";
+ }
+ $sql.=" ORDER BY id, lang DESC ";
+ $result=pwg_query($sql);
+ if($result)
+ {
+ while($row=mysql_fetch_array($result))
+ {
+ $returned[]=$row;
+ }
+ }
+ return($returned);
+ }
+
+
} // amm_root class