Beispiel #1
0
 /**
  * Gets the Time
  * @return 
  */
 function GetClock()
 {
     $db =& $this->db;
     $response = new ResponseManager();
     $output = DateManager::GetClock();
     $response->SetFormRequestResponse($output, __('Date / Time Information'), '480px', '240px');
     $response->clockUpdate = true;
     $response->success = false;
     $response->Respond();
 }
Beispiel #2
0
 public function ErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
 {
     // timestamp for the error entry
     $dt = date("Y-m-d H:i:s (T)");
     // define an assoc array of error string
     // in reality the only entries we should
     // consider are E_WARNING, E_NOTICE, E_USER_ERROR,
     // E_USER_WARNING and E_USER_NOTICE
     $errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Recoverable Error', 8192 => 'Deprecated Call');
     // set of errors for which a var trace will be saved
     $user_errors_halt = array(E_USER_ERROR);
     $user_errors_inline = array(E_USER_WARNING);
     $err = "<errormsg>" . $errmsg . "</errormsg>\n";
     $err .= "<errornum>" . $errno . "</errornum>\n";
     $err .= "<errortype>" . $errortype[$errno] . "</errortype>\n";
     $err .= "<scriptname>" . $filename . "</scriptname>\n";
     $err .= "<scriptlinenum>" . $linenum . "</scriptlinenum>\n";
     // Log everything
     Debug::LogEntry("error", $err);
     // Test to see if this is a HALT error or not (we do the same if we are in production or not!)
     if (in_array($errno, $user_errors_halt)) {
         // We have a halt error
         Debug::LogEntry('audit', 'Creating a Response Manager to deal with the HALT Error.');
         $response = new ResponseManager();
         $response->SetError($errmsg);
         $response->Respond();
     }
     // Is Debug Enabled? (i.e. Development or Support)
     if (error_reporting() != 0) {
         if (in_array($errno, $user_errors_inline)) {
             // This is an inline error - therefore we really want to pop up a message box with this in it - so we know?
             // For now we treat this like a halt error? Or do we just try and output some javascript to pop up an error
             // surely the javascript idea wont work in ajax?
             // or prehaps we add this to the session errormessage so we see it at a later date?
             echo $errmsg;
             die;
         }
     }
     // Must return false
     return false;
 }
 /**
  * Validate the User is Logged In
  * @param $ajax Object[optional] Indicates if this request came from an AJAX call or otherwise
  */
 function attempt_login($ajax = false)
 {
     $db =& $this->db;
     $userid = Kit::GetParam('userid', _SESSION, _INT);
     // Referring Page is anything after the ?
     $requestUri = rawurlencode(Kit::GetCurrentPage());
     if (!$this->checkforUserid()) {
         // Log out the user
         if ($userid != 0) {
             $db->query(sprintf("UPDATE user SET loggedin = 0 WHERE userid = %d ", $userid));
         }
         // AJAX calls that fail the login test cause a page redirect
         if ($ajax) {
             //create the AJAX request object
             $response = new ResponseManager();
             $response->Login();
             $response->Respond();
         } else {
             Theme::Set('form_meta', '<input type="hidden" name="token" value="' . CreateFormToken() . '" />');
             Theme::Set('form_action', 'index.php?q=login&referingPage=' . $requestUri);
             Theme::Set('about_url', 'index.php?p=index&q=About');
             Theme::Set('source_url', 'https://launchpad.net/xibo/1.6');
             // Message (either from the URL or the session)
             $message = Kit::GetParam('message', _GET, _STRING, Kit::GetParam('message', _SESSION, _STRING, ''));
             Theme::Set('login_message', $message);
             Theme::Render('login_page');
             // Clear the session message
             $_SESSION['message'] = '';
             exit;
         }
         return false;
     } else {
         //write out to the db that the logged in user has accessed the page still
         $SQL = sprintf("UPDATE user SET lastaccessed = '" . date("Y-m-d H:i:s") . "', loggedin = 1 WHERE userid = %d ", $userid);
         $results = $db->query($SQL) or trigger_error("Can not write last accessed info.", E_USER_ERROR);
         // Load the information about this user
         $this->LoginServices($userid);
         return true;
     }
 }
Beispiel #4
0
 /**
  * Shows the form to delete a template
  */
 public function DeleteTemplateForm()
 {
     $response = new ResponseManager();
     $templateId = Kit::GetParam('layoutid', _GET, _INT);
     $auth = $this->user->TemplateAuth($templateId, true);
     if (!$auth->del) {
         trigger_error(__('You do not have permissions to delete this template'), E_USER_ERROR);
     }
     Theme::Set('form_id', 'DeleteForm');
     Theme::Set('form_action', 'index.php?p=template&q=DeleteTemplate');
     Theme::Set('form_meta', '<input type="hidden" name="templateId" value="' . $templateId . '">');
     Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to delete this template?'))));
     $form = Theme::RenderReturn('form_render');
     $response->SetFormRequestResponse($form, __('Delete Template'), '300px', '200px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Template', 'Delete') . '")');
     $response->AddButton(__('No'), 'XiboDialogClose()');
     $response->AddButton(__('Yes'), '$("#DeleteForm").submit()');
     $response->Respond();
 }
Beispiel #5
0
 public function Install()
 {
     // Module file name
     $file = Kit::GetParam('module', _GET, _STRING);
     if ($file == '') {
         trigger_error(__('Unable to install module'), E_USER_ERROR);
     }
     Debug::LogEntry('audit', 'Request to install Module: ' . $file, 'module', 'Install');
     // Check that the file exists
     if (!file_exists($file)) {
         trigger_error(__('File does not exist'), E_USER_ERROR);
     }
     // Make sure the file is in our list of expected module files
     $files = glob('modules/*.module.php');
     if (!in_array($file, $files)) {
         trigger_error(__('Not a module file'), E_USER_ERROR);
     }
     // Load the file
     include_once $file;
     $type = str_replace('modules/', '', $file);
     $type = str_replace('.module.php', '', $type);
     // Load the module object inside the file
     if (!class_exists($type)) {
         trigger_error(__('Module file does not contain a class of the correct name'), E_USER_ERROR);
     }
     try {
         Debug::LogEntry('audit', 'Validation passed, installing module.', 'module', 'Install');
         $moduleObject = ModuleFactory::create($type, $this->db, $this->user);
         $moduleObject->InstallOrUpdate();
     } catch (Exception $e) {
         trigger_error(__('Unable to install module'), E_USER_ERROR);
     }
     Debug::LogEntry('audit', 'Module Installed: ' . $file, 'module', 'Install');
     // Excellent... capital... success
     $response = new ResponseManager();
     $response->refresh = true;
     $response->refreshLocation = 'index.php?p=module';
     $response->Respond();
 }
Beispiel #6
0
 /**
  * Tidies up the library
  */
 public function TidyLibrary()
 {
     $response = new ResponseManager();
     $tidyOldRevisions = Kit::GetParam('tidyOldRevisions', _POST, _CHECKBOX) == 1;
     $cleanUnusedFiles = Kit::GetParam('cleanUnusedFiles', _POST, _CHECKBOX) == 1;
     if (Config::GetSetting('SETTING_LIBRARY_TIDY_ENABLED') != 1) {
         trigger_error(__('Sorry this function is disabled.'), E_USER_ERROR);
     }
     $maintenance = new Maintenance();
     if (!$maintenance->TidyLibrary($tidyOldRevisions, $cleanUnusedFiles)) {
         trigger_error($maintenance->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('Library Tidy Complete'));
     $response->Respond();
 }
Beispiel #7
0
 /**
  * Re-orders a medias regions
  * @return
  */
 function TimelineReorder()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     // Vars
     $layoutId = Kit::GetParam('layoutid', _REQUEST, _INT);
     $regionId = Kit::GetParam('regionid', _POST, _STRING);
     $mediaList = Kit::GetParam('medialist', _POST, _STRING);
     // Check the user has permission
     Kit::ClassLoader('region');
     $region = new region($db);
     $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);
     }
     // Create a list of media
     if ($mediaList == '') {
         trigger_error(__('No media to reorder'));
     }
     // Trim the last | if there is one
     $mediaList = rtrim($mediaList, '|');
     // Explode into an array
     $mediaList = explode('|', $mediaList);
     // Store in an array
     $resolvedMedia = array();
     foreach ($mediaList as $mediaNode) {
         // Explode the second part of the array
         $mediaNode = explode(',', $mediaNode);
         $resolvedMedia[] = array('mediaid' => $mediaNode[0], 'lkid' => $mediaNode[1]);
     }
     // Hand off to the region object to do the actual reorder
     if (!$region->ReorderTimeline($layoutId, $regionId, $resolvedMedia)) {
         trigger_error($region->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('Order Changed'));
     $response->keepOpen = true;
     $response->Respond();
 }
Beispiel #8
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();
 }
Beispiel #9
0
 /**
  * Logs out a user
  * @return 
  */
 function LogoutUser()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error(__('Sorry the form has expired. Please refresh.'), E_USER_ERROR);
     }
     $db =& $this->db;
     //ajax request handler
     $response = new ResponseManager();
     $userID = Kit::GetParam('userid', _POST, _INT);
     $SQL = sprintf("UPDATE session SET IsExpired = 1 WHERE userID = %d", $userID);
     if (!$db->query($SQL)) {
         trigger_error($db->error());
         trigger_error(__("Unable to log out this user"), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('User Logged Out.'));
     $response->Respond();
 }
Beispiel #10
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($mediatype, $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();
 }
Beispiel #11
0
 public function Import()
 {
     $db =& $this->db;
     $response = new ResponseManager();
     // What are we importing?
     $template = Kit::GetParam('template', _POST, _STRING, 'false');
     $template = $template == 'true';
     $layout = Kit::GetParam('layout', _POST, _STRING);
     $replaceExisting = Kit::GetParam('replaceExisting', _POST, _CHECKBOX);
     $importTags = Kit::GetParam('importTags', _POST, _CHECKBOX, !$template);
     // File data
     $tmpName = Kit::GetParam('hidFileID', _POST, _STRING);
     if ($tmpName == '') {
         trigger_error(__('Please ensure you have picked a file and it has finished uploading'), E_USER_ERROR);
     }
     // File name and extension (orignial name)
     $fileName = Kit::GetParam('txtFileName', _POST, _STRING);
     $fileName = basename($fileName);
     $ext = strtolower(substr(strrchr($fileName, "."), 1));
     // File upload directory.. get this from the settings object
     $fileLocation = Config::GetSetting('LIBRARY_LOCATION') . 'temp/' . $tmpName;
     Kit::ClassLoader('layout');
     $layoutObject = new Layout($this->db);
     if (!$layoutObject->Import($fileLocation, $layout, $this->user->userid, $template, $replaceExisting, $importTags)) {
         trigger_error($layoutObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('Layout Imported'));
     $response->Respond();
 }
Beispiel #12
0
 /**
  * Deletes an Event from all displays
  * @return 
  */
 public function DeleteDay()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error('Token does not match', E_USER_ERROR);
     }
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $displayGroupIds = Kit::GetParam('DisplayGroupIDs', _POST, _ARRAY, Kit::GetParam('DisplayGroupIDs', _SESSION, _ARRAY));
     $date = Kit::GetParam('date', _POST, _INT, 0);
     $dateString = date('Y-m-d', $date);
     if ($date == 0) {
         trigger_error(__('Day not selected'), E_USER_ERROR);
     }
     $events = $this->GetEventsForDay($date, $displayGroupIds);
     // Create an object to use for the delete
     $scheduleObject = new Schedule($db);
     foreach ($events as $event) {
         if ($event->editPermission) {
             // Delete the entire schedule.
             if (!$scheduleObject->Delete($event->eventID)) {
                 trigger_error($scheduleObject->GetErrorMessage(), E_USER_ERROR);
             }
         }
     }
     $response->SetFormSubmitResponse(sprintf(__('All events for %s have been deleted'), $dateString));
     $response->callBack = 'CallGenerateCalendar';
     $response->Respond();
 }
Beispiel #13
0
 public function ScheduleNow()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error(__('Sorry the form has expired. Please refresh.'), E_USER_ERROR);
     }
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $campaignId = Kit::GetParam('CampaignID', _POST, _INT, 0);
     $displayGroupIds = Kit::GetParam('DisplayGroupIDs', _POST, _ARRAY);
     $isPriority = Kit::GetParam('is_priority', _POST, _CHECKBOX);
     $fromDt = time();
     $hours = Kit::GetParam('hours', _POST, _INT, 0);
     $minutes = Kit::GetParam('minutes', _POST, _INT, 0);
     $seconds = Kit::GetParam('seconds', _POST, _INT, 0);
     $duration = $hours * 3600 + $minutes * 60 + $seconds;
     $displayOrder = Kit::GetParam('DisplayOrder', _POST, _INT);
     // Validate
     if ($campaignId == 0) {
         trigger_error(__('No layout selected'), E_USER_ERROR);
     }
     if ($duration == 0) {
         trigger_error(__('You must enter a duration'), E_USER_ERROR);
     }
     // check that at least one display has been selected
     if ($displayGroupIds == '') {
         trigger_error(__('No displays selected'), E_USER_ERROR);
     }
     if ($fromDt < time() - 86400) {
         trigger_error(__('Your start time is in the past. Cannot schedule events in the past'), E_USER_ERROR);
     }
     $toDt = $fromDt + $duration;
     // Ready to do the add
     $scheduleObject = new Schedule($db);
     if (!$scheduleObject->Add($displayGroupIds, $fromDt, $toDt, $campaignId, '', '', '', $isPriority, $this->user->userid, $displayOrder)) {
         trigger_error($scheduleObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('The Event has been Scheduled'));
     $response->Respond();
 }
Beispiel #14
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();
 }
Beispiel #15
0
 public function LayoutStatus()
 {
     $db =& $this->db;
     $response = new ResponseManager();
     $layoutId = Kit::GetParam('layoutId', _GET, _INT);
     Kit::ClassLoader('Layout');
     $layout = new Layout($db);
     $status = "";
     switch ($layout->IsValid($layoutId)) {
         case 1:
             $status = '<span title="' . __('This Layout is ready to play') . '" class="icon-ok-circle"></span>';
             break;
         case 2:
             $status = '<span title="' . __('There are items on this Layout that can only be assessed by the client') . '" class="icon-question-sign"></span>';
             break;
         case 3:
             $status = '<span title="' . __('This Layout is invalid and should not be scheduled') . '" class="icon-remove-sign"></span>';
             break;
         default:
             $status = '<span title="' . __('The Status of this Layout is not known') . '" class="icon-warning-sign"></span>';
     }
     $response->html = $status;
     $response->success = true;
     $response->Respond();
 }
Beispiel #16
0
 public function VersionInstructions()
 {
     $response = new ResponseManager();
     Kit::ClassLoader('media');
     Kit::ClassLoader('display');
     Kit::ClassLoader('lkmediadisplaygroup');
     $displayGroupId = Kit::GetParam('displaygroupid', _POST, _INT);
     $mediaId = Kit::GetParam('mediaid', _POST, _INT);
     // Make sure we have permission to do this to this display
     $auth = $this->user->DisplayGroupAuth($displayGroupId, true);
     if (!$auth->edit) {
         trigger_error(__('You do not have permission to edit this display group'), E_USER_ERROR);
     }
     // Make sure we have permission to use this file
     $mediaAuth = $this->user->MediaAuth($mediaId, true);
     if (!$mediaAuth->view) {
         trigger_error(__('You have selected media that you no longer have permission to use. Please reload the form.'), E_USER_ERROR);
     }
     // Make sure this file is assigned to this display group
     $link = new LkMediaDisplayGroup($this->db);
     if (!$link->Link($displayGroupId, $mediaId)) {
         trigger_error($display->GetErrorMessage(), E_USER_ERROR);
     }
     // Get the "StoredAs" for this media item
     $media = new Media($this->db);
     $storedAs = $media->GetStoredAs($mediaId);
     // Get a list of displays for this group
     $displays = $this->user->DisplayList(array('displayid'), array('displaygroupid' => $displayGroupId));
     foreach ($displays as $display) {
         // Update the Display with the new instructions
         $displayObject = new Display($this->db);
         if (!$displayObject->SetVersionInstructions($display['displayid'], $mediaId, $storedAs)) {
             trigger_error($displayObject->GetErrorMessage(), E_USER_ERROR);
         }
     }
     $response->SetFormSubmitResponse(__('Version Instructions Set'));
     $response->Respond();
 }
Beispiel #17
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();
 }
Beispiel #18
0
 /**
  * Shows the Authorised applications this user has
  */
 public function UserTokens()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $store = OAuthStore::instance();
     try {
         $list = $store->listConsumerTokens(Kit::GetParam('userID', _GET, _INT));
     } catch (OAuthException $e) {
         trigger_error($e->getMessage());
         trigger_error(__('Error listing Log.'), E_USER_ERROR);
     }
     $rows = array();
     foreach ($list as $app) {
         $app['application_title'] = Kit::ValidateParam($app['application_title'], _STRING);
         $app['enabled'] = Kit::ValidateParam($app['enabled'], _STRING);
         $app['status'] = Kit::ValidateParam($app['status'], _STRING);
         $rows[] = $app;
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('application_form_user_applications');
     $response->SetFormRequestResponse($output, __('Authorized applications for user'), '650', '450');
     $response->AddButton(__('Help'), "XiboHelpRender('" . HelpManager::Link('User', 'Applications') . "')");
     $response->AddButton(__('Close'), 'XiboDialogClose()');
     $response->Respond();
 }
Beispiel #19
0
 /**
  * Set this templates permissions
  */
 public function Permissions()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error('Token does not match', E_USER_ERROR);
     }
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $templateId = Kit::GetParam('templateid', _POST, _INT);
     if ($templateId == 0) {
         trigger_error(__('No template selected'), E_USER_ERROR);
     }
     // Is this user allowed to delete this template?
     $auth = $this->user->TemplateAuth($templateId, true);
     $groupIds = Kit::GetParam('groupids', _POST, _ARRAY);
     // Unlink all
     Kit::ClassLoader('templategroupsecurity');
     $security = new TemplateGroupSecurity($db);
     if (!$security->UnlinkAll($templateId)) {
         trigger_error(__('Unable to set permissions'), E_USER_ERROR);
     }
     // Some assignments for the loop
     $lastGroupId = 0;
     $first = true;
     $view = 0;
     $edit = 0;
     $del = 0;
     // List of groupIds with view, edit and del assignments
     foreach ($groupIds as $groupPermission) {
         $groupPermission = explode('_', $groupPermission);
         $groupId = $groupPermission[0];
         if ($first) {
             // First time through
             $first = false;
             $lastGroupId = $groupId;
         }
         if ($groupId != $lastGroupId) {
             // The groupId has changed, so we need to write the current settings to the db.
             // Link new permissions
             if (!$security->Link($templateId, $lastGroupId, $view, $edit, $del)) {
                 trigger_error(__('Unable to set permissions'), E_USER_ERROR);
             }
             // Reset
             $lastGroupId = $groupId;
             $view = 0;
             $edit = 0;
             $del = 0;
         }
         switch ($groupPermission[1]) {
             case 'view':
                 $view = 1;
                 break;
             case 'edit':
                 $edit = 1;
                 break;
             case 'del':
                 $del = 1;
                 break;
         }
     }
     // Need to do the last one
     if (!$first) {
         if (!$security->Link($templateId, $lastGroupId, $view, $edit, $del)) {
             trigger_error(__('Unable to set permissions'), E_USER_ERROR);
         }
     }
     $response->SetFormSubmitResponse(__('Permissions Changed'));
     $response->Respond();
 }
Beispiel #20
0
 public function Delete()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error('Token does not match', E_USER_ERROR);
     }
     $db =& $this->db;
     $response = new ResponseManager();
     $helpId = Kit::GetParam('HelpID', _POST, _INT);
     // Deal with the Edit
     Kit::ClassLoader('help');
     $helpObject = new Help($db);
     if (!$helpObject->Delete($helpId)) {
         trigger_error($helpObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('Help Link Deleted'), false);
     $response->Respond();
 }
Beispiel #21
0
 /**
  * Shows information about Xibo
  * @return 
  */
 function About()
 {
     $response = new ResponseManager();
     Theme::Set('version', VERSION);
     // Render the Theme and output
     $output = Theme::RenderReturn('about_text');
     $response->SetFormRequestResponse($output, __('About'), '500', '500');
     $response->AddButton(__('Close'), 'XiboDialogClose()');
     $response->Respond();
 }
Beispiel #22
0
 /**
  * Permissions Edit
  */
 public function Permissions()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     Kit::ClassLoader('mediagroupsecurity');
     Kit::ClassLoader('layoutmediagroupsecurity');
     $layoutId = Kit::GetParam('layoutid', _POST, _INT);
     $regionId = Kit::GetParam('regionid', _POST, _STRING);
     $mediaId = Kit::GetParam('mediaid', _POST, _STRING);
     $groupIds = Kit::GetParam('groupids', _POST, _ARRAY);
     if (!$this->auth->modifyPermissions) {
         trigger_error(__('You do not have permissions to edit this layout'), E_USER_ERROR);
     }
     // Unlink all
     if ($this->assignedMedia) {
         $layoutMediaSecurity = new LayoutMediaGroupSecurity($db);
         if (!$layoutMediaSecurity->UnlinkAll($layoutId, $regionId, $mediaId)) {
             trigger_error(__('Unable to set permissions'));
         }
     } else {
         $mediaSecurity = new MediaGroupSecurity($db);
         if (!$mediaSecurity->UnlinkAll($mediaId)) {
             trigger_error(__('Unable to set permissions'));
         }
     }
     // Some assignments for the loop
     $lastGroupId = 0;
     $first = true;
     $view = 0;
     $edit = 0;
     $del = 0;
     // List of groupIds with view, edit and del assignments
     foreach ($groupIds as $groupPermission) {
         $groupPermission = explode('_', $groupPermission);
         $groupId = $groupPermission[0];
         if ($first) {
             // First time through
             $first = false;
             $lastGroupId = $groupId;
         }
         if ($groupId != $lastGroupId) {
             // The groupId has changed, so we need to write the current settings to the db.
             // Link new permissions
             if ($this->assignedMedia) {
                 if (!$layoutMediaSecurity->Link($layoutId, $regionId, $mediaId, $lastGroupId, $view, $edit, $del)) {
                     trigger_error(__('Unable to set permissions'));
                 }
             } else {
                 if (!$mediaSecurity->Link($mediaId, $lastGroupId, $view, $edit, $del)) {
                     trigger_error(__('Unable to set permissions'));
                 }
             }
             // Reset
             $lastGroupId = $groupId;
             $view = 0;
             $edit = 0;
             $del = 0;
         }
         switch ($groupPermission[1]) {
             case 'view':
                 $view = 1;
                 break;
             case 'edit':
                 $edit = 1;
                 break;
             case 'del':
                 $del = 1;
                 break;
         }
     }
     // Need to do the last one
     if (!$first) {
         if ($this->assignedMedia) {
             if (!$layoutMediaSecurity->Link($layoutId, $regionId, $mediaId, $lastGroupId, $view, $edit, $del)) {
                 trigger_error(__('Unable to set permissions'));
             }
         } else {
             if (!$mediaSecurity->Link($mediaId, $lastGroupId, $view, $edit, $del)) {
                 trigger_error(__('Unable to set permissions'));
             }
         }
     }
     $response->SetFormSubmitResponse(__('Permissions Changed'));
     return $response;
 }
Beispiel #23
0
 public function Edit()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error('Token does not match', E_USER_ERROR);
     }
     $db =& $this->db;
     $response = new ResponseManager();
     // Can we edit?
     if (Config::GetSetting('MODULE_CONFIG_LOCKED_CHECKB') == 'Checked') {
         trigger_error(__('Module Config Locked'), E_USER_ERROR);
     }
     $moduleId = Kit::GetParam('ModuleID', _POST, _INT);
     $validExtensions = Kit::GetParam('ValidExtensions', _POST, _STRING, '');
     $imageUri = Kit::GetParam('ImageUri', _POST, _STRING);
     $enabled = Kit::GetParam('Enabled', _POST, _CHECKBOX);
     $previewEnabled = Kit::GetParam('PreviewEnabled', _POST, _CHECKBOX);
     // Validation
     if ($moduleId == 0 || $moduleId == '') {
         trigger_error(__('Module ID is missing'), E_USER_ERROR);
     }
     if ($imageUri == '') {
         trigger_error(__('Image Uri is a required field.'), E_USER_ERROR);
     }
     // Deal with the Edit
     $SQL = "UPDATE `module` SET ImageUri = '%s', ValidExtensions = '%s', Enabled = %d, PreviewEnabled = %d WHERE ModuleID = %d";
     $SQL = sprintf($SQL, $db->escape_string($imageUri), $db->escape_string($validExtensions), $enabled, $previewEnabled, $moduleId);
     if (!$db->query($SQL)) {
         trigger_error($db->error());
         trigger_error(__('Unable to update module'), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('Module Edited'), false);
     $response->Respond();
 }
 /**
  * Deletes a Group
  * @return 
  */
 function Delete()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error('Token does not match', E_USER_ERROR);
     }
     $response = new ResponseManager();
     $displayProfile = new DisplayProfile();
     $displayProfile->displayProfileId = Kit::GetParam('displayprofileid', _POST, _INT);
     if (!$displayProfile->Load()) {
         trigger_error($displayProfile->GetErrorMessage(), E_USER_ERROR);
     }
     if ($this->user->usertypeid != 1 && $this->user->userid != $displayProfile->userId) {
         trigger_error(__('You do not have permission to edit this profile'), E_USER_ERROR);
     }
     if (!$displayProfile->Delete($displayProfile->displayProfileId)) {
         trigger_error($displayProfile->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('Display Profile Deleted'), false);
     $response->Respond();
 }
Beispiel #25
0
 function Delete()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error(__('Sorry the form has expired. Please refresh.'), E_USER_ERROR);
     }
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $resolutionID = Kit::GetParam('resolutionid', _POST, _INT);
     // Remove the resolution
     $resObject = new Resolution($db);
     if (!$resObject->Delete($resolutionID)) {
         trigger_error($resObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse('Resolution deleted');
     $response->Respond();
 }
Beispiel #26
0
 public function ImportCsv()
 {
     $db =& $this->db;
     $response = new ResponseManager();
     $dataSetId = Kit::GetParam('datasetid', _POST, _INT);
     $overwrite = Kit::GetParam('overwrite', _POST, _CHECKBOX);
     $ignorefirstrow = Kit::GetParam('ignorefirstrow', _POST, _CHECKBOX);
     $auth = $this->user->DataSetAuth($dataSetId, true);
     if (!$auth->edit) {
         trigger_error(__('Access Denied'), E_USER_ERROR);
     }
     // File data
     $tmpName = Kit::GetParam('hidFileID', _POST, _STRING);
     if ($tmpName == '') {
         trigger_error(__('Please ensure you have picked a file and it has finished uploading'), E_USER_ERROR);
     }
     // File name and extension (original name)
     $fileName = Kit::GetParam('txtFileName', _POST, _STRING);
     $fileName = basename($fileName);
     $ext = strtolower(substr(strrchr($fileName, "."), 1));
     // Check it is a CSV file
     if ($ext != 'csv') {
         trigger_error(__('Files with a CSV extension only.'), E_USER_ERROR);
     }
     // File upload directory.. get this from the settings object
     $csvFileLocation = Config::GetSetting('LIBRARY_LOCATION') . 'temp/' . $tmpName;
     // Enumerate over the columns in the DataSet and offer a column mapping for each one (from the file)
     $SQL = "";
     $SQL .= "SELECT DataSetColumnID ";
     $SQL .= "  FROM datasetcolumn ";
     $SQL .= sprintf(" WHERE DataSetID = %d ", $dataSetId);
     $SQL .= "   AND DataSetColumnTypeID = 1 ";
     $SQL .= "ORDER BY ColumnOrder ";
     // Load results into an array
     $dataSetColumns = $db->GetArray($SQL);
     if (!is_array($dataSetColumns)) {
         trigger_error($db->error());
         trigger_error(__('Error getting list of dataSetColumns'), E_USER_ERROR);
     }
     $spreadSheetMapping = array();
     foreach ($dataSetColumns as $row) {
         $dataSetColumnId = Kit::ValidateParam($row['DataSetColumnID'], _INT);
         $spreadSheetColumn = Kit::GetParam('csvImport_' . $dataSetColumnId, _POST, _INT);
         $spreadSheetMapping[$spreadSheetColumn - 1] = $dataSetColumnId;
     }
     $dataSetObject = new DataSetData($db);
     if (!$dataSetObject->ImportCsv($dataSetId, $csvFileLocation, $spreadSheetMapping, $overwrite == 1, $ignorefirstrow == 1)) {
         trigger_error($dataSetObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('CSV File Imported'));
     $response->Respond();
 }
Beispiel #27
0
 public function RequestScreenShot()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error(__('Sorry the form has expired. Please refresh.'), E_USER_ERROR);
     }
     $db =& $this->db;
     $response = new ResponseManager();
     $displayObject = new Display($db);
     $displayId = Kit::GetParam('displayId', _POST, _INT);
     if (!$displayObject->RequestScreenShot($displayId)) {
         trigger_error($displayObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('Request Sent.'));
     $response->Respond();
 }
Beispiel #28
0
 /**
  * Tidies up the library
  */
 public function tidyLibrary()
 {
     $response = new ResponseManager();
     if (Config::GetSetting('SETTING_LIBRARY_TIDY_ENABLED') != 1) {
         trigger_error(__('Sorry this function is disabled.'), E_USER_ERROR);
     }
     $media = new Media();
     if (!$media->deleteUnusedForUser($this->user->userid)) {
         trigger_error($media->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('Library Tidy Complete'));
     $response->Respond();
 }
Beispiel #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();
 }
Beispiel #30
0
 /**
  * Wake on LAN
  */
 public function WakeOnLan()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error('Token does not match', E_USER_ERROR);
     }
     $db =& $this->db;
     $response = new ResponseManager();
     $displayObject = new Display($db);
     $displayId = Kit::GetParam('DisplayId', _POST, _INT);
     if (!$displayObject->WakeOnLan($displayId)) {
         trigger_error($displayObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('Wake on Lan command sent.'));
     $response->Respond();
 }