Open GoogleCodeExporter opened 9 years ago
I have the same problem :(
Original comment by aladdinh...@gmail.com
on 26 Oct 2011 at 3:43
is there any workaround?
Original comment by hikaru.y...@gmail.com
on 12 May 2012 at 2:50
When i click on translation in user managment module then i am also facing the
same problem..
Original comment by anand.neema2008
on 14 May 2012 at 5:46
Attachments:
i have same when i click on translation to :/
Original comment by d.volose...@gmail.com
on 18 Jun 2012 at 10:47
I have found a solution for this. This is not fully tested but it seems to
work. Edit in YumTranslationController.php file the following functions:
- actionUpdate
- performAjaxValidation
- loadModel
See altered functions below
public function loadModel($model = false)
{
$newmodel=YumTranslation::model()->find('category = :category and message = :message and language = :language', array(
':category' => $model->category,
':message' => $model->message,
':language' => $model->language));
if($newmodel===null) {
$translation = new YumTranslation;
$translation->category = $model->category;
$translation->message = $model->message;
$translation->language = $model->language;
return $translation;
}
return $newmodel;
}
protected function performAjaxValidation($model, $form)
{
//if(isset($_POST['ajax']) && $_POST['ajax']==='translation-form')
if(isset($_POST['ajax']) && $_POST['ajax'] == $form)
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
}
public function actionUpdate($category = null, $message = null, $language = null)
{
$models = array();
foreach(Yum::getAvailableLanguages() as $language) {
$tmpModel = new YumTranslation(); // added
$tmpModel->category = $category; // added
$tmpModel->message = $message; // added
$tmpModel->language = $language; // added
//$models[] = $this->loadModel($category, $message, $language); // changed
$models[] = $this->loadModel($tmpModel);
}
if(isset($_POST['YumTranslation']))
{
$category = $_POST['YumTranslation']['category'];
$message = $_POST['YumTranslation']['message'];
foreach($_POST as $key => $translation) {
if(substr($key, 0, 11) == 'translation') {
$lang = explode('_', $key);
if(isset($lang[1])) {
$lang = $lang[1];
foreach(Yum::getAvailableLanguages() as $language) {
if($language == $lang) {
$model = YumTranslation::model()->find(
'category = :category and message = :message and language = :language ', array(
':category' => $category,
':message' => $message,
':language' => $lang));
if(!$model)
$model = new YumTranslation();
if($translation != '') {
$model->message = $message;
$model->category = $category;
$model->translation = $translation;
$model->language = $lang;
$model->save();
}
}
}
}
}
}
Yum::setFlash('Translations have been saved');
$this->redirect(array('admin'));
}
$this->render('update',array(
'models'=>$models,
));
}
Original comment by fr...@streeksoft.nl
on 19 Sep 2012 at 9:17
Original issue reported on code.google.com by
mohamada...@gmail.com
on 18 Jul 2011 at 10:39