27 $this->lng->loadLanguageModule(
'barometer');
39 if(isset(
$_SESSION[
'error_post_vars'][
'cmd'][
'update'])){
41 $this->ctrl->setCmd(
'edit');
43 $this->ctrl->setCmd(
'addBarometer');
45 $params = $this->ctrl->getParameterArray($this);
47 $cmd = $this->ctrl->getCmd(
'fbList');
50 if((!$ilAccess->checkAccess(
'write',
'edit',$params[
'ref_id']))&&(in_array(
$cmd,array(
'fbList',
'save',
'delete',
'update',
'edit'))))
51 $cmd =
'showBarometer';
53 $next_class = $this->ctrl->getNextClass($this);
56 return($this->
$cmd());
64 $tpl =
new ilTemplate(
"tpl.feedbacklist.html",
true,
true,
"Services/Feedback");
65 $tpl->setVariable(
"TXT_FEEDBACK_TITLE", $lng->txt(
"stimmungsb"));
66 $tpl->setVariable(
"TXT_TITLE", $lng->txt(
"title"));
67 $tpl->setVariable(
"TXT_STATUS", $lng->txt(
"status"));
68 $tpl->setVariable(
"TXT_ACTIVE_TIME", $lng->txt(
"active_time"));
69 $tpl->setVariable(
"TXT_OPTIONS", $lng->txt(
"options"));
71 $tpl->setVariable(
"TXT_NEW_VOTE", $lng->txt(
"options"));
72 $tpl->parseCurrentBlock();
81 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
85 $ilFeedback->setRefId(
$_GET[
'ref_id']);
86 $barometers = $ilFeedback->getAllBarometer();
88 if(is_Array($barometers)){
89 foreach($barometers as $barometer){
91 $rows[$cnt][
'title'] = $barometer->getTitle();
92 $rows[$cnt][
'status'] =
'Aktive';
93 if(($barometer->getStarttime()>0) && ($barometer->getStarttime()>0)){
94 $rows[$cnt][
'running'] = date(
'd.m.Y H:i',$barometer->getStarttime()).
' - '.date(
'd.m.Y H:i',$barometer->getEndtime());
95 if(($barometer->getStarttime()<=time())&&($barometer->getEndtime()>=time()))
96 $rows[$cnt][
'status'] = $this->lng->txt(
'active');
98 $rows[$cnt][
'status'] = $this->lng->txt(
'inactive');
101 $rows[$cnt][
'running'] =
'';
102 $rows[$cnt][
'status'] = $this->lng->txt(
'active');
104 $rows[$cnt][
'options'] = $this->
getButtons($barometer->getId());
105 $barometer_ids[]=$barometer->getId();
110 $tbl->tpl->setCurrentBlock(
"tbl_form_header");
111 $tbl->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
112 $tbl->tpl->parseCurrentBlock();
113 $tbl->setTitle($this->lng->txt(
"feedb_feedback_list"),
114 "icon_feedb.gif", $this->lng->txt(
"feedb_feedback_list"));
115 $tbl->setHeaderNames(array(
"",$this->lng->txt(
"title"),$this->lng->txt(
"status"),$this->lng->txt(
"time"),$this->lng->txt(
"options")));
116 $tbl->setHeaderVars(array(
"checkbox",
"title",
"stauts",
"running",
"options"));
117 $tbl->setData($rows);
120 $tbl->disable(
'sort');
121 $tbl->setMaxCount(count($rows));
122 $tbl->tpl->setCurrentBlock(
"plain_button");
123 $tbl->tpl->setVariable(
"PBTN_NAME",
"addBarometer");
124 $tbl->tpl->setVariable(
"PBTN_VALUE",$this->lng->txt(
"barometer_add"));
125 $tbl->tpl->parseCurrentBlock();
126 $tbl->tpl->setCurrentBlock(
"plain_buttons");
127 $tbl->tpl->parseCurrentBlock();
131 $tbl->tpl->setCurrentBlock(
"tbl_action_toggle_checkboxes");
132 $tbl->tpl->setVariable(
"JS_VARNAME",
"barometer");
134 $tbl->tpl->setVariable(
"TXT_CHECKALL", $this->lng->txt(
"check_all"));
135 $tbl->tpl->setVariable(
"TXT_UNCHECKALL", $this->lng->txt(
"uncheck_all"));
136 $tbl->tpl->parseCurrentBlock();
140 $tbl->tpl->setVariable(
"COLUMN_COUNTS",5);
143 $tbl->tpl->setCurrentBlock(
"tbl_action_select");
145 $tbl->tpl->setVariable(
"BTN_NAME",
"delete");
146 $tbl->tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"delete"));
147 $tbl->tpl->parseCurrentBlock();
149 $tbl->setOrderDirection(
'asc');
150 $tbl->setColumnWidth(array(
"",
"25%",
"25%",
"25%",
""));
151 #$tbl->disable('sort');
152 $tbl->setFooter(
"tblfooter");
155 return($tbl->tpl->get());
160 include_once
"./Services/Table/classes/class.ilTableGUI.php";
166 if(is_array(
$_POST[
'barometer']))
168 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
170 $ilFB->setIds(
$_POST[
'barometer']);
173 ilUtil::redirect($this->ctrl->getLinkTarget($this,
'fbList',
'',
false,
false));
177 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
180 $tpl =
new ilTemplate(
"tpl.feedback_stats.html",
true,
true,
"Services/Feedback");
183 $feedback->setId(
$_GET[
'barometer_id']);
184 $chartdata = $feedback->getChartData();
185 $data = $chartdata[
'data'];
186 $legend = $chartdata[
'legend'];
187 $legendpie = $chartdata[
'legendpie'];
188 $datapie = $chartdata[
'datapie'];
189 $datatable = $chartdata[
'table'];
191 $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)).
'">';
192 $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)).
'">';
198 $chart_user[0] = $this->lng->txt(
'all_users');
199 $chart_user = $feedback->getResultUsers();
201 $tpl->setVariable(
"TXT_USER",$this->lng->txt(
'user'));
202 $tpl->setVariable(
"TXT_CHART_TYPE",$this->lng->txt(
'chart_type'));
203 switch(
$_POST[
'chart_type']){
205 $tpl->setVariable(
"CHART_PIE", $chartpie);
208 if(is_array($datatable)){
209 $tpl->setCurrentBlock(
'tablerow');
210 $tpl->setVariable(
'TXT_TABLE_USERNAME',$this->lng->txt(
'username'));
211 $tpl->setVariable(
'TXT_TABLE_VOTE',$this->lng->txt(
'vote'));
212 $tpl->setVariable(
'TXT_TABLE_DATE', $this->lng->txt(
'date'));
213 $tpl->parseCurrentBlock();
215 foreach($datatable as $tablerow){
216 $tpl->setVariable(
'VALUE_NUM',(($i++ % 2) ? 1 : 2));
217 $tpl->setVariable(
'VALUE_VOTETIME', $tablerow[
'votetime']);
218 $tpl->setVariable(
'VALUE_USER', $tablerow[
'user']);
219 $tpl->setVariable(
'VALUE_VOTE', $tablerow[
'vote']);
220 $tpl->parseCurrentBlock();
225 $tpl->setVariable(
"CHART_LINES", $chartlines);
234 $comments = $feedback->getNotes();
235 if(is_Array($comments)){
236 $tpl->setCurrentBlock(
'comment_row');
237 $tpl->setVariable(
'TXT_USERNAME',$this->lng->txt(
'username'));
238 $tpl->setVariable(
'TXT_COMMENT',$this->lng->txt(
'comment'));
239 $tpl->setVariable(
'TXT_DATE', $this->lng->txt(
'date'));
240 $tpl->parseCurrentBlock();
243 $tpl->setVariable(
'VALUE_NUM',(($i++ % 2) ? 1 : 2));
244 $tpl->setVariable(
'VALUE_LOGIN',$comment[
'user']);
245 $tpl->setVariable(
'VALUE_DATE',$comment[
'votetime']);
246 $tpl->setVariable(
'VALUE_NOTE',$comment[
'note']);
247 $tpl->parseCurrentBlock();
250 $tpl->parseCurrentBlock();
260 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
263 $tpl =
new ilTemplate(
"tpl.feedback_edit.html",
true,
true,
"Services/Feedback");
266 $data[
'description'] =
$_POST[
'text'] ?
$_POST[
'text'] : $ilFB->getDescription();
267 $data[
'anonymous'] = (
$_POST[
'anonymous']!=
'') ?
$_POST[
'anonymous'] : $ilFB->getAnonymous();
268 $data[
'required'] = (
$_POST[
'required']!=
'') ?
$_POST[
'required'] : $ilFB->getRequired();
270 $data[
'vote'] =
$_POST[
'vote'] ?
$_POST[
'vote'] : unserialize($ilFB->getVotes());
271 if(
$_POST[
'extra_votes']==
'')
273 $data[
'text_answer'] = (
$_POST[
'text_answer']!=
'') ?
$_POST[
'text_answer'] : $ilFB->getTextAnswer();
274 if($ilFB->getStarttime()>=0||isset(
$_POST[
'start_day'])){
275 $data[
'start_day'] =
$_POST[
'start_day'] ?
$_POST[
'start_day'] : date(
'd',$ilFB->getStarttime());
276 $data[
'start_month'] =
$_POST[
'start_month'] ?
$_POST[
'start_month'] : date(
'm',$ilFB->getStarttime());
277 $data[
'start_year'] =
$_POST[
'start_year'] ?
$_POST[
'start_year'] :date(
'Y',$ilFB->getStarttime());
278 $data[
'start_hour'] =
$_POST[
'start_hour'] ?
$_POST[
'start_hour'] :date(
'H',$ilFB->getStarttime());
279 $data[
'start_minute'] =
$_POST[
'start_minute'] ?
$_POST[
'start_minute'] :date(
'i',$ilFB->getStarttime());
281 if($ilFB->getEndtime()>=0||isset(
$_POST[
'end_day'])){
282 $data[
'end_day'] =
$_POST[
'end_day'] ?
$_POST[
'end_day'] :date(
'd',$ilFB->getEndtime());
283 $data[
'end_month'] =
$_POST[
'end_month'] ?
$_POST[
'end_month'] :date(
'm',$ilFB->getEndtime());
284 $data[
'end_year'] =
$_POST[
'end_year'] ?
$_POST[
'end_year'] :date(
'Y',$ilFB->getEndtime());
285 $data[
'end_hour'] =
$_POST[
'end_hour'] ?
$_POST[
'end_hour'] :date(
'H',$ilFB->getEndtime());
286 $data[
'end_minute'] =
$_POST[
'end_minute'] ?
$_POST[
'end_minute'] :date(
'i',$ilFB->getEndtime());
289 $data[
'interval'] =
$_POST[
'interval'] ?
$_POST[
'interval'] : $ilFB->getInterval();
290 $data[
'interval_unit'] =
$_POST[
'interval_unit'] ?
$_POST[
'interval_unit'] : $ilFB->getIntervalUnit();
291 $data[
'first_vote_best'] = (
$_POST[
'first_vote_best']!=
'') ?
$_POST[
'first_vote_best'] : $ilFB->getFirstVoteBest();
293 $this->ctrl->setParameter($this,
"barometer_id",
$_GET[
'barometer_id']);
294 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
295 $tpl->setVariable(
"TXT_HEADER", $this->lng->txt(
"feedb_edit_feedback"));
297 $tpl->setVariable(
"ALT_FEEDB", $this->lng->txt(
"feedb_edit_feedback"));
298 $tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"title"));
299 $tpl->setVariable(
"VALUE_TITLE",
$data[
'title']);
300 $tpl->setVariable(
"TXT_TOP_TEXT", $this->lng->txt(
"text"));
301 $tpl->setVariable(
"TXT_TIME", $this->lng->txt(
"feedb_time"));
302 $tpl->setVariable(
"VALUE_TEXT",
$data[
'description']);
303 $tpl->setVariable(
"TXT_ANONYMOUS", $this->lng->txt(
"anonymous"));
305 if(
$data[
"anonymous"]==
"0")
306 $tpl->setVariable(
"ANONYMOUS_NO",
" checked");
308 $tpl->setVariable(
"ANONYMOUS_YES",
" checked");
309 $tpl->setVariable(
"TXT_YES", $this->lng->txt(
"yes"));
310 $tpl->setVariable(
"TXT_NO", $this->lng->txt(
"no"));
311 $tpl->setVariable(
"TXT_TYPE", $this->lng->txt(
"type"));
312 $typeSB[0] = $this->lng->txt(
'optional');
313 $typeSB[1] = $this->lng->txt(
'required');
315 $tpl->setVariable(
"SELECT_TYPE",
318 $tpl->setVariable(
"TXT_REQUIRED", $this->lng->txt(
"required"));
319 if(
$data[
"show_on"]==
"course")
320 $tpl->setVariable(
"SHOW_CHANGE_COURSE_SELECTED",
"selected");
322 $tpl->setVariable(
"SHOW_LOGIN_SELECTED",
"selected");
323 $tpl->setVariable(
"TXT_LOGIN", $this->lng->txt(
"login"));
324 $tpl->setVariable(
"TXT_CHANGE_COURSE", $this->lng->txt(
"change_course"));
325 if(
$data[
"text_answer"]==
"1")
326 $tpl->setVariable(
"TEXT_ANSWER_YES",
" checked");
328 $tpl->setVariable(
"TEXT_ANSWER_NO",
" checked");
329 $tpl->setVariable(
"TXT_TEXT_ANSWER", $this->lng->txt(
"text_answer"));
330 $tpl->setVariable(
"TXT_VOTES", $this->lng->txt(
"votes"));
331 $extra_votes =
$_POST[
"extra_votes"] ?
$_POST[
"extra_votes"]+1 : (count(
$data[
"vote"])-2);
332 if ($extra_votes<1) $extra_votes=1;
333 $tpl->setVariable(
"VALUE_EXTRA_VOTES", $extra_votes);
335 for($i=1;$i < 3+$extra_votes ;$i++){
336 $tpl->setCurrentBlock(
"vote");
337 $tpl->setVariable(
"TXT_TEXT",$this->lng->txt(
"text"));
338 $tpl->setVariable(
"VALUE_VOTE_TEXT",
$data[
"vote"][$i]);
339 $tpl->setVariable(
"VOTE_NUM",$i);
340 $tpl->parseCurrentBlock();
343 $tpl->setVariable(
"TXT_DAY",$this->lng->txt(
"day"));
344 $tpl->setVariable(
"SELECT_ACTIVATION_START_DAY",$this->
getDateSelect(
'day',
'start_day',
$data[
'start_day']));
345 $tpl->setVariable(
"SELECT_ACTIVATION_START_MONTH",$this->
getDateSelect(
'month',
'start_month',
$data[
'start_month']));
346 $tpl->setVariable(
"SELECT_ACTIVATION_START_YEAR",$this->
getDateSelect(
'year',
'start_year',
$data[
'start_year']));
347 $tpl->setVariable(
"SELECT_ACTIVATION_START_HOUR",$this->
getDateSelect(
'hour',
'start_hour',
$data[
'start_hour']));
348 $tpl->setVariable(
"SELECT_ACTIVATION_START_MINUTE",$this->
getDateSelect(
'minute',
'start_minute',
$data[
'start_minute']));
350 $tpl->setVariable(
"SELECT_ACTIVATION_END_MONTH",$this->
getDateSelect(
'month',
'end_month',
$data[
'end_month']));
351 $tpl->setVariable(
"SELECT_ACTIVATION_END_YEAR",$this->
getDateSelect(
'year',
'end_year',
$data[
'end_year']));
352 $tpl->setVariable(
"SELECT_ACTIVATION_END_HOUR",$this->
getDateSelect(
'hour',
'end_hour',
$data[
'end_hour']));
353 $tpl->setVariable(
"SELECT_ACTIVATION_END_MINUTE",$this->
getDateSelect(
'minute',
'end_minute',
$data[
'end_minute']));
355 $tpl->setVariable(
"TXT_MONTH",$this->lng->txt(
"month"));
356 $tpl->setVariable(
"TXT_YEAR",$this->lng->txt(
"year"));
357 $tpl->setVariable(
"TXT_FROM",$this->lng->txt(
"from"));
358 $tpl->setVariable(
"TXT_UNTIL",$this->lng->txt(
"until"));
360 $tpl->setVariable(
"TXT_DURATION",$this->lng->txt(
"duration"));
361 $tpl->setVariable(
"TXT_HOURS",$this->lng->txt(
"hours"));
362 $tpl->setVariable(
"TXT_DAYS",$this->lng->txt(
"days"));
363 $tpl->setVariable(
"TXT_WEEKS",$this->lng->txt(
"weeks"));
364 $tpl->setVariable(
"TXT_MONTHS",$this->lng->txt(
"months"));
365 $tpl->setVariable(
"TXT_REPEAT",$this->lng->txt(
"repeat"));
366 $tpl->setVariable(
"TXT_FTEXT",$this->lng->txt(
"text"));
368 for($i=0;$i < 25;$i++){
373 $interval_unitSB[0] = $this->lng->txt(
'hours');
374 $interval_unitSB[1] = $this->lng->txt(
'days');
375 $interval_unitSB[2] = $this->lng->txt(
'weeks');
376 $interval_unitSB[3] = $this->lng->txt(
'months');
379 $tpl->setVariable(
"TXT_FIRST_VOTE",$this->lng->txt(
"first_vote"));
380 $tpl->setVariable(
"TXT_BEST",$this->lng->txt(
"best"));
381 $tpl->setVariable(
"TXT_WORST",$this->lng->txt(
"worst"));
382 if(
$data[
"first_vote_best"]==1)
383 $tpl->setVariable(
"BEST_CHECKED",
"checked");
385 $tpl->setVariable(
"WORST_CHECKED",
"checked");
386 $tpl->setVariable(
"TXT_VOTE", $this->lng->txt(
"vote"));
387 $tpl->setVariable(
"TXT_NEW_VOTE", $this->lng->txt(
"new_vote"));
388 $tpl->setVariable(
"CMD_ADDVOTE",
'edit');
389 $tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
"save"));
390 $tpl->setVariable(
"CMD_SUBMIT",
"update");
391 $tpl->parseCurrentBlock();
398 return $this->
save();
403 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
404 $params = $this->ctrl->getParameterArray($this);
411 #$this->ctrl->setParameter($this,'barometer_id',(int) $_GET['barometer_id']);
412 #$this->ctrl->redirect($this,'edit');
413 --$_POST[
'extra_votes'];
414 return $this->
edit();
416 foreach ($_POST[
'vote'] as $k=>$v)
420 $tmp_votes[$vote_cnt]=$v;
424 if(($_POST[
'title']==
'')||($_POST[
'text']==
'')|| $vote_cnt<3)
427 --$_POST[
'extra_votes'];
428 return $this->
edit();
429 #$this->ctrl->setParameter($this,'a','32');
430 #$ilias->raiseError($this->lng->txt('missing_fields'),$ilias->error_obj->MESSAGE);
439 $ilFeedback->setVotes(serialize($tmp_votes));
445 $ilFeedback->setEndtime(mktime(
451 $ilFeedback->setInterval(
453 $ilFeedback->setIntervalUnit(
455 $ilFeedback->setFirstVoteBest(
457 $ilFeedback->setObjId($params[
'obj_id']);
458 $ilFeedback->setRefId($params[
'ref_id']);
461 $ilFeedback->setId(
$_GET[
'barometer_id']);
462 $ilFeedback->update();
465 $ilFeedback->create();
466 ilUtil::redirect($this->ctrl->getLinkTarget($this,
'fbList',
'',
false,
false));
488 $tpl =
new ilTemplate(
"tpl.feedback_edit.html",
true,
true,
"Services/Feedback");
489 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
490 $tpl->setVariable(
"TXT_HEADER", $this->lng->txt(
"bar_create"));
492 $tpl->setVariable(
"ALT_FEEDB", $this->lng->txt(
"bar_create"));
493 $tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"title"));
494 $tpl->setVariable(
"TXT_TIME", $this->lng->txt(
"feedb_time"));
495 $tpl->setVariable(
"VALUE_TITLE",$this->
get_last(
"title"));
496 $tpl->setVariable(
"TXT_TOP_TEXT", $this->lng->txt(
"text"));
497 $tpl->setVariable(
"VALUE_TEXT", $this->
get_last(
"text"));
498 $tpl->setVariable(
"TXT_ANONYMOUS", $this->lng->txt(
"anonymous"));
499 if($this->
get_last(
"anonymous")==
"0")
500 $tpl->setVariable(
"ANONYMOUS_NO",
" checked");
502 $tpl->setVariable(
"ANONYMOUS_YES",
" checked");
503 $tpl->setVariable(
"TXT_YES", $this->lng->txt(
"yes"));
504 $tpl->setVariable(
"TXT_NO", $this->lng->txt(
"no"));
505 $tpl->setVariable(
"TXT_TYPE", $this->lng->txt(
"type"));
506 $typeSB[0] = $this->lng->txt(
'optional');
507 $typeSB[1] = $this->lng->txt(
'required');
510 $tpl->setVariable(
"TXT_REQUIRED", $this->lng->txt(
"required"));
511 if($this->
get_last(
"show_on")==
"course")
512 $tpl->setVariable(
"SHOW_CHANGE_COURSE_SELECTED",
"selected");
514 $tpl->setVariable(
"SHOW_LOGIN_SELECTED",
"selected");
515 $tpl->setVariable(
"TXT_LOGIN", $this->lng->txt(
"login"));
516 $tpl->setVariable(
"TXT_CHANGE_COURSE", $this->lng->txt(
"change_course"));
517 if($this->
get_last(
"text_answer")==
"1")
518 $tpl->setVariable(
"TEXT_ANSWER_YES",
" checked");
520 $tpl->setVariable(
"TEXT_ANSWER_NO",
" checked");
521 $tpl->setVariable(
"TXT_TEXT_ANSWER", $this->lng->txt(
"text_answer"));
522 $tpl->setVariable(
"TXT_VOTES", $this->lng->txt(
"votes"));
523 $extra_votes = $this->
get_last(
"extra_votes",0);
524 if (
$_POST[
'cmd'][
'addBarometer']) $extra_votes+=1;
525 $tpl->setVariable(
"VALUE_EXTRA_VOTES", $extra_votes);
526 $vote_txt=$this->
get_last(
'vote',array(),
false);
527 for($i=1;$i < 3+$extra_votes ;$i++){
528 $tpl->setCurrentBlock(
"vote");
529 $tpl->setVariable(
"TXT_TEXT",$this->lng->txt(
"text"));
531 $tpl->setVariable(
"VOTE_NUM",$i);
532 $tpl->parseCurrentBlock();
534 $tpl->setVariable(
"TXT_DAY",$this->lng->txt(
"day"));
536 $tpl->setVariable(
"SELECT_ACTIVATION_START_MONTH",$this->
getDateSelect(
'month',
'start_month',$this->
get_last(
'start_month')));
537 $tpl->setVariable(
"SELECT_ACTIVATION_START_YEAR",$this->
getDateSelect(
'year',
'start_year',$this->
get_last(
'start_year')));
538 $tpl->setVariable(
"SELECT_ACTIVATION_START_HOUR",$this->
getDateSelect(
'hour',
'start_hour',$this->
get_last(
'start_hour')));
539 $tpl->setVariable(
"SELECT_ACTIVATION_START_MINUTE",$this->
getDateSelect(
'minute',
'start_minute',$this->
get_last(
'start_minute')));
544 $tpl->setVariable(
"SELECT_ACTIVATION_END_MINUTE",$this->
getDateSelect(
'minute',
'end_minute',$this->
get_last(
'end_minute')));
546 $tpl->setVariable(
"TXT_MONTH",$this->lng->txt(
"month"));
547 $tpl->setVariable(
"TXT_YEAR",$this->lng->txt(
"year"));
548 $tpl->setVariable(
"TXT_FROM",$this->lng->txt(
"from"));
549 $tpl->setVariable(
"TXT_UNTIL",$this->lng->txt(
"until"));
551 $tpl->setVariable(
"TXT_DURATION",$this->lng->txt(
"duration"));
552 $tpl->setVariable(
"TXT_HOURS",$this->lng->txt(
"hours"));
553 $tpl->setVariable(
"TXT_DAYS",$this->lng->txt(
"days"));
554 $tpl->setVariable(
"TXT_WEEKS",$this->lng->txt(
"weeks"));
555 $tpl->setVariable(
"TXT_MONTHS",$this->lng->txt(
"months"));
556 $tpl->setVariable(
"TXT_REPEAT",$this->lng->txt(
"repeat"));
558 for($i=0;$i < 25;$i++){
562 $tpl->setVariable(
"TXT_EVERY",$this->lng->txt(
"every"));
564 $interval_unitSB[0] = $this->lng->txt(
'hours');
565 $interval_unitSB[1] = $this->lng->txt(
'days');
566 $interval_unitSB[2] = $this->lng->txt(
'weeks');
567 $interval_unitSB[3] = $this->lng->txt(
'months');
570 $tpl->setVariable(
"TXT_FIRST_VOTE",$this->lng->txt(
"first_vote"));
571 $tpl->setVariable(
"TXT_BEST",$this->lng->txt(
"best"));
572 $tpl->setVariable(
"TXT_WORST",$this->lng->txt(
"worst"));
573 if($this->
get_last(
"first_vote_best")==1)
574 $tpl->setVariable(
"BEST_CHECKED",
"checked");
576 $tpl->setVariable(
"WORST_CHECKED",
"checked");
578 $tpl->setVariable(
"TXT_NEW_VOTE", $this->lng->txt(
"new_vote"));
579 $tpl->setVariable(
"CMD_ADDVOTE",
'addBarometer');
580 $tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
"save"));
581 $tpl->setVariable(
"CMD_SUBMIT",
"save");
582 $tpl->parseCurrentBlock();
588 $tpl =
new ilTemplate(
"tpl.buttons.html",
true,
true,
"Services/Feedback");
590 $tpl->setCurrentBlock(
"btn_cell");
591 $this->ctrl->setParameter($this,
"barometer_id",$a_barometer_id);
592 $this->ctrl->setParameter($this,
"ref_id",
$_GET[
'ref_id']);
593 $tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
'stats'));
594 $tpl->setVariable(
"BTN_TXT", $this->lng->txt(
"statistics"));
595 $tpl->parseCurrentBlock();
596 $tpl->setCurrentBlock(
"btn_cell");
597 $tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
'edit'));
598 $tpl->setVariable(
"BTN_TXT", $this->lng->txt(
"edit"));
599 $tpl->parseCurrentBlock();
609 $days[$i] = $i < 10 ?
"0".$i : $i;
616 $days[$i] = $i < 10 ?
"0".$i : $i;
623 $days[$i] = $i < 10 ?
"0".$i : $i;
631 $month[$i] = $i < 10 ?
"0".$i : $i;
637 for($i = date(
"Y",time());$i < date(
"Y",time()) + 3;++$i)
647 global $ilAccess,$ilUser;
648 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
650 $bid = $a_id ? $a_id :
$_GET[
'barometer_id'];
651 $feedback->setId($bid);
652 $feedback->getBarometer();
653 if($feedback->getId()&& ($feedback->canVote($ilUser->getId(),$feedback->getId())==1)){
654 $tpl =
new ilTemplate(
"tpl.feedback_vote.html",
true,
true,
"Services/Feedback");
658 $tpl->setCurrentBlock(
"vote_head");
661 $tpl->parseCurrentBlock();
664 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this).
'&fb_id='.$feedback->getId());
665 $tpl->setVariable(
"TXT_TITLE", $feedback->getTitle());
666 $tpl->setVariable(
"TXT_DESCRIPTION", $feedback->getDescription());
667 $votes = unserialize($feedback->getVotes());
669 foreach($votes as $vote => $votetext){
673 $tpl->setVariable(
"TXT_SAVE",$this->lng->txt(
'save_vote'));
675 $tpl->setVariable(
"RADIO_VOTES",$radios);
676 if($feedback->getTextAnswer()){
677 $tpl->setCurrentBlock(
"text_answer");
678 $tpl->setVariable(
"TXT_NOTE",$this->lng->txt(
'note'));
681 $tpl->parseCurrentBlock();
689 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
690 include_once(
'Modules/Course/classes/class.ilCourseParticipants.php');
694 $feedback->getFeedback();
697 if(($feedback->getId()) && ($members_obj->isAssigned($ilUser->getId())))
699 return($feedback->getRefId());
707 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
710 $ilfeedback->setRefId(
$_GET[
'ref_id']);
711 $feedbacks = $ilfeedback->getAllBarometer();
715 foreach($feedbacks as $feedback){
717 if($feedback->getId()&& ($feedback->canVote($ilUser->getId(),$feedback->getId())==1)){
718 $tpl =
new ilTemplate(
"tpl.feedback_vote.html",
true,
true,
"Services/Feedback");
719 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this).
'&fb_id='.$feedback->getId());
720 $tpl->setVariable(
"TXT_TITLE", $feedback->getTitle());
721 $tpl->setVariable(
"TXT_DESCRIPTION", $feedback->getDescription());
722 $votes = unserialize($feedback->getVotes());
724 foreach($votes as $vote => $votetext){
728 $tpl->setVariable(
"TXT_SAVE",$this->lng->txt(
'save_vote'));
729 $tpl->setVariable(
"RADIO_VOTES",$radios);
730 if($feedback->getTextAnswer()){
731 $tpl->setCurrentBlock(
"text_answer");
732 $tpl->setVariable(
"TXT_NOTE",$this->lng->txt(
'note'));
735 $tpl->parseCurrentBlock();
743 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
746 $feedback->setId(
$_GET[
'fb_id']);
747 $feedback->getBarometer();
750 if($feedback->getAnonymous())
751 $feedback->setUserId(0);
753 $feedback->setUserId($ilUser->getId());
754 $feedback->saveResult();
755 $this->ctrl->returnToParent($this);
757 function selectbox($selected_itm, $name, $items, $params=
'',$first=
''){
759 $options = $first ?
'<option value="">'.$first.
'</option>'.chr(10) :
'';
760 if(is_Array($items)){
761 foreach($items as $key => $item){
762 $selected = ($key == $selected_itm) ?
' selected' :
'';
763 $options.=
'<option value="'.$key.
'"'.$selected.
'>'.$item.
'</option>'.chr(10);
767 $content =
'<select name="'.$name.
'" '.$params.
'>
774 global $ilUser, $ilAccess;
776 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
778 $barometers = $feedback->getAllBarometer(0);
780 $tpl =
new ilTemplate(
"tpl.feedback_pdbox.html",
true,
true,
"Services/Feedback");
781 $tpl->setVariable(
'TXT_TITLE',$this->lng->txt(
'feedback'));
783 if(count($barometers)){
784 foreach ($barometers as $barometer)
787 if ($ilAccess->checkAccess(
"write",
"", $barometer->getRefId()))
791 if($barometer->canVote($ilUser->getId(),$barometer->getId())==1)
793 $tpl->setCurrentBlock(
'tbl_row');
794 $tpl->setVariable(
'ROWCOL',
'tblrow'.(($rownum++ % 2)+1));
795 $this->ctrl->setParameter($this,
"barometer_id",$barometer->getId());
796 $link =
'<a href="'.$this->ctrl->getLinkTargetByClass(
'ilfeedbackgui',
'voteform').
'">'.$barometer->getTitle().
'</a>';
798 $tpl->setVariable(
'BAROMETER_LINK',$link);
799 $tpl->parseCurrentBlock();
803 $output = $rownum ?
$tpl->get() :
'' ;
810 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
812 $feedback->setRefId(
$_GET[
'ref_id']);
813 $barometers = $feedback->getAllBarometer(0);
815 $tpl =
new ilTemplate(
"tpl.feedback_pdbox.html",
true,
true,
"Services/Feedback");
816 $tpl->setVariable(
'TXT_TITLE',$this->lng->txt(
'feedback'));
818 if(count($barometers)){
819 foreach ($barometers as $barometer){
820 if($barometer->canVote($ilUser->getId(),$barometer->getId())==1){
821 $tpl->setCurrentBlock(
'tbl_row');
822 $tpl->setVariable(
'ROWCOL',
'tblrow'.(($rownum++ % 2)+1));
823 $this->ctrl->setParameter($this,
"barometer_id",$barometer->getId());
824 $link =
'<a href="'.$this->ctrl->getLinkTargetByClass(array(
'ilinfoscreengui',
'ilfeedbackgui'),
'fbList').
'">'.$barometer->getTitle().
'</a>';
826 $tpl->setVariable(
'BAROMETER_LINK',$link);
827 $tpl->parseCurrentBlock();
831 $output = $rownum ?
$tpl->get() :
'' ;
839 include_once(
'Services/Feedback/classes/class.ilFeedback.php');
843 $feedback->setRefId($a_ref_id);
845 $barometers = $feedback->getAllBarometer(0,1);
848 if(count($barometers))
850 foreach ($barometers as $barometer)
852 if($barometer->canVote($ilUser->getId(),$barometer->getId())==1){
853 $this->ctrl->setParameter($this,
"barometer_id",$barometer->getId());
854 $this->ctrl->redirectByClass(array(
"ilinfoscreengui",
"ilfeedbackgui"),
"showBarometerById");
863 $barometer_id = $a_barometer_id ? $a_barometer_id :
$_GET[
'barometer_id'];