Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class View
- {
- public function listar_registros( $query, AbstractAction $action, $paginacao='' )
- {
- $ctrl = getGet('ctrl');
- $ac = getGet('ac');
- $order = getGet('order')!='DESC' ? 'DESC' : 'ASC';
- $html = '<h2>Bem vindo, <b>'.getSession('nome').'</b></h2>';
- $html .= '<a href="?ctrl='.$ctrl.'&ac=new" class="additem">Adicionar '.ucfirst( $ctrl ).'</a>';
- $html .= '<table id="lista">';
- $html .= '
- <thead>
- <tr>
- <th><input class="check-all" type="checkbox" /></th>
- <th><a href="?ctrl='.$ctrl.'&ac='.$ac.'&by=id&order='.$order.'">ID</a></th>
- <th><a href="?ctrl='.$ctrl.'&ac='.$ac.'&by=label&order='.$order.'">Nome</a></th>';
- $bool_ths = method_exists( $action, 'ths' );
- if( $bool_ths ) $html .= $action->ths();
- $html .= '<th>Opções</th>
- </tr>
- </thead>
- <tfoot>
- <tr>
- <td colspan="6">
- <div class="bulk-actions align-left">
- <select name="dropdown">
- <option value="option1">Escolha uma ação...</option>
- <option value="option3">Deletar</option>
- </select>
- <a class="button" href="#">Aplicar as selecionadas</a>
- </div>
- '.$paginacao.'
- </td>
- </tr>
- </tfoot>
- <tbody>';
- if( $query && $query->num_rows )
- {
- $i=1;
- while( $dados = $query->fetch_object() )
- {
- $class = $i%2==0 ? ' class="alt-row"' : '';
- $html .= '<tr'.$class.'>
- <td><input type="checkbox" name="id[]" value="'.$dados->id.'" /></td>
- <td><a href="?ctrl='.$ctrl.'&ac=view&id='.$dados->id.'">'.$dados->id.'</a></td>
- <td class="nome"><a href="?ctrl='.$ctrl.'&ac=view&id='.$dados->id.'">'.$dados->label.'</a></td>';
- if( $bool_ths ) $html .= $action->tds( $dados );
- $html .= '
- <td>
- <!-- Icons -->
- <a href="?ctrl='.$ctrl.'&ac=view&id='.$dados->id.'" title="Editar"><img src="resources/images/icons/pencil.png" alt="Edit" /></a>
- <a href="?ctrl='.$ctrl.'&ac=del&id='.$dados->id.'" title="Deletar"><img src="resources/images/icons/cross.png" alt="Delete" /></a>
- </td>
- </tr>';
- $i++;
- }
- }
- else
- $html .= '<tr><td></td><td colspan="3" class="nome">Nenhum cadastro</td></tr>';
- $html .= '</tbody></table>';
- echo $html;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement