function page_admin_collections($path) { $this->require_role('admin'); if (count($path) == 0) { // collections index page $lib = new Library(); $this->smarty->assign('Collections', $lib->get_collections()); $this->secondarycontent = './tpl/admin/collections/index_right.tpl'; $this->content = './tpl/admin/collections/index.tpl'; } else { if (count($path) == 1) { switch ($path[0]) { case 'create': $this->page_admin_collections_create(); break; default: $this->page_404($path); } } else { if (count($path) == 2) { // /admin/collections/<id>/action $collection_id = $path[0]; $action = $path[1]; switch ($action) { case 'scan': $c = new Collection($collection_id); $c->scan(); die('scan done'); break; case 'delete': die('undefined'); break; default: $this->page_404($path); } } else { $this->page_404($path); } } } }