50 $this->logger = $DIC->logger()->mmbr();
52 $this->parent_gui = $a_parent_gui;
53 $this->parent_obj = $a_parent_obj;
54 $this->participants = $a_participants_object;
55 $this->waiting_list = $a_waiting_list;
58 $this->presets[
'name'] =
array($DIC->language()->txt(
'name'),
true);
59 $this->presets[
'login'] =
array($DIC->language()->txt(
'login'),
true);
65 $DIC->language()->loadLanguageModule(
'crs');
68 $roles = $this->participants->getRoles();
69 foreach (
$roles as $role_id) {
71 switch (substr(
$title, 0, 8)) {
74 $this->
addRole($role_id, $DIC->language()->txt(
'event_tbl_admin'),
'admin');
78 $this->
addRole($role_id, $DIC->language()->txt(
'event_tbl_tutor'),
'tutor');
83 $this->
addRole($role_id, $DIC->language()->txt(
'event_tbl_member'),
'member');
87 $this->
addRole($role_id, $DIC->language()->txt(
'event_tbl_member'),
'member');
92 $this->has_local_role =
true;
105 include_once(
'Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
106 include_once(
'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
107 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
108 include_once(
'Services/User/classes/class.ilUserDefinedFields.php');
111 $field_info->sortExportFields();
113 foreach ($field_info->getExportableFields() as $field) {
123 $this->presets[$field] =
array(
131 foreach ($udf->getExportableFields($this->parent_obj->getId()) as $field_id => $udf_data) {
132 $this->presets[
'udf_' . $field_id] =
array(
133 $udf_data[
'field_name'],
139 include_once
'./Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php';
141 $this->presets[
'cdf_' . $field_obj->getId()] =
array(
142 $field_obj->getName(),
156 public function addPreset($a_id, $a_caption, $a_selected =
false)
158 $this->presets[$a_id] =
array($a_caption, $a_selected);
168 $this->pre_blanks[] = $a_caption;
177 public function setTitle($a_title, $a_description = null)
179 $this->title = $a_title;
180 $this->description = $a_description;
204 $this->roles = $a_role_ids;
216 $this->user_filters[$a_id] =
array($a_caption, $a_checked);
228 $subscriber_ids = $this->participants->getSubscribers();
230 $user_ids = $subscriber_ids;
232 if ($this->waiting_list) {
233 $user_ids = array_merge($user_ids, $this->waiting_list->getUserIds());
238 foreach ($profile_data as $user_id => $fields) {
239 foreach ((
array) $fields as $field => $value) {
240 $a_res[$user_id][$field] = $value;
244 include_once
'./Services/User/classes/class.ilUserDefinedFields.php';
247 foreach ($udf->getExportableFields($this->parent_obj->getId()) as $field_id => $udf_data) {
248 foreach ($profile_data as $user_id => $field) {
249 include_once
'./Services/User/classes/class.ilUserDefinedData.php';
251 $a_res[$user_id][
'udf_' . $field_id] = (
string) $udf_data->get(
'f_' . $field_id);
255 if (
sizeof($user_ids)) {
257 include_once
'Modules/Course/classes/Export/class.ilCourseUserData.php';
260 foreach (array_unique($user_ids) as $user_id) {
262 $a_res[$user_id][
'login'] = $tmp_obj->getLogin();
263 $a_res[$user_id][
'name'] = $tmp_obj->getLastname() .
', ' . $tmp_obj->getFirstname();
265 if (in_array($user_id, $subscriber_ids)) {
266 $a_res[$user_id][
'status'] = $lng->txt(
'crs_subscriber');
268 $a_res[$user_id][
'status'] = $lng->txt(
'crs_waiting_list');
271 foreach ((
array) $cdfs[$user_id] as $field_id => $value) {
272 $a_res[$user_id][
'cdf_' . $field_id] = (
string) $value;
286 if (!implode(
"", $a_values)) {
289 foreach ($a_values as $idx => $value) {
290 $a_values[$idx] = trim($value);
291 if ($a_values[$idx] ==
"") {
292 unset($a_values[$idx]);
296 $this->blank_columns = $a_values;
306 $this->callback = $a_callback;
316 $this->
id = (
string) $a_value;
329 $lng->loadLanguageModule(
'crs');
331 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
333 $form->setFormAction($ilCtrl->getFormAction($this->parent_gui, $a_cmd));
334 $form->setTarget(
'_blank');
335 $form->setPreventDoubleSubmission(
false);
336 $form->setTitle($lng->txt(
'sess_gen_attendance_list'));
339 $title->setValue($this->title);
343 $desc->
setValue($this->description);
344 $form->addItem($desc);
346 if (
sizeof($this->presets)) {
348 $preset_value =
array();
349 foreach ($this->presets as
$id => $item) {
352 $preset_value[] =
$id;
355 $preset->setValue($preset_value);
356 $form->addItem($preset);
359 $blank =
new ilTextInputGUI($lng->txt(
'event_blank_columns'),
'blank');
361 $form->addItem($blank);
363 if ($this->pre_blanks) {
364 $blank->setValue($this->pre_blanks);
372 foreach ($this->role_data as $role_id =>
$role_data) {
375 $role_name = $role_id;
376 if (substr(
$title, 0, 10) ==
'il_' . $this->parent_obj->getType() .
'_adm') {
379 if (substr(
$title, 0, 10) ==
'il_' . $this->parent_obj->getType() .
'_mem') {
382 if (substr(
$title, 0, 10) ==
'il_' . $this->parent_obj->getType() .
'_tut') {
387 $checked[] =
'role_' . $role_name;
388 $chk_grp->addOption($chk);
391 if ($this->waiting_list) {
392 $chk =
new ilCheckboxOption($lng->txt(
'event_user_selection_include_requests'),
'subscr');
393 $chk_grp->addOption($chk);
395 $chk =
new ilCheckboxOption($lng->txt(
'event_user_selection_include_waiting_list'),
'wlist');
396 $chk_grp->addOption($chk);
399 if ($this->user_filters) {
400 foreach ($this->user_filters as $sub_id => $sub_item) {
402 sprintf($lng->txt(
'event_user_selection_include_filter'), $sub_item[0]),
406 $checked[] =
'members_' . $sub_id;
408 $chk_grp->addOption($chk);
411 $chk_grp->setValue($checked);
412 $form->addItem($chk_grp);
414 $form->addCommandButton($a_cmd, $lng->txt(
'sess_print_attendance_list'));
416 if ($this->
id && $a_cmd) {
417 include_once
"Services/User/classes/class.ilUserFormSettings.php";
419 if (!$settings->hasStoredEntry()) {
424 $settings->exportToForm(
$form);
425 } elseif ($a_cmd ==
'printForMembersOutput') {
426 include_once
"Services/User/classes/class.ilUserFormSettings.php";
427 $settings =
new ilUserFormSettings($this->parent_obj->getType() .
's_pview_' . $this->parent_obj->getId(), -1);
428 if (!$settings->hasStoredEntry()) {
434 $settings->exportToForm(
$form,
true);
446 if (
$form->checkInput()) {
447 foreach (array_keys($this->presets) as
$id) {
448 $this->presets[
$id][1] =
false;
450 foreach ((
array)
$form->getInput(
'preset') as $value) {
451 if (isset($this->presets[$value])) {
452 $this->presets[$value][1] =
true;
461 $selection_of_users = (
array)
$form->getInput(
'selection_of_users');
464 foreach (array_keys($this->role_data) as $role_id) {
466 $role_name = $role_id;
467 if (substr(
$title, 0, 10) ==
'il_' . $this->parent_obj->getType() .
'_adm') {
470 if (substr(
$title, 0, 10) ==
'il_' . $this->parent_obj->getType() .
'_mem') {
473 if (substr(
$title, 0, 10) ==
'il_' . $this->parent_obj->getType() .
'_tut') {
478 if (in_array(
'role_' . $role_name, (
array) $selection_of_users)) {
485 if ($this->waiting_list) {
486 $this->include_subscribers = (bool) in_array(
'subscr', $selection_of_users);
487 $this->include_waiting_list = (bool) in_array(
'wlist', $selection_of_users);
490 if ($this->user_filters) {
491 foreach (array_keys($this->user_filters) as $msub_id) {
492 $this->user_filters[$msub_id][2] = (bool) in_array(
"members_" . $msub_id, $selection_of_users);
497 #$form->setValuesByPost(); 499 #include_once "Services/User/classes/class.ilUserFormSettings.php"; 500 #$settings = new ilUserFormSettings($this->id); 501 #$settings->deleteValue('desc'); // #11340 502 #$settings->importFromForm($form); 516 $tpl->setBodyClass(
"ilBodyPrint");
520 $tpl->setVariable(
"LOCATION_STYLESHEET", $location_stylesheet);
522 $tpl->setVariable(
"BODY_ATTRIBUTES",
'onload="window.print()"');
535 $tpl =
new ilTemplate(
'tpl.attendance_list_print.html',
true,
true,
'Services/Membership');
543 $tpl->setVariable(
'TXT_TITLE', $this->title);
544 if ($this->description) {
545 $tpl->setVariable(
'TXT_DESCRIPTION', $this->description .
" (" .
$time .
")");
547 $tpl->setVariable(
'TXT_DESCRIPTION',
$time);
553 $tpl->setCurrentBlock(
'head_item');
554 foreach ($this->presets as
$id => $item) {
556 $tpl->setVariable(
'TXT_HEAD', $item[0]);
557 $tpl->parseCurrentBlock();
561 if ($this->blank_columns) {
562 foreach ($this->blank_columns as $blank) {
563 $tpl->setVariable(
'TXT_HEAD', $blank);
564 $tpl->parseCurrentBlock();
571 $valid_user_ids = $filters =
array();
574 if ($this->has_local_role) {
576 foreach ($this->participants->getMembers() as $member_id) {
577 foreach ($this->participants->getAssignedRoles($member_id) as $role_id) {
578 $members[$role_id][] = $member_id;
582 $members = $this->participants->getMembers();
585 foreach ($this->roles as $role_id) {
586 switch ($this->role_data[$role_id][1]) {
588 $valid_user_ids = array_merge($valid_user_ids, $this->participants->getAdmins());
592 $valid_user_ids = array_merge($valid_user_ids, $this->participants->getTutors());
597 if (!$this->has_local_role) {
598 $valid_user_ids = array_merge($valid_user_ids, (
array) $members);
600 $valid_user_ids = array_merge($valid_user_ids, (
array) $members[$role_id]);
607 if ($this->include_subscribers) {
608 $valid_user_ids = array_merge($valid_user_ids, $this->participants->getSubscribers());
611 if ($this->include_waiting_list) {
612 $valid_user_ids = array_merge($valid_user_ids, $this->waiting_list->getUserIds());
615 if ($this->user_filters) {
616 foreach ($this->user_filters as $sub_id => $sub_item) {
617 $filters[$sub_id] = (bool) $sub_item[2];
621 $valid_user_ids =
ilUtil::_sortIds(array_unique($valid_user_ids),
'usr_data',
'lastname',
'usr_id');
626 foreach ($valid_user_ids as $user_id) {
627 if ($this->callback) {
628 $user_data = call_user_func_array($this->callback,
array($user_id, $filters));
633 $tpl->setCurrentBlock(
"row_preset");
634 foreach ($this->presets as
$id => $item) {
638 if (!$user_data[
$id]) {
640 $value =
$name[
"lastname"] .
", " .
$name[
"firstname"];
647 if (!$user_data[$id]) {
654 $value = (
string) $user_data[$id];
657 $tpl->setVariable(
"TXT_PRESET", (
string) $value);
658 $tpl->parseCurrentBlock();
663 if ($this->blank_columns) {
665 $tpl->touchBlock(
'row_blank');
669 $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.
static _getInstance()
Get instance.
Base class for course and group waiting lists.
setId($a_value)
Set id (used for user form settings)
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
static _getValuesByObjId($a_obj_id)
Get values by obj_id (for all users)
getFullscreenHTML()
render list in fullscreen mode
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static setUseRelativeDates($a_status)
set use relative dates
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.
static _readUsersProfileData($a_user_ids)
STATIC METHOD get user data of selected users.
Base class for attendance lists.
addPreset($a_id, $a_caption, $a_selected=false)
Add user field.
if(isset($_POST['submit'])) $form
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.
static _getInstanceByType($a_type)
Get Singleton Instance.
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.
readOrderedExportableFields()
read object export fields
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Create styles array
The data for the language used.
__construct($a_parent_gui, $a_parent_obj, ilParticipants $a_participants_object=null, ilWaitingList $a_waiting_list=null)
Constructor.
setCallback($a_callback)
Set participant detail callback.
setRoleSelection($a_role_ids)
Set role selection.
static getLogger($a_component_id)
Get component logger.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
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.
static _getFields($a_container_id, $a_sort=IL_CDF_SORT_NAME)
Get all fields of a container.