Beispiel #1
0
 public static function file($value, $inline = true, $name = '', $overwrite = true)
 {
     $size = strlen($value);
     $instance = new MFile(array('size' => $size));
     $instance->setValue($value);
     $instance->saveToCache($inline, $name, $overwrite);
     return $instance;
 }
 public function exportFrames()
 {
     try {
         $service = MApp::getService('fnbr20', '', 'data');
         $json = $service->exportFramesToJSON($this->data->gridExportFrames->data->checked);
         $fileName = $this->data->fileName . '.json';
         $mfile = MFile::file($json, false, $fileName);
         $this->renderFile($mfile);
     } catch (EMException $e) {
         $this->renderPrompt('error', $e->getMessage());
     }
 }
Beispiel #3
0
 public function renderFile(\Maestro\Types\MFile $file)
 {
     Manager::getPage()->window($file->getURL());
     $this->setResult(new Results\MBrowserFile($file));
 }
Beispiel #4
0
 public function convertToPHPValue($value, $type)
 {
     if ($type == 'date') {
         return \Maestro\Manager::Date($value);
     } elseif ($type == 'timestamp') {
         return \Maestro\Manager::Timestamp($value);
     } elseif ($type == 'currency') {
         return \Maestro\Manager::currency($value);
     } elseif ($type == 'cnpj') {
         return \Maestro\Types\MCNPJ::create($value);
     } elseif ($type == 'cpf') {
         return \Maestro\Types\MCPF::create($value);
     } elseif ($type == 'currency') {
         return \Maestro\Manager::currency($value);
     } elseif ($type == 'boolean') {
         return !empty($value);
     } elseif ($type == 'blob') {
         $value = \Maestro\Types\MFile::file(base64_decode($value));
         return $value;
     } else {
         return $value;
     }
 }