예제 #1
0
파일: list.php 프로젝트: pascal26/fabrik
 /**
  * If not loaded this loads in the table's form model
  * also binds a reference of the table to the form.
  *
  * @return  FabrikFEModelForm	form model with form table loaded
  */
 public function &getFormModel()
 {
     if (!isset($this->formModel)) {
         $this->formModel = JModelLegacy::getInstance('Form', 'FabrikFEModel');
         $table = $this->getTable();
         $this->formModel->setId($table->form_id);
         $this->formModel->getForm();
         $this->formModel->setListModel($this);
     }
     return $this->formModel;
 }
예제 #2
0
파일: group.php 프로젝트: glauberm/cinevi
 /**
  * Get the groups form model
  *
  * @return FabrikFEModelForm form model
  */
 public function getFormModel()
 {
     if (!isset($this->form)) {
         $formIds = $this->getFormsIamIn();
         $formId = empty($formIds) ? 0 : $formIds[0];
         $this->form = JModelLegacy::getInstance('Form', 'FabrikFEModel');
         $this->form->setId($formId);
         $this->form->getForm();
         $this->form->getlistModel();
     }
     return $this->form;
 }
예제 #3
0
 /**
  * Download the content type
  *
  * @param   FabrikFEModelForm $formModel
  *
  * @throws Exception
  */
 public function download($formModel)
 {
     $params = $formModel->getParams();
     $file = $params->get('content_type_path');
     $label = 'content-type-' . $formModel->getForm()->get('label');
     $label = JFile::makeSafe($label);
     $zip = new ZipArchive();
     $zipFile = $this->config->get('tmp_path') . '/' . $label . '.zip';
     $zipRes = $zip->open($zipFile, ZipArchive::CREATE);
     if (!$zipRes) {
         throw new Exception('unable to create ZIP');
     }
     if (!JFile::exists($file)) {
         throw new Exception('Content type file not found');
     }
     if (!$zip->addFile($file, basename($file))) {
         throw new Exception('unable to add file ' . $file . ' to zip');
     }
     $zip->close();
     header('Content-Type: application/zip');
     header('Content-Length: ' . filesize($zipFile));
     header('Content-Disposition: attachment; filename="' . basename($zipFile) . '"');
     echo file_get_contents($zipFile);
     // Must exit to produce valid Zip download
     exit;
 }