Example #1
0
/**
 * @param EntityBuilderHelper $entityBuilder
 * @param Entity[] $entityInstances
 * @param bool $tableHasActions [optional]
 * @param bool $appendCreateButton [optional]
 */
function buildListViewFromList($entityBuilder, $entityInstances, $tableHasActions = true, $appendCreateButton = true)
{
    $isEmpty = false;
    if (empty($entityInstances)) {
        $isEmpty = true;
        array_push($entityInstances, $entityBuilder->createEmpty());
    }
    $listViewAggregator = new ListViewAggregator($entityInstances, $tableHasActions);
    $contentHeader = $entityBuilder->getLabel();
    $contentAction = 'Lista';
    $contentHTML = $listViewAggregator->buildListHTML($isEmpty, $appendCreateButton);
    $GLOBALS[CONTENT_HEADER] = $contentHeader;
    $GLOBALS[CONTENT_ACTION] = $contentAction;
    $GLOBALS[CONTENT_HTML] = $contentHTML;
}
Example #2
0
$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);
?>
Example #3
0
/**
 * Created by PhpStorm.
 * User: Marin Kaçaj
 * Date: 6/19/2015
 * Time: 1:07 AM
 */
use fti\adv_db\aggregator\ListViewAggregator;
use fti\adv_db\entity\Attendance;
use fti\adv_db\entity\Professor;
require_once dirname(dirname(__FILE__)) . '/includes/loader.php';
require_once dirname(dirname(__FILE__)) . '/pages/listHelper.php';
redirectIfNotProfessor();
$currentlyLoggedInProfessor = getCurrentlyLoggedInUser();
$professorID = $currentlyLoggedInProfessor->getProperty(Professor::PROP_ID)->getValue();
$entityBuilder = Attendance::getBuilder();
$entityInstances = Attendance::getList($professorID);
$isEmpty = false;
if (empty($entityInstances)) {
    $isEmpty = true;
    array_push($entityInstances, $entityBuilder->createEmpty());
}
$listViewAggregator = new ListViewAggregator($entityInstances, true);
$listViewAggregator->setIsUpdateButtonDisplayed(true);
$listViewAggregator->setIsDeleteButtonDisplayed(false);
$contentHeader = $entityBuilder->getLabel();
$contentAction = 'Lista';
$contentHTML = $listViewAggregator->buildListHTML($isEmpty);
$GLOBALS[CONTENT_HEADER] = $contentHeader;
$GLOBALS[CONTENT_ACTION] = $contentAction;
$GLOBALS[CONTENT_HTML] = $contentHTML;
require_once dirname(dirname(__FILE__)) . '/pages/listPage.php';