It looks like you're new here. If you want to get involved, click one of these buttons!
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once(MODULES_PATH.'/bio/config/bio_constants.php');
class Bio_core {
var $_CI;
function __construct() {
$this->_CI =& get_instance();
}
function sidebar( $query = FALSE ) {
$this->_CI->load->module_library(FUEL_FOLDER, 'fuel_pagevars');
$vars['people'] = $this->_get_people( $query );
$output = $this->_render(BIO_FOLDER, '_blocks/sidebar', $vars);
return $output;
}
function _render( $view, $vars = array(), $return=TRUE ) {
$output = $this->_CI->load->module_view($view, $vars, $return);
$output = $this->_CI->fuel_page->fuelify($output);
return $output;
}
function _get_people( $where = array(), $order_by = NULL, $limit = NULL, $offset = NULL, $return_method = NULL, $assoc_key = NULL ) {
$this->_CI->load->module_model(BIO_FOLDER, 'bio_people_model');
$this->_CI->module_model->readonly = TRUE;
$people = $this->_CI->bio_people_model->find_all($where, $order_by, $limit, $offset, $return_method, $assoc_key);
var_dump($people);
return $people;
}
}
/* End of file bio_core.php */
/* Location: ./modules/libraries/bio_core.php */
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
require_once(FUEL_PATH.'models/base_module_model.php');
class Bio_people_model extends Base_module_model {
public $record_class = 'Bio_person';
public $foreign_keys = array('category_id' => array( 'bio' => 'bio_categories_model'));
function __construct() {
parent::__construct('bio_people', BIO_FOLDER); // table name
}
function list_items() {
$result = parent::list_items();
return $result;
}
function find_all($where = array(), $order_by = NULL, $limit = NULL, $offset = NULL, $return_method = NULL, $assoc_key = NULL) {
$this->db->select('bio_people.*');
$return = parent::find_all($where = array(), $order_by = NULL, $limit = NULL, $offset = NULL, $return_method = NULL, $assoc_key = NULL);
return $return;
}
function _common_query() {
$this->db->join('bio_categories', 'bio_categories.id=bio_people.category_id');
$this->db->select('bio_people.id, bio_people.name, bio_categories.name as category, bio_people.published, bio_people.active');
$result = parent::_common_query();
return $result;
}
}
class Bio_person_model extends Base_module_record {
}
Comments
foreach($people as $person){ print_r($person->values()); }