当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_BAO_Navigation类代码示例

本文整理汇总了PHP中CRM_Core_BAO_Navigation的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Navigation类的具体用法?PHP CRM_Core_BAO_Navigation怎么用?PHP CRM_Core_BAO_Navigation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CRM_Core_BAO_Navigation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smarty_function_crmNavigationMenu

/**
 * Output navigation script tag
 *
 * @param array $params
 *   - is_default: bool, true if this is normal/default instance of the menu (which may be subject to CIVICRM_DISABLE_DEFAULT_MENU)
 * @param object $smarty the Smarty object
 *
 * @return string HTML
 */
function smarty_function_crmNavigationMenu($params, &$smarty)
{
    $config = CRM_Core_Config::singleton();
    //check if logged in user has access CiviCRM permission and build menu
    $buildNavigation = !CRM_Core_Config::isUpgradeMode() && CRM_Core_Permission::check('access CiviCRM');
    if (defined('CIVICRM_DISABLE_DEFAULT_MENU') && CRM_Utils_Array::value('is_default', $params, FALSE)) {
        $buildNavigation = FALSE;
    }
    if ($config->userFrameworkFrontend) {
        $buildNavigation = FALSE;
    }
    if ($buildNavigation) {
        $session = CRM_Core_Session::singleton();
        $contactID = $session->get('userID');
        if ($contactID) {
            // These params force the browser to refresh the js file when switching user, domain, or language
            // We don't put them as a query string because some browsers will refuse to cache a page with a ? in the url
            // We end the string with .js to trick apache mods into sending pro-caching headers
            // @see CRM_Admin_Page_AJAX::getNavigationMenu
            $lang = $config->lcMessages;
            $domain = CRM_Core_Config::domainID();
            $key = CRM_Core_BAO_Navigation::getCacheKey($contactID);
            $src = CRM_Utils_System::url("civicrm/ajax/menujs/{$contactID}/{$lang}/{$domain}/{$key}.js");
            return '<script type="text/javascript" src="' . $src . '"></script>';
        }
    }
    return '';
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:37,代码来源:function.crmNavigationMenu.php

示例2: eventpermissions_civicrm_navigationMenu

/**
 * Implements hook_civicrm_navigationMenu().
 */
function eventpermissions_civicrm_navigationMenu(&$params)
{
    $searchParams = array('url' => 'civicrm/eventpermissions?reset=1');
    $menuItems = array();
    CRM_Core_BAO_Navigation::retrieve($searchParams, $menuItems);
    if (!empty($menuItems)) {
        return;
    }
    $searchParams = array('url' => 'civicrm/admin/options/participant_role?reset=1');
    $menuItems = array();
    CRM_Core_BAO_Navigation::retrieve($searchParams, $menuItems);
    $parent = CRM_Utils_Array::value('parent_id', $menuItems);
    $navId = CRM_Core_DAO::singleValueQuery("SELECT max(id) FROM civicrm_navigation");
    if (is_int($navId)) {
        $navId++;
    }
    $basicAttrs = array('label' => ts('Event Permissions', array('domain' => 'com.aghstrategies.eventpermissions')), 'name' => 'Event Permissions', 'url' => 'civicrm/eventpermissions?reset=1', 'permission' => 'administer CiviCRM', 'active' => 1, 'navID' => $navId, 'parentID' => $parent);
    $searchParams = array('id' => $parent);
    $menuItems = array();
    CRM_Core_BAO_Navigation::retrieve($searchParams, $menuItems);
    if (empty($menuItems['parent_id'])) {
        $params[$parent]['child'][$navId] = $basicAttrs;
    } else {
        $params[$menuItems['parent_id']]['child'][$parent]['child'][$navId] = array('attributes' => $basicAttrs);
    }
}
开发者ID:aghstrategies,项目名称:com.aghstrategies.eventpermissions,代码行数:29,代码来源:eventpermissions.php

示例3: smarty_function_crmNavigationMenu

/**
 * Output navigation script tag
 *
 * @param array $params
 *   - is_default: bool, true if this is normal/default instance of the menu (which may be subject to CIVICRM_DISABLE_DEFAULT_MENU)
 * @param CRM_Core_Smarty $smarty
 *   The Smarty object.
 *
 * @return string
 *   HTML
 */
function smarty_function_crmNavigationMenu($params, &$smarty)
{
    $config = CRM_Core_Config::singleton();
    //check if logged in user has access CiviCRM permission and build menu
    $buildNavigation = !CRM_Core_Config::isUpgradeMode() && CRM_Core_Permission::check('access CiviCRM');
    if (defined('CIVICRM_DISABLE_DEFAULT_MENU') && CRM_Utils_Array::value('is_default', $params, FALSE)) {
        $buildNavigation = FALSE;
    }
    if ($config->userFrameworkFrontend) {
        $buildNavigation = FALSE;
    }
    if ($buildNavigation) {
        $session = CRM_Core_Session::singleton();
        $contactID = $session->get('userID');
        if ($contactID) {
            // These params force the browser to refresh the js file when switching user, domain, or language
            // We don't put them as a query string because some browsers will refuse to cache a page with a ? in the url
            // @see CRM_Admin_Page_AJAX::getNavigationMenu
            $lang = $config->lcMessages;
            $domain = CRM_Core_Config::domainID();
            $key = CRM_Core_BAO_Navigation::getCacheKey($contactID);
            $src = CRM_Utils_System::url("civicrm/ajax/menujs/{$contactID}/{$lang}/{$domain}/{$key}");
            // CRM-15493 QFkey needed for quicksearch bar - must be unique on each page refresh so adding it directly to markup
            $qfKey = CRM_Core_Key::get('CRM_Contact_Controller_Search', TRUE);
            return '<script id="civicrm-navigation-menu" type="text/javascript" src="' . $src . '" data-qfkey=' . json_encode($qfKey) . '></script>';
        }
    }
    return '';
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:40,代码来源:function.crmNavigationMenu.php

示例4: civicrm_api3_navigation_reset

/**
 * Reset navigation.
 *
 * @param array $params
 *   Array of name/value pairs.
 *
 * @return array
 *   API result array.
 */
function civicrm_api3_navigation_reset($params)
{
    if ($params['for'] == 'report') {
        CRM_Core_BAO_Navigation::rebuildReportsNavigation($params['domain_id']);
    }
    CRM_Core_BAO_Navigation::resetNavigation();
    return civicrm_api3_create_success(1, $params, 'navigation', 'reset');
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:17,代码来源:Navigation.php

示例5: run

 /**
  * Run this page (figure out the action needed and perform it).
  */
 public function run()
 {
     $instanceId = CRM_Report_Utils_Report::getInstanceID();
     if (!$instanceId) {
         $instanceId = CRM_Report_Utils_Report::getInstanceIDForPath();
     }
     if (is_numeric($instanceId)) {
         $instanceURL = CRM_Utils_System::url("civicrm/report/instance/{$instanceId}", 'reset=1');
         CRM_Core_Session::singleton()->replaceUserContext($instanceURL);
     }
     $action = CRM_Utils_Request::retrieve('action', 'String', $this);
     $optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId);
     $reportUrl = CRM_Utils_System::url('civicrm/report/list', "reset=1");
     if ($action & CRM_Core_Action::DELETE) {
         if (!CRM_Core_Permission::check('administer Reports')) {
             $statusMessage = ts('You do not have permission to Delete Report.');
             CRM_Core_Error::statusBounce($statusMessage, $reportUrl);
         }
         $navId = CRM_Core_DAO::getFieldValue('CRM_Report_DAO_ReportInstance', $instanceId, 'navigation_id', 'id');
         CRM_Report_BAO_ReportInstance::del($instanceId);
         //delete navigation if exists
         if ($navId) {
             CRM_Core_BAO_Navigation::processDelete($navId);
             CRM_Core_BAO_Navigation::resetNavigation();
         }
         CRM_Core_Session::setStatus(ts('Selected report has been deleted.'), ts('Deleted'), 'success');
     } else {
         $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value');
         if (empty($templateInfo)) {
             CRM_Core_Error::statusBounce('You have tried to access a report that does not exist.');
         }
         $extKey = strpos($templateInfo['name'], '.');
         $reportClass = NULL;
         if ($extKey !== FALSE) {
             $ext = CRM_Extension_System::singleton()->getMapper();
             $reportClass = $ext->keyToClass($templateInfo['name'], 'report');
             $templateInfo['name'] = $reportClass;
         }
         if (strstr($templateInfo['name'], '_Form') || !is_null($reportClass)) {
             $instanceInfo = array();
             CRM_Report_BAO_ReportInstance::retrieve(array('id' => $instanceId), $instanceInfo);
             if (!empty($instanceInfo['title'])) {
                 CRM_Utils_System::setTitle($instanceInfo['title']);
                 $this->assign('reportTitle', $instanceInfo['title']);
             } else {
                 CRM_Utils_System::setTitle($templateInfo['label']);
                 $this->assign('reportTitle', $templateInfo['label']);
             }
             $wrapper = new CRM_Utils_Wrapper();
             return $wrapper->run($templateInfo['name'], NULL, NULL);
         }
         CRM_Core_Session::setStatus(ts('Could not find template for the instance.'), ts('Template Not Found'), 'error');
     }
     return CRM_Utils_System::redirect($reportUrl);
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:58,代码来源:Instance.php

示例6: addNavigationMenuEntry

 /**
  * Add the given menu item to the CiviCRM navigation menu if it does not exist yet.
  * @param array parent_params the params array into whose 'child' attribute the new item will be added.
  * @param array $attributes the attributes array to be added to the navigation menu
  */
 static function addNavigationMenuEntry(&$parent_params, $menu_entry_attributes)
 {
     // see if it is already in the menu...
     $menu_item_search = array('url' => $menu_entry_attributes['url']);
     $menu_items = array();
     CRM_Core_BAO_Navigation::retrieve($menu_item_search, $menu_items);
     if (empty($menu_items)) {
         // it's not already contained, so we want to add it to the menu
         // insert at the bottom
         $parent_params['child'][] = array('attributes' => $menu_entry_attributes);
     }
 }
开发者ID:FundingWorks,项目名称:org.project60.sepa,代码行数:17,代码来源:SepaMenuTools.php

示例7: testGetNavItemByUrl

 /**
  * Test that a navigation item can be retrieved by it's url.
  */
 public function testGetNavItemByUrl()
 {
     $random_string = substr(sha1(rand()), 0, 7);
     $name = "Test Menu Link {$random_string}";
     $url = "civicrm/test/{$random_string}";
     $url_params = "reset=1";
     $params = array('name' => $name, 'label' => ts($name), 'url' => "{$url}?{$url_params}", 'parent_id' => NULL, 'is_active' => TRUE, 'permission' => array('access CiviCRM'));
     CRM_Core_BAO_Navigation::add($params);
     $new_nav = CRM_Core_BAO_Navigation::getNavItemByUrl($url, $url_params);
     $this->assertObjectHasAttribute('id', $new_nav);
     $this->assertNotNull($new_nav->id);
     $new_nav->delete();
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:16,代码来源:NavigationTest.php

示例8: queryrunner_civicrm_navigationMenu

function queryrunner_civicrm_navigationMenu(&$params)
{
    $menu_item_search = array('url' => 'civicrm/query-runner');
    $menu_items = array();
    CRM_Core_BAO_Navigation::retrieve($menu_item_search, $menu_items);
    if (!empty($menu_items)) {
        return;
    }
    $navId = CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_navigation') + 1;
    $adminID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Administer', 'id', 'name');
    $systemID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'System settings', 'id', 'name');
    $params[$adminID]['child'][$systemID]['child'][$navId] = array('attributes' => array('label' => ts('Query Runner'), 'name' => 'Query Runner', 'url' => 'civicrm/query-runner', 'permission' => 'administer CiviCRM', 'operator' => 'AND', 'separator' => null, 'parentID' => $systemID, 'navID' => $navId, 'active' => 1));
}
开发者ID:imba-us,项目名称:com.imba.queryrunner,代码行数:13,代码来源:queryrunner.php

示例9: mailchimpsync_civicrm_navigationMenu

function mailchimpsync_civicrm_navigationMenu(&$params)
{
    // get the id of Administer Menu
    $administerMenuId = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_Navigation', 'Administer', 'id', 'name');
    CRM_Core_Error::debug_var('$administerMenuId', $administerMenuId);
    // skip adding menu if there is no administer menu
    if ($administerMenuId) {
        // get the maximum key under adminster menu
        $maxKey = max(array_keys($params[$administerMenuId]['child']));
        $params[$administerMenuId]['child'][$maxKey + 1] = array('attributes' => array('label' => 'MailChimp Settings', 'name' => 'MailChimp Settings', 'url' => 'civicrm/mailchimp/apikeyregister', 'permission' => 'administer CiviCRM', 'operator' => NULL, 'separator' => TRUE, 'parentID' => $administerMenuId, 'navID' => $maxKey + 1, 'active' => 1));
        CRM_Core_BAO_Navigation::add($params);
    }
}
开发者ID:prashantgajare,项目名称:com.webaccessglobal.mailchimpsync,代码行数:13,代码来源:mailchimpsync.php

示例10: run

 /**
  * run this page (figure out the action needed and perform it).
  *
  * @return void
  */
 function run()
 {
     $instanceId = CRM_Report_Utils_Report::getInstanceID();
     if (!$instanceId) {
         $instanceId = CRM_Report_Utils_Report::getInstanceIDForPath();
     }
     $action = CRM_Utils_Request::retrieve('action', 'String', $this);
     $optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId);
     $reportUrl = CRM_Utils_System::url('civicrm/report/list', "reset=1");
     if ($action & CRM_Core_Action::DELETE) {
         if (!CRM_Core_Permission::check('administer Reports')) {
             $statusMessage = ts('Your do not have permission to Delete Report.');
             CRM_Core_Error::statusBounce($statusMessage, $reportUrl);
         }
         $navId = CRM_Core_DAO::getFieldValue('CRM_Report_DAO_Instance', $instanceId, 'navigation_id', 'id');
         CRM_Report_BAO_Instance::delete($instanceId);
         //delete navigation if exists
         if ($navId) {
             require_once 'CRM/Core/BAO/Navigation.php';
             CRM_Core_BAO_Navigation::processDelete($navId);
             CRM_Core_BAO_Navigation::resetNavigation();
         }
         CRM_Core_Session::setStatus(ts('Selected Instance has been deleted.'));
     } else {
         require_once 'CRM/Core/OptionGroup.php';
         $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value');
         $extKey = strpos($templateInfo['name'], '.');
         $reportClass = null;
         if ($extKey !== FALSE) {
             require_once 'CRM/Core/Extensions.php';
             $ext = new CRM_Core_Extensions();
             $reportClass = $ext->keyToClass($templateInfo['name'], 'report');
             $templateInfo['name'] = $reportClass;
         }
         if (strstr($templateInfo['name'], '_Form') || !is_null($reportClass)) {
             $instanceInfo = array();
             CRM_Report_BAO_Instance::retrieve(array('id' => $instanceId), $instanceInfo);
             if (!empty($instanceInfo['title'])) {
                 CRM_Utils_System::setTitle($instanceInfo['title']);
                 $this->assign('reportTitle', $instanceInfo['title']);
             } else {
                 CRM_Utils_System::setTitle($templateInfo['label']);
                 $this->assign('reportTitle', $templateInfo['label']);
             }
             $wrapper = new CRM_Utils_Wrapper();
             return $wrapper->run($templateInfo['name'], null, null);
         }
         CRM_Core_Session::setStatus(ts('Could not find template for the instance.'));
     }
     return CRM_Utils_System::redirect($reportUrl);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:56,代码来源:Instance.php

示例11: maxadditionalparticipants_civicrm_uninstall

/**
 * Implementation of hook_civicrm_uninstall
 *
 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_uninstall
 */
function maxadditionalparticipants_civicrm_uninstall()
{
    require_once "CRM/Core/DAO.php";
    $maxparticipantMenuItem = array('Participant_Settings');
    foreach ($maxparticipantMenuItem as $name) {
        $itemId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', $name, 'id', 'name', TRUE);
        if ($itemId) {
            CRM_Core_BAO_Navigation::processDelete($itemId);
        }
    }
    CRM_Core_BAO_Navigation::resetNavigation();
    CRM_Core_DAO::executeQuery("DELETE FROM civicrm_setting WHERE group_name = 'Event Preferences' AND name = 'max_participants'");
    return _maxadditionalparticipants_civix_civicrm_uninstall();
}
开发者ID:Kajakaran,项目名称:uk.co.vedaconsulting.maxadditionalparticipants,代码行数:19,代码来源:maxadditionalparticipants.php

示例12: smarty_function_crmNavigationMenu

/**
 * Generate the nav menu
 *
 * @param array $params
 *   - is_default: bool, true if this is normal/default instance of the menu (which may be subject to CIVICRM_DISABLE_DEFAULT_MENU)
 * @param object $smarty the Smarty object
 *
 * @return string HTML
 */
function smarty_function_crmNavigationMenu($params, &$smarty)
{
    //check if logged in user has access CiviCRM permission and build menu
    $buildNavigation = !CRM_Core_Config::isUpgradeMode() && CRM_Core_Permission::check('access CiviCRM');
    if (defined('CIVICRM_DISABLE_DEFAULT_MENU') && CRM_Utils_Array::value('is_default', $params, FALSE)) {
        $buildNavigation = FALSE;
    }
    if ($buildNavigation) {
        $session = CRM_Core_Session::singleton();
        $contactID = $session->get('userID');
        if ($contactID) {
            $navigation = CRM_Core_BAO_Navigation::createNavigation($contactID);
            $smarty->assign('navigation', $navigation);
            return $smarty->fetch('CRM/common/Navigation.tpl');
        }
    }
    return '';
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:27,代码来源:function.crmNavigationMenu.php

示例13: simpledonate_civicrm_install

/**
 * Implementation of hook_civicrm_install
 */
function simpledonate_civicrm_install()
{
    //Add menu for donation page link under Contribution parent navigation
    //And Configuration link under Admin navigation
    $civiContributeParentId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'CiviContribute', 'id', 'name');
    $params = array('domain_id' => CRM_Core_Config::domainID(), 'label' => 'Simple Donate Configuration', 'name' => 'Simple Donate Configuration', 'url' => 'civicrm/simple/donation/configuration?reset=1', 'permission' => 'access CiviContribute', 'parent_id' => $civiContributeParentId, 'has_separator' => 1, 'is_active' => 1);
    CRM_Core_BAO_Navigation::add($params);
    $contributionsParentId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Contributions', 'id', 'name');
    $donationNavigation = new CRM_Core_DAO_Navigation();
    $params = array('domain_id' => CRM_Core_Config::domainID(), 'label' => 'Simple Donate', 'name' => 'Simple Donate', 'url' => NULL, 'permission' => 'access CiviContribute', 'parent_id' => $contributionsParentId, 'has_separator' => 1, 'is_active' => 1, 'weight' => 100);
    $donationNavigation->copyValues($params);
    $donationNavigation->save();
    $donationMenuTree = array(array('label' => ts('Test mode'), 'name' => 'Test Donation', 'url' => 'civicrm/simple?test=1#/donation', 'permission' => 'access CiviContribute'), array('label' => ts('Live mode'), 'name' => 'Live Donation', 'url' => 'civicrm/simple/#/donation', 'permission' => 'access CiviContribute'));
    foreach ($donationMenuTree as $key => $menuItems) {
        $menuItems['is_active'] = 1;
        $menuItems['parent_id'] = $donationNavigation->id;
        $menuItems['weight'] = $key;
        CRM_Core_BAO_Navigation::add($menuItems);
    }
    return _simpledonate_civix_civicrm_install();
}
开发者ID:rohankatkar,项目名称:com.webaccessglobal.simpledonate,代码行数:24,代码来源:simpledonate.php

示例14: array

 /**
  * Create instance.
  * takes an associative array and creates a instance object and does any related work like permissioning, adding to dashboard etc.
  *
  * This function is invoked from within the web form layer and also from the api layer
  *
  * @param array $params
  *   (reference ) an assoc array of name/value pairs.
  *
  * @return CRM_Report_BAO_ReportInstance
  */
 public static function &create(&$params)
 {
     if (isset($params['report_header'])) {
         $params['header'] = CRM_Utils_Array::value('report_header', $params);
     }
     if (isset($params['report_footer'])) {
         $params['footer'] = CRM_Utils_Array::value('report_footer', $params);
     }
     // build navigation parameters
     if (!empty($params['is_navigation'])) {
         if (!array_key_exists('navigation', $params)) {
             $params['navigation'] = array();
         }
         $navigationParams =& $params['navigation'];
         $navigationParams['permission'] = array();
         $navigationParams['label'] = $params['title'];
         $navigationParams['name'] = $params['title'];
         $navigationParams['current_parent_id'] = CRM_Utils_Array::value('parent_id', $navigationParams);
         $navigationParams['parent_id'] = CRM_Utils_Array::value('parent_id', $params);
         $navigationParams['is_active'] = 1;
         if ($permission = CRM_Utils_Array::value('permission', $params)) {
             $navigationParams['permission'][] = $permission;
         }
         // unset the navigation related elements, not used in report form values
         unset($params['parent_id']);
         unset($params['is_navigation']);
     }
     // add to dashboard
     $dashletParams = array();
     if (!empty($params['addToDashboard'])) {
         $dashletParams = array('label' => $params['title'], 'is_active' => 1);
         if ($permission = CRM_Utils_Array::value('permission', $params)) {
             $dashletParams['permission'][] = $permission;
         }
     }
     $transaction = new CRM_Core_Transaction();
     $instance = self::add($params);
     if (is_a($instance, 'CRM_Core_Error')) {
         $transaction->rollback();
         return $instance;
     }
     // add / update navigation as required
     if (!empty($navigationParams)) {
         if (empty($params['id']) && empty($params['instance_id']) && !empty($navigationParams['id'])) {
             unset($navigationParams['id']);
         }
         $navigationParams['url'] = "civicrm/report/instance/{$instance->id}?reset=1";
         $navigation = CRM_Core_BAO_Navigation::add($navigationParams);
         if (!empty($navigationParams['is_active'])) {
             //set the navigation id in report instance table
             CRM_Core_DAO::setFieldValue('CRM_Report_DAO_ReportInstance', $instance->id, 'navigation_id', $navigation->id);
         } else {
             // has been removed from the navigation bar
             CRM_Core_DAO::setFieldValue('CRM_Report_DAO_ReportInstance', $instance->id, 'navigation_id', 'NULL');
         }
         //reset navigation
         CRM_Core_BAO_Navigation::resetNavigation();
     }
     // add to dashlet
     if (!empty($dashletParams)) {
         $section = 2;
         $chart = '';
         if (!empty($params['charts'])) {
             $section = 1;
             $chart = "&charts=" . $params['charts'];
         }
         $limitResult = NULL;
         if (!empty($params['row_count'])) {
             $limitResult = '&rowCount=' . $params['row_count'];
         }
         $dashletParams['name'] = "report/{$instance->id}";
         $dashletParams['url'] = "civicrm/report/instance/{$instance->id}?reset=1&section={$section}&snippet=5{$chart}&context=dashlet" . $limitResult;
         $dashletParams['fullscreen_url'] = "civicrm/report/instance/{$instance->id}?reset=1&section={$section}&snippet=5{$chart}&context=dashletFullscreen" . $limitResult;
         $dashletParams['instanceURL'] = "civicrm/report/instance/{$instance->id}";
         CRM_Core_BAO_Dashboard::addDashlet($dashletParams);
     }
     $transaction->commit();
     return $instance;
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:90,代码来源:ReportInstance.php

示例15: postProcess

 /**
  * Post process function.
  *
  * @param CRM_Core_Form $form
  * @param bool $redirect
  */
 public static function postProcess(&$form, $redirect = TRUE)
 {
     $params = $form->getVar('_params');
     $instanceID = $form->getVar('_id');
     if ($isNew = $form->getVar('_createNew')) {
         // set the report_id since base template is going to be same, and we going to unset $instanceID
         // which will make it difficult later on, to compute report_id
         $params['report_id'] = CRM_Report_Utils_Report::getValueFromUrl($instanceID);
         // Unset $instanceID so a new copy would be created.
         $instanceID = NULL;
     }
     $params['instance_id'] = $instanceID;
     if (!empty($params['is_navigation'])) {
         $params['navigation'] = $form->_navigation;
     } elseif ($instanceID) {
         // Delete navigation if exists.
         $navId = CRM_Core_DAO::getFieldValue('CRM_Report_DAO_ReportInstance', $instanceID, 'navigation_id', 'id');
         if ($navId) {
             CRM_Core_BAO_Navigation::processDelete($navId);
             CRM_Core_BAO_Navigation::resetNavigation();
         }
     }
     // make a copy of params
     $formValues = $params;
     // unset params from $formValues that doesn't match with DB columns of instance tables, and also not required in form-values for sure
     $unsetFields = array('title', 'to_emails', 'cc_emails', 'header', 'footer', 'qfKey', 'id', '_qf_default', 'report_header', 'report_footer', 'grouprole');
     foreach ($unsetFields as $field) {
         unset($formValues[$field]);
     }
     $view_mode = $formValues['view_mode'];
     // pass form_values as string
     $params['form_values'] = serialize($formValues);
     $instance = CRM_Report_BAO_ReportInstance::create($params);
     $form->set('id', $instance->id);
     if ($instanceID && !$isNew) {
         // updating existing instance
         $statusMsg = ts('"%1" report has been updated.', array(1 => $instance->title));
     } elseif ($form->getVar('_id') && $isNew) {
         $statusMsg = ts('Your report has been successfully copied as "%1". You are currently viewing the new copy.', array(1 => $instance->title));
     } else {
         $statusMsg = ts('"%1" report has been successfully created. You are currently viewing the new report instance.', array(1 => $instance->title));
     }
     CRM_Core_Session::setStatus($statusMsg);
     if ($redirect) {
         $urlParams = array('reset' => 1);
         if ($view_mode == 'view') {
             $urlParams['force'] = 1;
         } else {
             $urlParams['output'] = 'criteria';
         }
         CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/report/instance/{$instance->id}", $urlParams));
     }
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:59,代码来源:Instance.php


注:本文中的CRM_Core_BAO_Navigation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。