public function actionTransdel() { /* @var $word LmtTranslation */ //get id from request $id = Yii::app()->request->getParam('id', null); //get word by id $word = LmtTranslation::model()->findByPk($id); //if not found - redirect to index if ($word == null) { $this->redirect($this->createUrl('/admin/lmt/index')); } //delete $word->deleteLng(); $word->delete(); //redirect to list $this->redirect($this->createUrl('/admin/lmt/translations')); }
public static function getTranslationFromWordOnSomeLng($str, $toLng) { /* @var $lng LmtTranslationLng */ /* @var $word LmtTranslation */ /* @var $neededWord LmtTranslation */ $ret = ""; $neededWord = null; $allWords = LmtTranslation::model()->findAll(); foreach ($allWords as $word) { foreach (Constants::GetLngArray() as $lngIndex => $lng) { $strWord = $word->getWordByLng($lng); if ($str == $strWord) { $neededWord = $word; } } } if ($neededWord != null) { $ret = $neededWord->getWordByLng($toLng); } else { $ret = $str; } return $ret; }