public function endMovie()
 {
     println("Shutting movie theater down...");
     $this->popper->off();
     $this->lights->on();
     $this->screen->up();
     $this->projector->off();
     $this->amp->off();
     $this->dvd->stop();
     $this->dvd->eject();
     $this->dvd->off();
 }
Beispiel #2
0
 public static function init()
 {
     /**
      * If initialized, return initialized value without reprocessing.
      */
     if (self::$_init !== null) {
         return self::$_init;
     }
     /**
      * Define name of the cookie set by asets/js/core/server.js.
      */
     self::$_name = 'screen';
     /**
      * Contents of cookie set by asets/js/core/server.js.
      */
     self::$_cookie = Cookie::get(self::$_name);
     /**
      * If cookie is set, extract contents and parse the JSON into a PHP
      * object, then setting initialized value to true. Otherwise, set it
      * false, as initialization has failed since no cookie is defined.
      */
     if (isset(self::$_cookie)) {
         self::$_screen = self::parse(self::$_cookie);
         self::$_init = true;
     } else {
         self::$_init = false;
     }
     /**
      * Return whether initialization succeeded or failed.
      */
     return self::$_init;
 }
 public function actionTest($id)
 {
     // renders the view file 'protected/views/screen/display.php'
     // using the default layout 'protected/views/layouts/billboard.php'
     $this->screen_id = $id;
     $screen = Screen::model()->findByPk($id);
     if ($screen === null) {
         throw new CHttpException(404, Yii::t('error', 'The requested screen does not exist.'));
     }
     Yii::app()->theme = count($screen->themes) == 0 ? 'he' : $screen->themes[0]->theme;
     $conditions = array();
     $conditions[] = 'ads.expire>=:now';
     $conditions[] = 'ads.start<=:now';
     $conditions[] = 'ads.' . date('D', strtotime('now')) . '=1';
     $ads = $screen->ads(array('condition' => implode(' AND ', $conditions), 'params' => array(':now' => date('Y-m-d', strtotime('now')))));
     $yeshuv = $screen->yeshuv->name_heb;
     $commercial = $screen->commercials[0]->file_name;
     date_default_timezone_set('Asia/Jerusalem');
     if ($this->isweekend()) {
         $holiday = Holiday::model()->find(array('condition' => 'name = :name', 'params' => array(':name' => 'friday')));
     } else {
         $holiday = Holiday::model()->find(array('condition' => 'end_date >= :now && start_date <= :now', 'params' => array(':now' => date('Y-m-d H:i:s', strtotime('now')))));
     }
     $this->render('test', array('ads' => $ads, 'screen' => $screen, 'yeshuv' => $yeshuv, 'commercial' => 5, 'holiday' => $holiday));
 }
Beispiel #4
0
 function show()
 {
     $this->clear();
     foreach ($this->layers as $l => $layer) {
         $this->map = Map::add($this->map, $layer->map, $layer->options);
     }
     Screen::to_screen($this->map->map());
 }
 function showAction()
 {
     $this->group = new Group($this->args[1]);
     $this->feeds = Feed::get_all('WHERE group_id=' . $this->group->id);
     $this->screens = Screen::get_all('WHERE group_id=' . $this->group->id);
     $this->setTitle($this->group->name);
     $this->setSubject($this->group->name);
     $this->canEdit = $_SESSION['user']->can_write('group', $this->args[1]);
 }
 public function testGetScreenPermissionsNoneWithScreenDefined()
 {
     $module = 'xim';
     $action = 'doThis';
     $roles = '';
     $mockDao = $this->getMock('ScreenPermissionDao', array('getScreenPermissions'));
     $emptyDoctrineCollection = new Doctrine_Collection('ScreenPermission');
     $mockDao->expects($this->once())->method('getScreenPermissions')->with($module, $action, $roles)->will($this->returnValue($emptyDoctrineCollection));
     $this->service->setScreenPermissionDao($mockDao);
     $screen = new Screen();
     $screen->setName('abc');
     $screenDao = $this->getMock('ScreenDao', array('getScreen'));
     $screenDao->expects($this->once())->method('getScreen')->with($module, $action)->will($this->returnValue($screen));
     $this->service->setScreenDao($screenDao);
     $permissions = $this->service->getScreenPermissions($module, $action, $roles);
     $this->assertTrue($permissions instanceof ResourcePermission);
     $this->verifyPermissions($permissions, false, false, false, false);
 }
Beispiel #7
0
 public function CreateChannelsForWindows($screenId, $netId)
 {
     $Screen = Screen::model()->findByPk($screenId);
     $windows = $Screen->windows;
     NetChannel::model()->deleteAll("net_id = :net_id", array('net_id' => $netId));
     foreach ($windows as $window) {
         $channel = new NetChannel();
         $channel->attributes = array('net_id' => $netId, 'window_id' => $window->id);
         $channel->save();
     }
 }
Beispiel #8
0
 function dashboardAction()
 {
     $this->notifications = Newsfeed::get_for_user($_SESSION['user']->id);
     $this->setTitle("Concerto Dashboard");
     $group_str = implode(',', $_SESSION['user']->groups);
     $this->setTitle("Dashboard");
     if (count($_SESSION['user']->groups) > 0) {
         $group_str = 'OR group_id IN (' . $group_str . ')';
     } else {
         $group_str = "";
     }
     $this->screens = Screen::get_all('WHERE type = 0 ' . $group_str . ' ORDER BY `name`');
     if (!is_array($this->screens)) {
         $this->screens = array();
     }
     $this->screen_stats = Screen::screenStats('WHERE type = 0 ' . $group_str . ' ORDER BY `name`');
 }
Beispiel #9
0
 /**
  * Parsed raw xrandr output and builds lists for screens and outputs
  *
  * @throws \Exception
  */
 public function parseRaw()
 {
     $this->screens = array();
     $this->outputs = array();
     $currentOutput = null;
     $outputIndex = 0;
     $raw = $this->getRaw();
     if ($raw == null) {
         return false;
     }
     foreach ($raw as $line) {
         // Using switch just because I think its more "logical" selecting from a case
         switch (true) {
             // Screen
             case preg_match(Screen::LINE_REGEX, $line, $result):
                 $newScreen = Screen::parseLine($line);
                 $this->screens[$newScreen->getId()] = Screen::parseLine($line);
                 break;
                 // Output
             // Output
             case preg_match(Output::LINE_REGEX, $line, $result):
                 $currentOutput = Output::parseLine($outputIndex++, $line);
                 $this->outputs[$currentOutput->getName()] = $currentOutput;
                 break;
                 // Mode
             // Mode
             case preg_match(Mode::LINE_REGEX, $line, $result):
                 if (!isset($currentOutput)) {
                     throw new \Exception("parseRawException: Mode line but no currentOutput\n{$line}");
                 }
                 $currentOutput->_addExistingMode(Mode::parseLine($line));
                 break;
             default:
                 // ToDo: Exeption handling
                 if (Xrandr::DEBUG) {
                     echo "Line could not be parsed!\n";
                     echo $line;
                     echo "\n";
                 }
         }
     }
     return true;
 }
Beispiel #10
0
function screen_offline_mail()
{
    # Query all screens and mail a report if any are offline
    $screens = Screen::get_all();
    if (!is_array($screens)) {
        return false;
    }
    $downed_screens = array();
    foreach ($screens as $screen) {
        if ($screen->went_down()) {
            $downed_screens[] = $screen;
        }
    }
    # construct email report if any screens have gone down in last 2 hours
    if (count($downed_screens) > 0) {
        $admin = new Group(ADMIN_GROUP_ID);
        $mail_body = "The following Concerto screens have gone offline. Please investigate.\n";
        //$mail_body .= "NOTE: THIS EMAIL IS A TEST, IT IS ONLY A TEST. FEEL FREE TO IGNORE.\n";
        foreach ($downed_screens as $screen) {
            $name = $screen->name;
            echo "Found downed screen {$name}.\n";
            $location = $screen->location;
            $mac = $screen->mac_inhex;
            $last_ip = $screen->last_ip;
            $mail_body .= "{$name} (at {$location}, last ip {$last_ip} mac {$mac})\n";
        }
        $admin->send_mail("Screen Outage Detected", $mail_body);
    }
}
Beispiel #11
0
 /**
  * Get the html node for this element
  *
  * @param \DOMElement $node
  * @param \AppShed\Remote\XML\DOMDocument $xml
  * @param \AppShed\Remote\HTML\Settings $settings
  * @param \AppShed\Remote\Style\CSSDocument $css
  * @param array $javascripts
  */
 protected function getHTMLNodeBase($node, $xml, $settings, $css, &$javascripts)
 {
     parent::getHTMLNodeBase($node, $xml, $settings, $css, $javascripts);
     $node->setAttribute('data-zoom', $this->zoom);
 }
Beispiel #12
0
<?php

/* @var $this ThemeController */
/* @var $model Theme */
/* @var $form CActiveForm */
?>

<div class="form">
<?php 
$form = $this->beginWidget('booster.widgets.TbActiveForm', array('id' => 'CreateScreenForm', 'type' => 'horizontal'));
?>

<fieldset>
    <?php 
echo $form->dropDownListGroup($model, 'theme', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Screen::model()->getAvailiableTheme(), 'htmlOptions' => array())));
?>

    <?php 
echo $form->textAreaGroup($model, 'description', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('htmlOptions' => array('rows' => 4))));
?>
</fieldset>

<div class="form-actions">
        <?php 
$this->widget('booster.widgets.TbButton', array('buttonType' => 'submit', 'context' => 'primary', 'label' => YII::t('default', 'Submit')));
?>
        <?php 
$this->widget('booster.widgets.TbButton', array('buttonType' => 'reset', 'label' => YII::t('default', 'Reset')));
?>
</div>
<?php 
Beispiel #13
0
<?php

namespace AScreen;

require_once 'loader.php';
$s = new Screen();
$s->add_layer(new Chaff(20, 80, ['character' => '*']));
$b = $s->add_layer();
$b->map->write(2, 4, '[ this text will be partially obscured by dots ]');
$d = $s->add_layer(new BendDexter(20, 40, ['start_column' => 4]));
//$d->map->show();
//$s->add_layer(new Chaff(20,40,['character'=>'.']));
$s->add_layer(new Chaff(30, 60, ['character' => '.']));
$text = $s->add_layer(null, ['transparent' => '~', 'blank' => '~']);
$text->map->write(4, 4, '[  this text will appear over everything else on the screen  ]');
//$s->add_layer(new BendDexter(20,40,['start_column'=>10]));
//$s->add_layer(Generate::bend_sinister(20,40,10));
$s->show();
Beispiel #14
0
 /**
  * Ajax return the screens for a specific commercial area.
  */
 public function actionGetSearchScreens()
 {
     if (isset($_GET['term'])) {
         $criteria = new CDbCriteria();
         $criteria->select = 'id, name';
         $criteria->condition = 'name LIKE :term OR name_heb LIKE :term';
         $criteria->params = array(':term' => '%' . $_GET['term'] . '%');
         $criteria->with = array('yeshuv' => array('select' => 'name_heb'));
         $criteria->together = true;
         $res = Screen::model()->findAll($criteria);
         if (count($res) > 0) {
             foreach ($res as $item) {
                 $returnVal[] = array('value' => $item->name . ', ' . $item->yeshuv->name_heb, 'id' => $item->id);
             }
             echo CJSON::encode($returnVal);
         } else {
             echo CJSON::encode("");
         }
     }
     Yii::app()->end();
 }
Beispiel #15
0
 /**
  * Displays the map with the availiable screens
  */
 public function actionMap()
 {
     $model = Screen::model()->with('geocodes', 'yeshuv', 'commercials')->findAll();
     $array = array();
     date_default_timezone_set('Asia/Jerusalem');
     $now = new DateTime();
     $now = $now->modify("-10 minutes");
     $id = 0;
     $green = 0;
     foreach ($model as $m) {
         $color = "red";
         $screenAjax = ScreenAjax::model()->findByPk($m->id);
         if ($screenAjax) {
             $last = strtotime($screenAjax->last_date);
             if ($last > $now->getTimestamp()) {
                 $color = "green";
                 $green++;
             }
         }
         if (count($m->geocodes) < 1) {
             $geocode = new Geocode();
             $location = Screen::model()->geocodeLookup($m->name . ',' . $m->yeshuv->name_heb);
             $geocode->lat = $location['lat'];
             $geocode->lng = $location['lng'];
             if ($geocode->save()) {
                 $screenGeocode = new ScreenGeocodeAssignment();
                 $screenGeocode->screen_id = $m->id;
                 $screenGeocode->geocode_id = $geocode->id;
                 $screenGeocode->save();
             }
             $marker = array('id' => $id++, 'name' => $m->name . ', ' . $m->yeshuv->name_heb, 'url' => $m->webkey_nickname, 'lat' => $geocode->lat, 'lng' => $geocode->lng, 'commercial' => $m->commercials[0]->name, 'color' => $color);
             array_push($array, $marker);
         } else {
             $marker = array('id' => $id++, 'name' => $m->name . ', ' . $m->yeshuv->name_heb, 'url' => $m->webkey_nickname, 'lat' => $m->geocodes[0]->lat, 'lng' => $m->geocodes[0]->lng, 'commercial' => $m->commercials[0]->name, 'color' => $color);
             array_push($array, $marker);
         }
     }
     $this->render('map', array('markers' => $array, 'green' => $green));
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Screen the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Screen::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
	function screenStats($where = '') {
		$numOnline = 0;
		$numOffline = 0;
		$numAsleep = 0;
		$total = 0;
		$sql = "SELECT * FROM screen $where";
		$res = sql_query($sql);
		$i = 0;
		while ($row = sql_row_keyed($res, $i)) {
			$temp = new Screen($row['id']);
			if ($temp->is_connected()&&$temp->get_powerstate()) {		// screen is ONLINE
				$numOnline++;
			} else if ($temp->is_connected()&&!$temp->get_powerstate()) {  // screen is ASLEEP
				$numAsleep++;
			} else {	// screen is OFFLINE
				$numOffline++;
			}
			$i++;
			$total = $numOnline + $numOffline + $numAsleep;
		}
		return array($numOnline, $numOffline, $numAsleep, $total);
	}
Beispiel #18
0
        break;
    case 'data':
        include 'cl/DbConnector.php';
        $ctr = new DbConnector();
        $result = json_encode($ctr->process($a, $data, $opt));
        header('Content-type: application/json');
        break;
    case 'get_all_data':
        include 'cl/DbConnector.php';
        $ctr = new DbConnector();
        $result = json_encode($ctr->getAllData());
        header('Content-type: application/json');
        break;
    case 'screen':
        include 'cl/Screen.php';
        $ctr = new Screen();
        $result = $ctr->process($a, $data);
        break;
    case 'login':
        include 'gateway.php';
        exit;
        break;
}
if ($result) {
    echo $result;
} else {
    if (isset($GLOBALS['ERROR'])) {
        echo $GLOBALS['ERROR'];
    } else {
        echo 'no result no errors';
    }
        imageBtnClose: "<?=ADMIN_BASE_URL?>images/lightbox-btn-close.gif",
        imageBtnPrev: "<?=ADMIN_BASE_URL?>images/lightbox-btn-prev.gif",
        imageBtnNext: "<?=ADMIN_BASE_URL?>images/lightbox-btn-next.gif",
        txtImage: 'Template'
    });
 });
})(jQuery);
//--></script>

<!-- Beginning Screen Form -->
<?php
      //assuming $this->screen is null or the screen we want to edit
      if(array_key_exists('screen', $this)) {
         $screen = $this->screen;
      } else {
         $screen = new Screen ();
      }

	if(isset($screen->width) && isset($screen->height)){
		if ($screen->width/$screen->height==(16/9)){
			$ratio = "16:9";
			if ($screen->is_connected()) {
				if (!$screen->get_powerstate()) {
					$scrimg="screen_169_asleep_big.png";
				}
				else {
					$scrimg="screen_169_on_big.png";
				}
			} else {
				$scrimg="screen_169_off_big.png";
			}
Beispiel #20
0
 public function testCreateScreen()
 {
     $newScreenName = "Screen test 1";
     $this->object->setAttributes(array('name' => $newScreenName, 'description' => "New screen description."));
     $this->assertTrue($this->object->save(FALSE));
 }
Beispiel #21
0
}
/**
 * Require necessary libraries. 
 */
include_once dirname(dirname(__FILE__)) . '/lib/screen.class.php';
include_once dirname(dirname(__FILE__)) . '/lib/image.class.php';
/**
 * @var int maximum width the image should be as defined first by the browser
 *          width and then more specifically by URI parameters.
 */
$max_width = Screen::get_width() ? Screen::get_width() * Screen::get_pixel_ratio() : PHP_INT_MAX;
/**
 * @var int maximum height the image should be as defined first by the browser
 *          width and then more specifically by URI parameters.
 */
$max_height = Screen::get_height() ? Screen::get_height() * Screen::get_pixel_ratio() : PHP_INT_MAX;
/**
 * @var bool true if the image should be compressed based on width.
 */
$set_width = false;
/**
 * @var bool true if the image should be compressed based on height.
 */
$set_height = false;
/**
 * Defines $set_height true if a URI segment defining height is set and then
 * calculates the $max_height that the image should be based on the segment(s).
 *
 * @uses $_GET['browser_width_percent'] defines width as percentage of browser width
 * @uses $_GET['browser_width_force'] defines width as 100% of browser width at max
 * @uses $_GET['max_width'] defines  width by max pixels for the image
Beispiel #22
0
 public function __construct($title, $columns = 3)
 {
     parent::__construct($title);
     $this->columns = $columns;
 }
Beispiel #23
0
$ScreenModels = $userModel->screens;
$selectedItems = array();
foreach ($ScreenModels as $val) {
    $dropDown[$val->id] = $val->name;
}
if (!$model->isNewRecord) {
    $ScreenModelId = $model->screen_id;
    $selectedItems[$ScreenModelId] = array('selected' => 'selected');
}
echo $form->dropDownList($model, 'screen_id', $dropDown, array('options' => $selectedItems, 'multiple' => false, 'class' => 'form-control', 'size' => '10'));
printf("<div id='windowsList'>");
if (!$model->isNewRecord) {
    $channels = $model->channels;
    $ScreenModelId = $model->screen_id;
    if ($ScreenModelId != null) {
        $ScreenModel = Screen::model()->findByPk($ScreenModelId);
        if (isset($ScreenModel->windows)) {
            $windows = $ScreenModel->windows;
            foreach ($windows as $window) {
                $windowId = $window->id;
                $windowName = $window->name;
                foreach ($channels as $channel) {
                    if ($channel->id_point === $model->id && $channel->window_id === $window->id) {
                        printf("<div class='ChannelsContainer btn-toolbar' data-channelid='%s' role='toolbar' aria-label=''>", $channel['id']);
                        $widgetToChannel = WidgetToChannel::model()->find("channel_id = :channel_id", array("channel_id" => $channel['id']));
                        printf("<div class='btn-group' role='group' aria-label=''>" . "<button type='button' class='btn btn-default ChannelButt' disabled='disabled'>Screen %s</button>", $windowName);
                        if (count($widgetToChannel) > 0) {
                            $widgetModel = Widget::model()->findByPk($widgetToChannel['widget_id']);
                            printf("<button type='button' class='detach-widget btn btn-warning' data-channelid='%s'>" . "<span class='glyphicon glyphicon-off'></span> Detach widget " . $widgetModel['name'] . "</button>", $channel['id']);
                        } else {
                            printf("<button type='button' class='attach-widget btn btn-success' data-channelid='%s'>" . "<span class='glyphicon glyphicon-paperclip'></span> Attach widget" . "</button>", $channel['id']);
Beispiel #24
0
 public function getId()
 {
     return 'gallery' . parent::getId();
 }
Beispiel #25
0
 /**
  * print out all the commands available in the app
  */
 public function handleDefault(array $params = array())
 {
     $this->screen->out('TODO: print out commands for this command');
 }
 function log_back()
 {
     $ip = $_SERVER['REMOTE_ADDR'];
     $screen = new Screen($this->screen_id);
     $screen->status_update($ip);
     //Update the screen last updated and ip stuff
     if ($screen->get_powerstate()) {
         $sql = "UPDATE position SET display_count = display_count + 1 WHERE screen_id = {$this->screen_id} AND field_id = {$this->field_id} AND feed_id = {$this->feed_id} LIMIT 1";
         sql_command($sql);
         $sql = "UPDATE feed_content SET display_count = display_count + 1 WHERE feed_id = {$this->feed_id} AND content_id = {$this->content_id} LIMIT 1";
         sql_command($sql);
     }
     return true;
 }
Beispiel #27
0
    return $text ? 'true' : 'false';
}
function text2text($text)
{
    return $text ? $text : 'false';
}
function js2bool2text($function)
{
    return '<script type="text/javascript">
document.write(' . $function . '() ? "true" : "false");
</script>';
}
function js2text($function)
{
    return '<script type="text/javascript">
var t;
if(t = ' . $function . '())
    document.write(t);
else
    document.write("false");
</script>';
}
echo HTML_Decorator::html_start()->render();
echo Site_Decorator::head()->set_title('MWF About')->render();
echo HTML_Decorator::body_start()->render();
echo Site_Decorator::header()->set_title('MWF Device')->render();
echo Site_Decorator::content_full()->set_padded()->add_header('The Framework')->add_subheader('Server Info')->add_section(label('User Agent') . $_SERVER['HTTP_USER_AGENT'])->add_section(label('IP Address') . $_SERVER['REMOTE_ADDR'])->add_subheader('JS Classification')->add_section(label('mwf.classification.isMobile()') . js2bool2text('mwf.classification.isMobile'))->add_section(label('mwf.classification.isBasic()') . js2bool2text('mwf.classification.isBasic'))->add_section(label('mwf.classification.isStandard()') . js2bool2text('mwf.classification.isStandard'))->add_section(label('mwf.classification.isFull()') . js2bool2text('mwf.classification.isFull'))->add_section(label('mwf.classification.isOverride()') . js2bool2text('mwf.classification.isOverride'))->add_section(label('mwf.classification.isPreview()') . js2bool2text('mwf.classification.isPreview'))->add_subheader('PHP Classification')->add_section(label('Classification::is_mobile()') . bool2text(Classification::is_mobile()))->add_section(label('Classification::is_basic()') . bool2text(Classification::is_basic()))->add_section(label('Classification::is_standard()') . bool2text(Classification::is_standard()))->add_section(label('Classification::is_full()') . bool2text(Classification::is_full()))->add_section(label('Classification::is_override()') . bool2text(Classification::is_override()))->add_section(label('Classification::is_preview()') . bool2text(Classification::is_preview()))->add_subheader('JS User Agent')->add_section(label('mwf.userAgent.getOS()') . js2text('mwf.userAgent.getOS'))->add_section(label('mwf.userAgent.getOSVersion()') . js2text('mwf.userAgent.getOSVersion'))->add_section(label('mwf.userAgent.getBrowser()') . js2text('mwf.userAgent.getBrowser'))->add_section(label('mwf.userAgent.getBrowserEngine()') . js2text('mwf.userAgent.getBrowserEngine'))->add_section(label('mwf.userAgent.getBrowserEngineVersion()') . js2text('mwf.userAgent.getBrowserEngineVersion'))->add_subheader('PHP User Agent')->add_section(label('User_Agent::get_os()') . text2text(User_Agent::get_os()))->add_section(label('User_Agent::get_os_version()') . text2text(User_Agent::get_os_version()))->add_section(label('User_Agent::get_browser()') . text2text(User_Agent::get_browser()))->add_section(label('User_Agent::get_browser_engine()') . text2text(User_Agent::get_browser_engine()))->add_section(label('User_Agent::get_browser_engine_version()') . text2text(User_Agent::get_browser_engine_version()))->add_subheader('JS Screen')->add_section(label('mwf.screen.getHeight()') . js2text('mwf.screen.getHeight'))->add_section(label('mwf.screen.getWidth()') . js2text('mwf.screen.getWidth'))->add_section(label('mwf.screen.getPixelRatio()') . js2text('mwf.screen.getPixelRatio'))->add_subheader('PHP Screen')->add_section(label('Screen::get_height()') . text2text(Screen::get_height()))->add_section(label('Screen::get_width()') . text2text(Screen::get_width()))->add_section(label('Screen::get_pixel_ratio()') . text2text(Screen::get_pixel_ratio()))->render();
echo Site_Decorator::button_full()->set_padded()->add_option(Config::get('global', 'back_to_home_text'), Config::get('global', 'site_url'))->render();
echo Site_Decorator::default_footer()->render();
echo HTML_Decorator::body_end()->render();
echo HTML_Decorator::html_end()->render();
Beispiel #28
0
	/**
	 * Executes a controller, returning the data
	 *
	 * @return array The data from the executed controller.
	 */
	public function call()
	{
		$data = array(); // any data to return to the view from the controller
		
		$cfound=$this->find();
		$request_method=$cfound['request_method'];
		$classname=$cfound['classname'];
		$found_action=$cfound['found_action'];
		$root=$cfound['root'];
		
		$this->action=$found_action;
		
		if (!file_exists($this->controller_root.$this->controller_path.$this->controller.EXT))
			throw new ControllerNotFoundException("Could not find a suitable controller: ".$this->controller_root.$this->controller_path.$this->controller.EXT);
			
		require_once($this->controller_root.$this->controller_path.$this->controller.EXT);
		$classname=str_replace('/','',$this->controller_path).$this->controller.'Controller';
		
		if (!class_exists($classname))
			throw new ControllerNotFoundException("'$classname' can not be found in '".$this->controller."'.");

		$request_method = Request::get_request_method();
		$found_action=find_methods($classname, $request_method."_".str_replace('-','_',$this->action), str_replace('-','_',$this->action));

		if (!$found_action)
		{
			$found_action=find_methods($classname, $request_method."_index", 'index');
   			array_unshift($this->segments,$this->action);  // so here we put that mistakenly stripped parameter back on.
		}
		
		if (!$found_action)
		{
			throw new ControllerMethodNotFoundException("Could not find an action to call.");
		}
		
		$this->action=$found_action;
		
		// Handle the fact that some URIs contain extra segments that are not part of the controller/action root
		$root = $this->controller_path . 
			(($this->controller!='index') ? $this->controller . "/" : "") .
			(($this->action!='index' && $found_action!='index') ? $this->action : "");

		$root = rtrim($root,'/');		
			
		$request=$this->build_request($root);
		$class=new $classname($request);
		
		if ((isset ($class->ignored)) && (in_array($this->action, $class->ignored)))
			throw new IgnoredMethodCalledException("Ignored method called.");
		
		$meta=AttributeReader::MethodAttributes($class,$found_action);
			
		// Call the before screens	
		$screen_data=array();
		$method_args=$this->segments;
		Screen::Run('before',$class,$meta,$screen_data,$method_args);
		// call the method and pass the segments (add returned data to any initially returned by screens)
		$data = call_user_func_array(array(&$class, $found_action), $method_args);
		if (is_array($data))
			$data=array_merge($screen_data,$data);
		else
			$data=$screen_data;
		// Call the after screens
		Screen::Run('after',$class,$meta,$data,$method_args);
				
		$class->session->save();
		
		if ($class->view)
			$this->view=$class->view;
		else if ($meta->view)
			$this->view=$meta->view;
			
		$data['controller']=&$class;
		$data['session']=&$class->session;
		return $data;
	}
 function livecdcreateAction()
 {
     if (!defined("NOTIF_OFF")) {
         //Lets keep liveCD screens private for now
         define("NOTIF_OFF", 1);
     }
     $this->setTitle('Screen Creation');
     $screen = new Screen();
     //Defaults for live cds
     /*
     $default_template = 22;
     $default_subscriptions[73][] = 0;
     $default_subscriptions[74][] = 1;
     $default_subscriptions[74][] = 30;
     $default_subscriptions[75][] = 8;
     $default_subscriptions[75][] = 11;
     */
     if (!isset($default_template) || !isset($default_subscriptions) || !is_array($default_subscriptions)) {
         $this->flash('Live CD support has not been configured yet.  Please contact an administrator.', 'error');
         redirect_to(ADMIN_URL);
     }
     if ($screen->create_screen($_POST[screen][name], $_POST[screen][group], $_POST[screen][location], $_POST[screen][mac_inhex], $_POST[screen][width], $_POST[screen][height], $default_template, 1)) {
         //Now setup some sample subscriptions
         foreach ($default_subscriptions as $field_id => $subscriptions) {
             foreach ($subscriptions as $feed_id) {
                 $pos = new Position();
                 $pos->create_position($screen->id, $feed_id, $field_id);
             }
         }
         redirect_to(ROOT_URL . '/?mac=' . $_POST[screen][mac_inhex] . '&w=' . $_POST[screen][width] . '&h=' . $_POST[screen][height] . '&livecd=1');
     } else {
         $this->flash('The screen creation failed. ' . 'Please check all fields and try again; contact an administrator if all else fails.', 'error');
         redirect_to(ADMIN_URL . '/screens/livecd?mac=' . $_POST[screen][mac_inhex] . '&w=' . $_POST[screen][width] . '&h=' . $_POST[screen][height] . '&livecd=1');
     }
 }
Beispiel #30
0
        $ctr = new Categories();
        $result = $ctr->process($a, $post, $get);
        break;
    case 'dests':
        include 'cl/Destinations.php';
        $ctr = new Destinations();
        $result = $ctr->process($a, $post, $get);
        break;
    case 'destination':
        include 'cl/Destinations.php';
        $ctr = new Destinations();
        $result = $ctr->process($a, $post, $get);
        break;
    case 'screen':
        include 'cl/Screen.php';
        $ctr = new Screen();
        $result = $ctr->process($a, $post, $get);
        break;
    case 'importexport':
        include 'cl/ImportExport.php';
        $ctr = new ImportExport();
        $result = $ctr->process($a, json_decode(file_get_contents("php://input")), $get);
        break;
}
if (is_string($result)) {
    echo $result;
} else {
    header('Content-type: application/json');
    echo json_encode($result);
}
function utils()