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]);
 }
 function listAction()
 {
     $group_str = implode(',', $_SESSION['user']->groups);
     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();
     }
 }
Beispiel #3
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 #4
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);
    }
}