/** * GET /user/dashboard User dashboard * * @param \Base $f3 * @throws \Exception */ public function dashboard($f3) { $dashboard = $f3->get("user_obj")->option("dashboard"); if (!$dashboard) { $dashboard = array("left" => array("projects", "subprojects", "bugs", "repeat_work", "watchlist"), "right" => array("tasks")); } // Load dashboard widget data $allWidgets = array("projects", "subprojects", "tasks", "bugs", "repeat_work", "watchlist", "my_comments", "recent_comments", "open_comments"); $helper = \Helper\Dashboard::instance(); foreach ($dashboard as $widgets) { foreach ($widgets as $widget) { if (is_callable(array($helper, $widget))) { $f3->set($widget, $helper->{$widget}()); } else { $f3->set("error", "Widget '{$widget}' is not available."); } unset($allWidgets[array_search($widget, $allWidgets)]); } } $f3->set("unused_widgets", $allWidgets); // Get current sprint if there is one $sprint = new \Model\Sprint(); $sprint->load(array("? BETWEEN start_date AND end_date", date("Y-m-d"))); $f3->set("sprint", $sprint); $f3->set("dashboard", $dashboard); $f3->set("menuitem", "index"); $this->_render("user/dashboard.html"); }
/** * GET /user/@username/tree * * @param \Base $f3 * @param array $params * @throws \Exception */ public function single_tree($f3, $params) { $this->_requireLogin(); $user = new \Model\User(); $user->load(array("username = ? AND deleted_date IS NULL", $params["username"])); if ($user->id) { $f3->set("title", $user->name); $f3->set("this_user", $user); $tree = \Helper\Dashboard::instance()->issue_tree(); $f3->set("issues", $tree); $this->_render($f3->get("AJAX") ? "user/single/tree/ajax.html" : "user/single/tree.html"); } else { $f3->error(404); } }