Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00042 class ilPDFPresentation extends ilLearningProgressBaseGUI
00043 {
00044 var $type = '';
00045
00046
00047 function ilPDFPresentation($a_mode,$a_ref_id,$a_user_id = 0)
00048 {
00049 global $lng,$ilCtrl;
00050
00051 parent::ilLearningProgressBaseGUI($a_mode,$a_ref_id,$a_user_id);
00052
00053 $this->ctrl =& $ilCtrl;
00054 $this->lng =& $lng;
00055
00056 $this->__init();
00057 }
00058
00062 function &executeCommand()
00063 {
00064 $this->ctrl->setReturn($this, "");
00065 switch($this->ctrl->getNextClass())
00066 {
00067 default:
00068 $cmd = $this->ctrl->getCmd();
00069 $this->$cmd();
00070
00071 }
00072 return true;
00073 }
00074
00075 function setType($a_type)
00076 {
00077 $this->type = $a_type;
00078 }
00079 function getType()
00080 {
00081 return $this->type;
00082 }
00083
00084
00085
00086 function __init()
00087 {
00088 global $ilUser;
00089
00090 include_once './classes/class.ilXmlWriter.php';
00091 $this->xmlWriter = new ilXmlWriter();
00092
00093
00094 include_once './Services/Tracking/classes/class.ilLPFilter.php';
00095 $this->filter = new ilLPFilter($ilUser->getId());
00096
00097
00098 }
00099
00100 function createList()
00101 {
00102 switch($this->getType())
00103 {
00104 case LP_ACTIVE_PROGRESS:
00105 return $this->__createPersonalProgressList();
00106
00107 default:
00108 sendInfo('trac_pdf_error'. ' '.$this->getMode(),true);
00109 }
00110
00111 $this->ctrl->returnToParent($this);
00112 }
00113
00114 function __createPersonalProgressList()
00115 {
00116
00117 $this->xml_tpl = new ilTemplate('tpl.lp_pdf_list.xml',true,true,'Services/Tracking');
00118
00119 $this->__addMain();
00120 $this->__addFilter();
00121
00122
00123 $this->__convert();
00124 }
00125
00126 function __addFilter()
00127 {
00128 global $ilUser,$ilObjDataCache;
00129
00130 $filter = new ilLPFilter($ilUser->getId());
00131
00132 $this->xml_tpl->setCurrentBlock("filter");
00133 $this->xml_tpl->setVariable("TXT_FILTER",$this->lng->txt('trac_lp_filter'));
00134 $this->xml_tpl->setVariable("TXT_OBJECT_TYPES",$this->lng->txt('obj_types'));
00135 $this->xml_tpl->setVariable("OBJECT_TYPES",$this->lng->txt('objs_'.$filter->getFilterType()));
00136 $this->xml_tpl->setVariable("TXT_AREA",$this->lng->txt('trac_filter_area'));
00137 $this->xml_tpl->setVariable("FILTER_LANG",$ilUser->getLanguage());
00138 if($filter->getRootNode() == ROOT_FOLDER_ID)
00139 {
00140 $this->xml_tpl->setVariable("AREA",$this->lng->txt('trac_filter_repository'));
00141 }
00142 else
00143 {
00144 $text = $this->lng->txt('trac_below')." '";
00145 $text .= $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($filter->getRootNode()));
00146 $text .= "'";
00147 $this->xml_tpl->setVariable("AREA",$text);
00148 }
00149 $this->xml_tpl->setVariable("TXT_TITLE_DESC",$this->lng->txt('trac_query'));
00150 $this->xml_tpl->setVariable("TITLE_DESC",$filter->getQueryString());
00151 $this->xml_tpl->parseCurrentBlock();
00152
00153 #echo htmlentities($this->xml_tpl->get());
00154 }
00155
00156 function __addMain()
00157 {
00158 global $ilUser;
00159
00160 $this->xml_tpl->setVariable("LANG",$ilUser->getLanguage());
00161 $this->xml_tpl->setVariable("PDF_TITLE",$this->lng->txt('learning_progress'));
00162 $this->xml_tpl->setVariable("PDF_DESCRIPTION",$this->lng->txt('learning_progress'));
00163 $this->xml_tpl->setVariable("PAGE_TITLE",$this->lng->txt('learning_progress'));
00164 $this->xml_tpl->setVariable("PAGE_DESCRIPTION",$this->lng->txt('learning_progress'));
00165
00166 return true;
00167 }
00168
00169
00170 function __convert()
00171 {
00172 include_once 'Services/Transformation/classes/class.ilContentObject2FO.php';
00173
00174 $co2fo = new ilContentObject2FO();
00175 $co2fo->setXMLString($xml = $this->xml_tpl->get());
00176 if(!$co2fo->transform())
00177 {
00178 sendInfo($this->lng->txt('trac_error_pdf',true));
00179 $this->ctrl->returnToParent($this);
00180 }
00181
00182 include_once 'Services/Transformation/classes/class.ilFO2PDF.php';
00183
00184 $fo2pdf = new ilFO2PDF();
00185 $fo2pdf->setFOString($co2fo->getFOString());
00186
00187 #var_dump("<pre>",htmlentities($co2fo->getFOString()),"<pre>");
00188 $pdf = $fo2pdf->send();
00189
00190 if(is_null($pdf))
00191 {
00192 sendInfo($this->lng->txt('trac_error_pdf',true));
00193 $this->ctrl->returnToParent($this);
00194 }
00195 }
00196
00197 }
00198 ?>