public function actionTransdel() { /* @var $word LuxTranslation */ //get id from request $id = Yii::app()->request->getParam('id', null); //get word by id $word = LuxTranslation::model()->findByPk($id); //if not found - redirect to index if ($word == null) { $this->redirect($this->createUrl('/admin/inlux/index')); } //delete $word->deleteLng(); $word->delete(); //redirect to list $this->redirect($this->createUrl('/admin/inlux/translations')); }
public static function getTranslationFromWordOnSomeLng($str, $toLng) { /* @var $lng LuxTranslationLng */ /* @var $word LuxTranslation */ /* @var $neededWord LuxTranslation */ $ret = ""; $neededWord = null; $allWords = LuxTranslation::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; }