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


PHP CRM_Report_Utils_Report::isInstanceGroupRoleAllowed方法代码示例

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


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

示例1: 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);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:63,代码来源:Instance.php

示例2: 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);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:44,代码来源:Instance.php

示例3: ifnull

 public static function &info($ovID = NULL, &$title = NULL)
 {
     $report = '';
     if ($ovID) {
         $report = " AND v.id = {$ovID} ";
     }
     $sql = "\n        SELECT inst.id, inst.title, inst.report_id, inst.description, v.label, \n               ifnull( SUBSTRING(comp.name, 5), 'Contact' ) as compName\n          FROM civicrm_option_group g\n          LEFT JOIN civicrm_option_value v\n                 ON v.option_group_id = g.id AND\n                    g.name  = 'report_template'\n          LEFT JOIN civicrm_report_instance inst\n                 ON v.value = inst.report_id\n          LEFT JOIN civicrm_component comp \n                 ON v.component_id = comp.id\n            \n         WHERE v.is_active = 1 {$report}\n                AND inst.domain_id = %1\n          ORDER BY  v.weight";
     $dao = CRM_Core_DAO::executeQuery($sql, array(1 => array(CRM_Core_Config::domainID(), 'Integer')));
     $config = CRM_Core_Config::singleton();
     $rows = array();
     $url = 'civicrm/report/instance';
     while ($dao->fetch()) {
         if (in_array($dao->report_id, self::$_exceptions)) {
             continue;
         }
         $enabled = in_array("Civi{$dao->compName}", $config->enableComponents);
         if ($dao->compName == 'Contact') {
             $enabled = TRUE;
         }
         //filter report listings by permissions
         if (!($enabled && CRM_Report_Utils_Report::isInstancePermissioned($dao->id))) {
             continue;
         }
         //filter report listing by group/role
         if (!($enabled && CRM_Report_Utils_Report::isInstanceGroupRoleAllowed($dao->id))) {
             continue;
         }
         if (trim($dao->title)) {
             if ($ovID) {
                 $title = ts("Report(s) created from the template: %1", array(1 => $dao->label));
             }
             $rows[$dao->compName][$dao->id]['title'] = $dao->title;
             $rows[$dao->compName][$dao->id]['label'] = $dao->label;
             $rows[$dao->compName][$dao->id]['description'] = $dao->description;
             $rows[$dao->compName][$dao->id]['url'] = CRM_Utils_System::url("{$url}/{$dao->id}", "reset=1");
             if (CRM_Core_Permission::check('administer Reports')) {
                 $rows[$dao->compName][$dao->id]['deleteUrl'] = CRM_Utils_System::url("{$url}/{$dao->id}", 'action=delete&reset=1');
             }
         }
     }
     return $rows;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:42,代码来源:InstanceList.php

示例4: info

 /**
  * Retrieves report instances, optionally filtered.
  *
  * Filtering available by parent report template ($ovID) or by component ($compID).
  *
  * @return array
  */
 public function info()
 {
     $report = '';
     if ($this->ovID) {
         $report .= " AND v.id = {$this->ovID} ";
     }
     if ($this->compID) {
         if ($this->compID == 99) {
             $report .= " AND v.component_id IS NULL ";
             $this->_compName = 'Contact';
         } else {
             $report .= " AND v.component_id = {$this->compID} ";
             $cmpName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Component', $this->compID, 'name', 'id');
             $this->_compName = substr($cmpName, 4);
             if ($this->_compName == 'Contribute') {
                 $this->_compName = 'Contribution';
             }
         }
     } elseif ($this->grouping) {
         $report .= " AND v.grouping = '{$this->grouping}' ";
     }
     $sql = "\n        SELECT inst.id, inst.title, inst.report_id, inst.description, v.label, v.grouping, v.name as class_name,\n        CASE\n          WHEN comp.name IS NOT NULL THEN SUBSTRING(comp.name, 5)\n          WHEN v.grouping IS NOT NULL THEN v.grouping\n          ELSE 'Contact'\n          END as compName\n          FROM civicrm_option_group g\n          LEFT JOIN civicrm_option_value v\n                 ON v.option_group_id = g.id AND\n                    g.name  = 'report_template'\n          LEFT JOIN civicrm_report_instance inst\n                 ON v.value = inst.report_id\n          LEFT JOIN civicrm_component comp\n                 ON v.component_id = comp.id\n\n          WHERE v.is_active = 1 {$report}\n                AND inst.domain_id = %1\n          ORDER BY  v.weight";
     $dao = CRM_Core_DAO::executeQuery($sql, array(1 => array(CRM_Core_Config::domainID(), 'Integer')));
     $config = CRM_Core_Config::singleton();
     $rows = array();
     $url = 'civicrm/report/instance';
     while ($dao->fetch()) {
         if (in_array($dao->report_id, self::$_exceptions)) {
             continue;
         }
         $enabled = in_array("Civi{$dao->compName}", $config->enableComponents);
         if ($dao->compName == 'Contact' || $dao->compName == $dao->grouping) {
             $enabled = TRUE;
         }
         //filter report listings by permissions
         if (!($enabled && CRM_Report_Utils_Report::isInstancePermissioned($dao->id))) {
             continue;
         }
         //filter report listing by group/role
         if (!($enabled && CRM_Report_Utils_Report::isInstanceGroupRoleAllowed($dao->id))) {
             continue;
         }
         if (trim($dao->title)) {
             if ($this->ovID) {
                 $this->title = ts("Report(s) created from the template: %1", array(1 => $dao->label));
             }
             $rows[$dao->compName][$dao->id]['title'] = $dao->title;
             $rows[$dao->compName][$dao->id]['label'] = $dao->label;
             $rows[$dao->compName][$dao->id]['description'] = $dao->description;
             $rows[$dao->compName][$dao->id]['url'] = CRM_Utils_System::url("{$url}/{$dao->id}", "reset=1&output=criteria");
             $rows[$dao->compName][$dao->id]['viewUrl'] = CRM_Utils_System::url("{$url}/{$dao->id}", 'force=1&reset=1');
             $rows[$dao->compName][$dao->id]['actions'] = $this->getActionLinks($dao->id, $dao->class_name);
         }
     }
     return $rows;
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:63,代码来源:InstanceList.php


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