コード例 #1
0
 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');
     }
 }
コード例 #2
0
	function add_feed($feed_id_in){
		if($this->screen_set){
         if(is_array($this->screen_pos))
			foreach($this->screen_pos as $pos){
				if($pos->feed_id == $feed_id_in){
					return true; //The mapping already exists.  Someone cannot see that, maybe they are using an iphone and the screen is tiny. dumb iphone
				}
			}
			$new_pos = new Position();
			if($new_pos->create_position($this->screen_id, $feed_id_in, $this->id)){
				$this->screen_pos[] = $new_pos;
				$notify = new Notification();
				$notify->notify('screen', $this->screen_id, 'feed', $feed_id_in, 'subscribe');	
                                return true;
			} else {
				return false;
			}
		} else {
			return false; //No screen = no fun :-(
		}
	}