Created
May 11, 2012 23:46
-
-
Save fieldju/2663149 to your computer and use it in GitHub Desktop.
multiple datagrids with grocery CRUD using IFRAMES
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); | |
class Controller extends Application{ | |
private static $data = array(); | |
public function __construct(){ | |
parent::__construct(); | |
/* restrict access to all but admin */ | |
$this->ag_auth->restrict('admin'); | |
// load database | |
$this->load->database(); | |
/* Load helpers */ | |
$this->load->helper(array('url', 'form', 'registration', 'menu', 'language')); | |
/* Load libraries */ | |
$this->load->library('grocery_CRUD'); | |
/* setup default view data */ | |
$this->data['title'] = 'Admin Dashboard'; | |
$this->data['MenuItems'] = get_menu_items('admin'); | |
} | |
public function index(){ | |
if(logged_in()){ | |
//* load views */ | |
$this->load->view('templates/header', $this->data); | |
$this->load->view('dashboard'); | |
$this->load->view('templates/footer'); | |
} | |
else{ | |
$this->login(); | |
} | |
} | |
function grid1(){ | |
$this->grocery_crud->set_table('WaitlistForm'); | |
$output = $this->grocery_crud->render(); | |
$this->load->view('grid',$output); | |
} | |
function grid2(){ | |
$this->grocery_crud->set_table('users'); | |
$output = $this->grocery_crud->render(); | |
$this->load->view('grid',$output); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IFRAME SRC=<?php echo base_url('controller/grid1');?> WIDTH=1200 Height=500></IFRAME> | |
</br> | |
<IFRAME SRC=<?php echo base_url('controller/grid2');?> WIDTH=1200 Height=500></IFRAME> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach($css_files as $file): ?> | |
<link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" /> | |
<?php endforeach; ?> | |
<?php foreach($js_files as $file): ?> | |
<script src="<?php echo $file; ?>"></script> | |
<?php endforeach; ?> | |
<div id="content"> | |
<?php echo $output; ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If your wondering why the controller extends Application that is because i am using ag_auth in my codeigniter project.