. */ include("./include/include.php"); require_once(FILESYSTEMROOTPATH."jc/include/classes/DefaultLayout.php"); require_once(FILESYSTEMROOTPATH."include/form/AbstractForm.php"); require_once(FILESYSTEMROOTPATH."jc/include/classes/DateTimeSelectField.php"); /** * Helper classes */ class pollOptionsForm extends AbstractForm { private $poll_id; public function __construct(Layout $layout, IModel $model, $poll_id) { parent::__construct($layout, $model); $this->poll_id = $poll_id; } public function save(IModel $model) { $poService = $GLOBALS['ClassFactory']->getPollOptionsService(); if( $poService->saveOrUpdate($model) ) { $this->layout->redirect('poll_options1.php?pid='.$this->poll_id); }else { $this->layout->echoln("Failed saving"); } } } /** * End of helper classes */ $layout = new DefaultLayout("JC_MANAGE", "./jc/"); $layout->init(); $layout->echoln('

Back

'); $poService = $GLOBALS['ClassFactory']->getPollOptionsService(); //get polls_id if set if (isset($_GET['pid'])){ $poll_id = $_GET['pid']; $poll = $GLOBALS['ClassFactory']->getPollsService()->load($poll_id); } else{ $layout->redirect('polls1.php'); } //get id if set if (isset($_GET['id'])){ $id = $_GET['id']; $pollOption = $poService->load($id); } else{ $pollOption = new pollOptions(''); $pollOption->setPoll_id($poll_id); } if (date("Y-m-d H:i:s") > $poll->getOpen()){ $layout->echoln('Poll has opened!'); $layout->echoln('
Back'); } else { $layout->echoln('Poll Options for '.$poll->getTitle().'

'); $form = new pollOptionsForm($layout, $pollOption, $poll_id); $tf1 = new TextField('pollOption', 'Option'); $tf2 = new TextField('description','Description'); $form->addField($tf1->setCompulsory(true)); $form->addField($tf2); $form->display(); } $layout->page_footer(); ?>