| Conditions | 21 |
| Paths | 18 |
| Total Lines | 684 |
| Code Lines | 550 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 1077 | public function getNavTabs($section) |
||
| 1078 | { |
||
| 1079 | $data = $this->getDatabaseAccessor(); |
||
| 1080 | $lang = $this->lang; |
||
| 1081 | $plugin_manager = $this->plugin_manager; |
||
| 1082 | |||
| 1083 | $hide_advanced = ($this->conf['show_advanced'] === false); |
||
| 1084 | $tabs = []; |
||
| 1085 | |||
| 1086 | switch ($section) { |
||
| 1087 | case 'root': |
||
| 1088 | $tabs = [ |
||
| 1089 | 'intro' => [ |
||
| 1090 | 'title' => $lang['strintroduction'], |
||
| 1091 | 'url' => 'intro', |
||
| 1092 | 'icon' => 'Introduction', |
||
| 1093 | ], |
||
| 1094 | 'servers' => [ |
||
| 1095 | 'title' => $lang['strservers'], |
||
| 1096 | 'url' => 'servers', |
||
| 1097 | 'icon' => 'Servers', |
||
| 1098 | ], |
||
| 1099 | ]; |
||
| 1100 | |||
| 1101 | break; |
||
| 1102 | case 'server': |
||
| 1103 | $hide_users = true; |
||
| 1104 | if ($data) { |
||
| 1105 | $hide_users = !$data->isSuperUser(); |
||
| 1106 | } |
||
| 1107 | |||
| 1108 | $tabs = [ |
||
| 1109 | 'databases' => [ |
||
| 1110 | 'title' => $lang['strdatabases'], |
||
| 1111 | 'url' => 'alldb', |
||
| 1112 | 'urlvars' => ['subject' => 'server'], |
||
| 1113 | 'help' => 'pg.database', |
||
| 1114 | 'icon' => 'Databases', |
||
| 1115 | ], |
||
| 1116 | ]; |
||
| 1117 | if ($data && $data->hasRoles()) { |
||
| 1118 | $tabs = array_merge($tabs, [ |
||
|
1 ignored issue
–
show
|
|||
| 1119 | 'roles' => [ |
||
| 1120 | 'title' => $lang['strroles'], |
||
| 1121 | 'url' => 'roles', |
||
| 1122 | 'urlvars' => ['subject' => 'server'], |
||
| 1123 | 'hide' => $hide_users, |
||
| 1124 | 'help' => 'pg.role', |
||
| 1125 | 'icon' => 'Roles', |
||
| 1126 | ], |
||
| 1127 | ]); |
||
|
1 ignored issue
–
show
|
|||
| 1128 | } else { |
||
| 1129 | $tabs = array_merge($tabs, [ |
||
|
1 ignored issue
–
show
|
|||
| 1130 | 'users' => [ |
||
| 1131 | 'title' => $lang['strusers'], |
||
| 1132 | 'url' => 'users', |
||
| 1133 | 'urlvars' => ['subject' => 'server'], |
||
| 1134 | 'hide' => $hide_users, |
||
| 1135 | 'help' => 'pg.user', |
||
| 1136 | 'icon' => 'Users', |
||
| 1137 | ], |
||
| 1138 | 'groups' => [ |
||
| 1139 | 'title' => $lang['strgroups'], |
||
| 1140 | 'url' => 'groups', |
||
| 1141 | 'urlvars' => ['subject' => 'server'], |
||
| 1142 | 'hide' => $hide_users, |
||
| 1143 | 'help' => 'pg.group', |
||
| 1144 | 'icon' => 'UserGroups', |
||
| 1145 | ], |
||
| 1146 | ]); |
||
|
1 ignored issue
–
show
|
|||
| 1147 | } |
||
| 1148 | |||
| 1149 | $tabs = array_merge($tabs, [ |
||
|
1 ignored issue
–
show
|
|||
| 1150 | 'account' => [ |
||
| 1151 | 'title' => $lang['straccount'], |
||
| 1152 | 'url' => ($data && $data->hasRoles()) ? 'roles' : 'users', |
||
| 1153 | 'urlvars' => ['subject' => 'server', 'action' => 'account'], |
||
| 1154 | 'hide' => !$hide_users, |
||
| 1155 | 'help' => 'pg.role', |
||
| 1156 | 'icon' => 'User', |
||
| 1157 | ], |
||
| 1158 | 'tablespaces' => [ |
||
| 1159 | 'title' => $lang['strtablespaces'], |
||
| 1160 | 'url' => 'tablespaces', |
||
| 1161 | 'urlvars' => ['subject' => 'server'], |
||
| 1162 | 'hide' => !$data || !$data->hasTablespaces(), |
||
| 1163 | 'help' => 'pg.tablespace', |
||
| 1164 | 'icon' => 'Tablespaces', |
||
| 1165 | ], |
||
| 1166 | 'export' => [ |
||
| 1167 | 'title' => $lang['strexport'], |
||
| 1168 | 'url' => 'alldb', |
||
| 1169 | 'urlvars' => ['subject' => 'server', 'action' => 'export'], |
||
| 1170 | 'hide' => !$this->isDumpEnabled(), |
||
| 1171 | 'icon' => 'Export', |
||
| 1172 | ], |
||
| 1173 | ]); |
||
|
1 ignored issue
–
show
|
|||
| 1174 | |||
| 1175 | break; |
||
| 1176 | case 'database': |
||
| 1177 | $tabs = [ |
||
| 1178 | 'schemas' => [ |
||
| 1179 | 'title' => $lang['strschemas'], |
||
| 1180 | 'url' => 'schemas', |
||
| 1181 | 'urlvars' => ['subject' => 'database'], |
||
| 1182 | 'help' => 'pg.schema', |
||
| 1183 | 'icon' => 'Schemas', |
||
| 1184 | ], |
||
| 1185 | 'sql' => [ |
||
| 1186 | 'title' => $lang['strsql'], |
||
| 1187 | 'url' => 'database', |
||
| 1188 | 'urlvars' => ['subject' => 'database', 'action' => 'sql', 'new' => 1], |
||
| 1189 | 'help' => 'pg.sql', |
||
| 1190 | 'tree' => false, |
||
| 1191 | 'icon' => 'SqlEditor', |
||
| 1192 | ], |
||
| 1193 | 'find' => [ |
||
| 1194 | 'title' => $lang['strfind'], |
||
| 1195 | 'url' => 'database', |
||
| 1196 | 'urlvars' => ['subject' => 'database', 'action' => 'find'], |
||
| 1197 | 'tree' => false, |
||
| 1198 | 'icon' => 'Search', |
||
| 1199 | ], |
||
| 1200 | 'variables' => [ |
||
| 1201 | 'title' => $lang['strvariables'], |
||
| 1202 | 'url' => 'database', |
||
| 1203 | 'urlvars' => ['subject' => 'database', 'action' => 'variables'], |
||
| 1204 | 'help' => 'pg.variable', |
||
| 1205 | 'tree' => false, |
||
| 1206 | 'icon' => 'Variables', |
||
| 1207 | ], |
||
| 1208 | 'processes' => [ |
||
| 1209 | 'title' => $lang['strprocesses'], |
||
| 1210 | 'url' => 'database', |
||
| 1211 | 'urlvars' => ['subject' => 'database', 'action' => 'processes'], |
||
| 1212 | 'help' => 'pg.process', |
||
| 1213 | 'tree' => false, |
||
| 1214 | 'icon' => 'Processes', |
||
| 1215 | ], |
||
| 1216 | 'locks' => [ |
||
| 1217 | 'title' => $lang['strlocks'], |
||
| 1218 | 'url' => 'database', |
||
| 1219 | 'urlvars' => ['subject' => 'database', 'action' => 'locks'], |
||
| 1220 | 'help' => 'pg.locks', |
||
| 1221 | 'tree' => false, |
||
| 1222 | 'icon' => 'Key', |
||
| 1223 | ], |
||
| 1224 | 'admin' => [ |
||
| 1225 | 'title' => $lang['stradmin'], |
||
| 1226 | 'url' => 'database', |
||
| 1227 | 'urlvars' => ['subject' => 'database', 'action' => 'admin'], |
||
| 1228 | 'tree' => false, |
||
| 1229 | 'icon' => 'Admin', |
||
| 1230 | ], |
||
| 1231 | 'privileges' => [ |
||
| 1232 | 'title' => $lang['strprivileges'], |
||
| 1233 | 'url' => 'privileges', |
||
| 1234 | 'urlvars' => ['subject' => 'database'], |
||
| 1235 | 'hide' => !isset($data->privlist['database']), |
||
| 1236 | 'help' => 'pg.privilege', |
||
| 1237 | 'tree' => false, |
||
| 1238 | 'icon' => 'Privileges', |
||
| 1239 | ], |
||
| 1240 | 'languages' => [ |
||
| 1241 | 'title' => $lang['strlanguages'], |
||
| 1242 | 'url' => 'languages', |
||
| 1243 | 'urlvars' => ['subject' => 'database'], |
||
| 1244 | 'hide' => $hide_advanced, |
||
| 1245 | 'help' => 'pg.language', |
||
| 1246 | 'icon' => 'Languages', |
||
| 1247 | ], |
||
| 1248 | 'casts' => [ |
||
| 1249 | 'title' => $lang['strcasts'], |
||
| 1250 | 'url' => 'casts', |
||
| 1251 | 'urlvars' => ['subject' => 'database'], |
||
| 1252 | 'hide' => $hide_advanced, |
||
| 1253 | 'help' => 'pg.cast', |
||
| 1254 | 'icon' => 'Casts', |
||
| 1255 | ], |
||
| 1256 | 'export' => [ |
||
| 1257 | 'title' => $lang['strexport'], |
||
| 1258 | 'url' => 'database', |
||
| 1259 | 'urlvars' => ['subject' => 'database', 'action' => 'export'], |
||
| 1260 | 'hide' => !$this->isDumpEnabled(), |
||
| 1261 | 'tree' => false, |
||
| 1262 | 'icon' => 'Export', |
||
| 1263 | ], |
||
| 1264 | ]; |
||
| 1265 | |||
| 1266 | break; |
||
| 1267 | case 'schema': |
||
| 1268 | $tabs = [ |
||
| 1269 | 'tables' => [ |
||
| 1270 | 'title' => $lang['strtables'], |
||
| 1271 | 'url' => 'tables', |
||
| 1272 | 'urlvars' => ['subject' => 'schema'], |
||
| 1273 | 'help' => 'pg.table', |
||
| 1274 | 'icon' => 'Tables', |
||
| 1275 | ], |
||
| 1276 | 'views' => [ |
||
| 1277 | 'title' => $lang['strviews'], |
||
| 1278 | 'url' => 'views', |
||
| 1279 | 'urlvars' => ['subject' => 'schema'], |
||
| 1280 | 'help' => 'pg.view', |
||
| 1281 | 'icon' => 'Views', |
||
| 1282 | ], |
||
| 1283 | 'matviews' => [ |
||
| 1284 | 'title' => 'M '.$lang['strviews'], |
||
| 1285 | 'url' => 'materializedviews', |
||
| 1286 | 'urlvars' => ['subject' => 'schema'], |
||
| 1287 | 'help' => 'pg.matview', |
||
| 1288 | 'icon' => 'MViews', |
||
| 1289 | ], |
||
| 1290 | 'sequences' => [ |
||
| 1291 | 'title' => $lang['strsequences'], |
||
| 1292 | 'url' => 'sequences', |
||
| 1293 | 'urlvars' => ['subject' => 'schema'], |
||
| 1294 | 'help' => 'pg.sequence', |
||
| 1295 | 'icon' => 'Sequences', |
||
| 1296 | ], |
||
| 1297 | 'functions' => [ |
||
| 1298 | 'title' => $lang['strfunctions'], |
||
| 1299 | 'url' => 'functions', |
||
| 1300 | 'urlvars' => ['subject' => 'schema'], |
||
| 1301 | 'help' => 'pg.function', |
||
| 1302 | 'icon' => 'Functions', |
||
| 1303 | ], |
||
| 1304 | 'fulltext' => [ |
||
| 1305 | 'title' => $lang['strfulltext'], |
||
| 1306 | 'url' => 'fulltext', |
||
| 1307 | 'urlvars' => ['subject' => 'schema'], |
||
| 1308 | 'help' => 'pg.fts', |
||
| 1309 | 'tree' => true, |
||
| 1310 | 'icon' => 'Fts', |
||
| 1311 | ], |
||
| 1312 | 'domains' => [ |
||
| 1313 | 'title' => $lang['strdomains'], |
||
| 1314 | 'url' => 'domains', |
||
| 1315 | 'urlvars' => ['subject' => 'schema'], |
||
| 1316 | 'help' => 'pg.domain', |
||
| 1317 | 'icon' => 'Domains', |
||
| 1318 | ], |
||
| 1319 | 'aggregates' => [ |
||
| 1320 | 'title' => $lang['straggregates'], |
||
| 1321 | 'url' => 'aggregates', |
||
| 1322 | 'urlvars' => ['subject' => 'schema'], |
||
| 1323 | 'hide' => $hide_advanced, |
||
| 1324 | 'help' => 'pg.aggregate', |
||
| 1325 | 'icon' => 'Aggregates', |
||
| 1326 | ], |
||
| 1327 | 'types' => [ |
||
| 1328 | 'title' => $lang['strtypes'], |
||
| 1329 | 'url' => 'types', |
||
| 1330 | 'urlvars' => ['subject' => 'schema'], |
||
| 1331 | 'hide' => $hide_advanced, |
||
| 1332 | 'help' => 'pg.type', |
||
| 1333 | 'icon' => 'Types', |
||
| 1334 | ], |
||
| 1335 | 'operators' => [ |
||
| 1336 | 'title' => $lang['stroperators'], |
||
| 1337 | 'url' => 'operators', |
||
| 1338 | 'urlvars' => ['subject' => 'schema'], |
||
| 1339 | 'hide' => $hide_advanced, |
||
| 1340 | 'help' => 'pg.operator', |
||
| 1341 | 'icon' => 'Operators', |
||
| 1342 | ], |
||
| 1343 | 'opclasses' => [ |
||
| 1344 | 'title' => $lang['stropclasses'], |
||
| 1345 | 'url' => 'opclasses', |
||
| 1346 | 'urlvars' => ['subject' => 'schema'], |
||
| 1347 | 'hide' => $hide_advanced, |
||
| 1348 | 'help' => 'pg.opclass', |
||
| 1349 | 'icon' => 'OperatorClasses', |
||
| 1350 | ], |
||
| 1351 | 'conversions' => [ |
||
| 1352 | 'title' => $lang['strconversions'], |
||
| 1353 | 'url' => 'conversions', |
||
| 1354 | 'urlvars' => ['subject' => 'schema'], |
||
| 1355 | 'hide' => $hide_advanced, |
||
| 1356 | 'help' => 'pg.conversion', |
||
| 1357 | 'icon' => 'Conversions', |
||
| 1358 | ], |
||
| 1359 | 'privileges' => [ |
||
| 1360 | 'title' => $lang['strprivileges'], |
||
| 1361 | 'url' => 'privileges', |
||
| 1362 | 'urlvars' => ['subject' => 'schema'], |
||
| 1363 | 'help' => 'pg.privilege', |
||
| 1364 | 'tree' => false, |
||
| 1365 | 'icon' => 'Privileges', |
||
| 1366 | ], |
||
| 1367 | 'export' => [ |
||
| 1368 | 'title' => $lang['strexport'], |
||
| 1369 | 'url' => 'schemas', |
||
| 1370 | 'urlvars' => ['subject' => 'schema', 'action' => 'export'], |
||
| 1371 | 'hide' => !$this->isDumpEnabled(), |
||
| 1372 | 'tree' => false, |
||
| 1373 | 'icon' => 'Export', |
||
| 1374 | ], |
||
| 1375 | ]; |
||
| 1376 | if (!$data->hasFTS()) { |
||
| 1377 | unset($tabs['fulltext']); |
||
| 1378 | } |
||
| 1379 | |||
| 1380 | break; |
||
| 1381 | case 'table': |
||
| 1382 | $tabs = [ |
||
| 1383 | 'columns' => [ |
||
| 1384 | 'title' => $lang['strcolumns'], |
||
| 1385 | 'url' => 'tblproperties', |
||
| 1386 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
| 1387 | 'icon' => 'Columns', |
||
| 1388 | 'branch' => true, |
||
| 1389 | ], |
||
| 1390 | 'browse' => [ |
||
| 1391 | 'title' => $lang['strbrowse'], |
||
| 1392 | 'icon' => 'Columns', |
||
| 1393 | 'url' => 'display', |
||
| 1394 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
| 1395 | 'return' => 'table', |
||
| 1396 | 'branch' => true, |
||
| 1397 | ], |
||
| 1398 | 'select' => [ |
||
| 1399 | 'title' => $lang['strselect'], |
||
| 1400 | 'icon' => 'Search', |
||
| 1401 | 'url' => 'tables', |
||
| 1402 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'confselectrows'], |
||
| 1403 | 'help' => 'pg.sql.select', |
||
| 1404 | ], |
||
| 1405 | 'insert' => [ |
||
| 1406 | 'title' => $lang['strinsert'], |
||
| 1407 | 'url' => 'tables', |
||
| 1408 | 'urlvars' => [ |
||
| 1409 | 'action' => 'confinsertrow', |
||
| 1410 | 'table' => Decorator::field('table'), |
||
| 1411 | ], |
||
| 1412 | 'help' => 'pg.sql.insert', |
||
| 1413 | 'icon' => 'Operator', |
||
| 1414 | ], |
||
| 1415 | 'indexes' => [ |
||
| 1416 | 'title' => $lang['strindexes'], |
||
| 1417 | 'url' => 'indexes', |
||
| 1418 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
| 1419 | 'help' => 'pg.index', |
||
| 1420 | 'icon' => 'Indexes', |
||
| 1421 | 'branch' => true, |
||
| 1422 | ], |
||
| 1423 | 'constraints' => [ |
||
| 1424 | 'title' => $lang['strconstraints'], |
||
| 1425 | 'url' => 'constraints', |
||
| 1426 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
| 1427 | 'help' => 'pg.constraint', |
||
| 1428 | 'icon' => 'Constraints', |
||
| 1429 | 'branch' => true, |
||
| 1430 | ], |
||
| 1431 | 'triggers' => [ |
||
| 1432 | 'title' => $lang['strtriggers'], |
||
| 1433 | 'url' => 'triggers', |
||
| 1434 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
| 1435 | 'help' => 'pg.trigger', |
||
| 1436 | 'icon' => 'Triggers', |
||
| 1437 | 'branch' => true, |
||
| 1438 | ], |
||
| 1439 | 'rules' => [ |
||
| 1440 | 'title' => $lang['strrules'], |
||
| 1441 | 'url' => 'rules', |
||
| 1442 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
| 1443 | 'help' => 'pg.rule', |
||
| 1444 | 'icon' => 'Rules', |
||
| 1445 | 'branch' => true, |
||
| 1446 | ], |
||
| 1447 | 'admin' => [ |
||
| 1448 | 'title' => $lang['stradmin'], |
||
| 1449 | 'url' => 'tables', |
||
| 1450 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'admin'], |
||
| 1451 | 'icon' => 'Admin', |
||
| 1452 | ], |
||
| 1453 | 'info' => [ |
||
| 1454 | 'title' => $lang['strinfo'], |
||
| 1455 | 'url' => 'info', |
||
| 1456 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
| 1457 | 'icon' => 'Statistics', |
||
| 1458 | ], |
||
| 1459 | 'privileges' => [ |
||
| 1460 | 'title' => $lang['strprivileges'], |
||
| 1461 | 'url' => 'privileges', |
||
| 1462 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
| 1463 | 'help' => 'pg.privilege', |
||
| 1464 | 'icon' => 'Privileges', |
||
| 1465 | ], |
||
| 1466 | 'import' => [ |
||
| 1467 | 'title' => $lang['strimport'], |
||
| 1468 | 'url' => 'tblproperties', |
||
| 1469 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'import'], |
||
| 1470 | 'icon' => 'Import', |
||
| 1471 | 'hide' => false, |
||
| 1472 | ], |
||
| 1473 | 'export' => [ |
||
| 1474 | 'title' => $lang['strexport'], |
||
| 1475 | 'url' => 'tblproperties', |
||
| 1476 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'export'], |
||
| 1477 | 'icon' => 'Export', |
||
| 1478 | 'hide' => false, |
||
| 1479 | ], |
||
| 1480 | ]; |
||
| 1481 | |||
| 1482 | break; |
||
| 1483 | case 'view': |
||
| 1484 | $tabs = [ |
||
| 1485 | 'columns' => [ |
||
| 1486 | 'title' => $lang['strcolumns'], |
||
| 1487 | 'url' => 'viewproperties', |
||
| 1488 | 'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')], |
||
| 1489 | 'icon' => 'Columns', |
||
| 1490 | 'branch' => true, |
||
| 1491 | ], |
||
| 1492 | 'browse' => [ |
||
| 1493 | 'title' => $lang['strbrowse'], |
||
| 1494 | 'icon' => 'Columns', |
||
| 1495 | 'url' => 'display', |
||
| 1496 | 'urlvars' => [ |
||
| 1497 | 'action' => 'confselectrows', |
||
| 1498 | 'return' => 'schema', |
||
| 1499 | 'subject' => 'view', |
||
| 1500 | 'view' => Decorator::field('view'), |
||
| 1501 | ], |
||
| 1502 | 'branch' => true, |
||
| 1503 | ], |
||
| 1504 | 'select' => [ |
||
| 1505 | 'title' => $lang['strselect'], |
||
| 1506 | 'icon' => 'Search', |
||
| 1507 | 'url' => 'views', |
||
| 1508 | 'urlvars' => ['action' => 'confselectrows', 'view' => Decorator::field('view')], |
||
| 1509 | 'help' => 'pg.sql.select', |
||
| 1510 | ], |
||
| 1511 | 'definition' => [ |
||
| 1512 | 'title' => $lang['strdefinition'], |
||
| 1513 | 'url' => 'viewproperties', |
||
| 1514 | 'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view'), 'action' => 'definition'], |
||
| 1515 | 'icon' => 'Definition', |
||
| 1516 | ], |
||
| 1517 | 'rules' => [ |
||
| 1518 | 'title' => $lang['strrules'], |
||
| 1519 | 'url' => 'rules', |
||
| 1520 | 'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')], |
||
| 1521 | 'help' => 'pg.rule', |
||
| 1522 | 'icon' => 'Rules', |
||
| 1523 | 'branch' => true, |
||
| 1524 | ], |
||
| 1525 | 'privileges' => [ |
||
| 1526 | 'title' => $lang['strprivileges'], |
||
| 1527 | 'url' => 'privileges', |
||
| 1528 | 'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')], |
||
| 1529 | 'help' => 'pg.privilege', |
||
| 1530 | 'icon' => 'Privileges', |
||
| 1531 | ], |
||
| 1532 | 'export' => [ |
||
| 1533 | 'title' => $lang['strexport'], |
||
| 1534 | 'url' => 'viewproperties', |
||
| 1535 | 'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view'), 'action' => 'export'], |
||
| 1536 | 'icon' => 'Export', |
||
| 1537 | 'hide' => false, |
||
| 1538 | ], |
||
| 1539 | ]; |
||
| 1540 | |||
| 1541 | break; |
||
| 1542 | case 'matview': |
||
| 1543 | $tabs = [ |
||
| 1544 | 'columns' => [ |
||
| 1545 | 'title' => $lang['strcolumns'], |
||
| 1546 | 'url' => 'materializedviewproperties', |
||
| 1547 | 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
||
| 1548 | 'icon' => 'Columns', |
||
| 1549 | 'branch' => true, |
||
| 1550 | ], |
||
| 1551 | 'browse' => [ |
||
| 1552 | 'title' => $lang['strbrowse'], |
||
| 1553 | 'icon' => 'Columns', |
||
| 1554 | 'url' => 'display', |
||
| 1555 | 'urlvars' => [ |
||
| 1556 | 'action' => 'confselectrows', |
||
| 1557 | 'return' => 'schema', |
||
| 1558 | 'subject' => 'matview', |
||
| 1559 | 'matview' => Decorator::field('matview'), |
||
| 1560 | ], |
||
| 1561 | 'branch' => true, |
||
| 1562 | ], |
||
| 1563 | 'select' => [ |
||
| 1564 | 'title' => $lang['strselect'], |
||
| 1565 | 'icon' => 'Search', |
||
| 1566 | 'url' => 'materializedviews', |
||
| 1567 | 'urlvars' => ['action' => 'confselectrows', 'matview' => Decorator::field('matview')], |
||
| 1568 | 'help' => 'pg.sql.select', |
||
| 1569 | ], |
||
| 1570 | 'definition' => [ |
||
| 1571 | 'title' => $lang['strdefinition'], |
||
| 1572 | 'url' => 'materializedviewproperties', |
||
| 1573 | 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview'), 'action' => 'definition'], |
||
| 1574 | 'icon' => 'Definition', |
||
| 1575 | ], |
||
| 1576 | 'indexes' => [ |
||
| 1577 | 'title' => $lang['strindexes'], |
||
| 1578 | 'url' => 'indexes', |
||
| 1579 | 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
||
| 1580 | 'help' => 'pg.index', |
||
| 1581 | 'icon' => 'Indexes', |
||
| 1582 | 'branch' => true, |
||
| 1583 | ], |
||
| 1584 | /*'constraints' => [ |
||
| 1585 | 'title' => $lang['strconstraints'], |
||
| 1586 | 'url' => 'constraints', |
||
| 1587 | 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
||
| 1588 | 'help' => 'pg.constraint', |
||
| 1589 | 'icon' => 'Constraints', |
||
| 1590 | 'branch' => true, |
||
| 1591 | */ |
||
| 1592 | |||
| 1593 | 'rules' => [ |
||
| 1594 | 'title' => $lang['strrules'], |
||
| 1595 | 'url' => 'rules', |
||
| 1596 | 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
||
| 1597 | 'help' => 'pg.rule', |
||
| 1598 | 'icon' => 'Rules', |
||
| 1599 | 'branch' => true, |
||
| 1600 | ], |
||
| 1601 | 'privileges' => [ |
||
| 1602 | 'title' => $lang['strprivileges'], |
||
| 1603 | 'url' => 'privileges', |
||
| 1604 | 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
||
| 1605 | 'help' => 'pg.privilege', |
||
| 1606 | 'icon' => 'Privileges', |
||
| 1607 | ], |
||
| 1608 | 'export' => [ |
||
| 1609 | 'title' => $lang['strexport'], |
||
| 1610 | 'url' => 'materializedviewproperties', |
||
| 1611 | 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview'), 'action' => 'export'], |
||
| 1612 | 'icon' => 'Export', |
||
| 1613 | 'hide' => false, |
||
| 1614 | ], |
||
| 1615 | ]; |
||
| 1616 | |||
| 1617 | break; |
||
| 1618 | case 'function': |
||
| 1619 | $tabs = [ |
||
| 1620 | 'definition' => [ |
||
| 1621 | 'title' => $lang['strdefinition'], |
||
| 1622 | 'url' => 'functions', |
||
| 1623 | 'urlvars' => [ |
||
| 1624 | 'subject' => 'function', |
||
| 1625 | 'function' => Decorator::field('function'), |
||
| 1626 | 'function_oid' => Decorator::field('function_oid'), |
||
| 1627 | 'action' => 'properties', |
||
| 1628 | ], |
||
| 1629 | 'icon' => 'Definition', |
||
| 1630 | ], |
||
| 1631 | 'privileges' => [ |
||
| 1632 | 'title' => $lang['strprivileges'], |
||
| 1633 | 'url' => 'privileges', |
||
| 1634 | 'urlvars' => [ |
||
| 1635 | 'subject' => 'function', |
||
| 1636 | 'function' => Decorator::field('function'), |
||
| 1637 | 'function_oid' => Decorator::field('function_oid'), |
||
| 1638 | ], |
||
| 1639 | 'icon' => 'Privileges', |
||
| 1640 | ], |
||
| 1641 | ]; |
||
| 1642 | |||
| 1643 | break; |
||
| 1644 | case 'aggregate': |
||
| 1645 | $tabs = [ |
||
| 1646 | 'definition' => [ |
||
| 1647 | 'title' => $lang['strdefinition'], |
||
| 1648 | 'url' => 'aggregates', |
||
| 1649 | 'urlvars' => [ |
||
| 1650 | 'subject' => 'aggregate', |
||
| 1651 | 'aggrname' => Decorator::field('aggrname'), |
||
| 1652 | 'aggrtype' => Decorator::field('aggrtype'), |
||
| 1653 | 'action' => 'properties', |
||
| 1654 | ], |
||
| 1655 | 'icon' => 'Definition', |
||
| 1656 | ], |
||
| 1657 | ]; |
||
| 1658 | |||
| 1659 | break; |
||
| 1660 | case 'role': |
||
| 1661 | $tabs = [ |
||
| 1662 | 'definition' => [ |
||
| 1663 | 'title' => $lang['strdefinition'], |
||
| 1664 | 'url' => 'roles', |
||
| 1665 | 'urlvars' => [ |
||
| 1666 | 'subject' => 'role', |
||
| 1667 | 'rolename' => Decorator::field('rolename'), |
||
| 1668 | 'action' => 'properties', |
||
| 1669 | ], |
||
| 1670 | 'icon' => 'Definition', |
||
| 1671 | ], |
||
| 1672 | ]; |
||
| 1673 | |||
| 1674 | break; |
||
| 1675 | case 'popup': |
||
| 1676 | $tabs = [ |
||
| 1677 | 'sql' => [ |
||
| 1678 | 'title' => $lang['strsql'], |
||
| 1679 | 'url' => '/src/views/sqledit', |
||
| 1680 | 'urlvars' => ['action' => 'sql', 'subject' => 'schema'], |
||
| 1681 | 'help' => 'pg.sql', |
||
| 1682 | 'icon' => 'SqlEditor', |
||
| 1683 | ], |
||
| 1684 | 'find' => [ |
||
| 1685 | 'title' => $lang['strfind'], |
||
| 1686 | 'url' => '/src/views/sqledit', |
||
| 1687 | 'urlvars' => ['action' => 'find', 'subject' => 'schema'], |
||
| 1688 | 'icon' => 'Search', |
||
| 1689 | ], |
||
| 1690 | ]; |
||
| 1691 | |||
| 1692 | break; |
||
| 1693 | case 'column': |
||
| 1694 | $tabs = [ |
||
| 1695 | 'properties' => [ |
||
| 1696 | 'title' => $lang['strcolprop'], |
||
| 1697 | 'url' => 'colproperties', |
||
| 1698 | 'urlvars' => [ |
||
| 1699 | 'subject' => 'column', |
||
| 1700 | 'table' => Decorator::field('table'), |
||
| 1701 | 'column' => Decorator::field('column'), |
||
| 1702 | ], |
||
| 1703 | 'icon' => 'Column', |
||
| 1704 | ], |
||
| 1705 | 'privileges' => [ |
||
| 1706 | 'title' => $lang['strprivileges'], |
||
| 1707 | 'url' => 'privileges', |
||
| 1708 | 'urlvars' => [ |
||
| 1709 | 'subject' => 'column', |
||
| 1710 | 'table' => Decorator::field('table'), |
||
| 1711 | 'column' => Decorator::field('column'), |
||
| 1712 | ], |
||
| 1713 | 'help' => 'pg.privilege', |
||
| 1714 | 'icon' => 'Privileges', |
||
| 1715 | ], |
||
| 1716 | ]; |
||
| 1717 | |||
| 1718 | break; |
||
| 1719 | case 'fulltext': |
||
| 1720 | $tabs = [ |
||
| 1721 | 'ftsconfigs' => [ |
||
| 1722 | 'title' => $lang['strftstabconfigs'], |
||
| 1723 | 'url' => 'fulltext', |
||
| 1724 | 'urlvars' => ['subject' => 'schema'], |
||
| 1725 | 'hide' => !$data->hasFTS(), |
||
| 1726 | 'help' => 'pg.ftscfg', |
||
| 1727 | 'tree' => true, |
||
| 1728 | 'icon' => 'FtsCfg', |
||
| 1729 | ], |
||
| 1730 | 'ftsdicts' => [ |
||
| 1731 | 'title' => $lang['strftstabdicts'], |
||
| 1732 | 'url' => 'fulltext', |
||
| 1733 | 'urlvars' => ['subject' => 'schema', 'action' => 'viewdicts'], |
||
| 1734 | 'hide' => !$data->hasFTS(), |
||
| 1735 | 'help' => 'pg.ftsdict', |
||
| 1736 | 'tree' => true, |
||
| 1737 | 'icon' => 'FtsDict', |
||
| 1738 | ], |
||
| 1739 | 'ftsparsers' => [ |
||
| 1740 | 'title' => $lang['strftstabparsers'], |
||
| 1741 | 'url' => 'fulltext', |
||
| 1742 | 'urlvars' => ['subject' => 'schema', 'action' => 'viewparsers'], |
||
| 1743 | 'hide' => !$data->hasFTS(), |
||
| 1744 | 'help' => 'pg.ftsparser', |
||
| 1745 | 'tree' => true, |
||
| 1746 | 'icon' => 'FtsParser', |
||
| 1747 | ], |
||
| 1748 | ]; |
||
| 1749 | |||
| 1750 | break; |
||
| 1751 | } |
||
| 1752 | |||
| 1753 | // Tabs hook's place |
||
| 1754 | $plugin_functions_parameters = [ |
||
| 1755 | 'tabs' => &$tabs, |
||
| 1756 | 'section' => $section, |
||
| 1757 | ]; |
||
| 1758 | $plugin_manager->do_hook('tabs', $plugin_functions_parameters); |
||
| 1759 | |||
| 1760 | return $tabs; |
||
| 1761 | } |
||
| 2130 |