diff --git a/core/templates/layout.admin.php b/core/templates/layout.admin.php index 1fcd4568f8c5d43afbd38d69b3840cdde5f49cc1..8668aa64fda68eaf6f0d2248e71eaccaecdacdf7 100644 --- a/core/templates/layout.admin.php +++ b/core/templates/layout.admin.php @@ -13,6 +13,18 @@ <?php foreach($_['jsfiles'] as $jsfile): ?> <script type="text/javascript" src="<?php echo $jsfile; ?>"></script> <?php endforeach; ?> + <?php foreach($_['headers'] as $header): ?> + <?php + echo '<'.$header['tag'].' '; + foreach($header['attributes'] as $name=>$value){ + echo "$name='$value' "; + }; + echo '>'; + echo $header['text']; + echo '</'.$header['tag'].'>'; + ?> + <script type="text/javascript" src="<?php echo $jsfile; ?>"></script> + <?php endforeach; ?> </head> <body id="body-settings"> diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php index ce99b00b9f69c108ad38b7a933eb19f11f7d55ae..5655a64d8da3f6b3f9c5a1d39afbcf4c1e605575 100644 --- a/core/templates/layout.guest.php +++ b/core/templates/layout.guest.php @@ -13,6 +13,19 @@ <?php foreach($_['jsfiles'] as $jsfile): ?> <script type="text/javascript" src="<?php echo $jsfile; ?>"></script> <?php endforeach; ?> + + <?php foreach($_['headers'] as $header): ?> + <?php + echo '<'.$header['tag'].' '; + foreach($header['attributes'] as $name=>$value){ + echo "$name='$value' "; + }; + echo '>'; + echo $header['text']; + echo '</'.$header['tag'].'>'; + ?> + <script type="text/javascript" src="<?php echo $jsfile; ?>"></script> + <?php endforeach; ?> </head> <body id="body-login"> diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index f21db202a8353d0b698918f55a7523a9a26c87d0..2a9a817498d5ff53a3c88e76627072d3a600ed1d 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -13,6 +13,18 @@ <?php foreach($_['jsfiles'] as $jsfile): ?> <script type="text/javascript" src="<?php echo $jsfile; ?>"></script> <?php endforeach; ?> + <?php foreach($_['headers'] as $header): ?> + <?php + echo '<'.$header['tag'].' '; + foreach($header['attributes'] as $name=>$value){ + echo "$name='$value' "; + }; + echo '>'; + echo $header['text']; + echo '</'.$header['tag'].'>'; + ?> + <script type="text/javascript" src="<?php echo $jsfile; ?>"></script> + <?php endforeach; ?> </head> <body id="body-user"> diff --git a/lib/template.php b/lib/template.php index 69065e1ea167e7a473a0487478448397ca474926..992fa2de76cbf47a24656c796c509f639d7f74dc 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