public function GetPushStatus($zoneId, $contextId = 1) { $this->lastStart = null; $this->lastStop = null; $this->pushRunning = null; $this->sleepTimeSeconds = null; try { $db = ZitDBAdapter::getDBAdapter(); } catch (Zend_Exception $e) { echo $e; } $query = "select \r\n\t\t\t\t\t" . DBConvertor::convertDateFormat('last_start', 'm-dd-yyyy-t', 'last_start') . ",\r\n\t\t\t\t\t" . DBConvertor::convertDateFormat('last_stop', 'm-dd-yyyy-t', 'last_stop') . ",\r\n\t\t\t\t\t sleep_time_seconds, push_running\r\n\t\t\t\t from " . DBConvertor::convertCase('push_handler') . " where zone_id = {$zoneId} and context_id = {$contextId}"; $result = $db->fetchAll($query); foreach ($result as $row) { switch (DB_TYPE) { case 'mysql': $this->lastStart = $row->last_start; $this->lastStop = $row->last_stop; $this->pushRunning = $row->push_running; $this->sleepTimeSeconds = $row->sleep_time_seconds; break; case 'oci8': $this->lastStart = $row->LAST_START; $this->lastStop = $row->LAST_STOP; $this->pushRunning = $row->PUSH_RUNNING; $this->sleepTimeSeconds = $row->SLEEP_TIME_SECONDS; break; } } }
public function ZitAdmin($id) { $this->id = $id; $db = Zend_Registry::get('my_db2'); $sql = "select\r\n\t\t\t\ta.first_name,\r\n\t\t\t\ta.active,\r\n\t\t\t\ta.admin_password,\r\n\t\t\t\tl.level_desc,\r\n\t\t\t\ta.admin_level_id,\r\n\t\t\t\t" . DBConvertor::convertDateFormat('a.last_login', 'm-dd-yyyy-t', 'last_login') . ",\r\n\t\t\t\ta.last_name,\r\n\t\t\t\ta.email,\r\n\t\t\t\ta.admin_username\r\n\t\t\t\tfrom\r\n\t\t\t\t" . DBConvertor::convertCase('zit_admin') . " a,\r\n\t\t\t\t" . DBConvertor::convertCase('admin_level') . " l\r\n\t\t\t\twhere a.admin_level_id = l.level_id and a.admin_id = {$id}"; $result = $db->fetchAll($sql); foreach ($result as $row) { switch (DB_TYPE) { case 'mysql': $this->username = $row->admin_username; $this->fName = $row->first_name; $this->lName = $row->last_name; $this->email = $row->email; $this->password = $row->admin_password; $this->adminLevel = $row->level_desc; $this->adminLevelId = $row->admin_level_id; $this->lastLogin = $row->last_login; $this->active = $row->active; break; case 'oci8': $this->username = $row->ADMIN_USERNAME; $this->fName = $row->FIRST_NAME; $this->lName = $row->LAST_NAME; $this->email = $row->EMAIL; $this->password = $row->ADMIN_PASSWORD; $this->adminLevel = $row->LEVEL_DESC; $this->adminLevelId = $row->ADMIN_LEVEL_ID; $this->lastLogin = $row->LAST_LOGIN; $this->active = $row->ACTIVE; break; } } }
public static function getErrorMessages() { //$db = ZitDBAdapter::getDBAdapter(); $db = Zend_Registry::get('my_db'); $errorMessages = array(); $select = $db->select()->from(array(DBConvertor::convertCase('l') => DBConvertor::convertCase('error_log')), array(DBConvertor::convertCase('error_timestamp') => DBConvertor::convertDateFormat(DBConvertor::convertCase('l.error_timestamp'), 'm-dd-yyyy-t', DBConvertor::convertCase('error_timestamp')), DBConvertor::convertCase('l.error_location'), DBConvertor::convertCase('l.short_error_desc'), DBConvertor::convertCase('l.long_error_desc'), DBConvertor::convertCase('l.error_id')))->joinLeft(array(DBConvertor::convertCase('a') => DBConvertor::convertCase('agent')), DBConvertor::convertCase('a.agent_id') . ' = ' . DBConvertor::convertCase('l.agent_id'), array(DBConvertor::convertCase('agent_name')))->joinLeft(array(DBConvertor::convertCase('z') => DBConvertor::convertCase('zones')), DBConvertor::convertCase('z.zone_id') . ' = ' . DBConvertor::convertCase('l.zone_id'), array(DBConvertor::convertCase('zone_desc')))->order(array(DBConvertor::convertCase(DBConvertor::convertCase('error_timestamp DESC'))))->where('l.archived = 0')->limit(100, 0); $stmt = $select->query(); $result = $stmt->fetchAll(); foreach ($result as $row) { switch (DB_TYPE) { case 'mysql': $zel = new ZitErrorLog($row->error_id, isset($row->agent_name) ? $row->agent_name : 'N/A', $row->zone_desc, $row->error_timestamp, $row->error_location, $row->short_error_desc, isset($row->long_error_desc) ? $row->long_error_desc : ''); break; case 'oci8': $longErrorXML = $row->LONG_ERROR_DESC; $longErrorDesc = $longErrorXML->read($longErrorXML->size()); $zel = new ZitErrorLog($row->ERROR_ID, isset($row->AGENT_NAME) ? $row->AGENT_NAME : '', $row->ZONE_DESC, isset($row->ERROR_TIMESTAMP) ? $row->ERROR_TIMESTAMP : 'N/A', $row->ERROR_LOCATION, $row->SHORT_ERROR_DESC, isset($longErrorDesc) ? $longErrorDesc : ''); break; } array_push($errorMessages, $zel); } return $errorMessages; }
public function getObjectsSubscribing($zoneId) { //$db = ZitDBAdapter::getDBAdapter(); $db = Zend_Registry::get('my_db'); $query = "select\r\n o.object_name,\r\n " . DBConvertor::convertDateFormat('s.subscribe_timestamp', 'm-dd-yyyy-t', 'subscribe_timestamp') . "\r\n from\r\n " . DBConvertor::convertCase('agent_subscriptions') . " s,\r\n " . DBConvertor::convertCase('data_object') . " o\r\n where\r\n o.object_id = s.object_type_id\r\n and agent_id = {$this->agentId}\r\n and zone_id = {$zoneId}"; $result = $db->fetchAll($query); foreach ($result as $row) { switch (DB_TYPE) { case 'mysql': $subscribeObject = new SubscribeObject($row->object_name, $row->subscribe_timestamp); break; case 'oci8': $subscribeObject = new SubscribeObject($row->OBJECT_NAME, $row->SUBSCRIBE_TIMESTAMP); break; } array_push($this->subscribing, $subscribeObject); } }
public function getLogEntries($zitLogType) { $db = Zend_Registry::get('my_db2'); $messages = array(); $select = $db->select()->from(array(DBConvertor::convertCase('l') => DBConvertor::convertCase('zit_log')), array(DBConvertor::convertCase('create_timestamp') => DBConvertor::convertDateFormat(DBConvertor::convertCase('l.create_timestamp'), 'm-dd-yyyy-t', DBConvertor::convertCase('create_timestamp')), DBConvertor::convertCase('l.log_id')))->join(array(DBConvertor::convertCase('a') => DBConvertor::convertCase('agent')), DBConvertor::convertCase('a.agent_id') . ' = ' . DBConvertor::convertCase('l.agent_id') . ' and ' . DBConvertor::convertCase('l.zone_id') . ' = ' . $this->zoneId, array(DBConvertor::convertCase('agent_name')))->join(array(DBConvertor::convertCase('mt') => DBConvertor::convertCase('sif_message_type')), DBConvertor::convertCase('l.sif_message_type_id') . ' = ' . DBConvertor::convertCase('mt.sif_message_type_id'), array(DBConvertor::convertCase('sif_message_type_desc')))->where('l.log_message_type_id = ?', $zitLogType)->where('l.archived = 0')->order(array(DBConvertor::convertCase('create_timestamp DESC')))->limit(100, 0); $stmt = $select->query(); $result = $stmt->fetchAll(); foreach ($result as $row) { switch (DB_TYPE) { case 'mysql': $zle = new ZitLogEntry($row->log_id, isset($row->create_timestamp) ? $row->create_timestamp : null, $row->agent_name, $row->sif_message_type_desc); // $zle = new ZitLogEntry($row->log_id, null, null, $row->rec_xml, $row->sent_xml, isset($row->create_timestamp) ? $row->create_timestamp : null, $row->agent_name, $row->sif_message_type_desc); break; case 'oci8': //$rec_xml = $row->REC_XML; //$sent_xml = $row->SENT_XML; $zle = new ZitLogEntry($row->LOG_ID, isset($row->CREATE_TIMESTAMP) ? $row->CREATE_TIMESTAMP : 'N/A', $row->AGENT_NAME, $row->SIF_MESSAGE_TYPE_DESC); // $zle = new ZitLogEntry($rec_xml->read($rec_xml->size()), $sent_xml->read($sent_xml->size()), isset($row->CREATE_TIMESTAMP) ? $row->CREATE_TIMESTAMP : 'N/A', $row->AGENT_NAME, $row->SIF_MESSAGE_TYPE_DESC); break; } array_push($messages, $zle); } return $messages; }