Exemplo n.º 1
0
 public function setAction()
 {
     parent::init();
     $this->checkParams(array('id', 'value', 'lang'));
     Default_TranslateModel::set(array('value' => $this->getRequest()->value), array('id' => $this->getRequest()->id, 'language_code' => $this->getRequest()->lang));
     $tag_data = Default_TranslateModel::get(array('id' => $this->getRequest()->id));
     // update the cached translate
     Cms_Translate::cacheSet($tag_data->tag_hash, $tag_data->value, $tag_data->language_code);
 }
Exemplo n.º 2
0
 public function saveAction()
 {
     $id = $this->getRequest()->getParam('id');
     if (!$id) {
         $this->getResponse()->setStatus(0)->setBody(__('tag does not exist'))->toJson();
     }
     $rs = Admin_TranslateModel::get(array('id' => $id));
     if (!$rs) {
         $this->getResponse()->setStatus(0)->setBody(__('tag does not exist'))->toJson();
     }
     $update_data = array('value' => $this->getRequest()->getPost('value'));
     Admin_TranslateModel::set($update_data, array('id' => $id));
     Cms_Translate::cacheSet($rs['tag_hash'], $this->getRequest()->getPost('value'));
     $this->getResponse()->setStatus(1)->setBody(__('Translate updated'))->toJson();
 }