Some fixes in phpgacl to work with php 5.4
[openemr.git] / phpmyadmin / tbl_relation.php
blob1c05c724410a0e73c8b3f8a881ea6aa77597007f
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Display table relations for viewing and editing
6 * includes phpMyAdmin relations and InnoDB relations
8 * @todo fix name handling: currently names with dots (.) are not properly handled
9 * for internal relations (but foreign keys relations are correct)
10 * @todo foreign key constraints require both fields being of equal type and size
11 * @todo check foreign fields to be from same type and size, all other makes no sense
12 * @todo if above todos are fullfilled we can add all fields meet requirements
13 * in the select dropdown
14 * @package PhpMyAdmin
17 /**
18 * Get the TableRelationController
20 namespace PMA;
22 use PMA_Response;
23 use PMA_Table;
24 use PMA_Util;
26 require_once 'libraries/common.inc.php';
27 require_once 'libraries/di/Container.class.php';
28 require_once 'libraries/controllers/TableRelationController.class.php';
29 require_once 'libraries/Response.class.php';
30 require_once 'libraries/Table.class.php';
31 require_once 'libraries/Util.class.php';
33 $container = DI\Container::getDefaultContainer();
34 $container->factory('PMA\Controllers\Table\TableRelationController');
35 $container->alias(
36 'TableRelationController', 'PMA\Controllers\Table\TableRelationController'
38 $container->set('PMA_Response', PMA_Response::getInstance());
39 $container->alias('response', 'PMA_Response');
41 /* Define dependencies for the concerned controller */
42 $db = $container->get('db');
43 $table = $container->get('table');
44 $dbi = $container->get('dbi');
45 $options_array = array(
46 'CASCADE' => 'CASCADE',
47 'SET_NULL' => 'SET NULL',
48 'NO_ACTION' => 'NO ACTION',
49 'RESTRICT' => 'RESTRICT',
51 $cfgRelation = PMA_getRelationsParam();
52 $tbl_storage_engine = /*overload*/
53 mb_strtoupper(
54 $GLOBALS['dbi']->getTable($db, $table)->getStatusInfo('Engine')
56 $upd_query = new PMA_Table($table, $db, $dbi);
58 $dependency_definitions = array(
59 "options_array" => $options_array,
60 "cfgRelation" => $cfgRelation,
61 "tbl_storage_engine" => $tbl_storage_engine,
62 "upd_query" => $upd_query
64 if ($cfgRelation['relwork']) {
65 $dependency_definitions['existrel'] = PMA_getForeigners(
66 $db, $table, '', 'internal'
69 if (PMA_Util::isForeignKeySupported($tbl_storage_engine)) {
70 $dependency_definitions['existrel_foreign'] = PMA_getForeigners(
71 $db, $table, '', 'foreign'
74 if ($cfgRelation['displaywork']) {
75 $dependency_definitions['disp'] = PMA_getDisplayField($db, $table);
76 } else {
77 $dependency_definitions['disp'] = 'asas';
80 /** @var Controllers\Table\TableRelationController $controller */
81 $controller = $container->get('TableRelationController', $dependency_definitions);
82 $controller->indexAction();