diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-06-24 18:02:19 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-06-24 18:02:19 +0200 |
commit | 4d11e920be943bdd60c86e46b8f6c922dea87c79 (patch) | |
tree | a203e732192c203618de7a7080fa27399ff945cf /lib/template.php | |
parent | 1aa8399915bc6148fab3ad8e3eae736e9a135c09 (diff) | |
download | nextcloud-server-4d11e920be943bdd60c86e46b8f6c922dea87c79.tar.gz nextcloud-server-4d11e920be943bdd60c86e46b8f6c922dea87c79.zip |
provide an option to add custom elements to the header of templates
Diffstat (limited to 'lib/template.php')
-rw-r--r-- | lib/template.php | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/template.php b/lib/template.php index 69065e1ea16..992fa2de76c 100644 --- a/lib/template.php +++ b/lib/template.php @@ -76,6 +76,7 @@ class OC_TEMPLATE{ private $vars; // Vars private $template; // The path to the template private $l10n; // The l10n-Object + private $headers=array(); //custom headers /** * @brief Constructor @@ -151,6 +152,16 @@ class OC_TEMPLATE{ $this->vars[$key] = array( $value ); } } + + /** + * @brief Add a custom element to the header + * @param string tag tag name of the element + * @param array $attributes array of attrobutes for the element + * @param string $text the text content for the element + */ + public function addHeader( $tag, $attributes, $text=''){ + $this->headers[]=array('tag'=>$tag,'attributes'=>$attributes,'text'=>$text); + } /** * @brief Prints the proceeded template @@ -195,7 +206,9 @@ class OC_TEMPLATE{ $search=new OC_TEMPLATE( 'core', 'part.searchbox'); $search->assign('searchurl',OC_HELPER::linkTo( 'search', 'index.php' )); $page->assign('searchbox', $search->fetchPage()); - // Add menu data + + // Add custom headers + $page->assign('headers',$this->headers); // Add navigation entry $page->assign( "navigation", OC_APP::getNavigation()); @@ -206,6 +219,10 @@ class OC_TEMPLATE{ $search=new OC_TEMPLATE( 'core', 'part.searchbox'); $search->assign('searchurl',OC_HELPER::linkTo( 'search', 'index.php' )); $page->assign('searchbox', $search->fetchPage()); + + // Add custom headers + $page->assign('headers',$this->headers); + // Add menu data if( OC_GROUP::inGroup( $_SESSION["user_id"], "admin" )){ $page->assign( "adminnavigation", OC_APP::getAdminNavigation()); @@ -215,7 +232,8 @@ class OC_TEMPLATE{ else { $page = new OC_TEMPLATE( "core", "layout.guest" ); - // Add data if required + // Add custom headers + $page->assign('headers',$this->headers); } // Add the css and js files |