/**
* Print out (html) show item : question and answer
*
* @param $options array of options
*
* @return nothing (display item : question and answer)
**/
function showFull($options = array())
{
global $DB, $CFG_GLPI;
if (!$this->can($this->fields['id'], READ)) {
return false;
}
$linkusers_id = true;
// show item : question and answer
if (Session::getLoginUserID() === false && $CFG_GLPI["use_public_faq"] || $_SESSION["glpiactiveprofile"]["interface"] == "helpdesk" || !User::canView()) {
$linkusers_id = false;
}
$this->updateCounter();
$knowbaseitemcategories_id = $this->fields["knowbaseitemcategories_id"];
$fullcategoryname = getTreeValueCompleteName("glpi_knowbaseitemcategories", $knowbaseitemcategories_id);
$tmp = "<a href='" . $this->getSearchURL() . "?knowbaseitemcategories_id={$knowbaseitemcategories_id}'>" . $fullcategoryname . "</a>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4'>" . sprintf(__('%1$s: %2$s'), __('Category'), $tmp);
echo "</th></tr>";
echo "<tr><td class='left' colspan='4'><h2>" . __('Subject') . "</h2>";
if (KnowbaseItemTranslation::canBeTranslated($this)) {
echo KnowbaseItemTranslation::getTranslatedValue($this, 'name');
} else {
echo $this->fields["name"];
}
echo "</td></tr>";
echo "<tr><td class='left' colspan='4'><h2>" . __('Content') . "</h2>\n";
echo "<div id='kbanswer'>";
if (KnowbaseItemTranslation::canBeTranslated($this)) {
$answer = KnowbaseItemTranslation::getTranslatedValue($this, 'answer');
} else {
$answer = $this->fields["answer"];
}
echo Toolbox::unclean_html_cross_side_scripting_deep($answer);
echo "</div>";
echo "</td></tr>";
echo "<tr><th class='tdkb' colspan='2'>";
if ($this->fields["users_id"]) {
// Integer because true may be 2 and getUserName return array
if ($linkusers_id) {
$linkusers_id = 1;
} else {
$linkusers_id = 0;
}
printf(__('%1$s: %2$s'), __('Writer'), getUserName($this->fields["users_id"], $linkusers_id));
echo "<br>";
}
if ($this->fields["date"]) {
//TRANS: %s is the datetime of update
printf(__('Created on %s'), Html::convDateTime($this->fields["date"]));
echo "<br>";
}
if ($this->fields["date_mod"]) {
//TRANS: %s is the datetime of update
printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
}
echo "</th>";
echo "<th class='tdkb' colspan='2'>";
if ($this->countVisibilities() == 0) {
echo "<span class='red'>" . __('Unpublished') . "</span><br>";
}
printf(_n('%d view', '%d views', $this->fields["view"]), $this->fields["view"]);
echo "<br>";
if ($this->fields["is_faq"]) {
_e('This item is part of the FAQ');
} else {
_e('This item is not part of the FAQ');
}
echo "</th></tr>";
echo "</table>";
return true;
}