/** * @param array $params * @param bool $isPartOfList [optional] */ function __construct($params, $isPartOfList = false) { if (!isset($params[self::PROP_ID])) { $params[self::PROP_ID] = BasicEntity::UNSAVED_INSTANCE_ID; } $headID = intval($params[self::PROP_HEAD_ID]); $member1ID = intval($params[self::PROP_MEMBER1_ID]); $member2ID = intval($params[self::PROP_MEMBER2_ID]); $seasonID = intval($params[self::PROP_SEASON_ID]); $subjectID = intval($params[self::PROP_SUBJECT_ID]); $departmentID = intval($params[self::PROP_DEPARTMENT_ID]); $seasonInstance = Season::getBuilder()->getByIdentifier(array(Season::PROP_ID => $seasonID)); $subjectInstance = Subject::getBuilder()->getByIdentifier(array(Subject::PROP_ID => $subjectID)); $departmentInstance = Department::getBuilder()->getByIdentifier(array(Department::PROP_ID => $departmentID)); $this->headID = $headID; $this->member1ID = $member1ID; $this->member2ID = $member2ID; $this->label = self::LABEL; $this->id = array(self::PROP_ID => $params[self::PROP_ID]); $this->properties[self::PROP_ID] = new IntegerProperty(self::PROP_ID, 'ID', $this->id[self::PROP_ID], false, false); $this->properties[self::PROP_SEASON_ID] = new EntityProperty(self::PROP_SEASON_ID, 'Sezon', intval($params[self::PROP_SEASON_ID]), Season::getBuilder()->getList($isPartOfList), true, true, $seasonInstance); $this->properties[self::PROP_SUBJECT_ID] = new EntityProperty(self::PROP_SUBJECT_ID, 'Lende', $subjectID, Subject::getBuilder()->getList($isPartOfList), true, true, $subjectInstance); $this->properties[self::PROP_DEPARTMENT_ID] = new EntityProperty(self::PROP_DEPARTMENT_ID, 'Dege', $departmentID, Department::getBuilder()->getList($isPartOfList), true, true, $departmentInstance); $this->properties[self::PROP_HEAD_ID] = new EntityProperty(self::PROP_HEAD_ID, 'Kryetar Komisioni', $headID, Professor::getBuilder()->getList($isPartOfList), true); $this->properties[self::PROP_MEMBER1_ID] = new EntityProperty(self::PROP_MEMBER1_ID, 'Anëtar 1', $member1ID, Professor::getBuilder()->getList($isPartOfList), true); $this->properties[self::PROP_MEMBER2_ID] = new EntityProperty(self::PROP_MEMBER2_ID, 'Anëtar 2', $member2ID, Professor::getBuilder()->getList($isPartOfList), true); $this->actionHelper = new EntityActionHelper(self::TABLE_NAME, $this); $this->isPartOfList = $isPartOfList; }
/** * @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; }
/** * @param array $params * @param bool $isPartOfList [optional] */ function __construct($params, $isPartOfList = false) { $this->label = 'NJK'; $headSecretaryID = intval($params[self::PROP_HEAD_SECRETARY_ID]); $secretaryID = intval($params[self::PROP_SECRETARY_ID]); $this->headSecretaryID = $headSecretaryID; $this->secretaryID = $secretaryID; $this->properties = array(); $this->id = array(self::PROP_ID => $params[self::PROP_ID]); $this->properties[self::PROP_ID] = new IntegerProperty(self::PROP_ID, 'ID', $this->id[self::PROP_ID], false, false); $this->properties[self::PROP_NAME] = new StringProperty(self::PROP_NAME, 'Emri', $params[self::PROP_NAME], true, true); $this->properties[self::PROP_ADDRESS] = new StringProperty(self::PROP_ADDRESS, 'Adresa', $params[self::PROP_ADDRESS], true, true); $this->properties[self::PROP_DEAN_ID] = new EntityProperty(self::PROP_DEAN_ID, 'Dekani', intval($params[self::PROP_DEAN_ID]), Professor::getBuilder()->getList($isPartOfList), true); $this->properties[self::PROP_HEAD_SECRETARY_ID] = new EntityProperty(self::PROP_HEAD_SECRETARY_ID, 'Krye Sekretarja', $headSecretaryID, Secretary::getBuilder()->getList($isPartOfList), true); $this->properties[self::PROP_SECRETARY_ID] = new EntityProperty(self::PROP_SECRETARY_ID, 'Sekretarja', $secretaryID, Secretary::getBuilder()->getList($isPartOfList), true); $this->properties[self::PROP_UNIVERSITY_ID] = new EntityProperty(self::PROP_UNIVERSITY_ID, 'Universiteti', $params[self::PROP_UNIVERSITY_ID], University::getBuilder()->getList($isPartOfList), true); $this->actionHelper = new EntityActionHelper(self::TABLE_NAME, $this); $this->isPartOfList = $isPartOfList; }
<?php /** * Created by PhpStorm. * User: Marin Kaçaj * Date: 6/8/2015 * Time: 6:14 PM */ use fti\adv_db\entity\Professor; require_once dirname(dirname(__FILE__)) . '/includes/loader.php'; require_once dirname(dirname(__FILE__)) . '/pages/createHelper.php'; redirectIfNotSecretary(); $entityBuilder = Professor::getBuilder(); buildCreateView($entityBuilder); require_once dirname(dirname(__FILE__)) . '/pages/formPage.php';
$subjectID = $filters[Subject::TABLE_NAME] = intval($filters[Subject::TABLE_NAME]); $groupID = $filters[Group::TABLE_NAME] = intval($filters[Group::TABLE_NAME]); $isImprovement = isset($_GET[RESULT_IS_FOR_IMPROVEMENT]) ? true : false; if (isset($_GET[RESULT_IS_FOR_IMPROVEMENT])) { $filters[RESULT_IS_FOR_IMPROVEMENT] = true; } $entityBuilder = ExamResult::getBuilder(); $entityInstances = ExamResult::getFilteredList($seasonID, $subjectID, $groupID, $professorID, $isImprovement); $isEmpty = false; if (empty($entityInstances)) { $isEmpty = true; array_push($entityInstances, $entityBuilder->createEmpty()); } else { $headProfessor = Professor::getBuilder()->getByIdentifier(array(Professor::PROP_ID => $entityInstances[0]->getProperty(ExamResult::PROP_EXAM_HEAD_ID)->getValue())); $member1Professor = Professor::getBuilder()->getByIdentifier(array(Professor::PROP_ID => $entityInstances[0]->getProperty(ExamResult::PROP_EXAM_MEMBER1_ID)->getValue())); $member2Professor = Professor::getBuilder()->getByIdentifier(array(Professor::PROP_ID => $entityInstances[0]->getProperty(ExamResult::PROP_EXAM_MEMBER2_ID)->getValue())); } $listViewAggregator = new ListViewAggregator($entityInstances, true); $listViewAggregator->setIsUpdateButtonDisplayed(true); $listViewAggregator->setIsDeleteButtonDisplayed(false); $baseURL = get_assets_base_url(); $listDefaultFileName = LIST_DEFAULT_FILE_NAME; $filterArgs = http_build_str($filters); $previousURL = $baseURL . "result/{$listDefaultFileName}?{$filterArgs}"; $previousURL = urlencode($previousURL); $listViewAggregator->setCommonParams(array(PREVIOUS_URL => $previousURL)); $subjectInstance = Subject::getBuilder()->getByIdentifier(array(Subject::PROP_ID => $subjectID)); $groupInstance = Group::getBuilder()->getByIdentifier(array(Group::PROP_ID => $groupID)); $contentHeader = $entityBuilder->getLabel(); $contentAction = 'Lista'; $contentHTML = $listViewAggregator->buildListHTML($isEmpty, false);
<?php /** * Created by PhpStorm. * User: Marin Kaçaj * Date: 6/14/2015 * Time: 4:49 PM */ use fti\adv_db\entity\Professor; 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(Professor::PROP_ID)); $professorInstance = Professor::getBuilder()->getByIdentifier($id); $actionNavigator = new ActionNavigator($professorInstance); $actionNavigator->deleteAndRedirect();