. */ require_once(FILESYSTEMROOTPATH."include/classes/Layout.php"); class DefaultLayout extends Layout { public $bbcodeexplanation = "Use bbcode to format your comment: [b]bold text[/b] to create bold text, [i]italic text[/i] to create italic text, [u]underlined text[/u] to create underlined text and [url=http://www.aegee.org/]a link[/url] to create a link."; public $jcwarning = "Don't forget that we cannot change a proposal against the wishes of the proposers, so only use this function for fixing layout/spelling/grammer mistakes or if the proposers agree. Any changes in the content after the deadline of two weeks before the Agora have to be accepted as an amendment during the prytanium.
"; /** * Initialise layout: handle login/logout and provide basic access check * * Note: this function does only return if required access met */ public function init() { parent::init(); if( !isset( $_SESSION['JC_MODULE']['AgoraId'] ) ){ $agora = $GLOBALS['ClassFactory']->getAgoraeService()->getLatestAgora(); $_SESSION['JC_MODULE']['AgoraId'] = $agora->getId(); $_SESSION['JC_MODULE']['Agora'] = $agora->getAgora(); $_SESSION['JC_MODULE']['AgoraOpen'] = $agora->getA_open(); $_SESSION['JC_MODULE']['AgoraClose'] = $agora->getA_close(); if( $_SESSION['sess_access'] > Access::VISITOR ){ $delegatesService = $GLOBALS['ClassFactory']->getDelegatesService(); $delegate = $delegatesService->load($_SESSION['sess_uid']); //should check if still delegate //if not delegate for this agora, (e.g. selected from Past Agorae) //object has empty strings, e.g. $body_code = '' if (!empty($delegate) OR isset($_SESSION['sess_access_bodyCodes']['XJU']['JC_MANAGE'])){ $_SESSION['sess_access'] = Access::BOARD; $body_code = $delegate->getBodyCode(); $_SESSION['JC_MODULE']['BodyCode'] = $body_code; $res = $delegatesService->getBodyName($body_code); $_SESSION['JC_MODULE']['BodyName'] = $res['BodyName']; }else{ $_SESSION['sess_access'] = Access::VISITOR; } } } //public (logged) menu if( $_SESSION['sess_access'] >= Access::VISITOR ) { $this->addSideMenu("", $_SESSION['JC_MODULE']['Agora'] ); $this->addSideMenu("view.php", "view CIA"); $this->addSideMenu("view_accepted.php", "Proposals"); $this->addSideMenu("view_votings.php", "Other Votings"); $this->addSideMenu("view_results.php", "Results"); $this->addSideMenu("elections_view1.php", "Elections"); $this->addSideMenu("polls_view1.php", "Polls"); $this->addSideMenu("ranked_view1.php", "Ranked Votings"); $this->addSideMenu("attendance_summary.php", "Plenary Attendance"); $this->addSideMenu("create_proposal0.php", "My Proposals"); $this->addSideMenu("agora_select.php", "Past Agorae"); $this->addSideMenu("help.php", "Help"); } //delegate menu if( $_SESSION['sess_access'] > Access::VISITOR ) { if (!isset($_SESSION['JC_MODULE']['BodyCode'])){ $delegatesService = $GLOBALS['ClassFactory']->getDelegatesService(); $delegate = $delegatesService->load($_SESSION['sess_uid']); //should check if still delegate //if not delegate for this agora, (e.g. selected from Past Agorae) //object has empty strings, e.g. $body_code = '' if (!empty($delegate) OR isset($_SESSION['sess_access_bodyCodes']['XJU']['JC_MANAGE'])){ $_SESSION['sess_access'] = Access::BOARD; $body_code = $delegate->getBodyCode(); $_SESSION['JC_MODULE']['BodyCode'] = $body_code; $res = $delegatesService->getBodyName($body_code); $_SESSION['JC_MODULE']['BodyName'] = $res['BodyName']; }else{ $_SESSION['sess_access'] = Access::VISITOR; } } $now = date("Y-m-d H:i:s"); $refresh = 10*60; // 10 minutes if (!isset($_SESSION['JC_MODULE']['Notifications']) OR (strtotime($now) - strtotime($_SESSION['JC_MODULE']['Notifications']['timestamp'])) > $refresh ) { $ns = $GLOBALS['ClassFactory']->getNotificationsService(); $nots = $ns->loadMine(); $nots['Vote'] = $nots['Proposal'] + $nots['Rollcall']; $_SESSION['JC_MODULE']['Notifications'] = $nots; $_SESSION['JC_MODULE']['Notifications']['timestamp'] = $now; } $this->addSideMenu("", "Delegate Menu"); if($_SESSION['JC_MODULE']['Notifications']['Vote'] > 0){ $this->addSideMenu("vote.php", "Votings ({$_SESSION['JC_MODULE']['Notifications']['Vote']})"); }else{ $this->addSideMenu("vote.php", "Votings"); } if($_SESSION['JC_MODULE']['Notifications']['RankedVote'] > 0){ $this->addSideMenu("ranked_vote1.php", "Ranked Vote ({$_SESSION['JC_MODULE']['Notifications']['RankedVote']})"); }else{ $this->addSideMenu("ranked_vote1.php", "Ranked Vote"); } if($_SESSION['JC_MODULE']['Notifications']['Poll'] > 0){ $this->addSideMenu("polls_vote1.php", "Polls ({$_SESSION['JC_MODULE']['Notifications']['Poll']})"); }else{ $this->addSideMenu("polls_vote1.php", "Polls"); } if( $_SESSION['JC_MODULE']['Notifications']['Election'] > 0){ $this->addSideMenu("elections_vote1.php", "Elections ({$_SESSION['JC_MODULE']['Notifications']['Election']})"); }else{ $this->addSideMenu("elections_vote1.php", "Elections"); } $this->addSideMenu("elections_find.php", "Election Ballot Check"); } if( isset( $_SESSION['sess_access_bodyCodes']['XJU']['JC_MANAGE'] )){ $this->addSideMenu("", "JC/Chair" ); $this->addSideMenu("agorae_list.php", "List of Agorae"); $this->addSideMenu("plenaries_list.php", "Plenaries"); $this->addSideMenu("proposals.php", "Proposals"); $this->addSideMenu("rollcall1.php", "Other Votings"); $this->addSideMenu("elections1.php","Elections"); $this->addSideMenu("polls1.php","Polls"); $this->addSideMenu("ranked1.php","Ranked Votings"); $this->addSideMenu("update1.php","Update CIA"); $this->addSideMenu("instructions.php", "Instructions"); $this->addSideMenu("", "Members' Attendance"); $this->addSideMenu("agora_setup.php", "Setup Data"); $this->addSideMenu("register.php", "Register Participants"); $this->addSideMenu("attendance_overview.php", "Agora Quorum"); $this->addSideMenu("attendance_live.php", "Now in the plenary"); $this->addSideMenu("attendance_summary.php", "Plenary Attendance"); } if( isset( $_SESSION['sess_access_bodyCodes']['XJU']['JC_BARCODE'] )){ $this->addSideMenu("", "Barcode Menu"); $this->addSideMenu("barcodes.php", "Scan a barcode"); } if(isset($_SESSION['JC_MODULE']['user_special']) AND ($_SESSION['JC_MODULE']['user_special'] == 'Admin') ){ $this->addSideMenu("", "Admin" ); $this->addSideMenu("admin_main.php", "Admin" ); } } } ?>