first commit
This commit is contained in:
54
application/controllers/admin/Pray.php
Executable file
54
application/controllers/admin/Pray.php
Executable file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Pray extends MY_Controller {
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
define("HOOSK_ADMIN", 1);
|
||||
parent::__construct();
|
||||
$this->load->model('pray_model');
|
||||
$this->load->helper(array('admincontrol', 'url', 'hoosk_admin', 'file', 'form'));
|
||||
$this->load->library('session');
|
||||
define('LANG', $this->data['settings']->siteLang);
|
||||
$this->lang->load('admin', LANG);
|
||||
//Define what page we are on for nav
|
||||
$this->data['current'] = $this->uri->segment(2);
|
||||
//check session exists
|
||||
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
|
||||
$this->load->helper('general');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->library('pagination');
|
||||
$result_per_page = 15; // the number of result per page
|
||||
$config['base_url'] = BASE_URL . '/admin/pray/';
|
||||
$config['total_rows'] = $this->pray_model->getCountPaging();
|
||||
$config['per_page'] = $result_per_page;
|
||||
$config['last_link'] = false;
|
||||
$config['first_link'] = false;
|
||||
$config['suffix'] = '?term=' . getSearchTerm();
|
||||
|
||||
$this->pagination->initialize($config);
|
||||
|
||||
//Get posts from database
|
||||
$this->data['pray'] = $this->pray_model->getPaging($result_per_page, $this->uri->segment(3))
|
||||
->get()->result();
|
||||
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
|
||||
$this->data['footer'] = $this->load->view('admin/footer', '', true);
|
||||
$this->load->view('admin/pray', $this->data);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if ($this->input->post('deleteid')) :
|
||||
$this->pray_model->delete($this->input->post('deleteid'));
|
||||
redirect(BASE_URL . '/admin/pray');
|
||||
else :
|
||||
$this->data['form'] = [(array)$this->pray_model->getOne($this->uri->segment(4))];
|
||||
$this->load->view('admin/pray_delete.php', $this->data);
|
||||
endif;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user