Beispiel #1
0
 /**
  * this fuction builds family list
  * @access public
  * @author tambet
  * @param int|string:Family[int] $parameters['familys'] Family list
  * @return string
  */
 public static function buildList($parameters)
 {
     require_once 'HTML/Template/IT.php';
     $tpl = new \HTML_Template_IT(dirname(__FILE__) . '/');
     $tpl->loadTemplatefile('familys.html');
     $list = '';
     foreach ($parameters['familys'] as $idFamily => $family) {
         $list .= FamilyView::buildListItem(array('family' => $family));
     }
     $tpl->setCurrentBlock('familys');
     $tpl->setVariable(array('LIST' => $list));
     $tpl->parse('familys');
     return $tpl->get('familys');
 }
Beispiel #2
0
 /**
  * This function
  * @access public
  * @author Ergo
  * @param int|string:Family[int] $parameters
  */
 public static function buildList($parameters)
 {
     //See jutt on kopeeritav ja samasugune
     require_once 'HTML/Template/IT.php';
     //ise tuleb kataloogi aadress paika panna
     $tpl = new \HTML_Template_IT(dirname(__FILE__) . '/../html');
     //siia tuleb fail millesse teeb
     $tpl->loadTemplatefile('familys.html');
     $list = '';
     //siin luuakse massiiv muutujaga family
     foreach ($parameters['familys'] as $idFamily => $family) {
         //Siin reas on punkt ja võrdus et lisada
         $list .= FamilyView::buildListItem(array('family' => $family));
     }
     $tpl->setCurrentBlock('familys');
     $tpl->setVariable(array('LIST' => $list));
     $tpl->parse('familys');
     return $tpl->get('familys');
 }
Beispiel #3
0
<?php

require_once dirname(__FILE__) . '/../CONFIGURATION.php';
require_once dirname(__FILE__) . '/FamilyView.php';
require_once dirname(__FILE__) . '/Family.php';
if (isset($_GET['idFamily']) && $_GET['idFamily'] > -1) {
    $family = new Family();
    $family->setIdFamily($_GET['idFamily']);
    $family->setCompleteFamily();
    $body = FamilyView::buildFamilyView(array('family' => $family));
    $title = $family->getName();
} else {
    $title = 'Perekondade nimed';
    $familys = Family::getFamilys();
    $body = FamilyView::buildList(array('familys' => $familys));
}
require_once dirname(__FILE__) . '/PageView.php';
echo PageView::buildPage(array('title' => $title, 'body' => $body));
Beispiel #4
0
<?php

//Kontroller
//__FILE__ tähendam selle samase faili asukohta kus praegu ollaxe
require_once dirname(__FILE__) . '/configuration.php';
require_once dirname(__FILE__) . '/KaladeView.php';
require_once dirname(__FILE__) . '/kalad.php';
if (isset($_GET['idFamily']) && $_GET['idFamily'] > -1) {
    $family = new Family();
    $family->setIdFamily($_GET['idKalad']);
    $family->setCompleteFamily();
    $body = FamilyView::buildFamilyView(array('family' => $family));
    $titles = $family->getName();
} else {
    $familys = Kalad::getKalad();
    $titles = 'Perekondade nimed';
    $body = KaladeView::buildList(array('familys' => $familys));
}
require_once dirname(__FILE__) . '/PageView.php';
echo PageView::buildPage(array('title' => $titles, 'body' => $body));