Exemplo n.º 1
0
 /**
  * @param array $params
  * @param bool $isPartOfList [optional]
  */
 function __construct($params, $isPartOfList = false)
 {
     $examID = intval($params[self::PROP_EXAM_ID]);
     $studentID = intval($params[self::PROP_STUDENT_ID]);
     $examInstance = Exam::getBuilder()->getByIdentifier(array(Exam::PROP_ID => $examID));
     $studentInstance = Student::getBuilder()->getByIdentifier(array(Student::PROP_ID => $studentID));
     $this->label = self::LABEL;
     $this->id = array(self::PROP_EXAM_ID => intval($params[self::PROP_EXAM_ID]), self::PROP_STUDENT_ID => intval($params[self::PROP_STUDENT_ID]));
     $mark = intval($params[self::PROP_MARK]);
     if ($mark < 4 || $mark > 10) {
         $mark = 4;
     }
     $this->properties[self::PROP_EXAM_ID] = new EntityProperty(self::PROP_EXAM_ID, 'Provimi', $examID, array($examInstance), true, true, $examInstance);
     $this->properties[self::PROP_STUDENT_ID] = new EntityProperty(self::PROP_STUDENT_ID, 'Studenti', $studentID, array($studentInstance), true, true, $studentInstance);
     $this->properties[self::PROP_MARK] = new IntegerProperty(self::PROP_MARK, 'Nota', $mark, true, true, 4, 10);
     $this->properties[self::PROP_DATE] = new DateProperty(self::PROP_DATE, 'Data e Provimit', $params[self::PROP_DATE], true, true);
     $this->actionHelper = new EntityActionHelper(self::TABLE_NAME, $this);
     $this->isPartOfList = $isPartOfList;
 }
Exemplo n.º 2
0
<?php

/**
 * Created by PhpStorm.
 * User: Marin Kaçaj
 * Date: 6/14/2015
 * Time: 2:05 PM
 */
use fti\adv_db\entity\Exam;
use fti\adv_db\http\HttpEntityParamBuilder;
require_once dirname(dirname(__FILE__)) . '/includes/loader.php';
require_once dirname(dirname(__FILE__)) . '/pages/editHelper.php';
redirectIfNotSecretary();
$identifier = HttpEntityParamBuilder::retrieveFilter(array(Exam::PROP_ID));
$entityBuilder = Exam::getBuilder();
buildEditView($entityBuilder, $identifier);
require_once dirname(dirname(__FILE__)) . '/pages/formPage.php';
Exemplo n.º 3
0
 */
use fti\adv_db\aggregator\FormViewAggregator;
use fti\adv_db\entity\Exam;
use fti\adv_db\entity\Result;
use fti\adv_db\entity\Student;
use fti\adv_db\http\HttpEntityParamBuilder;
require_once dirname(dirname(__FILE__)) . '/includes/loader.php';
require_once dirname(dirname(__FILE__)) . '/pages/editHelper.php';
redirectIfNotProfessor();
$previousURL = $_GET[PREVIOUS_URL];
$previousURLArg = http_build_str(array(PREVIOUS_URL => $previousURL));
$identifier = HttpEntityParamBuilder::retrieveFilter(array(Result::PROP_EXAM_ID, Result::PROP_STUDENT_ID));
$entityBuilder = Result::getBuilder();
$entityInstance = $entityBuilder->getByIdentifier($identifier);
if (!$entityInstance) {
    $entityInstance = $entityBuilder->createEmpty();
}
$entityInstance->setProperty(Result::PROP_EXAM_ID, $identifier[Result::PROP_EXAM_ID]);
$entityInstance->setProperty(Result::PROP_STUDENT_ID, $identifier[Result::PROP_STUDENT_ID]);
$examInstance = Exam::getBuilder()->getByIdentifier(array(Exam::PROP_ID => $identifier[Result::PROP_EXAM_ID]));
$studentInstance = Student::getBuilder()->getByIdentifier(array(Student::PROP_ID => $identifier[Result::PROP_STUDENT_ID]));
$entityInstance->getProperty(Result::PROP_EXAM_ID)->setEntityInstances(array($examInstance));
$entityInstance->getProperty(Result::PROP_STUDENT_ID)->setEntityInstances(array($studentInstance));
$formViewAggregator = new FormViewAggregator($entityInstance, $previousURLArg);
$contentHeader = $entityBuilder->getLabel();
$contentAction = 'P&euml;rdit&euml;so';
$contentHTML = $formViewAggregator->buildEntityFormHTML();
$GLOBALS[CONTENT_HEADER] = $contentHeader;
$GLOBALS[CONTENT_ACTION] = $contentAction;
$GLOBALS[CONTENT_HTML] = $contentHTML;
require_once dirname(dirname(__FILE__)) . '/pages/formPage.php';
Exemplo n.º 4
0
<?php

/**
 * Created by PhpStorm.
 * User: Marin Kaçaj
 * Date: 6/14/2015
 * Time: 4:49 PM
 */
use fti\adv_db\entity\Exam;
use fti\adv_db\http\HttpEntityParamBuilder;
use fti\adv_db\nav\ActionNavigator;
require_once dirname(dirname(__FILE__)) . '/includes/session.php';
require_once dirname(dirname(__FILE__)) . '/auth/security.php';
require_once dirname(dirname(dirname(__FILE__))) . '/src/fti/adv_db/functions/auto_loader.php';
spl_autoload_register('class_auto_loader');
redirectIfNotSecretary();
$id = HttpEntityParamBuilder::retrieveFilter(array(Exam::PROP_ID));
$examInstance = Exam::getBuilder()->getByIdentifier($id);
$actionNavigator = new ActionNavigator($examInstance);
$actionNavigator->deleteAndRedirect();