3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
29 * This class introduces component to the system and provides all the
30 * information about it. It needs to extend CRM_Core_Component_Info
34 * @copyright CiviCRM LLC (c) 2004-2014
38 class CRM_Case_Info
extends CRM_Core_Component_Info
{
41 // docs inherited from interface
42 protected $keyword = 'case';
44 // docs inherited from interface
45 public function getInfo() {
48 'translatedName' => ts('CiviCase'),
49 'title' => ts('CiviCase Engine'),
51 'showActivitiesInCore' => 0,
55 // docs inherited from interface
56 public function getPermissions($getAllUnconditionally = FALSE) {
59 'administer CiviCase',
60 'access my cases and activities',
61 'access all cases and activities',
66 // docs inherited from interface
67 public function getUserDashboardElement() {
71 // docs inherited from interface
72 public function registerTab() {
73 return array('title' => ts('Cases'),
79 // docs inherited from interface
80 public function registerAdvancedSearchPane() {
81 return array('title' => ts('Cases'),
86 // docs inherited from interface
87 public function getActivityTypes() {
91 // add shortcut to Create New
92 public function creatNewShortcut(&$shortCuts) {
93 if (CRM_Core_Permission
::check('access all cases and activities') ||
94 CRM_Core_Permission
::check('add cases')
96 $atype = CRM_Core_OptionGroup
::getValue('activity_type',
101 $shortCuts = array_merge($shortCuts, array(
102 array('path' => 'civicrm/case/add',
103 'query' => "reset=1&action=add&atype=$atype&context=standalone",
105 'title' => ts('Case'),
113 * Respond to changes in the "enable_components" setting
115 * If CiviCase is being enabled, load the case related sample data
117 * @param array $oldValue List of component names
118 * @param array $newValue List of component names
119 * @param array $metadata Specification of the setting (per *.settings.php)
121 public static function onToggleComponents($oldValue, $newValue, $metadata) {
123 in_array('CiviCase', $newValue)
125 (!$oldValue ||
!in_array('CiviCase', $oldValue))
127 $config = CRM_Core_Config
::singleton();
128 CRM_Admin_Form_Setting_Component
::loadCaseSampleData($config->dsn
, $config->sqlDir
. 'case_sample.mysql');
129 if (!CRM_Case_BAO_Case
::createCaseViews()) {
130 $msg = ts("Could not create the MySQL views for CiviCase. Your mysql user needs to have the 'CREATE VIEW' permission");
131 CRM_Core_Error
::fatal($msg);