示例#1
0
 protected function getContent()
 {
     $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
     $selectBuilder->select->add('content');
     $selectBuilder->from->add(Gpf_Db_Table_FileContents::getName());
     $selectBuilder->where->add('fileid', '=', $this->file->getFileId());
     $selectBuilder->orderBy->add('contentid', true);
     $sth = $this->createDatabase()->execute($selectBuilder->toString());
     while ($row = $sth->fetchArray()) {
         echo $row['content'];
     }
     return '';
 }
 /**
  * Return file content from database
  *
  * @param string $fileId
  * @return string
  */
 public static function getFileContent($fileId)
 {
     $select = new Gpf_SqlBuilder_SelectBuilder();
     $select->select->add('content', 'content');
     $select->from->add(Gpf_Db_Table_FileContents::getName());
     $select->where->add('fileid', '=', $fileId);
     $select->orderBy->add('contentid');
     $resultSet = $select->getAllRows();
     $content = '';
     foreach ($resultSet as $result) {
         $content .= $result->get('content');
     }
     return $content;
 }
 /**
  * Print content of file to default output
  */
 private function downloadContent()
 {
     if ($this->printHeaders()) {
         $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
         $selectBuilder->select->add('content', 'content');
         $selectBuilder->from->add(Gpf_Db_Table_FileContents::getName());
         $selectBuilder->where->add('fileid', '=', $this->file->get('fileid'));
         $selectBuilder->orderBy->add('contentid', true);
         $contents = $selectBuilder->getAllRows();
         foreach ($contents as $contentRecord) {
             echo $contentRecord->get('content');
         }
         return true;
     }
     return false;
 }