예제 #1
0
 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'));
 }
예제 #2
0
 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;
 }