Back to Nested class

Method _logtable

protected void
_logtable
(mixed $showData = true, mixed $showQuery = true)
Method to create a log table in the buffer optionally showing the query and/or data.
Parameters
  • bool $showData True to show data
  • bool $showQuery True to show query
Returns
  • void
Since
  • 1.7.0
-
Class: Nested
Project: Joomla

Method _logtable - Source code

/**
 * Method to create a log table in the buffer optionally showing the query and/or data.
 *
 * @param   boolean  $showData   True to show data
 * @param   boolean  $showQuery  True to show query
 *
 * @return  void
 *
 * @codeCoverageIgnore
 * @since   1.7.0
 */
protected function _logtable($showData = true, $showQuery = true)
{
    $sep = "\n" . str_pad('', 40, '-');
    $buffer = '';
    if ($showQuery) {
        $buffer .= "\n" . htmlspecialchars($this->_db->getQuery(), ENT_QUOTES, 'UTF-8') . $sep;
    }
    if ($showData) {
        $query = $this->_db->getQuery(true)->select($this->_tbl_key . ', parent_id, lft, rgt, level')->from($this->_tbl)->order($this->_tbl_key);
        $this->_db->setQuery($query);
        $rows = $this->_db->loadRowList();
        $buffer .= sprintf("\n| %4s | %4s | %4s | %4s |", $this->_tbl_key, 'par', 'lft', 'rgt');
        $buffer .= $sep;
        foreach ($rows as $row) {
            $buffer .= sprintf("\n| %4s | %4s | %4s | %4s |", $row[0], $row[1], $row[2], $row[3]);
        }
        $buffer .= $sep;
    }
    echo $buffer;
}