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