Beispiel #1
0
 public function action_delete()
 {
     RoutingEngine::setPage("runnDAILY", "PV__300");
     if (!isset($_POST["go_id"])) {
         Page::redirect("/goals");
     }
     Goal::deleteGoal($_POST["go_id"]);
     Page::redirect("/goals");
 }
Beispiel #2
0
 public function elevation()
 {
     RoutingEngine::setPage("runnDAILY Elevation Admin", "PV__100");
     $query = Database::getDB()->query("\r\n\t\t\tSELECT * FROM elevation_regions\r\n\t\t");
     $elev = array();
     while ($row = $query->fetch_assoc()) {
         $elev[$row["id"]] = $row;
     }
     RoutingEngine::getSmarty()->assign("elevation", json_encode($elev));
 }
Beispiel #3
0
 public function actionCancel()
 {
     RoutingEngine::setPage("runnDAILY Requests", "PV__300");
     $cid = $_POST["cid"];
     $confirmation = Confirmation::fetch($cid);
     $result = false;
     if ($confirmation->uid_from == User::$current_user->uid) {
         $result = $confirmation->delete();
     }
     //Javascript is expecting an object with result and cid
     $output = array("cid" => $cid, "result" => $result);
     RoutingEngine::returnAjax($output, true);
 }
Beispiel #4
0
 public function search()
 {
     RoutingEngine::setPage("runnDAILY", "PV__300");
     if (!isset($_POST["u_search"]) || $_POST["u_search"] == "") {
         echo "<p>Please enter a search term.</p>";
         exit;
     }
     //$user_list = User::searchForUser($_POST["u_search"]);
     $user = $_POST["u_search"];
     $user_list = User::sql()->select("u_uid, u_username")->where("u_username LIKE ? OR u_email LIKE ?", "%" . $user . "%", "%" . $user . "%")->limit(40)->execute(false, true);
     RoutingEngine::getSmarty()->assign("user_list", $user_list);
     $output = RoutingEngine::getSmarty()->fetch("community/_user_search_result.tpl");
     echo $output;
     exit;
 }
Beispiel #5
0
 public function actionDelete()
 {
     RoutingEngine::setPage("Messages | runnDAILY", "PV__300");
     if (!isset($_POST["msg_convo_id"])) {
         Page::redirect("/messages");
     }
     $message = new Message($_POST);
     $read_count = Message::markConvoRead($message->convo_id);
     if ($read_count > 0) {
         Message::updateCount(User::$current_user->uid, -$read_count);
         User::$current_user->msg_new -= $read_count;
         RoutingEngine::getInstance()->persistUserData();
     }
     $message->delete();
     Page::redirect("/messages");
 }
Beispiel #6
0
 public function view($common)
 {
     RoutingEngine::setPage("runnDAILY About", "PV__400");
     $pages = array("admin_elevation", "about_contact", "about_credits", "about_index", "community_index", "community_view_user", "confirmation_index", "goals_index", "goals_create", "home_index", "home_register", "messages_index", "routes_view", "routes_create", "routes_index", "training_create", "training_index");
     if (in_array($common, $pages)) {
         $output = RoutingEngine::getSmarty()->fetch("help/_pages/{$common}.tpl");
     } else {
         $feedback = new Message();
         $feedback->uid_from = User::$current_user->uid;
         $feedback->uid_to = null;
         $feedback->message = "Please create a help page for " . $_SERVER["HTTP_REFERER"];
         $feedback->subject = null;
         $feedback->type = 2;
         $feedback->create();
         $output = RoutingEngine::getSmarty()->fetch("help/_pages/none.tpl");
     }
     echo $output;
     die;
 }
Beispiel #7
0
 public function action_copy_view()
 {
     RoutingEngine::setPage("runnDAILY Routes", "PV__300");
     $route = new Route($_POST);
     if ($route->copy()) {
         Notification::add("Your route - {$route->name} - was copied.");
         Page::redirect("/routes/view/{$route->id}");
     }
     Notification::add("There was an error copying the route.  Try again.");
     Page::redirect("/routes/view/{$route->id}");
 }
Beispiel #8
0
 public function delete()
 {
     RoutingEngine::setPage("runnDAILY", "PV__100");
     $message = new Message($_POST);
     exit(json_encode($message->deleteByType(2)));
 }
Beispiel #9
0
 public function settings()
 {
     RoutingEngine::setPage("runnDAILY Settings", "PV__300");
 }
Beispiel #10
0
 public function summary()
 {
     RoutingEngine::setPage("runnDAILY Training Summary", "PV__300");
     $this_week = new DateRange();
     $this_week->getWeekRange();
     $data_this_week = TrainingLog::getItemsForUserForGoalPercent(User::$current_user->uid, $this_week->start, $this_week->end);
     $last_week = new DateRange();
     $last_week->getWeekRange("today", -1);
     $data_last_week = TrainingLog::getItemsForUserForGoalPercent(User::$current_user->uid, $last_week->start, $last_week->end);
     $overall = TrainingLog::getSummaryOverall(User::$current_user->uid);
     //var_dump($data_this_week, $data_last_week, $overall);
     RoutingEngine::getSmarty()->assign("this_week", $this_week);
     RoutingEngine::getSmarty()->assign("last_week", $last_week);
     RoutingEngine::getSmarty()->assign("overall", $overall);
     RoutingEngine::getSmarty()->assign("data_this_week", $data_this_week);
     RoutingEngine::getSmarty()->assign("data_last_week", $data_last_week);
     $output = RoutingEngine::getSmarty()->fetch("training/_summary.tpl");
     echo $output;
     die;
 }
Beispiel #11
0
 function ajax_remove_notification()
 {
     RoutingEngine::setPage("runnDAILY User Remove Notification", "PV__300");
     if (!isset($_POST["id"])) {
         return false;
     }
     $id = $_POST["id"];
     Notification::remove($id);
     RoutingEngine::getInstance()->persistUserData();
     RoutingEngine::returnAjax(true);
 }
Beispiel #12
0
 public function credits()
 {
     RoutingEngine::setPage("runnDAILY About", "PV__400");
 }
Beispiel #13
0
 public function index()
 {
     RoutingEngine::setPage("runnDAILY Guides", "PV__400");
 }