43 $this->parent_obj = $a_parent_obj;
44 $this->participants = $a_participants_object;
45 $this->waiting_list = $a_waiting_list;
48 $this->presets[
'name'] = array($lng->txt(
'name'),
true);
49 $this->presets[
'login'] = array($lng->txt(
'login'),
true);
51 $lng->loadLanguageModule(
'crs');
54 $roles = $this->participants->getRoles();
55 foreach(
$roles as $role_id)
58 switch(substr(
$title, 0, 8))
62 $this->
addRole($role_id, $lng->txt(
'event_tbl_admin'),
'admin');
66 $this->
addRole($role_id, $lng->txt(
'event_tbl_tutor'),
'tutor');
71 $this->
addRole($role_id, $lng->txt(
'event_tbl_member'),
'member');
76 $this->has_local_role =
true;
90 function addPreset($a_id, $a_caption, $a_selected =
false)
92 $this->presets[$a_id] = array($a_caption, $a_selected);
102 $this->pre_blanks[] = $a_caption;
113 $this->title = $a_title;
114 $this->description = $a_description;
124 protected function addRole($a_id, $a_caption, $a_type)
126 $this->role_data[$a_id] = array($a_caption, $a_type);
136 $this->roles = $a_role_ids;
148 $this->user_filters[$a_id] = array($a_caption, $a_checked);
160 $subscriber_ids = $this->participants->getSubscribers();
162 $user_ids = $subscriber_ids;
164 if($this->waiting_list)
166 $user_ids = array_merge($user_ids, $this->waiting_list->getUserIds());
169 if(
sizeof($user_ids))
171 foreach(array_unique($user_ids) as $user_id)
173 if(!isset($a_res[$user_id]))
177 $a_res[$user_id][
'login'] = $tmp_obj->getLogin();
178 $a_res[$user_id][
'name'] = $tmp_obj->getLastname().
', '.$tmp_obj->getFirstname();
180 if(in_array($user_id, $subscriber_ids))
182 $a_res[$user_id][
'status'] = $lng->txt(
'crs_subscriber');
186 $a_res[$user_id][
'status'] = $lng->txt(
'crs_waiting_list');
201 if(!implode(
"", $a_values))
207 foreach($a_values as $idx => $value)
209 $a_values[$idx] = trim($value);
210 if($a_values[$idx] ==
"")
212 unset($a_values[$idx]);
216 $this->blank_columns = $a_values;
226 $this->callback = $a_callback;
236 $this->
id = (string)$a_value;
249 $lng->loadLanguageModule(
'crs');
251 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
253 $form->setFormAction($ilCtrl->getFormAction($this->parent_obj,$a_cmd));
254 $form->setTarget(
'_blank');
255 $form->setPreventDoubleSubmission(
false);
256 $form->setTitle($lng->txt(
'sess_gen_attendance_list'));
259 $title->setValue($this->title);
263 $desc->
setValue($this->description);
264 $form->addItem($desc);
266 if(
sizeof($this->presets))
269 $preset_value = array();
270 foreach($this->presets as
$id => $item)
275 $preset_value[] =
$id;
278 $preset->setValue($preset_value);
279 $form->addItem($preset);
282 $blank =
new ilTextInputGUI($lng->txt(
'event_blank_columns'),
'blank');
284 $form->addItem($blank);
286 if($this->pre_blanks)
288 $blank->setValue($this->pre_blanks);
296 foreach($this->role_data as $role_id =>
$role_data)
299 $checked[] =
'role_'.$role_id;
300 $chk_grp->addOption($chk);
303 if($this->waiting_list)
305 $chk =
new ilCheckboxOption($lng->txt(
'event_user_selection_include_requests'),
'subscr');
306 $chk_grp->addOption($chk);
308 $chk =
new ilCheckboxOption($lng->txt(
'event_user_selection_include_waiting_list'),
'wlist');
309 $chk_grp->addOption($chk);
312 if($this->user_filters)
314 foreach($this->user_filters as $sub_id => $sub_item)
316 $chk =
new ilCheckboxOption(sprintf($lng->txt(
'event_user_selection_include_filter'),$sub_item[0]),
320 $checked[] =
'members_'.$sub_id;
322 $chk_grp->addOption($chk);
325 $chk_grp->setValue($checked);
326 $form->addItem($chk_grp);
328 $form->addCommandButton($a_cmd,$lng->txt(
'sess_print_attendance_list'));
330 if($this->
id && $a_cmd)
332 include_once
"Services/User/classes/class.ilUserFormSettings.php";
334 $settings->deleteValue(
'desc');
335 $settings->exportToForm($form);
347 if($form->checkInput())
349 foreach(array_keys($this->presets) as
$id)
351 $this->presets[
$id][1] =
false;
353 foreach($form->getInput(
'preset') as $value)
355 if(isset($this->presets[$value]))
357 $this->presets[$value][1] =
true;
365 $this->
setTitle($form->getInput(
'title'), $form->getInput(
'desc'));
368 $selection_of_users = (array)$form->getInput(
'selection_of_users');
371 foreach(array_keys($this->role_data) as $role_id)
373 if(in_array(
'role_'.$role_id, $selection_of_users))
381 if($this->waiting_list)
383 $this->include_subscribers = (bool)in_array(
'subscr', $selection_of_users);
384 $this->include_waiting_list = (bool)in_array(
'wlist', $selection_of_users);
387 if($this->user_filters)
389 foreach(array_keys($this->user_filters) as $msub_id)
391 $this->user_filters[$msub_id][2] = (bool)in_array(
"members_".$msub_id, $selection_of_users);
397 $form->setValuesByPost();
399 include_once
"Services/User/classes/class.ilUserFormSettings.php";
401 $settings->deleteValue(
'desc');
402 $settings->importFromForm($form);
417 $tpl->setBodyClass(
"ilBodyPrint");
421 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
423 $tpl->setVariable(
"BODY_ATTRIBUTES",
'onload="window.print()"');
436 $tpl =
new ilTemplate(
'tpl.attendance_list_print.html',
true,
true,
'Services/Membership');
443 $tpl->setVariable(
'TXT_TITLE', $this->title);
444 if($this->description)
446 $tpl->setVariable(
'TXT_DESCRIPTION', $this->description.
" (".$time.
")");
450 $tpl->setVariable(
'TXT_DESCRIPTION', $time);
456 $tpl->setCurrentBlock(
'head_item');
457 foreach($this->presets as
$id => $item)
461 $tpl->setVariable(
'TXT_HEAD', $item[0]);
462 $tpl->parseCurrentBlock();
466 if($this->blank_columns)
468 foreach($this->blank_columns as $blank)
470 $tpl->setVariable(
'TXT_HEAD', $blank);
471 $tpl->parseCurrentBlock();
478 $valid_user_ids = $filters = array();
482 if($this->has_local_role)
485 foreach($this->participants->getMembers() as $member_id)
487 foreach($this->participants->getAssignedRoles($member_id) as $role_id)
489 $members[$role_id][] = $member_id;
495 $members = $this->participants->getMembers();
498 foreach($this->roles as $role_id)
500 switch($this->role_data[$role_id][1])
503 $valid_user_ids = array_merge($valid_user_ids, $this->participants->getAdmins());
507 $valid_user_ids = array_merge($valid_user_ids, $this->participants->getTutors());
512 if(!$this->has_local_role)
514 $valid_user_ids = array_merge($valid_user_ids, (array)$members);
518 $valid_user_ids = array_merge($valid_user_ids, (array)$members[$role_id]);
525 if($this->include_subscribers)
527 $valid_user_ids = array_merge($valid_user_ids, $this->participants->getSubscribers());
530 if($this->include_waiting_list)
532 $valid_user_ids = array_merge($valid_user_ids, $this->waiting_list->getUserIds());
535 if($this->user_filters)
537 foreach($this->user_filters as $sub_id => $sub_item)
539 $filters[$sub_id] = (bool)$sub_item[2];
543 $valid_user_ids =
ilUtil::_sortIds(array_unique($valid_user_ids),
'usr_data',
'lastname',
'usr_id');
548 foreach($valid_user_ids as $user_id)
552 $user_data = call_user_func_array($this->callback, array($user_id, $filters));
558 $tpl->setCurrentBlock(
"row_preset");
559 foreach($this->presets as
$id => $item)
569 $value = $name[
"lastname"].
", ".$name[
"firstname"];
582 $value = (string)$user_data[$id];
585 $tpl->setVariable(
"TXT_PRESET", $value);
586 $tpl->parseCurrentBlock();
591 if($this->blank_columns)
595 $tpl->touchBlock(
'row_blank');
599 $tpl->touchBlock(
"member_row");
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
This class represents an option in a checkbox group.
Base class for course and group waiting lists.
setId($a_value)
Set id (used for user form settings)
__construct($a_parent_obj, ilParticipants $a_participants_object=null, ilWaitingList $a_waiting_list=null)
Constructor.
setTitle($a_title, $a_description=null)
Set titles.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
getFullscreenHTML()
render list in fullscreen mode
static _lookupTitle($a_id)
lookup object title
getNonMemberUserData(array &$a_res)
Get user data for subscribers and waiting list.
addBlank($a_caption)
Add blank column preset.
initForm($a_cmd="")
Init form.
Base class for attendance lists.
addPreset($a_id, $a_caption, $a_selected=false)
Add user field.
static _sortIds($a_ids, $a_table, $a_field, $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname.
setBlankColumns(array $a_values)
Add blank columns.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
addRole($a_id, $a_caption, $a_type)
Add role.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
setCallback($a_callback)
Set participant detail callback.
setRoleSelection($a_role_ids)
Set role selection.
setValue($a_value)
Set Value.
getHTML()
render attendance list
addUserFilter($a_id, $a_caption, $a_checked=false)
Add user filter.
initFromForm()
Set list attributes from post values.