34 function __construct($a_parent_obj, $a_participants_object = null)
38 $this->parent_obj = $a_parent_obj;
39 $this->participants = $a_participants_object;
42 $this->presets[
'name'] = array($lng->txt(
'name'),
true);
43 $this->presets[
'login'] = array($lng->txt(
'login'),
true);
44 $this->presets[
'email'] = array($lng->txt(
'email'));
54 function addPreset($a_id, $a_caption, $a_selected =
false)
56 $this->presets[$a_id] = array($a_caption, $a_selected);
66 $this->pre_blanks[] = $a_caption;
75 function setTitle($a_title, $a_description = null)
77 $this->title = $a_title;
78 $this->description = $a_description;
88 $this->show_admins = (bool)$a_value;
98 $this->show_tutors = (bool)$a_value;
108 $this->show_members = (bool)$a_value;
118 if(!implode(
"", $a_values))
124 foreach($a_values as $idx => $value)
126 $a_values[$idx] = trim($value);
127 if($a_values[$idx] ==
"")
129 unset($a_values[$idx]);
133 $this->blank_columns = $a_values;
143 $this->callback = $a_callback;
153 $this->
id = (string)$a_value;
166 $lng->loadLanguageModule(
'crs');
168 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
170 $form->setFormAction($ilCtrl->getFormAction($this->parent_obj,$a_cmd));
171 $form->setTarget(
'_blank');
172 $form->setTitle($lng->txt(
'sess_gen_attendance_list'));
175 $title->setValue($this->title);
179 $desc->
setValue($this->description);
180 $form->addItem($desc);
182 if(
sizeof($this->presets))
185 $preset_value = array();
186 foreach($this->presets as
$id => $item)
191 $preset_value[] =
$id;
194 $preset->setValue($preset_value);
195 $form->addItem($preset);
198 $blank =
new ilTextInputGUI($lng->txt(
'event_blank_columns'),
'blank');
200 $form->addItem($blank);
202 if($this->pre_blanks)
204 $blank->setValue($this->pre_blanks);
208 $part->setTitle($lng->txt(
'event_participant_selection'));
209 $form->addItem($part);
215 $form->addItem($admin);
221 $form->addItem($tutor);
226 $member->setValue(1);
227 $member->setChecked(
true);
228 $form->addItem($member);
230 $form->addCommandButton($a_cmd,$lng->txt(
'sess_print_attendance_list'));
232 if($this->
id && $a_cmd)
234 include_once
"Services/User/classes/class.ilUserFormSettings.php";
236 $settings->deleteValue(
'desc');
237 $settings->exportToForm($form);
249 if($form->checkInput())
251 foreach(array_keys($this->presets) as
$id)
253 $this->presets[
$id][1] =
false;
255 foreach($form->getInput(
'preset') as $value)
257 if(isset($this->presets[$value]))
259 $this->presets[$value][1] =
true;
267 $this->
setTitle($form->getInput(
'title'), $form->getInput(
'desc'));
269 $this->
showAdmins($form->getInput(
'show_admins'));
270 $this->
showTutors($form->getInput(
'show_tutors'));
271 $this->
showMembers($form->getInput(
'show_members'));
275 $form->setValuesByPost();
277 include_once
"Services/User/classes/class.ilUserFormSettings.php";
279 $settings->deleteValue(
'desc');
280 $settings->importFromForm($form);
295 $tpl->setBodyClass(
"ilBodyPrint");
299 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
301 $tpl->setVariable(
"BODY_ATTRIBUTES",
'onload="window.print()"');
314 $tpl =
new ilTemplate(
'tpl.attendance_list_print.html',
true,
true,
'Services/Membership');
321 $tpl->setVariable(
'TXT_TITLE', $this->title);
322 if($this->description)
324 $tpl->setVariable(
'TXT_DESCRIPTION', $this->description.
" (".$time.
")");
328 $tpl->setVariable(
'TXT_DESCRIPTION', $time);
334 $tpl->setCurrentBlock(
'head_item');
335 foreach($this->presets as
$id => $item)
339 $tpl->setVariable(
'TXT_HEAD', $item[0]);
340 $tpl->parseCurrentBlock();
344 if($this->blank_columns)
346 foreach($this->blank_columns as $blank)
348 $tpl->setVariable(
'TXT_HEAD', $blank);
349 $tpl->parseCurrentBlock();
356 $member_ids = array();
357 if($this->show_admins)
359 $member_ids = array_merge((array)$member_ids,$this->participants->getAdmins());
361 if($this->show_tutors)
363 $member_ids = array_merge((array)$member_ids,$this->participants->getTutors());
365 if($this->show_members)
367 $member_ids = array_merge((array)$member_ids,$this->participants->getMembers());
369 $member_ids =
ilUtil::_sortIds((array) $member_ids,
'usr_data',
'lastname',
'usr_id');
374 foreach($member_ids as $user_id)
378 $user_data = call_user_func_array($this->callback, array($user_id));
380 $tpl->setCurrentBlock(
"row_preset");
381 foreach($this->presets as
$id => $item)
391 $value = $name[
"lastname"].
", ".$name[
"firstname"];
412 $value = (string)$user_data[$id];
415 $tpl->setVariable(
"TXT_PRESET", $value);
416 $tpl->parseCurrentBlock();
421 if($this->blank_columns)
425 $tpl->touchBlock(
'row_blank');
429 $tpl->touchBlock(
"member_row");