Esempio n. 1
0
 public static function getMonitors()
 {
     $monitors = array();
     $mrows = $GLOBALS['PW_DB']->executeSelect('*', 'monitors', '');
     foreach ($mrows as $m) {
         $monitors[] = Monitor::fetch($m);
     }
     return $monitors;
 }
Esempio n. 2
0
 public static function checkAll()
 {
     $monitors = $GLOBALS['PW_DB']->executeSelect('*', 'monitors', '');
     foreach ($monitors as $mrow) {
         $monitor = Monitor::fetch($mrow);
         $up = $monitor->poll();
         echo $monitor->getAlias(), $up;
         $monitor->saveToDb();
     }
 }
Esempio n. 3
0
 public function processDelete($data)
 {
     $this->customProcessDelete();
     $mons = $GLOBALS['PW_DB']->executeSelect('*', 'monitors', 'WHERE ' . intval($this->id) . ' IN
         (notification_channels)');
     foreach ($mons as $mon) {
         $mhandle = Monitor::fetch($mon);
         $mhandle->deleteChannel($mhandle);
         $mhandle->saveToDb();
     }
     $GLOBALS['PW_DB']->executeDelete('channels', 'WHERE id=' . intval($this->id));
 }
Esempio n. 4
0
<?php

$monitor = Monitor::fetch(intval($_GET['id']));
if (FormHelpers::donePOST()) {
    $monitor->processDelete($_GET);
    ?>
<div class="message">
    The monitor has been deleted. <br />
    <a href="?page=monitors">Return to monitors</a>
</div>
        <?
    }
    else
    {
?>
<div class="form-field">
</div>
<?php 
    FormHelpers::startForm('POST', '?page=monitor-delete&id=' . $monitor->getId());
    FormHelpers::createHidden('confirmed', '1');
    ?>
<center>
    Are you sure you want to delete this monitor?<br />
    <?php 
    FormHelpers::createSubmit('Yes');
    ?>
</center>
<?php 
    FormHelpers::endForm();
}
Esempio n. 5
0
<?php

if (intval($_GET['query'])) {
    $m = Monitor::fetch(intval($_GET['query']));
    $m->poll();
    $m->saveToDb();
}
?>
<div class="menu">
    <ul class="page-menu">
        <li>
            <?php 
FormHelpers::startForm('GET', '?page=monitor');
FormHelpers::createHidden('page', 'monitor');
?>
            <?php 
$options = array();
foreach ($GLOBALS['monitor_types'] as $type) {
    $o = new $type();
    $options[] = FormHelpers::getOption($o->getName(), $type);
}
FormHelpers::createSelect('type', $options);
FormHelpers::createSubmit('New Monitor');
?>
            <?php 
FormHelpers::endForm();
?>
        </li>
    </ul>
        Display: <a href="?page=monitors">Expand All</a> - <a href="?page=monitors&expand=none">Collapse All</a>
</div>