public function recentAlarms() { $sql = <<<SQL SELECT * FROM tblModJackAlert WHERE fldStatus='new' ORDER BY fldTimeStamp LIMIT 50 SQL; $html = '<h2>Recent Alerts</h2>'; $tab = new DBTable(DB::DEF, $sql, null, DB::FETCH_ASSOC); if ($tab->isEmpty()) { $html .= "There are no alerts at the moment"; } else { $html .= Tag::table() . Tag::tr() . Tag::th() . 'Type' . Tag::_th() . Tag::th() . 'Description' . Tag::_th() . Tag::th() . 'Time' . Tag::_th() . Tag::th() . 'Actions' . Tag::_th() . Tag::_tr(); $resp = MenuUtils::responseObject()->action(__CLASS__ . '->recentAlarmsAck()'); foreach ($tab as $row) { $style = ['class' => $row['fldType'] . '_row']; $html .= Tag::tr($style) . Tag::td($style) . Tag::e($row['fldType']) . Tag::_td() . Tag::td($style) . Tag::e($row['fldDescription']) . Tag::_td() . Tag::td($style) . Tag::e($row['fldTimeStamp']) . Tag::_td() . Tag::td($style) . Tag::linkButton('?' . $resp->set('fldModJackAlertID', $row['fldModJackAlertID'])->toUrl(), 'Ack') . Tag::_td() . Tag::_tr(); } $html .= Tag::_table(); } return $html; }
/** Function to load the user Group details * @returns boolean * @private */ function _loadGroupTable() { // Load the first group because it is the Global Group $sql = DB::limit("SELECT * FROM tblGroup", 0, 1); $tab = new DBTable(DB::DEF, $sql, null, DB::FETCH_ASSOC); if ($tab->isEmpty()) { return false; } $fldGroup = []; $fldGroup[$tab->getValue("fldGroupID")] = $tab->getValue("fldName"); // get the groups that are related to this client $sql = "SELECT g.* FROM tblGroup g, tblUserGroupMap map " . "WHERE map.fldUserID='" . $this->prefs->get("fldIserID") . "' " . "AND map.fldGroupID=g.fldGroupID "; $tab = new DBTable(DB::DEF, $sql, null, DB::FETCH_ASSOC); if (!$tab->isEmpty()) { for ($i = 0; $i < $tab->getRowCount(); $i++) { $fldGroup[$tab->getValue("fldGroupID", $i)] = $tab->getValue("fldName", $i); } } $this->prefs->put("fldGroup", $fldGroup); // return true/success return TRUE; }
private static function getPriviliageIDs($action) { $sql = 'SELECT fldSecPrivilegesID FROM tblSecPrivileges WHERE ? LIKE fldAction'; $tab = new DBTable(DB::DEF, $sql, $action, DB::FETCH_NUM); if ($tab->isEmpty()) { return false; } return $tab->getColumn(0); }