33 public function __construct($a_parent_obj, $a_parent_cmd, $a_records, $a_mode =
"chronological")
37 $this->
ctrl = $DIC->ctrl();
38 $this->
lng = $DIC->language();
39 $this->
access = $DIC->access();
40 $ilCtrl = $DIC->ctrl();
41 $lng = $DIC->language();
42 $ilAccess = $DIC->access();
43 $lng = $DIC->language();
47 $this->mode = $a_mode;
49 switch ($this->mode) {
64 case "by_first_table":
82 $this->
setRowTemplate(
"tpl.db_bench.html",
"components/ILIAS/SystemFolder");
99 foreach ($a_needles as $needle) {
100 $pos2 = strpos($a_str, $needle);
102 if ($pos2 > 0 && ($pos2 < $pos || $pos == 0)) {
118 $pos1 = $this->
getFirst(strtolower($a_sql), array(
"from ",
"from\n",
"from\t",
"from\r"));
122 $tablef = substr(strtolower($a_sql), $pos1 + 5);
123 $pos2 = $this->
getFirst($tablef, array(
" ",
"\n",
"\t",
"\r"));
125 $table = substr($tablef, 0, $pos2);
130 if (trim($table) !=
"") {
147 foreach ($a_records as
$r) {
149 $data[$table][
"table"] = $table;
150 $data[$table][
"cnt"] = isset(
$data[$table][
"cnt"]) ?
$data[$table][
"cnt"] + 1 : 1;
151 $data[$table][
"time"] = isset(
$data[$table][
"time"]) ?
$data[$table][
"time"] + $r[
"time"] : $r[
"time"];
153 if (count(
$data) > 0) {
163 protected function fillRow(array $a_set): void
167 switch ($this->mode) {
168 case "by_first_table":
169 $this->tpl->setCurrentBlock(
"td");
170 $this->tpl->setVariable(
"VAL", $a_set[
"table"]);
171 $this->tpl->parseCurrentBlock();
172 $this->tpl->setVariable(
"VAL1", $a_set[
"time"]);
173 $this->tpl->setVariable(
"VAL2", $a_set[
"cnt"]);
176 case "slowest_first":
177 case "sorted_by_sql":
179 $this->tpl->setVariable(
"VAL1", $a_set[
"time"]);
180 $this->tpl->setVariable(
"VAL2", $a_set[
"sql"]);
getDataByFirstTable($a_records)
Get data by first table.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setFormAction(string $a_form_action, bool $a_multipart=false)
__construct($a_parent_obj, $a_parent_cmd, $a_records, $a_mode="chronological")
Constructor.
setEnableTitle(bool $a_enabletitle)
fillRow(array $a_set)
Fill table row.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
extractFirstTableFromSQL($a_sql)
Extract first table from sql.
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
getFirst($a_str, $a_needles)
Get first occurence of string.
__construct(Container $dic, ilPlugin $plugin)
setLimit(int $a_limit=0, int $a_default_limit=0)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
disable(string $a_module_name)
setEnableHeader(bool $a_enableheader)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)