Conditions | 21 |
Paths | 18 |
Total Lines | 693 |
Code Lines | 558 |
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 |
||
404 | public function getNavTabs($section) |
||
405 | { |
||
406 | $data = $this->getDatabaseAccessor(); |
||
407 | $lang = $this->lang; |
||
408 | $plugin_manager = $this->plugin_manager; |
||
409 | |||
410 | $hide_advanced = ($this->conf['show_advanced'] === false); |
||
411 | $tabs = []; |
||
412 | |||
413 | switch ($section) { |
||
414 | case 'root': |
||
415 | $tabs = [ |
||
416 | 'intro' => [ |
||
417 | 'title' => $lang['strintroduction'], |
||
418 | 'url' => 'intro', |
||
419 | 'icon' => 'Introduction', |
||
420 | ], |
||
421 | 'servers' => [ |
||
422 | 'title' => $lang['strservers'], |
||
423 | 'url' => 'servers', |
||
424 | 'icon' => 'Servers', |
||
425 | ], |
||
426 | ]; |
||
427 | |||
428 | break; |
||
429 | case 'server': |
||
430 | $hide_users = true; |
||
431 | $hide_roles = false; |
||
432 | if ($data) { |
||
433 | $hide_users = !$data->isSuperUser(); |
||
434 | } |
||
435 | |||
436 | $tabs = [ |
||
437 | 'databases' => [ |
||
438 | 'title' => $lang['strdatabases'], |
||
439 | 'url' => 'alldb', |
||
440 | 'urlvars' => ['subject' => 'server'], |
||
441 | 'help' => 'pg.database', |
||
442 | 'icon' => 'Databases', |
||
443 | ], |
||
444 | ]; |
||
445 | if ($data && $data->hasRoles()) { |
||
446 | $tabs = array_merge($tabs, [ |
||
447 | 'users' => [ |
||
448 | 'title' => $lang['strusers'], |
||
449 | 'url' => 'users', |
||
450 | 'urlvars' => ['subject' => 'server'], |
||
451 | 'hide' => $hide_roles, |
||
452 | 'help' => 'pg.user', |
||
453 | 'icon' => 'Users', |
||
454 | ], |
||
455 | 'roles' => [ |
||
456 | 'title' => $lang['strroles'], |
||
457 | 'url' => 'roles', |
||
458 | 'urlvars' => ['subject' => 'server'], |
||
459 | 'hide' => $hide_roles, |
||
460 | 'help' => 'pg.role', |
||
461 | 'icon' => 'Roles', |
||
462 | ], |
||
463 | ]); |
||
464 | } else { |
||
465 | $tabs = array_merge($tabs, [ |
||
466 | 'users' => [ |
||
467 | 'title' => $lang['strusers'], |
||
468 | 'url' => 'users', |
||
469 | 'urlvars' => ['subject' => 'server'], |
||
470 | 'hide' => $hide_users, |
||
471 | 'help' => 'pg.user', |
||
472 | 'icon' => 'Users', |
||
473 | ], |
||
474 | 'groups' => [ |
||
475 | 'title' => $lang['strgroups'], |
||
476 | 'url' => 'groups', |
||
477 | 'urlvars' => ['subject' => 'server'], |
||
478 | 'hide' => $hide_users, |
||
479 | 'help' => 'pg.group', |
||
480 | 'icon' => 'UserGroups', |
||
481 | ], |
||
482 | ]); |
||
483 | } |
||
484 | |||
485 | $tabs = array_merge($tabs, [ |
||
486 | 'account' => [ |
||
487 | 'title' => $lang['straccount'], |
||
488 | 'url' => ($data && $data->hasRoles()) ? 'roles' : 'users', |
||
489 | 'urlvars' => ['subject' => 'server', 'action' => 'account'], |
||
490 | 'hide' => !$hide_users, |
||
491 | 'help' => 'pg.role', |
||
492 | 'icon' => 'User', |
||
493 | ], |
||
494 | 'tablespaces' => [ |
||
495 | 'title' => $lang['strtablespaces'], |
||
496 | 'url' => 'tablespaces', |
||
497 | 'urlvars' => ['subject' => 'server'], |
||
498 | 'hide' => !$data || !$data->hasTablespaces(), |
||
499 | 'help' => 'pg.tablespace', |
||
500 | 'icon' => 'Tablespaces', |
||
501 | ], |
||
502 | 'export' => [ |
||
503 | 'title' => $lang['strexport'], |
||
504 | 'url' => 'alldb', |
||
505 | 'urlvars' => ['subject' => 'server', 'action' => 'export'], |
||
506 | 'hide' => !$this->isDumpEnabled(), |
||
507 | 'icon' => 'Export', |
||
508 | ], |
||
509 | ]); |
||
510 | |||
511 | break; |
||
512 | case 'database': |
||
513 | $tabs = [ |
||
514 | 'schemas' => [ |
||
515 | 'title' => $lang['strschemas'], |
||
516 | 'url' => 'schemas', |
||
517 | 'urlvars' => ['subject' => 'database'], |
||
518 | 'help' => 'pg.schema', |
||
519 | 'icon' => 'Schemas', |
||
520 | ], |
||
521 | 'sql' => [ |
||
522 | 'title' => $lang['strsql'], |
||
523 | 'url' => 'database', |
||
524 | 'urlvars' => ['subject' => 'database', 'action' => 'sql', 'new' => 1], |
||
525 | 'help' => 'pg.sql', |
||
526 | 'tree' => false, |
||
527 | 'icon' => 'SqlEditor', |
||
528 | ], |
||
529 | 'find' => [ |
||
530 | 'title' => $lang['strfind'], |
||
531 | 'url' => 'database', |
||
532 | 'urlvars' => ['subject' => 'database', 'action' => 'find'], |
||
533 | 'tree' => false, |
||
534 | 'icon' => 'Search', |
||
535 | ], |
||
536 | 'variables' => [ |
||
537 | 'title' => $lang['strvariables'], |
||
538 | 'url' => 'database', |
||
539 | 'urlvars' => ['subject' => 'database', 'action' => 'variables'], |
||
540 | 'help' => 'pg.variable', |
||
541 | 'tree' => false, |
||
542 | 'icon' => 'Variables', |
||
543 | ], |
||
544 | 'processes' => [ |
||
545 | 'title' => $lang['strprocesses'], |
||
546 | 'url' => 'database', |
||
547 | 'urlvars' => ['subject' => 'database', 'action' => 'processes'], |
||
548 | 'help' => 'pg.process', |
||
549 | 'tree' => false, |
||
550 | 'icon' => 'Processes', |
||
551 | ], |
||
552 | 'locks' => [ |
||
553 | 'title' => $lang['strlocks'], |
||
554 | 'url' => 'database', |
||
555 | 'urlvars' => ['subject' => 'database', 'action' => 'locks'], |
||
556 | 'help' => 'pg.locks', |
||
557 | 'tree' => false, |
||
558 | 'icon' => 'Key', |
||
559 | ], |
||
560 | 'admin' => [ |
||
561 | 'title' => $lang['stradmin'], |
||
562 | 'url' => 'database', |
||
563 | 'urlvars' => ['subject' => 'database', 'action' => 'admin'], |
||
564 | 'tree' => false, |
||
565 | 'icon' => 'Admin', |
||
566 | ], |
||
567 | 'privileges' => [ |
||
568 | 'title' => $lang['strprivileges'], |
||
569 | 'url' => 'privileges', |
||
570 | 'urlvars' => ['subject' => 'database'], |
||
571 | 'hide' => !isset($data->privlist['database']), |
||
572 | 'help' => 'pg.privilege', |
||
573 | 'tree' => false, |
||
574 | 'icon' => 'Privileges', |
||
575 | ], |
||
576 | 'languages' => [ |
||
577 | 'title' => $lang['strlanguages'], |
||
578 | 'url' => 'languages', |
||
579 | 'urlvars' => ['subject' => 'database'], |
||
580 | 'hide' => $hide_advanced, |
||
581 | 'help' => 'pg.language', |
||
582 | 'icon' => 'Languages', |
||
583 | ], |
||
584 | 'casts' => [ |
||
585 | 'title' => $lang['strcasts'], |
||
586 | 'url' => 'casts', |
||
587 | 'urlvars' => ['subject' => 'database'], |
||
588 | 'hide' => $hide_advanced, |
||
589 | 'help' => 'pg.cast', |
||
590 | 'icon' => 'Casts', |
||
591 | ], |
||
592 | 'export' => [ |
||
593 | 'title' => $lang['strexport'], |
||
594 | 'url' => 'database', |
||
595 | 'urlvars' => ['subject' => 'database', 'action' => 'export'], |
||
596 | 'hide' => !$this->isDumpEnabled(), |
||
597 | 'tree' => false, |
||
598 | 'icon' => 'Export', |
||
599 | ], |
||
600 | ]; |
||
601 | |||
602 | break; |
||
603 | case 'schema': |
||
604 | $tabs = [ |
||
605 | 'tables' => [ |
||
606 | 'title' => $lang['strtables'], |
||
607 | 'url' => 'tables', |
||
608 | 'urlvars' => ['subject' => 'schema'], |
||
609 | 'help' => 'pg.table', |
||
610 | 'icon' => 'Tables', |
||
611 | ], |
||
612 | 'views' => [ |
||
613 | 'title' => $lang['strviews'], |
||
614 | 'url' => 'views', |
||
615 | 'urlvars' => ['subject' => 'schema'], |
||
616 | 'help' => 'pg.view', |
||
617 | 'icon' => 'Views', |
||
618 | ], |
||
619 | 'matviews' => [ |
||
620 | 'title' => 'M ' . $lang['strviews'], |
||
621 | 'url' => 'materializedviews', |
||
622 | 'urlvars' => ['subject' => 'schema'], |
||
623 | 'help' => 'pg.matview', |
||
624 | 'icon' => 'MViews', |
||
625 | ], |
||
626 | 'sequences' => [ |
||
627 | 'title' => $lang['strsequences'], |
||
628 | 'url' => 'sequences', |
||
629 | 'urlvars' => ['subject' => 'schema'], |
||
630 | 'help' => 'pg.sequence', |
||
631 | 'icon' => 'Sequences', |
||
632 | ], |
||
633 | 'functions' => [ |
||
634 | 'title' => $lang['strfunctions'], |
||
635 | 'url' => 'functions', |
||
636 | 'urlvars' => ['subject' => 'schema'], |
||
637 | 'help' => 'pg.function', |
||
638 | 'icon' => 'Functions', |
||
639 | ], |
||
640 | 'fulltext' => [ |
||
641 | 'title' => $lang['strfulltext'], |
||
642 | 'url' => 'fulltext', |
||
643 | 'urlvars' => ['subject' => 'schema'], |
||
644 | 'help' => 'pg.fts', |
||
645 | 'tree' => true, |
||
646 | 'icon' => 'Fts', |
||
647 | ], |
||
648 | 'domains' => [ |
||
649 | 'title' => $lang['strdomains'], |
||
650 | 'url' => 'domains', |
||
651 | 'urlvars' => ['subject' => 'schema'], |
||
652 | 'help' => 'pg.domain', |
||
653 | 'icon' => 'Domains', |
||
654 | ], |
||
655 | 'aggregates' => [ |
||
656 | 'title' => $lang['straggregates'], |
||
657 | 'url' => 'aggregates', |
||
658 | 'urlvars' => ['subject' => 'schema'], |
||
659 | 'hide' => $hide_advanced, |
||
660 | 'help' => 'pg.aggregate', |
||
661 | 'icon' => 'Aggregates', |
||
662 | ], |
||
663 | 'types' => [ |
||
664 | 'title' => $lang['strtypes'], |
||
665 | 'url' => 'types', |
||
666 | 'urlvars' => ['subject' => 'schema'], |
||
667 | 'hide' => $hide_advanced, |
||
668 | 'help' => 'pg.type', |
||
669 | 'icon' => 'Types', |
||
670 | ], |
||
671 | 'operators' => [ |
||
672 | 'title' => $lang['stroperators'], |
||
673 | 'url' => 'operators', |
||
674 | 'urlvars' => ['subject' => 'schema'], |
||
675 | 'hide' => $hide_advanced, |
||
676 | 'help' => 'pg.operator', |
||
677 | 'icon' => 'Operators', |
||
678 | ], |
||
679 | 'opclasses' => [ |
||
680 | 'title' => $lang['stropclasses'], |
||
681 | 'url' => 'opclasses', |
||
682 | 'urlvars' => ['subject' => 'schema'], |
||
683 | 'hide' => $hide_advanced, |
||
684 | 'help' => 'pg.opclass', |
||
685 | 'icon' => 'OperatorClasses', |
||
686 | ], |
||
687 | 'conversions' => [ |
||
688 | 'title' => $lang['strconversions'], |
||
689 | 'url' => 'conversions', |
||
690 | 'urlvars' => ['subject' => 'schema'], |
||
691 | 'hide' => $hide_advanced, |
||
692 | 'help' => 'pg.conversion', |
||
693 | 'icon' => 'Conversions', |
||
694 | ], |
||
695 | 'privileges' => [ |
||
696 | 'title' => $lang['strprivileges'], |
||
697 | 'url' => 'privileges', |
||
698 | 'urlvars' => ['subject' => 'schema'], |
||
699 | 'help' => 'pg.privilege', |
||
700 | 'tree' => false, |
||
701 | 'icon' => 'Privileges', |
||
702 | ], |
||
703 | 'export' => [ |
||
704 | 'title' => $lang['strexport'], |
||
705 | 'url' => 'schemas', |
||
706 | 'urlvars' => ['subject' => 'schema', 'action' => 'export'], |
||
707 | 'hide' => !$this->isDumpEnabled(), |
||
708 | 'tree' => false, |
||
709 | 'icon' => 'Export', |
||
710 | ], |
||
711 | ]; |
||
712 | if (!$data->hasFTS()) { |
||
713 | unset($tabs['fulltext']); |
||
714 | } |
||
715 | |||
716 | break; |
||
717 | case 'table': |
||
718 | $tabs = [ |
||
719 | 'columns' => [ |
||
720 | 'title' => $lang['strcolumns'], |
||
721 | 'url' => 'tblproperties', |
||
722 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
723 | 'icon' => 'Columns', |
||
724 | 'branch' => true, |
||
725 | ], |
||
726 | 'browse' => [ |
||
727 | 'title' => $lang['strbrowse'], |
||
728 | 'icon' => 'Columns', |
||
729 | 'url' => 'display', |
||
730 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
731 | 'return' => 'table', |
||
732 | 'branch' => true, |
||
733 | ], |
||
734 | 'select' => [ |
||
735 | 'title' => $lang['strselect'], |
||
736 | 'icon' => 'Search', |
||
737 | 'url' => 'tables', |
||
738 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'confselectrows'], |
||
739 | 'help' => 'pg.sql.select', |
||
740 | ], |
||
741 | 'insert' => [ |
||
742 | 'title' => $lang['strinsert'], |
||
743 | 'url' => 'tables', |
||
744 | 'urlvars' => [ |
||
745 | 'action' => 'confinsertrow', |
||
746 | 'table' => Decorator::field('table'), |
||
747 | ], |
||
748 | 'help' => 'pg.sql.insert', |
||
749 | 'icon' => 'Operator', |
||
750 | ], |
||
751 | 'indexes' => [ |
||
752 | 'title' => $lang['strindexes'], |
||
753 | 'url' => 'indexes', |
||
754 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
755 | 'help' => 'pg.index', |
||
756 | 'icon' => 'Indexes', |
||
757 | 'branch' => true, |
||
758 | ], |
||
759 | 'constraints' => [ |
||
760 | 'title' => $lang['strconstraints'], |
||
761 | 'url' => 'constraints', |
||
762 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
763 | 'help' => 'pg.constraint', |
||
764 | 'icon' => 'Constraints', |
||
765 | 'branch' => true, |
||
766 | ], |
||
767 | 'triggers' => [ |
||
768 | 'title' => $lang['strtriggers'], |
||
769 | 'url' => 'triggers', |
||
770 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
771 | 'help' => 'pg.trigger', |
||
772 | 'icon' => 'Triggers', |
||
773 | 'branch' => true, |
||
774 | ], |
||
775 | 'rules' => [ |
||
776 | 'title' => $lang['strrules'], |
||
777 | 'url' => 'rules', |
||
778 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
779 | 'help' => 'pg.rule', |
||
780 | 'icon' => 'Rules', |
||
781 | 'branch' => true, |
||
782 | ], |
||
783 | 'admin' => [ |
||
784 | 'title' => $lang['stradmin'], |
||
785 | 'url' => 'tables', |
||
786 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'admin'], |
||
787 | 'icon' => 'Admin', |
||
788 | ], |
||
789 | 'info' => [ |
||
790 | 'title' => $lang['strinfo'], |
||
791 | 'url' => 'info', |
||
792 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
793 | 'icon' => 'Statistics', |
||
794 | ], |
||
795 | 'privileges' => [ |
||
796 | 'title' => $lang['strprivileges'], |
||
797 | 'url' => 'privileges', |
||
798 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
||
799 | 'help' => 'pg.privilege', |
||
800 | 'icon' => 'Privileges', |
||
801 | ], |
||
802 | 'import' => [ |
||
803 | 'title' => $lang['strimport'], |
||
804 | 'url' => 'tblproperties', |
||
805 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'import'], |
||
806 | 'icon' => 'Import', |
||
807 | 'hide' => false, |
||
808 | ], |
||
809 | 'export' => [ |
||
810 | 'title' => $lang['strexport'], |
||
811 | 'url' => 'tblproperties', |
||
812 | 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'export'], |
||
813 | 'icon' => 'Export', |
||
814 | 'hide' => false, |
||
815 | ], |
||
816 | ]; |
||
817 | |||
818 | break; |
||
819 | case 'view': |
||
820 | $tabs = [ |
||
821 | 'columns' => [ |
||
822 | 'title' => $lang['strcolumns'], |
||
823 | 'url' => 'viewproperties', |
||
824 | 'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')], |
||
825 | 'icon' => 'Columns', |
||
826 | 'branch' => true, |
||
827 | ], |
||
828 | 'browse' => [ |
||
829 | 'title' => $lang['strbrowse'], |
||
830 | 'icon' => 'Columns', |
||
831 | 'url' => 'display', |
||
832 | 'urlvars' => [ |
||
833 | 'action' => 'confselectrows', |
||
834 | 'return' => 'schema', |
||
835 | 'subject' => 'view', |
||
836 | 'view' => Decorator::field('view'), |
||
837 | ], |
||
838 | 'branch' => true, |
||
839 | ], |
||
840 | 'select' => [ |
||
841 | 'title' => $lang['strselect'], |
||
842 | 'icon' => 'Search', |
||
843 | 'url' => 'views', |
||
844 | 'urlvars' => ['action' => 'confselectrows', 'view' => Decorator::field('view')], |
||
845 | 'help' => 'pg.sql.select', |
||
846 | ], |
||
847 | 'definition' => [ |
||
848 | 'title' => $lang['strdefinition'], |
||
849 | 'url' => 'viewproperties', |
||
850 | 'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view'), 'action' => 'definition'], |
||
851 | 'icon' => 'Definition', |
||
852 | ], |
||
853 | 'rules' => [ |
||
854 | 'title' => $lang['strrules'], |
||
855 | 'url' => 'rules', |
||
856 | 'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')], |
||
857 | 'help' => 'pg.rule', |
||
858 | 'icon' => 'Rules', |
||
859 | 'branch' => true, |
||
860 | ], |
||
861 | 'privileges' => [ |
||
862 | 'title' => $lang['strprivileges'], |
||
863 | 'url' => 'privileges', |
||
864 | 'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')], |
||
865 | 'help' => 'pg.privilege', |
||
866 | 'icon' => 'Privileges', |
||
867 | ], |
||
868 | 'export' => [ |
||
869 | 'title' => $lang['strexport'], |
||
870 | 'url' => 'viewproperties', |
||
871 | 'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view'), 'action' => 'export'], |
||
872 | 'icon' => 'Export', |
||
873 | 'hide' => false, |
||
874 | ], |
||
875 | ]; |
||
876 | |||
877 | break; |
||
878 | case 'matview': |
||
879 | $tabs = [ |
||
880 | 'columns' => [ |
||
881 | 'title' => $lang['strcolumns'], |
||
882 | 'url' => 'materializedviewproperties', |
||
883 | 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
||
884 | 'icon' => 'Columns', |
||
885 | 'branch' => true, |
||
886 | ], |
||
887 | 'browse' => [ |
||
888 | 'title' => $lang['strbrowse'], |
||
889 | 'icon' => 'Columns', |
||
890 | 'url' => 'display', |
||
891 | 'urlvars' => [ |
||
892 | 'action' => 'confselectrows', |
||
893 | 'return' => 'schema', |
||
894 | 'subject' => 'matview', |
||
895 | 'matview' => Decorator::field('matview'), |
||
896 | ], |
||
897 | 'branch' => true, |
||
898 | ], |
||
899 | 'select' => [ |
||
900 | 'title' => $lang['strselect'], |
||
901 | 'icon' => 'Search', |
||
902 | 'url' => 'materializedviews', |
||
903 | 'urlvars' => ['action' => 'confselectrows', 'matview' => Decorator::field('matview')], |
||
904 | 'help' => 'pg.sql.select', |
||
905 | ], |
||
906 | 'definition' => [ |
||
907 | 'title' => $lang['strdefinition'], |
||
908 | 'url' => 'materializedviewproperties', |
||
909 | 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview'), 'action' => 'definition'], |
||
910 | 'icon' => 'Definition', |
||
911 | ], |
||
912 | 'indexes' => [ |
||
913 | 'title' => $lang['strindexes'], |
||
914 | 'url' => 'indexes', |
||
915 | 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
||
916 | 'help' => 'pg.index', |
||
917 | 'icon' => 'Indexes', |
||
918 | 'branch' => true, |
||
919 | ], |
||
920 | /*'constraints' => [ |
||
921 | 'title' => $lang['strconstraints'], |
||
922 | 'url' => 'constraints', |
||
923 | 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
||
924 | 'help' => 'pg.constraint', |
||
925 | 'icon' => 'Constraints', |
||
926 | 'branch' => true, |
||
927 | */ |
||
928 | |||
929 | 'rules' => [ |
||
930 | 'title' => $lang['strrules'], |
||
931 | 'url' => 'rules', |
||
932 | 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
||
933 | 'help' => 'pg.rule', |
||
934 | 'icon' => 'Rules', |
||
935 | 'branch' => true, |
||
936 | ], |
||
937 | 'privileges' => [ |
||
938 | 'title' => $lang['strprivileges'], |
||
939 | 'url' => 'privileges', |
||
940 | 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
||
941 | 'help' => 'pg.privilege', |
||
942 | 'icon' => 'Privileges', |
||
943 | ], |
||
944 | 'export' => [ |
||
945 | 'title' => $lang['strexport'], |
||
946 | 'url' => 'materializedviewproperties', |
||
947 | 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview'), 'action' => 'export'], |
||
948 | 'icon' => 'Export', |
||
949 | 'hide' => false, |
||
950 | ], |
||
951 | ]; |
||
952 | |||
953 | break; |
||
954 | case 'function': |
||
955 | $tabs = [ |
||
956 | 'definition' => [ |
||
957 | 'title' => $lang['strdefinition'], |
||
958 | 'url' => 'functions', |
||
959 | 'urlvars' => [ |
||
960 | 'subject' => 'function', |
||
961 | 'function' => Decorator::field('function'), |
||
962 | 'function_oid' => Decorator::field('function_oid'), |
||
963 | 'action' => 'properties', |
||
964 | ], |
||
965 | 'icon' => 'Definition', |
||
966 | ], |
||
967 | 'privileges' => [ |
||
968 | 'title' => $lang['strprivileges'], |
||
969 | 'url' => 'privileges', |
||
970 | 'urlvars' => [ |
||
971 | 'subject' => 'function', |
||
972 | 'function' => Decorator::field('function'), |
||
973 | 'function_oid' => Decorator::field('function_oid'), |
||
974 | ], |
||
975 | 'icon' => 'Privileges', |
||
976 | ], |
||
977 | ]; |
||
978 | |||
979 | break; |
||
980 | case 'aggregate': |
||
981 | $tabs = [ |
||
982 | 'definition' => [ |
||
983 | 'title' => $lang['strdefinition'], |
||
984 | 'url' => 'aggregates', |
||
985 | 'urlvars' => [ |
||
986 | 'subject' => 'aggregate', |
||
987 | 'aggrname' => Decorator::field('aggrname'), |
||
988 | 'aggrtype' => Decorator::field('aggrtype'), |
||
989 | 'action' => 'properties', |
||
990 | ], |
||
991 | 'icon' => 'Definition', |
||
992 | ], |
||
993 | ]; |
||
994 | |||
995 | break; |
||
996 | case 'role': |
||
997 | $tabs = [ |
||
998 | 'definition' => [ |
||
999 | 'title' => $lang['strdefinition'], |
||
1000 | 'url' => 'roles', |
||
1001 | 'urlvars' => [ |
||
1002 | 'subject' => 'role', |
||
1003 | 'rolename' => Decorator::field('rolename'), |
||
1004 | 'action' => 'properties', |
||
1005 | ], |
||
1006 | 'icon' => 'Definition', |
||
1007 | ], |
||
1008 | ]; |
||
1009 | |||
1010 | break; |
||
1011 | case 'popup': |
||
1012 | $tabs = [ |
||
1013 | 'sql' => [ |
||
1014 | 'title' => $lang['strsql'], |
||
1015 | 'url' => \SUBFOLDER . '/src/views/sqledit', |
||
1016 | 'urlvars' => ['action' => 'sql', 'subject' => 'schema'], |
||
1017 | 'help' => 'pg.sql', |
||
1018 | 'icon' => 'SqlEditor', |
||
1019 | ], |
||
1020 | 'find' => [ |
||
1021 | 'title' => $lang['strfind'], |
||
1022 | 'url' => \SUBFOLDER . '/src/views/sqledit', |
||
1023 | 'urlvars' => ['action' => 'find', 'subject' => 'schema'], |
||
1024 | 'icon' => 'Search', |
||
1025 | ], |
||
1026 | ]; |
||
1027 | |||
1028 | break; |
||
1029 | case 'column': |
||
1030 | $tabs = [ |
||
1031 | 'properties' => [ |
||
1032 | 'title' => $lang['strcolprop'], |
||
1033 | 'url' => 'colproperties', |
||
1034 | 'urlvars' => [ |
||
1035 | 'subject' => 'column', |
||
1036 | 'table' => Decorator::field('table'), |
||
1037 | 'column' => Decorator::field('column'), |
||
1038 | ], |
||
1039 | 'icon' => 'Column', |
||
1040 | ], |
||
1041 | 'privileges' => [ |
||
1042 | 'title' => $lang['strprivileges'], |
||
1043 | 'url' => 'privileges', |
||
1044 | 'urlvars' => [ |
||
1045 | 'subject' => 'column', |
||
1046 | 'table' => Decorator::field('table'), |
||
1047 | 'column' => Decorator::field('column'), |
||
1048 | ], |
||
1049 | 'help' => 'pg.privilege', |
||
1050 | 'icon' => 'Privileges', |
||
1051 | ], |
||
1052 | ]; |
||
1053 | |||
1054 | break; |
||
1055 | case 'fulltext': |
||
1056 | $tabs = [ |
||
1057 | 'ftsconfigs' => [ |
||
1058 | 'title' => $lang['strftstabconfigs'], |
||
1059 | 'url' => 'fulltext', |
||
1060 | 'urlvars' => ['subject' => 'schema'], |
||
1061 | 'hide' => !$data->hasFTS(), |
||
1062 | 'help' => 'pg.ftscfg', |
||
1063 | 'tree' => true, |
||
1064 | 'icon' => 'FtsCfg', |
||
1065 | ], |
||
1066 | 'ftsdicts' => [ |
||
1067 | 'title' => $lang['strftstabdicts'], |
||
1068 | 'url' => 'fulltext', |
||
1069 | 'urlvars' => ['subject' => 'schema', 'action' => 'viewdicts'], |
||
1070 | 'hide' => !$data->hasFTS(), |
||
1071 | 'help' => 'pg.ftsdict', |
||
1072 | 'tree' => true, |
||
1073 | 'icon' => 'FtsDict', |
||
1074 | ], |
||
1075 | 'ftsparsers' => [ |
||
1076 | 'title' => $lang['strftstabparsers'], |
||
1077 | 'url' => 'fulltext', |
||
1078 | 'urlvars' => ['subject' => 'schema', 'action' => 'viewparsers'], |
||
1079 | 'hide' => !$data->hasFTS(), |
||
1080 | 'help' => 'pg.ftsparser', |
||
1081 | 'tree' => true, |
||
1082 | 'icon' => 'FtsParser', |
||
1083 | ], |
||
1084 | ]; |
||
1085 | |||
1086 | break; |
||
1087 | } |
||
1088 | |||
1089 | // Tabs hook's place |
||
1090 | $plugin_functions_parameters = [ |
||
1091 | 'tabs' => &$tabs, |
||
1092 | 'section' => $section, |
||
1093 | ]; |
||
1094 | $plugin_manager->doHook('tabs', $plugin_functions_parameters); |
||
1095 | |||
1096 | return $tabs; |
||
1097 | } |
||
1120 |