Example #1
0
 function Search($indexedbyid = false, $loose = false)
 {
     global $dbh;
     // Store any values that have been added before we make them safe
     foreach ($this as $prop => $val) {
         if (isset($val)) {
             $o[$prop] = $val;
         }
     }
     // Make everything safe for us to search with
     $this->MakeSafe();
     // This will store all our extended sql
     $sqlextend = "";
     foreach ($o as $prop => $val) {
         extendsql($prop, $this->{$prop}, $sqlextend, $loose);
     }
     $sql = "SELECT * FROM fac_Ports {$sqlextend} ORDER BY DeviceID, PortNumber ASC;";
     $portList = array();
     foreach ($dbh->query($sql) as $portRow) {
         if ($indexedbyid) {
             $portList[$portRow["DeviceID"] . $portRow["PortNumber"]] = DevicePorts::RowToObject($portRow);
         } else {
             $portList[] = DevicePorts::RowToObject($portRow);
         }
     }
     return $portList;
 }
Example #2
0
 function Search($indexedbyid = false, $loose = false)
 {
     // Store the value of devicetype before we muck with it
     $os = $this->NumberScheme;
     // Make everything safe for us to search with
     $this->MakeSafe();
     // This will store all our extended sql
     $sqlextend = "";
     foreach ($this as $prop => $val) {
         // We force NumberScheme to a known value so this is to check if they wanted to search for the default
         if ($prop == "NumberScheme" && $val == "Sequential" && $os != "Sequential") {
             continue;
         }
         if ($val) {
             extendsql($prop, $val, $sqlextend, $loose);
         }
     }
     $sql = "SELECT * FROM fac_PowerPanel {$sqlextend} ORDER BY PanelLabel ASC;";
     $panelList = array();
     foreach ($this->query($sql) as $row) {
         if ($indexedbyid) {
             $panelList[$deviceRow["DeviceID"]] = PowerPanel::RowToObject($row);
         } else {
             $panelList[] = PowerPanel::RowToObject($row);
         }
     }
     return $panelList;
 }
Example #3
0
 function Search($num_rec_per_page = 0, $page = 1)
 {
     $this->MakeSafe();
     // This will store all our extended sql
     $sqlextend = "";
     foreach ($this as $prop => $val) {
         if ($val && $val != date("Y-m-d", strtotime(0))) {
             extendsql($prop, $val, $sqlextend, true);
         }
     }
     $sqlextend .= " ORDER BY Time DESC";
     // Make sure someone didn't do something crazy with the input
     $page = intval($page);
     $num_rec_per_page = intval($num_rec_per_page);
     if ($page && $num_rec_per_page) {
         $start_from = ($page - 1) * $num_rec_per_page;
         $sqlextend .= " LIMIT {$start_from}, {$num_rec_per_page}";
     }
     $sql = "SELECT * FROM fac_GenericLog{$sqlextend};";
     $events = array();
     foreach ($this->query($sql) as $dbRow) {
         $events[] = LogActions::RowToObject($dbRow);
     }
     return $events;
 }
Example #4
0
 function Search($indexedbyid = false, $loose = false)
 {
     $o = array();
     // Store any values that have been added before we make them safe
     foreach ($this as $prop => $val) {
         if (isset($val)) {
             $o[$prop] = $val;
         }
     }
     // Make everything safe for us to search with
     $this->MakeSafe();
     // This will store all our extended sql
     $sqlextend = "";
     foreach ($o as $prop => $val) {
         extendsql($prop, $this->{$prop}, $sqlextend, $loose);
     }
     $sql = "SELECT * FROM fac_People {$sqlextend} ORDER BY LastName ASC, FirstName ASC;";
     $peopleList = array();
     foreach ($this->query($sql) as $peopleRow) {
         if ($indexedbyid) {
             $peopleList[$peopleRow["PersonID"]] = People::RowToObject($peopleRow);
         } else {
             $peopleList[] = People::RowToObject($peopleRow);
         }
     }
     return $peopleList;
 }
Example #5
0
 function Search($indexedbyid = false, $loose = false)
 {
     $o = new stdClass();
     // Store any values that have been added before we make them safe
     foreach ($this as $prop => $val) {
         if (isset($val)) {
             $o->{$prop} = $val;
         }
     }
     // Make everything safe for us to search with
     $this->MakeSafe();
     // This will store all our extended sql
     $sqlextend = "";
     foreach ($o as $prop => $val) {
         extendsql($prop, $this->{$prop}, $sqlextend, $loose);
     }
     // The join is purely to sort the templates by the manufacturer's name
     $sql = "SELECT * FROM fac_CabRow {$sqlextend} ORDER BY Name ASC;";
     $rowList = array();
     foreach ($this->query($sql) as $row) {
         if ($indexedbyid) {
             $rowList[$row["CabRowID"]] = CabRow::RowToObject($row);
         } else {
             $rowList[] = CabRow::RowToObject($row);
         }
     }
     return $rowList;
 }