Esempio n. 1
0
 public static function getAllAgents()
 {
     $agents = array();
     //$db = ZitDBAdapter::getDBAdapter();
     $db = Zend_Registry::get('my_db2');
     $agt = new Agents($db);
     $adminLevel = $_SESSION['ADMIN_LEVEL'];
     $adminId = $_SESSION['ADMIN_ID'];
     if ($adminLevel == Utility::$SUPER_ADMIN) {
         $select = $agt->select()->order('source_id');
     } else {
         $select = $agt->select()->where('admin_id = ' . $adminId)->order('source_id');
     }
     $result = $agt->fetchAll($select);
     foreach ($result as $row) {
         switch (DB_TYPE) {
             case 'mysql':
                 $agent = new Agent($row->agent_id);
                 break;
             case 'oci8':
                 $agent = new Agent($row->AGENT_ID);
                 break;
         }
         array_push($agents, $agent);
     }
     return $agents;
 }
Esempio n. 2
0
 public static function checkSourceId($sourceId)
 {
     $db = Zend_Registry::get('my_db');
     $agent = new Agents($db);
     $quote_sourceId = $db->quote($sourceId);
     $result = $agent->fetchAll("source_id = '" . $sourceId . "'");
     $count = $result->count();
     if ($count != 0) {
         return true;
     } else {
         return false;
     }
 }