0
I am developing the following screen using Codeigniter:
My difficulty is in leaving the code in an elegant way, without the use of the table library (I think it is not the most suitable for what I am doing) and without large data manipulations in the view, I would like some suggestions on how to perform this activity.
View.php
<div id="container">
<?php include 'menu.php';?>
<center>
<h1>Tarefas</h1>
</center>
<div id="body">
<center>
<?php echo form_open('tarefa/detalhes'); ?>
<?php $this->load->library('table');
echo $this->table->generate();
echo form_close(); ?>
<center>
</div>
<p class="footer">
PGM renderizado em <strong>{elapsed_time}</strong> segundos
</p>
</div>
Controler.php
public function index()
{
$this->load->helper('form');
$this->load->library('table');
$this->load->helper('form');
$query = $this->tarefa_model->busca_tarefa_ordenado_por_estado();
$head = array();
$tarefanterior ="";
foreach ($query->result() as $row)
{
$data['equipeTarefas'][] = array(
'Sequencia' => $row->sequencia,
'Nome' => $row->nome,
'id' => $row->id ==""?"":"#".$row->id,
'Titulo' => $row->titulo);
if(!in_array($row->nome,$head)){
array_push($head,$row->nome );
}
$tarefa = '<figure id="containerimage">
<input type="image" src="'.base_url().'postit.jpeg" id="centro" name="tarefa" value="'.$row->id.'"><figcaption>#'.$row->id." ".$row->titulo.'</figcaption>
</figure>';
$this->table->add_row($row->sequencia== 1?"$tarefa":"", $row->sequencia== 2?$tarefa:"",$row->sequencia== 3?$tarefa:"");
}
$this->table->set_heading($head);
$this->load->view('tarefa_view',$data);
}