00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00036 include_once 'Services/Tracking/classes/class.ilLPStatus.php';
00037 include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
00038 include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
00039
00040 class ilLPItemListGUI
00041 {
00042 var $db = null;
00043 var $anonymized = false;
00044
00045 function ilLPItemListGUI($a_id,$a_type)
00046 {
00047 global $ilDB,$lng,$ilErr,$tree,$ilObjDataCache,$ilCtrl;
00048
00049 $this->db =& $ilDB;
00050 $this->lng =& $lng;
00051 $this->err =& $ilErr;
00052 $this->tree =& $tree;
00053 $this->obj_cache = $ilObjDataCache;
00054 $this->ctrl =& $ilCtrl;
00055
00056 $this->id = $a_id;
00057 $this->type = $a_type;
00058 }
00059
00060 function isAnonymized()
00061 {
00062 return $this->anonymized;
00063 }
00064
00065 function setCmdClass($a_class)
00066 {
00067 $this->cmd_class = $a_class;
00068 }
00069 function getCmdClass()
00070 {
00071 return $this->cmd_class;
00072 }
00073
00074 function setRefId($a_ref_id)
00075 {
00076 $this->ref_id = $a_ref_id;
00077 }
00078 function getRefId()
00079 {
00080 return $this->ref_id;
00081 }
00082 function getId()
00083 {
00084 return $this->id;
00085 }
00086 function getType()
00087 {
00088 return $this->type;
00089 }
00090
00091 function setCurrentUser($a_user)
00092 {
00093 $this->user = $a_user;
00094 }
00095 function getCurrentUser()
00096 {
00097 return $this->user;
00098 }
00099
00100 function getMode()
00101 {
00102 return $this->mode;
00103 }
00104
00105 function getTitle()
00106 {
00107 return $this->title;
00108 }
00109 function getDescription()
00110 {
00111 return $this->description;
00112 }
00113
00114 function getMark()
00115 {
00116 return $this->mark;
00117 }
00118 function getComment()
00119 {
00120 return $this->comment;
00121 }
00122 function getTypicalLearningTime()
00123 {
00124 return $this->tlt ? $this->tlt : 0;
00125 }
00126 function hasDetails()
00127 {
00128 return true;
00129 }
00130 function enabled($a_key)
00131 {
00132 return $this->enabled[$key];
00133 }
00134
00135 function enable($a_key)
00136 {
00137 $this->enabled[$key] = true;
00138 }
00139 function disable($a_key)
00140 {
00141 $this->enabled[$key] = false;
00142 }
00143
00144 function setIndentLevel($a_level)
00145 {
00146 $this->level = $a_level;
00147 }
00148
00149 function getUserStatus()
00150 {
00151 return $this->status;
00152 }
00153
00154 function getEditingTime()
00155 {
00156 return $this->editing_time;
00157 }
00158
00159 function showTimingWarning()
00160 {
00161 if(!$this->editing_time)
00162 {
00163 return false;
00164 }
00165 if($this->status == LP_STATUS_COMPLETED)
00166 {
00167 return false;
00168 }
00169 #print_r('<br>');
00170 #print_r(date('Y-m-d H:i',$this->editing_time));
00171 #print_r('<br>');
00172 #print_r(date('Y-m-d H:i',time()));
00173 return $this->editing_time < time();
00174 }
00175
00176 function addCheckBox($a_check)
00177 {
00178 $this->checkbox = $a_check;
00179 }
00180
00181 function __readMode()
00182 {
00183 include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
00184 $this->mode = ilLPObjSettings::_lookupMode($this->getId());
00185 }
00186
00187 function __readStatusInfo()
00188 {
00189 }
00190 function __readUserStatus()
00191 {
00192 }
00193 function __readTypicalLearningTime()
00194 {
00195 }
00196 function __readTimings()
00197 {
00198 $this->timings = array();
00199 }
00200
00201 function getHTML()
00202 {
00203 return $this->html;
00204 }
00205
00211 function read()
00212 {
00213 $this->__readMode();
00214 $this->__readStatusInfo();
00215 $this->__readTypicalLearningTime();
00216 $this->__readTitle();
00217 $this->__readDescription();
00218 }
00219
00220 function readUserInfo()
00221 {
00222 if($this->getCurrentUser())
00223 {
00224 $this->__readMark();
00225 $this->__readComment();
00226 $this->__readUserStatus();
00227 $this->__readUserStatusInfo();
00228 $this->__readEditingTime();
00229 }
00230 }
00231
00232 function readTimings()
00233 {
00234 if($this->getRefId())
00235 {
00236 include_once 'course/classes/Timings/class.ilTimingCache.php';
00237 $this->timings =& ilTimingCache::_getTimings($this->getRefId());
00238 }
00239 }
00240 function renderTypeImage()
00241 {
00242 $this->tpl->setCurrentBlock("row_type_image");
00243 $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$this->getType().'.gif'));
00244 $this->tpl->setVariable("TYPE_ALT_IMG",$this->lng->txt('obj_'.$this->getType()));
00245 $this->tpl->parseCurrentBlock();
00246 }
00247
00248
00249 function renderContainerProgress()
00250 {
00251 $this->tpl = new ilTemplate('tpl.lp_item_list_row.html',true,true,'Services/Tracking');
00252
00253 $this->renderTypeImage();
00254
00255 $this->tpl->setVariable("TXT_TITLE",$this->getTitle());
00256 if(strlen($this->getDescription()))
00257 {
00258 $this->tpl->setVariable("TXT_DESC",$this->getDescription());
00259 }
00260
00261 if($this->user_status_info)
00262 {
00263 $this->tpl->setCurrentBlock("status_info");
00264 $this->tpl->setVariable("STATUS_PROP",$this->user_status_info[0]);
00265 $this->tpl->setVariable("STATUS_VAL",$this->user_status_info[1]);
00266 $this->tpl->parseCurrentBlock();
00267 }
00268
00269
00270 $this->tpl->setCurrentBlock("item_property");
00271 $this->tpl->setVariable("TXT_PROP",$this->lng->txt('trac_status'));
00272 $this->tpl->setVariable("VAL_PROP",$this->lng->txt($this->getUserStatus()));
00273 $this->tpl->parseCurrentBlock();
00274
00275 for($i = 0;$i < $this->level;$i++)
00276 {
00277 $this->tpl->touchBlock('start_indent');
00278 $this->tpl->touchBlock('end_indent');
00279 }
00280
00281 $this->html = $this->tpl->get();
00282 }
00283
00284 function renderSimpleProgress()
00285 {
00286 $this->tpl = new ilTemplate('tpl.lp_item_list_row.html',true,true,'Services/Tracking');
00287
00288 if(is_array($this->checkbox))
00289 {
00290 $this->tpl->setVariable("CHECK_NAME",$this->checkbox[0]);
00291 $this->tpl->setVariable("CHECK_VALUE",$this->checkbox[1]);
00292 if($this->checkbox[2])
00293 {
00294 $this->tpl->setVariable("CHECK_CHECKED",'checked="checked"');
00295 }
00296 }
00297 $this->tpl->setVariable("TXT_TITLE",$this->getTitle());
00298 if(strlen($this->getDescription()))
00299 {
00300 $this->tpl->setVariable("TXT_DESC",$this->getDescription());
00301 }
00302
00303
00304 if($this->user_status_info)
00305 {
00306 $this->tpl->setCurrentBlock("status_info");
00307 $this->tpl->setVariable("STATUS_PROP",$this->user_status_info[0]);
00308 $this->tpl->setVariable("STATUS_VAL",$this->user_status_info[1]);
00309 $this->tpl->parseCurrentBlock();
00310 }
00311
00312
00313 $this->tpl->setCurrentBlock("item_property");
00314 $this->tpl->setVariable("TXT_PROP",$this->lng->txt('trac_status'));
00315 $this->tpl->setVariable("VAL_PROP",$this->lng->txt($this->getUserStatus()));
00316 $this->tpl->parseCurrentBlock();
00317
00318
00319 if($this->enabled('path'))
00320 {
00321 $this->renderPath(true);
00322 }
00323
00324
00325 $this->html = $this->tpl->get();
00326 }
00327
00328 function renderSimpleProgressFO()
00329 {
00330 global $tpl;
00331 $this->tpl =& $tpl;
00332
00333 if(strlen($this->getDescription()))
00334 {
00335 $this->tpl->setCurrentBlock("description");
00336 $this->tpl->setVariable("OBJ_DESC",ilXmlWriter::_xmlEscapeData($this->getDescription()));
00337 $this->tpl->parseCurrentBlock();
00338 }
00339
00340 $this->tpl->setCurrentBlock("status_row");
00341 $this->tpl->setVariable("STATUS_PROP",ilXmlWriter::_xmlEscapeData($this->lng->txt('trac_status')));
00342 $this->tpl->setVariable("STATUS_VAL",ilXmlWriter::_xmlEscapeData($this->lng->txt($this->getUserStatus())));
00343 $this->tpl->parseCurrentBlock();
00344
00345 if($this->user_status_info)
00346 {
00347 $this->tpl->setCurrentBlock("status_row");
00348 $this->tpl->setVariable("STATUS_PROP",ilXmlWriter::_xmlEscapeData($this->user_status_info[0]));
00349 $this->tpl->setVariable("STATUS_VAL",ilXmlWriter::_xmlEscapeData($this->user_status_info[1]));
00350 $this->tpl->parseCurrentBlock();
00351 }
00352
00353 $this->tpl->setCurrentBlock("item");
00354 $this->tpl->setVariable("OBJ_TITLE",ilXmlWriter::_xmlEscapeData($this->getTitle()));
00355 $this->tpl->parseCurrentBlock();
00356
00357 }
00358
00359
00360 function renderObjectList()
00361 {
00362 $this->tpl = new ilTemplate('tpl.lp_item_list_row.html',true,true,'Services/Tracking');
00363
00364 if(is_array($this->checkbox))
00365 {
00366 $this->tpl->setVariable("CHECK_NAME",$this->checkbox[0]);
00367 $this->tpl->setVariable("CHECK_VALUE",$this->checkbox[1]);
00368 if($this->checkbox[2])
00369 {
00370 $this->tpl->setVariable("CHECK_CHECKED",'checked="checked"');
00371 }
00372 }
00373 $this->tpl->setVariable("TXT_TITLE",$this->getTitle());
00374 if(strlen($this->getDescription()))
00375 {
00376 $this->tpl->setVariable("TXT_DESC",$this->getDescription());
00377 }
00378
00379
00380 include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
00381 if($num_na = ilLPStatusWrapper::_getCountNotAttempted($this->getId()))
00382 {
00383 $this->tpl->setCurrentBlock("item_property");
00384 $this->tpl->setVariable("TXT_PROP",$this->lng->txt('trac_not_attempted'));
00385 $this->tpl->setVariable("VAL_PROP",$num_na);
00386 $this->tpl->parseCurrentBlock();
00387 $this->tpl->touchBlock('newline_prop');
00388 }
00389
00390 $this->tpl->setCurrentBlock("item_property");
00391 $this->tpl->setVariable("TXT_PROP",$this->lng->txt('trac_in_progress'));
00392 $this->tpl->setVariable("VAL_PROP",ilLPStatusWrapper::_getCountInProgress($this->getId()));
00393 $this->tpl->parseCurrentBlock();
00394 $this->tpl->touchBlock('newline_prop');
00395
00396 $this->tpl->setCurrentBlock("item_property");
00397 $this->tpl->setVariable("TXT_PROP",$this->lng->txt('trac_completed'));
00398 $this->tpl->setVariable("VAL_PROP",ilLPStatusWrapper::_getCountCompleted($this->getId()));
00399 $this->tpl->parseCurrentBlock();
00400
00401 if($num_failed = ilLPStatusWrapper::_getCountFailed($this->getId()))
00402 {
00403 $this->tpl->touchBlock('newline_prop');
00404 $this->tpl->setCurrentBlock("item_property");
00405 $this->tpl->setVariable("TXT_PROP",$this->lng->txt('trac_failed'));
00406 $this->tpl->setVariable("VAL_PROP",ilLPStatusWrapper::_getCountFailed($this->getId()));
00407 $this->tpl->parseCurrentBlock();
00408 }
00409
00410
00411 if($this->enabled('path'))
00412 {
00413 $this->renderPath(false);
00414 }
00415
00416
00417 $this->html = $this->tpl->get();
00418 }
00419
00420 function renderObjectListFO()
00421 {
00422 global $tpl;
00423 $this->tpl =& $tpl;
00424
00425 if(strlen($this->getDescription()))
00426 {
00427 $this->tpl->setCurrentBlock("description");
00428 $this->tpl->setVariable("OBJ_DESC",ilXmlWriter::_xmlEscapeData($this->getDescription()));
00429 $this->tpl->parseCurrentBlock();
00430 }
00431 include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
00432 if($num_na = ilLPStatusWrapper::_getCountNotAttempted($this->getId()))
00433 {
00434 $this->tpl->setCurrentBlock("status_row");
00435 $this->tpl->setVariable("STATUS_PROP",ilXmlWriter::_xmlEscapeData($this->lng->txt('trac_not_attempted')));
00436 $this->tpl->setVariable("STATUS_VAL",ilLPStatusWrapper::_getCountNotAttempted($this->getId()));
00437 $this->tpl->parseCurrentBlock();
00438 }
00439
00440 $this->tpl->setCurrentBlock("status_row");
00441 $this->tpl->setVariable("STATUS_PROP",ilXmlWriter::_xmlEscapeData($this->lng->txt('trac_in_progress')));
00442 $this->tpl->setVariable("STATUS_VAL",ilLPStatusWrapper::_getCountInProgress($this->getId()));
00443 $this->tpl->parseCurrentBlock();
00444
00445 $this->tpl->setCurrentBlock("status_row");
00446 $this->tpl->setVariable("STATUS_PROP",ilXmlWriter::_xmlEscapeData($this->lng->txt('trac_completed')));
00447 $this->tpl->setVariable("STATUS_VAL",ilLPStatusWrapper::_getCountCompleted($this->getId()));
00448 $this->tpl->parseCurrentBlock();
00449
00450 if($num_failed = ilLPStatusWrapper::_getCountFailed($this->getId()))
00451 {
00452 $this->tpl->setCurrentBlock("status_row");
00453 $this->tpl->setVariable("STATUS_PROP",$this->lng->txt('trac_failed'));
00454 $this->tpl->setVariable("STATUS_VAL",ilLPStatusWrapper::_getCountFailed($this->getId()));
00455 $this->tpl->parseCurrentBlock();
00456 }
00457
00458 $this->tpl->setCurrentBlock("item");
00459 $this->tpl->setVariable("OBJ_TITLE",ilXmlWriter::_xmlEscapeData($this->getTitle()));
00460 $this->tpl->parseCurrentBlock();
00461 }
00462
00463 function renderObjectDetails()
00464 {
00465 $this->tpl = new ilTemplate('tpl.lp_item_list_row.html',true,true,'Services/Tracking');
00466
00467 $this->renderTypeImage();
00468
00469 if(is_array($this->checkbox))
00470 {
00471 $this->tpl->setVariable("CHECK_NAME",$this->checkbox[0]);
00472 $this->tpl->setVariable("CHECK_VALUE",$this->checkbox[1]);
00473 if($this->checkbox[2])
00474 {
00475 $this->tpl->setVariable("CHECK_CHECKED",'checked="checked"');
00476 }
00477 }
00478
00479 $this->tpl->setVariable("TXT_TITLE",$this->getTitle());
00480 if(strlen($this->getDescription()))
00481 {
00482 $this->tpl->setVariable("TXT_DESC",$this->getDescription());
00483 }
00484
00485
00486 if($this->user_status_info)
00487 {
00488 $this->tpl->setCurrentBlock("status_info");
00489 $this->tpl->setVariable("STATUS_PROP",$this->user_status_info[0]);
00490 $this->tpl->setVariable("STATUS_VAL",$this->user_status_info[1]);
00491 $this->tpl->parseCurrentBlock();
00492 }
00493
00494
00495 $this->tpl->setCurrentBlock("item_property");
00496 $this->tpl->setVariable("TXT_PROP",$this->lng->txt('trac_status'));
00497 $this->tpl->setVariable("VAL_PROP",$this->lng->txt($this->getUserStatus()));
00498 $this->tpl->parseCurrentBlock();
00499
00500
00501 if(strlen($this->getComment()))
00502 {
00503 $this->tpl->setCurrentBlock("info_property");
00504 $this->tpl->setVariable("INFO_TXT_PROP",$this->lng->txt('trac_comment'));
00505 $this->tpl->setVariable("INFO_VAL_PROP",$this->getComment());
00506 $this->tpl->parseCurrentBlock();
00507 }
00508
00509 for($i = 0;$i < $this->level;$i++)
00510 {
00511 $this->tpl->touchBlock('start_indent');
00512 $this->tpl->touchBlock('end_indent');
00513 }
00514
00515 $this->html = $this->tpl->get();
00516 }
00517
00518 function renderObjectDetailsXML(&$writer)
00519 {
00520 $writer->xmlElement('ItemText',array('Style' => 'title'),$this->getTitle());
00521 if(strlen($this->getDescription()))
00522 {
00523 $writer->xmlElement('ItemText',array('Style' => 'description'),$this->getDescription());
00524 }
00525
00526
00527 $writer->xmlStartTag('ItemInfo',array('Style' => 'alert'));
00528 $writer->xmlElement('ItemInfoName',null,$this->lng->txt('trac_status').': ');
00529 $writer->xmlElement('ItemInfoValue',null,$this->lng->txt($this->getUserStatus()));
00530 $writer->xmlEndTag('ItemInfo');
00531
00532
00533 if($this->user_status_info)
00534 {
00535 $writer->xmlStartTag('ItemInfo',array('Style' => 'text'));
00536 $writer->xmlElement('ItemInfoName',null,$this->user_status_info[0].': ');
00537 $writer->xmlElement('ItemInfoValue',null,$this->user_status_info[1]);
00538 $writer->xmlEndTag('ItemInfo');
00539 }
00540
00541
00542 if(strlen($this->getComment()))
00543 {
00544 $writer->xmlStartTag('ItemInfo',array('Style' => 'text'));
00545 $writer->xmlElement('ItemInfoName',null,$this->lng->txt('trac_comment').': ');
00546 $writer->xmlElement('ItemInfoValue',null,$this->getComment());
00547 $writer->xmlEndTag('ItemInfo');
00548 }
00549 if(strlen($this->getMark()))
00550 {
00551 $writer->xmlStartTag('ItemInfo',array('Style' => 'text'));
00552 $writer->xmlElement('ItemInfoName',null,$this->lng->txt('trac_mark').': ');
00553 $writer->xmlElement('ItemInfoValue',null,$this->getMark());
00554 $writer->xmlEndTag('ItemInfo');
00555 }
00556 if($this->enabled('timings') and $this->editing_time)
00557 {
00558 $writer->xmlStartTag('ItemInfo',array('Style' => $this->showTimingWarning() ?
00559 'alert' :
00560 'text'));
00561 $writer->xmlElement('ItemInfoName',null,$this->lng->txt('trac_head_timing').": ");
00562 $writer->xmlElement('ItemInfoValue',null,ilFormat::formatUnixTime($this->editing_time));
00563 $writer->xmlEndTag('ItemInfo');
00564 }
00565 }
00566
00567 function &renderObjectInfo($enable_details = false)
00568 {
00569 include_once("classes/class.ilInfoScreenGUI.php");
00570 $info = new ilInfoScreenGUI($this);
00571
00572 $info->addSection($this->lng->txt('details'));
00573
00574
00575 $info->addProperty($this->lng->txt('title'),$this->getTitle());
00576
00577
00578 if(strlen($desc = $this->getDescription()))
00579 {
00580 $info->addProperty($this->lng->txt('description'),$desc);
00581 }
00582
00583
00584 $info->addProperty($this->lng->txt('trac_mode'),ilLPObjSettings::_mode2Text($this->getMode()));
00585
00586
00587 if($this->getMode() == LP_MODE_VISITS)
00588 {
00589 $info->addProperty($this->lng->txt('trac_required_visits'),$this->status_info['visits']);
00590 }
00591
00592
00593 if($this->getTypicalLearningTime())
00594 {
00595 $info->addProperty($this->lng->txt('meta_typical_learning_time'),ilFormat::_secondsToString($this->getTypicalLearningTime()));
00596 }
00597
00598 return $info;
00599 }
00600
00601 function renderObjectInfoXML(&$writer,$a_enable_progress = false,$a_enable_user_info = false)
00602 {
00603 global $ilObjDataCache;
00604
00605 $writer->xmlStartTag('Info');
00606 $writer->xmlStartTag('InfoBody');
00607
00608 if($a_enable_user_info)
00609 {
00610 $writer->xmlStartTag('InfoRow');
00611 $writer->xmlElement('InfoColumn',array('Style' => 'title','Colspan' => '2'),$this->lng->txt('trac_user_data'));
00612 $writer->xmlEndTag('InfoRow');
00613
00614 $writer->xmlStartTag('InfoRow');
00615 $writer->xmlElement('InfoColumn',array('Style' => 'option'),$this->lng->txt('username'));
00616 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),ilObjUser::_lookupLogin($this->getCurrentUser()));
00617 $writer->xmlEndTag('InfoRow');
00618
00619 $writer->xmlStartTag('InfoRow');
00620 $writer->xmlElement('InfoColumn',array('Style' => 'option'),$this->lng->txt('name'));
00621 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),$ilObjDataCache->lookupTitle($this->getCurrentUser()));
00622 $writer->xmlEndTag('InfoRow');
00623
00624 $writer->xmlStartTag('InfoRow');
00625 $writer->xmlElement('InfoColumn',array('Style' => 'option'),$this->lng->txt('last_login'));
00626 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),
00627 ilFormat::formatDate(ilObjUser::_lookupLastLogin($this->getCurrentUser())));
00628 $writer->xmlEndTag('InfoRow');
00629
00630 include_once 'Services/Tracking/classes/class.ilOnlineTracking.php';
00631 $writer->xmlStartTag('InfoRow');
00632 $writer->xmlElement('InfoColumn',array('Style' => 'option'),$this->lng->txt('trac_total_online'));
00633 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),
00634 ilFormat::_secondsToString(ilOnlineTracking::_getOnlineTime($this->getCurrentUser())));
00635 $writer->xmlEndTag('InfoRow');
00636 }
00637
00638 $writer->xmlStartTag('InfoRow');
00639 $writer->xmlElement('InfoColumn',array('Style' => 'title','Colspan' => 2),$this->lng->txt('details'));
00640 $writer->xmlEndTag('InfoRow');
00641
00642
00643 $writer->xmlStartTag('InfoRow');
00644 $writer->xmlElement('InfoColumn',array('Style' => 'option'),$this->lng->txt('title'));
00645 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),$this->getTitle());
00646 $writer->xmlEndTag('InfoRow');
00647
00648
00649 if(strlen($desc = $this->getDescription()))
00650 {
00651 $writer->xmlStartTag('InfoRow');
00652 $writer->xmlElement('InfoColumn',array('Style' => 'option'),$this->lng->txt('description'));
00653 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),$this->getDescription());
00654 $writer->xmlEndTag('InfoRow');
00655 }
00656
00657
00658 $writer->xmlStartTag('InfoRow');
00659 $writer->xmlElement('InfoColumn',array('Style' => 'option'),$this->lng->txt('trac_mode'));
00660 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),ilLPObjSettings::_mode2Text($this->getMode()));
00661 $writer->xmlEndTag('InfoRow');
00662
00663
00664 if($this->getMode() == LP_MODE_VISITS)
00665 {
00666 $writer->xmlStartTag('InfoRow');
00667 $writer->xmlElement('InfoColumn',array('Style' => 'option'),$this->lng->txt('trac_required_visits'));
00668 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),$this->status_info['visits']);
00669 $writer->xmlEndTag('InfoRow');
00670 }
00671
00672
00673 if($this->getTypicalLearningTime())
00674 {
00675 $writer->xmlStartTag('InfoRow');
00676 $writer->xmlElement('InfoColumn',array('Style' => 'option'),$this->lng->txt('meta_typical_learning_time'));
00677 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),
00678 ilFormat::_secondsToString($this->getTypicalLearningTime()));
00679 $writer->xmlEndTag('InfoRow');
00680 }
00681
00682 if($a_enable_progress)
00683 {
00684 $writer->xmlStartTag('InfoRow');
00685 $writer->xmlElement('InfoColumn',array('Style' => 'title','Colspan' => 2),$this->lng->txt('trac_learning_progress'));
00686 $writer->xmlEndTag('InfoRow');
00687
00688 switch($this->getType())
00689 {
00690 case 'lm':
00691 case 'htlm':
00692 include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
00693 $progress = ilLearningProgress::_getProgress($this->getCurrentUser(),$this->getId());
00694
00695 $writer->xmlStartTag('InfoRow');
00696 $writer->xmlElement('InfoColumn',array('Style' => 'option'),$this->lng->txt('last_access'));
00697 if($progress['access_time'])
00698 {
00699 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),
00700 ilFormat::formatUnixTime($progress['access_time'],true));
00701 }
00702 else
00703 {
00704 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),
00705 $this->lng->txt('trac_not_accessed'));
00706 }
00707 $writer->xmlEndTag('InfoRow');
00708
00709 $writer->xmlStartTag('InfoRow');
00710 $writer->xmlElement('InfoColumn',array('Style' => 'option'),$this->lng->txt('trac_visits'));
00711 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),$progress['visits']);
00712 $writer->xmlEndTag('InfoRow');
00713 break;
00714 }
00715 $writer->xmlStartTag('InfoRow');
00716 $writer->xmlElement('InfoColumn',array('Style' => 'option'),$this->lng->txt('trac_status'));
00717 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),$this->lng->txt($this->getUserStatus()));
00718 $writer->xmlEndTag('InfoRow');
00719
00720
00721 if($this->user_status_info)
00722 {
00723 $writer->xmlStartTag('InfoRow');
00724 $writer->xmlElement('InfoColumn',array('Style' => 'option'),$this->user_status_info[0]);
00725 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),$this->user_status_info[1]);
00726 $writer->xmlEndTag('InfoRow');
00727 }
00728
00729 if($this->getMark())
00730 {
00731 $writer->xmlStartTag('InfoRow');
00732 $writer->xmlElement('InfoColumn',array('Style' => 'option'),$this->lng->txt('trac_mark'));
00733 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),$this->getMark());
00734 $writer->xmlEndTag('InfoRow');
00735 }
00736
00737
00738 if($this->getComment())
00739 {
00740 $writer->xmlStartTag('InfoRow');
00741 $writer->xmlElement('InfoColumn',array('Style' => 'option'),$this->lng->txt('trac_comment'));
00742 $writer->xmlElement('InfoColumn',array('Style' => 'option_value'),$this->getComment());
00743 $writer->xmlEndTag('InfoRow');
00744 }
00745
00746 }
00747 $writer->xmlEndTag('InfoBody');
00748 $writer->xmlEndTag('Info');
00749
00750 }
00751
00752 function __readEditingTime()
00753 {
00754 if(!$this->enabled('timings'))
00755 {
00756 return false;
00757 }
00758 if($this->timings['item']['changeable'] and $this->timings['user'][$this->getCurrentUser()]['end'])
00759 {
00760 $end = $this->timings['user'][$this->getCurrentUser()]['end'];
00761 }
00762 else
00763 {
00764 $end = $this->timings['item']['suggestion_end'];
00765 }
00766 $this->editing_time = $end;
00767 }
00768
00769
00770
00771 function __getPercent($max,$reached)
00772 {
00773 if(!$max)
00774 {
00775 return "0%";
00776 }
00777
00778 return sprintf("%.2f%%",$reached / $max * 100);
00779 }
00780
00781 }
00782 ?>