Ejemplo n.º 1
0
 /**
  * Saves the report to a file
  * output path and filename should be set before calling this function
  * @param \GO\Projects2\Model\Project $project the project object
  * @return \GO\Files\Model\File
  */
 public function save()
 {
     $file = new \GO\Base\Fs\File($this->_outputPath . '/' . $this->filename . '.' . $this->fileExtension());
     $file->appendNumberToNameIfExists();
     $this->_outputPath = $file->path();
     $str = $this->render(true);
     if (!isset($this->_fp)) {
         $this->_fp = fopen($this->_outputPath, 'w+');
     }
     fputs($this->_fp, $str);
     $folder = \GO\Files\Model\Folder::model()->findByPath($file->parent()->stripFileStoragePath());
     $fileModel = $folder->addFile($file->name());
     return $fileModel;
 }