コード例 #1
0
 /**
  * save
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 public function save()
 {
     $this->core->logger->debug('massiveart->generic->data->GenericDataTypeFolder->save()');
     try {
         $this->getModelFolders()->setLanguageId($this->setup->getLanguageId());
         $intUserId = Zend_Auth::getInstance()->getIdentity()->id;
         /**
          * add|edit|... core and instance data
          */
         switch ($this->setup->getActionType()) {
             case $this->core->sysConfig->generic->actions->add:
                 $objFolder = $this->objModelFolders->add($this->setup);
                 $this->setup->setElementId($objFolder->id);
                 $this->insertCoreData('folder', $objFolder->folderId, $objFolder->version);
                 $this->insertFileData('folder', array('Id' => $objFolder->folderId, 'Version' => $objFolder->version));
                 $this->insertMultiFieldData('folder', array('Id' => $objFolder->folderId, 'Version' => $objFolder->version));
                 $this->insertInstanceData('folder', array('Id' => $objFolder->folderId, 'Version' => $objFolder->version));
                 $this->insertMultiplyRegionData('folder', $objFolder->folderId, $objFolder->version);
                 break;
             case $this->core->sysConfig->generic->actions->edit:
                 $objFolder = $this->objModelFolders->load($this->setup->getElementId());
                 if (count($objFolder) > 0) {
                     $objFolder = $objFolder->current();
                     $this->objModelFolders->update($this->setup, $objFolder);
                     $this->updateCoreData('folder', $objFolder->folderId, $objFolder->version);
                     $this->updateFileData('folder', array('Id' => $objFolder->folderId, 'Version' => $objFolder->version));
                     $this->updateMultiFieldData('folder', $objFolder->folderId, $objFolder->version);
                     $this->updateInstanceData('folder', $objFolder->folderId, $objFolder->version);
                     $this->updateMultiplyRegionData('folder', $objFolder->folderId, $objFolder->version);
                 }
                 break;
         }
         return $this->setup->getElementId();
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }