本文整理汇总了PHP中CRM_Report_Utils_Report::isInstancePermissioned方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Report_Utils_Report::isInstancePermissioned方法的具体用法?PHP CRM_Report_Utils_Report::isInstancePermissioned怎么用?PHP CRM_Report_Utils_Report::isInstancePermissioned使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Report_Utils_Report
的用法示例。
在下文中一共展示了CRM_Report_Utils_Report::isInstancePermissioned方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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\n ORDER BY v.weight\n ";
$dao = CRM_Core_DAO::executeQuery($sql);
$config = CRM_Core_Config::singleton();
$rows = array();
$url = 'civicrm/report/instance';
while ($dao->fetch()) {
$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;
}
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;
}
示例2: substr
/**
* Retrieves report instances, optionally filtered 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,\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");
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;
}
示例3: 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}' ";
} elseif ($this->myReports) {
$report .= " AND inst.owner_id = " . CRM_Core_Session::getLoggedInContactID();
}
$sql = "\n SELECT inst.id, inst.title, inst.report_id, inst.description, inst.owner_id, 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';
$my_reports_grouping = 'My';
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 for private reports
if (!empty($dao->owner_id) && CRM_Core_Session::getLoggedInContactID() != $dao->owner_id) {
continue;
}
//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));
}
$report_grouping = $dao->compName;
if ($dao->owner_id != NULL) {
$report_grouping = $my_reports_grouping;
}
$rows[$report_grouping][$dao->id]['title'] = $dao->title;
$rows[$report_grouping][$dao->id]['label'] = $dao->label;
$rows[$report_grouping][$dao->id]['description'] = $dao->description;
$rows[$report_grouping][$dao->id]['url'] = CRM_Utils_System::url("{$url}/{$dao->id}", "reset=1&output=criteria");
$rows[$report_grouping][$dao->id]['viewUrl'] = CRM_Utils_System::url("{$url}/{$dao->id}", 'force=1&reset=1');
$rows[$report_grouping][$dao->id]['actions'] = $this->getActionLinks($dao->id, $dao->class_name);
}
}
// Move My Reports to the beginning of the reports list
if (isset($rows[$my_reports_grouping])) {
$my_reports = $rows[$my_reports_grouping];
unset($rows[$my_reports_grouping]);
$rows = array($my_reports_grouping => $my_reports) + $rows;
}
return $rows;
}