Пример #1
0
 /**
  * Outputs the page to the client.
  *
  * @param string $page Page to show.
  */
 function Show($page)
 {
     if (empty($this->pages[$page])) {
         trigger_error("Page not found: {$page}");
         return;
     }
     if (isset($this->pages[$page]['layout'])) {
         $layout = $this->pages[$page]['layout'];
     } else {
         $layout = $this->layout;
     }
     if (isset($this->pages[$page]['style'])) {
         $style = $this->pages[$page]['style'];
     } else {
         $style = $this->styles;
     }
     if (isset($this->pages[$page]['title'])) {
         $title = $this->pages[$page]['title'];
     } else {
         $title = $this->title;
     }
     if (isset($this->pages[$page]['opts'])) {
         $opts = $this->pages[$page]['opts'];
     } else {
         $opts = array();
     }
     if ($this->db) {
         $this->db->Connect();
         $opts['db'] =& $this->db;
     }
     $pg =& new SEC_Page(array('header' => array('class' => 'SEC_Header', 'opts' => array('title' => $title, 'styles' => $style)), 'layout' => $layout, 'content' => array('class' => $this->pages[$page]['class'], 'opts' => $opts)));
     $pg->Show();
     $this->db->Close();
 }
Пример #2
0
 /**
  * Constructor: Load all parameters into member variables.
  *
  * @param array $opts Parameters for the object, as 'var' => 'value'.
  */
 function APP_Base($opts = array())
 {
     $keys = array_keys($opts);
     foreach ($keys as $key) {
         $this->{$key} = $opts[$key];
     }
     if (!empty($this->connection_class)) {
         $db_class = $this->connection_class;
         include_once $db_class . '.class.php';
         $this->db = new $db_class($this->connection_opts);
         $this->db->Connect();
     }
 }