public function actionUpdateContacts() { /* @var $contacts ContactInfo */ /* @var $contactsLng ContactInfoLng */ $id = Yii::app()->request->getParam('id', null); $email_1 = Yii::app()->request->getParam('email_1', null); $phone_1 = Yii::app()->request->getParam('phone_1', null); $phone_2 = Yii::app()->request->getParam('phone_2', null); $email_admin = Yii::app()->request->getParam('email_admin', null); $small_text_lng = Yii::app()->request->getParam('info', array()); $subject_lng = Yii::app()->request->getParam('subject', array()); $contacts = ContactInfo::model()->findByPk($id); if ($contacts == null) { $contacts = new ContactInfo(); } $contacts->email_1 = $email_1; $contacts->phone_1 = $phone_1; $contacts->phone_2 = $phone_2; $contacts->administrator_email = $email_admin; if ($contacts->isNewRecord) { $contacts->save(); } else { $contacts->update(); } foreach (Constants::GetLngArray() as $lng) { $contactsLng = $contacts->getLngObject($lng); $contactsLng->small_text = $small_text_lng[$lng]; $contactsLng->feedback_subject = $subject_lng[$lng]; if ($contactsLng->isNewRecord) { $contactsLng->save(); } else { $contactsLng->update(); } } $this->redirect($this->createUrl('/admin/panel/contacts')); }