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();
 
   70        foreach (
$roles as $role_id) {
 
   72            switch (substr(
$title, 0, 8)) {
 
   76                    $this->
addRole($role_id, 
$DIC->language()->txt(
'event_tbl_admin'), 
'admin');
 
   80                    $this->
addRole($role_id, 
$DIC->language()->txt(
'event_tbl_tutor'), 
'tutor');
 
   86                    $this->
addRole($role_id, 
$DIC->language()->txt(
'event_tbl_member'), 
'member');
 
   90                    $this->
addRole($role_id, 
$DIC->language()->txt(
'event_tbl_member'), 
'member');
 
   95                    $this->has_local_role = 
true;
 
  108        include_once(
'Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
 
  109        include_once(
'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
 
  110        include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
 
  111        include_once(
'Services/User/classes/class.ilUserDefinedFields.php');
 
  114        $field_info->sortExportFields();
 
  116        foreach ($field_info->getExportableFields() as $field) {
 
  126            $this->presets[$field] = array(
 
  127                $GLOBALS[
'DIC'][
'lng']->txt($field),
 
  134        foreach ($udf->getExportableFields($this->parent_obj->getId()) as $field_id => $udf_data) {
 
  135            $this->presets[
'udf_' . $field_id] = array(
 
  136                $udf_data[
'field_name'],
 
  142        include_once 
'./Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php';
 
  144            $this->presets[
'cdf_' . $field_obj->getId()] = array(
 
  145                $field_obj->getName(),
 
  159    public function addPreset($a_id, $a_caption, $a_selected = 
false)
 
  161        $this->presets[$a_id] = array($a_caption, $a_selected);
 
  171        $this->pre_blanks[] = $a_caption;
 
  180    public function setTitle($a_title, $a_description = 
null)
 
  182        $this->title = $a_title;
 
  183        $this->description = $a_description;
 
  193    protected function addRole($a_id, $a_caption, $a_type)
 
  195        $this->role_data[$a_id] = array($a_caption, $a_type);
 
  207        $this->roles = $a_role_ids;
 
  219        $this->user_filters[$a_id] = array($a_caption, $a_checked);
 
  233        $subscriber_ids = $this->participants->getSubscribers();
 
  235        $user_ids = $subscriber_ids;
 
  237        if ($this->waiting_list) {
 
  238            $user_ids = array_merge($user_ids, $this->waiting_list->getUserIds());
 
  243        foreach ($profile_data as $user_id => $fields) {
 
  244            foreach ((array) $fields as $field => $value) {
 
  245                $a_res[$user_id][$field] = $value;
 
  249        include_once 
'./Services/User/classes/class.ilUserDefinedFields.php';
 
  252        foreach ($udf->getExportableFields($this->parent_obj->getId()) as $field_id => $udf_data) {
 
  253            foreach ($profile_data as $user_id => $field) {
 
  254                include_once 
'./Services/User/classes/class.ilUserDefinedData.php';
 
  256                $a_res[$user_id][
'udf_' . $field_id] = (string) $udf_data->get(
'f_' . $field_id);
 
  260        if (
sizeof($user_ids)) {
 
  262            include_once 
'Modules/Course/classes/Export/class.ilCourseUserData.php';
 
  265            foreach (array_unique($user_ids) as $user_id) {
 
  267                    $a_res[$user_id][
'login'] = $tmp_obj->getLogin();
 
  268                    $a_res[$user_id][
'name'] = $tmp_obj->getLastname() . 
', ' . $tmp_obj->getFirstname();
 
  270                    if (in_array($user_id, $subscriber_ids)) {
 
  271                        $a_res[$user_id][
'status'] = 
$lng->txt(
'crs_subscriber');
 
  273                        $a_res[$user_id][
'status'] = 
$lng->txt(
'crs_waiting_list');
 
  276                    foreach ((array) $cdfs[$user_id] as $field_id => $value) {
 
  277                        $a_res[$user_id][
'cdf_' . $field_id] = (string) $value;
 
  291        if (!implode(
"", $a_values)) {
 
  294            foreach ($a_values as $idx => $value) {
 
  295                $a_values[$idx] = trim($value);
 
  296                if ($a_values[$idx] == 
"") {
 
  297                    unset($a_values[$idx]);
 
  301        $this->blank_columns = $a_values;
 
  311        $this->callback = $a_callback;
 
  321        $this->
id = (string) $a_value;
 
  334        $ilCtrl = 
$DIC[
'ilCtrl'];
 
  337        $lng->loadLanguageModule(
'crs');
 
  339        include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
 
  341        $form->setFormAction($ilCtrl->getFormAction($this->parent_gui, $a_cmd));
 
  342        $form->setPreventDoubleSubmission(
false);
 
  343        $form->setTitle(
$lng->txt(
'sess_gen_attendance_list'));
 
  346        $title->setValue($this->title);
 
  350        $desc->setValue($this->description);
 
  351        $form->addItem($desc);
 
  353        if (
sizeof($this->presets)) {
 
  355            $preset_value = array();
 
  356            foreach ($this->presets as 
$id => $item) {
 
  359                    $preset_value[] = 
$id;
 
  362            $preset->setValue($preset_value);
 
  363            $form->addItem($preset);
 
  367        $blank->setMulti(
true);
 
  368        $form->addItem($blank);
 
  370        if ($this->pre_blanks) {
 
  371            $blank->setValue($this->pre_blanks);
 
  379        foreach ($this->role_data as $role_id => 
$role_data) {
 
  382            $role_name = $role_id;
 
  383            if (substr(
$title, 0, 10) == 
'il_' . $this->parent_obj->getType() . 
'_adm') {
 
  386            if (substr(
$title, 0, 10) == 
'il_' . $this->parent_obj->getType() . 
'_mem') {
 
  389            if (substr(
$title, 0, 10) == 
'il_' . $this->parent_obj->getType() . 
'_tut') {
 
  394            $checked[] = 
'role_' . $role_name;
 
  395            $chk_grp->addOption($chk);
 
  398        if ($this->waiting_list) {
 
  400            $chk_grp->addOption($chk);
 
  403            $chk_grp->addOption($chk);
 
  406        if ($this->user_filters) {
 
  407            foreach ($this->user_filters as $sub_id => $sub_item) {
 
  409                    sprintf(
$lng->txt(
'event_user_selection_include_filter'), $sub_item[0]),
 
  413                    $checked[] = 
'members_' . $sub_id;
 
  415                $chk_grp->addOption($chk);
 
  418        $chk_grp->setValue($checked);
 
  419        $form->addItem($chk_grp);
 
  421        $form->addCommandButton($a_cmd, 
$lng->txt(
'sess_print_attendance_list'));
 
  423        if ($this->
id && $a_cmd) {
 
  424            include_once 
"Services/User/classes/class.ilUserFormSettings.php";
 
  426            if (!$settings->hasStoredEntry()) {
 
  430            $settings->deleteValue(
'desc'); 
 
  431            $settings->exportToForm($form);
 
  432        } elseif ($a_cmd == 
'printForMembersOutput') {
 
  433            include_once 
"Services/User/classes/class.ilUserFormSettings.php";
 
  434            $settings = 
new ilUserFormSettings($this->parent_obj->getType() . 
's_pview_' . $this->parent_obj->getId(), -1);
 
  435            if (!$settings->hasStoredEntry()) {
 
  440            $settings->deleteValue(
'desc'); 
 
  441            $settings->exportToForm($form, 
true);
 
  453        if ($form->checkInput()) {
 
  454            foreach (array_keys($this->presets) as 
$id) {
 
  455                $this->presets[
$id][1] = 
false;
 
  457            foreach ((array) $form->getInput(
'preset') as $value) {
 
  458                if (isset($this->presets[$value])) {
 
  459                    $this->presets[$value][1] = 
true;
 
  465            $this->
setTitle($form->getInput(
'title'), $form->getInput(
'desc'));
 
  468            $selection_of_users = (array) $form->getInput(
'selection_of_users'); 
 
  471            foreach (array_keys($this->role_data) as $role_id) {
 
  473                $role_name = $role_id;
 
  474                if (substr(
$title, 0, 10) == 
'il_' . $this->parent_obj->getType() . 
'_adm') {
 
  477                if (substr(
$title, 0, 10) == 
'il_' . $this->parent_obj->getType() . 
'_mem') {
 
  480                if (substr(
$title, 0, 10) == 
'il_' . $this->parent_obj->getType() . 
'_tut') {
 
  485                if (in_array(
'role_' . $role_name, (array) $selection_of_users)) {
 
  492            if ($this->waiting_list) {
 
  493                $this->include_subscribers = (bool) in_array(
'subscr', $selection_of_users);
 
  494                $this->include_waiting_list = (bool) in_array(
'wlist', $selection_of_users);
 
  497            if ($this->user_filters) {
 
  498                foreach (array_keys($this->user_filters) as $msub_id) {
 
  499                    $this->user_filters[$msub_id][2] = (bool) in_array(
"members_" . $msub_id, $selection_of_users);
 
  504                #$form->setValuesByPost(); 
  506                #include_once "Services/User/classes/class.ilUserFormSettings.php";
 
  507                #$settings = new ilUserFormSettings($this->id); 
  508                #$settings->deleteValue('desc');  
  509                #$settings->importFromForm($form); 
  527        $tpl->addOnLoadCode(
"il.Util.print();");
 
  539        $tpl = 
new ilTemplate(
'tpl.attendance_list_print.html', 
true, 
true, 
'Services/Membership');
 
  547        $tpl->setVariable(
'TXT_TITLE', $this->title);
 
  548        if ($this->description) {
 
  549            $tpl->setVariable(
'TXT_DESCRIPTION', $this->description . 
" (" . $time . 
")");
 
  551            $tpl->setVariable(
'TXT_DESCRIPTION', $time);
 
  557        $tpl->setCurrentBlock(
'head_item');
 
  558        foreach ($this->presets as 
$id => $item) {
 
  560                $tpl->setVariable(
'TXT_HEAD', $item[0]);
 
  561                $tpl->parseCurrentBlock();
 
  565        if ($this->blank_columns) {
 
  566            foreach ($this->blank_columns as $blank) {
 
  567                $tpl->setVariable(
'TXT_HEAD', $blank);
 
  568                $tpl->parseCurrentBlock();
 
  575        $valid_user_ids = $filters = array();
 
  578            if ($this->has_local_role) {
 
  580                foreach ($this->participants->getMembers() as $member_id) {
 
  581                    foreach ($this->participants->getAssignedRoles($member_id) as $role_id) {
 
  582                        $members[$role_id][] = $member_id;
 
  586                $members = $this->participants->getMembers();
 
  589            foreach ($this->roles as $role_id) {
 
  590                switch ($this->role_data[$role_id][1]) {
 
  592                        $valid_user_ids = array_merge($valid_user_ids, $this->participants->getAdmins());
 
  596                        $valid_user_ids = array_merge($valid_user_ids, $this->participants->getTutors());
 
  601                        if (!$this->has_local_role) {
 
  602                            $valid_user_ids = array_merge($valid_user_ids, (array) $members);
 
  604                            $valid_user_ids = array_merge($valid_user_ids, (array) $members[$role_id]);
 
  611        if ($this->include_subscribers) {
 
  612            $valid_user_ids = array_merge($valid_user_ids, $this->participants->getSubscribers());
 
  615        if ($this->include_waiting_list) {
 
  616            $valid_user_ids = array_merge($valid_user_ids, $this->waiting_list->getUserIds());
 
  619        if ($this->user_filters) {
 
  620            foreach ($this->user_filters as $sub_id => $sub_item) {
 
  621                $filters[$sub_id] = (bool) $sub_item[2];
 
  625        $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                                $value = (string) ilOrgUnitPathStorage::getTextRepresentationOfUsersOrgUnits($user_id);
 
  642                                if (!$user_data[
$id]) {
 
  644                                    $value = 
$name[
"lastname"] . 
", " . 
$name[
"firstname"];
 
  651                                if (!$user_data[
$id]) {
 
  658                                $value = (string) $user_data[
$id];
 
  661                        $tpl->setVariable(
"TXT_PRESET", (
string) $value);
 
  662                        $tpl->parseCurrentBlock();
 
  667            if ($this->blank_columns) {
 
  669                    $tpl->touchBlock(
'row_blank');
 
  673            $tpl->touchBlock(
"member_row");
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
Base class for attendance lists.
setCallback($a_callback)
Set participant detail callback.
getHTML()
render attendance list
initForm($a_cmd="")
Init form.
addRole($a_id, $a_caption, $a_type)
Add role.
addPreset($a_id, $a_caption, $a_selected=false)
Add user field.
setRoleSelection($a_role_ids)
Set role selection.
addBlank($a_caption)
Add blank column preset.
__construct($a_parent_gui, $a_parent_obj, ilParticipants $a_participants_object=null, ilWaitingList $a_waiting_list=null)
Constructor.
setTitle($a_title, $a_description=null)
Set titles.
getFullscreenHTML()
render list in fullscreen mode
getNonMemberUserData(array &$a_res)
Get user data for subscribers and waiting list.
readOrderedExportableFields()
read object export fields
addUserFilter($a_id, $a_caption, $a_checked=false)
Add user filter.
setBlankColumns(array $a_values)
Add blank columns.
setId($a_value)
Set id (used for user form settings)
initFromForm()
Set list attributes from post values.
This class represents an option in a checkbox group.
static _getFields($a_container_id, $a_sort=IL_CDF_SORT_NAME)
Get all fields of a container.
static _getValuesByObjId($a_obj_id)
Get values by obj_id (for all users)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
@classDescription Date and time handling
static _getInstanceByType($a_type)
Get Singleton Instance.
static getLogger($a_component_id)
Get component logger.
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
static _readUsersProfileData($a_user_ids)
STATIC METHOD get user data of selected users.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupTitle($a_id)
lookup object title
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
static _getInstance()
Get instance.
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,...
Base class for course and group waiting lists.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl