function delete_group() { //if user has permission if (check_my_access('delete_user_group')) { $data['main_content'] = 'admin/usergroups/delete_usergroup_v'; $data['pagetitle'] = 'Delete User group'; //load the admin dashboard view $this->load->view('admin/includes/admin_template', $data); } else { load_access_denied_page(); } }
function add() { //if user has permission if (check_my_access('add_user')) { //if form is posted $data['main_content'] = 'admin/users/add_user_v'; $data['pagetitle'] = 'Add user'; //load the admin dashboard view $this->load->view('admin/includes/admin_template', $data); } else { load_access_denied_page(); } }
<div class="panel-body"> <!-- code here--> <div class="panel-body"> <?php //if user has permission if (check_my_access('add_tags')) { ?> <p> <a class="btn btn-xs btn-primary" href="<?= base_url() . $this->uri->segment(1) . '/' . $this->uri->segment(2) ?>/add_tag">New tag</a> </p> <?php } else { load_access_denied_page(); } ?> <table class="table datatable"> <thead> <tr> <th>Title</th> <th>DELETE</th> </tr> </thead> <tbody> <?php //print_array($all_houses_paginated); foreach ($all_tags as $row) {
function logo_settings() { if (check_my_access('view_site_info')) { if ($this->input->post('ajax')) { $str = ''; switch ($this->input->post('ajax')) { case 'logo_dimensions': //print_array($_POST); $this->form_validation->set_rules($this->site_logo_m->validate_dimensions); $str = ''; if ($this->form_validation->run() == FALSE) { $str .= error_template(validation_errors()); } else { $info = array('width' => $this->input->post('logo_width'), 'height' => $this->input->post('logo_height')); //check if thetre is info $logo_info = $this->site_logo_m->get_all(); if (count($logo_info)) { //then update based on id foreach ($logo_info as $row) { if ($this->site_logo_m->update($row['id'], $info, 'You updated site logo info')) { $str .= success_template('Site logo dimensions have been successfully Updated'); } else { $str .= info_template('No change was made'); } } } else { //insert if ($this->site_logo_m->create($info, 'You updated the site logo info')) { $str .= success_template('Site logo dimensions have been successfully added'); } } } echo $str; break; } echo $str; } else { $data['main_content'] = 'admin/settings/logo_home_v'; $data['pagetitle'] = 'Logo Settings'; $data['logo_info'] = $this->site_logo_m->get_all(); if ($this->input->post('upload')) { //if a file is being uploaded if ($_FILES and $_FILES['userfile']['name']) { //check if there is already a logo if ($this->site_logo_m->get_all()) { //delete it foreach ($this->site_logo_m->get_all() as $row) { unlink('uploads/site_logo/' . get_thumbnail($row['logo_name'])); unlink('uploads/site_logo/' . $row['logo_name']); } } $image_name = $this->site_logo_m->do_upload('site_logo'); // Upload the file if (!$this->upload->display_errors()) { //save file name $image_data = array('logo_name' => $image_name); //print_array($_POST); //check if there is already a logo if ($data['logo_info']) { //do update foreach ($this->site_logo_m->get_all() as $row) { //save file info if ($this->site_logo_m->update($row['id'], $image_data, 'updated site logo ')) { $data['success'] = 'Site logo successfully updated <a class="btn btn-success btn-sx" href="' . current_url() . '">Refresh</a>'; } else { $data['errors'] = 'File was not saved. Please try again'; } } } else { //save file info if ($this->site_logo_m->create($image_data, 'updated site logo ')) { $data['success'] = 'Site logo successfully updated <a class="btn btn-success btn-xs" href="' . current_url() . '">Refresh</a>'; } else { $data['errors'] = 'File was not saved. Please try again'; } } } else { $data['errors'] = $this->upload->display_errors(); } } else { $data['errors'] = 'Upload an image'; } } //load the admin dashboard view $this->load->view('admin/includes/admin_template', $data); } } else { load_access_denied_page(); } }