public function save() { $phrases = $this->input->post("phrase"); $translations = $this->input->post("translation"); $lng = (int) $this->input->post("language"); $lang = Language::factory()->get_by_id($lng); for ($i = 0; $i < count($phrases); $i++) { $pid = $phrases[$i]; $pid = (int) $pid; $translation = $translations[$i]; if (!empty($translation)) { $phrase = new Phrase($pid); $phrase->translation = $translations[$i]; $phrase->save($lang); } } $this->update_languages_setting(); redirect("administration/translations/phrases/" . $lang->id); }