function save() { //print_r($_POST); global $ilias; include_once 'Services/Feedback/classes/class.ilFeedback.php'; $params = $this->ctrl->getParameterArray($this); $tmp_votes = array(); $vote_cnt = 1; if ($_POST['anonymous'] and $_POST['type']) { ilUtil::sendFailure($this->lng->txt('barometer_conflict_anon_req')); #$this->ctrl->setParameter($this,'barometer_id',(int) $_GET['barometer_id']); #$this->ctrl->redirect($this,'edit'); --$_POST['extra_votes']; return $this->edit(); } foreach ($_POST['vote'] as $k => $v) { if (trim($v)) { $tmp_votes[$vote_cnt] = $v; $vote_cnt++; } } if ($_POST['title'] == '' || $_POST['text'] == '' || $vote_cnt < 3) { ilUtil::sendFailure($this->lng->txt('missing_fields')); --$_POST['extra_votes']; return $this->edit(); #$this->ctrl->setParameter($this,'a','32'); #$ilias->raiseError($this->lng->txt('missing_fields'),$ilias->error_obj->MESSAGE); } $ilFeedback = new ilFeedback(); $ilFeedback->setTitle(ilUtil::stripSlashes($_POST['title'])); $ilFeedback->setDescription(ilUtil::stripSlashes($_POST['text'])); $ilFeedback->setAnonymous(ilUtil::stripSlashes($_POST['anonymous'])); $ilFeedback->setRequired(ilUtil::stripSlashes($_POST['type'])); $ilFeedback->setShowOn(ilUtil::stripSlashes($_POST['show_on'])); $ilFeedback->setTextAnswer(ilUtil::stripSlashes($_POST['text_answer'])); $ilFeedback->setVotes(serialize($tmp_votes)); $ilFeedback->setStarttime(mktime(ilUtil::stripSlashes($_POST['start_hour']), ilUtil::stripSlashes($_POST['start_minute']), 0, ilUtil::stripSlashes($_POST['start_month']), ilUtil::stripSlashes($_POST['start_day']), ilUtil::stripSlashes($_POST['start_year']))); $ilFeedback->setEndtime(mktime(ilUtil::stripSlashes($_POST['end_hour']), ilUtil::stripSlashes($_POST['end_minute']), 0, ilUtil::stripSlashes($_POST['end_month']), ilUtil::stripSlashes($_POST['end_day']), ilUtil::stripSlashes($_POST['end_year']))); $ilFeedback->setInterval(ilUtil::stripSlashes($_POST['interval'])); $ilFeedback->setIntervalUnit(ilUtil::stripSlashes($_POST['interval_unit'])); $ilFeedback->setFirstVoteBest(ilUtil::stripSlashes($_POST['first_vote_best'])); $ilFeedback->setObjId($params['obj_id']); $ilFeedback->setRefId($params['ref_id']); if ($this->update == 1 && $_GET['barometer_id']) { $ilFeedback->setId($_GET['barometer_id']); $ilFeedback->update(); } else { $ilFeedback->create(); } ilUtil::redirect($this->ctrl->getLinkTarget($this, 'fbList', '', false, false)); }