Exemple #1
0
 function Select($p_oSession)
 {
     $this->m_nError = $this->m_nDBO_OK;
     $bFirst = true;
     $this->m_bBof = true;
     $this->m_bEof = true;
     if ($p_oSession->GetFileRead()) {
         $oFile = @fopen($p_oSession->GetDatabase() . $this->m_sTABLE_NAME . ".dat", "r");
         if ($oFile == 0) {
             $this->m_nError = $this->m_nDBO_BAD_READ_FILE;
             $this->m_sErrorInfo = $this->m_sTABLE_NAME . ".dat";
             return false;
         }
         while (!feof($oFile)) {
             if ($this->ReadRecord($oFile, $p_oSession, $sData)) {
                 if ($this->MatchCriteria($sData, false)) {
                     if ($bFirst) {
                         $this->m_oTable = array();
                         $bFirst = false;
                         $this->m_bBof = false;
                         $this->m_bEof = false;
                     }
                     $oObj = new CRowtblconfig();
                     if ($sData[0] != "") {
                         $oObj->SetConfigId($sData[0]);
                     }
                     if ($sData[1] != "") {
                         $oObj->SetParam($sData[1]);
                     }
                     if ($sData[2] != "") {
                         $oObj->SetValue($sData[2]);
                     }
                     if ($sData[3] != "") {
                         $oObj->SetDescription($sData[3]);
                     }
                     if ($sData[4] != "") {
                         $oObj->SetModifiable($sData[4]);
                     }
                     array_push($this->m_oTable, $oObj);
                 }
             }
         }
         if (!$bFirst) {
             reset($this->m_oTable);
             $oRow = current($this->m_oTable);
             if ($sData[0] != "") {
                 $this->m_nConfigId = $oRow->GetConfigId();
             }
             if ($sData[1] != "") {
                 $this->m_sParam = $oRow->GetParam();
             }
             if ($sData[2] != "") {
                 $this->m_sValue = $oRow->GetValue();
             }
             if ($sData[3] != "") {
                 $this->m_sDescription = $oRow->GetDescription();
             }
             if ($sData[4] != "") {
                 $this->m_bModifiable = $oRow->GetModifiable();
             }
         }
         fclose($oFile);
     } else {
         $sSql = "SELECT * FROM " . $this->m_sTABLE_NAME;
         if ($this->GenerateWhereClause($p_oSession, false, $sWhere)) {
             $sSql .= $sWhere;
         } else {
             $this->m_nError = $this->m_nDBO_DATATYPE;
             $this->m_sErrorInfo = $sWhere;
             return false;
         }
         if (strlen($this->m_sSortBy)) {
             $sSql .= " ORDER BY " . $this->m_sSortBy;
         }
         if ($this->m_nFromRecord != 0) {
             $sSql .= " LIMIT " . $this->m_nFromRecord . "," . $this->m_nMaxRecords;
         } else {
             if ($this->m_nMaxRecords != -1) {
                 $sSql .= " LIMIT " . $this->m_nMaxRecords;
             }
         }
         if (!$this->CheckSession($p_oSession)) {
             $this->m_nError = $this->m_nDBO_BAD_SESSION;
             return false;
         } else {
             if (!($oResult = mysql_query($sSql, $p_oSession->GetLink()))) {
                 $this->m_nError = $this->m_nDBO_SELECT_FAILURE;
                 $this->m_sErrorInfo = mysql_error() . ":" . $sSql;
                 return false;
             } else {
                 while ($oRow = mysql_fetch_object($oResult)) {
                     $oObj = new CRowtblconfig();
                     if ($bFirst) {
                         $this->m_oTable = array();
                         if (!is_null($oRow->ConfigId)) {
                             $this->m_nConfigId = $oRow->ConfigId;
                         }
                         if (!is_null($oRow->Param)) {
                             $this->m_sParam = $oRow->Param;
                         }
                         if (!is_null($oRow->Value)) {
                             $this->m_sValue = $oRow->Value;
                         }
                         if (!is_null($oRow->Description)) {
                             $this->m_sDescription = $oRow->Description;
                         }
                         if (!is_null($oRow->Modifiable)) {
                             $this->m_bModifiable = $oRow->Modifiable;
                         }
                         $bFirst = false;
                         $this->m_bBof = false;
                         $this->m_bEof = false;
                     }
                     if (!is_null($oRow->ConfigId)) {
                         $oObj->SetConfigId($oRow->ConfigId);
                     }
                     if (!is_null($oRow->Param)) {
                         $oObj->SetParam($oRow->Param);
                     }
                     if (!is_null($oRow->Value)) {
                         $oObj->SetValue($oRow->Value);
                     }
                     if (!is_null($oRow->Description)) {
                         $oObj->SetDescription($oRow->Description);
                     }
                     if (!is_null($oRow->Modifiable)) {
                         $oObj->SetModifiable($oRow->Modifiable);
                     }
                     array_push($this->m_oTable, $oObj);
                 }
                 mysql_free_result($oResult);
             }
         }
     }
     return true;
 }
Exemple #2
0
                if ($oCompleted->GetSuccess() == 5) {
                    $sXML .= $oCompleted->GetOutXML();
                } else {
                    $bError = true;
                    $sXML .= $oCompleted->GetOutXML();
                    $sMessage .= $sXML;
                    $sXML = "";
                }
            }
            $oCompleted->MoveNext();
        }
    }
}
if ($nCommandGroup == $nConfEdit) {
    $oConfig = new CRowtblconfig();
    $oConfig->SetParam("ZONES");
    $oConfig->Select($oSession);
    $sZones = $oConfig->GetValue();
    $oConfig->Clear();
    $oConfig->SetParam("TIMEOUT");
    $oConfig->Select($oSession);
    $nTimeout = $oConfig->GetValue() / 1000;
    $_SESSION["timeout"] = $nTimeout;
    $_SESSION["zones"] = $sZones;
}
$sHeader = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
if ($sFormat == "xslt") {
    $sHeader .= "<?xml-stylesheet type=\"text/xsl\" href=\"heating_" . $sTrans . ".xsl\" ?>";
}
$sHeader .= "<" . $sRootTag . " current=\"" . $nCommandGroup . "\" home=\"" . $nHome . "\" polledit=\"" . $nPollEdit . "\" alertedit=\"" . $nAlertEdit . "\" conditionedit=\"" . $nCondEdit . "\" commandedit=\"" . $nCmdEdit . "\">";
if (!$bError) {