Example #1
0
 public function createComponentMenu()
 {
     $navigation = new NavigationBuilder();
     $navigation->setTranslator(new Translator($this->lang));
     $navigation->template->presenter = $this;
     return $navigation;
 }
Example #2
0
 if ($actionId !== NULL) {
     try {
         $targetId = ActionHandler::handleAction($website, $db, $i18n, $actionId);
         if ($targetId != null) {
             $pageId = $targetId;
         }
     } catch (ValidationException $ve) {
         $validationMessages = $ve->getMessages();
         $website->addFrontMessage(new FrontMessage(MESSAGE_TYPE_ERROR, $i18n->getMessage('validation_error_box_title'), $i18n->getMessage('validation_error_box_message')));
     } catch (Exception $e) {
         $website->addFrontMessage(new FrontMessage(MESSAGE_TYPE_ERROR, $i18n->getMessage('errorpage_title'), $e->getMessage()));
     }
 }
 $website->setPageId($pageId);
 // get and set navigation items
 $navItems = NavigationBuilder::getNavigationItems($website, $i18n, $page, $pageId);
 $parameters['navItems'] = $navItems;
 // get and set breadcrumb
 $parameters['breadcrumbItems'] = BreadcrumbBuilder::getBreadcrumbItems($website, $i18n, $page, $pageId);
 // get and render target page
 header('Content-type: text/html; charset=utf-8');
 $viewHandler = new ViewHandler($website, $db, $i18n, $page, $block, $validationMessages);
 try {
     echo $viewHandler->handlePage($pageId, $parameters);
 } catch (AccessDeniedException $e) {
     // show log-in form for user
     if ($website->getUser()->getRole() == ROLE_GUEST) {
         $website->addFrontMessage(new FrontMessage(MESSAGE_TYPE_ERROR, $e->getMessage(), ''));
         echo $viewHandler->handlePage('login', $parameters);
     } else {
         renderErrorPage($website, $i18n, $viewHandler, $e->getMessage(), $parameters);
Example #3
0
<?php

require "./app/core/SectionBuilder.php";
require "./app/core/NavigationBuilder.php";
$renderer = new SectionBuilder();
$navigation = new NavigationBuilder();
?>

<section class="getRequests" id="get">
    <section class="wrapper">
        <h2>GET Requests</h2>
        <?php 
$navigation->addItem("GET Requests", "get", true);
// GET User
$renderer->renderHeader("getUser", "Retrieve a specific User", "Based on a users ID, this method will query the database for that specific user and return a JSON object with all of their values.", "GET", "User/{userId}", "This endpoint should be used to return a specific users profile");
$renderer->renderHeaderInformation(array("session_token" => "The logged in users current session token.", "device_id" => "The id of the current device"));
$renderer->renderURIComponents(array("userId" => "The ID of the user that needs to be retrieved."));
$renderer->renderResponseCodes(array("200" => "The user was retrieved successfully, this is accompanied by a user payload", "401" => "Your session_token and/or device_id combination was not found in the DB. Login again", "404" => "The user was not found on the server"));
$renderer->renderTestResponse(array("Content-Type: application/json", "session_token: adminToken", "device_id: adminDevice"), array(), REQUEST_URL . "User/386", "GET");
$navigation->addItem("Retrieve a specific User", "getUser");
// GET Users at location (for list view)
$renderer->renderHeader("getUsersAtLocation", "Retrieve all Users", "Returns all users that match the logged in users preferences and settings, this is impacted by age range, gender and other factors.  Right now this method will return every user in the system that matches the preferences, but as the application gets more users a max radius filter will be implemented, with that in mind the URI parameters now make more sense.", "GET", "User/at-location/long/lat/{limit}", "This endpoint should be used to return all users for the list view, do not use this for the map view.");
$renderer->renderHeaderInformation(array("session_token" => "The logged in users current session token.", "device_id" => "The id of the current device"));
$renderer->renderURIComponents(array("long" => "The current longitude of the user", "lat" => "The current latitude of the user", "limit*" => "The limit to the amount of users that should be returned, this key is optional"));
$renderer->renderResponseCodes(array("200" => "Returns a list of all of the users who are within a certain distance of your location.", "401" => "Your session_token and/or device_id combination was not found in the DB. Login again", "404" => "No users were found for the given user, users may appear if settings and preferences are changed."));
$renderer->renderTestResponse(array("Content-Type: application/json", "session_token: adminToken", "device_id: adminDevice"), array(), REQUEST_URL . "User/at-location/0.0002324/-0.013243/2", "GET");
$navigation->addItem("Retrieve all Users", "getUsersAtLocation");
// GET Favorite Places
$renderer->renderHeader("getFavoritePlaces", "Retrieve a Users Favorite Places", "Returns list of the favorite places for the requested user, this information is returned in the <mark>/api/v2/User/{userId}</mark> endpoint, but this provides an interface to return them if you desire them as a separate object.", "GET", "User/favorite-places/{userId}", "This endpoint should be used to return all of a users favorite places.");
$renderer->renderHeaderInformation(array("session_token" => "The logged in users current session token.", "device_id" => "The id of the current device"));
$renderer->renderURIComponents(array("userId" => "The id of the user that the favorite places should be returned for."));