function show() { $myModel = new MyModel(); $data = $myModel->get(); $myView = new MyView(); $myView->display($data); }
public function __construct($template, $engine, $vars) { parent::__construct($template, $engine, $vars); $vars['page'] = 'home'; $vars['title'] = $vars['site_name'] . ' Home'; $this->addVars($vars); }
protected function initializeView() { if (self::$shouldCallParentAndEcho) { parent::initializeView(); echo 'View' . PHP_EOL; } if (is_null($this->view)) { $this->view = MyView::getInstance(); } }
public function initializeController() { if (self::$amWacky) { parent::initializeController(); var_dump($this->view); var_dump($this->commandMap); } elseif (self::$shouldUseMyView) { $this->view = MyView::getInstance(); } }
<?php include "../../config/settings.inc.php"; include "../../include/database.inc.php"; include "setup.php"; include "../../include/myview.php"; $t = new MyView(); $t->thispage = "iem-sites"; $t->title = "Current Data"; $t->sites_current = "current"; if (strpos($network, "_DCP") || strpos($network, "_COOP")) { $table = '<p>This station reports observations in SHEF format. The following is a table of the most recent reports from this site identifier for each reported SHEF variable'; $mesosite = iemdb('mesosite'); $shefcodes = array(); $rs = pg_query($mesosite, "SELECT * from shef_physical_codes"); for ($i = 0; $row = @pg_fetch_assoc($rs, $i); $i++) { $shefcodes[$row['code']] = $row['name']; } $durationcodes = array(); $rs = pg_query($mesosite, "SELECT * from shef_duration_codes"); for ($i = 0; $row = @pg_fetch_assoc($rs, $i); $i++) { $durationcodes[$row['code']] = $row['name']; } $extremumcodes = array(); $rs = pg_query($mesosite, "SELECT * from shef_extremum_codes"); for ($i = 0; $row = @pg_fetch_assoc($rs, $i); $i++) { $extremumcodes[$row['code']] = $row['name']; } $pgconn = iemdb('access');
} for ($i = 0; $row = @pg_fetch_array($result, $i); $i++) { $table .= str_pad($row["id"], 9) . str_pad($row["synop"], 7) . str_pad($row["name"], 33) . str_pad($row["state"], 3) . str_pad($row["country"], 2) . sprintf("%6.0f", $row["latitude"] * 100) . sprintf("%7.0f", $row["longitude"] * 100) . sprintf("%6.0f", $row["elevation"]) . "\n"; } if (!$nohtml) { $table .= "</pre>\n"; } } } } } } } } if (!$nohtml || $format == 'shapefile') { $t = new MyView(); $t->title = "Network Station Tables"; $t->thispage = "iem-networks"; $page = 'single.phtml'; $sextra = ""; if (isset($_REQUEST['station'])) { $t->sites_current = "tables"; include "setup.php"; $page = 'sites.phtml'; $sextra = sprintf("<input type=\"hidden\" value=\"%s\" name=\"station\">", $_REQUEST["station"]); } $ar = array("html" => "HTML Table", "csv" => "Comma Delimited", "shapefile" => "ESRI Shapefile", "gempak" => "GEMPAK Station Table", "awips" => "AWIPS Station Table", "madis" => "MADIS Station Table"); $fselect = make_select("format", $format, $ar); $nselect = selectNetwork($network, array("_ALL_" => "All Networks")); $t->content = <<<EOF <h3>Network Location Tables</h3>
<?php /* * This is an Extjs application that allows historical and current viewing of * webcam images. */ include "../../config/settings.inc.php"; define("IEM_APPID", 9); require_once "../../include/myview.php"; $t = new MyView(); include "../../include/iemprop.php"; $camera_refresh = get_iemprop("webcam.interval"); $t->headextra = <<<EOF <link rel="stylesheet" type="text/css" href="https://extjs.cachefly.net/ext/gpl/5.0.0/build/packages/ext-theme-neptune/build/resources/ext-theme-neptune-all.css"/> <script type="text/javascript" src="https://extjs.cachefly.net/ext/gpl/5.0.0/build/ext-all.js"></script> <script> Ext.namespace('cfg'); cfg.refreshint = {$camera_refresh}000; cfg.header = 'iem-header'; cfg.headerHeight = 60; cfg.jsonSource = '/json/webcams.php'; </script> <script type='text/javascript' src='webcam-static.js?v=7'></script> <style> .webimage { height: 240px; width : 320px; } .thumb-wrap{ float: left; margin: 1px;
function cached($path) { if (Configure::read('Cache.enable') && Configure::read('Cache.view')) { $path = Inflector::slug($path); $filename = CACHE . 'views' . DS . $path . '.php'; if (!file_exists($filename)) { $filename = CACHE . 'views' . DS . $path . '_index.php'; } if (file_exists($filename)) { if (!class_exists('MyView')) { App::import('Core', 'View', $this->app); } $view = new MyView($this, false); $view->ajaxRequest = $this->ajaxRequest; $view->viewSuffix = $this->viewSuffix; $view->name = $this->name; // $view->helpers = $this->helpers; // $view->layout = $this->layout; return $view->renderCache($filename, S2getMicrotime()); } } return false; }
<?php /*include_once("myconfig.php");*/ include '.././classes/mymodel.php'; include '.././classes/myview.php'; /*CONTROLLER CREATES THE MODEL*/ $theActualModel = new MyModel(); /*TEST IT IS INSTANCIATED*/ $myTemp = $theActualModel->getQueryValue(); echo $myTemp; echo "<p></p>"; /*CONTROLLER FINDS OUT THE QUERY STRING APPENDED TO THE URL, REVERSES IT, AND SENDS IT TO THE MODEL*/ /*... BUT MAYBE IT WOULD BE BETTER FOR THE MANIPULATION TO OCCUR INSIDE THE MODEL?*/ $theURLStuff = strrev($_SERVER['QUERY_STRING']); $theActualModel->setQueryValue($theURLStuff); /*CONTROLLER CREATES THE VIEW*/ $theActualView = new MyView(); /*TEST THE VIEW WORKS*/ $myTempViewModelText = $theActualView->displayTheInfo(); /*echo $myTempViewModelText ; */ echo "<p>Here is the number at the end of the URL, but reversed.</p>"; /*CONTROLLER GETS TEXT FROM THE MODEL AND SENDS TO THE VIEW*/ $theActualView->setInfoToDisplay($theActualModel->getQueryValue()); /*CONTROLLER TELLS VIEW TO DISPLAY THE TEXT*/ $theActualView->displayTheInfo();
<?php include_once "../../config/settings.inc.php"; define("IEM_APPID", 86); include_once "../../include/myview.php"; $t = new MyView(); $t->title = "7 AM 24 Hour Precipitation Analysis"; $t->headextra = <<<EOF <link rel="stylesheet" href="/vendor/openlayers/3.6.0/ol.css" type="text/css"> <link rel="stylesheet" href="/assets/jquery-ui/1.11.2/jquery-ui.min.css" /> <link type="text/css" href="/vendor/openlayers/3.6.0/ol3-layerswitcher.css" rel="stylesheet" /> <style> .map { height: 400px; width: 100%; background-color: #FFFFFF; } .popover { width: 300px; } </style> EOF; $t->jsextra = <<<EOF <script src="/vendor/openlayers/3.6.0/ol.js" type="text/javascript"></script> <script src="/assets/jquery-ui/1.11.2/jquery-ui.js"></script> <script src='/vendor/openlayers/3.6.0/ol3-layerswitcher.js'></script> <script src='7am-app.js?v=8'></script> EOF; $t->content = <<<EOF <ol class="breadcrumb"> \t<li><a href="/COOP/">NWS COOP</a></li>
public static function showName() { self::$showName = true; }
<?php include "../../config/settings.inc.php"; include "../../include/myview.php"; $t = new MyView(); define("IEM_APPID", 40); $sortcol = isset($_GET["sortcol"]) ? $_GET["sortcol"] : "peak"; $metar = isset($_GET["metar"]) ? $_GET['metar'] : "no"; $sorder = isset($_GET["sorder"]) ? $_GET["sorder"] : "desc"; $wfo = isset($_REQUEST["wfo"]) ? $_REQUEST["wfo"] : 'DMX'; $t->refresh = "<meta http-equiv=\"refresh\" content=\"60;\">"; $t->title = "Obs by NWS Forecast Office"; $t->thispage = "current-sort"; include "../../include/mlib.php"; include "../../include/network.php"; $nt = new NetworkTable("WFO"); include "../../include/forms.php"; include "../../include/station.php"; include "../../include/iemaccess.php"; include "../../include/iemaccessob.php"; $iem = new IEMAccess(); $asos = $iem->getWFO($wfo); $vals = array("tmpf" => "Air Temperature [F]", "dwpf" => "Dew Point Temp [F]", "sknt" => "Wind Speed [knots]", "drct" => "Wind Direction [deg]", "alti" => "Altimeter [mb]", "peak" => "Today's Wind Gust [knots]", "peak_ts" => "Time of Peak Gust", "relh" => "Relative Humidity", "feel" => "Feels Like [F]", "vsby" => "Visibility [miles]", "ts" => "Observation Time", "phour" => "Last Hour Rainfall [inch]", "min_tmpf" => "Today's Low Temperature", "max_tmpf" => "Today's High Temperature", "pday" => "Today Rainfall [inch]"); $t->current_network = "By NWS WFO"; $wselect = "<select name=\"wfo\">"; while (list($key, $value) = each($nt->table)) { $wselect .= "<option value=\"{$key}\" "; if ($wfo == $key) { $wselect .= "SELECTED"; } $wselect .= ">[" . $key . "] " . $nt->table[$key]["name"] . "\n";
function renderLayout($content_for_layout, $layout = null) { $layout_fn = $this->_getLayoutFileName($layout); $data_for_layout = array_merge($this->viewVars, array('content_for_layout' => $content_for_layout)); if (empty($this->loaded) && !empty($this->helpers)) { $loadHelpers = true; } else { $loadHelpers = false; $data_for_layout = array_merge($data_for_layout, $this->loaded); } if (substr($layout_fn, -3) === 'ctp' || substr($layout_fn, -5) === 'thtml') { $this->output = MyView::_render($layout_fn, $data_for_layout, $loadHelpers, true); } else { $this->output = $this->_render($layout_fn, $data_for_layout, $loadHelpers); } // $out = $this->_render($layout_fn, $data_for_layout, $loadHelpers); if ($this->output === false) { $this->output = $this->_render($layout_fn, $data_for_layout); trigger_error(sprintf(__("Error in layout %s, got: <blockquote>%s</blockquote>", true), $layout_fn, $this->output), E_USER_ERROR); return false; } /* if (!empty($this->loaded)) { $helpers = array_keys($this->loaded); foreach ($helpers as $helperName) { $helper =& $this->loaded[$helperName]; if (is_object($helper)) { if (is_subclass_of($helper, 'Helper') || is_subclass_of($helper, 'helper')) { $helper->afterLayout(); } } } } */ return $this->output; }
/** * Outputs cached dispatch view cache * * @param string $url Requested URL * @access public */ function cached($url) { App::import('Component', 'config', $this->app); $controller = new stdClass(); if (class_exists('ConfigComponent')) { $Config = new ConfigComponent(); $Config->startup($controller); } $User = cmsFramework::getUser(); if ($User->id === 0 && !Configure::read('Cache.disable') && Configure::read('Cache.view') && !defined('MVC_FRAMEWORK_ADMIN')) { $path = $this->here; if ($this->here == '/') { $path = 'home'; } $path = Inflector::slug($path); $filename = CACHE . 'views' . DS . $path . '.php'; if (!file_exists($filename)) { $filename = CACHE . 'views' . DS . $path . '_index.php'; } if (file_exists($filename)) { if (!class_exists('MyView')) { App::import('Core', 'View', $this->app); } $controller = null; $view = new MyView($controller, false); // Pass the configuration object to the view and set the theme variable for helpers $view->name = $this->controller; $view->action = $this->action; $view->page = Sanitize::getInt($this->params, 'page'); $view->limit = Sanitize::getInt($this->params, 'limit'); $view->Config = $Config; $view->viewTheme = $Config->template; $view->xajaxRequest = false; $view->ajaxRequest = $this->isAjax(); $out = $view->renderCache($filename, S2getMicrotime()); return $out; } } return false; }
public static function set_base_href($base_href) { self::$base_href = $base_href; }
<?php include "../../../config/settings.inc.php"; include "../../../include/myview.php"; include "../../../include/forms.php"; include "../../../include/imagemaps.php"; define("IEM_APPID", 109); $t = new MyView(); $t->thispage = "gis-"; $t->jsextra = <<<EOF <script> \$('select[name=station]').change( function() { \tnexrad = \$('select[name=station]').val(); \t\$('#histimage').attr('src', '/pickup/nexrad_attrs/'+nexrad+'_histogram.png'); \twindow.location.href = "#"+ nexrad; }); var tokens = window.location.href.split('#'); if (tokens.length == 2 && tokens[1].length == 3){ \t\$('#histimage').attr('src', '/pickup/nexrad_attrs/'+ tokens[1] +'_histogram.png'); } </script> EOF; $t->title = "Download NEXRAD Storm Attributes Shapefile"; $content = <<<EOF <h3 class="heading">Archived NEXRAD Storm Attributes Shapefiles</h3> <p>The IEM attempts to process and archive the Storm Attribute Table that is produced by the RADARs that are a part of the NEXRAD network. This page allows you to selectively download these attributes from the IEM database in shapefile format. <strong>Holes do exist in this archive!</strong> If you find
<?php include_once "../../../../config/settings.inc.php"; include_once "../../../../include/myview.php"; $OL = "3.9.0"; $t = new MyView(); $t->title = "Profitability Map"; $t->headextra = <<<EOF <link rel="stylesheet" href="/vendor/openlayers/{$OL}/ol.css" type="text/css"> <link rel="stylesheet" href="/vendor/jquery-ui/1.11.4/jquery-ui.min.css" /> <link type="text/css" href="/vendor/openlayers/{$OL}/ol3-layerswitcher.css" rel="stylesheet" /> EOF; $t->jsextra = <<<EOF <script src="/vendor/openlayers/{$OL}/ol.js" type="text/javascript"></script> <script src="/vendor/jquery-ui/1.11.4/jquery-ui.js"></script> <script src='/vendor/openlayers/{$OL}/ol3-layerswitcher.js'></script> <script> var map; var player; \$(document).ready(function(){ \tplayer = new ol.layer.Tile({ title: 'Profitability', \t\t\t\t\t\tvisible: true, source: new ol.source.XYZ({ url : '/c/tile.py/1.0.0/profit2010/{z}/{x}/{y}.png' }) }); \t\t \t\tmap = new ol.Map({ target: 'map', layers: [new ol.layer.Tile({