INFRA-132 - Fix spacing of @return tag in comments
[civicrm-core.git] / CRM / Admin / Page / Admin.php
CommitLineData
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 */
39class 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
02fc859b
TO
60 $groups = array(
61 'Customize Data and Screens' => ts('Customize Data and Screens'),
6a488035
TO
62 'Communications' => ts('Communications'),
63 'Localization' => ts('Localization'),
64 'Users and Permissions' => ts('Users and Permissions'),
65 'System Settings' => ts('System Settings'),
66 );
67
68 $config = CRM_Core_Config::singleton();
69 if (in_array('CiviContribute', $config->enableComponents)) {
70 $groups['CiviContribute'] = ts('CiviContribute');
71 }
72
73 if (in_array('CiviMember', $config->enableComponents)) {
74 $groups['CiviMember'] = ts('CiviMember');
75 }
76
77 if (in_array('CiviEvent', $config->enableComponents)) {
78 $groups['CiviEvent'] = ts('CiviEvent');
79 }
80
81 if (in_array('CiviMail', $config->enableComponents)) {
82 $groups['CiviMail'] = ts('CiviMail');
83 }
84
85 if (in_array('CiviCase', $config->enableComponents)) {
86 $groups['CiviCase'] = ts('CiviCase');
87 }
88
89 if (in_array('CiviReport', $config->enableComponents)) {
90 $groups['CiviReport'] = ts('CiviReport');
91 }
92
93 if (in_array('CiviCampaign', $config->enableComponents)) {
94 $groups['CiviCampaign'] = ts('CiviCampaign');
95 }
96
97 $values = CRM_Core_Menu::getAdminLinks();
98
99 $this->_showHide = new CRM_Core_ShowHideBlocks();
100 foreach ($groups as $group => $title) {
101 $groupId = str_replace(' ', '_', $group);
8ef12e64 102
6a488035
TO
103 $this->_showHide->addShow("id_{$groupId}_show");
104 $this->_showHide->addHide("id_{$groupId}");
105 $v = CRM_Core_ShowHideBlocks::links($this, $groupId, '', '', FALSE);
106 if (isset($values[$group])) {
107 $adminPanel[$groupId] = $values[$group];
108 $adminPanel[$groupId]['show'] = $v['show'];
109 $adminPanel[$groupId]['hide'] = $v['hide'];
110 $adminPanel[$groupId]['title'] = $title;
0db6c3e1
TO
111 }
112 else {
6a488035
TO
113 $adminPanel[$groupId] = array();
114 $adminPanel[$groupId]['show'] = '';
115 $adminPanel[$groupId]['hide'] = '';
116 $adminPanel[$groupId]['title'] = $title;
117 }
118 }
119 $this->assign('adminPanel', $adminPanel);
120 $this->_showHide->addToTemplate();
121 return parent::run();
122 }
123}