Class ilInfoScreenGUI. More...
Public Member Functions | |
ilInfoScreenGUI ($a_gui_object) | |
Constructor. | |
& | executeCommand () |
execute command | |
enablePrivateNotes ($a_enable=true) | |
enable notes | |
enableLearningProgress ($a_enable=true) | |
enable learning progress | |
enableFeedback ($a_enable=true) | |
enable feedback | |
addSection ($a_title) | |
add a new section | |
setFormAction ($a_form_action) | |
set a form action | |
removeFormAction () | |
remove form action | |
addProperty ($a_name, $a_value, $a_link="") | |
add a property to current section | |
addPropertyCheckbox ($a_name, $a_checkbox_name, $a_checkbox_value, $a_checkbox_label="", $a_checkbox_checked=false) | |
add a property to current section | |
addPropertyTextinput ($a_name, $a_input_name, $a_input_value="", $a_input_size="", $direct_button_command="", $direct_button_label="") | |
add a property to current section | |
addButton ($a_title, $a_link, $a_frame="", $a_position="top") | |
add a property to current section | |
addFormButton ($a_command, $a_title, $a_position="top") | |
add a form button to the info screen the form buttons are only valid if a form action is set | |
addHiddenElement ($a_name, $a_value) | |
addMetaDataSections ($a_rep_obj_id, $a_obj_id, $a_type) | |
add standard meta data sections | |
showSummary () | |
show summary page | |
getHTML () | |
get html | |
showLearningProgress () | |
saveProgress () | |
showNotesSection () | |
show notes section | |
setTabs () | |
getTabs (&$tabs_gui) | |
get tabs | |
Data Fields | |
$ilias | |
$lng | |
$ctrl | |
$gui_object | |
$top_buttons = array() | |
$top_formbuttons = array() | |
$hiddenelements = array() | |
$form_action | |
a form action parameter. |
Class ilInfoScreenGUI.
ilInfoScreenGUI: ilNoteGUI, ilFeedbackGUI
Definition at line 37 of file class.ilInfoScreenGUI.php.
ilInfoScreenGUI::addButton | ( | $ | a_title, | |
$ | a_link, | |||
$ | a_frame = "" , |
|||
$ | a_position = "top" | |||
) |
add a property to current section
Definition at line 224 of file class.ilInfoScreenGUI.php.
{ if ($a_position == "top") { $this->top_buttons[] = array("title" => $a_title,"link" => $a_link,"target" => $a_frame); } }
ilInfoScreenGUI::addFormButton | ( | $ | a_command, | |
$ | a_title, | |||
$ | a_position = "top" | |||
) |
add a form button to the info screen the form buttons are only valid if a form action is set
Definition at line 237 of file class.ilInfoScreenGUI.php.
{ if ($a_position == "top") { array_push($this->top_formbuttons, array("command" => $a_command, "title" => $a_title) ); } }
ilInfoScreenGUI::addHiddenElement | ( | $ | a_name, | |
$ | a_value | |||
) |
Definition at line 247 of file class.ilInfoScreenGUI.php.
{ array_push($this->hiddenelements, array("name" => $a_name, "value" => $a_value)); }
ilInfoScreenGUI::addMetaDataSections | ( | $ | a_rep_obj_id, | |
$ | a_obj_id, | |||
$ | a_type | |||
) |
add standard meta data sections
Definition at line 255 of file class.ilInfoScreenGUI.php.
References $author, $id, $keywords, $lng, ilFormat::_secondsToString(), addProperty(), and addSection().
{ global $lng; $lng->loadLanguageModule("meta"); include_once("./Services/MetaData/classes/class.ilMD.php"); $md = new ilMD($a_rep_obj_id,$a_obj_id, $a_type); if ($md_gen = $md->getGeneral()) { // get first descrption foreach($md_gen->getDescriptionIds() as $id) { $md_des = $md_gen->getDescription($id); $description = $md_des->getDescription(); break; } // get language(s) $langs = array(); foreach($ids = $md_gen->getLanguageIds() as $id) { $md_lan = $md_gen->getLanguage($id); if ($md_lan->getLanguageCode() != "") { $langs[] = $lng->txt("meta_l_".$md_lan->getLanguageCode()); } } $langs = implode($langs, ", "); // keywords $keywords = array(); foreach($ids = $md_gen->getKeywordIds() as $id) { $md_key = $md_gen->getKeyword($id); $keywords[] = $md_key->getKeyword(); } $keywords = implode($keywords, ", "); } // authors if(is_object($lifecycle = $md->getLifecycle())) { $sep = $author = ""; foreach(($ids = $lifecycle->getContributeIds()) as $con_id) { $md_con = $lifecycle->getContribute($con_id); if ($md_con->getRole() == "Author") { foreach($ent_ids = $md_con->getEntityIds() as $ent_id) { $md_ent = $md_con->getEntity($ent_id); $author = $author.$sep.$md_ent->getEntity(); $sep = ", "; } } } } // copyright $copyright = ""; if(is_object($rights = $md->getRights())) { $copyright = $rights->getDescription(); } // learning time #if(is_object($educational = $md->getEducational())) #{ # $learning_time = $educational->getTypicalLearningTime(); #} $learning_time = ""; if(is_object($educational = $md->getEducational())) { if($seconds = $educational->getTypicalLearningTimeSeconds()) { $learning_time = ilFormat::_secondsToString($seconds); } } // output // description if ($description != "") { $this->addSection($lng->txt("description")); $this->addProperty("", nl2br($description)); } // general section $this->addSection($lng->txt("meta_general")); if ($langs != "") // language { $this->addProperty($lng->txt("language"), $langs); } if ($keywords != "") // keywords { $this->addProperty($lng->txt("keywords"), $keywords); } if ($author != "") // author { $this->addProperty($lng->txt("author"), $author); } if ($copyright != "") // copyright { $this->addProperty($lng->txt("meta_copyright"), $copyright); } if ($learning_time != "") // typical learning time { $this->addProperty($lng->txt("meta_typical_learning_time"), $learning_time); } }
ilInfoScreenGUI::addProperty | ( | $ | a_name, | |
$ | a_value, | |||
$ | a_link = "" | |||
) |
add a property to current section
string | $a_name property name string | |
string | $a_value property value | |
string | $a_link link (will link the property value string) |
Definition at line 172 of file class.ilInfoScreenGUI.php.
Referenced by addMetaDataSections().
{ $this->section[$this->sec_nr]["properties"][] = array("name" => $a_name, "value" => $a_value, "link" => $a_link); }
ilInfoScreenGUI::addPropertyCheckbox | ( | $ | a_name, | |
$ | a_checkbox_name, | |||
$ | a_checkbox_value, | |||
$ | a_checkbox_label = "" , |
|||
$ | a_checkbox_checked = false | |||
) |
add a property to current section
Definition at line 182 of file class.ilInfoScreenGUI.php.
{ $checkbox = "<input type=\"checkbox\" name=\"$a_checkbox_name\" value=\"$a_checkbox_value\" id=\"$a_checkbox_name$a_checkbox_value\""; if ($a_checkbox_checked) { $checkbox .= " checked=\"checked\""; } $checkbox .= " />"; if (strlen($a_checkbox_label)) { $checkbox .= " <label for=\"$a_checkbox_name$a_checkbox_value\">$a_checkbox_label</label>"; } $this->section[$this->sec_nr]["properties"][] = array("name" => $a_name, "value" => $checkbox); }
ilInfoScreenGUI::addPropertyTextinput | ( | $ | a_name, | |
$ | a_input_name, | |||
$ | a_input_value = "" , |
|||
$ | a_input_size = "" , |
|||
$ | direct_button_command = "" , |
|||
$ | direct_button_label = "" | |||
) |
add a property to current section
Definition at line 201 of file class.ilInfoScreenGUI.php.
References ilUtil::prepareFormOutput().
{ $input = "<input type=\"text\" name=\"$a_input_name\" id=\"$a_input_name\""; if (strlen($a_input_value)) { $input .= " value=\"" . ilUtil::prepareFormOutput($a_input_value) . "\""; } if (strlen($a_input_size)) { $input .= " size=\"" . $a_input_size . "\""; } $input .= " />"; if (strlen($direct_button_command) && strlen($direct_button_label)) { $input .= " <input type=\"submit\" class=\"submit\" name=\"cmd[$direct_button_command]\" value=\"$direct_button_label\" />"; } $this->section[$this->sec_nr]["properties"][] = array("name" => "<label for=\"$a_input_name\">$a_name</label>", "value" => $input); }
ilInfoScreenGUI::addSection | ( | $ | a_title | ) |
add a new section
Definition at line 143 of file class.ilInfoScreenGUI.php.
Referenced by addMetaDataSections().
{
$this->sec_nr++;
$this->section[$this->sec_nr]["title"] = $a_title;
}
ilInfoScreenGUI::enableFeedback | ( | $ | a_enable = true |
) |
enable feedback
Definition at line 135 of file class.ilInfoScreenGUI.php.
{ $this->feedback_enabled = $a_enable; }
ilInfoScreenGUI::enableLearningProgress | ( | $ | a_enable = true |
) |
enable learning progress
Definition at line 126 of file class.ilInfoScreenGUI.php.
{ $this->learning_progress_enabled = $a_enable; }
ilInfoScreenGUI::enablePrivateNotes | ( | $ | a_enable = true |
) |
enable notes
Definition at line 118 of file class.ilInfoScreenGUI.php.
{ $this->private_notes_enabled = $a_enable; }
& ilInfoScreenGUI::executeCommand | ( | ) |
execute command
Definition at line 78 of file class.ilInfoScreenGUI.php.
References $_GET, $cmd, $lng, $rbacsystem, $tpl, setTabs(), and showSummary().
{ global $rbacsystem; global $tpl; global $lng; // load additional language modules $lng->loadLanguageModule("barometer"); $next_class = $this->ctrl->getNextClass($this); $cmd = $this->ctrl->getCmd("showSummary"); $this->setTabs(); switch($next_class) { case "ilnotegui": $this->showSummary(); // forwards command break; case "ilfeedbackgui": include_once("Services/Feedback/classes/class.ilFeedbackGUI.php"); $fb_gui = new ilFeedbackGUI(); $this->ctrl->setParameterByClass("ilFeedbackGUI","obj_id",$this->gui_object->object->getId()); $this->ctrl->setParameterByClass("ilFeedbackGUI","ref_id",$_GET['ref_id']); $html = $this->ctrl->forwardCommand($fb_gui); $tpl->setContent($html); break; default: return $this->$cmd(); break; } return true; }
ilInfoScreenGUI::getHTML | ( | ) |
get html
Definition at line 389 of file class.ilInfoScreenGUI.php.
References $ref_id, $tpl, $type, showLearningProgress(), and showNotesSection().
Referenced by showSummary().
{ $tpl = new ilTemplate("tpl.infoscreen.html" ,true, true); // add top buttons if (count($this->top_buttons) > 0) { $tpl->addBlockfile("TOP_BUTTONS", "top_buttons", "tpl.buttons.html"); foreach($this->top_buttons as $button) { // view button $tpl->setCurrentBlock("btn_cell"); $tpl->setVariable("BTN_LINK", $button["link"]); $tpl->setVariable("BTN_TARGET", $button["target"]); $tpl->setVariable("BTN_TXT", $button["title"]); $tpl->parseCurrentBlock(); } } // add top formbuttons if ((count($this->top_formbuttons) > 0) && (strlen($this->form_action) > 0)) { $tpl->addBlockfile("TOP_FORMBUTTONS", "top_submitbuttons", "tpl.submitbuttons.html"); foreach($this->top_formbuttons as $button) { // view button $tpl->setCurrentBlock("btn_submit_cell"); $tpl->setVariable("BTN_COMMAND", $button["command"]); $tpl->setVariable("BTN_NAME", $button["title"]); $tpl->parseCurrentBlock(); } } // add form action if (strlen($this->form_action) > 0) { $tpl->setCurrentBlock("formtop"); $tpl->setVariable("FORMACTION", $this->form_action); $tpl->parseCurrentBlock(); $tpl->touchBlock("formbottom"); } if (count($this->hiddenelements)) { foreach ($this->hiddenelements as $hidden) { $tpl->setCurrentBlock("hidden_element"); $tpl->setVariable("HIDDEN_NAME", $hidden["name"]); $tpl->setVariable("HIDDEN_VALUE", $hidden["value"]); $tpl->parseCurrentBlock(); } } for($i = 1; $i <= $this->sec_nr; $i++) { if (is_array($this->section[$i]["properties"])) { // section header $tpl->setCurrentBlock("header_row"); $tpl->setVariable("TXT_SECTION", $this->section[$i]["title"]); $tpl->parseCurrentBlock(); $tpl->touchBlock("row"); // section properties foreach($this->section[$i]["properties"] as $property) { if ($property["name"] != "") { if ($property["link"] == "") { $tpl->setCurrentBlock("pv"); $tpl->setVariable("TXT_PROPERTY_VALUE", $property["value"]); $tpl->parseCurrentBlock(); } else { $tpl->setCurrentBlock("lpv"); $tpl->setVariable("TXT_PROPERTY_LVALUE", $property["value"]); $tpl->setVariable("LINK_PROPERTY_VALUE", $property["link"]); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("property_row"); $tpl->setVariable("TXT_PROPERTY", $property["name"]); $tpl->parseCurrentBlock(); $tpl->touchBlock("row"); } else { $tpl->setCurrentBlock("property_full_row"); $tpl->setVariable("TXT_PROPERTY_FULL_VALUE", $property["value"]); $tpl->parseCurrentBlock(); $tpl->touchBlock("row"); } } } } // additional information if (is_object($this->gui_object->object)) { // section header $tpl->setCurrentBlock("header_row"); $tpl->setVariable("TXT_SECTION", $this->lng->txt("additional_info")); $tpl->parseCurrentBlock(); $tpl->touchBlock("row"); // permanent link $type = $this->gui_object->object->getType(); $ref_id = $this->gui_object->object->getRefId(); $href = ILIAS_HTTP_PATH. "/goto.php?target=".$type."_".$ref_id."&client_id=".CLIENT_ID; $tpl->setCurrentBlock("property_row"); $tpl->setVariable("TXT_PROPERTY", $this->lng->txt("perma_link")); $tpl->setVariable("TXT_PROPERTY_VALUE", '<a class="small" href="'.$href.'" target="_top">'.$href.'</a>'); $tpl->parseCurrentBlock(); $tpl->touchBlock("row"); } // learning progress if($this->learning_progress_enabled and $html = $this->showLearningProgress()) { $tpl->setCurrentBlock("learning_progress"); $tpl->setVariable("LP_TABLE",$html); $tpl->parseCurrentBlock(); } // notes section if ($this->private_notes_enabled) { $html = $this->showNotesSection(); $tpl->setCurrentBlock("notes"); $tpl->setVariable("NOTES", $html); $tpl->parseCurrentBlock(); } return $tpl->get(); }
ilInfoScreenGUI::getTabs | ( | &$ | tabs_gui | ) |
get tabs
Definition at line 670 of file class.ilInfoScreenGUI.php.
References $_GET, and $rbacsystem.
Referenced by setTabs().
{ global $rbacsystem,$ilUser,$ilAccess; $next_class = $this->ctrl->getNextClass($this); $force_active = ($next_class == "ilnotegui") ? true : false; $tabs_gui->addSubTabTarget('summary', $this->ctrl->getLinkTarget($this, "showSummary"), array("showSummary", ""), get_class($this), "", $force_active); if ($this->feedback_enabled) { $show_feedback_tab=false; if($ilAccess->checkAccess('write','edit',$_GET['ref_id'])) { $show_feedback_tab=true; } else { // this should work with feedback class available // maybe a line... "@ ilCtrl_Calls ilFeedbackGUI:" // in the header of feedbackgui is necessary include_once('Services/Feedback/classes/class.ilFeedback.php'); $feedback = new ilFeedback(); $feedback->setRefId($_GET['ref_id']); $barometers = $feedback->getAllBarometer(0); if(count($barometers)) { foreach ($barometers as $barometer) { if($barometer->canVote($ilUser->getId(),$barometer->getId())==1) { $show_feedback_tab=true; break; } } } } if ($show_feedback_tab) { $tabs_gui->addSubTabTarget("feedback", $this->ctrl->getLinkTargetByClass("ilfeedbackgui", "fbList"), "", "ilfeedbackgui"); } /* $tabs_gui->addSubTabTarget("feedb_feedback_settings", $this->ctrl->getLinkTargetByClass("ilfeedbackgui", "fbList"), "", "ilfeedbackgui");*/ } }
ilInfoScreenGUI::ilInfoScreenGUI | ( | $ | a_gui_object | ) |
Constructor.
object | $a_gui_object GUI instance of related object (ilCouseGUI, ilTestGUI, ...) |
Definition at line 57 of file class.ilInfoScreenGUI.php.
References $ilCtrl, $ilias, and $lng.
{ global $ilias, $ilCtrl, $lng,$ilTabs; $this->ilias =& $ilias; $this->ctrl =& $ilCtrl; $this->lng =& $lng; $this->tabs_gui =& $ilTabs; $this->gui_object =& $a_gui_object; $this->sec_nr = 0; $this->private_notes_enabled = false; $this->feedback_enabled = false; $this->learning_progress_enabled = false; $this->form_action = ""; $this->top_formbuttons = array(); $this->hiddenelements = array(); }
ilInfoScreenGUI::removeFormAction | ( | ) |
remove form action
Definition at line 160 of file class.ilInfoScreenGUI.php.
{
$this->form_action = "";
}
ilInfoScreenGUI::saveProgress | ( | ) |
Definition at line 617 of file class.ilInfoScreenGUI.php.
References $_POST, sendInfo(), and showSummary().
{ global $ilUser; include_once 'Services/Tracking/classes/class.ilLPObjSettings.php'; include_once 'Services/Tracking/classes/class.ilLPMarks.php'; $lp_marks = new ilLPMarks($this->gui_object->object->getId(),$ilUser->getId()); $lp_marks->setCompleted((bool) $_POST['lp_edit']); $lp_marks->update(); $this->lng->loadLanguageModule('trac'); sendInfo($this->lng->txt('trac_updated_status')); $this->showSummary(); }
ilInfoScreenGUI::setFormAction | ( | $ | a_form_action | ) |
set a form action
Definition at line 152 of file class.ilInfoScreenGUI.php.
{ $this->form_action = $a_form_action; }
ilInfoScreenGUI::setTabs | ( | ) |
Definition at line 660 of file class.ilInfoScreenGUI.php.
References $tpl, and getTabs().
Referenced by executeCommand().
ilInfoScreenGUI::showLearningProgress | ( | ) |
Definition at line 534 of file class.ilInfoScreenGUI.php.
References $rbacsystem, $tpl, ilObjUserTracking::_enabledLearningProgress(), ilLearningProgress::_getProgress(), ilLPMarks::_hasCompleted(), ilLPObjSettings::_lookupMode(), ilFormat::_secondsToString(), ilUtil::formSelect(), and ilUtil::getImagePath().
Referenced by getHTML().
{ global $ilUser,$rbacsystem; if(!$rbacsystem->checkAccess('read',$this->gui_object->object->getRefId())) { return false; } if($ilUser->getId() == ANONYMOUS_USER_ID) { return false; } include_once("Services/Tracking/classes/class.ilObjUserTracking.php"); if (!ilObjUserTracking::_enabledLearningProgress()) { return false; } include_once 'Services/Tracking/classes/class.ilLPObjSettings.php'; include_once 'Services/Tracking/classes/class.ilLPMarks.php'; if(ilLPObjSettings::_lookupMode($this->gui_object->object->getId()) != LP_MODE_MANUAL) { return false; } $this->lng->loadLanguageModule('trac'); $tpl = new ilTemplate("tpl.lp_edit_manual.html",true,true,'Services/Tracking'); $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this)); $tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_trac.gif')); $tpl->setVariable("ALT_IMG",$this->lng->txt('learning_progress')); $tpl->setVariable("TXT_EDIT_PROGRESS",$this->lng->txt('trac_edit_progress')); $tpl->setVariable("TXT_STATUS",$this->lng->txt('trac_status')); $tpl->setVariable("CHECK_EDITED",ilUtil::formSelect((int) ilLPMarks::_hasCompleted($ilUser->getId(), $this->gui_object->object->getId()), 'lp_edit', array(0 => $this->lng->txt('trac_not_completed'), 1 => $this->lng->txt('trac_completed')), false, true)); $tpl->setVariable("INFO_EDITED",$this->lng->txt('trac_info_edited')); // More infos for lm's if($this->gui_object->object->getType() == 'lm' || $this->gui_object->object->getType() == 'htlm') { $tpl->setCurrentBlock("lm_infos"); $tpl->setVariable("TXT_LAST_ACCESS",$this->lng->txt('trac_last_access')); include_once 'Services/Tracking/classes/class.ilLearningProgress.php'; $progress = ilLearningProgress::_getProgress($ilUser->getId(),$this->gui_object->object->getId()); if($progress['access_time']) { $tpl->setVariable("LAST_ACCESS",date('Y-m-d H:i:s',$progress['access_time'])); } else { $tpl->setVariable("LAST_ACCESS",$this->lng->txt('trac_not_accessed')); } $tpl->setVariable("TXT_VISITS",$this->lng->txt('trac_visits')); $tpl->setVariable("VISITS",(int) $progress['visits']); if($this->gui_object->object->getType() == 'lm') { $tpl->setVariable("TXT_DURATION",$this->lng->txt('trac_spent_time')); $tpl->setVariable("DURATION",ilFormat::_secondsToString($progress['spent_time'])); } $tpl->parseCurrentBlock(); } $tpl->setVariable("TXT_SAVE",$this->lng->txt('save')); return $tpl->get(); }
ilInfoScreenGUI::showNotesSection | ( | ) |
show notes section
Definition at line 638 of file class.ilInfoScreenGUI.php.
Referenced by getHTML().
{ $next_class = $this->ctrl->getNextClass($this); include_once("Services/Notes/classes/class.ilNoteGUI.php"); $notes_gui = new ilNoteGUI($this->gui_object->object->getId(), 0, $this->gui_object->object->getType()); $notes_gui->enablePrivateNotes(); //$notes_gui->enablePublicNotes(); if ($next_class == "ilnotegui") { $html = $this->ctrl->forwardCommand($notes_gui); } else { $html = $notes_gui->getNotesHTML(); } return $html; }
ilInfoScreenGUI::showSummary | ( | ) |
show summary page
Definition at line 378 of file class.ilInfoScreenGUI.php.
References $tpl, and getHTML().
Referenced by executeCommand(), and saveProgress().
ilInfoScreenGUI::$ctrl |
Definition at line 41 of file class.ilInfoScreenGUI.php.
ilInfoScreenGUI::$form_action |
a form action parameter.
if set a form is generated
Definition at line 49 of file class.ilInfoScreenGUI.php.
ilInfoScreenGUI::$gui_object |
Definition at line 42 of file class.ilInfoScreenGUI.php.
ilInfoScreenGUI::$hiddenelements = array() |
Definition at line 45 of file class.ilInfoScreenGUI.php.
ilInfoScreenGUI::$ilias |
Definition at line 39 of file class.ilInfoScreenGUI.php.
Referenced by ilInfoScreenGUI().
ilInfoScreenGUI::$lng |
Definition at line 40 of file class.ilInfoScreenGUI.php.
Referenced by addMetaDataSections(), executeCommand(), and ilInfoScreenGUI().
ilInfoScreenGUI::$top_buttons = array() |
Definition at line 43 of file class.ilInfoScreenGUI.php.
ilInfoScreenGUI::$top_formbuttons = array() |
Definition at line 44 of file class.ilInfoScreenGUI.php.