public function actionEdit() { $message = ""; $lang = CatLang::fetchAll(); if (!empty($_POST["trans"])) { for ($n = 0; $n < sizeof($lang); $n++) { $trans = $_POST["trans"][$n]; if ($trans["id"] > 0 || $trans["translation"]) { if ($trans["id"] > 0) { $model = I18nTranslate::fetch($trans->id); } else { $model = new I18nTranslate(); } $model->setAttributesFromArray($trans); $model->i18n_id = $this->id; if (!$model->save()) { print_r($model->getErrors()); } } } } $list = array(); if (!empty($this->id)) { $item = I18n::fetch($this->id); $list = I18nTranslate::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("i18n_id=:id")->setParams(array(":id" => $item->id))->setLimit(-1)->setCache(0)); } else { $item = new I18n(); } $this->render('edit', array('form' => $item, 'list' => $list, 'lang' => $lang, 'message' => $message)); }