function edit() { // Init $data = array(); $data['edit_mode'] = $edit_mode = FALSE; $data['breadcrumb'] = set_crumbs(array('content/entries' => 'Entries', current_url() => 'Entry Edit')); $data['content_type_id'] = $content_type_id = $this->uri->segment(5); $data['entry_id'] = $entry_id = $this->uri->segment(6); $data['revision_id'] = $revision_id = $this->uri->segment(7); // Get entry $this->load->model('users/users_model'); $this->load->model('entries_model'); $this->load->model('content_types_model'); // Used for content types dropdown $Content_types_model = new Content_types_model(); // If user not a super admin check if user's group is allowed access if ($this->Group_session->type != SUPER_ADMIN) { $this->content_types_model->group_start()->where('restrict_admin_access', 0)->or_where_related('admin_groups', 'group_id', $this->Group_session->id)->group_end(); $this->entries_model->group_start()->where('restrict_admin_access', 0)->or_where_related('content_types/admin_groups', 'group_id', $this->Group_session->id)->group_end(); // Only get Content Types user has access to for dropdown $Content_types_model->group_start()->where('restrict_admin_access', 0)->or_where_related('admin_groups', 'group_id', $this->Group_session->id)->group_end(); } $data['Entry'] = $Entry = $this->entries_model->get_by_id($entry_id); $data['Content_type'] = $Content_type = $this->content_types_model->get_by_id($content_type_id); // Load content fields library $config['Entry'] = $Entry; $config['content_type_id'] = $content_type_id; $this->load->add_package_path(APPPATH . 'modules/content/content_fields'); $Content_fields = $this->load->library('content_fields'); $Content_fields->initialize($config); // Check if versioning is enabled and whether a revision is loaded if ($Content_type->enable_versioning && is_numeric($revision_id)) { $Revision = new Revisions_model(); $Revision->get_by_id($revision_id); if ($Revision->exists()) { $revision_data = @unserialize($Revision->revision_data); // Update Entry and content fields from revision // Entries data gets queiried in the content_fields library initialize if (is_array($revision_data)) { $Entry->from_array($revision_data); $Content_fields->from_array($revision_data); } } } // Get content types for the setting's // content type dropdown $Change_content_types = $Content_types_model->where('id !=', $content_type_id)->order_by('title')->get(); $data['change_content_types'] = array('' => ''); foreach ($Change_content_types as $Change_content_type) { $entries_count = $Change_content_type->entries->count(); // Only add the content type to the Add Entry dropdown if it has not reached the // limit of entries allowed. An empty entries_allowed is unlimited if ($Change_content_type->entries_allowed == '' || $entries_count < $Change_content_type->entries_allowed || $entries_count == 0 && $Change_content_type->entries_allowed > 0) { $data['change_content_types'][$Change_content_type->id] = $Change_content_type->title; } } // Get Admins and Super Admins for the setting's // author dropdown $Users = $this->users_model->where_in_related('groups', 'type', array(SUPER_ADMIN, ADMINISTRATOR))->order_by('first_name')->get(); $data['authors'] = array('' => ''); foreach ($Users as $User) { $data['authors'][$User->id] = $User->full_name(); } // Validate that the content type exists if (!$Content_type->exists()) { return show_404(); } if ($Entry->exists()) { // Check that url content_type_id and entry content_type_id match if ($Entry->content_type_id != $content_type_id && !$revision_id) { return show_404(); } $data['edit_mode'] = $edit_mode = TRUE; } // Build categories tree if content type has a category group assigned if ($Content_type->category_group_id) { $this->load->library('categories_library'); $config['id'] = $Content_type->category_group_id; $config['admin_entries_categories'] = TRUE; $config['populate'] = option_array_value($Entry->categories->get(), 'id', 'id'); $data['categories_tree'] = $this->categories_library->list_categories($config); $Entry->categories->get(); } // Form Validation Rules if ($edit_mode) { $this->form_validation->set_rules('slug', 'URL', 'trim|max_length[255]|callback_unique_slug_check[' . addslashes($Entry->slug) . ']'); } else { $this->form_validation->set_rules('slug', 'URL', 'trim|max_length[255]|callback_unique_slug_check'); } $this->form_validation->set_rules('meta_title', 'Meta Title', 'trim'); $this->form_validation->set_rules('meta_description', 'Meta Description', 'trim'); $this->form_validation->set_rules('meta_keywords', 'Meta Keywords', 'trim'); $this->form_validation->set_rules('status', 'Status', 'trim|required'); $this->form_validation->set_rules('title', 'Entry Title', 'trim|required|max_length[100]'); $this->form_validation->set_rules('created_date', 'Date Created', 'trim|required'); // Validate url title if content type has a dynamic route if ($Content_type->dynamic_route != '') { $this->form_validation->set_rules('url_title', 'URL Title', 'trim|required|alpha_dash|max_length[100]|is_unique[entries.url_title' . ($edit_mode ? '.id.' . $Entry->id : '') . ']'); } // Get content fields html $field_validation = $Content_fields->validate(); // Validation and process form if ($this->form_validation->run() == TRUE && $field_validation) { // Populate from post and prep for insert / update $Entry->from_array($this->input->post()); $Entry->modified_date = date('Y-m-d H:i:s'); $Entry->created_date = date('Y-m-d H:i:s', strtotime($this->input->post('created_date'))); $Entry->slug = $this->input->post('slug') != '' ? $this->input->post('slug') : NULL; $Entry->url_title = $this->input->post('url_title') != '' ? $this->input->post('url_title') : NULL; $Entry->meta_title = $this->input->post('meta_title') != '' ? $this->input->post('meta_title') : NULL; $Entry->meta_description = $this->input->post('meta_description') != '' ? $this->input->post('meta_description') : NULL; $Entry->meta_keywords = $this->input->post('meta_keywords') != '' ? $this->input->post('meta_keywords') : NULL; $Entry->content_type_id = $content_type_id; $Entry->author_id = $this->input->post('author_id') != '' ? $this->input->post('author_id') : NULL; // Ensure the id wasn't overwritten by an id in the post if ($edit_mode) { $Entry->id = $entry_id; } $Entry->save(); // Save field data to entries_data $Content_fields->from_array($this->input->post()); $Content_fields->save(); // Add Revision if versioning enabled if ($Content_type->enable_versioning) { // Delete old revsions so that not to exceed max revisions setting $Revision = new Revisions_model(); $Revision->where_related('revision_resource_types', 'key_name', 'ENTRY')->where('resource_id', $entry_id)->order_by('id', 'desc')->limit(25, $Content_type->max_revisions - 1)->get()->delete_all(); // Serialize and save post data to entry revisions table $User = $this->secure->get_user_session(); $Revision = new Revisions_model(); $Revision->resource_id = $Entry->id; $Revision->revision_resource_type_id = Revision_resource_types_model::ENTRY; $Revision->content_type_id = $Entry->content_type_id; $Revision->author_id = $User->id; $Revision->author_name = $User->first_name . ' ' . $User->last_name; $Revision->revision_date = date('Y-m-d H:i:s'); $Revision->revision_data = serialize($this->input->post()); $Revision->save(); } // Assign entry to selected categories if ($Content_type->category_group_id) { $this->load->model('categories_entries_model'); $Categories_entries = new Categories_entries_model(); $categories_post = is_array($this->input->post('categories')) ? $this->input->post('categories') : array(); // Delete all of the entries categories that are not in the posted array $Categories_entries->where('entry_id', $Entry->id); if (!empty($categories_post)) { $Categories_entries->where_not_in('category_id', $categories_post); } $Categories_entries->get()->delete_all(); // Check if categories posted already exist in the relationship table // If not add them foreach ($categories_post as $category_id) { $Categories_entries = new Categories_entries_model(); $Categories_entries->where('category_id', $category_id)->where('entry_id', $Entry->id)->get(); if (!$Categories_entries->exists()) { $Categories_entries->category_id = $category_id; $Categories_entries->entry_id = $entry_id; $Categories_entries->save(); } } } // Clear cache so updates will show on next page load $this->load->library('cache'); $this->cache->delete_all('entries'); // Clear navigation cache so updates will show on next page load $this->load->library('navigations/navigations_library'); $this->navigations_library->clear_cache(); // Set a success message $this->session->set_flashdata('message', '<p class="success">Changes Saved.</p>'); // Deteremine where to redirect user if ($this->input->post('save_exit')) { redirect(ADMIN_PATH . "/content/entries"); } else { redirect(ADMIN_PATH . "/content/entries/edit/" . $Entry->content_type_id . "/" . $Entry->id); } } $_SESSION['KCFINDER'] = array(); $_SESSION['KCFINDER']['disabled'] = false; $_SESSION['isLoggedIn'] = true; // Field form needs to be built after running form_validation->run() $data['Fields'] = $Content_fields->form(); $this->template->view('admin/entries/edit', $data); }
public function edit_event() { $site_id = $this->uri->segment(4); $park_event_id = $this->uri->segment(5); if (!$site_id) { return show_404(); } $data = array(); $data['breadcrumb'] = set_crumbs(array('settings/sites' => 'Sites', "calendar/index/{$site_id}" => 'Calendar', current_url() => 'Calendar Events')); $this->load->model('park_events_model'); // Load site name $Site = $this->load->model('settings/sites_model'); $Site->where('id', $site_id)->get(); $data['Site'] = $Site; // Determine if the event is being added or edited if ($park_event_id === '0') { $data['edit_mode'] = $edit_mode = false; // Get the day that this new event is to be added for $year = $this->uri->segment(6); $month = $this->uri->segment(7); $day = $this->uri->segment(8); $calendar_day = date('Y-m-d', mktime(12, 0, 0, $month, $day, $year)); } else { $data['edit_mode'] = $edit_mode = true; // Load the event $data['Event'] = $Event = $this->park_events_model->get_event($park_event_id); } // Determine event type if ($edit_mode) { $edit_type = 'Edit'; $data['event_type'] = $event_type = $Event->park_hours ? 'Park Hours' : 'Event'; } else { $edit_type = 'Add'; $data['event_type'] = $event_type = 'Event'; } // Validate Form $this->form_validation->set_rules('title', 'Title', "trim|required"); $this->form_validation->set_rules('details', 'Details', "trim"); $this->form_validation->set_rules('event_bg_color', 'Event Color', "trim|required"); $this->form_validation->set_rules('park_closed', 'Park Closed', "trim|required"); if ($event_type == 'Event') { $this->form_validation->set_rules('event_link', 'Event Link', "trim"); $this->form_validation->set_rules('event_link_target', 'Event Link Target', "trim"); // Validate links dependingon link type if ($this->input->post('link_type') == 'INTERNAL') { $this->form_validation->set_rules('link_internal', 'Page', "trim|required"); } else { if ($this->input->post('link_type') == 'EXTERNAL') { $this->form_validation->set_rules('link_external', 'URL', "trim|required"); } } } if ($this->form_validation->run() == TRUE) { $park_event_data = array('event_text_color' => $this->input->post('event_text_color'), 'event_bg_color' => $this->input->post('event_bg_color'), 'title' => $this->input->post('park_closed') ? $this->config->item('calendar_park_closed') : $this->input->post('title'), 'details' => $this->input->post('details'), 'event_link' => $event_type == 'Event' ? $this->input->post('event_link') : '', 'event_link_internal' => $event_type == 'Event' ? $this->input->post('event_link_internal') : '', 'event_link_external' => $event_type == 'Event' ? $this->input->post('event_link_external') : '', 'event_link_target' => $event_type == 'Event' ? $this->input->post('event_link_target') : '', 'park_closed' => $this->input->post('park_closed') ? 1 : 0); // Save event data if ($edit_mode) { // Edit existing event $this->park_events_model->update_event($park_event_id, $park_event_data); } else { $park_event_data['calendar_day'] = $calendar_day; $park_event_data['park_hours'] = 0; $park_event_data['site_id'] = $site_id; // Add new event $this->park_events_model->add_event($park_event_data); } // Work out the month and year of the edited event if ($edit_mode) { $dates = explode('-', $Event->calendar_day); $year = $dates[0]; $month = $dates[1]; } redirect(ADMIN_PATH . "/calendar/index/{$site_id}/{$year}/{$month}"); } // Get all the sites pages $this->load->model('content/entries_model'); $Pages = $this->entries_model->where('status', 'published')->where('site_id', $site_id)->where('slug !=', 'NULL')->order_by('title')->get(); $data['Pages'] = option_array_value($Pages, 'slug', 'title', array('' => '- SELECT -')); // Get all Color options $data['colors'] = array(); foreach ($this->config->item('calendar_color_options') as $option_number => $colors) { if ($edit_mode) { $highlight = $colors['background-color'] == $Event->event_bg_color && $colors['text-color'] == $Event->event_text_color ? true : false; } else { $highlight = $option_number == 0 ? true : false; } $colorAttributes = array('style' => "background-color: {$colors['background-color']}; color: {$colors['text-color']};", 'class' => $highlight ? 'highlight' : ''); $data['colors'][] = $colorAttributes; } // Set Title $data['title'] = "{$edit_type} {$Site->name} Calendar {$event_type}"; // Load the view $this->template->add_package(array('ckeditor', 'ck_jq_adapter')); $this->template->view('admin/events', $data); }
<ul class="htabs"> <li><a href="#edit-user-tab">Edit User</a></li> <li><a href="#password-tab">Password</a></li> </ul> <?php } ?> <div id="edit-user-tab"> <div class="form"> <div class="field_spacing"> <?php echo form_label('<span class="required">*</span> Group:', 'groups'); ?> <?php echo form_dropdown('group_id', option_array_value($Groups, 'id', 'name'), set_value('group_id', isset($User->group_id) ? $User->group_id : $this->settings->users_module->default_group), 'id="groups" class="long"'); ?> </div> <div class="field_spacing"> <?php echo form_label('<span class="required">*</span> Email:', 'email'); ?> <?php echo form_input(array('id' => 'email', 'name' => 'email', 'value' => set_value('email', isset($User->email) ? $User->email : ''))); ?> </div> <?php if (!$edit_mode) { ?>
</span> </div> <?php } ?> </div> </div> <!-- Users Tab --> <!-- <div id="users-tab"> <div class="form"> <div> <?php echo form_label('<span class="required">*</span> Default User Group:', 'default_group'); ?> <?php echo form_dropdown('users[default_group]', option_array_value($Groups, 'id', 'name'), set_value('default_group', isset($Settings->default_group->value) ? $Settings->default_group->value : '')); ?> </div> <div> <?php echo form_label('<span class="required">*</span> User Registration:', 'enable_registration'); ?> <span> <label><?php echo form_radio(array('name' => 'users[enable_registration]', 'value' => '1', 'checked' => set_radio('enable_registration', '1', !empty($Settings->enable_registration->value) ? TRUE : FALSE))); ?> Enabled</label> <label><?php echo form_radio(array('name' => 'users[enable_registration]', 'value' => '0', 'checked' => set_radio('enable_registration', '0', empty($Settings->enable_registration->value) ? TRUE : FALSE))); ?> Disabled</label>
function edit() { $Field = null; $data = array(); $data['edit_mode'] = FALSE; $this->load->model('content_fields_model'); $this->load->model('content_field_types_model'); $this->load->model('content_types_model'); $type_id = $this->uri->segment(5); $data['breadcrumb'] = set_crumbs(array('content/types' => 'Content Types', 'content/fields/index/' . $type_id => 'Content Fields', current_url() => 'Field Edit')); $data['Type'] = $Type = $this->content_types_model->get_by_id($type_id); // Check if content type exists if (!$Type->exists()) { return show_404(); } $field_id = $this->uri->segment(6); // Edit mode if ($field_id) { $data['edit_mode'] = TRUE; $data['Field'] = $Field = $this->content_fields_model->include_related('content_field_types', 'model_name')->get_by_id($field_id); // Check if field exists if (!$Field->exists()) { return show_404(); } } // Get content field types for dropdown and a datatype refrence $Content_field_types = $this->content_field_types_model->order_by('title')->get(); $datatype_ref_array = option_array_value($Content_field_types, 'id', 'datatype'); $data['Content_field_types'] = option_array_value($Content_field_types, 'id', 'title'); // Get setting fields $this->load->add_package_path(APPPATH . 'modules/content/content_fields'); $Content_fields = $this->load->library('content_fields'); $data['setting_fields'] = $Content_fields->settings($Field); // Form Validation $this->form_validation->set_rules('content_field_type_id', 'Type', 'trim|required'); $this->form_validation->set_rules('label', 'Label', 'trim|required'); $this->form_validation->set_rules('required', 'Required', 'trim|required'); if ($data['edit_mode']) { $this->form_validation->set_rules('short_tag', 'Short Tag', 'trim|alpha_dash|required|callback_unique_short_tag[' . $Field->short_tag . ']'); } else { $this->form_validation->set_rules('short_tag', 'Short Tag', 'trim|alpha_dash|required|callback_unique_short_tag'); } if ($this->form_validation->run() == TRUE) { $this->load->model('content_fields_model'); $Content_fields = new Content_fields_model(); $Content_fields->from_array($this->input->post()); $Content_fields->content_type_id = $type_id; $Content_fields->short_tag = $this->input->post('short_tag'); // Setting fields $Content_fields->settings = $this->input->post('settings') ? serialize($this->input->post('settings')) : NULL; // Edit mode if ($field_id) { $Content_fields->id = $field_id; } $Content_fields->save(); // If new record add column to entries data and set sort if (!$data['edit_mode']) { // Set a sort number so that the field will be // added to the end of the fields list. // Setting it to its ID# ensures that it is greater than the other field's sort $Content_fields->sort = $Content_fields->id; $Content_fields->save(); } $this->load->library('cache'); $this->cache->delete_all('content_types'); $this->cache->delete_all('entries'); // There is probably a better way to go about getting the // field datatype but this should work for now $datatype = isset($datatype_ref_array[$Content_fields->content_field_type_id]) ? $datatype_ref_array[$Content_fields->content_field_type_id] : 'text'; $Content_fields->save_entries_column($datatype); $this->session->set_flashdata('message', '<p class="success">Content field saved successfully.</p>'); redirect(ADMIN_PATH . '/content/fields/index/' . $Type->id); } $this->template->view('admin/fields/edit', $data); }
function edit() { // Init $data = array(); $data['Navigation'] = $Navigation = $this->load->model('navigations_model'); $data['Navigation_item'] = $Navigation_item = $this->load->model('navigation_items_model'); $data['navigation_id'] = $navigation_id = $this->uri->segment(5); $data['breadcrumb'] = set_crumbs(array('navigations' => 'Navigations', 'navigations/items/tree/' . $navigation_id => 'Navigation Tree', current_url() => 'Navigation Item Edit')); $data['edit_mode'] = $edit_mode = FALSE; $item_id = $this->uri->segment(6); // Verify navigation exists $Navigation->get_by_id($navigation_id); if (!$Navigation->exists()) { return show_404(); } // Set mode if ($item_id) { $Navigation_item->get_by_id($item_id); if (!$Navigation_item->exists()) { return show_404(); } $data['edit_mode'] = $edit_mode = TRUE; } // Get all entries for link dropdown $this->load->model('content/entries_model'); $Pages = $this->entries_model->where('status', 'published')->where('slug !=', 'NULL')->or_where('id =', $this->settings->content_module->site_homepage)->order_by('title')->get(); $data['Pages'] = option_array_value($Pages, 'id', 'title', array('' => '')); // Form validation rules if ($this->input->post('type') == 'page') { $this->form_validation->set_rules('entry_id', 'Pages', 'trim|required'); $this->form_validation->set_rules('page_link_text', 'Link Text', 'trim'); } else { $this->form_validation->set_rules('title', 'Link Text', 'trim|required'); $this->form_validation->set_rules('url', 'URL', 'trim|required'); } $this->form_validation->set_rules('type', 'Link Type', 'trim|required'); $this->form_validation->set_rules('tag_id', 'Tag ID', 'trim'); $this->form_validation->set_rules('class', 'Class', 'trim'); $this->form_validation->set_rules('target', 'Target', 'trim'); $this->form_validation->set_rules('disable_current', 'Disable Current', 'trim'); $this->form_validation->set_rules('disable_current_trail', 'Disable Current Trail', 'trim'); if ($this->form_validation->run() == TRUE) { $Navigation_item->from_array($this->input->post()); $Navigation_item->navigation_id = $navigation_id; if ($this->input->post('type') == 'page') { $Navigation_item->title = $this->input->post('page_link_text') ? $this->input->post('page_link_text') : NULL; $Navigation_item->url = NULL; } else { if ($this->input->post('type') == 'dynamic_route') { $Navigation_item->url = trim($this->input->post('url'), '/'); } else { $Navigation_item->entry_id = NULL; } } $Navigation_item->tag_id = $this->input->post('tag_id') ? $this->input->post('tag_id') : NULL; $Navigation_item->class = $this->input->post('class') ? $this->input->post('class') : NULL; $Navigation_item->target = $this->input->post('target') ? $this->input->post('target') : NULL; $Navigation_item->hide = $this->input->post('hide') ? 1 : 0; $Navigation_item->disable_current = $this->input->post('disable_current') ? 1 : 0; $Navigation_item->disable_current_trail = $this->input->post('disable_current_trail') ? 1 : 0; $Navigation_item->save(); // Set the sort to the id if creating new item if (!$edit_mode) { $Navigation_item->sort = $Navigation_item->id; $Navigation_item->save(); } // Clear navigation cache so updates will show on next page load $this->load->library('navigations_library'); $this->navigations_library->clear_cache(); $this->session->set_flashdata('message', '<p class="success">Navigation Item Saved</p>'); redirect(ADMIN_PATH . "/navigations/items/tree/{$navigation_id}"); } $this->template->view('admin/items/edit', $data); }
function add() { // Init $data = array(); $data['breadcrumb'] = set_crumbs(array('content/types' => 'Content Types', current_url() => 'Add Content Type')); $this->load->model('content_types_model'); $this->load->model('content_types_admin_groups_model'); $this->load->model('content_fields_model'); $this->load->model('users/groups_model'); $this->load->model('category_groups_model'); // Get theme layouts for theme layout dropdown $data['theme_layouts'] = $this->template->get_theme_layouts($this->settings->theme, TRUE); // Get all admin groups for admin group access $data['Admin_groups'] = $this->groups_model->where('type', ADMINISTRATOR)->order_by('name')->get(); // Get all user groups except super admin for group access $Groups = new Groups_model(); $data['Groups'] = $Groups->where('type !=', SUPER_ADMIN)->order_by('name')->get(); // Get all category groups for dropdown $data['category_groups'] = option_array_value($this->category_groups_model->order_by('title')->get(), 'id', 'title', array('' => '')); // Form Validation $this->form_validation->set_rules('title', 'Title', 'trim|required'); $this->form_validation->set_rules('short_name', 'Short Name', 'trim|required|alpha_dash|max_length[50]|is_unique[content_types.short_name]'); $this->form_validation->set_rules('enable_dynamic_routing', 'Enable Dynamic Routing', 'trim'); $this->form_validation->set_rules('enable_versioning', 'Enable Versioning', 'trim|required'); $this->form_validation->set_rules('max_revisions', 'Max Revisions', 'trim|required|integer|less_than[26]'); $this->form_validation->set_rules('category_group_id', 'Category Group', 'trim'); $this->form_validation->set_rules('restrict_admin_access', 'Restrict Admin Access', 'trim|required'); $this->form_validation->set_rules('selected_admin_groups[]', 'Administrative Access', 'trim'); $this->form_validation->set_rules('access', 'Access', 'trim|required'); $this->form_validation->set_rules('restrict_to[]', 'Group Access', 'trim'); $this->form_validation->set_rules('entries_allowed', 'Number of Entries Allowed', 'trim|integer'); // Add dynamic route validation if enable dynamic routing checkbox selected if ($this->input->post('enable_dynamic_routing') == 1) { $this->form_validation->set_rules('dynamic_route', 'Dynamic Route', 'trim|required|max_length[255]|callback_unique_dynamic_route'); } if ($this->form_validation->run() == TRUE) { // Save new content type $Content_type = new Content_types_model(); $Content_type->from_array($this->input->post()); $Content_type->dynamic_route = $this->input->post('dynamic_route') != '' && $this->input->post('enable_dynamic_routing') ? $this->input->post('dynamic_route') : NULL; $Content_type->restrict_to = $this->input->post('access') == 2 ? serialize($this->input->post('restrict_to')) : NULL; $Content_type->category_group_id = $this->input->post('category_group_id') != '' ? $this->input->post('category_group_id') : NULL; $Content_type->theme_layout = $this->input->post('theme_layout') != '' ? $this->input->post('theme_layout') : NULL; $Content_type->entries_allowed = $this->input->post('entries_allowed') != '' ? $this->input->post('entries_allowed') : NULL; $Content_type->save(); $Content_type->add_revision(); // Assign admin groups to this content type // if restrict admin access is enabled if ($Content_type->restrict_admin_access && is_array($this->input->post('selected_admin_groups'))) { $selected_admin_groups = $this->input->post('selected_admin_groups'); foreach ($selected_admin_groups as $admin_group) { $Content_types_admin_groups = new Content_types_admin_groups_model(); $Content_types_admin_groups->content_type_id = $Content_type->id; $Content_types_admin_groups->group_id = $admin_group; $Content_types_admin_groups->save(); } } // Clear cache $this->load->library('cache'); $this->cache->delete_all('entries'); $this->cache->delete_all('content_types'); redirect(ADMIN_PATH . "/content/types/edit/{$Content_type->id}"); } $this->template->view('admin/types/add', $data); }
</div> <div class="content"> <div class="filter"> <form id="filter_form" method="post"> <div class="left"> <div><label>Search:</label></div> <?php echo form_input(array('name' => 'filter[search]', 'class' => 'long', 'value' => set_filter('users', 'search'))); ?> </div> <div class="left"> <div><label>Group:</label></div> <?php echo form_dropdown('filter[group_id]', option_array_value($Groups, 'id', 'name', array('' => '')), set_filter('users', 'group_id')); ?> </td> </div> <div class="left filter_buttons"> <button type="submit" class="button"><span>Filter</span></button> <button type="submit" class="button" name="clear_filter" value="1"><span>Clear</span></button> </div> </form> <div class="clear"></div> </div> <?php echo form_open(null, 'id="form"'); ?>