.
*/
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) {
$agoraeService = $GLOBALS['ClassFactory']->getAgoraeService();
$x =$agoraeService->activate($model->getId());
if ($x){
$this->layout->redirect('agorae_list.php');
}
else{
echo 'Error';
}
}
}
$layout = new DefaultLayout("JC_MANAGE");
$layout->init();
$agoraeService = $GLOBALS['ClassFactory']->getAgoraeService();
$data = $agoraeService->loadAll();
$agorae = array();
$active = NULL;
foreach($data as $a){
$agorae[$a['id']] = $a['agora'];
if ($a['active'] == 1){
$active = $a['id'];
}
}
$layout->echoln('Select active agora
All side menus will refer to the selected agora
');
$AAForm = new AAForm($layout, new Agorae($data[$active]));
$AAField = new SelectField('id','Agora',$agorae);
$AAForm->addField($AAField);
$AAForm->setSubmitText('Activate');
$AAForm->display();
$layout->page_footer();
?>