Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06b69b18 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | ||
28 | /** | |
29 | * | |
30 | * @package CRM | |
06b69b18 | 31 | * @copyright CiviCRM LLC (c) 2004-2014 |
6a488035 TO |
32 | * $Id$ |
33 | * | |
34 | */ | |
35 | ||
36 | /** | |
37 | * Page for displaying Administer CiviCRM Control Panel | |
38 | */ | |
39 | class CRM_Admin_Page_Admin extends CRM_Core_Page { | |
e0ef6999 EM |
40 | /** |
41 | * @return string | |
42 | */ | |
00be9182 | 43 | public function run() { |
6a488035 TO |
44 | $errorMessage = ''; |
45 | // ensure that all CiviCRM tables are InnoDB, else abort | |
46 | // this is not a very fast operation, so we do it randomly 10% of the times | |
47 | // but we do it for most / all tables | |
48 | // http://bugs.mysql.com/bug.php?id=43664 | |
49 | if (rand(1, 10) == 3 && | |
50 | CRM_Core_DAO::isDBMyISAM(150) | |
51 | ) { | |
52 | $errorMessage = ts('Your database is configured to use the MyISAM database engine. CiviCRM requires InnoDB. You will need to convert any MyISAM tables in your database to InnoDB. Using MyISAM tables will result in data integrity issues.'); | |
53 | CRM_Core_Session::setStatus($errorMessage, ts('Warning'), "alert"); | |
54 | } | |
55 | ||
56 | if (!CRM_Utils_System::isDBVersionValid($errorMessage)) { | |
42daf119 | 57 | CRM_Core_Session::setStatus($errorMessage, ts('Warning'), "alert", array('expires' => 0)); |
6a488035 TO |
58 | } |
59 | ||
60 | $groups = array('Customize Data and Screens' => ts('Customize Data and Screens'), | |
61 | 'Communications' => ts('Communications'), | |
62 | 'Localization' => ts('Localization'), | |
63 | 'Users and Permissions' => ts('Users and Permissions'), | |
64 | 'System Settings' => ts('System Settings'), | |
65 | ); | |
66 | ||
67 | $config = CRM_Core_Config::singleton(); | |
68 | if (in_array('CiviContribute', $config->enableComponents)) { | |
69 | $groups['CiviContribute'] = ts('CiviContribute'); | |
70 | } | |
71 | ||
72 | if (in_array('CiviMember', $config->enableComponents)) { | |
73 | $groups['CiviMember'] = ts('CiviMember'); | |
74 | } | |
75 | ||
76 | if (in_array('CiviEvent', $config->enableComponents)) { | |
77 | $groups['CiviEvent'] = ts('CiviEvent'); | |
78 | } | |
79 | ||
80 | if (in_array('CiviMail', $config->enableComponents)) { | |
81 | $groups['CiviMail'] = ts('CiviMail'); | |
82 | } | |
83 | ||
84 | if (in_array('CiviCase', $config->enableComponents)) { | |
85 | $groups['CiviCase'] = ts('CiviCase'); | |
86 | } | |
87 | ||
88 | if (in_array('CiviReport', $config->enableComponents)) { | |
89 | $groups['CiviReport'] = ts('CiviReport'); | |
90 | } | |
91 | ||
92 | if (in_array('CiviCampaign', $config->enableComponents)) { | |
93 | $groups['CiviCampaign'] = ts('CiviCampaign'); | |
94 | } | |
95 | ||
96 | $values = CRM_Core_Menu::getAdminLinks(); | |
97 | ||
98 | $this->_showHide = new CRM_Core_ShowHideBlocks(); | |
99 | foreach ($groups as $group => $title) { | |
100 | $groupId = str_replace(' ', '_', $group); | |
8ef12e64 | 101 | |
6a488035 TO |
102 | $this->_showHide->addShow("id_{$groupId}_show"); |
103 | $this->_showHide->addHide("id_{$groupId}"); | |
104 | $v = CRM_Core_ShowHideBlocks::links($this, $groupId, '', '', FALSE); | |
105 | if (isset($values[$group])) { | |
106 | $adminPanel[$groupId] = $values[$group]; | |
107 | $adminPanel[$groupId]['show'] = $v['show']; | |
108 | $adminPanel[$groupId]['hide'] = $v['hide']; | |
109 | $adminPanel[$groupId]['title'] = $title; | |
110 | } else { | |
111 | $adminPanel[$groupId] = array(); | |
112 | $adminPanel[$groupId]['show'] = ''; | |
113 | $adminPanel[$groupId]['hide'] = ''; | |
114 | $adminPanel[$groupId]['title'] = $title; | |
115 | } | |
116 | } | |
117 | $this->assign('adminPanel', $adminPanel); | |
118 | $this->_showHide->addToTemplate(); | |
119 | return parent::run(); | |
120 | } | |
121 | } |