diff --git a/upload/includes/68kb/cache/load_addons.cache b/upload/includes/68kb/cache/load_addons.cache index 6419cc8..6466ee2 100755 --- a/upload/includes/68kb/cache/load_addons.cache +++ b/upload/includes/68kb/cache/load_addons.cache @@ -1 +1 @@ -a:4:{s:16:"__cache_contents";a:0:{}s:15:"__cache_created";i:1280259736;s:20:"__cache_dependencies";a:0:{}s:15:"__cache_expires";i:1280259796;} \ No newline at end of file +a:4:{s:16:"__cache_contents";a:0:{}s:15:"__cache_created";i:1280260845;s:20:"__cache_dependencies";a:0:{}s:15:"__cache_expires";i:1280260905;} \ No newline at end of file diff --git a/upload/includes/68kb/language/english/kb_lang.php b/upload/includes/68kb/language/english/kb_lang.php index 7a510ae..f1cae1f 100644 --- a/upload/includes/68kb/language/english/kb_lang.php +++ b/upload/includes/68kb/language/english/kb_lang.php @@ -349,6 +349,7 @@ $lang['lang_glossary'] = 'Glossary'; $lang['lang_term'] = 'Term'; $lang['lang_add_term'] = 'Add Term'; +$lang['lang_edit_term'] = 'Edit Term'; $lang['lang_definition'] = 'Definition'; $lang['kb_save'] = 'Save'; $lang['kb_save_and_continue'] = 'Save and Continue Editing'; diff --git a/upload/includes/68kb/modules/kb/controllers/admin_glossary.php b/upload/includes/68kb/modules/kb/controllers/admin_glossary.php index 726e4df..4c77ffa 100644 --- a/upload/includes/68kb/modules/kb/controllers/admin_glossary.php +++ b/upload/includes/68kb/modules/kb/controllers/admin_glossary.php @@ -55,6 +55,94 @@ public function index() // ------------------------------------------------------------------------ + /** + * add term + * + */ + public function add() + { + $data['nav'] = 'glossary'; + + $this->template->title(lang('lang_add_term')); + $data['action'] = 'add'; + + $this->load->helper(array('form', 'url', 'html')); + $this->load->library('form_validation'); + $this->form_validation->set_rules('g_term', 'lang:lang_title', 'required'); + $this->form_validation->set_rules('g_definition', 'lang:lang_definition', 'required'); + $this->events->trigger('glossary/validation'); + + if ($this->form_validation->run() == FALSE) + { + $this->template->build('admin/glossary/form', $data); + } + else + { + $data = array( + 'g_term' => $this->input->post('g_term', TRUE), + 'g_definition' => $this->input->post('g_definition', TRUE) + ); + + if ($this->db->insert('glossary', $data)) + { + $this->session->set_flashdata('msg', lang('lang_settings_saved')); + redirect('admin/kb/glossary/'); + } + } + } + + // ------------------------------------------------------------------------ + + /** + * edit term + * + */ + public function edit($id = '') + { + if ( ! is_numeric($id)) + { + redirect('admin/kb/glossary'); + } + $id = (int) $id; + + $data['nav'] = 'glossary'; + + $this->db->from('glossary')->where('g_id', $id); + $query = $this->db->get(); + $data['row'] = $query->row_array(); + $query->free_result(); + + $this->template->title(lang('lang_edit_term')); + + $data['action'] = 'add'; + + $this->load->helper(array('form', 'url', 'html')); + $this->load->library('form_validation'); + $this->form_validation->set_rules('g_term', 'lang:lang_title', 'required'); + $this->form_validation->set_rules('g_definition', 'lang:lang_definition', 'required'); + $this->events->trigger('glossary/validation'); + + if ($this->form_validation->run() == FALSE) + { + $this->template->build('admin/glossary/form', $data); + } + else + { + $data = array( + 'g_term' => $this->input->post('g_term', TRUE), + 'g_definition' => $this->input->post('g_definition', TRUE) + ); + $this->db->where('g_id', $id); + if ($this->db->update('glossary', $data)) + { + $this->session->set_flashdata('msg', lang('lang_settings_saved')); + redirect('admin/kb/glossary/'); + } + } + } + + // ------------------------------------------------------------------------ + /** * Grid * diff --git a/upload/includes/68kb/modules/kb/views/admin/glossary/form.php b/upload/includes/68kb/modules/kb/views/admin/glossary/form.php new file mode 100644 index 0000000..9fd0afb --- /dev/null +++ b/upload/includes/68kb/modules/kb/views/admin/glossary/form.php @@ -0,0 +1,38 @@ +events->active_hook('articles/form')) +{ + $this->events->trigger('articles/form'); +} +else +{ + echo ''; +} +?> +
+

+ +

'.lang('lang_errors_occured').'

'.validation_errors().'
'; + } + ?> + + uri->uri_string(), 'class="crud"'); ?> +
+
+ +

+ ('.lang('lang_required').')', 'g_term'); ?> + +

+ +
+ +
+ +
+ +

+
+
+ +