aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2012-10-27 12:32:43 +0000
committermistic100 <mistic@piwigo.org>2012-10-27 12:32:43 +0000
commit457dbb4dac68ac052da5d693682965db688bfe9a (patch)
tree64804da09238d747dcce0805f694552a3c0a2f1c
parentcbfdae7499f9dd19699695d0d5c06f229c55ad88 (diff)
feature:2781 Add template method to sort actions buttons
git-svn-id: http://piwigo.org/svn/trunk@18760 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--include/template.class.php36
-rw-r--r--index.php1
-rw-r--r--picture.php1
3 files changed, 38 insertions, 0 deletions
diff --git a/include/template.class.php b/include/template.class.php
index 21dfed4ea..cf823cb5a 100644
--- a/include/template.class.php
+++ b/include/template.class.php
@@ -46,6 +46,9 @@ class Template {
const COMBINED_CSS_TAG = '<!-- COMBINED_CSS -->';
var $css_by_priority = array();
+
+ var $picture_buttons = array();
+ var $index_buttons = array();
function Template($root = ".", $theme= "", $path = "template")
{
@@ -852,6 +855,39 @@ var s,after = document.getElementsByTagName(\'script\')[document.getElementsByTa
}
return $themeconfs[$dir];
}
+
+ function add_picture_button($content, $rank)
+ {
+ $this->picture_buttons[$rank][] = $content;
+ }
+
+ function add_index_button($content, $rank)
+ {
+ $this->index_buttons[$rank][] = $content;
+ }
+
+ function parse_picture_buttons()
+ {
+ if (!empty($this->picture_buttons))
+ {
+ ksort($this->picture_buttons);
+ foreach ($this->picture_buttons as $ranked)
+ foreach ($ranked as $content)
+ $this->concat('PLUGIN_PICTURE_ACTIONS', $content);
+ }
+ }
+
+ function parse_index_buttons()
+ {
+ if (!empty($this->index_buttons))
+ {
+ ksort($this->index_buttons);
+ foreach ($this->index_buttons as $ranked)
+ foreach ($ranked as $content)
+ $this->concat('PLUGIN_INDEX_ACTIONS', $content);
+ }
+ }
+
}
diff --git a/index.php b/index.php
index 9fbc083f7..021056331 100644
--- a/index.php
+++ b/index.php
@@ -334,6 +334,7 @@ if (!empty($page['cat_slideshow_url']))
include(PHPWG_ROOT_PATH.'include/page_header.php');
trigger_action('loc_end_index');
include(PHPWG_ROOT_PATH.'include/page_messages.php');
+$template->parse_index_buttons();
$template->pparse('index');
//------------------------------------------------------------ log informations
pwg_log();
diff --git a/picture.php b/picture.php
index a791ea959..4d89edc77 100644
--- a/picture.php
+++ b/picture.php
@@ -999,6 +999,7 @@ if ($page['slideshow'] and $conf['light_slideshow'])
}
else
{
+ $template->parse_picture_buttons();
$template->pparse('picture');
}
//------------------------------------------------------------ log informations