Exemplo n.º 1
0
 private function getForm(GWF_VoteMulti $poll, GWF_User $user)
 {
     $data = array();
     $data['title'] = array(GWF_Form::STRING, $poll->getVar('vm_title'), $this->module->lang('th_title'));
     $data['guest'] = array(GWF_Form::CHECKBOX, $poll->isGuestVoteAllowed(), $this->module->lang('th_guests'));
     $data['multi'] = array(GWF_Form::CHECKBOX, $poll->isMultipleChoice(), $this->module->lang('th_multi'));
     $data['enabled'] = array(GWF_Form::CHECKBOX, $poll->isEnabled(), $this->module->lang('th_enabled'));
     if (Module_Votes::mayAddGlobalPoll(GWF_Session::getUser())) {
         $data['public'] = array(GWF_Form::CHECKBOX, $poll->isGlobal(), $this->module->lang('th_vm_public'));
     }
     $data['view'] = array(GWF_Form::SELECT, GWF_VoteMulti::getViewSelect($this->module, 'view', $poll->getViewFlag()), $this->module->lang('th_mvview'));
     $data['gid'] = array(GWF_Form::SELECT, GWF_GroupSelect::single('gid', $poll->getGroupID(), true, true), $this->module->lang('th_vm_gid'));
     $data['level'] = array(GWF_Form::INT, $poll->getLevel(), $this->module->lang('th_vm_level'));
     $data['edit'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_edit'));
     return new GWF_Form($this, $data);
 }
Exemplo n.º 2
0
 public function getForm()
 {
     $data = array('opt' => array(GWF_Form::VALIDATOR));
     $buttons = array('add_opt' => $this->module->lang('btn_add_opt'), 'rem_opts' => $this->module->lang('btn_rem_opts'), 'create' => $this->module->lang('btn_create'));
     $data['title'] = array(GWF_Form::STRING, '', $this->module->lang('th_title'));
     $data['reverse'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_reverse'));
     $data['multi'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_multi'));
     $data['guests'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_guests'));
     if (Module_Votes::mayAddGlobalPoll(GWF_Session::getUser())) {
         $data['public'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_vm_public'));
     }
     $data['view'] = array(GWF_Form::SELECT, GWF_VoteMulti::getViewSelect($this->module, 'view', intval(Common::getPost('view', GWF_VoteMulti::SHOW_RESULT_VOTED))), $this->module->lang('th_mvview'));
     $data['gid'] = array(GWF_Form::SELECT, GWF_GroupSelect::single('gid', Common::getPostString('gid', '0')), $this->module->lang('th_vm_gid'));
     $data['level'] = array(GWF_Form::INT, '0', $this->module->lang('th_vm_level'));
     $i = 1;
     foreach (GWF_Session::getOrDefault(self::SESS_OPTIONS, array()) as $item) {
         $data['opt[' . $i . ']'] = array(GWF_Form::STRING, $item, $this->module->lang('th_option', array($i)));
         $i++;
     }
     $data['cmds'] = array(GWF_Form::SUBMITS, $buttons);
     return new GWF_Form($this, $data);
 }