コード例 #1
0
ファイル: index.php プロジェクト: piiskop/pstk
 /**
  * This function starts everything.
  *
  * @access public
  * @param string $parameters['target']
  *        	the target
  * @uses Pupil for the search
  * @uses PupilView for the search form
  */
 public static function start($parameters)
 {
     if ('export' === $parameters['target']) {
         require_once dirname(__FILE__) . '/Pupil.php';
         $content = Pupil::getRawPupils();
         echo json_encode($content);
     } else {
         require_once dirname(__FILE__) . '/PupilView.php';
         if (isset($_GET['name'])) {
             require_once dirname(__FILE__) . '/Pupil.php';
             Pupil::setProperty('name');
             $resultOfSearch = Pupil::findPositionAsBinary(array('array' => Pupil::getRawPupils(), 'property' => 'name', 'value' => $_GET['name']));
             if ($resultOfSearch['position'] > -1) {
                 $css = PupilView::buildCss(array('displayResult' => true, 'displayNoResult' => false, 'displaySteps' => true));
             } else {
                 $css = PupilView::buildCss(array('displayResult' => false, 'displayNoResult' => true, 'displaySteps' => true));
             }
             $js = PupilView::buildJs(array('position' => $resultOfSearch['position']));
             $numberOfSteps = $resultOfSearch['numberOfSteps'];
         } else {
             $js = PupilView::buildJs(array('position' => -1));
             $css = PupilView::buildCss(array('displayResult' => false, 'displayNoResult' => false, 'displaySteps' => false));
             $numberOfSteps = 0;
         }
         echo PupilView::buildView(array('css' => $css, 'name' => isset($_GET['name']) ? $_GET['name'] : null, 'js' => $js, 'numberOfSteps' => $numberOfSteps, 'target' => $parameters['target']));
     }
 }
コード例 #2
0
ファイル: Controller.php プロジェクト: piiskop/pstk
 /**
  * Run mvc
  * Also does routing
  * 
  * @param array $parGET
  * @param array $parPOST
  */
 public static function start($parGET, $parPOST)
 {
     self::setUp();
     //        Pupil::TEST();
     $route = '';
     if (array_key_exists('fname', $parGET)) {
         $route = 'searchPHP';
     }
     switch ($route) {
         case 'searchPHP':
             $r = Pupil::searchByName($parGET['fname']);
             $r['name'] = $parGET['fname'];
             //                print_r($r);
             echo PupilView::buildView($r);
             break;
         default:
             echo PupilView::buildView();
             break;
     }
 }
コード例 #3
0
ファイル: Controller.php プロジェクト: piiskop/pstk
 public static function start()
 {
     require_once dirname(__FILE__) . '/PupilView.php';
     $name = Controller::test_input($_GET["name"]);
     PupilView::buildView(array("name" => $name));
 }