aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/AMenuManager/amm_root.class.inc.php
diff options
context:
space:
mode:
authorgrum <grum@piwigo.org>2008-08-03 07:48:39 +0000
committergrum <grum@piwigo.org>2008-08-03 07:48:39 +0000
commit7ebed797262c7f3371ae1b16ed455f7e9879caf0 (patch)
tree7abef8d2994ae2efa66f38e3027369c7ac0e3926 /plugins/AMenuManager/amm_root.class.inc.php
parentee0af5d43d607ffb969a10e6a21e9df923651d52 (diff)
Asked by rvelices on this topic
http://forum.phpwebgallery.net/viewtopic.php?pid=92097#p92097 A plugin to integrate the menu class see test_menu directory A plugin to show how to use the menu class see AMenuManager directory And common classes needed for the AMenuManager plugin see grum_plugins_classes-2 directory See topic http://forum.phpwebgallery.net/viewtopic.php?pid=92637#p92637 for more informations git-svn-id: http://piwigo.org/svn/trunk@2466 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--plugins/AMenuManager/amm_root.class.inc.php113
1 files changed, 113 insertions, 0 deletions
diff --git a/plugins/AMenuManager/amm_root.class.inc.php b/plugins/AMenuManager/amm_root.class.inc.php
new file mode 100644
index 000000000..50d9742e2
--- /dev/null
+++ b/plugins/AMenuManager/amm_root.class.inc.php
@@ -0,0 +1,113 @@
+<?php
+/* -----------------------------------------------------------------------------
+ Plugin : Advanced Menu Manager
+ Author : Grum
+ email : grum@grum.dnsalias.com
+ website : http://photos.grum.dnsalias.com
+ PWG user : http://forum.phpwebgallery.net/profile.php?id=3706
+
+ << May the Little SpaceFrog be with you ! >>
+ ------------------------------------------------------------------------------
+ See main.inc.php for release information
+
+ AMM_root : root classe for plugin
+
+ --------------------------------------------------------------------------- */
+
+if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
+
+include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php');
+
+class AMM_root extends common_plugin
+{
+ function AMM_root($prefixeTable, $filelocation)
+ {
+ $this->plugin_name="Advanced Menu Manager";
+ $this->plugin_name_files="amm";
+ parent::__construct($prefixeTable, $filelocation);
+
+ $list=array('urls');
+ $this->set_tables_list($list);
+ }
+
+ /* ---------------------------------------------------------------------------
+ common AIP & PIP functions
+ --------------------------------------------------------------------------- */
+
+ /* this function initialize var $my_config with default values */
+ public function init_config()
+ {
+ global $menu;
+
+ $this->my_config=array(
+ 'amm_links_show_icons' => 'y',
+ 'amm_links_active' => 'y',
+ 'amm_links_title' => array(),
+ 'amm_sections_visible' => array()
+ );
+
+ $languages=get_languages();
+ foreach($languages as $key => $val)
+ {
+ if($key=='fr_FR')
+ {
+ $this->my_config['amm_links_title'][$key]='Liens';
+ }
+ else
+ {
+ $this->my_config['amm_links_title'][$key]='Links';
+ }
+ }
+
+ $sections=$menu->registered();
+ foreach($sections as $key => $val)
+ {
+ $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)
+ {
+ $returned=array();
+ $sql="SELECT * FROM ".$this->tables['urls'];
+ if($only_visible)
+ {
+ $sql.=" WHERE visible = 'y' ";
+ }
+ $sql.=" ORDER BY position";
+ $result=pwg_query($sql);
+ if($result)
+ {
+ while($row=mysql_fetch_array($result))
+ {
+ $returned[]=$row;
+ }
+ }
+ return($returned);
+ }
+
+ //return number of url
+ protected function get_count_url($only_visible=false)
+ {
+ $returned=0;
+ $sql="SELECT count(id) FROM ".$this->tables['urls'];
+ if($only_visible)
+ {
+ $sql.=" WHERE visible = 'y' ";
+ }
+ $result=pwg_query($sql);
+ if($result)
+ {
+ $tmp=mysql_fetch_row($result);
+ $returned=$tmp[0];
+ }
+ return($returned);
+ }
+
+
+} // amm_root class
+
+
+?>