當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Utils_Hook::dashboard_defaults方法代碼示例

本文整理匯總了PHP中CRM_Utils_Hook::dashboard_defaults方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Utils_Hook::dashboard_defaults方法的具體用法?PHP CRM_Utils_Hook::dashboard_defaults怎麽用?PHP CRM_Utils_Hook::dashboard_defaults使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Utils_Hook的用法示例。


在下文中一共展示了CRM_Utils_Hook::dashboard_defaults方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: initializeDashlets

 /**
  * Setup default dashlets for new users.
  *
  * When a user accesses their dashboard for the first time, set up
  * the default dashlets.
  *
  * @param bool $flatFormat
  *
  * @return array
  *    Array of dashboard_id's
  * @throws \CiviCRM_API3_Exception
  */
 public static function initializeDashlets($flatFormat = FALSE)
 {
     $dashlets = array();
     $getDashlets = civicrm_api3("Dashboard", "get", array('domain_id' => CRM_Core_Config::domainID(), 'option.limit' => 0));
     $contactID = CRM_Core_Session::singleton()->getLoggedInContactID();
     $allDashlets = CRM_Utils_Array::index(array('name'), $getDashlets['values']);
     $defaultDashlets = array();
     $defaults = array('blog' => 1, 'getting-started' => '0');
     foreach ($defaults as $name => $column) {
         if (!empty($allDashlets[$name])) {
             $defaultDashlets[$name] = array('dashboard_id' => $allDashlets[$name]['id'], 'is_active' => 1, 'column_no' => $column, 'contact_id' => $contactID);
         }
     }
     CRM_Utils_Hook::dashboard_defaults($allDashlets, $defaultDashlets);
     if (is_array($defaultDashlets) && !empty($defaultDashlets)) {
         foreach ($defaultDashlets as $id => $defaultDashlet) {
             $dashboard_id = $defaultDashlet['dashboard_id'];
             if (!self::checkPermission($getDashlets['values'][$dashboard_id]['permission'], CRM_Utils_Array::value('permission_operator', $getDashlets['values'][$dashboard_id]))) {
                 continue;
             } else {
                 $assignDashlets = civicrm_api3("dashboard_contact", "create", $defaultDashlet);
                 if (!$flatFormat) {
                     $values = $assignDashlets['values'][$assignDashlets['id']];
                     $dashlets[$values['column_no']][$values['weight'] - $values['dashboard_id']] = $values['is_minimized'];
                 } else {
                     $dashlets[$dashboard_id] = $defaultDashlet['dashboard_id'];
                 }
             }
         }
     }
     return $dashlets;
 }
開發者ID:saurabhbatra96,項目名稱:civicrm-core,代碼行數:44,代碼來源:Dashboard.php

示例2: initializeDashlets

 /**
  * @param $hasDashlets
  *
  * @return bool
  * @throws CiviCRM_API3_Exception
  */
 static function initializeDashlets($hasDashlets)
 {
     $getDashlets = civicrm_api3("Dashboard", "get", array('domain_id' => CRM_Core_Config::domainID()));
     $contactID = CRM_Core_Session::singleton()->get('userID');
     $allDashlets = CRM_Utils_Array::index(array('name'), $getDashlets['values']);
     $defaultDashlets = array();
     if (!$hasDashlets && !empty($allDashlets['blog'])) {
         $defaultDashlets['blog'] = array('dashboard_id' => $allDashlets['blog']['id'], 'is_active' => 1, 'column_no' => 1, 'contact_id' => $contactID, 'domain_id' => CRM_Core_Config::domainID());
     }
     CRM_Utils_Hook::dashboard_defaults($allDashlets, $defaultDashlets);
     if (is_array($defaultDashlets) && !empty($defaultDashlets)) {
         foreach ($defaultDashlets as $defaultDashlet) {
             if (!self::checkPermission($getDashlets['values'][$defaultDashlet['dashboard_id']]['permission'], $getDashlets['values'][$defaultDashlet['dashboard_id']]['permission_operator'])) {
                 unset($defaultDashlets[$defaultDashlet]);
                 continue;
             } else {
                 $assignDashlets = civicrm_api3("dashboard_contact", "create", $defaultDashlet);
                 $dashlets[$defaultDashlet['dashboard_id']] = $defaultDashlet['dashboard_id'];
             }
         }
         return $dashlets;
     }
     return FALSE;
 }
開發者ID:prashantgajare,項目名稱:civicrm-core,代碼行數:30,代碼來源:Dashboard.php


注:本文中的CRM_Utils_Hook::dashboard_defaults方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。