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; }
protected function getDisplayName() { $name = G::get('fldFirstName') . ' ' . G::get('fldLastName'); if (G::isLoggedIn() && G::accessLevel(Privileges::getSecurityLevel('SITE ADMIN'))) { $uName = Tag::hRef('superadmin.php', $name, ['class' => 'admin']); } else { $uName = Tag::e($name); } return $uName; }
private function renderValue($rowIdx, $colName, $value) { $html = ''; $name = $this->gridTag . '[' . $rowIdx . '][' . $colName . ']'; $autoUpdateJS = "autoUpdate({$rowIdx},'{$this->updTag}','{$this->delTag}','{$this->submitId}');"; $id = $this->gridTag . '_' . $rowIdx . '_' . $colName; $updClickAttrib = ['onClick' => $autoUpdateJS, 'id' => $id]; $updCheckAttrib = ['onChange' => $autoUpdateJS, 'id' => $id]; $type = $this->getColumnType($colName); switch ($type) { case self::NONE: break; case self::DISPLAY: $html .= $value == '' ? ' ' : Tag::e($value); break; case self::HIDDEN: $this->resp->set($name, $value); break; case self::RADIO: $dispList = isset($this->displayType[$colName][1]) ? $this->displayType[$colName][1] : null; $updCheckAttrib['default'] = $value; $html .= Tag::table() . Tag::tr() . Tag::td(['nowrap' => 'nowrap']) . implode(Tag::_td() . Tag::td(['nowrap' => 'nowrap']), Lists::radio($name, $dispList, $updCheckAttrib)) . Tag::_td() . Tag::_tr() . Tag::_table(); break; case self::SELECT: $dispList = isset($this->displayType[$colName][1]) ? $this->displayType[$colName][1] : null; $blankLine = isset($this->displayType[$colName][2]) ? $this->displayType[$colName][2] : false; $updCheckAttrib['default'] = $value; $updCheckAttrib['hasBlank'] = $blankLine; $html .= Lists::select($name, $dispList, $updCheckAttrib); break; case self::CHECKBOX: $checkValue = isset($this->displayType[$colName][1]) ? $this->displayType[$colName][1] : 'YES'; $html .= Tag::checkBox($name, $checkValue, $value == $checkValue, $updClickAttrib); break; case self::TIMESTAMP: $attribs = array_merge($updCheckAttrib, $this->cellAttributes[$colName]); $attribs['value'] = strftime('%Y-%m-%d %H:%M:%S', (int) $value); $attribs['size'] = strlen($attribs['value']) + 1; $html .= Tag::text($name, $attribs); break; case self::ENCTEXT: $value = Cryptography::de((string) $value); // Fall through to output text field // Fall through to output text field case self::TEXT: default: $updCheckAttrib['value'] = (string) $value; $html .= Tag::text($name, array_merge($updCheckAttrib, $this->cellAttributes[$colName])); break; } if (!in_array($type, [self::HIDDEN, self::NONE])) { $html = Tag::td() . $html . Tag::_td(); } return $html; }
public function manageUsersToGroups() { $key = Request::get('KEY'); if ($key == '') { return 'KEY missing'; } $userSql = DB::driver() == DB::MYSQL ? self::USER_SQL_MYSQL : self::USER_SQL_SQLITE; $row = DB::oneRow(DB::DEF, 'SELECT * FROM tblGroup WHERE fldGroupID=?', $key); return Tag::hTag('h4') . Tag::e('Editing Users in ' . $row['fldName'] . '(' . $row['fldLongName'] . ')') . Tag::_hTag('h4') . CRUD::factory('tblUserGroupMap', ['topPager' => false, 'where' => ['fldGroupID' => $key]])->setColDisplay('fldUserID', [CRUD::SELECT, $userSql, true])->setColDisplay('fldGroupID', CRUD::DISPLAY)->copyVarsFromRequest('KEY')->index(); }