I'm developing the following screen using Codeigniter:
Mydifficultyistoleavethecodeinanelegantway,withouttheuseofthetablelibrary(IbelieveitisnotthemostsuitableforwhatIamdoing)andwithoutgreatmanipulationsofdataintheview,Iwouldlikesomesuggestionsonhowperformthisactivity.
View.php
<divid="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);
}