本文整理汇总了PHP中CRM_Core_BAO_Navigation::getNavigationList方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Navigation::getNavigationList方法的具体用法?PHP CRM_Core_BAO_Navigation::getNavigationList怎么用?PHP CRM_Core_BAO_Navigation::getNavigationList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Navigation
的用法示例。
在下文中一共展示了CRM_Core_BAO_Navigation::getNavigationList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
if (isset($this->_id)) {
$params = array('id' => $this->_id);
CRM_Core_BAO_Navigation::retrieve($params, $this->_defaults);
}
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'label', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Navigation', 'label'), true);
$this->add('text', 'url', ts('Url'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Navigation', 'url'));
require_once 'CRM/Core/Permission.php';
$permissions = CRM_Core_Permission::basicPermissions(true);
$include =& $this->addElement('advmultiselect', 'permission', ts('Permission') . ' ', $permissions, array('size' => 5, 'style' => 'width:150px', 'class' => 'advmultiselect'));
$include->setButtonAttributes('add', array('value' => ts('Add >>')));
$include->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$operators = array('AND' => 'AND', 'OR' => 'OR');
$this->add('select', 'permission_operator', ts('Operator'), $operators);
$this->add('checkbox', 'has_separator', ts('Separator?'));
$active = $this->add('checkbox', 'is_active', ts('Enabled?'));
if ($this->_defaults['name'] == 'Home') {
$active->freeze();
} else {
$parentMenu = CRM_Core_BAO_Navigation::getNavigationList();
if (isset($this->_id)) {
unset($parentMenu[$this->_id]);
}
// also unset home.
$homeMenuId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Home', 'id', 'name');
unset($parentMenu[$homeMenuId]);
$parent = $this->add('select', 'parent_id', ts('Parent'), array('' => ts('-- select --')) + $parentMenu);
}
}
示例2: buildForm
/**
* Build form.
*
* @param CRM_Core_Form $form
*/
public static function buildForm(&$form)
{
// We should not build form elements in dashlet mode.
if ($form->_section) {
return;
}
// Check role based permission.
$instanceID = $form->getVar('_id');
if ($instanceID && !CRM_Report_Utils_Report::isInstanceGroupRoleAllowed($instanceID)) {
$url = CRM_Utils_System::url('civicrm/report/list', 'reset=1');
CRM_Core_Error::statusBounce(ts('You do not have permission to access this report.'), $url);
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Report_DAO_ReportInstance');
$form->add('text', 'title', ts('Report Title'), $attributes['title']);
$form->add('text', 'description', ts('Report Description'), $attributes['description']);
$form->add('text', 'email_subject', ts('Subject'), $attributes['email_subject']);
$form->add('text', 'email_to', ts('To'), $attributes['email_to']);
$form->add('text', 'email_cc', ts('CC'), $attributes['email_subject']);
$form->add('number', 'row_count', ts('Limit Dashboard Results'), array('class' => 'four', 'min' => 1));
$form->add('textarea', 'report_header', ts('Report Header'), $attributes['header']);
$form->add('textarea', 'report_footer', ts('Report Footer'), $attributes['footer']);
$form->addElement('checkbox', 'is_navigation', ts('Include Report in Navigation Menu?'), NULL, array('onclick' => "return showHideByValue('is_navigation','','navigation_menu','table-row','radio',false);"));
$form->addElement('select', 'view_mode', ts('Configure link to...'), array('view' => ts('View Results'), 'criteria' => ts('Show Criteria')));
$form->addElement('checkbox', 'addToDashboard', ts('Available for Dashboard?'));
$form->add('number', 'cache_minutes', ts('Cache dashlet for'), array('class' => 'four', 'min' => 1));
$form->addElement('checkbox', 'add_to_my_reports', ts('Add to My Reports?'), NULL);
$form->addElement('checkbox', 'is_reserved', ts('Reserved Report?'));
if (!CRM_Core_Permission::check('administer reserved reports')) {
$form->freeze('is_reserved');
}
$config = CRM_Core_Config::singleton();
if ($config->userFramework != 'Joomla' || $config->userFramework != 'WordPress') {
$form->addElement('select', 'permission', ts('Permission'), array('0' => ts('Everyone (includes anonymous)')) + CRM_Core_Permission::basicPermissions());
// prepare user_roles to save as names not as ids
if (function_exists('user_roles')) {
$user_roles_array = user_roles();
foreach ($user_roles_array as $key => $value) {
$user_roles[$value] = $value;
}
$grouprole =& $form->addElement('advmultiselect', 'grouprole', ts('ACL Group/Role'), $user_roles, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$grouprole->setButtonAttributes('add', array('value' => ts('Add >>')));
$grouprole->setButtonAttributes('remove', array('value' => ts('<< Remove')));
}
}
// navigation field
$parentMenu = CRM_Core_BAO_Navigation::getNavigationList();
$form->add('select', 'parent_id', ts('Parent Menu'), array('' => ts('- select -')) + $parentMenu);
// For now we only providing drilldown for one primary detail report only. In future this could be multiple reports
foreach ($form->_drilldownReport as $reportUrl => $drillLabel) {
$instanceList = CRM_Report_Utils_Report::getInstanceList($reportUrl);
if (count($instanceList) > 1) {
$form->add('select', 'drilldown_id', $drillLabel, array('' => ts('- select -')) + $instanceList);
}
break;
}
$form->addButtons(array(array('type' => 'submit', 'name' => ts('Save Report'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
$form->addFormRule(array('CRM_Report_Form_Instance', 'formRule'), $form);
}
示例3: buildForm
static function buildForm(&$form)
{
// we should not build form elements in dashlet mode
if ($form->_section) {
return;
}
// check role based permission
$instanceID = $form->getVar('_id');
if ($instanceID && !CRM_Report_Utils_Report::isInstanceGroupRoleAllowed($instanceID)) {
$url = CRM_Utils_System::url('civicrm/report/list', 'reset=1');
CRM_Core_Error::statusBounce(ts('You do not have permission to access this report.'), $url);
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Report_DAO_Instance');
$form->add('text', 'title', ts('Report Title'), $attributes['title']);
$form->add('text', 'description', ts('Report Description'), $attributes['description']);
$form->add('text', 'email_subject', ts('Subject'), $attributes['email_subject']);
$form->add('text', 'email_to', ts('To'), $attributes['email_to']);
$form->add('text', 'email_cc', ts('CC'), $attributes['email_subject']);
$form->add('textarea', 'report_header', ts('Report Header'), $attributes['header']);
$form->add('textarea', 'report_footer', ts('Report Footer'), $attributes['footer']);
$form->addElement('checkbox', 'is_navigation', ts('Include Report in Navigation Menu?'), NULL, array('onclick' => "return showHideByValue('is_navigation','','navigation_menu','table-row','radio',false);"));
$form->addElement('checkbox', 'addToDashboard', ts('Available for Dashboard?'));
$form->addElement('checkbox', 'is_reserved', ts('Reserved Report?'));
if (!CRM_Core_Permission::check('administer reserved reports')) {
$form->freeze('is_reserved');
}
$config = CRM_Core_Config::singleton();
if ($config->userFramework != 'Joomla' || $config->userFramework != 'WordPress') {
$form->addElement('select', 'permission', ts('Permission'), array('0' => ts('Everyone (includes anonymous)')) + CRM_Core_Permission::basicPermissions());
// prepare user_roles to save as names not as ids
if (function_exists('user_roles')) {
$user_roles_array = user_roles();
foreach ($user_roles_array as $key => $value) {
$user_roles[$value] = $value;
}
$form->addElement('advmultiselect', 'grouprole', ts('ACL Group/Role'), $user_roles, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
}
}
// navigation field
$parentMenu = CRM_Core_BAO_Navigation::getNavigationList();
$form->add('select', 'parent_id', ts('Parent Menu'), array('' => ts('-- select --')) + $parentMenu);
$form->addButtons(array(array('type' => 'submit', 'name' => ts('Save Report'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
$form->addFormRule(array('CRM_Report_Form_Instance', 'formRule'), $form);
}
示例4: buildForm
static function buildForm(&$form)
{
$attributes = CRM_Core_DAO::getAttribute('CRM_Report_DAO_Instance');
$form->add('text', 'title', ts('Report Title'), $attributes['title']);
$form->add('text', 'description', ts('Report Description'), $attributes['description']);
$form->add('text', 'email_subject', ts('Subject'), $attributes['email_subject']);
$form->add('text', 'email_to', ts('To'), $attributes['email_to']);
$form->add('text', 'email_cc', ts('CC'), $attributes['email_subject']);
$form->add('textarea', 'report_header', ts('Report Header'), $attributes['header']);
$form->add('textarea', 'report_footer', ts('Report Footer'), $attributes['footer']);
$form->addElement('checkbox', 'is_navigation', ts('Include Report in Navigation Menu?'), null, array('onclick' => "return showHideByValue('is_navigation','','navigation_menu','table-row','radio',false);"));
$form->addElement('checkbox', 'addToDashboard', ts('Available for Dashboard?'));
$config = CRM_Core_Config::singleton();
if ($config->userFramework != 'Joomla') {
$form->addElement('select', 'permission', ts('Permission'), array('0' => '- Any One -') + CRM_Core_Permission::basicPermissions());
}
// navigation field
$parentMenu = CRM_Core_BAO_Navigation::getNavigationList();
$form->add('select', 'parent_id', ts('Parent Menu'), array('' => ts('-- select --')) + $parentMenu);
$form->addButtons(array(array('type' => 'submit', 'name' => ts('Save Report'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
$form->addFormRule(array('CRM_Report_Form_Instance', 'formRule'), $form);
}
示例5: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
parent::buildQuickForm();
$this->setPageTitle(ts('Menu Item'));
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
if (isset($this->_id)) {
$params = array('id' => $this->_id);
CRM_Core_BAO_Navigation::retrieve($params, $this->_defaults);
}
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'label', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Navigation', 'label'), TRUE);
$this->add('text', 'url', ts('Url'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Navigation', 'url'));
$permissions = array();
foreach (CRM_Core_Permission::basicPermissions(TRUE, TRUE) as $id => $vals) {
$permissions[] = array('id' => $id, 'label' => $vals[0], 'description' => (array) CRM_Utils_Array::value(1, $vals));
}
$this->add('text', 'permission', ts('Permission'), array('placeholder' => ts('Unrestricted'), 'class' => 'huge', 'data-select-params' => json_encode(array('data' => array('results' => $permissions, 'text' => 'label')))));
$operators = array('AND' => ts('AND'), 'OR' => ts('OR'));
$this->add('select', 'permission_operator', NULL, $operators);
//make separator location configurable
$separator = array(ts('None'), ts('After menu element'), ts('Before menu element'));
$this->add('select', 'has_separator', ts('Separator'), $separator);
$active = $this->add('advcheckbox', 'is_active', ts('Enabled'));
if (CRM_Utils_Array::value('name', $this->_defaults) == 'Home') {
$active->freeze();
} else {
$parentMenu = CRM_Core_BAO_Navigation::getNavigationList();
if (isset($this->_id)) {
unset($parentMenu[$this->_id]);
}
// also unset home.
$homeMenuId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Home', 'id', 'name');
unset($parentMenu[$homeMenuId]);
$this->add('select', 'parent_id', ts('Parent'), array('' => ts('Top level')) + $parentMenu, FALSE, array('class' => 'crm-select2'));
}
}