public function executeNormalView() { $this->setup(); $this->poll = $this->slot->getPoll(); $type = $this->poll->getType(); if (!($this->show_poll = aPollToolkit::checkIfShowPoll($this->getRequest(), $this->poll))) { return 'Success'; } // validating apoll_settings_available_polls entry $this->poll_validation = aPollToolkit::checkPollConfiguration($type); if ($this->poll_validation->isValid()) { $form_name = aPollToolkit::getPollFormName($type); $this->poll_form = new $form_name(array('poll_id' => $this->poll->getId(), 'slot_name' => $this->name, 'permid' => $this->permid, 'pageid' => $this->pageid, 'remote_address' => $this->getRequest()->getRemoteAddress(), 'culture' => $this->getUser()->getCulture(), 'poll_type' => $type)); // Getting view template partial to display the form. // The template can be defined in two ways: // - In apoll_settings_view_default_template, to set an overall template for all polls // - In In apoll_settings_available_polls_XXX_view_template, where XXX // is the name of this poll, to override the default display template $this->form_view_template = aPollToolkit::getPollViewTemplate($type); // Getting the action treating the form sumbission. // The action can be defined in two ways: // - In apoll_settings_view_submit_action, to set an overall action for all polls // - In In apoll_settings_available_polls_XXX_submit_action, where XXX // is the name of this poll, to override the default action $this->submit_action = aPollToolkit::getPollSubmitAction($type); } }
public function executePreviewPoll(sfWebRequest $request) { $this->poll_values = $request->getParameter('a_poll_poll'); $name = $this->poll_values['type']; $this->poll_validation = aPollToolkit::checkPollConfiguration($name); $culture = $this->getUser()->getCulture(); // filling data required to preview the poll $this->poll = new aPollPoll(); $this->poll->setTitle($this->poll_values[$culture]['title']); $this->poll->setDescription($this->poll_values[$culture]['description']); $form = aPollToolkit::getPollFormName($name); $this->form = new $form(); $this->form_view_template = aPollToolkit::getPollViewTemplate($name); $this->submit_action = aPollToolkit::getPollSubmitAction($name); // some fake values, just to call the form partial $this->pageid = 1; $this->name = 'dfsd'; $this->permid = 1; }