ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAttendanceList Class Reference

Base class for attendance lists. More...

+ Collaboration diagram for ilAttendanceList:

Public Member Functions

 __construct ($a_parent_obj, $a_participants_object=null)
 Constructor.
 addPreset ($a_id, $a_caption, $a_selected=false)
 Add user field.
 addBlank ($a_caption)
 Add blank column preset.
 setTitle ($a_title, $a_description=null)
 Set titles.
 showAdmins ($a_value=true)
 Include admins.
 showTutors ($a_value=true)
 Include tutors.
 showMembers ($a_value=true)
 Include members.
 setBlankColumns (array $a_values)
 Add blank columns.
 setCallback ($a_callback)
 Set participant detail callback.
 setId ($a_value)
 Set id (used for user form settings)
 initForm ($a_cmd="")
 Init form.
 initFromForm ()
 Set list attributes from post values.
 getFullscreenHTML ()
 render list in fullscreen mode
 getHTML ()
 render attendance list

Protected Attributes

 $parent_obj
 $participants
 $callback
 $presets
 $show_admins
 $show_tutors
 $show_members
 $blank_columns
 $title
 $description
 $pre_blanks
 $id

Detailed Description

Base class for attendance lists.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 13 of file class.ilAttendanceList.php.

Constructor & Destructor Documentation

ilAttendanceList::__construct (   $a_parent_obj,
  $a_participants_object = null 
)

Constructor.

Parameters
object$a_parent_obj
object$a_participants_object

Definition at line 34 of file class.ilAttendanceList.php.

References $lng.

{
global $lng;
$this->parent_obj = $a_parent_obj;
$this->participants = $a_participants_object;
// always available
$this->presets['name'] = array($lng->txt('name'), true);
$this->presets['login'] = array($lng->txt('login'), true);
$this->presets['email'] = array($lng->txt('email'));
}

Member Function Documentation

ilAttendanceList::addBlank (   $a_caption)

Add blank column preset.

Parameters
string$a_caption

Definition at line 64 of file class.ilAttendanceList.php.

{
$this->pre_blanks[] = $a_caption;
}
ilAttendanceList::addPreset (   $a_id,
  $a_caption,
  $a_selected = false 
)

Add user field.

Parameters
string$a_id
string$a_caption
bool$a_selected

Definition at line 54 of file class.ilAttendanceList.php.

Referenced by initFromForm().

{
$this->presets[$a_id] = array($a_caption, $a_selected);
}

+ Here is the caller graph for this function:

ilAttendanceList::getFullscreenHTML ( )

render list in fullscreen mode

Returns
string

Definition at line 292 of file class.ilAttendanceList.php.

References $tpl, getHTML(), and ilUtil\getStyleSheetLocation().

{
$tpl = new ilTemplate('tpl.main.html',true,true);
$tpl->setBodyClass("ilBodyPrint");
// load style sheet depending on user's settings
$location_stylesheet = ilUtil::getStyleSheetLocation();
$tpl->setVariable("LOCATION_STYLESHEET",$location_stylesheet);
$tpl->setVariable("BODY_ATTRIBUTES",'onload="window.print()"');
$tpl->setVariable("CONTENT", $this->getHTML());
return $tpl->show();
}

+ Here is the call graph for this function:

ilAttendanceList::getHTML ( )

render attendance list

Returns
string

Definition at line 312 of file class.ilAttendanceList.php.

References $blank_columns, $id, $tpl, ilObjUser\_lookupEmail(), ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), ilUtil\_sortIds(), and ilFormat\formatUnixTime().

Referenced by getFullscreenHTML().

{
$tpl = new ilTemplate('tpl.attendance_list_print.html',true,true,'Services/Membership');
// title
$time = ilFormat::formatUnixTime(time(),true);
$tpl->setVariable('TXT_TITLE', $this->title);
if($this->description)
{
$tpl->setVariable('TXT_DESCRIPTION', $this->description." (".$time.")");
}
else
{
$tpl->setVariable('TXT_DESCRIPTION', $time);
}
// header
$tpl->setCurrentBlock('head_item');
foreach($this->presets as $id => $item)
{
if($item[1])
{
$tpl->setVariable('TXT_HEAD', $item[0]);
$tpl->parseCurrentBlock();
}
}
if($this->blank_columns)
{
foreach($this->blank_columns as $blank)
{
$tpl->setVariable('TXT_HEAD', $blank);
$tpl->parseCurrentBlock();
}
}
// handle members
$member_ids = array();
if($this->show_admins)
{
$member_ids = array_merge((array)$member_ids,$this->participants->getAdmins());
}
if($this->show_tutors)
{
$member_ids = array_merge((array)$member_ids,$this->participants->getTutors());
}
if($this->show_members)
{
$member_ids = array_merge((array)$member_ids,$this->participants->getMembers());
}
$member_ids = ilUtil::_sortIds((array) $member_ids,'usr_data','lastname','usr_id');
// rows
foreach($member_ids as $user_id)
{
if($this->callback)
{
$user_data = call_user_func_array($this->callback, array($user_id));
$tpl->setCurrentBlock("row_preset");
foreach($this->presets as $id => $item)
{
if($item[1])
{
switch($id)
{
case "name":
if(!$user_data[$id])
{
$name = ilObjUser::_lookupName($user_id);
$value = $name["lastname"].", ".$name["firstname"];
break;
}
case "email":
if(!$user_data[$id])
{
$value = ilObjUser::_lookupEmail($user_id);
break;
}
case "login":
if(!$user_data[$id])
{
$value = ilObjUser::_lookupLogin($user_id);
break;
}
default:
$value = (string)$user_data[$id];
break;
}
$tpl->setVariable("TXT_PRESET", $value);
$tpl->parseCurrentBlock();
}
}
}
if($this->blank_columns)
{
for($loop = 0; $loop < sizeof($this->blank_columns); $loop++)
{
$tpl->touchBlock('row_blank');
}
}
$tpl->touchBlock("member_row");
}
return $tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAttendanceList::initForm (   $a_cmd = "")

Init form.

Parameters
string$a_cmd
Returns
ilPropertyFormGUI

Definition at line 162 of file class.ilAttendanceList.php.

References $id, $ilCtrl, $lng, $title, ilTextInputGUI\setMulti(), ilCheckboxInputGUI\setOptionTitle(), and ilTextInputGUI\setValue().

Referenced by initFromForm().

{
global $ilCtrl, $lng;
$lng->loadLanguageModule('crs');
include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
$form = new ilPropertyFormGUI();
$form->setFormAction($ilCtrl->getFormAction($this->parent_obj,$a_cmd));
$form->setTarget('_blank');
$form->setTitle($lng->txt('sess_gen_attendance_list'));
$title = new ilTextInputGUI($lng->txt('title'), 'title');
$title->setValue($this->title);
$form->addItem($title);
$desc = new ilTextInputGUI($lng->txt('description'), 'desc');
$desc->setValue($this->description);
$form->addItem($desc);
if(sizeof($this->presets))
{
$preset = new ilCheckboxGroupInputGUI($lng->txt('user_detail'), 'preset');
$preset_value = array();
foreach($this->presets as $id => $item)
{
$preset->addOption(new ilCheckboxOption($item[0], $id));
if($item[1])
{
$preset_value[] = $id;
}
}
$preset->setValue($preset_value);
$form->addItem($preset);
}
$blank = new ilTextInputGUI($lng->txt('event_blank_columns'), 'blank');
$blank->setMulti(true);
$form->addItem($blank);
if($this->pre_blanks)
{
$blank->setValue($this->pre_blanks);
}
$part = new ilFormSectionHeaderGUI();
$part->setTitle($lng->txt('event_participant_selection'));
$form->addItem($part);
// Admins
$admin = new ilCheckboxInputGUI($lng->txt('event_tbl_admins'),'show_admins');
$admin->setOptionTitle($lng->txt('event_inc_admins'));
$admin->setValue(1);
$form->addItem($admin);
// Tutors
$tutor = new ilCheckboxInputGUI($lng->txt('event_tbl_tutors'),'show_tutors');
$tutor->setOptionTitle($lng->txt('event_inc_tutors'));
$tutor->setValue(1);
$form->addItem($tutor);
// Members
$member = new ilCheckboxInputGUI($lng->txt('event_tbl_members'),'show_members');
$member->setOptionTitle($lng->txt('event_inc_members'));
$member->setValue(1);
$member->setChecked(true);
$form->addItem($member);
$form->addCommandButton($a_cmd,$lng->txt('sess_print_attendance_list'));
if($this->id && $a_cmd)
{
include_once "Services/User/classes/class.ilUserFormSettings.php";
$settings = new ilUserFormSettings($this->id);
$settings->deleteValue('desc');
$settings->exportToForm($form);
}
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAttendanceList::initFromForm ( )

Set list attributes from post values.

Definition at line 246 of file class.ilAttendanceList.php.

References $id, addPreset(), initForm(), setBlankColumns(), setTitle(), showAdmins(), showMembers(), and showTutors().

{
$form = $this->initForm();
if($form->checkInput())
{
foreach(array_keys($this->presets) as $id)
{
$this->presets[$id][1] = false;
}
foreach($form->getInput('preset') as $value)
{
if(isset($this->presets[$value]))
{
$this->presets[$value][1] = true;
}
else
{
$this->addPreset($value, $value, true);
}
}
$this->setTitle($form->getInput('title'), $form->getInput('desc'));
$this->setBlankColumns($form->getInput('blank'));
$this->showAdmins($form->getInput('show_admins'));
$this->showTutors($form->getInput('show_tutors'));
$this->showMembers($form->getInput('show_members'));
if($this->id)
{
$form->setValuesByPost();
include_once "Services/User/classes/class.ilUserFormSettings.php";
$settings = new ilUserFormSettings($this->id);
$settings->deleteValue('desc');
$settings->importFromForm($form);
$settings->store();
}
}
}

+ Here is the call graph for this function:

ilAttendanceList::setBlankColumns ( array  $a_values)

Add blank columns.

Parameters
array$a_value

Definition at line 116 of file class.ilAttendanceList.php.

Referenced by initFromForm().

{
if(!implode("", $a_values))
{
$a_values = array();
}
else
{
foreach($a_values as $idx => $value)
{
$a_values[$idx] = trim($value);
if($a_values[$idx] == "")
{
unset($a_values[$idx]);
}
}
}
$this->blank_columns = $a_values;
}

+ Here is the caller graph for this function:

ilAttendanceList::setCallback (   $a_callback)

Set participant detail callback.

Parameters
string | array$a_callback

Definition at line 141 of file class.ilAttendanceList.php.

{
$this->callback = $a_callback;
}
ilAttendanceList::setId (   $a_value)

Set id (used for user form settings)

Parameters
string$a_value

Definition at line 151 of file class.ilAttendanceList.php.

{
$this->id = (string)$a_value;
}
ilAttendanceList::setTitle (   $a_title,
  $a_description = null 
)

Set titles.

Parameters
string$a_title
string$a_description

Definition at line 75 of file class.ilAttendanceList.php.

Referenced by initFromForm().

{
$this->title = $a_title;
$this->description = $a_description;
}

+ Here is the caller graph for this function:

ilAttendanceList::showAdmins (   $a_value = true)

Include admins.

Parameters
bool$a_value

Definition at line 86 of file class.ilAttendanceList.php.

Referenced by initFromForm().

{
$this->show_admins = (bool)$a_value;
}

+ Here is the caller graph for this function:

ilAttendanceList::showMembers (   $a_value = true)

Include members.

Parameters
bool$a_value

Definition at line 106 of file class.ilAttendanceList.php.

Referenced by initFromForm().

{
$this->show_members = (bool)$a_value;
}

+ Here is the caller graph for this function:

ilAttendanceList::showTutors (   $a_value = true)

Include tutors.

Parameters
bool$a_value

Definition at line 96 of file class.ilAttendanceList.php.

Referenced by initFromForm().

{
$this->show_tutors = (bool)$a_value;
}

+ Here is the caller graph for this function:

Field Documentation

ilAttendanceList::$blank_columns
protected

Definition at line 22 of file class.ilAttendanceList.php.

Referenced by getHTML().

ilAttendanceList::$callback
protected

Definition at line 17 of file class.ilAttendanceList.php.

ilAttendanceList::$description
protected

Definition at line 24 of file class.ilAttendanceList.php.

ilAttendanceList::$id
protected

Definition at line 26 of file class.ilAttendanceList.php.

Referenced by getHTML(), initForm(), and initFromForm().

ilAttendanceList::$parent_obj
protected

Definition at line 15 of file class.ilAttendanceList.php.

ilAttendanceList::$participants
protected

Definition at line 16 of file class.ilAttendanceList.php.

ilAttendanceList::$pre_blanks
protected

Definition at line 25 of file class.ilAttendanceList.php.

ilAttendanceList::$presets
protected

Definition at line 18 of file class.ilAttendanceList.php.

ilAttendanceList::$show_admins
protected

Definition at line 19 of file class.ilAttendanceList.php.

ilAttendanceList::$show_members
protected

Definition at line 21 of file class.ilAttendanceList.php.

ilAttendanceList::$show_tutors
protected

Definition at line 20 of file class.ilAttendanceList.php.

ilAttendanceList::$title
protected

Definition at line 23 of file class.ilAttendanceList.php.

Referenced by initForm().


The documentation for this class was generated from the following file: