Example #1
0
 public function view()
 {
     RoutingEngine::setPage("runnDAILY View Route", "PV__300");
     RoutingEngine::getInstance()->registerParams("rid");
     if (!isset($_GET["rid"])) {
         Page::redirect("/routes");
     }
     $rid = $_GET["rid"];
     //$route = Route::fromRouteIdentifier($rid);
     $route = Route::sql()->select("routes.*, u_username, u_uid")->leftjoin("users", "u_uid", "r_uid", true)->where_eq("r_id", $rid)->execute(true, false);
     //get training types for create new training modal
     /*$stmt = Database::getDB()->prepare("
     			SELECT t_type_id, t_type_name
     			FROM training_types
     		");
     		$stmt->execute();
     		$stmt->store_result();
     		$types = array();
     		while($row = $stmt->fetch_assoc()){
     			$types[] = array("id"=>$row["t_type_id"], "name"=>$row["t_type_name"]);
     		}
     		$stmt->close();*/
     $types_sql = new SQL("training_types");
     $types = $types_sql->select("t_type_id, t_type_name")->execute(false, true);
     //$training_items = TrainingLog::getItemsForUserForRoute(User::$current_user->uid, $rid);
     $training_items = TrainingLog::sql()->select("r_name, t_rid, t_tid, t_time, t_distance, t_pace, t_date, t_comment")->leftjoin("routes", "r_id", "t_rid")->where_eq("t_uid", User::$current_user->uid)->where_eq("t_rid", $rid)->orderby("t_date")->execute(false, true);
     RoutingEngine::getSmarty()->assign("t_types", $types);
     RoutingEngine::getSmarty()->assign("route_view", $route);
     RoutingEngine::getSmarty()->assign("training_items", $training_items);
 }
Example #2
0
 public function view_user()
 {
     RoutingEngine::setPage("runnDAILY", "PV__300");
     RoutingEngine::getInstance()->registerParams("uid");
     if (!isset($_GET["uid"])) {
         Page::redirect("/community");
     }
     $uid = $_GET["uid"];
     //$routes = Route::getRoutesForUserInArray($uid, 50);
     $routes = Route::sql()->select("r_id, r_name, r_distance, r_creation, r_description")->where_eq("r_uid", $uid)->orderby("r_creation")->limit(50)->execute(false, true, "r_id");
     //$routes_js = json_encode_null($routes);
     RoutingEngine::getSmarty()->assign("routes", $routes);
     //RoutingEngine::getSmarty()->assign("routes_js", $routes_js);
     //$index_items = TrainingLog::getIndexItemsForUser($uid);
     $index_items = TrainingLog::sql()->select("r_name, t_rid, t_tid, t_time, t_distance, t_pace, t_date, t_comment")->leftjoin("routes", "r_id", "t_rid", false)->where_eq("t_uid", $uid)->orderby("t_date")->orderby("t_distance")->limit(50)->execute(false, true);
     //$json_data = TrainingLog::buildChartData($index_items);
     RoutingEngine::getSmarty()->assign("training_index_items", $index_items);
     //RoutingEngine::getSmarty()->assign("JSON_Chart_Data", $json_data);
     //var_dump(User::$current_user);
     RoutingEngine::getSmarty()->assign("user", User::fromUid($uid));
 }