27 $this->lng->loadLanguageModule(
'barometer');
41 if(isset(
$_SESSION[
'error_post_vars'][
'cmd'][
'update'])){
43 $this->ctrl->setCmd(
'edit');
45 $this->ctrl->setCmd(
'addBarometer');
47 $params = $this->ctrl->getParameterArray($this);
49 $cmd = $this->ctrl->getCmd(
'fbList');
52 if((!$ilAccess->checkAccess(
'write',
'edit',$params[
'ref_id']))&&(in_array(
$cmd,array(
'fbList',
'save',
'delete',
'update',
'edit'))))
53 $cmd =
'showBarometer';
55 $next_class = $this->ctrl->getNextClass($this);
58 return($this->
$cmd());
66 $tpl =
new ilTemplate(
"tpl.feedbacklist.html",
true,
true,
"Services/Feedback");
67 $tpl->setVariable(
"TXT_FEEDBACK_TITLE", $lng->txt(
"stimmungsb"));
68 $tpl->setVariable(
"TXT_TITLE", $lng->txt(
"title"));
69 $tpl->setVariable(
"TXT_STATUS", $lng->txt(
"status"));
70 $tpl->setVariable(
"TXT_ACTIVE_TIME", $lng->txt(
"active_time"));
71 $tpl->setVariable(
"TXT_OPTIONS", $lng->txt(
"options"));
73 $tpl->setVariable(
"TXT_NEW_VOTE", $lng->txt(
"options"));
74 $tpl->parseCurrentBlock();
83 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
87 $ilFeedback->setRefId(
$_GET[
'ref_id']);
88 $barometers = $ilFeedback->getAllBarometer();
90 if(is_Array($barometers)){
91 foreach($barometers as $barometer){
93 $rows[$cnt][
'title'] = $barometer->getTitle();
94 $rows[$cnt][
'status'] =
'Aktive';
95 if(($barometer->getStarttime()>0) && ($barometer->getStarttime()>0)){
96 $rows[$cnt][
'running'] = date(
'd.m.Y H:i',$barometer->getStarttime()).
' - '.date(
'd.m.Y H:i',$barometer->getEndtime());
97 if(($barometer->getStarttime()<=time())&&($barometer->getEndtime()>=time()))
98 $rows[$cnt][
'status'] = $this->lng->txt(
'active');
100 $rows[$cnt][
'status'] = $this->lng->txt(
'inactive');
103 $rows[$cnt][
'running'] =
'';
104 $rows[$cnt][
'status'] = $this->lng->txt(
'active');
106 $rows[$cnt][
'options'] = $this->
getButtons($barometer->getId());
107 $barometer_ids[]=$barometer->getId();
112 $tbl->tpl->setCurrentBlock(
"tbl_form_header");
113 $tbl->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
114 $tbl->tpl->parseCurrentBlock();
115 $tbl->setTitle($this->lng->txt(
"feedb_feedback_list"),
116 "icon_feedb.png", $this->lng->txt(
"feedb_feedback_list"));
117 $tbl->setHeaderNames(array(
"",$this->lng->txt(
"title"),$this->lng->txt(
"status"),$this->lng->txt(
"time"),$this->lng->txt(
"options")));
118 $tbl->setHeaderVars(array(
"checkbox",
"title",
"stauts",
"running",
"options"));
119 $tbl->setData($rows);
122 $tbl->disable(
'sort');
123 $tbl->setMaxCount(count($rows));
137 $tbl->tpl->setCurrentBlock(
"tbl_action_toggle_checkboxes");
138 $tbl->tpl->setVariable(
"JS_VARNAME",
"barometer");
140 $tbl->tpl->setVariable(
"TXT_CHECKALL", $this->lng->txt(
"check_all"));
141 $tbl->tpl->setVariable(
"TXT_UNCHECKALL", $this->lng->txt(
"uncheck_all"));
142 $tbl->tpl->parseCurrentBlock();
146 $tbl->tpl->setVariable(
"COLUMN_COUNTS",5);
149 $tbl->tpl->setCurrentBlock(
"tbl_action_select");
151 $tbl->tpl->setVariable(
"BTN_NAME",
"delete");
152 $tbl->tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"delete"));
153 $tbl->tpl->parseCurrentBlock();
155 $tbl->setOrderDirection(
'asc');
156 $tbl->setColumnWidth(array(
"",
"25%",
"25%",
"25%",
""));
157 #$tbl->disable('sort');
158 $tbl->setFooter(
"tblfooter");
161 return($tbl->tpl->get());
166 include_once
"./Services/Table/classes/class.ilTableGUI.php";
172 if(is_array(
$_POST[
'barometer']))
174 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
176 $ilFB->setIds(
$_POST[
'barometer']);
179 ilUtil::redirect($this->ctrl->getLinkTarget($this,
'fbList',
'',
false,
false));
183 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
186 $tpl =
new ilTemplate(
"tpl.feedback_stats.html",
true,
true,
"Services/Feedback");
189 $feedback->setId(
$_GET[
'barometer_id']);
190 $chartdata = $feedback->getChartData();
191 $data = $chartdata[
'data'];
192 $legend = $chartdata[
'legend'];
193 $legendpie = $chartdata[
'legendpie'];
194 $datapie = $chartdata[
'datapie'];
195 $datatable = $chartdata[
'table'];
197 $chartlines =
'<img src="Services/Feedback/showchart.php?chart_type=lines&title='.base64_encode($this->lng->txt(
'chart_users')).
'&data='.base64_encode(serialize(
$data)).
'&legend='.base64_encode(serialize(
$legend)).
'">';
198 $chartpie =
'<img src="Services/Feedback/showchart.php?chart_type=pie&title='.base64_encode($this->lng->txt(
'chart_votes')).
'&data='.base64_encode(serialize($datapie)).
'&legend='.base64_encode(serialize($legendpie)).
'">';
204 $chart_user[0] = $this->lng->txt(
'all_users');
205 $chart_user = $feedback->getResultUsers();
207 $tpl->setVariable(
"TXT_USER",$this->lng->txt(
'user'));
208 $tpl->setVariable(
"TXT_CHART_TYPE",$this->lng->txt(
'chart_type'));
209 switch(
$_POST[
'chart_type']){
211 $tpl->setVariable(
"CHART_PIE", $chartpie);
214 if(is_array($datatable)){
215 $tpl->setCurrentBlock(
'tablerow');
216 $tpl->setVariable(
'TXT_TABLE_USERNAME',$this->lng->txt(
'username'));
217 $tpl->setVariable(
'TXT_TABLE_VOTE',$this->lng->txt(
'vote'));
218 $tpl->setVariable(
'TXT_TABLE_DATE', $this->lng->txt(
'date'));
219 $tpl->parseCurrentBlock();
221 foreach($datatable as $tablerow){
222 $tpl->setVariable(
'VALUE_NUM',(($i++ % 2) ? 1 : 2));
223 $tpl->setVariable(
'VALUE_VOTETIME', $tablerow[
'votetime']);
224 $tpl->setVariable(
'VALUE_USER', $tablerow[
'user']);
225 $tpl->setVariable(
'VALUE_VOTE', $tablerow[
'vote']);
226 $tpl->parseCurrentBlock();
231 $tpl->setVariable(
"CHART_LINES", $chartlines);
240 $comments = $feedback->getNotes();
241 if(is_Array($comments)){
242 $tpl->setCurrentBlock(
'comment_row');
243 $tpl->setVariable(
'TXT_USERNAME',$this->lng->txt(
'username'));
244 $tpl->setVariable(
'TXT_COMMENT',$this->lng->txt(
'comment'));
245 $tpl->setVariable(
'TXT_DATE', $this->lng->txt(
'date'));
246 $tpl->parseCurrentBlock();
249 $tpl->setVariable(
'VALUE_NUM',(($i++ % 2) ? 1 : 2));
250 $tpl->setVariable(
'VALUE_LOGIN',$comment[
'user']);
251 $tpl->setVariable(
'VALUE_DATE',$comment[
'votetime']);
252 $tpl->setVariable(
'VALUE_NOTE',$comment[
'note']);
253 $tpl->parseCurrentBlock();
256 $tpl->parseCurrentBlock();
266 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
269 $tpl =
new ilTemplate(
"tpl.feedback_edit.html",
true,
true,
"Services/Feedback");
272 $data[
'description'] =
$_POST[
'text'] ?
$_POST[
'text'] : $ilFB->getDescription();
273 $data[
'anonymous'] = (
$_POST[
'anonymous']!=
'') ?
$_POST[
'anonymous'] : $ilFB->getAnonymous();
274 $data[
'required'] = (
$_POST[
'required']!=
'') ?
$_POST[
'required'] : $ilFB->getRequired();
276 $data[
'vote'] =
$_POST[
'vote'] ?
$_POST[
'vote'] : unserialize($ilFB->getVotes());
277 if(
$_POST[
'extra_votes']==
'')
279 $data[
'text_answer'] = (
$_POST[
'text_answer']!=
'') ?
$_POST[
'text_answer'] : $ilFB->getTextAnswer();
280 if($ilFB->getStarttime()>=0||isset(
$_POST[
'start_day'])){
281 $data[
'start_day'] =
$_POST[
'start_day'] ?
$_POST[
'start_day'] : date(
'd',$ilFB->getStarttime());
282 $data[
'start_month'] =
$_POST[
'start_month'] ?
$_POST[
'start_month'] : date(
'm',$ilFB->getStarttime());
283 $data[
'start_year'] =
$_POST[
'start_year'] ?
$_POST[
'start_year'] :date(
'Y',$ilFB->getStarttime());
284 $data[
'start_hour'] =
$_POST[
'start_hour'] ?
$_POST[
'start_hour'] :date(
'H',$ilFB->getStarttime());
285 $data[
'start_minute'] =
$_POST[
'start_minute'] ?
$_POST[
'start_minute'] :date(
'i',$ilFB->getStarttime());
287 if($ilFB->getEndtime()>=0||isset(
$_POST[
'end_day'])){
288 $data[
'end_day'] =
$_POST[
'end_day'] ?
$_POST[
'end_day'] :date(
'd',$ilFB->getEndtime());
289 $data[
'end_month'] =
$_POST[
'end_month'] ?
$_POST[
'end_month'] :date(
'm',$ilFB->getEndtime());
290 $data[
'end_year'] =
$_POST[
'end_year'] ?
$_POST[
'end_year'] :date(
'Y',$ilFB->getEndtime());
291 $data[
'end_hour'] =
$_POST[
'end_hour'] ?
$_POST[
'end_hour'] :date(
'H',$ilFB->getEndtime());
292 $data[
'end_minute'] =
$_POST[
'end_minute'] ?
$_POST[
'end_minute'] :date(
'i',$ilFB->getEndtime());
295 $data[
'interval'] =
$_POST[
'interval'] ?
$_POST[
'interval'] : $ilFB->getInterval();
296 $data[
'interval_unit'] =
$_POST[
'interval_unit'] ?
$_POST[
'interval_unit'] : $ilFB->getIntervalUnit();
297 $data[
'first_vote_best'] = (
$_POST[
'first_vote_best']!=
'') ?
$_POST[
'first_vote_best'] : $ilFB->getFirstVoteBest();
299 $this->ctrl->setParameter($this,
"barometer_id",
$_GET[
'barometer_id']);
300 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
301 $tpl->setVariable(
"TXT_HEADER", $this->lng->txt(
"feedb_edit_feedback"));
303 $tpl->setVariable(
"ALT_FEEDB", $this->lng->txt(
"feedb_edit_feedback"));
304 $tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"title"));
305 $tpl->setVariable(
"VALUE_TITLE",
$data[
'title']);
306 $tpl->setVariable(
"TXT_TOP_TEXT", $this->lng->txt(
"text"));
307 $tpl->setVariable(
"TXT_TIME", $this->lng->txt(
"feedb_time"));
308 $tpl->setVariable(
"VALUE_TEXT",
$data[
'description']);
309 $tpl->setVariable(
"TXT_ANONYMOUS", $this->lng->txt(
"anonymous"));
311 if(
$data[
"anonymous"]==
"0")
312 $tpl->setVariable(
"ANONYMOUS_NO",
" checked");
314 $tpl->setVariable(
"ANONYMOUS_YES",
" checked");
315 $tpl->setVariable(
"TXT_YES", $this->lng->txt(
"yes"));
316 $tpl->setVariable(
"TXT_NO", $this->lng->txt(
"no"));
317 $tpl->setVariable(
"TXT_TYPE", $this->lng->txt(
"type"));
318 $typeSB[0] = $this->lng->txt(
'optional');
319 $typeSB[1] = $this->lng->txt(
'required');
321 $tpl->setVariable(
"SELECT_TYPE",
324 $tpl->setVariable(
"TXT_REQUIRED", $this->lng->txt(
"required"));
325 if(
$data[
"show_on"]==
"course")
326 $tpl->setVariable(
"SHOW_CHANGE_COURSE_SELECTED",
"selected");
328 $tpl->setVariable(
"SHOW_LOGIN_SELECTED",
"selected");
329 $tpl->setVariable(
"TXT_LOGIN", $this->lng->txt(
"login"));
330 $tpl->setVariable(
"TXT_CHANGE_COURSE", $this->lng->txt(
"change_course"));
331 if(
$data[
"text_answer"]==
"1")
332 $tpl->setVariable(
"TEXT_ANSWER_YES",
" checked");
334 $tpl->setVariable(
"TEXT_ANSWER_NO",
" checked");
335 $tpl->setVariable(
"TXT_TEXT_ANSWER", $this->lng->txt(
"text_answer"));
336 $tpl->setVariable(
"TXT_VOTES", $this->lng->txt(
"votes"));
337 $extra_votes =
$_POST[
"extra_votes"] ?
$_POST[
"extra_votes"]+1 : (count(
$data[
"vote"])-2);
338 if ($extra_votes<1) $extra_votes=1;
339 $tpl->setVariable(
"VALUE_EXTRA_VOTES", $extra_votes);
341 for($i=1;$i < 3+$extra_votes ;$i++){
342 $tpl->setCurrentBlock(
"vote");
343 $tpl->setVariable(
"TXT_TEXT",$this->lng->txt(
"text"));
344 $tpl->setVariable(
"VALUE_VOTE_TEXT",
$data[
"vote"][$i]);
345 $tpl->setVariable(
"VOTE_NUM",$i);
346 $tpl->parseCurrentBlock();
349 $tpl->setVariable(
"TXT_DAY",$this->lng->txt(
"day"));
350 $tpl->setVariable(
"SELECT_ACTIVATION_START_DAY",$this->
getDateSelect(
'day',
'start_day',
$data[
'start_day']));
351 $tpl->setVariable(
"SELECT_ACTIVATION_START_MONTH",$this->
getDateSelect(
'month',
'start_month',
$data[
'start_month']));
352 $tpl->setVariable(
"SELECT_ACTIVATION_START_YEAR",$this->
getDateSelect(
'year',
'start_year',
$data[
'start_year']));
353 $tpl->setVariable(
"SELECT_ACTIVATION_START_HOUR",$this->
getDateSelect(
'hour',
'start_hour',
$data[
'start_hour']));
354 $tpl->setVariable(
"SELECT_ACTIVATION_START_MINUTE",$this->
getDateSelect(
'minute',
'start_minute',
$data[
'start_minute']));
356 $tpl->setVariable(
"SELECT_ACTIVATION_END_MONTH",$this->
getDateSelect(
'month',
'end_month',
$data[
'end_month']));
357 $tpl->setVariable(
"SELECT_ACTIVATION_END_YEAR",$this->
getDateSelect(
'year',
'end_year',
$data[
'end_year']));
358 $tpl->setVariable(
"SELECT_ACTIVATION_END_HOUR",$this->
getDateSelect(
'hour',
'end_hour',
$data[
'end_hour']));
359 $tpl->setVariable(
"SELECT_ACTIVATION_END_MINUTE",$this->
getDateSelect(
'minute',
'end_minute',
$data[
'end_minute']));
361 $tpl->setVariable(
"TXT_MONTH",$this->lng->txt(
"month"));
362 $tpl->setVariable(
"TXT_YEAR",$this->lng->txt(
"year"));
363 $tpl->setVariable(
"TXT_FROM",$this->lng->txt(
"from"));
364 $tpl->setVariable(
"TXT_UNTIL",$this->lng->txt(
"until"));
366 $tpl->setVariable(
"TXT_DURATION",$this->lng->txt(
"duration"));
367 $tpl->setVariable(
"TXT_HOURS",$this->lng->txt(
"hours"));
368 $tpl->setVariable(
"TXT_DAYS",$this->lng->txt(
"days"));
369 $tpl->setVariable(
"TXT_WEEKS",$this->lng->txt(
"weeks"));
370 $tpl->setVariable(
"TXT_MONTHS",$this->lng->txt(
"months"));
371 $tpl->setVariable(
"TXT_REPEAT",$this->lng->txt(
"repeat"));
372 $tpl->setVariable(
"TXT_FTEXT",$this->lng->txt(
"text"));
374 for($i=0;$i < 25;$i++){
379 $interval_unitSB[0] = $this->lng->txt(
'hours');
380 $interval_unitSB[1] = $this->lng->txt(
'days');
381 $interval_unitSB[2] = $this->lng->txt(
'weeks');
382 $interval_unitSB[3] = $this->lng->txt(
'months');
385 $tpl->setVariable(
"TXT_FIRST_VOTE",$this->lng->txt(
"first_vote"));
386 $tpl->setVariable(
"TXT_BEST",$this->lng->txt(
"best"));
387 $tpl->setVariable(
"TXT_WORST",$this->lng->txt(
"worst"));
388 if(
$data[
"first_vote_best"]==1)
389 $tpl->setVariable(
"BEST_CHECKED",
"checked");
391 $tpl->setVariable(
"WORST_CHECKED",
"checked");
392 $tpl->setVariable(
"TXT_VOTE", $this->lng->txt(
"vote"));
393 $tpl->setVariable(
"TXT_NEW_VOTE", $this->lng->txt(
"new_vote"));
394 $tpl->setVariable(
"CMD_ADDVOTE",
'edit');
395 $tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
"save"));
396 $tpl->setVariable(
"CMD_SUBMIT",
"update");
397 $tpl->parseCurrentBlock();
404 return $this->
save();
409 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
410 $params = $this->ctrl->getParameterArray($this);
417 #$this->ctrl->setParameter($this,'barometer_id',(int) $_GET['barometer_id']);
418 #$this->ctrl->redirect($this,'edit');
419 --$_POST[
'extra_votes'];
420 return $this->
edit();
422 foreach ($_POST[
'vote'] as $k=>$v)
426 $tmp_votes[$vote_cnt]=$v;
430 if(($_POST[
'title']==
'')||($_POST[
'text']==
'')|| $vote_cnt<3)
433 --$_POST[
'extra_votes'];
434 return $this->
edit();
435 #$this->ctrl->setParameter($this,'a','32');
436 #$ilias->raiseError($this->lng->txt('missing_fields'),$ilias->error_obj->MESSAGE);
445 $ilFeedback->setVotes(serialize($tmp_votes));
451 $ilFeedback->setEndtime(mktime(
457 $ilFeedback->setInterval(
459 $ilFeedback->setIntervalUnit(
461 $ilFeedback->setFirstVoteBest(
463 $ilFeedback->setObjId($params[
'obj_id']);
464 $ilFeedback->setRefId($params[
'ref_id']);
467 $ilFeedback->setId(
$_GET[
'barometer_id']);
468 $ilFeedback->update();
471 $ilFeedback->create();
472 ilUtil::redirect($this->ctrl->getLinkTarget($this,
'fbList',
'',
false,
false));
498 $tpl =
new ilTemplate(
"tpl.feedback_edit.html",
true,
true,
"Services/Feedback");
499 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
500 $tpl->setVariable(
"TXT_HEADER", $this->lng->txt(
"bar_create"));
502 $tpl->setVariable(
"ALT_FEEDB", $this->lng->txt(
"bar_create"));
503 $tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"title"));
504 $tpl->setVariable(
"TXT_TIME", $this->lng->txt(
"feedb_time"));
505 $tpl->setVariable(
"VALUE_TITLE",$this->
get_last(
"title"));
506 $tpl->setVariable(
"TXT_TOP_TEXT", $this->lng->txt(
"text"));
507 $tpl->setVariable(
"VALUE_TEXT", $this->
get_last(
"text"));
508 $tpl->setVariable(
"TXT_ANONYMOUS", $this->lng->txt(
"anonymous"));
509 if($this->
get_last(
"anonymous")==
"0")
510 $tpl->setVariable(
"ANONYMOUS_NO",
" checked");
512 $tpl->setVariable(
"ANONYMOUS_YES",
" checked");
513 $tpl->setVariable(
"TXT_YES", $this->lng->txt(
"yes"));
514 $tpl->setVariable(
"TXT_NO", $this->lng->txt(
"no"));
515 $tpl->setVariable(
"TXT_TYPE", $this->lng->txt(
"type"));
516 $typeSB[0] = $this->lng->txt(
'optional');
517 $typeSB[1] = $this->lng->txt(
'required');
520 $tpl->setVariable(
"TXT_REQUIRED", $this->lng->txt(
"required"));
521 if($this->
get_last(
"show_on")==
"course")
522 $tpl->setVariable(
"SHOW_CHANGE_COURSE_SELECTED",
"selected");
524 $tpl->setVariable(
"SHOW_LOGIN_SELECTED",
"selected");
525 $tpl->setVariable(
"TXT_LOGIN", $this->lng->txt(
"login"));
526 $tpl->setVariable(
"TXT_CHANGE_COURSE", $this->lng->txt(
"change_course"));
527 if($this->
get_last(
"text_answer")==
"1")
528 $tpl->setVariable(
"TEXT_ANSWER_YES",
" checked");
530 $tpl->setVariable(
"TEXT_ANSWER_NO",
" checked");
531 $tpl->setVariable(
"TXT_TEXT_ANSWER", $this->lng->txt(
"text_answer"));
532 $tpl->setVariable(
"TXT_VOTES", $this->lng->txt(
"votes"));
533 $extra_votes = $this->
get_last(
"extra_votes",0);
534 if (
$_POST[
'cmd'][
'addBarometer']) $extra_votes+=1;
535 $tpl->setVariable(
"VALUE_EXTRA_VOTES", $extra_votes);
536 $vote_txt=$this->
get_last(
'vote',array(),
false);
537 for($i=1;$i < 3+$extra_votes ;$i++){
538 $tpl->setCurrentBlock(
"vote");
539 $tpl->setVariable(
"TXT_TEXT",$this->lng->txt(
"text"));
541 $tpl->setVariable(
"VOTE_NUM",$i);
542 $tpl->parseCurrentBlock();
544 $tpl->setVariable(
"TXT_DAY",$this->lng->txt(
"day"));
546 $tpl->setVariable(
"SELECT_ACTIVATION_START_MONTH",$this->
getDateSelect(
'month',
'start_month',$this->
get_last(
'start_month')));
547 $tpl->setVariable(
"SELECT_ACTIVATION_START_YEAR",$this->
getDateSelect(
'year',
'start_year',$this->
get_last(
'start_year')));
548 $tpl->setVariable(
"SELECT_ACTIVATION_START_HOUR",$this->
getDateSelect(
'hour',
'start_hour',$this->
get_last(
'start_hour')));
549 $tpl->setVariable(
"SELECT_ACTIVATION_START_MINUTE",$this->
getDateSelect(
'minute',
'start_minute',$this->
get_last(
'start_minute')));
554 $tpl->setVariable(
"SELECT_ACTIVATION_END_MINUTE",$this->
getDateSelect(
'minute',
'end_minute',$this->
get_last(
'end_minute')));
556 $tpl->setVariable(
"TXT_MONTH",$this->lng->txt(
"month"));
557 $tpl->setVariable(
"TXT_YEAR",$this->lng->txt(
"year"));
558 $tpl->setVariable(
"TXT_FROM",$this->lng->txt(
"from"));
559 $tpl->setVariable(
"TXT_UNTIL",$this->lng->txt(
"until"));
561 $tpl->setVariable(
"TXT_DURATION",$this->lng->txt(
"duration"));
562 $tpl->setVariable(
"TXT_HOURS",$this->lng->txt(
"hours"));
563 $tpl->setVariable(
"TXT_DAYS",$this->lng->txt(
"days"));
564 $tpl->setVariable(
"TXT_WEEKS",$this->lng->txt(
"weeks"));
565 $tpl->setVariable(
"TXT_MONTHS",$this->lng->txt(
"months"));
566 $tpl->setVariable(
"TXT_REPEAT",$this->lng->txt(
"repeat"));
568 for($i=0;$i < 25;$i++){
572 $tpl->setVariable(
"TXT_EVERY",$this->lng->txt(
"every"));
574 $interval_unitSB[0] = $this->lng->txt(
'hours');
575 $interval_unitSB[1] = $this->lng->txt(
'days');
576 $interval_unitSB[2] = $this->lng->txt(
'weeks');
577 $interval_unitSB[3] = $this->lng->txt(
'months');
580 $tpl->setVariable(
"TXT_FIRST_VOTE",$this->lng->txt(
"first_vote"));
581 $tpl->setVariable(
"TXT_BEST",$this->lng->txt(
"best"));
582 $tpl->setVariable(
"TXT_WORST",$this->lng->txt(
"worst"));
583 if($this->
get_last(
"first_vote_best")==1)
584 $tpl->setVariable(
"BEST_CHECKED",
"checked");
586 $tpl->setVariable(
"WORST_CHECKED",
"checked");
588 $tpl->setVariable(
"TXT_NEW_VOTE", $this->lng->txt(
"new_vote"));
589 $tpl->setVariable(
"CMD_ADDVOTE",
'addBarometer');
590 $tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
"save"));
591 $tpl->setVariable(
"CMD_SUBMIT",
"save");
592 $tpl->parseCurrentBlock();
598 $tpl =
new ilTemplate(
"tpl.buttons.html",
true,
true,
"Services/Feedback");
600 $tpl->setCurrentBlock(
"btn_cell");
601 $this->ctrl->setParameter($this,
"barometer_id",$a_barometer_id);
602 $this->ctrl->setParameter($this,
"ref_id",
$_GET[
'ref_id']);
603 $tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
'stats'));
604 $tpl->setVariable(
"BTN_TXT", $this->lng->txt(
"statistics"));
605 $tpl->parseCurrentBlock();
606 $tpl->setCurrentBlock(
"btn_cell");
607 $tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
'edit'));
608 $tpl->setVariable(
"BTN_TXT", $this->lng->txt(
"edit"));
609 $tpl->parseCurrentBlock();
619 $days[$i] = $i < 10 ?
"0".$i : $i;
626 $days[$i] = $i < 10 ?
"0".$i : $i;
633 $days[$i] = $i < 10 ?
"0".$i : $i;
641 $month[$i] = $i < 10 ?
"0".$i : $i;
647 for($i = date(
"Y",time());$i < date(
"Y",time()) + 3;++$i)
658 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
660 $bid = $a_id ? $a_id :
$_GET[
'barometer_id'];
661 $feedback->setId($bid);
662 $feedback->getBarometer();
663 if($feedback->getId()&& ($feedback->canVote($ilUser->getId(),$feedback->getId())==1)){
664 $tpl =
new ilTemplate(
"tpl.feedback_vote.html",
true,
true,
"Services/Feedback");
668 $tpl->setCurrentBlock(
"vote_head");
671 $tpl->parseCurrentBlock();
674 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this).
'&fb_id='.$feedback->getId());
675 $tpl->setVariable(
"TXT_TITLE", $feedback->getTitle());
676 $tpl->setVariable(
"TXT_DESCRIPTION", $feedback->getDescription());
677 $votes = unserialize($feedback->getVotes());
679 foreach($votes as $vote => $votetext){
683 $tpl->setVariable(
"TXT_SAVE",$this->lng->txt(
'save_vote'));
685 $tpl->setVariable(
"RADIO_VOTES",$radios);
686 if($feedback->getTextAnswer()){
687 $tpl->setCurrentBlock(
"text_answer");
688 $tpl->setVariable(
"TXT_NOTE",$this->lng->txt(
'note'));
691 $tpl->parseCurrentBlock();
700 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
701 include_once(
'Modules/Course/classes/class.ilCourseParticipant.php');
705 $feedback->getFeedback();
708 if(($feedback->getId()) && ($members_obj->isAssigned()))
710 return($feedback->getRefId());
718 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
721 $ilfeedback->setRefId(
$_GET[
'ref_id']);
722 $feedbacks = $ilfeedback->getAllBarometer();
726 foreach($feedbacks as $feedback){
728 if($feedback->getId()&& ($feedback->canVote($ilUser->getId(),$feedback->getId())==1)){
729 $tpl =
new ilTemplate(
"tpl.feedback_vote.html",
true,
true,
"Services/Feedback");
730 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this).
'&fb_id='.$feedback->getId());
731 $tpl->setVariable(
"TXT_TITLE", $feedback->getTitle());
732 $tpl->setVariable(
"TXT_DESCRIPTION", $feedback->getDescription());
733 $votes = unserialize($feedback->getVotes());
735 foreach($votes as $vote => $votetext){
739 $tpl->setVariable(
"TXT_SAVE",$this->lng->txt(
'save_vote'));
740 $tpl->setVariable(
"RADIO_VOTES",$radios);
741 if($feedback->getTextAnswer()){
742 $tpl->setCurrentBlock(
"text_answer");
743 $tpl->setVariable(
"TXT_NOTE",$this->lng->txt(
'note'));
746 $tpl->parseCurrentBlock();
754 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
757 $feedback->setId(
$_GET[
'fb_id']);
758 $feedback->getBarometer();
761 if($feedback->getAnonymous())
762 $feedback->setUserId(0);
764 $feedback->setUserId($ilUser->getId());
765 $feedback->saveResult();
766 $this->ctrl->returnToParent($this);
768 function selectbox($selected_itm, $name, $items, $params=
'',$first=
''){
770 $options = $first ?
'<option value="">'.$first.
'</option>'.chr(10) :
'';
771 if(is_Array($items)){
772 foreach($items as $key => $item){
773 $selected = ($key == $selected_itm) ?
' selected' :
'';
774 $options.=
'<option value="'.$key.
'"'.$selected.
'>'.$item.
'</option>'.chr(10);
778 $content =
'<select name="'.$name.
'" '.$params.
'>
787 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
789 $barometers = $feedback->getAllBarometer(0);
791 $tpl =
new ilTemplate(
"tpl.feedback_pdbox.html",
true,
true,
"Services/Feedback");
792 $tpl->setVariable(
'TXT_TITLE',$this->lng->txt(
'feedback'));
794 if(count($barometers)){
795 foreach ($barometers as $barometer)
798 if ($ilAccess->checkAccess(
"write",
"", $barometer->getRefId()))
802 if($barometer->canVote($ilUser->getId(),$barometer->getId())==1)
804 $tpl->setCurrentBlock(
'tbl_row');
805 $tpl->setVariable(
'ROWCOL',
'tblrow'.(($rownum++ % 2)+1));
806 $this->ctrl->setParameter($this,
"barometer_id",$barometer->getId());
807 $link =
'<a href="'.$this->ctrl->getLinkTargetByClass(
'ilfeedbackgui',
'voteform').
'">'.$barometer->getTitle().
'</a>';
808 $tpl->setVariable(
'BAROMETER_LINK',$link);
809 $tpl->parseCurrentBlock();
813 $output = $rownum ?
$tpl->get() :
'' ;
820 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
822 $feedback->setRefId(
$_GET[
'ref_id']);
823 $barometers = $feedback->getAllBarometer(0);
825 $tpl =
new ilTemplate(
"tpl.feedback_pdbox.html",
true,
true,
"Services/Feedback");
826 $tpl->setVariable(
'TXT_TITLE',$this->lng->txt(
'feedback'));
828 if(count($barometers)){
829 foreach ($barometers as $barometer){
830 if($barometer->canVote($ilUser->getId(),$barometer->getId())==1){
831 $tpl->setCurrentBlock(
'tbl_row');
832 $tpl->setVariable(
'ROWCOL',
'tblrow'.(($rownum++ % 2)+1));
833 $this->ctrl->setParameter($this,
"barometer_id",$barometer->getId());
834 $link =
'<a href="'.$this->ctrl->getLinkTargetByClass(array(
'ilinfoscreengui',
'ilfeedbackgui'),
'fbList').
'">'.$barometer->getTitle().
'</a>';
836 $tpl->setVariable(
'BAROMETER_LINK',$link);
837 $tpl->parseCurrentBlock();
841 $output = $rownum ?
$tpl->get() :
'' ;
849 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
853 $feedback->setRefId($a_ref_id);
855 $barometers = $feedback->getAllBarometer(0,1);
858 if(count($barometers))
860 foreach ($barometers as $barometer)
862 if($barometer->canVote($ilUser->getId(),$barometer->getId())==1){
863 $this->ctrl->setParameter($this,
"barometer_id",$barometer->getId());
864 $this->ctrl->redirectByClass(array(
"ilinfoscreengui",
"ilfeedbackgui"),
"showBarometerById");
873 $barometer_id = $a_barometer_id ? $a_barometer_id :
$_GET[
'barometer_id'];