/** {@inheritdoc} */
 public function index($data)
 {
     if (Util::arrayHasData($data)) {
         // does the request end with .json
         $jsonRequest;
         try {
             $this->removeFileExtensionFromURLData($data, '.json');
             $jsonRequest = true;
         } catch (UnexpectedValueException $e) {
             $jsonRequest = false;
         }
         // if this is a json request
         if ($jsonRequest) {
             try {
                 $this->_processJsonRequest($data);
                 return;
             } catch (RuntimeException $e) {
                 throw new PageNotFoundException();
             }
         } else {
         }
         throw new PageNotFoundException();
     }
     $this->_indexPage();
 }
 /** {@inheritdoc} */
 public function index($data)
 {
     if (Util::arrayHasData($data)) {
         throw new PageNotFoundException();
     }
     $this->_indexPage();
 }
 public function contact($data)
 {
     if (Util::arrayHasData($data)) {
         throw new PageNotFoundException();
     }
     $data = array();
     $meta = array('title' => 'Contact Us - Grand Training');
     $this->_renderPage('about/contact.php', $data, $meta);
 }
 /** {@inheritdoc} */
 public function index($data)
 {
     if (Util::arrayHasData($data)) {
         $r_data = array_slice($data, 1);
         switch ($data[0]) {
             default:
                 throw new PageNotFoundException();
                 break;
             case 'test.html':
                 $this->_test_dot_html($r_data);
                 break;
         }
         return;
     }
     $this->_indexPage();
 }
 /**
  * echo out json of the course dates availiable
  * A courseid can be specified in $_GET to refine the selection
  * @param array $data Any additional path data passed in the url
  * @throws PageNotFoundException if $data contains any data
  */
 private function _dates_dot_json($data)
 {
     if (Util::arrayHasData($data)) {
         throw new PageNotFoundException();
     }
     $model = new Model();
     $courseid = isset($_GET['course']) ? $_GET['course'] : 0;
     header('Content-type: application/json');
     echo json_encode($model->getCourseDates($courseid));
 }
 /**
  * Remove the given file extension from the url data array.
  * Modifies $data.
  *
  * @param array $data The url data
  * @param string $extension The file extension to remove
  * @throws UnexpectedValueException if the url doesn't end with the given extension
  */
 protected function removeFileExtensionFromURLData(array &$data, $extension)
 {
     $length = count($data);
     if (!Util::stringEndsWith($data[$length - 1], $extension)) {
         throw new UnexpectedValueException("url doesn't end with {$extension}");
     }
     $data[$length - 1] = substr($data[$length - 1], 0, strlen($data[$length - 1]) - strlen($extension));
 }