本文整理汇总了PHP中CRM_Core_BAO_Navigation::resetNavigation方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Navigation::resetNavigation方法的具体用法?PHP CRM_Core_BAO_Navigation::resetNavigation怎么用?PHP CRM_Core_BAO_Navigation::resetNavigation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Navigation
的用法示例。
在下文中一共展示了CRM_Core_BAO_Navigation::resetNavigation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: 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);
}
示例3: 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);
}
示例4: 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
示例5: hrabsence_civicrm_disable
/**
* Implementation of hook_civicrm_disable
*/
function hrabsence_civicrm_disable()
{
//Disable the Navigation menu and submenus
$sql = "UPDATE civicrm_navigation SET is_active=0 WHERE name IN ('Absences','my_absences', 'calendar', 'new_absence', 'publicHolidays', 'absencePeriods', 'absenceTypes', 'absence_report','absenceReport')";
CRM_Core_DAO::executeQuery($sql);
CRM_Core_BAO_Navigation::resetNavigation();
CRM_Core_DAO::executeQuery("UPDATE civicrm_msg_template SET is_active=0 WHERE msg_title = 'Absence Email'");
_hrabsence_setActiveFields(0);
return _hrabsence_civix_civicrm_disable();
}
示例6: postProcess
public function postProcess()
{
$params = $this->controller->exportValues($this->_name);
$params['enableComponentIDs'] = array();
foreach ($params['enableComponents'] as $name) {
$params['enableComponentIDs'][] = $this->_components[$name]->componentID;
}
parent::commonProcess($params);
// reset navigation when components are enabled / disabled
require_once 'CRM/Core/BAO/Navigation.php';
CRM_Core_BAO_Navigation::resetNavigation();
}
示例7: setIsActive
/**
* Update the is_active flag in the db.
*
* @param int $id
* Id of the database record.
* @param bool $is_active
* Value we want to set the is_active field.
*
* @return Object
* DAO object on success, null otherwise
*/
public static function setIsActive($id, $is_active)
{
$params = array('id' => $id);
self::retrieve($params, $contactinfo);
$params = array('name' => "New {$contactinfo['name']}");
$newParams = array('is_active' => $is_active);
CRM_Core_BAO_Navigation::processUpdate($params, $newParams);
CRM_Core_BAO_Navigation::resetNavigation();
return CRM_Core_DAO::setFieldValue('CRM_Contact_DAO_ContactType', $id, 'is_active', $is_active);
}
示例8: rebuildMenuAndCaches
static function rebuildMenuAndCaches($triggerRebuild = FALSE, $sessionReset = FALSE)
{
$config = CRM_Core_Config::singleton();
$config->clearModuleList();
CRM_Core_Menu::store();
// also reset navigation
CRM_Core_BAO_Navigation::resetNavigation();
// also cleanup all caches
$config->cleanupCaches($sessionReset || CRM_Utils_Request::retrieve('sessionReset', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET'));
// also rebuild triggers if requested explicitly
if ($triggerRebuild || CRM_Utils_Request::retrieve('triggerRebuild', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET')) {
CRM_Core_DAO::triggerRebuild();
}
CRM_Core_ManagedEntities::singleton(TRUE)->reconcile();
}
示例9: _hrjob_setActiveFields
function _hrjob_setActiveFields($setActive)
{
$sql = "UPDATE civicrm_navigation SET is_active= {$setActive} WHERE name IN ('jobs','jobImport','hoursType')";
CRM_Core_DAO::executeQuery($sql);
CRM_Core_BAO_Navigation::resetNavigation();
//disable/enable customgroup and customvalue
$sql = "UPDATE civicrm_custom_field JOIN civicrm_custom_group ON civicrm_custom_group.id = civicrm_custom_field.custom_group_id SET civicrm_custom_field.is_active = {$setActive} WHERE civicrm_custom_group.name = 'HRJob_Summary'";
CRM_Core_DAO::executeQuery($sql);
CRM_Core_DAO::executeQuery("UPDATE civicrm_custom_group SET is_active = {$setActive} WHERE name = 'HRJob_Summary'");
//disable/enable optionGroup and optionValue
$query = "UPDATE civicrm_option_value JOIN civicrm_option_group ON civicrm_option_group.id = civicrm_option_value.option_group_id SET civicrm_option_value.is_active = {$setActive} WHERE civicrm_option_group.name IN ('hrjob_contract_type', 'hrjob_level_type', 'hrjob_department', 'hrjob_hours_type', 'hrjob_pay_grade', 'hrjob_health_provider', 'hrjob_life_provider', 'hrjob_location', 'hrjob_pension_type', 'hrjob_region', 'hrjob_pay_scale')";
CRM_Core_DAO::executeQuery($query);
CRM_Core_DAO::executeQuery("UPDATE civicrm_option_group SET is_active = {$setActive} WHERE name IN ('hrjob_contract_type', 'hrjob_level_type', 'hrjob_department', 'hrjob_hours_type', 'hrjob_pay_grade', 'hrjob_health_provider', 'hrjob_life_provider', 'hrjob_location', 'hrjob_pension_type', 'hrjob_region', 'hrjob_pay_scale')");
}
示例10: rebuildMenuAndCaches
/**
* @param bool $triggerRebuild
* @param bool $sessionReset
*
* @throws Exception
*/
public static function rebuildMenuAndCaches($triggerRebuild = FALSE, $sessionReset = FALSE)
{
$config = CRM_Core_Config::singleton();
$config->clearModuleList();
// also cleanup all caches
$config->cleanupCaches($sessionReset || CRM_Utils_Request::retrieve('sessionReset', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET'));
CRM_Core_Menu::store();
// also reset navigation
CRM_Core_BAO_Navigation::resetNavigation();
// also cleanup module permissions
$config->cleanupPermissions();
// rebuild word replacement cache - pass false to prevent operations redundant with this fn
CRM_Core_BAO_WordReplacement::rebuild(FALSE);
Civi::service('settings_manager')->flush();
// Clear js caches
CRM_Core_Resources::singleton()->flushStrings()->resetCacheCode();
CRM_Case_XMLRepository::singleton(TRUE);
// also rebuild triggers if requested explicitly
if ($triggerRebuild || CRM_Utils_Request::retrieve('triggerRebuild', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET')) {
CRM_Core_DAO::triggerRebuild();
}
CRM_Core_DAO_AllCoreTables::reinitializeCache(TRUE);
CRM_Core_ManagedEntities::singleton(TRUE)->reconcile();
//CRM-16257 update Config.IDS.ini might be an old copy
CRM_Core_IDS::createConfigFile(TRUE);
}
示例11: 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§ion={$section}&snippet=5{$chart}&context=dashlet" . $limitResult;
$dashletParams['fullscreen_url'] = "civicrm/report/instance/{$instance->id}?reset=1§ion={$section}&snippet=5{$chart}&context=dashletFullscreen" . $limitResult;
$dashletParams['instanceURL'] = "civicrm/report/instance/{$instance->id}";
CRM_Core_BAO_Dashboard::addDashlet($dashletParams);
}
$transaction->commit();
return $instance;
}
示例12: postProcess
static function postProcess(&$form)
{
$params = $form->getVar('_params');
$config = CRM_Core_Config::singleton();
$params['header'] = $params['report_header'];
$params['footer'] = $params['report_footer'];
$params['domain_id'] = CRM_Core_Config::domainID();
$form->_navigation['permission'] = array();
$form->_navigation['label'] = $params['title'];
$form->_navigation['name'] = $params['title'];
//navigation parameters
if (CRM_Utils_Array::value('is_navigation', $params)) {
$permission = CRM_Utils_Array::value('permission', $params);
$form->_navigation['current_parent_id'] = CRM_Utils_Array::value('parent_id', $form->_navigation);
$form->_navigation['parent_id'] = CRM_Utils_Array::value('parent_id', $params);
$form->_navigation['is_active'] = 1;
if ($permission) {
$form->_navigation['permission'][] = $permission;
}
//unset the navigation related element,
//not used in report form values
unset($params['parent_id']);
unset($params['is_navigation']);
}
// convert roles array to string
if (isset($params['grouprole']) && is_array($params['grouprole'])) {
$grouprole_array = array();
foreach ($params['grouprole'] as $key => $value) {
$grouprole_array[$value] = $value;
}
$params['grouprole'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($grouprole_array));
}
// add to dashboard
$dashletParams = array();
if (CRM_Utils_Array::value('addToDashboard', $params)) {
$dashletParams = array('label' => $params['title'], 'is_active' => 1);
$permission = CRM_Utils_Array::value('permission', $params);
if ($permission) {
$dashletParams['permission'][] = $permission;
}
}
$params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE);
$dao = new CRM_Report_DAO_Instance();
$dao->copyValues($params);
if ($config->userFramework == 'Joomla') {
$dao->permission = 'null';
}
// explicitly set to null if params value is empty
if (empty($params['grouprole'])) {
$dao->grouprole = 'null';
}
// unset all the params that we use
$fields = array('title', 'to_emails', 'cc_emails', 'header', 'footer', 'qfKey', '_qf_default', 'report_header', 'report_footer', 'grouprole');
foreach ($fields as $field) {
unset($params[$field]);
}
$dao->form_values = serialize($params);
$instanceID = $form->getVar('_id');
$isNew = $form->getVar('_createNew');
if ($instanceID && !$isNew) {
$dao->id = $instanceID;
}
$dao->report_id = CRM_Report_Utils_Report::getValueFromUrl($instanceID);
$dao->save();
$form->set('id', $dao->id);
$reloadTemplate = FALSE;
if ($dao->id) {
if (!empty($form->_navigation)) {
if ($isNew && CRM_Utils_Array::value('id', $form->_navigation)) {
unset($form->_navigation['id']);
}
$form->_navigation['url'] = "civicrm/report/instance/{$dao->id}&reset=1";
$navigation = CRM_Core_BAO_Navigation::add($form->_navigation);
if (CRM_Utils_Array::value('is_active', $form->_navigation)) {
//set the navigation id in report instance table
CRM_Core_DAO::setFieldValue('CRM_Report_DAO_Instance', $dao->id, 'navigation_id', $navigation->id);
} else {
// has been removed from the navigation bar
CRM_Core_DAO::setFieldValue('CRM_Report_DAO_Instance', $dao->id, 'navigation_id', 'NULL');
}
//reset navigation
CRM_Core_BAO_Navigation::resetNavigation();
// in order to reflect change in navigation, template needs to be reloaded
$reloadTemplate = TRUE;
}
// add to dashlet
if (!empty($dashletParams)) {
$section = 2;
$chart = '';
if (CRM_Utils_Array::value('charts', $params)) {
$section = 1;
$chart = "&charts=" . $params['charts'];
}
$dashletParams['url'] = "civicrm/report/instance/{$dao->id}&reset=1§ion={$section}&snippet=5{$chart}&context=dashlet";
$dashletParams['fullscreen_url'] = "civicrm/report/instance/{$dao->id}&reset=1§ion={$section}&snippet=5{$chart}&context=dashletFullscreen";
$dashletParams['instanceURL'] = "civicrm/report/instance/{$dao->id}";
CRM_Core_BAO_Dashboard::addDashlet($dashletParams);
}
$instanceParams = array('value' => $dao->report_id);
$instanceDefaults = array();
//.........这里部分代码省略.........
示例13: postProcess
public function postProcess()
{
$params = $this->controller->exportValues($this->_name);
CRM_Case_Info::onToggleComponents($this->_defaults['enableComponents'], $params['enableComponents'], NULL);
parent::commonProcess($params);
// reset navigation when components are enabled / disabled
CRM_Core_BAO_Navigation::resetNavigation();
}
示例14: rebuild
/**
* Rebuild
*/
static function rebuild()
{
$id = CRM_Core_Config::domainID();
$stringOverride = self::getAllAsConfigArray($id);
$params = array('locale_custom_strings' => serialize($stringOverride));
$wordReplacementSettings = CRM_Core_BAO_Domain::edit($params, $id);
if ($wordReplacementSettings) {
CRM_Core_Config::singleton()->localeCustomStrings = $stringOverride;
// Reset navigation
CRM_Core_BAO_Navigation::resetNavigation();
// Clear js string cache
CRM_Core_Resources::singleton()->flushStrings();
// Clear dynamic js files which may contain localization
CRM_Utils_File::flushDynamicResources();
return TRUE;
}
return FALSE;
}
示例15: hrcase_example_caseType
/**
* Enable/Disable example case type
*/
function hrcase_example_caseType($is_active)
{
$isActive = $is_active ? 1 : 0;
$sql = "Update civicrm_case_type SET is_active = {$isActive} where name IN ('AdultDayCareReferral', 'HousingSupport', 'adult_day_care_referral', 'housing_support')";
CRM_Core_DAO::executeQuery($sql);
CRM_Core_BAO_Navigation::resetNavigation();
}