当前位置: 首页>>代码示例>>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;未经允许,请勿转载。