Esempio n. 1
0
 /**
  * Display page grid
  */
 public function Grid()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $store = OAuthStore::instance();
     try {
         $list = $store->listConsumers($this->user->userid);
     } catch (OAuthException $e) {
         trigger_error($e->getMessage());
         trigger_error(__('Error listing Applications.'), E_USER_ERROR);
     }
     $rows = array();
     foreach ($list as $app) {
         $app['application_title'] = Kit::ValidateParam($app['application_title'], _STRING);
         $app['application_descr'] = Kit::ValidateParam($app['application_descr'], _STRING);
         $app['application_uri'] = Kit::ValidateParam($app['application_uri'], _URI);
         $app['consumer_key'] = Kit::ValidateParam($app['consumer_key'], _STRING);
         $app['consumer_secret'] = Kit::ValidateParam($app['consumer_secret'], _STRING);
         $rows[] = $app;
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('applications_page_grid');
     $response->SetGridResponse($output);
     $response->Respond();
 }
Esempio n. 2
0
 /**
  * Resolution Grid
  */
 function ResolutionGrid()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $SQL = "SELECT * FROM resolution ORDER BY resolution";
     if (!($results = $db->query($SQL))) {
         trigger_error($db->error());
         trigger_error('Unable to Query for resolutions.');
     }
     $rows = array();
     while ($row = $db->get_assoc_row($results)) {
         $resolutionID = Kit::ValidateParam($row['resolutionID'], _INT);
         $row['resolution'] = Kit::ValidateParam($row['resolution'], _STRING);
         $row['width'] = Kit::ValidateParam($row['width'], _INT);
         $row['height'] = Kit::ValidateParam($row['height'], _INT);
         $row['intended_width'] = Kit::ValidateParam($row['intended_width'], _INT);
         $row['intended_height'] = Kit::ValidateParam($row['intended_height'], _INT);
         // Edit Button
         $row['buttons'][] = array('id' => 'resolution_button_edit', 'url' => 'index.php?p=resolution&q=EditForm&resolutionid=' . $resolutionID, 'text' => __('Edit'));
         // Delete Button
         $row['buttons'][] = array('id' => 'resolution_button_delete', 'url' => 'index.php?p=resolution&q=DeleteForm&resolutionid=' . $resolutionID, 'text' => __('Delete'));
         // Add to the rows objects
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('resolution_page_grid');
     $response->SetGridResponse($output);
     $response->Respond();
 }
Esempio n. 3
0
 public function Grid()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $SQL = '';
     $SQL .= 'SELECT TransitionID, ';
     $SQL .= '   Transition, ';
     $SQL .= '   Code, ';
     $SQL .= '   HasDuration, ';
     $SQL .= '   HasDirection, ';
     $SQL .= '   AvailableAsIn, ';
     $SQL .= '   AvailableAsOut ';
     $SQL .= '  FROM `transition` ';
     $SQL .= ' ORDER BY Transition ';
     if (!($transitions = $db->GetArray($SQL))) {
         trigger_error($db->error());
         trigger_error(__('Unable to get the list of transitions'), E_USER_ERROR);
     }
     $cols = array(array('name' => 'name', 'title' => __('Name')), array('name' => 'hasduration', 'title' => __('Has Duration'), 'icons' => true), array('name' => 'hasdirection', 'title' => __('Has Direction'), 'icons' => true), array('name' => 'enabledforin', 'title' => __('Enabled for In'), 'icons' => true), array('name' => 'enabledforout', 'title' => __('Enabled for Out'), 'icons' => true));
     Theme::Set('table_cols', $cols);
     $rows = array();
     foreach ($transitions as $transition) {
         $row = array();
         $row['transitionid'] = Kit::ValidateParam($transition['TransitionID'], _INT);
         $row['name'] = Kit::ValidateParam($transition['Transition'], _STRING);
         $row['hasduration'] = Kit::ValidateParam($transition['HasDuration'], _INT);
         $row['hasdirection'] = Kit::ValidateParam($transition['HasDirection'], _INT);
         $row['enabledforin'] = Kit::ValidateParam($transition['AvailableAsIn'], _INT);
         $row['enabledforout'] = Kit::ValidateParam($transition['AvailableAsOut'], _INT);
         // Initialise array of buttons, because we might not have any
         $row['buttons'] = array();
         // If the module config is not locked, present some buttons
         if (Config::GetSetting('TRANSITION_CONFIG_LOCKED_CHECKB') != 'Checked') {
             // Edit button
             $row['buttons'][] = array('id' => 'transition_button_edit', 'url' => 'index.php?p=transition&q=EditForm&TransitionID=' . $row['transitionid'], 'text' => __('Edit'));
         }
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('table_render');
     $response->SetGridResponse($output);
     $response->Respond();
 }
Esempio n. 4
0
 function Grid()
 {
     $cols = array(array('name' => 'name', 'title' => __('Name')), array('name' => 'type', 'title' => __('Type')), array('name' => 'isdefault', 'title' => __('Default'), 'icons' => true));
     Theme::Set('table_cols', $cols);
     $rows = array();
     foreach ($this->user->DisplayProfileList() as $profile) {
         // Default Layout
         $profile['buttons'][] = array('id' => 'displayprofile_button_edit', 'url' => 'index.php?p=displayprofile&q=EditForm&displayprofileid=' . $profile['displayprofileid'], 'text' => __('Edit'));
         if ($profile['del'] == 1) {
             $profile['buttons'][] = array('id' => 'displayprofile_button_delete', 'url' => 'index.php?p=displayprofile&q=DeleteForm&displayprofileid=' . $profile['displayprofileid'], 'text' => __('Delete'));
         }
         $rows[] = $profile;
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('table_render');
     $response = new ResponseManager();
     $response->SetGridResponse($output);
     $response->Respond();
 }
Esempio n. 5
0
    public function Grid()
    {
        $db =& $this->db;
        $user =& $this->user;
        $response = new ResponseManager();
        //display the display table
        $SQL = <<<SQL
        SELECT HelpID, Topic, Category, Link
          FROM `help`
        ORDER BY Topic, Category
SQL;
        // Load results into an array
        $helplinks = $db->GetArray($SQL);
        if (!is_array($helplinks)) {
            trigger_error($db->error());
            trigger_error(__('Error getting list of helplinks'), E_USER_ERROR);
        }
        $cols = array(array('name' => 'topic', 'title' => __('Topic')), array('name' => 'category', 'title' => __('Category')), array('name' => 'link', 'title' => __('Link')));
        Theme::Set('table_cols', $cols);
        $rows = array();
        foreach ($helplinks as $row) {
            $row['helpid'] = Kit::ValidateParam($row['HelpID'], _INT);
            $row['topic'] = Kit::ValidateParam($row['Topic'], _STRING);
            $row['category'] = Kit::ValidateParam($row['Category'], _STRING);
            $row['link'] = Kit::ValidateParam($row['Link'], _STRING);
            $row['buttons'] = array();
            // we only want to show certain buttons, depending on the user logged in
            if ($user->usertypeid == 1) {
                // Edit
                $row['buttons'][] = array('id' => 'help_button_edit', 'url' => 'index.php?p=help&q=EditForm&HelpID=' . $row['helpid'], 'text' => __('Edit'));
                // Delete
                $row['buttons'][] = array('id' => 'help_button_delete', 'url' => 'index.php?p=help&q=DeleteForm&HelpID=' . $row['helpid'], 'text' => __('Delete'));
                // Test
                $row['buttons'][] = array('id' => 'help_button_test', 'url' => HelpManager::Link($row['topic'], $row['category']), 'text' => __('Test'));
            }
            $rows[] = $row;
        }
        Theme::Set('table_rows', $rows);
        $output = Theme::RenderReturn('table_render');
        $response->SetGridResponse($output);
        $response->Respond();
    }
Esempio n. 6
0
 /**
  * Resolution Grid
  */
 function ResolutionGrid()
 {
     $user =& $this->user;
     $response = new ResponseManager();
     setSession('resolution', 'ResolutionFilter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     // Show enabled
     $filterEnabled = Kit::GetParam('filterEnabled', _POST, _INT);
     setSession('resolution', 'filterEnabled', $filterEnabled);
     $rows = $user->ResolutionList(array('resolution'), array('enabled' => $filterEnabled));
     $resolutions = array();
     $cols = array(array('name' => 'resolutionid', 'title' => __('ID')), array('name' => 'resolution', 'title' => __('Resolution')), array('name' => 'intended_width', 'title' => __('Width')), array('name' => 'intended_height', 'title' => __('Height')), array('name' => 'width', 'title' => __('Designer Width')), array('name' => 'height', 'title' => __('Designer Height')), array('name' => 'version', 'title' => __('Version')), array('name' => 'enabled', 'title' => __('Enabled?'), 'icons' => true));
     Theme::Set('table_cols', $cols);
     foreach ($rows as $row) {
         // Edit Button
         $row['buttons'][] = array('id' => 'resolution_button_edit', 'url' => 'index.php?p=resolution&q=EditForm&resolutionid=' . $row['resolutionid'], 'text' => __('Edit'));
         // Delete Button
         $row['buttons'][] = array('id' => 'resolution_button_delete', 'url' => 'index.php?p=resolution&q=DeleteForm&resolutionid=' . $row['resolutionid'], 'text' => __('Delete'));
         // Add to the rows objects
         $resolutions[] = $row;
     }
     Theme::Set('table_rows', $resolutions);
     $response->SetGridResponse(Theme::RenderReturn('table_render'));
     $response->Respond();
 }
Esempio n. 7
0
 /**
  * Category Grid
  */
 function CategoryGrid()
 {
     $user =& $this->user;
     $response = new ResponseManager();
     setSession('category', 'CategoryFilter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     // Show enabled
     $filterEnabled = Kit::GetParam('filterEnabled', _POST, _INT);
     setSession('category', 'filterEnabled', $filterEnabled);
     $rows = $user->CategoryList(array('category'), array('enabled' => $filterEnabled));
     $categorys = array();
     $cols = array(array('name' => 'categoryid', 'title' => __('ID')), array('name' => 'category', 'title' => __('Category')));
     Theme::Set('table_cols', $cols);
     foreach ($rows as $row) {
         // Edit Button
         $row['buttons'][] = array('id' => 'category_button_edit', 'url' => 'index.php?p=category&q=EditForm&categoryid=' . $row['categoryid'], 'text' => __('Edit'));
         // Delete Button
         $row['buttons'][] = array('id' => 'category_button_delete', 'url' => 'index.php?p=category&q=DeleteForm&categoryid=' . $row['categoryid'], 'text' => __('Delete'));
         // Add to the rows objects
         $categorys[] = $row;
     }
     Theme::Set('table_rows', $categorys);
     $response->SetGridResponse(Theme::RenderReturn('table_render'));
     $response->Respond();
 }
Esempio n. 8
0
 public function TimelineGridView()
 {
     $user =& $this->user;
     $response = new ResponseManager();
     $layoutId = Kit::GetParam('layoutid', _POST, _INT);
     $regionId = Kit::GetParam('regionid', _POST, _STRING);
     // Make sure we have permission to edit this region
     Kit::ClassLoader('region');
     $region = new Region();
     $ownerId = $region->GetOwnerId($layoutId, $regionId);
     $regionAuth = $this->user->RegionAssignmentAuth($ownerId, $layoutId, $regionId, true);
     if (!$regionAuth->edit) {
         trigger_error(__('You do not have permissions to edit this region'), E_USER_ERROR);
     }
     // Load the XML for this layout and region, we need to get the media nodes.
     $region = new Region();
     $cols = array(array('name' => 'order', 'title' => __('Order')), array('name' => 'name', 'title' => __('Name')), array('name' => 'type', 'title' => __('Type')), array('name' => 'duration', 'title' => __('Duration')), array('name' => 'transition', 'title' => __('Transition')));
     Theme::Set('table_cols', $cols);
     $rows = array();
     $i = 0;
     foreach ($region->GetMediaNodeList($layoutId, $regionId) as $mediaNode) {
         // Construct an object containing all the layouts, and pass to the theme
         $row = array();
         // Put this node vertically in the region time line
         $mediaId = $mediaNode->getAttribute('id');
         $lkId = $mediaNode->getAttribute('lkid');
         $mediaType = $mediaNode->getAttribute('type');
         $mediaDuration = $mediaNode->getAttribute('duration');
         $ownerId = $mediaNode->getAttribute('userId');
         // Permissions for this assignment
         $auth = $user->MediaAssignmentAuth($ownerId, $layoutId, $regionId, $mediaId, true);
         // Skip over media assignments that we do not have permission to see
         if (!$auth->view) {
             continue;
         }
         $i++;
         // Create a media module to handle all the complex stuff
         $tmpModule = ModuleFactory::load($mediaType, $layoutId, $regionId, $mediaId, $lkId, $this->db, $this->user);
         $mediaName = $tmpModule->GetName();
         $row['order'] = $i;
         $row['name'] = $mediaName == '' ? __($tmpModule->displayType) : $mediaName;
         $row['type'] = __($tmpModule->displayType);
         $row['duration'] = sprintf('%d seconds', $mediaDuration);
         $row['transition'] = sprintf('%s / %s', $tmpModule->GetTransition('in'), $tmpModule->GetTransition('out'));
         if ($auth->edit) {
             $row['buttons'][] = array('id' => 'timeline_button_edit', 'url' => 'index.php?p=module&mod=' . $mediaType . '&q=Exec&method=EditForm&layoutid=' . $layoutId . '&regionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '"', 'text' => __('Edit'));
         }
         if ($auth->del) {
             $row['buttons'][] = array('id' => 'timeline_button_delete', 'url' => 'index.php?p=module&mod=' . $mediaType . '&q=Exec&method=DeleteForm&layoutid=' . $layoutId . '&regionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '"', 'text' => __('Remove'), 'multi-select' => true, 'dataAttributes' => array(array('name' => 'multiselectlink', 'value' => 'index.php?p=module&mod=' . $mediaType . '&q=Exec&method=DeleteMedia'), array('name' => 'rowtitle', 'value' => $row['name']), array('name' => 'layoutid', 'value' => $layoutId), array('name' => 'regionid', 'value' => $regionId), array('name' => 'mediaid', 'value' => $mediaId), array('name' => 'lkid', 'value' => $lkId), array('name' => 'options', 'value' => 'unassign')));
         }
         if ($auth->modifyPermissions) {
             $row['buttons'][] = array('id' => 'timeline_button_permissions', 'url' => 'index.php?p=module&mod=' . $mediaType . '&q=Exec&method=PermissionsForm&layoutid=' . $layoutId . '&regionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '"', 'text' => __('Permissions'));
         }
         if (count($this->user->TransitionAuth('in')) > 0) {
             $row['buttons'][] = array('id' => 'timeline_button_trans_in', 'url' => 'index.php?p=module&mod=' . $mediaType . '&q=Exec&method=TransitionEditForm&type=in&layoutid=' . $layoutId . '&regionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '"', 'text' => __('In Transition'));
         }
         if (count($this->user->TransitionAuth('out')) > 0) {
             $row['buttons'][] = array('id' => 'timeline_button_trans_in', 'url' => 'index.php?p=module&mod=' . $mediaType . '&q=Exec&method=TransitionEditForm&type=out&layoutid=' . $layoutId . '&regionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '"', 'text' => __('Out Transition'));
         }
         $rows[] = $row;
     }
     // Store the table rows
     Theme::Set('table_rows', $rows);
     Theme::Set('gridId', Kit::GetParam('gridId', _REQUEST, _STRING));
     // Initialise the theme and capture the output
     $output = Theme::RenderReturn('table_render');
     $response->SetGridResponse($output);
     $response->initialSortColumn = 1;
     $response->Respond();
 }
Esempio n. 9
0
 function Grid()
 {
     $db =& $this->db;
     $response = new ResponseManager();
     $type = Kit::GetParam('filter_type', _POST, _WORD);
     $fromDt = Kit::GetParam('filter_fromdt', _POST, _STRING);
     setSession('sessions', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     setSession('sessions', 'filter_type', $type);
     setSession('sessions', 'filter_fromdt', $fromDt);
     $SQL = "SELECT session.userID, user.UserName,  IsExpired, LastPage,  session.LastAccessed,  RemoteAddr,  UserAgent ";
     $SQL .= "FROM `session` LEFT OUTER JOIN user ON user.userID = session.userID ";
     $SQL .= "WHERE 1 = 1 ";
     if ($fromDt != '') {
         // From Date is the Calendar Formatted DateTime in ISO format
         $SQL .= sprintf(" AND session.LastAccessed < '%s' ", DateManager::getMidnightSystemDate(DateManager::getTimestampFromString($fromDt)));
     }
     if ($type == "active") {
         $SQL .= " AND IsExpired = 0 ";
     }
     if ($type == "expired") {
         $SQL .= " AND IsExpired = 1 ";
     }
     if ($type == "guest") {
         $SQL .= " AND session.userID IS NULL ";
     }
     // Load results into an array
     $log = $db->GetArray($SQL);
     Debug::LogEntry('audit', $SQL);
     if (!is_array($log)) {
         trigger_error($db->error());
         trigger_error(__('Error getting the log'), E_USER_ERROR);
     }
     $cols = array(array('name' => 'lastaccessed', 'title' => __('Last Accessed')), array('name' => 'isexpired', 'title' => __('Active'), 'icons' => true), array('name' => 'username', 'title' => __('User Name')), array('name' => 'lastpage', 'title' => __('Last Page')), array('name' => 'ip', 'title' => __('IP Address')), array('name' => 'browser', 'title' => __('Browser')));
     Theme::Set('table_cols', $cols);
     $rows = array();
     foreach ($log as $row) {
         $row['userid'] = Kit::ValidateParam($row['userID'], _INT);
         $row['username'] = Kit::ValidateParam($row['UserName'], _STRING);
         $row['isexpired'] = Kit::ValidateParam($row['IsExpired'], _INT) == 1 ? 0 : 1;
         $row['lastpage'] = Kit::ValidateParam($row['LastPage'], _STRING);
         $row['lastaccessed'] = DateManager::getLocalDate(strtotime(Kit::ValidateParam($row['LastAccessed'], _STRING)));
         $row['ip'] = Kit::ValidateParam($row['RemoteAddr'], _STRING);
         $row['browser'] = Kit::ValidateParam($row['UserAgent'], _STRING);
         // Edit
         $row['buttons'][] = array('id' => 'sessions_button_logout', 'url' => 'index.php?p=sessions&q=ConfirmLogout&userid=' . $row['userid'], 'text' => __('Logout'));
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     $response->SetGridResponse(Theme::RenderReturn('table_render'));
     $response->Respond();
 }
Esempio n. 10
0
 /**
  * Shows the stats grid
  */
 public function StatsGrid()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $fromDt = Kit::GetParam('fromdt', _POST, _STRING);
     $toDt = Kit::GetParam('todt', _POST, _STRING);
     $displayId = Kit::GetParam('displayid', _POST, _INT);
     $mediaId = Kit::GetParam('mediaid', _POST, _INT);
     // What if the fromdt and todt are exactly the same?
     // in this case assume an entire day from midnight on the fromdt to midnight on the todt (i.e. add a day to the todt)
     if ($fromDt == $toDt) {
         $toDt = date("Y-m-d", strtotime($toDt) + 86399);
     }
     Theme::Set('form_action', '');
     Theme::Set('form_meta', '<input type="hidden" name="p" value="stats"/><input type="hidden" name="q" value="OutputCSV"/><input type="hidden" name="displayid" value="' . $displayId . '" /><input type="hidden" name="fromdt" value="' . $fromDt . '" /><input type="hidden" name="todt" value="' . $toDt . '" />');
     // Get an array of display id this user has access to.
     $displays = $this->user->DisplayList();
     $display_ids = array();
     foreach ($displays as $display) {
         $display_ids[] = $display['displayid'];
     }
     if (count($display_ids) <= 0) {
         trigger_error(__('No displays with View permissions'), E_USER_ERROR);
     }
     // 3 grids showing different stats.
     // Layouts Ran
     $SQL = 'SELECT display.Display, layout.Layout, COUNT(StatID) AS NumberPlays, SUM(TIME_TO_SEC(TIMEDIFF(end, start))) AS Duration, MIN(start) AS MinStart, MAX(end) AS MaxEnd ';
     $SQL .= '  FROM stat ';
     $SQL .= '  INNER JOIN layout ON layout.LayoutID = stat.LayoutID ';
     $SQL .= '  INNER JOIN display ON stat.DisplayID = display.DisplayID ';
     $SQL .= " WHERE stat.type = 'layout' ";
     $SQL .= sprintf("  AND stat.end > '%s' ", $fromDt);
     $SQL .= sprintf("  AND stat.start <= '%s' ", $toDt);
     $SQL .= ' AND stat.displayID IN (' . implode(',', $display_ids) . ') ';
     if ($displayId != 0) {
         $SQL .= sprintf("  AND stat.displayID = %d ", $displayId);
     }
     $SQL .= 'GROUP BY display.Display, layout.Layout ';
     $SQL .= 'ORDER BY display.Display, layout.Layout';
     if (!($results = $this->db->query($SQL))) {
         trigger_error($db->error());
         trigger_error(__('Unable to get Layouts Shown'), E_USER_ERROR);
     }
     $rows = array();
     while ($row = $db->get_assoc_row($results)) {
         $row['Display'] = Kit::ValidateParam($row['Display'], _STRING);
         $row['Layout'] = Kit::ValidateParam($row['Layout'], _STRING);
         $row['NumberPlays'] = Kit::ValidateParam($row['NumberPlays'], _INT);
         $row['DurationSec'] = Kit::ValidateParam($row['Duration'], _INT);
         $row['Duration'] = sec2hms(Kit::ValidateParam($row['Duration'], _INT));
         $row['MinStart'] = Kit::ValidateParam($row['MinStart'], _STRING);
         $row['MaxEnd'] = Kit::ValidateParam($row['MaxEnd'], _STRING);
         $rows[] = $row;
     }
     Theme::Set('table_layouts_shown', $rows);
     // Media Ran
     $SQL = 'SELECT display.Display, media.Name, COUNT(StatID) AS NumberPlays, SUM(TIME_TO_SEC(TIMEDIFF(end, start))) AS Duration, MIN(start) AS MinStart, MAX(end) AS MaxEnd ';
     $SQL .= '  FROM stat ';
     $SQL .= '  INNER JOIN display ON stat.DisplayID = display.DisplayID ';
     $SQL .= '  INNER JOIN  media ON media.MediaID = stat.MediaID ';
     $SQL .= " WHERE stat.type = 'media' ";
     $SQL .= sprintf("  AND stat.end > '%s' ", $fromDt);
     $SQL .= sprintf("  AND stat.start <= '%s' ", $toDt);
     $SQL .= ' AND stat.displayID IN (' . implode(',', $display_ids) . ') ';
     if ($mediaId != 0) {
         $SQL .= sprintf("  AND media.MediaID = %d ", $mediaId);
     }
     if ($displayId != 0) {
         $SQL .= sprintf("  AND stat.displayID = %d ", $displayId);
     }
     $SQL .= 'GROUP BY display.Display, media.Name ';
     $SQL .= 'ORDER BY display.Display, media.Name';
     if (!($results = $this->db->query($SQL))) {
         trigger_error($db->error());
         trigger_error(__('Unable to get Library Media Ran'), E_USER_ERROR);
     }
     $rows = array();
     while ($row = $db->get_assoc_row($results)) {
         $row['Display'] = Kit::ValidateParam($row['Display'], _STRING);
         $row['Media'] = Kit::ValidateParam($row['Name'], _STRING);
         $row['NumberPlays'] = Kit::ValidateParam($row['NumberPlays'], _INT);
         $row['DurationSec'] = Kit::ValidateParam($row['Duration'], _INT);
         $row['Duration'] = sec2hms(Kit::ValidateParam($row['Duration'], _INT));
         $row['MinStart'] = Kit::ValidateParam($row['MinStart'], _STRING);
         $row['MaxEnd'] = Kit::ValidateParam($row['MaxEnd'], _STRING);
         $rows[] = $row;
     }
     Theme::Set('table_media_shown', $rows);
     // Media on Layouts Ran
     $SQL = "SELECT display.Display, layout.Layout, IFNULL(media.Name, 'Text/Rss/Webpage') AS Name, COUNT(StatID) AS NumberPlays, SUM(TIME_TO_SEC(TIMEDIFF(end, start))) AS Duration, MIN(start) AS MinStart, MAX(end) AS MaxEnd ";
     $SQL .= '  FROM stat ';
     $SQL .= '  INNER JOIN display ON stat.DisplayID = display.DisplayID ';
     $SQL .= '  INNER JOIN layout ON layout.LayoutID = stat.LayoutID ';
     $SQL .= '  LEFT OUTER JOIN media ON media.MediaID = stat.MediaID ';
     $SQL .= " WHERE stat.type = 'media' ";
     $SQL .= sprintf("  AND stat.end > '%s' ", $fromDt);
     $SQL .= sprintf("  AND stat.start <= '%s' ", $toDt);
     $SQL .= ' AND stat.displayID IN (' . implode(',', $display_ids) . ') ';
     if ($mediaId != 0) {
         $SQL .= sprintf("  AND media.MediaID = %d ", $mediaId);
     }
     if ($displayId != 0) {
         $SQL .= sprintf("  AND stat.displayID = %d ", $displayId);
     }
     $SQL .= "GROUP BY display.Display, layout.Layout, IFNULL(media.Name, 'Text/Rss/Webpage') ";
     $SQL .= "ORDER BY display.Display, layout.Layout, IFNULL(media.Name, 'Text/Rss/Webpage')";
     if (!($results = $this->db->query($SQL))) {
         trigger_error($db->error());
         trigger_error(__('Unable to get Library Media Ran'), E_USER_ERROR);
     }
     $rows = array();
     while ($row = $db->get_assoc_row($results)) {
         $row['Display'] = Kit::ValidateParam($row['Display'], _STRING);
         $row['Layout'] = Kit::ValidateParam($row['Layout'], _STRING);
         $row['Media'] = Kit::ValidateParam($row['Name'], _STRING);
         $row['NumberPlays'] = Kit::ValidateParam($row['NumberPlays'], _INT);
         $row['DurationSec'] = Kit::ValidateParam($row['Duration'], _INT);
         $row['Duration'] = sec2hms(Kit::ValidateParam($row['Duration'], _INT));
         $row['MinStart'] = Kit::ValidateParam($row['MinStart'], _STRING);
         $row['MaxEnd'] = Kit::ValidateParam($row['MaxEnd'], _STRING);
         $rows[] = $row;
     }
     Theme::Set('table_media_on_layouts_shown', $rows);
     $output = Theme::RenderReturn('stats_page_grid');
     $response->SetGridResponse($output);
     $response->Respond();
 }
Esempio n. 11
0
 /**
  * Data grid
  */
 function TemplateView()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $filter_name = Kit::GetParam('filter_name', _POST, _STRING);
     $filter_tags = Kit::GetParam('filter_tags', _POST, _STRING);
     $filter_is_system = Kit::GetParam('filter_is_system', _POST, _INT);
     setSession('template', 'filter_name', $filter_name);
     setSession('template', 'filter_tags', $filter_tags);
     setSession('template', 'filter_is_system', $filter_is_system);
     setSession('template', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     $templates = $user->TemplateList($filter_name, $filter_tags, $filter_is_system);
     if (!is_array($templates)) {
         trigger_error(__('Unable to get list of templates for this user'), E_USER_ERROR);
     }
     $rows = array();
     foreach ($templates as $template) {
         $template['permissions'] = $this->GroupsForTemplate($template['templateid']);
         $template['owner'] = $user->getNameFromID($template['ownerid']);
         $template['buttons'] = array();
         if ($template['del'] && $template['issystem'] == 'No') {
             // Delete Button
             $template['buttons'][] = array('id' => 'layout_button_delete', 'url' => 'index.php?p=template&q=DeleteTemplateForm&templateid=' . $template['templateid'], 'text' => __('Delete'));
         }
         if ($template['modifyPermissions'] && $template['issystem'] == 'No') {
             // Permissions Button
             $template['buttons'][] = array('id' => 'layout_button_delete', 'url' => 'index.php?p=template&q=PermissionsForm&templateid=' . $template['templateid'], 'text' => __('Permissions'));
         }
         // Add this row to the array
         $rows[] = $template;
     }
     Theme::Set('table_rows', $rows);
     $response->SetGridResponse(Theme::RenderReturn('template_page_grid'));
     $response->Respond();
 }
Esempio n. 12
0
 /**
  * A grid of modules
  */
 public function Grid()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $SQL = '';
     $SQL .= 'SELECT ModuleID, ';
     $SQL .= '   Name, ';
     $SQL .= '   Enabled, ';
     $SQL .= '   Description, ';
     $SQL .= '   RegionSpecific, ';
     $SQL .= '   ValidExtensions, ';
     $SQL .= '   ImageUri, ';
     $SQL .= '   PreviewEnabled, ';
     $SQL .= '   assignable, ';
     $SQL .= '   settings ';
     $SQL .= '  FROM `module` ';
     $SQL .= ' ORDER BY Name ';
     if (!($modules = $db->GetArray($SQL))) {
         trigger_error($db->error());
         trigger_error(__('Unable to get the list of modules'), E_USER_ERROR);
     }
     $cols = array(array('name' => 'name', 'title' => __('Name')), array('name' => 'description', 'title' => __('Description')), array('name' => 'isregionspecific', 'title' => __('Library Media'), 'icons' => true), array('name' => 'validextensions', 'title' => __('Valid Extensions')), array('name' => 'imageuri', 'title' => __('Image Uri')), array('name' => 'preview_enabled', 'title' => __('Preview Enabled'), 'icons' => true), array('name' => 'assignable', 'title' => __('Assignable'), 'icons' => true, 'helpText' => __('Can this module be assigned to a Layout?')), array('name' => 'enabled', 'title' => __('Enabled'), 'icons' => true));
     Theme::Set('table_cols', $cols);
     $rows = array();
     foreach ($modules as $module) {
         $row = array();
         $row['moduleid'] = Kit::ValidateParam($module['ModuleID'], _INT);
         $row['name'] = Kit::ValidateParam($module['Name'], _STRING);
         $row['description'] = Kit::ValidateParam($module['Description'], _STRING);
         $row['isregionspecific'] = Kit::ValidateParam($module['RegionSpecific'], _INT) == 0 ? 1 : 0;
         $row['validextensions'] = Kit::ValidateParam($module['ValidExtensions'], _STRING);
         $row['imageuri'] = Kit::ValidateParam($module['ImageUri'], _STRING);
         $row['enabled'] = Kit::ValidateParam($module['Enabled'], _INT);
         $row['preview_enabled'] = Kit::ValidateParam($module['PreviewEnabled'], _INT);
         $row['assignable'] = Kit::ValidateParam($module['assignable'], _INT);
         $row['settings'] = json_decode(Kit::ValidateParam($module['settings'], _HTMLSTRING), true);
         // Initialise array of buttons, because we might not have any
         $row['buttons'] = array();
         // If the module config is not locked, present some buttons
         if (Config::GetSetting('MODULE_CONFIG_LOCKED_CHECKB') != 'Checked') {
             // Edit button
             $row['buttons'][] = array('id' => 'module_button_edit', 'url' => 'index.php?p=module&q=EditForm&ModuleID=' . $row['moduleid'], 'text' => __('Edit'));
         }
         // Are there any buttons we need to provide as part of the module?
         if (isset($row['settings']['buttons'])) {
             foreach ($row['settings']['buttons'] as $button) {
                 $button['text'] = __($button['text']);
                 $row['buttons'][] = $button;
             }
         }
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('table_render');
     $response->SetGridResponse($output);
     $response->Respond();
 }
Esempio n. 13
0
 public function FileAssociationsView()
 {
     $user =& $this->user;
     //Input vars
     $mediatype = Kit::GetParam('filter_type', _POST, _STRING);
     $name = Kit::GetParam('filter_name', _POST, _STRING);
     $displaygroupid = Kit::GetParam('displaygroupid', _POST, _INT);
     // Get the currently associated media items and put them in the top bar
     $existing = array();
     try {
         $dbh = PDOConnect::init();
         $sth = $dbh->prepare('
             SELECT mediaid
               FROM `lkmediadisplaygroup` 
              WHERE displaygroupid = :displaygroupid
         ');
         $sth->execute(array('displaygroupid' => $displaygroupid));
         while ($existing[] = $sth->fetchColumn()) {
         }
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage(), get_class(), __FUNCTION__);
         trigger_error(__('Unable to get existing assignments.'), E_USER_ERROR);
     }
     // Get a list of media
     $mediaList = $user->MediaList($mediatype, $name);
     $rows = array();
     // Add some extra information
     foreach ($mediaList as $row) {
         if (in_array($row['mediaid'], $existing)) {
             continue;
         }
         $row['list_id'] = 'MediaID_' . $row['mediaid'];
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     // Render the Theme
     $response = new ResponseManager();
     $response->SetGridResponse(Theme::RenderReturn('displaygroup_fileassociations_form_assign_list'));
     $response->callBack = 'FileAssociationsCallback';
     $response->pageSize = 5;
     $response->Respond();
 }
Esempio n. 14
0
 /**
  * Grid of Displays
  * @return
  */
 function DisplayGrid()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $displays = $user->DisplayList();
     if (!is_array($displays)) {
         trigger_error($db->error());
         trigger_error(__('Unable to get list of displays'), E_USER_ERROR);
     }
     // Do we want to make a VNC link out of the display name?
     $vncTemplate = Config::GetSetting('SHOW_DISPLAY_AS_VNCLINK');
     $linkTarget = Kit::ValidateParam(Config::GetSetting('SHOW_DISPLAY_AS_VNC_TGT'), _STRING);
     $rows = array();
     foreach ($displays as $row) {
         // VNC Template as display name?
         if ($vncTemplate != '' && $row['clientaddress'] != '') {
             if ($linkTarget == '') {
                 $linkTarget = '_top';
             }
             $row['display'] = sprintf('<a href="' . $vncTemplate . '" title="VNC to ' . $row['display'] . '" target="' . $linkTarget . '">' . Theme::Prepare($row['display']) . '</a>', $row['clientaddress']);
         }
         // Format last accessed
         $row['lastaccessed'] = date("Y-m-d H:i:s", $row['lastaccessed']);
         // Create some login lights
         $row['licensed'] = $row['licensed'] == 1 ? 'icon-ok' : 'icon-remove';
         $row['inc_schedule'] = $row['inc_schedule'] == 1 ? 'icon-ok' : 'icon-remove';
         $row['email_alert'] = $row['email_alert'] == 1 ? 'icon-ok' : 'icon-remove';
         $row['loggedin'] = $row['loggedin'] == 1 ? 'icon-ok' : 'icon-remove';
         $row['mediainventorystatus'] = $row['mediainventorystatus'] == 1 ? 'success' : ($row['mediainventorystatus'] == 2 ? 'error' : 'warning');
         // Schedule Now
         $row['buttons'][] = array('id' => 'display_button_schedulenow', 'url' => 'index.php?p=schedule&q=ScheduleNowForm&displayGroupId=' . $row['displaygroupid'], 'text' => __('Schedule Now'));
         // Media Inventory
         $row['buttons'][] = array('id' => 'display_button_mediainventory', 'url' => 'index.php?p=display&q=MediaInventory&DisplayId=' . $row['displayid'], 'text' => __('Media Inventory'));
         if ($row['edit'] == 1) {
             // Default Layout
             $row['buttons'][] = array('id' => 'display_button_defaultlayout', 'url' => 'index.php?p=display&q=DefaultLayoutForm&DisplayId=' . $row['displayid'], 'text' => __('Default Layout'));
             // Edit
             $row['buttons'][] = array('id' => 'display_button_edit', 'url' => 'index.php?p=display&q=displayForm&displayid=' . $row['displayid'], 'text' => __('Edit'));
             // Wake On LAN
             $row['buttons'][] = array('id' => 'display_button_wol', 'url' => 'index.php?p=display&q=WakeOnLanForm&DisplayId=' . $row['displayid'], 'text' => __('Wake on LAN'));
             // File Associations
             $row['buttons'][] = array('id' => 'displaygroup_button_fileassociations', 'url' => 'index.php?p=displaygroup&q=FileAssociations&DisplayGroupID=' . $row['displaygroupid'], 'text' => __('Assign Files'));
         }
         if ($row['del'] == 1) {
             // Delete
             $row['buttons'][] = array('id' => 'display_button_delete', 'url' => 'index.php?p=display&q=DeleteForm&displayid=' . $row['displayid'], 'text' => __('Delete'));
         }
         if ($row['modifypermissions'] == 1) {
             // Display Groups
             $row['buttons'][] = array('id' => 'display_button_group_membership', 'url' => 'index.php?p=display&q=MemberOfForm&DisplayID=' . $row['displayid'], 'text' => __('Display Groups'));
             // Permissions
             $row['buttons'][] = array('id' => 'display_button_group_membership', 'url' => 'index.php?p=displaygroup&q=PermissionsForm&DisplayGroupID=' . $row['displaygroupid'], 'text' => __('Permissions'));
             // Version Information
             $row['buttons'][] = array('id' => 'display_button_version_instructions', 'url' => 'index.php?p=displaygroup&q=VersionInstructionsForm&displaygroupid=' . $row['displaygroupid'] . '&displayid=' . $row['displayid'], 'text' => __('Version Information'));
         }
         // Assign this to the table row
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('display_page_grid');
     $response->SetGridResponse($output);
     $response->Respond();
 }
Esempio n. 15
0
 public function BandwidthGrid()
 {
     $fromDt = DateManager::getTimestampFromString(Kit::GetParam('fromdt', _POST, _STRING));
     $toDt = DateManager::getTimestampFromString(Kit::GetParam('todt', _POST, _STRING));
     // Get an array of display id this user has access to.
     $displays = $this->user->DisplayList();
     $displayIds = array();
     foreach ($displays as $display) {
         $displayIds[] = $display['displayid'];
     }
     if (count($displayIds) <= 0) {
         trigger_error(__('No displays with View permissions'), E_USER_ERROR);
     }
     // Get some data for a bandwidth chart
     try {
         $dbh = PDOConnect::init();
         $displayId = Kit::GetParam('displayid', _POST, _INT);
         $params = array('month' => $fromDt, 'month2' => $toDt);
         $SQL = 'SELECT display.display, IFNULL(SUM(Size), 0) AS size ';
         if ($displayId != 0) {
             $SQL .= ', bandwidthtype.name AS type ';
         }
         $SQL .= ' FROM `bandwidth`
                 INNER JOIN `display`
                 ON display.displayid = bandwidth.displayid';
         if ($displayId != 0) {
             $SQL .= '
                     INNER JOIN bandwidthtype
                     ON bandwidthtype.bandwidthtypeid = bandwidth.type
                 ';
         }
         $SQL .= '  WHERE month > :month 
                 AND month < :month2
                 AND display.displayId IN (' . implode(',', $displayIds) . ') ';
         if ($displayId != 0) {
             $SQL .= ' AND display.displayid = :displayid ';
             $params['displayid'] = $displayId;
         }
         $SQL .= 'GROUP BY display.display ';
         if ($displayId != 0) {
             $SQL .= ' , bandwidthtype.name ';
         }
         $SQL .= 'ORDER BY display.display';
         //Debug::LogEntry('audit', $SQL . '. Params = ' . var_export($params, true), get_class(), __FUNCTION__);
         $sth = $dbh->prepare($SQL);
         $sth->execute($params);
         // Get the results
         $results = $sth->fetchAll();
         $maxSize = 0;
         foreach ($results as $library) {
             $maxSize = $library['size'] > $maxSize ? $library['size'] : $maxSize;
         }
         // Decide what our units are going to be, based on the size
         $base = floor(log($maxSize) / log(1024));
         $output = array();
         foreach ($results as $row) {
             // label depends whether we are filtered by display
             if ($displayId != 0) {
                 $label = $row['type'];
             } else {
                 $label = $row['display'];
             }
             $output[] = array('label' => $label, 'value' => round((double) $row['size'] / pow(1024, $base), 2));
         }
         // Set the data
         Theme::Set('bandwidthWidget', json_encode($output));
         // Set up some suffixes
         $suffixes = array('bytes', 'k', 'M', 'G', 'T');
         Theme::Set('bandwidthWidgetUnits', isset($suffixes[$base]) ? $suffixes[$base] : '');
         $output = Theme::RenderReturn('stats_page_bandwidth');
         $response = new ResponseManager();
         $response->SetGridResponse($output);
         $response->Respond();
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         // Show the error in place of the bandwidth chart
         Theme::Set('widget-error', 'Unable to get widget details');
     }
 }
Esempio n. 16
0
 function LastHundredForDisplay()
 {
     $response = new ResponseManager();
     $displayId = Kit::GetParam('displayid', _GET, _INT);
     try {
         $dbh = PDOConnect::init();
         $sth = $dbh->prepare('SELECT logid, logdate, page, function, message FROM log WHERE displayid = :displayid ORDER BY logid DESC LIMIT 100');
         $sth->execute(array('displayid' => $displayId));
         $log = $sth->fetchAll();
         if (count($log) <= 0) {
             throw new Exception(__('No log messages for this display'));
         }
         $cols = array(array('name' => 'logid', 'title' => __('ID')), array('name' => 'logdate', 'title' => __('Date')), array('name' => 'page', 'title' => __('Page')), array('name' => 'function', 'title' => __('Function')), array('name' => 'message', 'title' => __('Message')));
         Theme::Set('table_cols', $cols);
         $rows = array();
         foreach ($log as $row) {
             $row['logid'] = Kit::ValidateParam($row['logid'], _INT);
             $row['logdate'] = Kit::ValidateParam($row['logdate'], _STRING);
             $row['page'] = Kit::ValidateParam($row['page'], _STRING);
             $row['function'] = Kit::ValidateParam($row['function'], _STRING);
             $row['message'] = nl2br(htmlspecialchars($row['message']));
             $rows[] = $row;
         }
         Theme::Set('table_rows', $rows);
         $output = Theme::RenderReturn('table_render');
         $response->initialSortOrder = 2;
         $response->dialogClass = 'modal-big';
         $response->dialogTitle = __('Recent Log Messages');
         $response->pageSize = 10;
         $response->SetGridResponse($output);
         $response->Respond();
     } catch (Exception $e) {
         trigger_error($e->getMessage(), E_USER_ERROR);
     }
 }
Esempio n. 17
0
    /**
     * Assign Menu Item Security Grid
     * @return 
     */
    function MenuItemSecurityGrid()
    {
        $db =& $this->db;
        $groupid = Kit::GetParam('groupid', _POST, _INT);
        $filter_menu = Kit::GetParam('filter_menu', _POST, _STRING);
        Theme::Set('form_id', 'UserGroupMenuForm');
        Theme::Set('form_meta', '<input type="hidden" name="groupid" value="' . $groupid . '">');
        Theme::Set('form_action', 'index.php?p=group&q=MenuItemSecurityAssign');
        $SQL = <<<END
\t\tSELECT \tmenu.Menu,
\t\t\t\tmenuitem.Text,
\t\t\t\tmenuitem.MenuItemID,
\t\t\t\tCASE WHEN menuitems_assigned.MenuItemID IS NULL 
\t\t\t\t\tTHEN 0
\t\t        \tELSE 1
\t\t        END AS AssignedID
\t\tFROM\tmenuitem
\t\tINNER JOIN menu
\t\tON\t\tmenu.MenuID = menuitem.MenuID
\t\tLEFT OUTER JOIN 
\t\t\t\t(SELECT DISTINCT lkmenuitemgroup.MenuItemID
\t\t\t\t FROM\tlkmenuitemgroup
\t\t\t\t WHERE  GroupID = {$groupid}
\t\t\t\t) menuitems_assigned
\t\tON menuitem.MenuItemID = menuitems_assigned.MenuItemID
\t\tWHERE menuitem.MenuID = %d
END;
        $SQL = sprintf($SQL, $filter_menu);
        if (!($results = $db->query($SQL))) {
            trigger_error($db->error());
            trigger_error(__('Cannot get the menu items for this Group.'), E_USER_ERROR);
        }
        if ($db->num_rows($results) == 0) {
            trigger_error(__('Cannot get the menu items for this Group.'), E_USER_ERROR);
        }
        // while loop
        $rows = array();
        while ($row = $db->get_assoc_row($results)) {
            $row['name'] = $row['Text'];
            $row['pageid'] = $row['MenuItemID'];
            $row['assigned'] = $row['AssignedID'] == 1 ? 'icon-ok' : 'icon-remove';
            $row['assignedid'] = $row['AssignedID'];
            $row['checkbox_value'] = $row['AssignedID'] . ',' . $row['MenuItemID'];
            $row['checkbox_ticked'] = '';
            $rows[] = $row;
        }
        Theme::Set('table_rows', $rows);
        $output = Theme::RenderReturn('usergroup_form_menusecurity_grid');
        $response = new ResponseManager();
        $response->SetGridResponse($output);
        $response->initialSortColumn = 2;
        $response->Respond();
    }
Esempio n. 18
0
 /**
  * Show the library
  * @return 
  */
 function LibraryAssignView()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     //Input vars
     $mediatype = Kit::GetParam('filter_type', _POST, _STRING);
     $name = Kit::GetParam('filter_name', _POST, _STRING);
     // Get a list of media
     $mediaList = $user->MediaList(NULL, array('type' => $mediatype, 'name' => $name));
     $rows = array();
     // Add some extra information
     foreach ($mediaList as $row) {
         $row['duration_text'] = sec2hms($row['duration']);
         $row['list_id'] = 'MediaID_' . $row['mediaid'];
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     // Render the Theme
     $response->SetGridResponse(Theme::RenderReturn('library_form_assign_list'));
     $response->callBack = 'LibraryAssignCallback';
     $response->pageSize = 5;
     $response->Respond();
 }
Esempio n. 19
0
 /**
  * Data grid
  */
 function TemplateView()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $filter_name = Kit::GetParam('filter_name', _POST, _STRING);
     $filter_tags = Kit::GetParam('filter_tags', _POST, _STRING);
     setSession('template', 'filter_name', $filter_name);
     setSession('template', 'filter_tags', $filter_tags);
     setSession('template', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     // Show filter_showThumbnail
     $showThumbnail = Kit::GetParam('showThumbnail', _POST, _CHECKBOX);
     setSession('layout', 'showThumbnail', $showThumbnail);
     $templates = $user->TemplateList(null, array('layout' => $filter_name, 'tags' => $filter_tags));
     if (!is_array($templates)) {
         trigger_error(__('Unable to get list of templates for this user'), E_USER_ERROR);
     }
     $cols = array(array('name' => 'layout', 'title' => __('Name')), array('name' => 'owner', 'title' => __('Owner')), array('name' => 'descriptionWithMarkup', 'title' => __('Description')), array('name' => 'thumbnail', 'title' => __('Thumbnail'), 'hidden' => $showThumbnail == 0), array('name' => 'permissions', 'title' => __('Permissions')));
     Theme::Set('table_cols', $cols);
     $rows = array();
     foreach ($templates as $template) {
         $template['permissions'] = $this->GroupsForTemplate($template['campaignid']);
         $template['owner'] = $user->getNameFromID($template['ownerid']);
         $template['thumbnail'] = '';
         if ($showThumbnail == 1 && $template['backgroundImageId'] != 0) {
             $template['thumbnail'] = '<a class="img-replace" data-toggle="lightbox" data-type="image" data-img-src="index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid=' . $template['backgroundImageId'] . '&width=100&height=100&dynamic=true&thumb=true" href="index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid=' . $template['backgroundImageId'] . '"><i class="fa fa-file-image-o"></i></a>';
         }
         $template['buttons'] = array();
         // Parse down for description
         $template['descriptionWithMarkup'] = Parsedown::instance()->text($template['description']);
         if ($template['edit']) {
             // Edit Button
             $template['buttons'][] = array('id' => 'template_button_edit', 'url' => 'index.php?p=template&q=EditForm&modify=true&layoutid=' . $template['layoutid'], 'text' => __('Edit'));
         }
         if ($template['del']) {
             // Delete Button
             $template['buttons'][] = array('id' => 'layout_button_delete', 'url' => 'index.php?p=template&q=DeleteTemplateForm&layoutid=' . $template['layoutid'], 'text' => __('Delete'));
         }
         if ($template['modifyPermissions']) {
             // Permissions Button
             $template['buttons'][] = array('id' => 'layout_button_delete', 'url' => 'index.php?p=campaign&q=PermissionsForm&CampaignID=' . $template['campaignid'], 'text' => __('Permissions'));
         }
         $template['buttons'][] = array('linkType' => 'divider');
         // Export Button
         $template['buttons'][] = array('id' => 'layout_button_export', 'linkType' => '_self', 'url' => 'index.php?p=layout&q=Export&layoutid=' . $template['layoutid'], 'text' => __('Export'));
         // Add this row to the array
         $rows[] = $template;
     }
     Theme::Set('table_rows', $rows);
     $response->SetGridResponse(Theme::RenderReturn('table_render'));
     $response->Respond();
 }
Esempio n. 20
0
    public function DataSetDataForm()
    {
        $db =& $this->db;
        $response = new ResponseManager();
        $dataSetId = Kit::GetParam('datasetid', _POST, _INT);
        $dataSet = Kit::GetParam('dataset', _POST, _STRING);
        $auth = $this->user->DataSetAuth($dataSetId, true);
        if (!$auth->edit) {
            trigger_error(__('Access Denied'), E_USER_ERROR);
        }
        // Get the max number of rows
        $SQL = "";
        $SQL .= "SELECT MAX(RowNumber) AS RowNumber, COUNT(DISTINCT datasetcolumn.DataSetColumnID) AS ColNumber ";
        $SQL .= "  FROM datasetdata ";
        $SQL .= "   RIGHT OUTER JOIN datasetcolumn ";
        $SQL .= "   ON datasetcolumn.DataSetColumnID = datasetdata.DataSetColumnID ";
        $SQL .= sprintf("WHERE datasetcolumn.DataSetID = %d  AND datasetcolumn.DataSetColumnTypeID = 1 ", $dataSetId);
        Debug::LogEntry('audit', $SQL, 'dataset', 'DataSetDataForm');
        if (!($maxResult = $db->GetSingleRow($SQL))) {
            trigger_error($db->error());
            trigger_error(__('Unable to find the number of data points'), E_USER_ERROR);
        }
        $maxRows = $maxResult['RowNumber'];
        $maxCols = $maxResult['ColNumber'];
        // Get some information about the columns in this dataset
        $SQL = "SELECT Heading, DataSetColumnID, ListContent, ColumnOrder, DataTypeID FROM datasetcolumn WHERE DataSetID = %d  AND DataSetColumnTypeID = 1 ";
        $SQL .= "ORDER BY ColumnOrder ";
        if (!($results = $db->query(sprintf($SQL, $dataSetId)))) {
            trigger_error($db->error());
            trigger_error(__('Unable to find the column headings'), E_USER_ERROR);
        }
        $columnDefinition = array();
        $form = '<table class="table table-bordered">';
        $form .= '   <tr>';
        $form .= '      <th>#</th>';
        while ($row = $db->get_assoc_row($results)) {
            $columnDefinition[] = $row;
            $heading = $row['Heading'];
            $form .= ' <th>' . $heading . '</th>';
        }
        $form .= '</tr>';
        // Loop through the max rows
        for ($row = 1; $row <= $maxRows + 2; $row++) {
            $form .= '<tr>';
            $form .= '  <td>' . $row . '</td>';
            // $row is the current row
            for ($col = 0; $col < $maxCols; $col++) {
                $dataSetColumnId = $columnDefinition[$col]['DataSetColumnID'];
                $listContent = $columnDefinition[$col]['ListContent'];
                $columnOrder = $columnDefinition[$col]['ColumnOrder'];
                $dataTypeId = $columnDefinition[$col]['DataTypeID'];
                // Value for this Col/Row
                $value = '';
                if ($row <= $maxRows) {
                    // This is intended to be a blank row
                    $SQL = "";
                    $SQL .= "SELECT Value ";
                    $SQL .= "  FROM datasetdata ";
                    $SQL .= "WHERE datasetdata.RowNumber = %d ";
                    $SQL .= "   AND datasetdata.DataSetColumnID = %d ";
                    $SQL = sprintf($SQL, $row, $dataSetColumnId);
                    Debug::LogEntry('audit', $SQL, 'dataset');
                    if (!($results = $db->query($SQL))) {
                        trigger_error($db->error());
                        trigger_error(__('Can not get the data row/column'), E_USER_ERROR);
                    }
                    if ($db->num_rows($results) == 0) {
                        $value = '';
                    } else {
                        $valueRow = $db->get_assoc_row($results);
                        $value = $valueRow['Value'];
                    }
                }
                // Do we need a select list?
                if ($listContent != '') {
                    $listItems = explode(',', $listContent);
                    $selected = $value == '' ? ' selected' : '';
                    $select = '<select name="value">';
                    $select .= '     <option value="" ' . $selected . '></option>';
                    for ($i = 0; $i < count($listItems); $i++) {
                        $selected = $listItems[$i] == $value ? ' selected' : '';
                        $select .= '<option value="' . $listItems[$i] . '" ' . $selected . '>' . $listItems[$i] . '</option>';
                    }
                    $select .= '</select>';
                } else {
                    // Numbers are always small
                    $size = $dataTypeId == 2 ? ' class="input-mini"' : '';
                    if ($dataTypeId == 1) {
                        // Strings should be based on something - not sure what.
                    }
                    $select = '<input type="text" class="' . $size . '" name="value" value="' . $value . '">';
                }
                $action = $value == '' ? 'AddDataSetData' : 'EditDataSetData';
                $fieldId = uniqid();
                $form .= <<<END
                <td>
                    <form id="{$fieldId}" class="XiboDataSetDataForm form-inline" action="index.php?p=dataset&q={$action}">
                        <input type="hidden" name="fieldid" value="{$fieldId}">
                        <input type="hidden" name="datasetid" value="{$dataSetId}">
                        <input type="hidden" name="datasetcolumnid" value="{$dataSetColumnId}">
                        <input type="hidden" name="rownumber" value="{$row}">
                        {$select}
                    </form>
                </td>
END;
            }
            //cols loop
            $form .= '</tr>';
        }
        //rows loop
        $form .= '</table>';
        $response->SetGridResponse($form);
        $response->callBack = 'dataSetData';
        $response->Respond();
    }
Esempio n. 21
0
 public function MediaManagerGrid()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $filterLayout = Kit::GetParam('filter_layout_name', _POST, _STRING);
     $filterRegion = Kit::GetParam('filter_region_name', _POST, _STRING);
     $filterMediaName = Kit::GetParam('filter_media_name', _POST, _STRING);
     $filterMediaType = Kit::GetParam('filter_type', _POST, _INT);
     setSession('mediamanager', 'filter_layout_name', $filterLayout);
     setSession('mediamanager', 'filter_region_name', $filterRegion);
     setSession('mediamanager', 'filter_media_name', $filterMediaName);
     setSession('mediamanager', 'filter_type', $filterMediaType);
     setSession('mediamanager', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     // Lookup the module name
     if ($filterMediaType != 0) {
         $module = $this->user->ModuleList(NULL, array('id' => $filterMediaType));
         if (count($module) > 0) {
             $filterMediaType = $module[0]['Name'];
             Debug::LogEntry('audit', 'Matched module type ' . $filterMediaType, get_class(), __FUNCTION__);
         }
     }
     $cols = array(array('name' => 'layout', 'title' => __('Layout'), 'colClass' => 'group-word'), array('name' => 'region', 'title' => __('Region')), array('name' => 'media', 'title' => __('Media')), array('name' => 'mediatype', 'title' => __('Type')), array('name' => 'seq', 'title' => __('Sequence')));
     Theme::Set('table_cols', $cols);
     // We would like a list of all layouts, media and media assignments that this user
     // has access to.
     $layouts = $user->LayoutList(NULL, array('layout' => $filterLayout));
     $rows = array();
     foreach ($layouts as $layout) {
         // We have edit permissions?
         if (!$layout['edit']) {
             continue;
         }
         // Every layout this user has access to.. get the regions
         $layoutXml = new DOMDocument();
         $layoutXml->loadXML($layout['xml']);
         // Get ever region
         $regionNodeList = $layoutXml->getElementsByTagName('region');
         $regionNodeSequence = 0;
         //get the regions
         foreach ($regionNodeList as $region) {
             $regionId = $region->getAttribute('id');
             $ownerId = $region->getAttribute('userId') == '' ? $layout['ownerid'] : $region->getAttribute('userId');
             $regionAuth = $user->RegionAssignmentAuth($ownerId, $layout['layoutid'], $regionId, true);
             // Do we have permission to edit?
             if (!$regionAuth->edit) {
                 continue;
             }
             $regionNodeSequence++;
             $regionName = $region->getAttribute('name') == '' ? 'Region ' . $regionNodeSequence : $region->getAttribute('name');
             if ($filterRegion != '' && !stristr($regionName, $filterRegion)) {
                 continue;
             }
             // Media
             $xpath = new DOMXPath($layoutXml);
             $mediaNodes = $xpath->query("//region[@id='{$regionId}']/media");
             $mediaNodeSequence = 0;
             foreach ($mediaNodes as $mediaNode) {
                 $mediaId = $mediaNode->getAttribute('id');
                 $lkId = $mediaNode->getAttribute('lkid');
                 $mediaOwnerId = $mediaNode->getAttribute('userId') == '' ? $layout['ownerid'] : $mediaNode->getAttribute('userId');
                 $mediaType = $mediaNode->getAttribute('type');
                 // Permissions
                 $auth = $user->MediaAssignmentAuth($mediaOwnerId, $layout['layoutid'], $regionId, $mediaId, true);
                 if (!$auth->edit) {
                     continue;
                 }
                 // Create the media object without any region and layout information
                 require_once 'modules/' . $mediaType . '.module.php';
                 $tmpModule = new $mediaType($db, $user, $mediaId, $layout['layoutid'], $regionId, $lkId);
                 $mediaName = $tmpModule->GetName();
                 if ($filterMediaName != '' && !stristr($mediaName, $filterMediaName)) {
                     continue;
                 }
                 if ($filterMediaType != '' && $mediaType != strtolower($filterMediaType)) {
                     continue;
                 }
                 $mediaNodeSequence++;
                 $layout['region'] = $regionName;
                 $layout['media'] = $mediaName;
                 $layout['mediatype'] = $mediaType;
                 $layout['seq'] = $mediaNodeSequence;
                 $layout['buttons'] = array();
                 // Edit
                 $layout['buttons'][] = array('id' => 'homepage_mediamanager_edit_button', 'url' => 'index.php?p=module&mod=' . $mediaType . '&q=Exec&method=EditForm&showRegionOptions=0&layoutid=' . $layout['layoutid'] . '&regionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId, 'text' => __('Edit'));
                 $rows[] = $layout;
             }
         }
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('table_render');
     $response->SetGridResponse($output);
     $response->Respond();
 }
Esempio n. 22
0
 /**
  * A List of Layouts we have permission to design
  */
 public function LayoutJumpList()
 {
     $user =& $this->user;
     $response = new ResponseManager();
     // Layout filter?
     $layoutName = Kit::GetParam('name', _POST, _STRING, '');
     setSession('layoutDesigner', 'JumpList', Kit::GetParam('XiboJumpListPinned', _REQUEST, _CHECKBOX, 'off'));
     setSession('layoutDesigner', 'Name', $layoutName);
     // Get a layout list
     $layoutList = $user->LayoutList($layoutName);
     $rows = array();
     foreach ($layoutList as $layout) {
         if (!$layout['edit'] == 1) {
             continue;
         }
         // We have permission to edit this layout
         $row = array();
         $row['layoutid'] = $layout['layoutid'];
         $row['layout'] = $layout['layout'];
         $row['jump_to_url'] = 'index.php?p=layout&modify=true&layoutid=' . $layout['layoutid'];
         $rows[] = $row;
     }
     // Store the table rows
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('layout_jumplist_grid');
     $response->SetGridResponse($output);
     $response->Respond();
 }
Esempio n. 23
0
 /**
  * Shows the Layout Grid
  * @return 
  */
 function LayoutGrid()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     // Filter by Name
     $name = Kit::GetParam('filter_layout', _POST, _STRING);
     setSession('layout', 'filter_layout', $name);
     // User ID
     $filter_userid = Kit::GetParam('filter_userid', _POST, _INT);
     setSession('layout', 'filter_userid', $filter_userid);
     // Show retired
     $filter_retired = Kit::GetParam('filter_retired', _POST, _INT);
     setSession('layout', 'filter_retired', $filter_retired);
     // Show filterLayoutStatusId
     $filterLayoutStatusId = Kit::GetParam('filterLayoutStatusId', _POST, _INT);
     setSession('layout', 'filterLayoutStatusId', $filterLayoutStatusId);
     // Show showDescriptionId
     $showDescriptionId = Kit::GetParam('showDescriptionId', _POST, _INT);
     setSession('layout', 'showDescriptionId', $showDescriptionId);
     // Show filter_showThumbnail
     $showTags = Kit::GetParam('showTags', _POST, _CHECKBOX);
     setSession('layout', 'showTags', $showTags);
     // Show filter_showThumbnail
     $showThumbnail = Kit::GetParam('showThumbnail', _POST, _CHECKBOX);
     setSession('layout', 'showThumbnail', $showThumbnail);
     // Tags list
     $filter_tags = Kit::GetParam("filter_tags", _POST, _STRING);
     setSession('layout', 'filter_tags', $filter_tags);
     // Pinned option?
     setSession('layout', 'LayoutFilter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     // Get all layouts
     $layouts = $user->LayoutList(NULL, array('layout' => $name, 'userId' => $filter_userid, 'retired' => $filter_retired, 'tags' => $filter_tags, 'filterLayoutStatusId' => $filterLayoutStatusId, 'showTags' => $showTags));
     if (!is_array($layouts)) {
         trigger_error(__('Unable to get layouts for user'), E_USER_ERROR);
     }
     $cols = array(array('name' => 'layoutid', 'title' => __('ID')), array('name' => 'tags', 'title' => __('Tag'), 'hidden' => $showTags == 0, 'colClass' => 'group-word'), array('name' => 'layout', 'title' => __('Name')), array('name' => 'description', 'title' => __('Description'), 'hidden' => $showDescriptionId == 1 || $showDescriptionId == 3), array('name' => 'descriptionWithMarkdown', 'title' => __('Description'), 'hidden' => $showDescriptionId == 2 || $showDescriptionId == 3), array('name' => 'thumbnail', 'title' => __('Thumbnail'), 'hidden' => $showThumbnail == 0), array('name' => 'owner', 'title' => __('Owner')), array('name' => 'permissions', 'title' => __('Permissions')), array('name' => 'status', 'title' => __('Status'), 'icons' => true, 'iconDescription' => 'statusDescription'));
     Theme::Set('table_cols', $cols);
     $rows = array();
     foreach ($layouts as $layout) {
         // Construct an object containing all the layouts, and pass to the theme
         $row = array();
         $row['layoutid'] = $layout['layoutid'];
         $row['layout'] = $layout['layout'];
         $row['description'] = $layout['description'];
         $row['tags'] = $layout['tags'];
         $row['owner'] = $user->getNameFromID($layout['ownerid']);
         $row['permissions'] = $this->GroupsForLayout($layout['layoutid']);
         $row['thumbnail'] = '';
         if ($showThumbnail == 1 && $layout['backgroundImageId'] != 0) {
             $row['thumbnail'] = '<a class="img-replace" data-toggle="lightbox" data-type="image" data-img-src="index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid=' . $layout['backgroundImageId'] . '&width=100&height=100&dynamic=true&thumb=true" href="index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid=' . $layout['backgroundImageId'] . '"><i class="fa fa-file-image-o"></i></a>';
         }
         // Fix up the description
         if ($showDescriptionId == 1) {
             // Parse down for description
             $row['descriptionWithMarkdown'] = Parsedown::instance()->text($row['description']);
         } else {
             if ($showDescriptionId == 2) {
                 $row['description'] = strtok($row['description'], "\n");
             }
         }
         switch ($layout['status']) {
             case 1:
                 $row['status'] = 1;
                 $row['statusDescription'] = __('This Layout is ready to play');
                 break;
             case 2:
                 $row['status'] = 2;
                 $row['statusDescription'] = __('There are items on this Layout that can only be assessed by the Display');
                 break;
             case 3:
                 $row['status'] = 0;
                 $row['statusDescription'] = __('This Layout is invalid and should not be scheduled');
                 break;
             default:
                 $row['status'] = 0;
                 $row['statusDescription'] = __('The Status of this Layout is not known');
         }
         $row['layout_form_edit_url'] = 'index.php?p=layout&q=displayForm&layoutid=' . $layout['layoutid'];
         // Add some buttons for this row
         if ($layout['edit']) {
             // Design Button
             $row['buttons'][] = array('id' => 'layout_button_design', 'linkType' => '_self', 'url' => 'index.php?p=layout&modify=true&layoutid=' . $layout['layoutid'], 'text' => __('Design'));
         }
         // Preview
         $row['buttons'][] = array('id' => 'layout_button_preview', 'linkType' => '_blank', 'url' => 'index.php?p=preview&q=render&ajax=true&layoutid=' . $layout['layoutid'], 'text' => __('Preview Layout'));
         // Schedule Now
         $row['buttons'][] = array('id' => 'layout_button_schedulenow', 'url' => 'index.php?p=schedule&q=ScheduleNowForm&CampaignID=' . $layout['campaignid'], 'text' => __('Schedule Now'));
         $row['buttons'][] = array('linkType' => 'divider');
         // Only proceed if we have edit permissions
         if ($layout['edit']) {
             // Edit Button
             $row['buttons'][] = array('id' => 'layout_button_edit', 'url' => 'index.php?p=layout&q=displayForm&modify=true&layoutid=' . $layout['layoutid'], 'text' => __('Edit'));
             // Copy Button
             $row['buttons'][] = array('id' => 'layout_button_copy', 'url' => 'index.php?p=layout&q=CopyForm&layoutid=' . $layout['layoutid'] . '&oldlayout=' . urlencode($layout['layout']), 'text' => __('Copy'));
             // Retire Button
             $row['buttons'][] = array('id' => 'layout_button_retire', 'url' => 'index.php?p=layout&q=RetireForm&layoutid=' . $layout['layoutid'], 'text' => __('Retire'), 'multi-select' => true, 'dataAttributes' => array(array('name' => 'multiselectlink', 'value' => 'index.php?p=layout&q=Retire'), array('name' => 'rowtitle', 'value' => $row['layout']), array('name' => 'layoutid', 'value' => $layout['layoutid'])));
             // Extra buttons if have delete permissions
             if ($layout['del']) {
                 // Copy Button
                 $row['buttons'][] = array('id' => 'layout_button_delete', 'url' => 'index.php?p=layout&q=DeleteLayoutForm&layoutid=' . $layout['layoutid'], 'text' => __('Delete'), 'multi-select' => true, 'dataAttributes' => array(array('name' => 'multiselectlink', 'value' => 'index.php?p=layout&q=delete'), array('name' => 'rowtitle', 'value' => $row['layout']), array('name' => 'layoutid', 'value' => $layout['layoutid'])));
             }
             $row['buttons'][] = array('linkType' => 'divider');
             // Export Button
             $row['buttons'][] = array('id' => 'layout_button_export', 'linkType' => '_self', 'url' => 'index.php?p=layout&q=Export&layoutid=' . $layout['layoutid'], 'text' => __('Export'));
             // Extra buttons if we have modify permissions
             if ($layout['modifyPermissions']) {
                 // Permissions button
                 $row['buttons'][] = array('id' => 'layout_button_permissions', 'url' => 'index.php?p=campaign&q=PermissionsForm&CampaignID=' . $layout['campaignid'], 'text' => __('Permissions'));
             }
         }
         // Add the row
         $rows[] = $row;
     }
     // Store the table rows
     Theme::Set('table_rows', $rows);
     Theme::Set('gridId', Kit::GetParam('gridId', _REQUEST, _STRING));
     // Initialise the theme and capture the output
     $output = Theme::RenderReturn('table_render');
     $response->SetGridResponse($output);
     $response->initialSortColumn = 3;
     $response->Respond();
 }
Esempio n. 24
0
 /**
  * Show the library
  * @return 
  */
 function LayoutAssignView()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     //Input vars
     $name = Kit::GetParam('filter_name', _POST, _STRING);
     // Get a list of media
     $layoutList = $user->LayoutList($name);
     $rows = array();
     // Add some extra information
     foreach ($layoutList as $row) {
         $row['list_id'] = 'LayoutID_' . $row['layoutid'];
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     // Render the Theme
     $response->SetGridResponse(Theme::RenderReturn('campaign_form_layout_assign_list'));
     $response->callBack = 'LayoutAssignCallback';
     $response->pageSize = 5;
     $response->Respond();
 }
Esempio n. 25
0
 /**
  * A grid of modules
  */
 public function Grid()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $SQL = '';
     $SQL .= 'SELECT ModuleID, ';
     $SQL .= '   Name, ';
     $SQL .= '   Enabled, ';
     $SQL .= '   Description, ';
     $SQL .= '   RegionSpecific, ';
     $SQL .= '   ValidExtensions, ';
     $SQL .= '   ImageUri, ';
     $SQL .= '   PreviewEnabled, ';
     $SQL .= '   assignable ';
     $SQL .= '  FROM `module` ';
     $SQL .= ' ORDER BY Name ';
     if (!($modules = $db->GetArray($SQL))) {
         trigger_error($db->error());
         trigger_error(__('Unable to get the list of modules'), E_USER_ERROR);
     }
     $rows = array();
     foreach ($modules as $module) {
         $row = array();
         $row['moduleid'] = Kit::ValidateParam($module['ModuleID'], _INT);
         $row['name'] = Kit::ValidateParam($module['Name'], _STRING);
         $row['description'] = Kit::ValidateParam($module['Description'], _STRING);
         $row['isregionspecific'] = Kit::ValidateParam($module['RegionSpecific'], _INT);
         $row['validextensions'] = Kit::ValidateParam($module['ValidExtensions'], _STRING);
         $row['imageuri'] = Kit::ValidateParam($module['ImageUri'], _STRING);
         $row['enabled'] = Kit::ValidateParam($module['Enabled'], _INT);
         $row['preview_enabled'] = Kit::ValidateParam($module['PreviewEnabled'], _INT);
         $row['assignable'] = Kit::ValidateParam($module['assignable'], _INT);
         $row['isregionspecific_image'] = $row['isregionspecific'] == 0 ? 'icon-ok' : 'icon-remove';
         $row['enabled_image'] = $row['enabled'] == 1 ? 'icon-ok' : 'icon-remove';
         $row['preview_enabled_image'] = $row['preview_enabled'] == 1 ? 'icon-ok' : 'icon-remove';
         $row['assignable_image'] = $row['assignable'] == 1 ? 'icon-ok' : 'icon-remove';
         // Initialise array of buttons, because we might not have any
         $row['buttons'] = array();
         // If the module config is not locked, present some buttons
         if (Config::GetSetting('MODULE_CONFIG_LOCKED_CHECKB') != 'Checked') {
             // Edit button
             $row['buttons'][] = array('id' => 'module_button_edit', 'url' => 'index.php?p=module&q=EditForm&ModuleID=' . $row['moduleid'], 'text' => __('Edit'));
         }
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('module_page_grid');
     $response->SetGridResponse($output);
     $response->Respond();
 }
Esempio n. 26
0
 public function EventFormDisplay()
 {
     $user =& $this->user;
     $response = new ResponseManager();
     // Filter
     $displayName = Kit::GetParam('name', _POST, _STRING, '');
     $displayGroupIds = Kit::GetParam('DisplayGroupIDs', _POST, _ARRAY);
     setSession('scheduleEvent', 'EventFormDisplayFilter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     setSession('scheduleEvent', 'DisplayName', $displayName);
     // Layout list
     $displays = $user->DisplayGroupList(0, $displayName);
     // Show a list of layouts we have permission to jump to
     $output = '<table class="table table-bordered">';
     $output .= '    <thead>';
     $output .= '    <tr>';
     $output .= '    <th>' . __('Name') . '</th>';
     $output .= '    <th>' . __('Type') . '</th>';
     $output .= '    <th data-sorter="false"></th>';
     $output .= '    </tr>';
     $output .= '    </thead>';
     $output .= '    <tbody>';
     foreach ($displays as $display) {
         if ($display['edit'] != 1 && Config::GetSetting('SCHEDULE_WITH_VIEW_PERMISSION') == 'No') {
             continue;
         }
         // We have permission to edit this layout
         $output .= '<tr>';
         $output .= '    <td>' . $display['displaygroup'] . '</td>';
         $output .= '    <td>' . ($display['isdisplayspecific'] == 1 ? __('Display') : __('Group')) . '</td>';
         $output .= '    <td><input type="checkbox" name="DisplayGroupIDs[]" value="' . $display['displaygroupid'] . '" ' . (in_array($display['displaygroupid'], $displayGroupIds) ? ' checked' : '') . '/></td>';
         $output .= '</tr>';
     }
     $output .= '    </tbody>';
     $output .= '</table>';
     $response->SetGridResponse($output);
     $response->paging = true;
     $response->pageSize = 5;
     $response->callBack = 'displayGridCallback';
     $response->Respond();
 }
Esempio n. 27
0
 /**
  * Grid of Displays
  * @return
  */
 function DisplayGrid()
 {
     // validate displays so we get a realistic view of the table
     Display::ValidateDisplays();
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     // Filter by Name
     $filter_display = Kit::GetParam('filter_display', _POST, _STRING);
     setSession('display', 'filter_display', $filter_display);
     // Filter by Name
     $filterMacAddress = Kit::GetParam('filterMacAddress', _POST, _STRING);
     setSession('display', 'filterMacAddress', $filterMacAddress);
     // Display Group
     $filter_displaygroupid = Kit::GetParam('filter_displaygroup', _POST, _INT);
     setSession('display', 'filter_displaygroup', $filter_displaygroupid);
     // Thumbnail?
     $filter_showView = Kit::GetParam('filter_showView', _REQUEST, _INT);
     setSession('display', 'filter_showView', $filter_showView);
     $filterVersion = Kit::GetParam('filterVersion', _REQUEST, _STRING);
     setSession('display', 'filterVersion', $filterVersion);
     // filter_autoRefresh?
     $filter_autoRefresh = Kit::GetParam('filter_autoRefresh', _REQUEST, _INT, 0);
     setSession('display', 'filter_autoRefresh', $filter_autoRefresh);
     // Pinned option?
     setSession('display', 'DisplayFilter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     $displays = $user->DisplayList(array('displayid'), array('displaygroupid' => $filter_displaygroupid, 'display' => $filter_display, 'macAddress' => $filterMacAddress, 'clientVersion' => $filterVersion));
     if (!is_array($displays)) {
         trigger_error($db->error());
         trigger_error(__('Unable to get list of displays'), E_USER_ERROR);
     }
     // Do we want to make a VNC link out of the display name?
     $vncTemplate = Config::GetSetting('SHOW_DISPLAY_AS_VNCLINK');
     $linkTarget = Kit::ValidateParam(Config::GetSetting('SHOW_DISPLAY_AS_VNC_TGT'), _STRING);
     $cols = array(array('name' => 'displayid', 'title' => __('ID')), array('name' => 'displayWithLink', 'title' => __('Display')), array('name' => 'status', 'title' => __('Status'), 'icons' => true, 'iconDescription' => 'statusDescription'), array('name' => 'licensed', 'title' => __('License'), 'icons' => true), array('name' => 'currentLayout', 'title' => __('Current Layout'), 'hidden' => $filter_showView != 3), array('name' => 'storageAvailableSpaceFormatted', 'title' => __('Storage Available'), 'hidden' => $filter_showView != 3), array('name' => 'storageTotalSpaceFormatted', 'title' => __('Storage Total'), 'hidden' => $filter_showView != 3), array('name' => 'storagePercentage', 'title' => __('Storage Free %'), 'hidden' => $filter_showView != 3), array('name' => 'description', 'title' => __('Description'), 'hidden' => $filter_showView != 4), array('name' => 'layout', 'title' => __('Default Layout'), 'hidden' => $filter_showView != 0), array('name' => 'inc_schedule', 'title' => __('Interleave Default'), 'icons' => true, 'hidden' => $filter_showView == 1 || $filter_showView == 2), array('name' => 'email_alert', 'title' => __('Email Alert'), 'icons' => true, 'hidden' => $filter_showView != 0), array('name' => 'loggedin', 'title' => __('Logged In'), 'icons' => true), array('name' => 'lastaccessed', 'title' => __('Last Accessed')), array('name' => 'clientVersionCombined', 'title' => __('Version'), 'hidden' => $filter_showView != 3), array('name' => 'clientaddress', 'title' => __('IP Address'), 'hidden' => $filter_showView == 1), array('name' => 'macaddress', 'title' => __('Mac Address'), 'hidden' => $filter_showView == 1), array('name' => 'screenShotRequested', 'title' => __('Screen shot?'), 'icons' => true, 'hidden' => $filter_showView != 1 && $filter_showView != 2), array('name' => 'thumbnail', 'title' => __('Thumbnail'), 'hidden' => $filter_showView != 1 && $filter_showView != 2));
     Theme::Set('table_cols', $cols);
     Theme::Set('rowClass', 'rowColor');
     $rows = array();
     foreach ($displays as $row) {
         // VNC Template as display name?
         if ($vncTemplate != '' && $row['clientaddress'] != '') {
             if ($linkTarget == '') {
                 $linkTarget = '_top';
             }
             $row['displayWithLink'] = sprintf('<a href="' . $vncTemplate . '" title="VNC to ' . $row['display'] . '" target="' . $linkTarget . '">' . Theme::Prepare($row['display']) . '</a>', $row['clientaddress']);
         } else {
             $row['displayWithLink'] = $row['display'];
         }
         // Format last accessed
         $row['lastaccessed'] = DateManager::getLocalDate($row['lastaccessed']);
         // Create some login lights
         $row['rowColor'] = $row['mediainventorystatus'] == 1 ? 'success' : ($row['mediainventorystatus'] == 2 ? 'danger' : 'warning');
         // Set some text for the display status
         switch ($row['mediainventorystatus']) {
             case 1:
                 $row['statusDescription'] = __('Display is up to date');
                 break;
             case 2:
                 $row['statusDescription'] = __('Display is downloading new files');
                 break;
             case 3:
                 $row['statusDescription'] = __('Display is out of date but has not yet checked in with the server');
                 break;
             default:
                 $row['statusDescription'] = __('Unknown Display Status');
         }
         $row['status'] = $row['mediainventorystatus'] == 1 ? 1 : ($row['mediainventorystatus'] == 2 ? 0 : -1);
         // Thumbnail
         $row['thumbnail'] = '';
         // If we aren't logged in, and we are showThumbnail == 2, then show a circle
         if ($filter_showView == 2 && $row['loggedin'] == 0) {
             $row['thumbnail'] = '<i class="fa fa-times-circle"></i>';
         } else {
             if ($filter_showView != 0 && file_exists(Config::GetSetting('LIBRARY_LOCATION') . 'screenshots/' . $row['displayid'] . '_screenshot.jpg')) {
                 $row['thumbnail'] = '<a data-toggle="lightbox" data-type="image" href="index.php?p=display&q=ScreenShot&DisplayId=' . $row['displayid'] . '"><img class="display-screenshot" src="index.php?p=display&q=ScreenShot&DisplayId=' . $row['displayid'] . '&' . Kit::uniqueId() . '" /></a>';
             }
         }
         // Version
         $row['clientVersionCombined'] = $row['client_type'] . ' / ' . $row['client_version'];
         // Format the storage available / total space
         $row['storageAvailableSpaceFormatted'] = Kit::formatBytes($row['storageAvailableSpace']);
         $row['storageTotalSpaceFormatted'] = Kit::formatBytes($row['storageTotalSpace']);
         $row['storagePercentage'] = $row['storageTotalSpace'] == 0 ? 100 : round($row['storageAvailableSpace'] / $row['storageTotalSpace'] * 100.0, 2);
         // Edit and Delete buttons first
         if ($row['edit'] == 1) {
             // Edit
             $row['buttons'][] = array('id' => 'display_button_edit', 'url' => 'index.php?p=display&q=displayForm&displayid=' . $row['displayid'], 'text' => __('Edit'));
         }
         // Delete
         if ($row['del'] == 1) {
             $row['buttons'][] = array('id' => 'display_button_delete', 'url' => 'index.php?p=display&q=DeleteForm&displayid=' . $row['displayid'], 'text' => __('Delete'));
         }
         if ($row['edit'] == 1 || $row['del'] == 1) {
             $row['buttons'][] = array('linkType' => 'divider');
         }
         // Schedule Now
         if ($row['edit'] == 1 || Config::GetSetting('SCHEDULE_WITH_VIEW_PERMISSION') == 'Yes') {
             $row['buttons'][] = array('id' => 'display_button_schedulenow', 'url' => 'index.php?p=schedule&q=ScheduleNowForm&displayGroupId=' . $row['displaygroupid'], 'text' => __('Schedule Now'));
         }
         if ($row['edit'] == 1) {
             // Default Layout
             $row['buttons'][] = array('id' => 'display_button_defaultlayout', 'url' => 'index.php?p=display&q=DefaultLayoutForm&DisplayId=' . $row['displayid'], 'text' => __('Default Layout'));
             // File Associations
             $row['buttons'][] = array('id' => 'displaygroup_button_fileassociations', 'url' => 'index.php?p=displaygroup&q=FileAssociations&DisplayGroupID=' . $row['displaygroupid'], 'text' => __('Assign Files'));
             // Screen Shot
             $row['buttons'][] = array('id' => 'display_button_requestScreenShot', 'url' => 'index.php?p=display&q=RequestScreenShotForm&displayId=' . $row['displayid'], 'text' => __('Request Screen Shot'), 'multi-select' => true, 'dataAttributes' => array(array('name' => 'multiselectlink', 'value' => 'index.php?p=display&q=RequestScreenShot'), array('name' => 'rowtitle', 'value' => $row['display']), array('name' => 'displayId', 'value' => $row['displayid'])));
             $row['buttons'][] = array('linkType' => 'divider');
         }
         // Media Inventory
         $row['buttons'][] = array('id' => 'display_button_mediainventory', 'url' => 'index.php?p=display&q=MediaInventory&DisplayId=' . $row['displayid'], 'text' => __('Media Inventory'));
         if ($row['edit'] == 1) {
             // Logs
             $row['buttons'][] = array('id' => 'displaygroup_button_logs', 'url' => 'index.php?p=log&q=LastHundredForDisplay&displayid=' . $row['displayid'], 'text' => __('Recent Log'));
             $row['buttons'][] = array('linkType' => 'divider');
         }
         if ($row['modifypermissions'] == 1) {
             // Display Groups
             $row['buttons'][] = array('id' => 'display_button_group_membership', 'url' => 'index.php?p=display&q=MemberOfForm&DisplayID=' . $row['displayid'], 'text' => __('Display Groups'));
             // Permissions
             $row['buttons'][] = array('id' => 'display_button_group_membership', 'url' => 'index.php?p=displaygroup&q=PermissionsForm&DisplayGroupID=' . $row['displaygroupid'], 'text' => __('Permissions'));
             // Version Information
             $row['buttons'][] = array('id' => 'display_button_version_instructions', 'url' => 'index.php?p=displaygroup&q=VersionInstructionsForm&displaygroupid=' . $row['displaygroupid'] . '&displayid=' . $row['displayid'], 'text' => __('Version Information'));
             $row['buttons'][] = array('linkType' => 'divider');
         }
         if ($row['edit'] == 1) {
             // Wake On LAN
             $row['buttons'][] = array('id' => 'display_button_wol', 'url' => 'index.php?p=display&q=WakeOnLanForm&DisplayId=' . $row['displayid'], 'text' => __('Wake on LAN'));
         }
         // Assign this to the table row
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('table_render');
     $response->SetGridResponse($output);
     $response->refresh = Kit::GetParam('filter_autoRefresh', _REQUEST, _INT, 0);
     $response->Respond();
 }
Esempio n. 28
0
 function Grid()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $type = Kit::GetParam('filter_type', _REQUEST, _STRING, '0');
     $function = Kit::GetParam('filter_function', _REQUEST, _STRING, '0');
     $page = Kit::GetParam('filter_page', _REQUEST, _STRING, '0');
     $fromdt = Kit::GetParam('filter_fromdt', _REQUEST, _STRING);
     $displayid = Kit::GetParam('filter_display', _REQUEST, _INT);
     $seconds = Kit::GetParam('filter_seconds', _POST, _INT, 120);
     setSession('log', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     setSession('log', 'filter_type', $type);
     setSession('log', 'filter_function', $function);
     setSession('log', 'filter_page', $page);
     setSession('log', 'filter_fromdt', $fromdt);
     setSession('log', 'filter_display', $displayid);
     setSession('log', 'filter_seconds', $seconds);
     //get the dates and times
     if ($fromdt == '') {
         $starttime_timestamp = time();
     } else {
         $start_date = explode("/", $fromdt);
         //		dd/mm/yyyy
         $starttime_timestamp = strtotime($start_date[1] . "/" . $start_date[0] . "/" . $start_date[2] . ' ' . date("H", time()) . ":" . date("i", time()) . ':59');
     }
     $todt = date("Y-m-d H:i:s", $starttime_timestamp);
     $fromdt = date("Y-m-d H:i:s", $starttime_timestamp - $seconds);
     $SQL = "";
     $SQL .= "SELECT logid, logdate, page, function, message FROM log ";
     $SQL .= sprintf(" WHERE  logdate > '%s' AND logdate <= '%s' ", $fromdt, $todt);
     if ($type != "0") {
         $SQL .= sprintf("AND type = '%s' ", $db->escape_string($type));
     }
     if ($page != "0") {
         $SQL .= sprintf("AND page = '%s' ", $db->escape_string($page));
     }
     if ($function != "0") {
         $SQL .= sprintf("AND function = '%s' ", $db->escape_string($function));
     }
     if ($displayid != 0) {
         $SQL .= sprintf("AND displayID = %d ", $displayid);
     }
     $SQL .= " ORDER BY logid ";
     // Load results into an array
     $log = $db->GetArray($SQL);
     if (!is_array($log)) {
         trigger_error($db->error());
         trigger_error(__('Error getting the log'), E_USER_ERROR);
     }
     $rows = array();
     foreach ($log as $row) {
         $row['logid'] = Kit::ValidateParam($row['logid'], _INT);
         $row['logdate'] = Kit::ValidateParam($row['logdate'], _STRING);
         $row['page'] = Kit::ValidateParam($row['page'], _STRING);
         $row['function'] = Kit::ValidateParam($row['function'], _STRING);
         $row['message'] = nl2br(htmlspecialchars($row['message']));
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('log_page_grid');
     $response->initialSortOrder = 2;
     $response->pageSize = 20;
     $response->SetGridResponse($output);
     $response->Respond();
 }
Esempio n. 29
0
 /**
  * Show the library
  * @return 
  */
 function LayoutAssignView()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     //Input vars
     $name = Kit::GetParam('filter_name', _POST, _STRING);
     $tags = Kit::GetParam('filter_tags', _POST, _STRING);
     // Get a list of media
     $layoutList = $user->LayoutList(NULL, array('layout' => $name, 'tags' => $tags));
     $cols = array(array('name' => 'layout', 'title' => __('Name')));
     Theme::Set('table_cols', $cols);
     $rows = array();
     // Add some extra information
     foreach ($layoutList as $row) {
         $row['list_id'] = 'LayoutID_' . $row['layoutid'];
         $row['assign_icons'][] = array('assign_icons_class' => 'layout_assign_list_select');
         $row['dataAttributes'] = array(array('name' => 'rowid', 'value' => $row['list_id']), array('name' => 'litext', 'value' => $row['layout']));
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     // Render the Theme
     $response->SetGridResponse(Theme::RenderReturn('table_render'));
     $response->callBack = 'LayoutAssignCallback';
     $response->pageSize = 5;
     $response->Respond();
 }
Esempio n. 30
0
 function Grid()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $type = Kit::GetParam('filter_type', _POST, _WORD);
     $fromdt = Kit::GetParam('filter_fromdt', _POST, _STRING);
     ///get the dates and times
     if ($fromdt != '') {
         $start_date = explode("/", $fromdt);
         //		dd/mm/yyyy
         $starttime_timestamp = strtotime($start_date[1] . "/" . $start_date[0] . "/" . $start_date[2] . ' ' . date("H", time()) . ":" . date("i", time()) . ':59');
     }
     setSession('sessions', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     setSession('sessions', 'filter_type', $type);
     setSession('sessions', 'filter_fromdt', $fromdt);
     $SQL = "SELECT session.userID, user.UserName,  IsExpired, LastPage,  session.LastAccessed,  RemoteAddr,  UserAgent ";
     $SQL .= "FROM `session` LEFT OUTER JOIN user ON user.userID = session.userID ";
     $SQL .= "WHERE 1 = 1 ";
     if ($fromdt != '') {
         $SQL .= sprintf(" AND session_expiration < '%s' ", $starttime_timestamp);
     }
     if ($type == "active") {
         $SQL .= " AND IsExpired = 0 ";
     }
     if ($type == "expired") {
         $SQL .= " AND IsExpired = 1 ";
     }
     if ($type == "guest") {
         $SQL .= " AND session.userID IS NULL ";
     }
     // Load results into an array
     $log = $db->GetArray($SQL);
     if (!is_array($log)) {
         trigger_error($db->error());
         trigger_error(__('Error getting the log'), E_USER_ERROR);
     }
     $rows = array();
     foreach ($log as $row) {
         $row['userid'] = Kit::ValidateParam($row['userID'], _INT);
         $row['username'] = Kit::ValidateParam($row['UserName'], _STRING);
         $row['isexpired'] = Kit::ValidateParam($row['IsExpired'], _INT) == 0 ? 'icon-ok' : 'icon-remove';
         $row['lastpage'] = Kit::ValidateParam($row['LastPage'], _STRING);
         $row['lastaccessed'] = Kit::ValidateParam($row['LastAccessed'], _STRING);
         $row['ip'] = Kit::ValidateParam($row['RemoteAddr'], _STRING);
         $row['browser'] = Kit::ValidateParam($row['UserAgent'], _STRING);
         // Edit
         $row['buttons'][] = array('id' => 'sessions_button_logout', 'url' => 'index.php?p=sessions&q=ConfirmLogout&userid=' . $row['userid'], 'text' => __('Logout'));
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('sessions_page_grid');
     $response->SetGridResponse($output);
     $response->Respond();
 }