Ejemplo n.º 1
0
 public function uploadFile($object, $type, $subtype)
 {
     $sheets = new SxModule_Sheets();
     $base = realpath(APPLICATION_PATH . '/../public_html/securedocs/');
     $path = $type . '/' . $subtype;
     if (!is_dir($base . '/' . $path)) {
         echo $base . '/' . $path;
         mkdir($base . '/' . $type);
         mkdir($base . '/' . $path);
     }
     if ($object->getFile() == null) {
         $object->setFile('');
     }
     $uploadAdapter = new Zend_File_Transfer_Adapter_Http();
     $uploadAdapter->setDestination($base . '/' . $path);
     $uploadAdapter->setOptions(array('ignoreNoFile' => true));
     $uploadAdapter->receive();
     $files = $uploadAdapter->getFileName(null, true);
     foreach ($_FILES['file']['name'] as $key => $filename) {
         if (!$filename) {
             continue;
         }
         $file = $base . '/' . $path . '/' . $filename;
         $date = date('Y-m-d His');
         $path_info = pathinfo($filename);
         $myfilename = str_replace(' ', '_', $path_info['filename'] . '_' . $date . '.' . $path_info['extension']);
         $myfilename = $sheets->createFileName($myfilename);
         $newfile = $base . '/' . $path . '/' . $myfilename;
         rename($file, $newfile);
         $object->setFile($myfilename);
     }
 }
Ejemplo n.º 2
0
 public function validate(SxModule_Sheets $object)
 {
     $this->validateNumeric($object->getType(), 'type', 'settings', $this->_namespace);
     $this->validateNumeric($object->getSubtype(), 'subtype', 'settings', $this->_namespace);
     $this->validateTextRequired($object->getName(), 'name', 'settings', $this->_namespace);
     $this->validateTextRequired($object->getDesc(), 'desc', 'settings', $this->_namespace);
     $msgr = Sanmax_MessageStack::getInstance($this->_namespace);
     if (!$msgr->getNamespaceMessages()) {
         return true;
     }
     return false;
 }
Ejemplo n.º 3
0
 public function toArray(SxModule_Sheets $item, $type = '*')
 {
     $data = array('type' => $item->getType(), 'subtype' => $item->getSubtype(), 'active' => $item->getActive(), 'place' => $item->getPlace(), 'date_created' => $item->getDateCreated(), 'date_updated' => $item->getDateUpdated());
     $tsl = array('name' => $item->getName(), 't_desc' => $item->getDesc(), 't_file' => $item->getFile(), 'lng' => $item->getLng());
     if ($type == 'item') {
         return $data;
     } elseif ($type == 'tsl') {
         return $tsl;
     }
     return array_merge($data, $tsl);
 }