• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/InfoScreen/classes/class.ilInfoScreenGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2005 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00037 class ilInfoScreenGUI
00038 {
00039         var $ilias;
00040         var $lng;
00041         var $ctrl;
00042         var $gui_object;
00043         var $top_buttons = array();
00044         var $top_formbuttons = array();
00045         var $hiddenelements = array();
00049         var $form_action;
00050 
00057         function ilInfoScreenGUI($a_gui_object)
00058         {
00059                 global $ilias, $ilCtrl, $lng,$ilTabs;
00060 
00061                 $this->ilias =& $ilias;
00062                 $this->ctrl =& $ilCtrl;
00063                 $this->lng =& $lng;
00064                 $this->tabs_gui =& $ilTabs;
00065                 $this->gui_object =& $a_gui_object;
00066                 $this->sec_nr = 0;
00067                 $this->private_notes_enabled = false;
00068                 $this->news_enabled = false;
00069                 $this->feedback_enabled = false;
00070                 $this->learning_progress_enabled = false;
00071                 $this->form_action = "";
00072                 $this->top_formbuttons = array();
00073                 $this->hiddenelements = array();
00074         }
00075 
00079         function &executeCommand()
00080         {
00081                 global $rbacsystem;
00082                 global $tpl;
00083                 global $lng, $ilAccess;
00084 
00085                 // load additional language modules
00086                 $lng->loadLanguageModule("barometer");
00087 
00088                 $next_class = $this->ctrl->getNextClass($this);
00089 
00090                 $cmd = $this->ctrl->getCmd("showSummary");
00091                 $this->ctrl->setReturn($this, "showSummary");
00092                 
00093                 $this->setTabs();
00094 
00095                 switch($next_class)
00096                 {
00097                         case "ilnotegui":
00098                                 $this->showSummary();   // forwards command
00099                                 break;
00100 
00101                         case "ilfeedbackgui":
00102                                 include_once("Services/Feedback/classes/class.ilFeedbackGUI.php");
00103                                 $fb_gui = new ilFeedbackGUI();
00104                                 $this->ctrl->setParameterByClass("ilFeedbackGUI","obj_id",$this->gui_object->object->getId());
00105                                 $this->ctrl->setParameterByClass("ilFeedbackGUI","ref_id",$_GET['ref_id']);
00106                                 $html = $this->ctrl->forwardCommand($fb_gui);
00107                                 $tpl->setContent($html);
00108                                 break;
00109 
00110                         case "ilcolumngui":
00111                                 $this->showSummary();
00112                                 break;
00113 
00114                         default:
00115                                 return $this->$cmd();
00116                                 break;
00117                 }
00118                 return true;
00119         }
00120 
00124         function enablePrivateNotes($a_enable = true)
00125         {
00126                 $this->private_notes_enabled = $a_enable;
00127         }
00128 
00132         function enableLearningProgress($a_enable = true)
00133         {
00134                 $this->learning_progress_enabled = $a_enable;
00135         }
00136 
00137 
00141         function enableFeedback($a_enable = true)
00142         {
00143                 $this->feedback_enabled = $a_enable;
00144         }
00145 
00149         function enableNews($a_enable = true)
00150         {
00151                 $this->news_enabled = $a_enable;
00152         }
00153 
00157         function enableNewsEditing($a_enable = true)
00158         {
00159                 $this->news_editing = $a_enable;
00160         }
00161 
00169         function setBlockProperty($a_block_type, $a_property, $a_value)
00170         {
00171                 $this->block_property[$a_block_type][$a_property] = $a_value;
00172         }
00173         
00174         function getAllBlockProperties()
00175         {
00176                 return $this->block_property;
00177         }
00178 
00182         function addSection($a_title)
00183         {
00184                 $this->sec_nr++;
00185                 $this->section[$this->sec_nr]["title"] = $a_title;
00186         }
00187 
00191         function setFormAction($a_form_action)
00192         {
00193                 $this->form_action = $a_form_action;
00194         }
00195 
00199         function removeFormAction()
00200         {
00201                 $this->form_action = "";
00202         }
00203 
00211         function addProperty($a_name, $a_value, $a_link = "")
00212         {
00213                 $this->section[$this->sec_nr]["properties"][] =
00214                         array("name" => $a_name, "value" => $a_value,
00215                                 "link" => $a_link);
00216         }
00217 
00221         function addPropertyCheckbox($a_name, $a_checkbox_name, $a_checkbox_value, $a_checkbox_label = "", $a_checkbox_checked = false)
00222         {
00223                 $checkbox = "<input type=\"checkbox\" name=\"$a_checkbox_name\" value=\"$a_checkbox_value\" id=\"$a_checkbox_name$a_checkbox_value\"";
00224                 if ($a_checkbox_checked)
00225                 {
00226                         $checkbox .= " checked=\"checked\"";
00227                 }
00228                 $checkbox .= " />";
00229                 if (strlen($a_checkbox_label))
00230                 {
00231                         $checkbox .= "&nbsp;<label for=\"$a_checkbox_name$a_checkbox_value\">$a_checkbox_label</label>";
00232                 }
00233                 $this->section[$this->sec_nr]["properties"][] =
00234                         array("name" => $a_name, "value" => $checkbox);
00235         }
00236 
00240         function addPropertyTextinput($a_name, $a_input_name, $a_input_value = "", $a_input_size = "", $direct_button_command = "", $direct_button_label = "")
00241         {
00242                 $input = "<input type=\"text\" name=\"$a_input_name\" id=\"$a_input_name\"";
00243                 if (strlen($a_input_value))
00244                 {
00245                         $input .= " value=\"" . ilUtil::prepareFormOutput($a_input_value) . "\"";
00246                 }
00247                 if (strlen($a_input_size))
00248                 {
00249                         $input .= " size=\"" . $a_input_size . "\"";
00250                 }
00251                 $input .= " />";
00252                 if (strlen($direct_button_command) && strlen($direct_button_label))
00253                 {
00254                         $input .= " <input type=\"submit\" class=\"submit\" name=\"cmd[$direct_button_command]\" value=\"$direct_button_label\" />";
00255                 }
00256                 $this->section[$this->sec_nr]["properties"][] =
00257                         array("name" => "<label for=\"$a_input_name\">$a_name</label>", "value" => $input);
00258         }
00259 
00263         function addButton($a_title, $a_link, $a_frame = "", $a_position = "top")
00264         {
00265                 if ($a_position == "top")
00266                 {
00267                         $this->top_buttons[] =
00268                                 array("title" => $a_title,"link" => $a_link,"target" => $a_frame);
00269                 }
00270         }
00271 
00276         function addFormButton($a_command, $a_title, $a_position = "top")
00277         {
00278                 if ($a_position == "top")
00279                 {
00280                         array_push($this->top_formbuttons,
00281                                 array("command" => $a_command, "title" => $a_title)
00282                         );
00283                 }
00284         }
00285 
00286         function addHiddenElement($a_name, $a_value)
00287         {
00288                 array_push($this->hiddenelements, array("name" => $a_name, "value" => $a_value));
00289         }
00290 
00294         function addMetaDataSections($a_rep_obj_id,$a_obj_id, $a_type)
00295         {
00296                 global $lng;
00297 
00298                 $lng->loadLanguageModule("meta");
00299 
00300                 include_once("./Services/MetaData/classes/class.ilMD.php");
00301                 $md = new ilMD($a_rep_obj_id,$a_obj_id, $a_type);
00302 
00303                 if ($md_gen = $md->getGeneral())
00304                 {
00305                         // get first descrption
00306                         foreach($md_gen->getDescriptionIds() as $id)
00307                         {
00308                                 $md_des = $md_gen->getDescription($id);
00309                                 $description = $md_des->getDescription();
00310                                 break;
00311                         }
00312 
00313                         // get language(s)
00314                         $langs = array();
00315                         foreach($ids = $md_gen->getLanguageIds() as $id)
00316                         {
00317                                 $md_lan = $md_gen->getLanguage($id);
00318                                 if ($md_lan->getLanguageCode() != "")
00319                                 {
00320                                         $langs[] = $lng->txt("meta_l_".$md_lan->getLanguageCode());
00321                                 }
00322                         }
00323                         $langs = implode($langs, ", ");
00324 
00325                         // keywords
00326                         $keywords = array();
00327                         foreach($ids = $md_gen->getKeywordIds() as $id)
00328                         {
00329                                 $md_key = $md_gen->getKeyword($id);
00330                                 $keywords[] = $md_key->getKeyword();
00331                         }
00332                         $keywords = implode($keywords, ", ");
00333                 }
00334 
00335                 // authors
00336                 if(is_object($lifecycle = $md->getLifecycle()))
00337                 {
00338                         $sep = $author = "";
00339                         foreach(($ids = $lifecycle->getContributeIds()) as $con_id)
00340                         {
00341                                 $md_con = $lifecycle->getContribute($con_id);
00342                                 if ($md_con->getRole() == "Author")
00343                                 {
00344                                         foreach($ent_ids = $md_con->getEntityIds() as $ent_id)
00345                                         {
00346                                                 $md_ent = $md_con->getEntity($ent_id);
00347                                                 $author = $author.$sep.$md_ent->getEntity();
00348                                                 $sep = ", ";
00349                                         }
00350                                 }
00351                         }
00352                 }
00353 
00354                 // copyright
00355                 $copyright = "";
00356                 if(is_object($rights = $md->getRights()))
00357                 {
00358                         include_once('Services/MetaData/classes/class.ilMDUtils.php');
00359                         $copyright = ilMDUtils::_parseCopyright($rights->getDescription());
00360                 }
00361 
00362                 // learning time
00363                 #if(is_object($educational = $md->getEducational()))
00364                 #{
00365                 #       $learning_time = $educational->getTypicalLearningTime();
00366                 #}
00367                 $learning_time = "";
00368                 if(is_object($educational = $md->getEducational()))
00369                 {
00370                         if($seconds = $educational->getTypicalLearningTimeSeconds())
00371                         {
00372                                 $learning_time = ilFormat::_secondsToString($seconds);
00373                         }
00374                 }
00375 
00376 
00377                 // output
00378 
00379                 // description
00380                 if ($description != "")
00381                 {
00382                         $this->addSection($lng->txt("description"));
00383                         $this->addProperty("",  nl2br($description));
00384                 }
00385 
00386                 // general section
00387                 $this->addSection($lng->txt("meta_general"));
00388                 if ($langs != "")       // language
00389                 {
00390                         $this->addProperty($lng->txt("language"),
00391                                 $langs);
00392                 }
00393                 if ($keywords != "")    // keywords
00394                 {
00395                         $this->addProperty($lng->txt("keywords"),
00396                                 $keywords);
00397                 }
00398                 if ($author != "")              // author
00399                 {
00400                         $this->addProperty($lng->txt("author"),
00401                                 $author);
00402                 }
00403                 if ($copyright != "")           // copyright
00404                 {
00405                         $this->addProperty($lng->txt("meta_copyright"),
00406                                 $copyright);
00407                 }
00408                 if ($learning_time != "")               // typical learning time
00409                 {
00410                         $this->addProperty($lng->txt("meta_typical_learning_time"),
00411                                 $learning_time);
00412                 }
00413         }
00414 
00418         function showSummary()
00419         {
00420                 global $tpl, $ilAccess;
00421 
00422                 $tpl->setContent($this->getCenterColumnHTML());
00423                 $tpl->setRightContent($this->getRightColumnHTML());
00424         }
00425 
00426 
00430         function getCenterColumnHTML()
00431         {
00432                 global $ilCtrl;
00433                 
00434                 include_once("Services/Block/classes/class.ilColumnGUI.php");
00435                 $column_gui = new ilColumnGUI("info", IL_COL_CENTER);
00436                 $this->setColumnSettings($column_gui);
00437 
00438                 if (!$ilCtrl->isAsynch())
00439                 {
00440                         if ($column_gui->getScreenMode() != IL_SCREEN_SIDE)
00441                         {
00442                                 // right column wants center
00443                                 if ($column_gui->getCmdSide() == IL_COL_RIGHT)
00444                                 {
00445                                         $column_gui = new ilColumnGUI("info", IL_COL_RIGHT);
00446                                         $this->setColumnSettings($column_gui);
00447                                         $html = $ilCtrl->forwardCommand($column_gui);
00448                                 }
00449                                 // left column wants center
00450                                 if ($column_gui->getCmdSide() == IL_COL_LEFT)
00451                                 {
00452                                         $column_gui = new ilColumnGUI("info", IL_COL_LEFT);
00453                                         $this->setColumnSettings($column_gui);
00454                                         $html = $ilCtrl->forwardCommand($column_gui);
00455                                 }
00456                         }
00457                         else
00458                         {
00459                                 $html = $this->getHTML();
00460                         }
00461                 }
00462                 
00463                 return $html;
00464         }
00465 
00469         function getRightColumnHTML()
00470         {
00471                 global $ilUser, $lng, $ilCtrl;
00472                 
00473                 include_once("Services/Block/classes/class.ilColumnGUI.php");
00474                 $column_gui = new ilColumnGUI("info", IL_COL_RIGHT);
00475                 $this->setColumnSettings($column_gui);
00476 
00477                 if ($ilCtrl->getNextClass() == "ilcolumngui" &&
00478                         $column_gui->getCmdSide() == IL_COL_RIGHT &&
00479                         $column_gui->getScreenMode() == IL_SCREEN_SIDE)
00480                 {
00481                         $html = $ilCtrl->forwardCommand($column_gui);
00482                 }
00483                 else
00484                 {
00485                         if (!$ilCtrl->isAsynch())
00486                         {
00487                                 if ($this->news_enabled)
00488                                 {
00489                                         $html = $ilCtrl->getHTML($column_gui);
00490                                 }
00491                         }
00492                 }
00493 
00494                 return $html;
00495         }
00496 
00500         function setColumnSettings($column_gui)
00501         {
00502                 global $lng, $ilAccess;
00503 
00504                 $column_gui->setEnableEdit($this->news_editing);
00505                 $column_gui->setRepositoryMode(true);
00506                 $column_gui->setAllBlockProperties($this->getAllBlockProperties());
00507         }
00508 
00512         function getHTML()
00513         {
00514                 global $lng, $ilSetting, $tree, $ilAccess;
00515                 
00516                 $tpl = new ilTemplate("tpl.infoscreen.html" ,true, true);
00517 
00518                 // add top buttons
00519                 if (count($this->top_buttons) > 0)
00520                 {
00521                         $tpl->addBlockfile("TOP_BUTTONS", "top_buttons", "tpl.buttons.html");
00522 
00523                         foreach($this->top_buttons as $button)
00524                         {
00525                                 // view button
00526                                 $tpl->setCurrentBlock("btn_cell");
00527                                 $tpl->setVariable("BTN_LINK", $button["link"]);
00528                                 $tpl->setVariable("BTN_TARGET", $button["target"]);
00529                                 $tpl->setVariable("BTN_TXT", $button["title"]);
00530                                 $tpl->parseCurrentBlock();
00531                         }
00532                 }
00533 
00534                 // add top formbuttons
00535                 if ((count($this->top_formbuttons) > 0) && (strlen($this->form_action) > 0))
00536                 {
00537                         $tpl->addBlockfile("TOP_FORMBUTTONS", "top_submitbuttons", "tpl.submitbuttons.html");
00538 
00539                         foreach($this->top_formbuttons as $button)
00540                         {
00541                                 // view button
00542                                 $tpl->setCurrentBlock("btn_submit_cell");
00543                                 $tpl->setVariable("BTN_COMMAND", $button["command"]);
00544                                 $tpl->setVariable("BTN_NAME", $button["title"]);
00545                                 $tpl->parseCurrentBlock();
00546                         }
00547                 }
00548 
00549                 // add form action
00550                 if (strlen($this->form_action) > 0)
00551                 {
00552                         $tpl->setCurrentBlock("formtop");
00553                         $tpl->setVariable("FORMACTION", $this->form_action);
00554                         $tpl->parseCurrentBlock();
00555                         $tpl->touchBlock("formbottom");
00556                 }
00557 
00558                 if (count($this->hiddenelements))
00559                 {
00560                         foreach ($this->hiddenelements as $hidden)
00561                         {
00562                                 $tpl->setCurrentBlock("hidden_element");
00563                                 $tpl->setVariable("HIDDEN_NAME", $hidden["name"]);
00564                                 $tpl->setVariable("HIDDEN_VALUE", $hidden["value"]);
00565                                 $tpl->parseCurrentBlock();
00566                         }
00567                 }
00568 
00569                 for($i = 1; $i <= $this->sec_nr; $i++)
00570                 {
00571                         if (is_array($this->section[$i]["properties"]))
00572                         {
00573                                 // section header
00574                                 $tpl->setCurrentBlock("header_row");
00575                                 $tpl->setVariable("TXT_SECTION",
00576                                         $this->section[$i]["title"]);
00577                                 $tpl->parseCurrentBlock();
00578                                 $tpl->touchBlock("row");
00579 
00580                                 // section properties
00581                                 foreach($this->section[$i]["properties"] as $property)
00582                                 {
00583                                         if ($property["name"] != "")
00584                                         {
00585                                                 if ($property["link"] == "")
00586                                                 {
00587                                                         $tpl->setCurrentBlock("pv");
00588                                                         $tpl->setVariable("TXT_PROPERTY_VALUE", $property["value"]);
00589                                                         $tpl->parseCurrentBlock();
00590                                                 }
00591                                                 else
00592                                                 {
00593                                                         $tpl->setCurrentBlock("lpv");
00594                                                         $tpl->setVariable("TXT_PROPERTY_LVALUE", $property["value"]);
00595                                                         $tpl->setVariable("LINK_PROPERTY_VALUE", $property["link"]);
00596                                                         $tpl->parseCurrentBlock();
00597                                                 }
00598                                                 $tpl->setCurrentBlock("property_row");
00599                                                 $tpl->setVariable("TXT_PROPERTY", $property["name"]);
00600                                                 $tpl->parseCurrentBlock();
00601                                                 $tpl->touchBlock("row");
00602                                         }
00603                                         else
00604                                         {
00605                                                 $tpl->setCurrentBlock("property_full_row");
00606                                                 $tpl->setVariable("TXT_PROPERTY_FULL_VALUE", $property["value"]);
00607                                                 $tpl->parseCurrentBlock();
00608                                                 $tpl->touchBlock("row");
00609                                         }
00610                                 }
00611                         }
00612                 }
00613 
00614                 // additional information
00615                 if (is_object($this->gui_object->object))
00616                 {
00617                         // section header
00618                         $tpl->setCurrentBlock("header_row");
00619                         $tpl->setVariable("TXT_SECTION",
00620                                 $this->lng->txt("additional_info"));
00621                         $tpl->parseCurrentBlock();
00622                         $tpl->touchBlock("row");
00623                         
00624                         // permanent link
00625                         $type = $this->gui_object->object->getType();
00626                         $ref_id = $this->gui_object->object->getRefId();
00627                         
00628                         include_once('classes/class.ilLink.php');
00629                         $href = ilLink::_getStaticLink($ref_id,$type,true);
00630                                 
00631                         // delicous link
00632                         $d_set = new ilSetting("delicious");
00633                         if ($d_set->get("add_info_links") == "1")
00634                         {
00635                                 $lng->loadLanguageModule("delic");
00636                                 $del_link = '<br/><a class="small" href="http://del.icio.us/post?desc=nn&url='.
00637                                         urlencode($href).'"><img border="0" src="'.ilUtil::getImagePath("icon_delicious_s.gif").
00638                                         '" /> '.$lng->txt("delic_add_to_delicious").
00639                                         '</a>';
00640                         }
00641                                 
00642                         $tpl->setCurrentBlock("property_row");
00643                         $tpl->setVariable("TXT_PROPERTY", $this->lng->txt("perma_link"));
00644                         $tpl->setVariable("TXT_PROPERTY_VALUE",
00645                                 '<a class="small" href="'.$href.'" target="_top">'.$href.'</a>'.$del_link);
00646                         $tpl->parseCurrentBlock();
00647                         $tpl->touchBlock("row");
00648                         
00649                         // links to resource
00650                         if ($ilAccess->checkAccess("write", "", $ref_id) ||
00651                                 $ilAccess->checkAccess("edit_permissions", "", $ref_id))
00652                         {
00653                                 $obj_id = $this->gui_object->object->getId();
00654                                 $rs = ilObject::_getAllReferences($obj_id);
00655                                 $refs = array();
00656                                 foreach($rs as $r)
00657                                 {
00658                                         if ($tree->isInTree($r))
00659                                         {
00660                                                 $refs[] = $r;
00661                                         }
00662                                 }
00663                                 if (count($refs) > 1)
00664                                 {
00665                                         $links = $sep = "";
00666                                         foreach($refs as $r)
00667                                         {
00668                                                 $cont_loc = new ilLocatorGUI();
00669                                                 $cont_loc->addContextItems($r, true);
00670                                                 $links.= $sep.$cont_loc->getHTML();
00671                                                 $sep = "<br />";
00672                                         }
00673                                         
00674                                         $tpl->setCurrentBlock("property_row");
00675                                         $tpl->setVariable("TXT_PROPERTY", $this->lng->txt("res_links"));
00676                                         $tpl->setVariable("TXT_PROPERTY_VALUE",
00677                                                 '<div class="small">'.$links.'</div>');
00678                                         $tpl->parseCurrentBlock();
00679                                         $tpl->touchBlock("row");
00680                                 }
00681                         }
00682                 }
00683 
00684                 // learning progress
00685                 if($this->learning_progress_enabled and $html = $this->showLearningProgress())
00686                 {
00687                         $tpl->setCurrentBlock("learning_progress");
00688                         $tpl->setVariable("LP_TABLE",$html);
00689                         $tpl->parseCurrentBlock();
00690                 }
00691 
00692 
00693                 // notes section
00694                 if ($this->private_notes_enabled && !$ilSetting->get('disable_notes'))
00695                 {
00696                         $html = $this->showNotesSection();
00697                         $tpl->setCurrentBlock("notes");
00698                         $tpl->setVariable("NOTES", $html);
00699                         $tpl->parseCurrentBlock();
00700                 }
00701 
00702                 return $tpl->get();
00703         }
00704 
00705         function showLearningProgress()
00706         {
00707                 global $ilUser,$rbacsystem;
00708 
00709                 if(!$rbacsystem->checkAccess('read',$this->gui_object->object->getRefId()))
00710                 {
00711                         return false;
00712                 }
00713                 if($ilUser->getId() == ANONYMOUS_USER_ID)
00714                 {
00715                         return false;
00716                 }
00717 
00718                 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
00719                 if (!ilObjUserTracking::_enabledLearningProgress() and $ilUser->getId() != ANONYMOUS_USER_ID)
00720                 {
00721                         return false;
00722                 }
00723 
00724                 include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
00725                 include_once 'Services/Tracking/classes/class.ilLPMarks.php';
00726 
00727                 if(ilLPObjSettings::_lookupMode($this->gui_object->object->getId()) != LP_MODE_MANUAL)
00728                 {
00729                         return false;
00730                 }
00731 
00732                 $this->lng->loadLanguageModule('trac');
00733                 $tpl = new ilTemplate("tpl.lp_edit_manual.html",true,true,'Services/Tracking');
00734 
00735                 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00736                 $tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_trac.gif'));
00737                 $tpl->setVariable("ALT_IMG",$this->lng->txt('learning_progress'));
00738                 $tpl->setVariable("TXT_EDIT_PROGRESS",$this->lng->txt('trac_edit_progress'));
00739 
00740                 $tpl->setVariable("TXT_STATUS",$this->lng->txt('trac_status'));
00741 
00742 
00743                 $tpl->setVariable("CHECK_EDITED",ilUtil::formSelect((int) ilLPMarks::_hasCompleted($ilUser->getId(),
00744                                                                                                                                                                                    $this->gui_object->object->getId()),
00745                                                                                                                         'lp_edit',
00746                                                                                                                         array(0 => $this->lng->txt('trac_not_completed'),
00747                                                                                                                                   1 => $this->lng->txt('trac_completed')),
00748                                                                                                                         false,
00749                                                                                                                         true));
00750 
00751 
00752                 $tpl->setVariable("INFO_EDITED",$this->lng->txt('trac_info_edited'));
00753 
00754                 // More infos for lm's
00755                 if($this->gui_object->object->getType() == 'lm' ||
00756                    $this->gui_object->object->getType() == 'htlm')
00757                 {
00758                         $tpl->setCurrentBlock("lm_infos");
00759                         $tpl->setVariable("TXT_LAST_ACCESS",$this->lng->txt('trac_last_access'));
00760 
00761                         include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
00762                         $progress = ilLearningProgress::_getProgress($ilUser->getId(),$this->gui_object->object->getId());
00763                         if($progress['access_time'])
00764                         {
00765                                 $tpl->setVariable("LAST_ACCESS",date('Y-m-d H:i:s',$progress['access_time']));
00766                         }
00767                         else
00768                         {
00769                                 $tpl->setVariable("LAST_ACCESS",$this->lng->txt('trac_not_accessed'));
00770                         }
00771 
00772                         $tpl->setVariable("TXT_VISITS",$this->lng->txt('trac_visits'));
00773                         $tpl->setVariable("VISITS",(int) $progress['visits']);
00774 
00775                         if($this->gui_object->object->getType() == 'lm')
00776                         {
00777                                 $tpl->setVariable("TXT_DURATION",$this->lng->txt('trac_spent_time'));
00778                                 $tpl->setVariable("DURATION",ilFormat::_secondsToString($progress['spent_time']));
00779                         }
00780 
00781                         $tpl->parseCurrentBlock();
00782                 }
00783                 $tpl->setVariable("TXT_SAVE",$this->lng->txt('save'));
00784 
00785                 return $tpl->get();
00786         }
00787 
00788         function saveProgress()
00789         {
00790                 global $ilUser;
00791 
00792                 include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
00793                 include_once 'Services/Tracking/classes/class.ilLPMarks.php';
00794 
00795                 $lp_marks = new ilLPMarks($this->gui_object->object->getId(),$ilUser->getId());
00796                 $lp_marks->setCompleted((bool) $_POST['lp_edit']);
00797                 $lp_marks->update();
00798 
00799                 $this->lng->loadLanguageModule('trac');
00800                 ilUtil::sendInfo($this->lng->txt('trac_updated_status'));
00801 
00802                 $this->showSummary();
00803         }
00804 
00805 
00809         function showNotesSection()
00810         {
00811                 $next_class = $this->ctrl->getNextClass($this);
00812                 include_once("Services/Notes/classes/class.ilNoteGUI.php");
00813                 $notes_gui = new ilNoteGUI($this->gui_object->object->getId(), 0,
00814                         $this->gui_object->object->getType());
00815 
00816                 $notes_gui->enablePrivateNotes();
00817                 //$notes_gui->enablePublicNotes();
00818 
00819                 if ($next_class == "ilnotegui")
00820                 {
00821                         $html = $this->ctrl->forwardCommand($notes_gui);
00822                 }
00823                 else
00824                 {
00825                         $html = $notes_gui->getNotesHTML();
00826                 }
00827 
00828                 return $html;
00829         }
00830 
00838         public function showLDAPRoleGroupMappingInfo($a_section = '')
00839         {
00840                 if(strlen($a_section))
00841                 {
00842                         $this->addSection($a_section);
00843                 }
00844                 include_once('Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
00845                 $ldap_mapping = ilLDAPRoleGroupMapping::_getInstance();
00846                 if($infos = $ldap_mapping->getInfoStrings($this->gui_object->object->getId()))
00847                 {
00848                         $info_combined = '<div style="color:green;">';
00849                         $counter = 0;
00850                         foreach($infos as $info_string)
00851                         {
00852                                 if($counter++)
00853                                 {
00854                                         $info_combined .= '<br />';
00855                                 }
00856                                 $info_combined .= $info_string; 
00857                         }
00858                         $info_combined .= '</div>';
00859                         $this->addProperty($this->lng->txt('applications'),$info_combined);
00860                 }
00861                 return true;
00862         }
00863 
00864         function setTabs()
00865         {
00866                 global $tpl;
00867 
00868                 $this->getTabs($this->tabs_gui);
00869         }
00870 
00874         function getTabs(&$tabs_gui)
00875         {
00876                 global $rbacsystem,$ilUser,$ilAccess;
00877 
00878                 $next_class = $this->ctrl->getNextClass($this);
00879                 $force_active = ($next_class == "ilnotegui")
00880                         ? true
00881                         : false;
00882 
00883                 $tabs_gui->addSubTabTarget('summary',
00884                          $this->ctrl->getLinkTarget($this, "showSummary"),
00885                          array("showSummary", ""),
00886                          get_class($this), "", $force_active);
00887 
00888                 if ($this->feedback_enabled)
00889                 {
00890                         $show_feedback_tab=false;
00891                         if($ilAccess->checkAccess('write','edit',$_GET['ref_id']))
00892                         {
00893                                 $show_feedback_tab=true;
00894                         }
00895                         else
00896                         {
00897                                 // this should work with feedback class available
00898                                 // maybe a line... "@ ilCtrl_Calls ilFeedbackGUI:"
00899                                 // in the header of feedbackgui is necessary
00900                                 include_once('Services/Feedback/classes/class.ilFeedback.php');
00901                                 $feedback = new ilFeedback();
00902                                 $feedback->setRefId($_GET['ref_id']);
00903                                 $barometers = $feedback->getAllBarometer(0);
00904                                 if(count($barometers))
00905                                 {
00906                                         foreach ($barometers as $barometer)
00907                                         {
00908                                                 if($barometer->canVote($ilUser->getId(),$barometer->getId())==1)
00909                                                 {
00910                                                         $show_feedback_tab=true;
00911                                                         break;
00912                                                 }
00913                                         }
00914                                 }
00915                         }
00916                         if ($show_feedback_tab)
00917                         {
00918                                 $tabs_gui->addSubTabTarget("feedback",
00919                                         $this->ctrl->getLinkTargetByClass("ilfeedbackgui", "fbList"),
00920                                         "", "ilfeedbackgui");
00921                         }
00922 
00923                         /*
00924                         $tabs_gui->addSubTabTarget("feedb_feedback_settings",
00925                                 $this->ctrl->getLinkTargetByClass("ilfeedbackgui", "fbList"),
00926                                 "", "ilfeedbackgui");*/
00927                 }
00928         }
00929 
00930 }
00931 
00932 ?>

Generated on Fri Dec 13 2013 17:56:57 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1