Пример #1
0
 function list_items($resource)
 {
     $url = $this->main_object->admin_url;
     $new_url = $url . '&action=new';
     if ($resource == NULL) {
         $arr = array(array('<b>There is no created items. <a href="' . $new_url . '">Create one now</a>.</b>'));
         $td_style[0][0] = 'colspan="4" style="text-align: center;"';
     } else {
         $td_style = NULL;
         foreach ($resource as $row) {
             $edit_url = $url . '&action=edit&id=' . $row['id'];
             $delete_url = $url . '&action=delete&id=' . $row['id'];
             $duplicate_url = $url . '&action=duplicate&id=' . $row['id'];
             $arr[] = array($row['id'], $row['name'], '[all_around id="' . $row['id'] . '"]', '<a href="' . $edit_url . '">Edit</a> | <a href="' . $delete_url . '" class="all_around_delete">Delete</a> | <a href="' . $duplicate_url . '">Duplicate</a>');
         }
     }
     $header = array('ID', 'Name', 'Shortcode', 'Actions');
     return all_around_visual_elements::generate_table($arr, $header, array('auto_width' => FALSE), $td_style);
 }