예제 #1
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;
 }