3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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-2013
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 getManagedEntities() {
57 // Use hook_civicrm_caseTypes to build a list of OptionValues
58 // In the long run, we may want more specialized logic for this, but
59 // this design is fairly convenient and will allow us to replace it
60 // without changing the hook_civicrm_caseTypes interface.
64 CRM_Utils_Hook
::caseTypes($caseTypes);
66 $proc = new CRM_Case_XMLProcessor();
67 $caseTypesGroupId = civicrm_api3('OptionGroup', 'getvalue', array('name' => 'case_type', 'return' => 'id'));
68 if (!is_numeric($caseTypesGroupId)) {
69 throw new CRM_Core_Exception("Found invalid ID for OptionGroup (case_type)");
71 foreach ($caseTypes as $name => $caseType) {
72 $xml = $proc->retrieve($name);
74 throw new CRM_Core_Exception("Failed to load XML for case type (" . $name . ")");
77 if (isset($caseType['module'], $caseType['name'], $caseType['file'])) {
79 'module' => $caseType['module'],
80 'name' => $caseType['name'],
81 'entity' => 'OptionValue',
84 'name' => $caseType['name'],
85 'label' => (string) $xml->name
,
86 'description' => (string) $xml->description
, // CRM_Utils_Array::value('description', $caseType, ''),
87 'option_group_id' => $caseTypesGroupId,
93 throw new CRM_Core_Exception("Invalid case type");
100 // docs inherited from interface
101 public function getPermissions($getAllUnconditionally = FALSE) {
103 'delete in CiviCase',
104 'administer CiviCase',
105 'access my cases and activities',
106 'access all cases and activities',
111 // docs inherited from interface
112 public function getUserDashboardElement() {
116 // docs inherited from interface
117 public function registerTab() {
118 return array('title' => ts('Cases'),
124 // docs inherited from interface
125 public function registerAdvancedSearchPane() {
126 return array('title' => ts('Cases'),
131 // docs inherited from interface
132 public function getActivityTypes() {
136 // add shortcut to Create New
137 public function creatNewShortcut(&$shortCuts) {
138 if (CRM_Core_Permission
::check('access all cases and activities') ||
139 CRM_Core_Permission
::check('add cases')
141 $atype = CRM_Core_OptionGroup
::getValue('activity_type',
146 $shortCuts = array_merge($shortCuts, array(
147 array('path' => 'civicrm/case/add',
148 'query' => "reset=1&action=add&atype=$atype&context=standalone",
150 'title' => ts('Case'),