Example #1
0
 public function editAction()
 {
     parent::editAction();
     if ($this->getRequest()->isPost()) {
         try {
             $data = (object) $this->getRequest()->getPost();
             if (intval($data->id_photo) !== 0) {
                 $this->_entity->setPhoto(RM_Photo::getById($data->id_photo));
             }
             $this->_entity->setName($data->lang_name);
             $this->_entity->setUrl($data->lang_url);
             $this->_entity->setIsoName($data->iso_name);
             isset($data->default) && intval($data->default) === 1 ? $this->_entity->makeDefault() : $this->_entity->save();
             $this->__goBack();
         } catch (Exception $e) {
             $this->view->ShowMessage($e->getMessage());
         }
     } else {
         $_POST['id_photo'] = $this->_entity->getIdPhoto();
         $_POST['iso_name'] = $this->_entity->getIsoName();
         $_POST['lang_name'] = $this->_entity->getName();
         $_POST['lang_url'] = $this->_entity->getUrl();
         $_POST['default'] = $this->_entity->isDefault() ? 1 : 0;
     }
 }
Example #2
0
 public function getLanguage()
 {
     if (!$this->language instanceof RM_Lang) {
         $this->language = RM_Lang::getDefault();
     }
     return $this->language;
 }
Example #3
0
 private function _formatLocationName($locationName)
 {
     if ($this->getLang() !== RM_Lang::getDefault()) {
         $locationName = str_replace(' St,', ' Street,', $locationName);
     }
     return $locationName;
 }
Example #4
0
 protected function _initLang()
 {
     $lang = RM_Lang::getDefault();
     $lang->setAsCurrent();
 }