Public Member Functions | |
| ilHistoryGUI ($a_obj_id, $a_obj_type="") | |
| getHistoryTable ($a_header_params, $a_user_comment=false) | |
| get history table | |
| getVersionsTable ($a_header_params, $a_user_comment=false) | |
| get versions table | |
Data Fields | |
| $obj_id | |
| $lng | |
| $tpl | |
Definition at line 33 of file class.ilHistoryGUI.php.
| ilHistoryGUI::getHistoryTable | ( | $ | a_header_params, | |
| $ | a_user_comment = false | |||
| ) |
get history table
Definition at line 61 of file class.ilHistoryGUI.php.
References $_GET, $entries, $ref_id, $tbl, ilHistory::_getEntriesForObject(), and ilObjUser::_lookupName().
{
$ref_id = $a_header_params["ref_id"];
require_once("classes/class.ilTableGUI.php");
$tbl = new ilTableGUI(0, false);
// table header
$tbl->setTitle($this->lng->txt("history"));
if ($a_user_comment)
{
$tbl->setHeaderNames(array($this->lng->txt("date"),
$this->lng->txt("user"), $this->lng->txt("action"),
$this->lng->txt("user_comment")));
$tbl->setColumnWidth(array("25%", "15%", "25%", "45%"));
$cols = array("date", "user", "action", "comment");
}
else
{
$tbl->setHeaderNames(array($this->lng->txt("date"),
$this->lng->txt("user"), $this->lng->txt("action")));
$tbl->setColumnWidth(array("25%", "25%", "50%"));
$cols = array("date", "user", "action");
}
if ($a_header_params == "")
{
$a_header_params = array();
}
$header_params = $a_header_params;
$tbl->setHeaderVars($cols, $header_params);
// table variables
$tbl->setOrderColumn($_GET["sort_by"]);
$tbl->setOrderDirection($_GET["sort_order"]);
$tbl->setLimit($_GET["limit"]);
$tbl->setOffset($_GET["offset"]);
$tbl->setMaxCount($this->maxcount); // ???
// footer
$tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
// get history entries
$entries = ilHistory::_getEntriesForObject($this->obj_id, $this->obj_type);
$tbl->setMaxCount(count($entries));
$entries = array_slice($entries, $_GET["offset"], $_GET["limit"]);
$this->tpl =& $tbl->getTemplateObject();
$this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.history_row.html", false);
if(count($entries) > 0)
{
$i=0;
foreach($entries as $entry)
{
$this->tpl->setCurrentBlock("tbl_content");
$css_row = ($cssrow != "tblrow1") ? "tblrow1" : "tblrow2";
$this->tpl->setVariable("CSS_ROW", $css_row);
$this->tpl->setVariable("TXT_DATE", $entry["date"]);
$name = ilObjUser::_lookupName($entry["user_id"]);
$this->tpl->setVariable("TXT_USER",
$name["title"]." ".$name["firstname"]." ".$name["lastname"]." [".$entry["user_id"]."]");
$info_params = explode(",", $entry["info_params"]);
$info_text = $this->lng->txt("hist_".$this->obj_type.
"_".$entry["action"]);
$i=1;
foreach($info_params as $info_param)
{
$info_text = str_replace("%".$i, $info_param, $info_text);
$i++;
}
$this->tpl->setVariable("TXT_ACTION", $info_text);
if ($a_user_comment)
{
$this->tpl->setCurrentBlock("user_comment");
$this->tpl->setVariable("TXT_USER_COMMENT", $entry["user_comment"]);
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("tbl_content");
}
$this->tpl->setCurrentBlock("tbl_content");
$this->tpl->parseCurrentBlock();
}
} //if is_array
else
{
$this->tpl->setCurrentBlock("tbl_content_cell");
$this->tpl->setVariable("TBL_CONTENT_CELL", $this->lng->txt("hist_no_entries"));
$this->tpl->setVariable("TBL_COL_SPAN", 4);
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("tbl_content_row");
$this->tpl->setVariable("ROWCOLOR", "tblrow1");
$this->tpl->parseCurrentBlock();
}
$tbl->render();
//$this->tpl->parseCurrentBlock();
return $this->tpl->get();
}
Here is the call graph for this function:| ilHistoryGUI::getVersionsTable | ( | $ | a_header_params, | |
| $ | a_user_comment = false | |||
| ) |
get versions table
Definition at line 165 of file class.ilHistoryGUI.php.
References $_GET, $entries, $ref_id, $tbl, ilHistory::_getEntriesForObject(), and ilObjUser::_lookupName().
{
$ref_id = $a_header_params["ref_id"];
require_once("classes/class.ilTableGUI.php");
$tbl = new ilTableGUI(0, false);
// table header
$tbl->setTitle($this->lng->txt("versions"));
if ($a_user_comment)
{
$tbl->setHeaderNames(array($this->lng->txt("date"),
$this->lng->txt("user"), $this->lng->txt("action"),
$this->lng->txt("user_comment"), ""));
$tbl->setColumnWidth(array("15%", "15%", "45%", "20%","5%"));
$cols = array("date", "user", "action", "comment", "");
}
else
{
$tbl->setHeaderNames(array($this->lng->txt("date"),
$this->lng->txt("user"), $this->lng->txt("action"),""));
$tbl->setColumnWidth(array("25%", "25%", "45%", "5%"));
$cols = array("date", "user", "action", "");
}
if ($a_header_params == "")
{
$a_header_params = array();
}
$header_params = $a_header_params;
$tbl->setHeaderVars($cols, $header_params);
// table variables
$tbl->setOrderColumn($_GET["sort_by"]);
$tbl->setOrderDirection($_GET["sort_order"]);
$tbl->setLimit($_GET["limit"]);
$tbl->setOffset($_GET["offset"]);
$tbl->setMaxCount($this->maxcount); // ???
// footer
$tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
// get history entries
$entries = ilHistory::_getEntriesForObject($this->obj_id, $this->obj_type);
$tbl->setMaxCount(count($entries));
$entries = array_slice($entries, $_GET["offset"], $_GET["limit"]);
$this->tpl =& $tbl->getTemplateObject();
$this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.history_row.html", false);
if(count($entries) > 0)
{
$i=0;
foreach($entries as $entry)
{
$this->tpl->setCurrentBlock("tbl_content");
$css_row = ($cssrow != "tblrow1") ? "tblrow1" : "tblrow2";
$this->tpl->setVariable("CSS_ROW", $css_row);
$this->tpl->setVariable("TXT_DATE", $entry["date"]);
$name = ilObjUser::_lookupName($entry["user_id"]);
$this->tpl->setVariable("TXT_USER",
$name["title"]." ".$name["firstname"]." ".$name["lastname"]." [".$entry["user_id"]."]");
$info_params = explode(",", $entry["info_params"]);
$info_text = $this->lng->txt("hist_".$this->obj_type.
"_".$entry["action"]);
$i=1;
foreach($info_params as $info_param)
{
$info_text = str_replace("%".$i, $info_param, $info_text);
$i++;
}
$this->tpl->setVariable("TXT_ACTION", $info_text);
if ($a_user_comment)
{
$this->tpl->setCurrentBlock("user_comment");
$this->tpl->setVariable("TXT_USER_COMMENT", $entry["user_comment"]);
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("tbl_content");
}
$this->tpl->setCurrentBlock("dl_link");
$this->tpl->setVariable("TXT_DL", $this->lng->txt("download"));
$this->tpl->setVariable("DL_LINK", "repository.php?cmd=sendfile&hist_id=".$entry["hist_entry_id"]."&ref_id=".$ref_id);
$this->tpl->setCurrentBlock("tbl_content");
$this->tpl->parseCurrentBlock();
}
} //if is_array
else
{
$this->tpl->setCurrentBlock("tbl_content_cell");
$this->tpl->setVariable("TBL_CONTENT_CELL", $this->lng->txt("hist_no_entries"));
$this->tpl->setVariable("TBL_COL_SPAN", 4);
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("tbl_content_row");
$this->tpl->setVariable("ROWCOLOR", "tblrow1");
$this->tpl->parseCurrentBlock();
}
$tbl->render();
//$this->tpl->parseCurrentBlock();
return $this->tpl->get();
}
Here is the call graph for this function:| ilHistoryGUI::ilHistoryGUI | ( | $ | a_obj_id, | |
| $ | a_obj_type = "" | |||
| ) |
Definition at line 39 of file class.ilHistoryGUI.php.
References $lng, and ilObject::_lookupType().
{
global $lng;
$this->obj_id = $a_obj_id;
if ($a_obj_type == "")
{
$this->obj_type = ilObject::_lookupType($a_obj_id);
}
else
{
$this->obj_type = $a_obj_type;
}
$this->lng =& $lng;
}
Here is the call graph for this function:| ilHistoryGUI::$lng |
Definition at line 36 of file class.ilHistoryGUI.php.
Referenced by ilHistoryGUI().
| ilHistoryGUI::$obj_id |
Definition at line 35 of file class.ilHistoryGUI.php.
| ilHistoryGUI::$tpl |
Definition at line 37 of file class.ilHistoryGUI.php.
1.7.1