Public Member Functions | Data Fields

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 ()

Data Fields

 $type = ''

Detailed Description

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


Member Function Documentation

ilPDFPresentation::__addMain (  ) 

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

References ilObjUser::_lookupName(), ilFormat::formatUnixTime(), getCurrentUserId(), and getType().

Referenced by __createObjectList(), and __createPersonalProgressList().

        {
                global $ilUser,$ilObjDataCache;

                $this->tpl->setVariable("LEARNING_PROGRESS_OF",$this->lng->txt('learning_progress'));
                switch($this->getType())
                {
                        case LP_ACTIVE_PROGRESS:
                                $name = ilObjUser::_lookupName($this->getCurrentUserId());
                                $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 397 of file class.ilPDFPresentation.php.

References ilUtil::deliverData(), and sendInfo().

Referenced by __createObjectList(), and __createPersonalProgressList().

        {
                #include_once 'Services/Transformation/classes/class.ilContentObject2FO.php';
                #$co2fo = new ilContentObject2FO();
                #$co2fo->setXMLString($xml = $this->xml_tpl->get());

                #if(!$co2fo->transform())
                #{
                #endInfo($this->lng->txt('trac_error_pdf',true));
                #       $this->ctrl->returnToParent($this);
                #}

                include_once 'Services/Transformation/classes/class.ilFO2PDF.php';

                $fo2pdf = new ilFO2PDF();
                #echo htmlentities($this->tpl->get());
                $fo2pdf->setFOString($this->tpl->get());

                #var_dump("<pre>",htmlentities($fo2pdf->getFOString()),"<pre>");

                $pdf_base64 = $fo2pdf->send();

                if(!$pdf_base64)
                {
                        sendInfo($this->lng->txt('trac_error_pdf',true));
                        $this->ctrl->returnToParent($this);
                }
                ilUtil::deliverData($pdf_base64,'learning_progress.pdf','application/pdf');
        }

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(), and getType().

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';
                if(ilLPObjSettings::_isContainer(ilLPObjSettings::_lookupMode($this->details_obj_id)) or $this->getType() == LP_ACTIVE_OBJECTS)
                {
                        $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 347 of file class.ilPDFPresentation.php.

References $counter, $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 317 of file class.ilPDFPresentation.php.

References $counter, $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(), and ilLPEventCollections::_getItems().

Referenced by __showItems().

        {
                global $ilObjDataCache,$ilUser;

                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.ilLPEventCollections.php';
                foreach(ilLPEventCollections::_getItems($ilObjDataCache->lookupObjId($a_item_id)) as $event_id)
                {
                        $this->writer->xmlStartTag('Item');
                        $this->__renderContainerRow($a_item_id,$event_id,$a_usr_id,'event',$level+2);
                        $this->writer->xmlEndTag('Item');
                }
                include_once './Services/Tracking/classes/class.ilLPCollectionCache.php';
                foreach(ilLPCollectionCache::_getItems($ilObjDataCache->lookupObjId($a_item_id)) as $child_id)
                {
                        $this->writer->xmlStartTag('Item');
                        switch($item_list->getMode())
                        {
                                case LP_MODE_OBJECTIVES:
                                        $this->__renderContainerRow($a_item_id,$child_id,$a_usr_id,'objective',$level + 2);
                                        break;

                                case LP_MODE_SCORM:
                                        $this->__renderContainerRow($a_item_id,$child_id,$a_usr_id,'sahs_item',$level + 2);
                                        break;

                                default:
                                        $this->__renderContainerRow($a_item_id,$child_id,$a_usr_id,
                                                                                                $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($child_id)),$level + 2);
                                        break;
                        }
                        $this->writer->xmlEndTag('Item');
                }
        }

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 $user, __renderContainerRow(), ilLearningProgressBaseGUI::__sort(), ilLPStatusWrapper::_getCompleted(), ilLPStatusWrapper::_getFailed(), ilLPStatusWrapper::_getInProgress(), ilLPStatusWrapper::_getNotAttempted(), ilCourseItems::_hasCollectionTimings(), ilLearningProgressBaseGUI::getRefId(), and getType().

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())
                {
                        case LP_ACTIVE_OBJECTS:
                                $all_users = array_merge($completed,$in_progress,$not_attempted,$failed);
                                $all_users = $this->__sort($all_users,'usr_data','lastname','usr_id');
                                break;

                        case LP_ACTIVE_PROGRESS:
                                $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 '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 287 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 301 of file class.ilPDFPresentation.php.

References ilUtil::deliverData(), and sendInfo().

Referenced by __createObjectDetails().

        {
                include_once 'Services/Transformation/classes/class.ilFO2PDF.php';

                $fo2pdf = new ilFO2PDF();
                $fo2pdf->setFOString($this->fo_string);
                $pdf_base64 = $fo2pdf->send();

                if(!$pdf_base64)
                {
                        sendInfo($this->lng->txt('trac_error_pdf',true));
                        $this->ctrl->returnToParent($this);
                }
                ilUtil::deliverData($pdf_base64,'learning_progress.pdf','application/pdf');
        }

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(), and sendInfo().

        {
                switch($this->getType())
                {
                        case LP_ACTIVE_OBJECTS:
                        case LP_ACTIVE_PROGRESS:
                                return $this->__createObjectDetails();
                                
                        default:
                                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(), and sendInfo().

        {
                switch($this->getType())
                {
                        case LP_ACTIVE_PROGRESS:
                                return $this->__createPersonalProgressList();

                        case LP_ACTIVE_OBJECTS:
                                return $this->__createObjectList();

                        default:
                                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.

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.

        {
                $this->type = $a_type;
        }


Field Documentation

ilPDFPresentation::$type = ''

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