public function index() { $this->load->model('post'); $this->load->library('table'); $layout_vars = array(); $content_vars = array(); // Template da tabela $this->table->set_template(array('table_open' => '<table id="grid" class="table table-striped">')); $this->table->set_heading('#', 'Título', 'Data', 'Status', 'Ações'); $query = $this->post->get_by_field('page', '2', array('field' => 'created', 'order' => 'desc')); //, array('offset'=>'0','limit'=>'2')); foreach ($query->result() as $row) { $this->table->add_row($row->id, $row->title, datetime_for_user($row->created, false), status_post($row->status), div(array('class' => 'btn-group btn-group-sm')) . anchor('admin/agendas/edit/' . $row->id, glyphicon('edit'), array('class' => 'btn btn-default')) . '<button class="btn btn-default" onClick="return confirmar(\'' . site_url('admin/agendas/delete/' . $row->id) . '\');">' . glyphicon('trash') . '</button>' . div(null, true)); } $content_vars['listagem'] = $this->table->generate(); $this->wpanel->load_view('agendas/index', $content_vars); }
<ul class="dropdown-menu"> <!-- User image --> <li class="user-header"> <img src="<?php echo $avatar; ?> " class="img-circle" alt="<?php echo $this->auth->get_name(); ?> " /> <p> <?php echo $this->auth->get_name(); ?> <small>Cadastrado em <?php echo datetime_for_user($this->wpanel->get_from_user('created'), false); ?> </small> </p> </li> <!-- Menu Footer--> <li class="user-footer"> <div class="pull-left"> <?php echo anchor('admin/usuarios/profile', glyphicon('user') . 'Perfil', array('class' => 'btn btn-primary btn-flat')); ?> </div> <div class="pull-right"> <?php echo anchor('/admin/logout', glyphicon('off') . 'Sair', array('class' => 'btn btn-danger btn-flat')); ?>
echo close_div(); echo row(); echo col(3); echo div(array('class' => 'form-group')); echo form_label('Imagem de capa', 'userfile'); echo form_input(array('name' => 'userfile', 'type' => 'file')); echo img(array('src' => 'media/capas/' . $row->image, 'class' => 'img-responsive img-thumbnail', 'style' => 'margin-top:5px;')); echo div(array('class' => 'checkbox')); echo '<label>'; echo form_checkbox(array('name' => 'alterar_imagem', 'value' => '1', 'class' => 'checkbox')); echo ' Alterar a foto.</label>'; echo close_div(3); echo col(3); echo div(array('class' => 'form-group')); echo form_label('Data', 'created'); echo form_input(array('name' => 'created', 'value' => datetime_for_user($row->created, false), 'class' => 'form-control')); echo form_error('created'); echo close_div(2); echo col(3); echo div(array('class' => 'form-group')); echo form_label('Palavras-chave (Separe com vírgula)', 'tags'); echo form_textarea(array('name' => 'tags', 'value' => $row->tags, 'class' => 'form-control', 'rows' => '5')); echo close_div(2); // Opções de status $options = array('0' => 'Rascunho', '1' => 'Publicado'); echo col(3); echo div(array('class' => 'form-group')); echo form_label('Status', 'status'); echo form_dropdown('status', $options, $row->status, null, 'form-control'); echo close_div(3); echo hr();