Merge pull request #10625 from mickadoo/CRM-20833-update-api4-entity-namespace
[civicrm-core.git] / CRM / Case / Info.php
index f361cfb6b06d341ebac179e1633c626ff009a877..a1e5ebbe2123935c8437389eda14d5217bb1ca97 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016                                |
+ | Copyright CiviCRM LLC (c) 2004-2017                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -31,7 +31,7 @@
  * abstract class.
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2016
+ * @copyright CiviCRM LLC (c) 2004-2017
  */
 class CRM_Case_Info extends CRM_Core_Component_Info {
 
@@ -59,19 +59,10 @@ class CRM_Case_Info extends CRM_Core_Component_Info {
    * @inheritDoc
    */
   public function getAngularModules() {
-    $result = array();
-    $result['crmCaseType'] = array(
-      'ext' => 'civicrm',
-      'js' => array('ang/crmCaseType.js'),
-      'css' => array('ang/crmCaseType.css'),
-      'partials' => array('ang/crmCaseType'),
-    );
+    global $civicrm_root;
 
-    CRM_Core_Resources::singleton()->addSetting(array(
-      'crmCaseType' => array(
-        'REL_TYPE_CNAME' => CRM_Case_XMLProcessor::REL_TYPE_CNAME,
-      ),
-    ));
+    $result = array();
+    $result['crmCaseType'] = include "$civicrm_root/ang/crmCaseType.ang.php";
     return $result;
   }
 
@@ -212,15 +203,12 @@ class CRM_Case_Info extends CRM_Core_Component_Info {
     if (CRM_Core_Permission::check('access all cases and activities') ||
       CRM_Core_Permission::check('add cases')
     ) {
-      $atype = CRM_Core_OptionGroup::getValue('activity_type',
-        'Open Case',
-        'name'
-      );
-      if ($atype) {
+      $activityType = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Open Case');
+      if ($activityType) {
         $shortCuts = array_merge($shortCuts, array(
           array(
             'path' => 'civicrm/case/add',
-            'query' => "reset=1&action=add&atype=$atype&context=standalone",
+            'query' => "reset=1&action=add&atype={$activityType}&context=standalone",
             'ref' => 'new-case',
             'title' => ts('Case'),
           ),
@@ -257,4 +245,40 @@ class CRM_Case_Info extends CRM_Core_Component_Info {
     }
   }
 
+  /**
+   * @return array
+   *   Array(string $value => string $label).
+   */
+  public static function getRedactOptions() {
+    return array(
+      'default' => ts('Default'),
+      '0' => ts('Do not redact emails'),
+      '1' => ts('Redact emails'),
+    );
+  }
+
+  /**
+   * @return array
+   *   Array(string $value => string $label).
+   */
+  public static function getMultiClientOptions() {
+    return array(
+      'default' => ts('Default'),
+      '0' => ts('Single client per case'),
+      '1' => ts('Multiple client per case'),
+    );
+  }
+
+  /**
+   * @return array
+   *   Array(string $value => string $label).
+   */
+  public static function getSortOptions() {
+    return array(
+      'default' => ts('Default'),
+      '0' => ts('Definition order'),
+      '1' => ts('Alphabetical order'),
+    );
+  }
+
 }