コード例 #1
0
 /**
  * @param array $params
  * @param bool $isPartOfList [optional]
  */
 function __construct($params, $isPartOfList = false)
 {
     $this->label = self::LABEL;
     $this->isPartOfList = $isPartOfList;
     $this->id = array(self::PROP_SUBJECT_ID => intval($params[self::PROP_SUBJECT_ID]), self::PROP_STUDENT_ID => intval($params[self::PROP_STUDENT_ID]));
     $this->properties[self::PROP_SUBJECT_ID] = new EntityProperty(self::PROP_SUBJECT_ID, 'Lende', $this->id[self::PROP_SUBJECT_ID], Subject::getBuilder()->getList($isPartOfList), true, true, Subject::getBuilder()->getByIdentifier(array(Subject::PROP_ID => $this->id[self::PROP_SUBJECT_ID])));
     $this->properties[self::PROP_STUDENT_ID] = new EntityProperty(self::PROP_STUDENT_ID, 'Student', $this->id[self::PROP_STUDENT_ID], Student::getBuilder()->getList($isPartOfList), true, true, Student::getBuilder()->getByIdentifier(array(Student::PROP_ID => $this->id[self::PROP_STUDENT_ID])));
     $this->properties[self::PROP_SEMINARIES] = new BooleanProperty(self::PROP_SEMINARIES, 'Frekuentim Seminaresh', $params, self::PROP_SEMINARIES, true, true);
     $this->properties[self::PROP_LAB] = new BooleanProperty(self::PROP_LAB, 'Frekuentim Laboratoresh', $params, self::PROP_LAB, true, true);
     $this->properties[self::PROP_ASSIGNMENT] = new BooleanProperty(self::PROP_ASSIGNMENT, 'Dorëzim Detyre Kursi', $params, self::PROP_ASSIGNMENT, true, true);
     $this->properties[self::PROP_STATUS] = new BooleanProperty(self::PROP_STATUS, 'Përmirësim', $params, self::PROP_STATUS, true, true);
     $this->actionHelper = new EntityActionHelper(self::TABLE_NAME, $this);
 }
コード例 #2
0
ファイル: security.php プロジェクト: MarinKacaj/MarksManager
/**
 * @param string $tableName
 * @param array $loginFilter
 * @return bool|UserEntity
 */
function getLoggedInUserByFilter($tableName, $loginFilter)
{
    switch ($tableName) {
        case Student::TABLE_NAME:
            $userInstance = Student::getBuilder()->filterByParams($loginFilter);
            break;
        case Professor::TABLE_NAME:
            $userInstance = Professor::getBuilder()->filterByParams($loginFilter);
            break;
        case Secretary::TABLE_NAME:
            $userInstance = Secretary::getBuilder()->filterByParams($loginFilter);
            break;
        default:
            $userInstance = false;
            break;
    }
    return $userInstance;
}
コード例 #3
0
ファイル: Result.php プロジェクト: MarinKacaj/MarksManager
 /**
  * @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;
 }
コード例 #4
0
ファイル: delete.php プロジェクト: MarinKacaj/MarksManager
<?php

/**
 * Created by PhpStorm.
 * User: Marin Kaçaj
 * Date: 6/14/2015
 * Time: 4:49 PM
 */
use fti\adv_db\entity\Student;
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(Student::PROP_ID));
$studentInstance = Student::getBuilder()->getByIdentifier($id);
$actionNavigator = new ActionNavigator($studentInstance);
$actionNavigator->deleteAndRedirect();
コード例 #5
0
ファイル: edit.php プロジェクト: MarinKacaj/MarksManager
<?php

/**
 * Created by PhpStorm.
 * User: Marin Kaçaj
 * Date: 6/14/2015
 * Time: 2:05 PM
 */
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';
redirectIfNotSecretary();
$identifier = HttpEntityParamBuilder::retrieveFilter(array(Student::PROP_ID));
$entityBuilder = Student::getBuilder();
buildEditView($entityBuilder, $identifier);
require_once dirname(dirname(__FILE__)) . '/pages/formPage.php';
コード例 #6
0
ファイル: edit.php プロジェクト: MarinKacaj/MarksManager
 */
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';
コード例 #7
0
ファイル: update.php プロジェクト: MarinKacaj/MarksManager
<?php

/**
 * Created by PhpStorm.
 * User: Marin Kaçaj
 * Date: 6/13/2015
 * Time: 7:29 PM
 */
use fti\adv_db\entity\Student;
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();
$params = HttpEntityParamBuilder::buildParams();
$studentInstance = new Student($params);
$studentInstance->unsetPassword();
$actionNavigator = new ActionNavigator($studentInstance);
$actionNavigator->updateAndRedirect();