public function listTop()
 {
     $database = Database::getInstance();
     $esc = SymbolStat::columns();
     $statement = $database->select(SymbolStat::table())->select("SUM(?) AS total_wt, SUM(?) AS total_ct, COUNT(DISTINCT ?) AS runs, ?, ?", $esc->wallTime, $esc->calls, $esc->runId, $esc->symbolId, Symbol::columns()->name)->leftJoin('? ON ? = ?', Symbol::table(), Symbol::columns()->id, $esc->symbolId)->groupBy(SymbolStat::columns()->symbolId)->order('total_wt DESC')->limit(50);
     $res = $statement->query();
     $table = new HTML();
     foreach ($res as $row) {
         $row['name'] = '<a href="?symbol=' . urlencode($row['name']) . '">' . $row['name'] . '</a>';
         unset($row['symbol_id']);
         $table->addRow($row);
     }
     $this->layout->pushMain($table)->render();
 }
Beispiel #2
0
 public function renderMessage($message)
 {
     if ($message instanceof SubContent) {
         return '<div class="padded">' . $this->renderMessage($message->content) . '</div>';
     }
     switch (true) {
         case $message instanceof Rows:
             $table = new HTML();
             $table->addClass('table table-striped');
             foreach ($message->getIterator() as $item) {
                 foreach ($item as $key => $value) {
                     $item[$key] = $this->renderMessage($value);
                 }
                 $table->addRow($item);
             }
             return (string) $table;
         case $message instanceof Error:
             return '<div role="alert" class="alert alert-danger"><strong>OOPS!</strong> ' . $this->renderMessage($message->value) . '</div>';
         case $message instanceof Success:
             return '<div role="alert" class="alert alert-success">' . $this->renderMessage($message->value) . '</div>';
         case $message instanceof Anchor:
             return '<a href="' . $message->anchor . '">' . $this->renderMessage($message->value) . '</a>';
         case $message instanceof Multiple:
             $ret = '';
             foreach ($message->items as $item) {
                 $ret .= $this->renderMessage($item);
             }
             return $ret;
         case $message instanceof Badge:
             return '<span class="badge">' . $this->renderMessage($message->value) . '</span>';
         case $message instanceof Label:
             return '<span class="label label-' . $message->style . '">' . $this->renderMessage($message->value) . '</span>';
         case $message instanceof Text:
             return '<div class="text ' . $message->type . '">' . $this->renderMessage($message->value) . '</div>';
         case $message instanceof ItemList:
             $ret = '<ul class="list-group">';
             foreach ($message->items as $item) {
                 $ret .= '<li class="list-group-item">' . $this->renderMessage($item) . '</li>';
             }
             $ret .= '</ul>';
             return $ret;
         default:
             return $message;
     }
 }
Beispiel #3
0
 public function respond($message)
 {
     if ($message instanceof Rows) {
         $this->layout->pushMain(HTML::create()->setRows($message->getIterator()));
         return $this;
     } else {
         $this->layout->pushMain(new Message($message));
         return $this;
     }
 }
Beispiel #4
0
 public function addContent($message)
 {
     if ($message instanceof SubContent) {
         echo '<div class="padded">';
         $this->addContent($message->content);
         echo '</div>';
         return $this;
     }
     if ($message instanceof Rows) {
         $table = new HTML();
         foreach ($message->getIterator() as $item) {
             $table->push($item);
         }
         $message = (string) $table;
     } elseif ($message instanceof Text) {
         $message = '<div class="text ' . $message->type . '">' . $message->value . '</div>';
     }
     echo '<div>' . $message . '</div>';
     return $this;
 }