Пример #1
0
 /**
  * [Kind of controller's destructor. Called when child's work is done]
  * @return [type] [description]
  */
 public function displayView()
 {
     $output = self::stopCapturing();
     if (strlen($output) === 0) {
         Debug::write("No output from controller was detected. No additionnal action will be done on HTML content", 0);
     } else {
         $this->view->setContent("%%@MAIN CONTENT%%", $output);
     }
     $this->view->display();
     /**
      * Breaking the DOM for credits or stats
      */
     if ($GLOBALS['config']['website']['display_credits'] === true || $GLOBALS['config']['website']['display_stats'] === true) {
         echo '<div style="border-top: 1px ridge black;"><p style="text-align:center;font-size:12px;">';
         if ($GLOBALS['config']['website']['display_credits'] === true) {
             echo $GLOBALS['config']['website']['name'] . ' v' . (is_numeric($GLOBALS['config']['website']['version']) ? number_format($GLOBALS['config']['website']['version'], 1) : $GLOBALS['config']['website']['version']) . ' ' . $GLOBALS['config']['website']['branch'] . ', powered by SPF v' . (is_numeric($GLOBALS['config']['framework']['version']) ? number_format($GLOBALS['config']['framework']['version'], 1) : $GLOBALS['config']['framework']['version']) . ' ' . $GLOBALS['config']['framework']['branch'] . '<br />';
         }
         if ($GLOBALS['config']['website']['display_stats'] === true) {
             $time = round(Timer::getTimeFrom("Start"), 5);
             if ($time >= 1) {
                 $unit = 's';
                 $time = round($time, 1);
             } else {
                 $unit = 'ms';
                 $time = round($time * 1000, 5);
             }
             if ($this->db !== null) {
                 echo 'Number of SQL requests : ' . $this->db->getStats() . ' - Page generated in ' . $time . $unit . '<br />';
             }
         }
         echo '</p></div>';
     }
 }
Пример #2
0
 /**
  * Get database information data from the table
  *
  * @param [Database] $db Database
  * @return array Database information
  * @internal
  */
 public function data($db)
 {
     if (!$this->_dbTable) {
         return null;
     }
     // Select the details requested, for the columns requested
     $q = $db->query('select')->table($this->_dbTable)->get($this->_dbPKey);
     foreach ($this->_dbFields as $column => $prop) {
         if ($prop !== self::DB_CONTENT) {
             $q->get($column);
         }
     }
     $result = $q->exec()->fetchAll();
     $out = [];
     for ($i = 0, $ien = count($result); $i < $ien; $i++) {
         $out[$result[$i][$this->_dbPKey]] = $result[$i];
     }
     return $out;
 }