export() public method

Export function
public export ( ) : string
return string
Exemplo n.º 1
0
 public function testImportScript()
 {
     $this->assertFalse($this->object->import('<xml></xml>'));
     $this->assertFalse($this->object->import(''));
     $this->assertFalse($this->object->import('<a></b>'));
     $this->createUser();
     $this->createContent();
     $data = $this->object->export($this->what);
     $this->removeContent();
     $this->assertTrue($this->object->import($data));
     $view = ViewModel::fromIdentifier('ViewContentIdentifier');
     $layout = LayoutModel::fromIdentifier('LayoutContentIdentifier');
     $script = ScriptModel::fromIdentifier('ScriptContentIdentifier');
     $this->assertInstanceOf('Gc\\View\\Model', $view);
     $this->assertInstanceOf('Gc\\Layout\\Model', $layout);
     $this->assertInstanceOf('Gc\\Script\\Model', $script);
     //Test datatype
     $datatype = new DatatypeModel();
     $datatype = $datatype->fromArray($datatype->fetchRow($datatype->select(array('name' => 'DatatypeTest'))));
     $this->assertInstanceOf('Gc\\Datatype\\Model', $datatype);
     //Test document type
     $documentType = new DocumentTypeModel();
     $documentType = $documentType->fromArray($documentType->fetchRow($documentType->select(array('name' => 'DocumentType'))));
     $this->assertInstanceOf('Gc\\DocumentType\\Model', $documentType);
     $this->assertCount(1, $documentType->getDependencies());
     $this->assertCount(1, $documentType->getAvailableViews()->getViews());
     $tabs = $documentType->getTabs();
     $this->assertCount(1, $tabs);
     $properties = $tabs[0]->getProperties();
     $this->assertCount(1, $properties);
     //Test document
     $document = DocumentModel::fromUrlKey('');
     $this->assertInstanceOf('Gc\\Document\\Model', $document);
     $property = $document->getProperty('azd');
     $this->assertInstanceof('Gc\\Property\\Model', $property);
     $this->assertEquals('string', $property->getValue());
     $document->delete();
     //Delete data
     $properties[0]->delete();
     $tabs[0]->delete();
     $datatype->delete();
     $view->delete();
     $script->delete();
     $layout->delete();
     $documentType->delete();
     $this->removeUser();
 }
Exemplo n.º 2
0
 /**
  * Download files as gzip
  *
  * @return \Zend\Stdlib\ResponseInterface
  */
 public function downloadFilesAction()
 {
     $model = new Model\Files();
     $content = $model->export();
     $filename = 'files-backup-' . date('Y-m-d-H-i-s') . '.zip';
     $headers = new Headers();
     $headers->addHeaderLine('Pragma', 'public')->addHeaderLine('Cache-control', 'must-revalidate, post-check=0, pre-check=0')->addHeaderLine('Cache-control', 'private')->addHeaderLine('Expires', -1)->addHeaderLine('Content-Type', 'application/download')->addHeaderLine('Content-Transfer-Encoding', 'binary')->addHeaderLine('Content-Length', strlen($content))->addHeaderLine('Content-Disposition', 'attachment; filename=' . $filename);
     $response = $this->getResponse();
     $response->setHeaders($headers);
     $response->setContent($content);
     return $response;
 }