本文整理匯總了PHP中Display::WakeOnLan方法的典型用法代碼示例。如果您正苦於以下問題:PHP Display::WakeOnLan方法的具體用法?PHP Display::WakeOnLan怎麽用?PHP Display::WakeOnLan使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Display
的用法示例。
在下文中一共展示了Display::WakeOnLan方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: DisplayWakeOnLan
/**
* 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));
}
示例2: WakeOnLan
/**
* Wake on LAN
*/
public function WakeOnLan()
{
// 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->WakeOnLan($displayId)) {
trigger_error($displayObject->GetErrorMessage(), E_USER_ERROR);
}
$response->SetFormSubmitResponse(__('Wake on Lan command sent.'));
$response->Respond();
}
示例3: foreach
$sth = $dbh->prepare('SELECT DisplayID, Display, WakeOnLanTime, LastWakeOnLanCommandSent FROM `display` WHERE WakeOnLan = 1');
$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());