Ejemplo n.º 1
0
 public function get_index($type = "index", $id = "all", $sorter = "ns")
 {
     $title = "List of Projects";
     //sorter and searcher for table
     if ($type == "index" && $id == "all" && preg_match("/^(title|created_at|author_id|draft|published)/", $sorter)) {
         $projects = Project::order_by($sorter, 'asc')->get();
         $count = Project::count();
     } elseif (preg_match("/^(draft|published)/", $type) && preg_match("/^(1|0)/", $id) && $sorter == "ns") {
         $projects = Project::get_query($type, $id);
         $count = Project::get_totals($type, $id);
     } elseif (preg_match("/^(index|draft|published)/", $type) && preg_match("/^(1|0)/", $id) && preg_match("/^(title|published|author_id|draft|created_at|ns)/", $sorter)) {
         $projects = Project::get_order($sorter, $type, $id);
         $count = Project::get_totals($type, $id);
     } else {
         $projects = Project::all();
         $count = Project::count();
     }
     $this->layout->nest('content', 'dojo::projects.index', array('projects' => $projects, 'count' => $count));
 }
Ejemplo n.º 2
0
 public static function get_order($field, $value, $order)
 {
     $projects = Project::order_by($order, 'asc')->where($field, '=', $value)->get();
     return $projects;
 }