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

Public Member Functions

 ilPDFPresentation ($a_mode, $a_ref_id, $a_user_id=0, $a_tracked_user=0)
getCurrentUserId ()
executeCommand ()
 execute command
 setType ($a_type)
 getType ()
 __init ()
 createList ()
 createDetails ()
 __createObjectDetails ()
 __showItems ()
 __renderContainerRow ($a_parent_id, $a_item_id, $a_usr_id, $type, $level)
 __toFO ()
 __toPDF ()
 __createPersonalProgressList ()
 __createObjectList ()
 __addMain ()
 __convert ()
- Public Member Functions inherited from ilLearningProgressBaseGUI
 ilLearningProgressBaseGUI ($a_mode, $a_ref_id=0, $a_usr_id=0)
 activePDF ()
 __checkPDF ()
 isAnonymized ()
 isObjectAnonymized ()
 getMode ()
 getRefId ()
 getObjId ()
 getUserId ()
 activateStatistics ($a_act=true)
 __getDefaultCommand ()
 __setSubTabs ($a_active)
 __buildFooter ()
 __buildHeader ()
 __insertPath (&$a_tpl, $a_ref_id)
 insert path
 __showImageByStatus (&$tpl, $a_status, $tpl_prefix="")
__initTableGUI ()
 __showObjectDetails (&$info, $item_id=0)
 show details about current object.
 __appendLPDetails (&$info, $item_id, $user_id)
 __readStatus ($a_obj_id, $user_id)
 __showButton ($a_link, $a_text, $a_target= '')
 __sort ($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.
 __getPercent ($max, $reached)
 __readItemStatusInfo ($a_items)
 __getLegendHTML ()

Data Fields

 $type = ''
- Data Fields inherited from ilLearningProgressBaseGUI
 $tpl = null
 $ctrl = null
 $lng = null
 $ref_id = 0
 $mode = 0
 $statistics_activated = false

Additional Inherited Members

- Static Public Member Functions inherited from ilLearningProgressBaseGUI
static _showImageByStatus (&$tpl, $a_status, $tpl_prefix="")

Detailed Description

Definition at line 43 of file class.ilPDFPresentation.php.

Member Function Documentation

ilPDFPresentation::__addMain ( )

Definition at line 390 of file class.ilPDFPresentation.php.

References $name, ilObjUser\_lookupName(), ilFormat\formatUnixTime(), getCurrentUserId(), getType(), and LP_ACTIVE_PROGRESS.

Referenced by __createObjectList(), and __createPersonalProgressList().

{
global $ilUser,$ilObjDataCache;
$this->tpl->setVariable("LEARNING_PROGRESS_OF",$this->lng->txt('learning_progress'));
switch($this->getType())
{
$this->tpl->setVariable("USER_FULLNAME",$name['lastname'].', '.$name['firstname']);
break;
}
$this->tpl->setVariable("DATE",ilFormat::formatUnixTime(time(),true));
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPDFPresentation::__convert ( )

Definition at line 408 of file class.ilPDFPresentation.php.

References $ilLog, ilUtil\deliverData(), ilRpcClientFactory\factory(), and ilUtil\sendFailure().

Referenced by __createObjectList(), and __createPersonalProgressList().

{
global $ilLog;
include_once './Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
try
{
$pdf_base64 = ilRpcClientFactory::factory('RPCTransformationHandler')->ilFO2PDF($this->tpl->get());
ilUtil::deliverData($pdf_base64->scalar,'learning_progress.pdf','application/pdf');
return true;
}
{
ilUtil::sendFailure($e->getMessage(),true);
$ilLog->write(__METHOD__.': '.$e->getMessage());
$this->ctrl->returnToParent($this);
return false;
}
catch(Exception $e)
{
ilUtil::sendFailure($e->getMessage(),true);
$ilLog->write(__METHOD__.': '.$e->getMessage());
$this->ctrl->returnToParent($this);
return false;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPDFPresentation::__createObjectDetails ( )

Definition at line 140 of file class.ilPDFPresentation.php.

References __showItems(), __toFO(), __toPDF(), ilLPItemListFactory\_getInstance(), ilLPObjSettings\_isContainer(), ilLPObjSettings\_lookupMode(), ilFormat\formatUnixTime(), ilLearningProgressBaseGUI\getRefId(), getType(), LP_ACTIVE_OBJECTS, and LP_ACTIVE_PROGRESS.

Referenced by createDetails().

{
global $ilObjDataCache;
include_once 'classes/class.ilXmlWriter.php';
$this->writer = new ilXmlWriter();
$this->writer->xmlHeader();
$this->writer->xmlStartTag('LearningProgress');
$this->writer->xmlElement('Title',null,$this->lng->txt('learning_progress'));
// Header
$header = $this->lng->txt('learning_progress').': '.ilFormat::formatUnixTime(time(),true);
$this->writer->xmlElement('Header',null,$header);
// Footer
$this->writer->xmlElement('Footer',null,'powered by ILIAS');
// Info
include_once 'Services/Tracking/classes/ItemList/class.ilLPItemListFactory.php';
$this->details_obj_id = $ilObjDataCache->lookupObjId($this->getRefId());
$item_list =& ilLPItemListFactory::_getInstance(0,$this->details_obj_id,$ilObjDataCache->lookupType($this->details_obj_id));
if($this->getType() == LP_ACTIVE_PROGRESS)
{
$item_list->setCurrentUser($this->current_user_id);
$item_list->readUserInfo();
$item_list->renderObjectInfoXML($this->writer,true,true);
}
else
{
$item_list->renderObjectInfoXML($this->writer,false,false);
}
// Items
include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
{
$this->__showItems();
}
$this->writer->xmlEndTag('LearningProgress');
$this->__toFO();
$this->__toPDF();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPDFPresentation::__createObjectList ( )

Definition at line 358 of file class.ilPDFPresentation.php.

References $type, __addMain(), __convert(), ilLearningProgressBaseGUI\__sort(), ilLPItemListFactory\_getInstance(), and getCurrentUserId().

Referenced by createList().

{
global $ilObjDataCache,$ilUser;
// Load and fill xml template
$this->tpl = new ilTemplate('tpl.lp_pdf_list.xml',true,true,'Services/Tracking');
$this->__addMain();
$this->tpl->setVariable("FILTER",$this->filter_gui->getFO());
$this->filter->setRequiredPermission('read');
$type = $this->filter->getFilterType();
$this->tpl->setVariable("TXT_OBJS",$this->lng->txt('objs_'.$type));
// Sort objects by title
$objs = $this->filter->getObjects();
$sorted_objs = $this->__sort(array_keys($objs),'object_data','title','obj_id');
// Render item list
$counter = 0;
foreach($sorted_objs as $object_id)
{
$item_list =& ilLPItemListFactory::_getInstance(0,$object_id,$ilObjDataCache->lookupType($object_id));
#$item_list->setCurrentUser($this->tracked_user->getId());
$item_list->setCurrentUser($this->getCurrentUserId());
$item_list->readUserInfo();
$item_list->renderObjectListFO();
}
// Finally convert to fop
$this->__convert();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPDFPresentation::__createPersonalProgressList ( )

Definition at line 328 of file class.ilPDFPresentation.php.

References $type, __addMain(), __convert(), ilLearningProgressBaseGUI\__sort(), ilLPItemListFactory\_getInstance(), and getCurrentUserId().

Referenced by createList().

{
global $ilObjDataCache,$ilUser;
// Load and fill xml template
$this->tpl = new ilTemplate('tpl.lp_pdf_list.xml',true,true,'Services/Tracking');
$this->__addMain();
$this->tpl->setVariable("FILTER",$this->filter_gui->getFO());
$this->filter->setRequiredPermission('read');
$type = $this->filter->getFilterType();
$this->tpl->setVariable("TXT_OBJS",$this->lng->txt('objs_'.$type));
// Sort objects by title
$objs = $this->filter->getObjects();
$sorted_objs = $this->__sort(array_keys($objs),'object_data','title','obj_id');
// Render item list
$counter = 0;
foreach($sorted_objs as $object_id)
{
$item_list =& ilLPItemListFactory::_getInstance(0,$object_id,$ilObjDataCache->lookupType($object_id));
$item_list->setCurrentUser($this->getCurrentUserId());
$item_list->readUserInfo();
$item_list->renderSimpleProgressFO();
}
// Finally convert to fop
$this->__convert();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPDFPresentation::__init ( )

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

Referenced by ilPDFPresentation().

{
global $ilUser;
include_once './classes/class.ilXmlWriter.php';
$this->xmlWriter = new ilXmlWriter();
include_once './Services/Tracking/classes/class.ilLPFilter.php';
$this->filter = new ilLPFilter($ilUser->getId());
include_once './Services/Tracking/classes/class.ilLPFilterGUI.php';
$this->filter_gui = new ilLPFilterGUI($ilUser->getId());
}

+ Here is the caller graph for this function:

ilPDFPresentation::__renderContainerRow (   $a_parent_id,
  $a_item_id,
  $a_usr_id,
  $type,
  $level 
)

Definition at line 231 of file class.ilPDFPresentation.php.

References $type, ilLPItemListFactory\_getInstanceByRefId(), ilLPCollectionCache\_getItems(), LP_MODE_OBJECTIVES, and LP_MODE_SCORM.

Referenced by __showItems().

{
global $ilObjDataCache,$ilUser,$ilAccess;
include_once 'Services/Tracking/classes/ItemList/class.ilLPItemListFactory.php';
$item_list =& ilLPItemListFactory::_getInstanceByRefId($a_parent_id,$a_item_id,$type);
if($this->has_timings)
{
$item_list->readTimings();
$item_list->enable('timings');
}
$item_list->setCurrentUser($a_usr_id);
$item_list->readUserInfo();
$item_list->setIndentLevel($level);
$item_list->renderObjectDetailsXML($this->writer);
if($type == 'sahs_item' or
$type == 'objective' or
$type == 'event')
{
return true;
}
include_once './Services/Tracking/classes/class.ilLPCollectionCache.php';
foreach(ilLPCollectionCache::_getItems($ilObjDataCache->lookupObjId($a_item_id)) as $child_id)
{
switch($item_list->getMode())
{
$this->writer->xmlStartTag('Item');
$this->__renderContainerRow($a_item_id,$child_id,$a_usr_id,'objective',$level + 2);
$this->writer->xmlEndTag('Item');
break;
$this->writer->xmlStartTag('Item');
$this->__renderContainerRow($a_item_id,$child_id,$a_usr_id,'sahs_item',$level + 2);
$this->writer->xmlEndTag('Item');
break;
default:
if(!$ilAccess->checkAccess('read','',$child_id))
{
break;
}
$this->writer->xmlStartTag('Item');
$this->__renderContainerRow($a_item_id,$child_id,$a_usr_id,
$ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($child_id)),$level + 2);
$this->writer->xmlEndTag('Item');
break;
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPDFPresentation::__showItems ( )

Definition at line 185 of file class.ilPDFPresentation.php.

References $failed, $user, __renderContainerRow(), ilLearningProgressBaseGUI\__sort(), ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), ilLPStatusWrapper\_getInProgress(), ilLPStatusWrapper\_getNotAttempted(), ilCourseItems\_hasCollectionTimings(), ilLearningProgressBaseGUI\getRefId(), getType(), LP_ACTIVE_OBJECTS, and LP_ACTIVE_PROGRESS.

Referenced by __createObjectDetails().

{
include_once 'Services/Tracking/classes/class.ilLPMarks.php';
global $ilObjDataCache,$ilUser;
$not_attempted = ilLPStatusWrapper::_getNotAttempted($this->details_obj_id);
$in_progress = ilLPStatusWrapper::_getInProgress($this->details_obj_id);
$completed = ilLPStatusWrapper::_getCompleted($this->details_obj_id);
$failed = ilLPStatusWrapper::_getFailed($this->details_obj_id);
switch($this->getType())
{
$all_users = array_merge($completed,$in_progress,$not_attempted,$failed);
$all_users = $this->__sort($all_users,'usr_data','lastname','usr_id');
break;
$all_users = array($this->current_user_id);
break;
}
// Header
$this->writer->xmlStartTag('Items');
$this->writer->xmlStartTag('ItemHeader');
$this->writer->xmlElement('HeaderTitle',null,$this->lng->txt('trac_objects'));
// Show timings header
include_once 'Modules/Course/classes/class.ilCourseItems.php';
if($this->has_timings = ilCourseItems::_hasCollectionTimings($this->getRefId()))
{
$this->writer->xmlElement('HeaderInfo',null,$this->lng->txt('trac_head_timing'));
}
$this->writer->xmlEndTag('ItemHeader');
// Render item list
$this->container_row_counter = 0;
foreach($all_users as $user)
{
$this->writer->xmlStartTag('Item');
$this->__renderContainerRow(0,$this->getRefId(),$user,'usr',0);
$this->writer->xmlEndTag('Item');
}
$this->writer->xmlEndTag('Items');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPDFPresentation::__toFO ( )

Definition at line 288 of file class.ilPDFPresentation.php.

Referenced by __createObjectDetails().

{
include_once 'Services/Transformation/classes/class.ilXML2FO.php';
$xml2FO = new ilXML2FO();
$xml2FO->setXSLTLocation($this->tpl->getTemplatePath('learning_progress_fo.xsl','Services/Tracking'));
$xml2FO->setXMLString($this->writer->xmlDumpMem());
$xml2FO->transform();
$this->fo_string = $xml2FO->getFOString();
#var_dump("<pre>",htmlentities($this->fo_string),"<pre>");
return true;
}

+ Here is the caller graph for this function:

ilPDFPresentation::__toPDF ( )

Definition at line 302 of file class.ilPDFPresentation.php.

References $ilLog, ilUtil\deliverData(), ilRpcClientFactory\factory(), and ilUtil\sendFailure().

Referenced by __createObjectDetails().

{
global $ilLog;
include_once './Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
try
{
$pdf_base64 = ilRpcClientFactory::factory('RPCTransformationHandler')->ilFO2PDF($this->fo_string);
ilUtil::deliverData($pdf_base64->scalar,'learning_progress.pdf','application/pdf');
}
{
ilUtil::sendFailure($e->getMessage(),true);
$ilLog->write(__METHOD__.': '.$e->getMessage());
$this->ctrl->returnToParent($this);
return false;
}
catch(Exception $e)
{
ilUtil::sendFailure($e->getMessage(),true);
$ilLog->write(__METHOD__.': '.$e->getMessage());
$this->ctrl->returnToParent($this);
return false;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPDFPresentation::createDetails ( )

Definition at line 127 of file class.ilPDFPresentation.php.

References __createObjectDetails(), ilLearningProgressBaseGUI\getMode(), getType(), LP_ACTIVE_OBJECTS, LP_ACTIVE_PROGRESS, and ilUtil\sendInfo().

{
switch($this->getType())
{
return $this->__createObjectDetails();
default:
ilUtil::sendInfo('trac_pdf_error'. ' '.$this->getMode(),true);
}
}

+ Here is the call graph for this function:

ilPDFPresentation::createList ( )

Definition at line 110 of file class.ilPDFPresentation.php.

References __createObjectList(), __createPersonalProgressList(), ilLearningProgressBaseGUI\getMode(), getType(), LP_ACTIVE_OBJECTS, LP_ACTIVE_PROGRESS, and ilUtil\sendInfo().

{
switch($this->getType())
{
return $this->__createObjectList();
default:
ilUtil::sendInfo('trac_pdf_error'. ' '.$this->getMode(),true);
}
$this->ctrl->returnToParent($this);
}

+ Here is the call graph for this function:

& ilPDFPresentation::executeCommand ( )

execute command

Definition at line 72 of file class.ilPDFPresentation.php.

References $cmd.

{
$this->ctrl->setReturn($this, "");
switch($this->ctrl->getNextClass())
{
default:
$cmd = $this->ctrl->getCmd();
$this->$cmd();
}
return true;
}
& ilPDFPresentation::getCurrentUserId ( )

Definition at line 62 of file class.ilPDFPresentation.php.

Referenced by __addMain(), __createObjectList(), and __createPersonalProgressList().

{
return $this->current_user_id;
}

+ Here is the caller graph for this function:

ilPDFPresentation::getType ( )

Definition at line 89 of file class.ilPDFPresentation.php.

References $type.

Referenced by __addMain(), __createObjectDetails(), __showItems(), createDetails(), and createList().

{
return $this->type;
}

+ Here is the caller graph for this function:

ilPDFPresentation::ilPDFPresentation (   $a_mode,
  $a_ref_id,
  $a_user_id = 0,
  $a_tracked_user = 0 
)

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

References $ilCtrl, ilLearningProgressBaseGUI\$lng, __init(), and ilLearningProgressBaseGUI\ilLearningProgressBaseGUI().

{
global $lng,$ilCtrl;
parent::ilLearningProgressBaseGUI($a_mode,$a_ref_id,$a_user_id);
$this->ctrl =& $ilCtrl;
$this->lng =& $lng;
$this->current_user_id = $a_tracked_user;
$this->__init();
}

+ Here is the call graph for this function:

ilPDFPresentation::setType (   $a_type)

Definition at line 85 of file class.ilPDFPresentation.php.

Referenced by ilLPListOfProgressGUI\executeCommand().

{
$this->type = $a_type;
}

+ Here is the caller graph for this function:

Field Documentation

ilPDFPresentation::$type = ''

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