/** * save * @author Thomas Schedler <*****@*****.**> * @version 1.1 */ public function save() { $this->core->logger->debug('massiveart->generic->data->GenericDataTypeLocation->save()'); try { $this->getModelLocations()->setLanguageId($this->setup->getLanguageId()); $intUserId = Zend_Auth::getInstance()->getIdentity()->id; /** * add|edit|newVersion core and instance data */ switch ($this->setup->getActionType()) { case $this->core->sysConfig->generic->actions->add: $arrCoreData = array('idGenericForms' => $this->setup->getGenFormId(), 'idUnits' => $this->setup->getParentId(), 'idUsers' => $intUserId, 'creator' => $intUserId, 'created' => date('Y-m-d H:i:s')); if (count($this->setup->CoreFields()) > 0) { foreach ($this->setup->CoreFields() as $strField => $obField) { $arrCoreData[$strField] = $obField->getValue(); } } /** * add location */ $this->setup->setElementId($this->objModelLocations->addLocation($arrCoreData)); $this->insertFileData('location', array('Id' => $this->setup->getElementId())); break; case $this->core->sysConfig->generic->actions->edit: $arrCoreData = array('idUsers' => $intUserId); if (count($this->setup->CoreFields()) > 0) { foreach ($this->setup->CoreFields() as $strField => $obField) { $arrCoreData[$strField] = $obField->getValue(); } } /** * add location */ $this->objModelLocations->editLocation($this->setup->getElementId(), $arrCoreData); $this->updateFileData('location', array('Id' => $this->setup->getElementId())); break; } return $this->setup->getElementId(); } catch (Exception $exc) { $this->core->logger->err($exc); } }