本文整理汇总了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());