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(); }
/** * Display Wake On LAN * @return <XiboAPIResponse> */ public function DisplayWakeOnLan() { if (!$this->user->PageAuth('display')) { return $this->Error(1, 'Access Denied'); } Kit::ClassLoader('Display'); $displayObject = new Display(); $displayId = $this->GetParam('displayId', _INT); // Try to issue the WOL command if (!$displayObject->WakeOnLan($displayId)) { return $this->Error($displayObject->GetErrorNumber(), $displayObject->GetErrorMessage()); } // Return True return $this->Respond($this->ReturnId('success', true)); }
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(); }
$sth->execute(array()); foreach ($sth->fetchAll() as $row) { $displayId = Kit::ValidateParam($row['DisplayID'], _INT); $display = Kit::ValidateParam($row['Display'], _STRING); $wakeOnLanTime = Kit::ValidateParam($row['WakeOnLanTime'], _STRING); $lastWakeOnLan = Kit::ValidateParam($row['LastWakeOnLanCommandSent'], _INT); // Time to WOL (with respect to today) $timeToWake = strtotime(date('Y-m-d') . ' ' . $wakeOnLanTime); $timeNow = time(); // Should the display be awake? if ($timeNow >= $timeToWake) { // Client should be awake, so has this displays WOL time been passed if ($lastWakeOnLan < $timeToWake) { // Call the Wake On Lan method of the display object if (!$displayObject->WakeOnLan($displayId)) { print $display . ':Error=' . $displayObject->GetErrorMessage() . '<br/>\\n'; } else { print $display . ':Sent WOL Message. Previous WOL send time: ' . date('Y-m-d H:i:s', $lastWakeOnLan) . '<br/>\\n'; } } else { print $display . ':Display already awake. Previous WOL send time: ' . date('Y-m-d H:i:s', $lastWakeOnLan) . '<br/>\\n'; } } else { print $display . ':Sleeping<br/>\\n'; } print $display . ':N/A<br/>\\n'; } print __('Done.'); } catch (Exception $e) { Debug::LogEntry('error', $e->getMessage()); }
/** * 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(); }