nfdevil

Untitled

Jul 29th, 2012
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.72 KB | None | 0 0
  1. <?php
  2. // Loop in the controller
  3.         foreach($objects as $o){
  4.         $rows .= '<tr>';
  5.         // Checkbox
  6.         $rows .= '<td>' . form_label(form_checkbox('action_to[]', $o->id)) . '</td>';
  7.         // Field values
  8.         foreach($fields as $field){
  9.             $rows .= '<td>' . $o->{$field} . '</td>';
  10.         }
  11.         // Add buttons
  12.         $rows .= '<td class="align-center">';
  13.         $rows .= '<div class="actions">';
  14.             // Edit button
  15.             if(!in_array($o->id, $noactions['edit'])){
  16.             $rows .= anchor(
  17.                 'admin/'.$this->module.'/edit/' . $o->id,
  18.                 sprite(
  19.                     'pencil',
  20.                     array('title' => ucfirst(sprintf(lang('edit'),lang($this->module . '.s'))))
  21.                 ),
  22.                 'class="button edit"'
  23.             );
  24.             }
  25.             // Delete button
  26.             if(!in_array($o->id, $noactions['delete'])){
  27.             $rows .= anchor(
  28.                 'admin/'.$this->module.'/delete/' . $o->id,
  29.                 sprite(
  30.                     'delete',
  31.                     array('title' => ucfirst(sprintf($this->lang->line('delete'),$this->lang->line($this->module . '.s'))))
  32.                 ),
  33.                 array(
  34.                     'onclick' => 'javascript:return confirm(\''.ucfirst(sprintf($this->lang->line('delete_confirm'),$this->lang->line($this->module . '.s'))).'\')')
  35.             );
  36.             }
  37.         $rows .= '</div></td></tr>';
  38.         }
  39.         $this->template->set_partial('list','admin/list',array('list_header' => $header, 'list_rows' => $rows));
  40.         $this->template->build('admin/list_wrapper');
  41.     }else{
  42.         $this->template->build('admin/list_nodata');
  43.     }
  44.  
  45.  
  46. // the view showing the list
  47.  
  48.     <thead>
  49.     <tr>
  50.         <th width="15"><?php echo form_checkbox(array('name' => 'action_to_all', 'id' => 'checkall', 'class' => 'checkbox')); ?></th>
  51.         <?php echo $list_header; ?>
  52.         <th width="50"></th>
  53.     </tr>
  54.     </thead>
  55.     <tbody>
  56.     <?php echo $list_rows; ?>
  57.     </tbody>
  58.     </table>
Advertisement
Add Comment
Please, Sign In to add comment