ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSessionOverviewGUI Class Reference
+ Collaboration diagram for ilSessionOverviewGUI:

Public Member Functions

 __construct ($a_crs_ref_id)
 constructor
 executeCommand ()
 ecxecute command
 listSessions ()
 list sessions of all user
 exportCSV ()
 Events List CSV Export.

Protected Attributes

 $course_ref_id = null
 $course_id = null
 $lng
 $tpl
 $ctrl

Detailed Description

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 32 of file class.ilSessionOverviewGUI.php.

Constructor & Destructor Documentation

ilSessionOverviewGUI::__construct (   $a_crs_ref_id)

constructor

public

Parameters
@return

Definition at line 48 of file class.ilSessionOverviewGUI.php.

References $ilCtrl, $lng, $tpl, and ilObject\_lookupObjId().

{
global $tpl, $ilCtrl, $lng;
$this->ctrl = $ilCtrl;
$this->tpl = $tpl;
$this->lng = $lng;
$this->lng->loadLanguageModule('event');
$this->lng->loadLanguageModule('crs');
$this->course_ref_id = $a_crs_ref_id;
$this->course_id = ilObject::_lookupObjId($this->course_ref_id);
}

+ Here is the call graph for this function:

Member Function Documentation

ilSessionOverviewGUI::executeCommand ( )

ecxecute command

public

Parameters
@return

Definition at line 69 of file class.ilSessionOverviewGUI.php.

References $cmd.

{
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
switch($next_class)
{
default:
if(!$cmd)
{
$cmd = "listSessions";
}
$this->$cmd();
break;
}
}
ilSessionOverviewGUI::exportCSV ( )

Events List CSV Export.

public

Parameters

Definition at line 227 of file class.ilSessionOverviewGUI.php.

References $name, ilCourseParticipants\_getInstanceByObjId(), ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), ilUtil\_sortIds(), ilUtil\deliverData(), ilObjectFactory\getInstanceByRefId(), IL_CAL_FKT_DATE, and IL_CAL_UNIX.

{
global $tree,$ilAccess;
include_once('Services/Utilities/classes/class.ilCSVWriter.php');
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
include_once 'Modules/Session/classes/class.ilEventParticipants.php';
$members_obj = ilCourseParticipants::_getInstanceByObjId($this->course_id);
$members = $members_obj->getParticipants();
$members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
$events = array();
foreach($tree->getSubtree($tree->getNodeData($this->course_ref_id),false,'sess') as $event_id)
{
$tmp_event = ilObjectFactory::getInstanceByRefId($event_id,false);
if(!is_object($tmp_event) or !$ilAccess->checkAccess('write','',$event_id))
{
continue;
}
$events[] = $tmp_event;
}
$this->csv = new ilCSVWriter();
$this->csv->addColumn($this->lng->txt("lastname"));
$this->csv->addColumn($this->lng->txt("firstname"));
$this->csv->addColumn($this->lng->txt("login"));
foreach($events as $event_obj)
{
// TODO: do not export relative dates
$this->csv->addColumn($event_obj->getTitle().' ('.$event_obj->getFirstAppointment()->appointmentToString().')');
}
$this->csv->addRow();
foreach($members as $user_id)
{
$this->csv->addColumn($name['lastname']);
$this->csv->addColumn($name['firstname']);
$this->csv->addColumn(ilObjUser::_lookupLogin($user_id));
foreach($events as $event_obj)
{
$event_part = new ilEventParticipants((int) $event_obj->getId());
$this->csv->addColumn($event_part->hasParticipated($user_id) ?
$this->lng->txt('event_participated') :
$this->lng->txt('event_not_participated'));
}
$this->csv->addRow();
}
$date = new ilDate(time(),IL_CAL_UNIX);
ilUtil::deliverData($this->csv->getCSVString(),$date->get(IL_CAL_FKT_DATE,'Y-m-d')."_course_events.csv", "text/csv");
}

+ Here is the call graph for this function:

ilSessionOverviewGUI::listSessions ( )

list sessions of all user

public

Parameters
@return

Definition at line 92 of file class.ilSessionOverviewGUI.php.

References $_GET, $_SESSION, $ilErr, $name, ilCourseParticipants\_getInstanceByObjId(), ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), ilUtil\_sortIds(), ilUtil\getImagePath(), ilObjectFactory\getInstanceByRefId(), and ilUtil\switchColor().

{
global $ilErr,$ilAccess, $ilUser,$tree;
if(!$ilAccess->checkAccess('write','',$this->course_ref_id))
{
$ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE);
}
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.sess_list.html','Modules/Session');
$this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
// display button
$this->tpl->setCurrentBlock("btn_cell");
$this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,'exportCSV'));
$this->tpl->setVariable("BTN_TXT",$this->lng->txt('event_csv_export'));
$this->tpl->parseCurrentBlock();
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
include_once 'Modules/Session/classes/class.ilEventParticipants.php';
$this->tpl->addBlockfile("EVENTS_TABLE","events_table", "tpl.table.html");
$this->tpl->addBlockfile('TBL_CONTENT','tbl_content','tpl.sess_list_row.html','Modules/Session');
$members_obj = ilCourseParticipants::_getInstanceByObjId($this->course_id);
$members = $members_obj->getParticipants();
$members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
// Table
$tbl = new ilTableGUI();
$tbl->setTitle($this->lng->txt("event_overview"),
'icon_usr.gif',
$this->lng->txt('obj_usr'));
$this->ctrl->setParameter($this,'offset',(int) $_GET['offset']);
$events = array();
foreach($tree->getSubtree($tree->getNodeData($this->course_ref_id),false,'sess') as $event_id)
{
$tmp_event = ilObjectFactory::getInstanceByRefId($event_id,false);
if(!is_object($tmp_event) or !$ilAccess->checkAccess('write','',$event_id))
{
continue;
}
$events[] = $tmp_event;
}
$headerNames = array();
$headerVars = array();
$colWidth = array();
$headerNames[] = $this->lng->txt('name');
$headerVars[] = "name";
$colWidth[] = '20%';
for ($i = 1; $i <= count($events); $i++)
{
$headerNames[] = $i;
$headerVars[] = "event_".$i;
$colWidth[] = 80/count($events)."%";
}
$this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
$tbl->setHeaderNames($headerNames);
$tbl->setHeaderVars($headerVars, $this->ctrl->getParameterArray($this,'listSessions'));
$tbl->setColumnWidth($colWidth);
$tbl->setOrderColumn($_GET["sort_by"]);
$tbl->setOrderDirection($_GET["sort_order"]);
$tbl->setOffset($_GET["offset"]);
$tbl->setLimit($ilUser->getPref("hits_per_page"));
$tbl->setMaxCount(count($members));
$tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
$sliced_users = array_slice($members,$_GET['offset'],$_SESSION['tbl_limit']);
$tbl->disable('sort');
$tbl->render();
$counter = 0;
foreach($sliced_users as $user_id)
{
foreach($events as $event_obj)
{
$this->tpl->setCurrentBlock("eventcols");
$event_part = new ilEventParticipants($event_obj->getId());
{
$this->tpl->setVariable("IMAGE_PARTICIPATED", $event_part->hasParticipated($user_id) ?
ilUtil::getImagePath('icon_ok.gif') :
ilUtil::getImagePath('icon_not_ok.gif'));
$this->tpl->setVariable("PARTICIPATED", $event_part->hasParticipated($user_id) ?
$this->lng->txt('event_participated') :
$this->lng->txt('event_not_participated'));
}
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("tbl_content");
$this->tpl->setVariable("CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
$this->tpl->setVariable("LASTNAME",$name['lastname']);
$this->tpl->setVariable("FIRSTNAME",$name['firstname']);
$this->tpl->setVariable("LOGIN",ilObjUser::_lookupLogin($user_id));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setVariable("HEAD_TXT_LEGEND", $this->lng->txt("legend"));
$this->tpl->setVariable("HEAD_TXT_DIGIT", $this->lng->txt("event_digit"));
$this->tpl->setVariable("HEAD_TXT_EVENT", $this->lng->txt("event"));
$this->tpl->setVariable("HEAD_TXT_LOCATION", $this->lng->txt("event_location"));
$this->tpl->setVariable("HEAD_TXT_DATE_TIME",$this->lng->txt("event_date_time"));
$i = 1;
foreach($events as $event_obj)
{
$this->tpl->setCurrentBlock("legend_loop");
$this->tpl->setVariable("LEGEND_CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
$this->tpl->setVariable("LEGEND_DIGIT", $i++);
$this->tpl->setVariable("LEGEND_EVENT_TITLE", $event_obj->getTitle());
$this->tpl->setVariable("LEGEND_EVENT_DESCRIPTION", $event_obj->getDescription());
$this->tpl->setVariable("LEGEND_EVENT_LOCATION", $event_obj->getLocation());
$this->tpl->setVariable("LEGEND_EVENT_APPOINTMENT", $event_obj->getFirstAppointment()->appointmentToString());
$this->tpl->parseCurrentBlock();
}
}

+ Here is the call graph for this function:

Field Documentation

ilSessionOverviewGUI::$course_id = null
protected

Definition at line 35 of file class.ilSessionOverviewGUI.php.

ilSessionOverviewGUI::$course_ref_id = null
protected

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

ilSessionOverviewGUI::$ctrl
protected

Definition at line 39 of file class.ilSessionOverviewGUI.php.

ilSessionOverviewGUI::$lng
protected

Definition at line 37 of file class.ilSessionOverviewGUI.php.

Referenced by __construct().

ilSessionOverviewGUI::$tpl
protected

Definition at line 38 of file class.ilSessionOverviewGUI.php.

Referenced by __construct().


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