Esempio n. 1
0
 /**
  * returns the instance created by its first invoke.
  *
  * @return Head
  */
 public static function getInstance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Esempio n. 2
0
 public function __construct()
 {
     parent::__construct();
     $this->session = Session::instance();
     $this->head = Head::instance();
     $this->head->css->append_file('themes/' . config::get('s7n.theme') . '/css/layout');
     $this->head->title->set(config::get('s7n.site_title'));
     $this->template->set_global('theme_url', 'themes/' . config::get('s7n.theme') . '/');
     $this->template->head = $this->head;
 }
Esempio n. 3
0
 public function __construct()
 {
     $this['title'] = new Head_Title();
     $this['base'] = new Head_Base();
     $this['javascript'] = new Head_Javascript();
     $this['css'] = new Head_Css();
     $this['link'] = new Head_Link();
     $this->setFlags(ArrayObject::ARRAY_AS_PROPS);
     // Singleton instance
     self::$instance = $this;
 }
 public function __construct()
 {
     parent::__construct();
     // Load the template
     $this->template = new Admin_View($this->template);
     if ($this->auto_render == TRUE) {
         // Render the template immediately after the controller method
         Event::add('system.post_controller', array($this, '_render'));
     }
     $this->session = Session::instance();
     $this->db = Database::instance();
     // check if user is logged in or not. also check if he has admin role
     if (!Auth::factory()->logged_in('admin')) {
         $this->session->set('redirect_me_to', url::current());
         url::redirect('admin/auth/login');
     }
     $this->head = Head::instance();
     // Javascripts
     $this->head->javascript->append_file('vendor/jquery/jquery.js');
     $this->head->javascript->append_file('vendor/jquery/jquery-ui.min.js');
     $this->head->javascript->append_file('vendor/jquery/ui/ui.tree.js');
     $this->head->javascript->append_file('themes/admin/js/stuff.js');
     // Stylesheets
     $this->head->css->append_file('themes/admin/css/ui/jquery-ui');
     $this->head->css->append_file('themes/admin/css/layout');
     $this->head->css->append_file('themes/admin/css/ui.tabs');
     $this->head->title->set('S7Nadmin');
     $this->template->set_global('tasks', array());
     $this->template->set_global('sidebar', array());
     $this->template->title = '';
     $this->template->message = $this->session->get('info_message', NULL);
     $this->template->error = $this->session->get('error_message', NULL);
     $this->template->content = '';
     $this->template->set_global('head', $this->head);
     $this->template->searchbar = FALSE;
     $this->template->searchvalue = '';
 }
Esempio n. 5
0
 /**
  * Returns the rendered head tag
  * @param boolean echo result
  * @return string
  */
 public function render($output = false)
 {
     // Set content-type header
     //Header('Content-Type: '.$this->contenttype.';; charset='.$this->charset);
     if (substr(Kohana::VERSION, 0, 3) == '3.0') {
         $request = Request::instance();
     } else {
         $request = Request::current();
     }
     $request->headers['Content-Type'] = $this->contenttype . '; charset=' . $this->charset;
     $html = $this->xhtml_doctype;
     $html .= '<html' . Html::attributes($this->htmlatts_all) . '>';
     $html .= Head::instance();
     $html .= '<body>' . $this->body . '</body>';
     $html .= '</html>';
     // Tidy
     if (extension_loaded('tidy') and Kohana::config('xhtml.tidy_output')) {
         $tidyconfig = Kohana::config('xhtml.tidy_config');
         //$tidyconfig['output-xml'] = true;
         $charset = str_replace('-', '', $this->charset);
         $tidy = new tidy();
         $tidy->parseString($html, $tidyconfig, $charset);
         $tidy->cleanRepair();
         $html = (string) $tidy;
     }
     //Output
     if ($output) {
         echo $html;
     }
     return $html;
 }