예제 #1
0
파일: PupilView.php 프로젝트: piiskop/pstk
 /**
  * This function builds the main structure in HTML.
  *
  * @access public
  * @param string $parameters['title'] the title
  * @return string the parsed HTML-structure
  * @uses ROOT_FOLDER for the path to the HTML-template file
  */
 public static function buildView($parameters)
 {
     require_once 'HTML/Template/IT.php';
     $tpl = new \HTML_Template_IT(ROOT_FOLDER);
     $tpl->loadTemplatefile('students-template.html');
     $tpl->setCurrentBlock('html');
     $tpl->setVariable(array('TITLE' => $parameters['title'], 'STUDENT-CLASS' => $parameters['student-class'], 'NO-STUDENT' => $parameters['no-student'], 'STEPS' => $parameters['steps'], 'STYLE' => \students\PupilView::buildCss(), 'JS' => \students\PupilView::buildJs(array($parameters['guess']))));
     $tpl->parse('html');
     return $tpl->get('html');
 }
예제 #2
0
파일: index.php 프로젝트: piiskop/pstk
 /**
  * This function is the stn.
  *
  * @access public
  * @author Rasmus <*****@*****.**>
  * @uses PupilView for the visual part
  */
 public static function start()
 {
     require_once dirname(__FILE__) . '/Pupil.php';
     require_once dirname(__FILE__) . '/PupilView.php';
     $search = \students\Pupil::binarySearch();
     if (isset($_GET['lastName']) && $search['guess'] > 0) {
         echo \students\PupilView::buildView(array('title' => 'Students', 'student-class' => 'Visible', 'steps' => "Korduste arv: " . $search['guesstimes'], 'guess' => $search['guess']));
     } elseif (isset($_GET['lastName']) && $search['guess'] < 0) {
         echo \students\PupilView::buildView(array('title' => 'Students', 'student-class' => 'Invisible', 'no-student' => "Sellist õpilast pole.", 'steps' => "Korduste arv: " . $search['guesstimes']));
     } elseif (isset($_GET['lastName']) && $_GET['lastName'] === "") {
         echo \students\PupilView::buildView(array('title' => 'Students', 'student-class' => 'Invisible', 'no-student' => "Sisesta otsinguks õpilase nimi."));
     } else {
         echo \students\PupilView::buildView(array('title' => 'Students', 'student-class' => 'Invisible'));
     }
 }