public function render() { $situazione = new StatoSensoriView($this->model->sensor); $programmi = new StatoSistemaView($this->model->program); $this->addData(['situazione' => $situazione->render(), 'programmazione' => $programmi->render()]); return parent::render(); }
public function render(MainView $mainView, NavigationView $navigationView) { echo ' <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="css/style.css"> <title>Result Logger</title> </head> <body> ' . $mainView->showHeadline() . ' ' . $mainView->showLogoutPanel() . ' ' . $navigationView->showLinks() . ' <div id="container"> ' . $mainView->showContent() . ' </div> </body> </html> '; }
public static function displayNav($title1, $title2, $withConnectBtn) { if (!isset($_SESSION['email'])) { $rep = '<nav class="navbar navbar-default navbar-fixed-top"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="#"> <span class="logo-brand">42</span> </a> </div>'; $rep .= '<ul class="nav navbar-nav"> <li class="active"><a href="./"> Appartements<span class="sr-only">(current)</span></a></li> </ul>'; if ($withConnectBtn == true) { $rep .= '<a class="btn btn-default navbar-btn navbar-right" href="./?a=login">Se connecter / S\'inscrire</a>'; } } else { $rep = '<nav class="navbar navbar-default navbar-fixed-top"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="#"> <span class="logo-brand">42</span> </a> </div> <ul class="nav navbar-nav">'; if ($_SESSION['employe'] == 1) { $rep .= ' <li class="active"><a href="./?a=dashboard"> Tableau de bord<span class="sr-only">(current)</span></a></li>'; } $rep .= ' <li class="active"><a href="./"> Appartements<span class="sr-only">(current)</span></a></li> </ul> <ul class="nav navbar-nav navbar-right"> <li><a href="./?a=displayPos"><span class="glyphicon glyphicon-home"></span> Mes appartements</a></li> <li><a href="./?a=displayLoc"><span class="glyphicon glyphicon-home"></span> Mes locations</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-user"></span> Mon compte (' . $_SESSION['prenom'] . ' ' . $_SESSION['nom'] . ')<span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="./?a=displayUti">Informations de compte</a></li> <li role="separator" class="divider"></li> <li><a href="controller/leaving.php""><strong>Se déconnecter</strong></a></li> </ul> </li> <li><a href="./?a=contactAgence"><span class="glyphicon glyphicon-envelope"></span> Contacter M42</a></li> </ul> </div> </nav>'; } $rep .= '</nav>' . MainView::displayTitle($title1, $title2); return $rep; }
public function buildProductsTable($cats) { $catHtml = ""; if(isset($cats) && is_array($cats)){ foreach($cats as $cat){ $catHtml .= " <tr> <td>$cat[category_id]</td> <td><a href='" . UrlHelper::generateUrl('item', 'getitems', array('category'=>$cat['category_name'])). "'>$cat[category_name]</a></td> </tr>"; } } else { $catHtml = "<tr><td colspan='4'>No Categorys Exists</td></tr>"; } parent::assign('cats', $catHtml); }
public function render() { $stati = ['acceso' => 0, 'spento' => 0, 'indeterminato' => 0]; foreach ($this->model->result as $v) { if ($v === true) { $stati['acceso'] += $v['durata']; } else { if ($v === false) { $stati['spento'] += $v['durata']; } else { $stati['indeterminato'] += $v['durata']; } } } $commutazioni = ['elenco' => $this->model->result, 'totale' => $stati]; $this->addData(['commutazioni' => $commutazioni]); return parent::render(); }
public function render() { $this->addData(['sensori' => $this->model->list, 'antigelo' => $this->model->antifreezeTemp, 'manuale' => $this->model->manualTemp, 'santigelo' => $this->model->antifreezeSensor, 'smanuale' => $this->model->manualSensor, 'pin_rele' => $this->model->pinRele]); return parent::render(); }
public function render($directOutput = true) { parent::render($directOutput); }
<?php /* * required lib */ require 'lib/functions.php'; /* * start session */ session_start(); $main_view = new MainView(); $main_view->init();
public function render() { $this->addData(['sensori' => $this->model->get('listnoavg'), 'sensore' => $this->model->get('data')]); return parent::render(); }
/** * navi */ protected function navi($file) { // read php-files from / $filenames = array(); $dh = opendir($_SERVER['DOCUMENT_ROOT'] . '/' . $_SESSION['GC']->get_config('relative_path')); while ($entry = readdir($dh)) { // check if file, .php-extension and !test.php if (is_file($_SERVER['DOCUMENT_ROOT'] . '/' . $_SESSION['GC']->get_config('relative_path') . $entry) && substr($entry, -4) == '.php' && $entry != 'test.php') { $filenames[] = $entry; } } closedir($dh); // get class-names from filelist for ($i = 0; $i < count($filenames); $i++) { // only use files excluding "index.php" if ($filenames[$i] != 'index.php') { // remove extension and set naviitem $classname = ucfirst(substr($filenames[$i], 0, -4)) . 'View'; $navi = $classname::connectnavi(); // check if array if (!is_array($navi)) { $errno = $GLOBALS['Error']->error_raised('CannotGetNavi', 'class:' . $classname); $GLOBALS['Error']->handle_error($errno); } $naviitems[$navi['firstlevel']['position']] = $navi; } else { // set navi for index-page $navi = MainView::connectnavi(); // check if array if (!is_array($navi)) { $errno = $GLOBALS['Error']->error_raised('CannotGetNavi', 'class:MainView'); $GLOBALS['Error']->handle_error($errno); } $naviitems[$navi['firstlevel']['position']] = $navi; } } // firstlevel // get authorized navi-entries $navi_entries = Rights::get_authorized_entries('navi'); // prepare data for smarty $data = array(); // walk through $naviitems and build navi for ($i = 0; $i < count($naviitems); $i++) { // simplify $firstlevel = $naviitems[$i]['firstlevel']; // check rights if (!in_array(md5($firstlevel['class']), $navi_entries)) { continue; } // check visibility if ($firstlevel['show'] === false) { continue; } // set firstlevel // smarty $data[] = array('level' => 0, 'href' => $firstlevel['file'], 'title' => parent::lang('class.' . $firstlevel['class'] . '#connectnavi#firstlevel#name'), 'content' => parent::lang($firstlevel['name'])); // walk through secondlevel $secondlevel = $naviitems[$i]['secondlevel']; for ($j = 0; $j < count($secondlevel); $j++) { // check rights if (!in_array(md5($firstlevel['class'] . '|' . $secondlevel[$j]['getid']), $navi_entries)) { continue; } // check visibility if ($secondlevel[$j]['show'] === false) { continue; } // smarty $data[] = array('level' => 1, 'href' => $secondlevel[$j]['getid'] == 'login' && $this->get('id') != 'login' && $this->get('id') != 'logout' ? $firstlevel['file'] . '?id=' . $secondlevel[$j]['getid'] . '&r=' . base64_encode($_SERVER['REQUEST_URI']) : $firstlevel['file'] . '?id=' . $secondlevel[$j]['getid'], 'title' => parent::lang($secondlevel[$j]['name']), 'content' => parent::lang($secondlevel[$j]['name']), 'id' => $secondlevel[$j]['getid'], 'file' => $firstlevel['file']); } } // return return $data; }
$log = \file_get_contents($logfilename); $content .= "<pre>" . \htmlspecialchars($log) . "</pre>"; $content .= $tpl->render('foot'); header('Content-Type: text/html; charset=utf-8'); header('Content-Length: ' . strlen($content)); echo $content; break; default: $logger->error('Unknown action.'); $m->addLastInfoMessage('error', 'Error!'); // TODO Improve message $mainView = new MainView(); $mainView->render(); break; } // switch($action) } catch (\Exception $e) { $pageTitle = 'Microblog: Error'; $logger->error($e->__toString()); if (isset($m)) { if ($m->isLogin()) { $m->addLastInfoMessage('error', $e->getMessage()); } else { $m->addLastInfoMessage('error', 'Error!'); } $mainView = new MainView(); $mainView->render(); } else { echo "Error"; } }
public function winnersAction() { $model = new OrderModel(); $winners = $model->getWinners(); $view = new MainView(); return $this->_controller->setPage($view->showWinners(['winners' => $winners])); }
public function render() { $this->addData(['commutazioni' => $this->renderSwitching()]); return parent::render(); }
public function render() { $this->addData(['programmi' => $this->model->list, 'programma' => $this->model, 'temperature' => isset($this->model->temperature) ? $this->model->temperature : null]); return parent::render(); }