Initial commit
This commit is contained in:
@@ -25,7 +25,28 @@ class View
|
||||
/* Note properties */
|
||||
public $messages;
|
||||
public $other_user;
|
||||
|
||||
|
||||
/* Group properties */
|
||||
public $groups;
|
||||
|
||||
/* Database Manager properties */
|
||||
public $databases;
|
||||
public $database_name;
|
||||
public $current_db;
|
||||
public $tables;
|
||||
public $table_name;
|
||||
public $table_info;
|
||||
public $columns;
|
||||
public $rows;
|
||||
public $indexes;
|
||||
public $total_rows;
|
||||
public $current_page;
|
||||
public $per_page;
|
||||
public $history;
|
||||
public $user;
|
||||
public $privileges;
|
||||
public $current_user;
|
||||
|
||||
/**
|
||||
* Static property to track if header has been rendered
|
||||
*/
|
||||
@@ -115,6 +136,24 @@ class View
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a view using the database manager layout
|
||||
* @param string $filename Path of the to-be-rendered view
|
||||
* @param array $data Data to be used in the view
|
||||
*/
|
||||
public function renderDbManager($filename, $data = null)
|
||||
{
|
||||
if ($data) {
|
||||
foreach ($data as $key => $value) {
|
||||
$this->{$key} = $value;
|
||||
}
|
||||
}
|
||||
|
||||
require Config::get('PATH_VIEW') . '_templates/dbmanager_header.php';
|
||||
require Config::get('PATH_VIEW') . $filename . '.php';
|
||||
require Config::get('PATH_VIEW') . '_templates/dbmanager_footer.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset header render flag at start of request
|
||||
@@ -206,6 +245,25 @@ class View
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the passed array of controllers contains the currently active controller.
|
||||
* Useful for navigation items that span multiple controllers (e.g., database manager).
|
||||
*
|
||||
* @param string $filename
|
||||
* @param array $controllers Array of controller names to check
|
||||
*
|
||||
* @return bool Shows if any of the controllers is active
|
||||
*/
|
||||
public static function checkForActiveControllers($filename, $controllers)
|
||||
{
|
||||
foreach ($controllers as $controller) {
|
||||
if (self::checkForActiveController($filename, $controller)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts characters to HTML entities
|
||||
* This is important to avoid XSS attacks, and attempts to inject malicious code in your page.
|
||||
|
||||
Reference in New Issue
Block a user