/**
  * export Comments for a specified page
  * 	
  * @param IExporter $exporter exporter to be used
  * @param String fields to be exported separated by comma
  * @param String orderClause to be used in selecting records
  */
 function export($exporter, $fields = null, $orderClause = null)
 {
     $whereClause = "";
     $whereFromFilter = $exporter->getFilter()->getSqlFilterClause();
     if ($whereFromFilter != null) {
         $whereClause = "WHERE " . $whereFromFilter;
     }
     $db = new RecordSet($this->dbConnectionInfo);
     $select = "*";
     if ($fields != null) {
         //$select=Utils::arrayToString($fields,",");
         $select = $fields;
     }
     $sql = "SELECT " . $select . " FROM " . $this->tableName . " " . $whereClause;
     if ($orderClause != null) {
         $sql .= " " . $orderClause;
     }
     $sql .= ";";
     if ($db->Open($sql)) {
         $rowArray = $db->getAssoc();
         while ($rowArray) {
             if (is_array($rowArray)) {
                 $exporter->exportRow($rowArray);
             }
             $rowArray = $db->getAssoc();
         }
     }
     $db->Close();
 }
Example #2
0
 /**
  * export Comments for a specified page
  * @param array $info exporting information
  * @param IExporter $exporter exporter to be used
  */
 function exportForPage($info, $exporter, $fields = null)
 {
     $toReturn = "";
     $whereClause = " WHERE ";
     if ($info["filter_version"] != "" && $info["filter_product"] != "") {
         $whereClause .= " version='" . $info["filter_version"] . "' AND product='" . $info["filter_product"] . "'";
     } else {
         $whereClause = "";
     }
     if ($this->isLoggedModerator()) {
         $db = new RecordSet($this->dbConnectionInfo);
         $select = "*";
         if ($fields != null) {
             $select = Utils::arrayToString($fields, ",");
         }
         $sql = "SELECT " . $select . " FROM comments " . $whereClause . " ORDER BY date DESC";
         if ($db->Open($sql)) {
             $rowArray = $db->getAssoc();
             while ($rowArray) {
                 if (is_array($rowArray)) {
                     $exporter->exportRow($rowArray);
                 }
                 $rowArray = $db->getAssoc();
             }
         }
         $db->Close();
     } else {
         $exporter->exportRow(array('ERROR' => 'Your user rights does not permit this opperation!'));
     }
 }