不显示状态行和日期


Not Displaying Status Row And Date

由于某些原因,添加的状态和日期没有在codeigniter中显示在我的表上。我已经得到的用户名工作良好,但应该能够看到date addedstatus都在数据库中工作良好。我的用户图片http://s20.postimg.org/7719crcl9/user.png

启用时在数据库中的状态为"1",但应该显示文本启用。

我如何得到我的状态和日期添加工作?

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class User_model extends CI_Model {
    public function __construct() {
        parent::__construct();
        $this->load->helper('date');
    }
    public function getTotalUsers() {
        $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . $this->db->dbprefix  . "user`");
        return $query->row('total');
    }
    public function getUsers($data = array()) {
        $sql = "SELECT * FROM `" . $this->db->dbprefix . "user`";
        $sort_data = array(
            'username',
            'status',
            'date_added'
        );  
        if (trim($data['sort']) && in_array($data['sort'], $sort_data)) {
            $sql .= " ORDER BY " . $data['sort'];   
        } else {
            $sql .= " ORDER BY username";   
        }
        if (trim($data['order']) && ($data['order'] == 'DESC')) {
            $sql .= " DESC";
        } else {
            $sql .= " ASC";
        }
        $query = $this->db->query($sql);
        return $query->result_array();
    }   
}
控制器

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class User extends Controller {
    private $error = array();
    public function index() {
        $this->lang->load('user/user', 'english');
        $this->load->model('user/user_model');
        $this->getList();
    }
    public function getList() {
        if (null !==($this->input->get('sort'))) {
            $sort = $this->input->get('sort');
        } else {
            $sort = 'username';
        }
        if (null !==($this->input->get('order'))) {
            $order = $this->input->get('order');
        } else {
            $order = 'ASC';
        }
        if (null !==($this->input->get('page'))) {
            $page = $this->input->get('page');
        } else {
            $page = 1;
        }
        $url = '';
        if (null !==($this->input->get('sort'))) {
            $url .= '&sort=' . $this->input->get('sort');
        }
        if (null !==($this->input->get('order'))) {
            $url .= '&order=' . $this->input->get('order');
        }
        if (null !==($this->input->get('page'))) {
            $url .= '&page=' . $this->input->get('page');
        }
        $data['breadcrumbs'] = array();
        $data['breadcrumbs'][] = array(
            'text' => $this->lang->line('text_home'),
            'href' => site_url('dashboard')
        );
        $data['breadcrumbs'][] = array(
            'text' => $this->lang->line('heading_title'),
            'href' => site_url('user')
        );
        $data['insert'] = site_url('user/insert');
        $data['delete'] = site_url('user/delete');      
        $data['users'] = array();
        $filter_data = array(
            'sort'  => $sort,
            'order' => $order,
        );
        $user_total = $this->user_model->getTotalUsers();
        $results = $this->user_model->getUsers($filter_data);
        foreach ($results as $result) {
            $data['users'][] = array(
                'user_id' => $result['user_id'],
                'username' => $result['username'],
                'status' => ($result['status'] ? $this->lang->line('text_enabled') : $this->lang->line('text_disabled')),
                'date_added' => date($this->lang->line('date_format_short'), strtotime($result['date_added'])),
                'edit'  => site_url('user/update', '&user_id=' . $result['user_id'] . $url)
            );
        }   
        $data['heading_title'] = $this->lang->line('heading_title');
        $data['text_no_results'] = $this->lang->line('text_no_results');
        $data['text_confirm'] = $this->lang->line('text_confirm');
        $data['column_username'] = $this->lang->line('column_username');
        $data['column_status'] = $this->lang->line('column_status');
        $data['column_date_added'] = $this->lang->line('column_date_added');
        $data['column_action'] = $this->lang->line('column_action');
        $data['button_insert'] = $this->lang->line('button_insert');
        $data['button_edit'] = $this->lang->line('button_edit');
        $data['button_delete'] = $this->lang->line('button_delete');
        if (null !==($this->input->post('selected'))) {
            $data['selected'] = (array)$this->input->post('selected');
        } else {
            $data['selected'] = array();
        }
        $url = '';
        if ($order == 'ASC') {
            $url .= '&order=DESC';
        } else {
            $url .= '&order=ASC';
        }
        if (null !==($this->input->get('page'))) {
            $url .= '&page=' . $this->input->get('page');
        }
        $data['sort_username'] = site_url('user', '&sort=username' . $url); 
        $data['sort_status'] = site_url('user', '&sort=status' . $url);
        $data['sort_date_added'] = site_url('user', '&sort=date_added' . $url);
        $url = '';
        if (null !==($this->input->get('sort'))) {
            $url .= '&sort=' . $this->input->get('sort');
        }
        if (null !==($this->input->get('order'))) {
            $url .= '&order=' . $this->input->get('order');
        }
        $data['sort'] = $sort;
        $data['order'] = $order;
        $this->load->view('user/user_list', $data);
    }
}
<<p> 视图/strong>
<?php if ($users) { ?>
              <?php foreach ($users as $user) { ?>
              <tr>
                <td class="text-center"><?php if (in_array($user['user_id'], $selected)) { ?>
                  <input type="checkbox" name="selected[]" value="<?php echo $user['user_id']; ?>" checked="checked" />
                  <?php } else { ?>
                  <input type="checkbox" name="selected[]" value="<?php echo $user['user_id']; ?>" />
                  <?php } ?></td>
                <td class="text-left"><?php echo $user['username']; ?></td>
                <td class="text-left"><?php echo $user['status']; ?></td>
                <td class="text-left"><?php echo $user['date_added']; ?></td>
                <td class="text-right"><a href="<?php echo $user['edit']; ?>" data-toggle="tooltip" title="<?php echo $button_edit; ?>" class="btn btn-primary"><i class="fa fa-pencil"></i></a></td>
              </tr>
              <?php } ?>
              <?php } else { ?>
              <tr>
                <td class="text-center" colspan="5"><?php echo $text_no_results; ?></td>
              </tr>
              <?php } ?>

我发现了我的问题,我必须加载我的英语语言文件,我得到了它。

public function index() {
$this->lang->load('user/user', 'english');
$this->lang->load('english', 'english'); // Had to add this 
$this->load->model('user/user_model');
$this->getList();
}