. */ include("./include/include.php"); require_once(FILESYSTEMROOTPATH."jc/include/classes/DefaultLayout.php"); require_once(FILESYSTEMROOTPATH."include/form/AbstractForm.php"); class AAForm extends AbstractForm { public function __construct(Layout $layout, IModel $model) { parent::__construct($layout, $model); } public function save(IModel $model) { $id = $model->getId(); $agoraeService = $GLOBALS['ClassFactory']->getAgoraeService(); $agora = $agoraeService->load($id); $_SESSION['JC_MODULE']['AgoraId']= $id; $_SESSION['JC_MODULE']['Agora']=$agora->getAgora(); $delegatesService = $GLOBALS['ClassFactory']->getDelegatesService(); $delegate = $delegatesService->load($_SESSION['sess_uid']); $body_code = $delegate->getBodyCode(); $_SESSION['JC_MODULE']['BodyCode'] = $body_code; $res = $delegatesService->getBodyName($body_code); $_SESSION['JC_MODULE']['BodyName'] = $res['BodyName']; //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($body_code OR isset( $_SESSION['sess_access_bodyCodes']['XJU']['JC_MANAGE']) ){ $_SESSION['sess_access'] = Access::BOARD; }else{ $_SESSION['sess_access'] = Access::VISITOR; } if(isset($_SESSION['JC_MODULE']['body_numberofvotes'])){ unset($_SESSION['JC_MODULE']['body_numberofvotes']); } $this->layout->redirect('index.php'); } } $layout = new DefaultLayout(Access::VISITOR); $layout->init(); $agoraeService = $GLOBALS['ClassFactory']->getAgoraeService(); $data = $agoraeService->loadAll(); $agorae = array(); foreach($data as $a){ $agorae[$a['id']] = $a['agora']; } $layout->echoln('Select active agora
All side menus will refer to the selected agora
'); $active = $_SESSION['JC_MODULE']['AgoraId']; $AAForm = new AAForm($layout, new Agorae($data[$active])); $AAField = new SelectField('id','Agora',$agorae); $AAForm->addField($AAField); $AAForm->setSubmitText('Select'); $AAForm->display(); $layout->page_footer(); ?>