/** * Return all reports * * @return array */ static function getAllReportsByObjectType() { $ignore_context_reports = Reports::findAll(array("conditions" => "ignore_context = 1")); $reports_result = Reports::instance()->listing(); $reports = $reports_result->objects; $to_merge_reports = array(); foreach ($ignore_context_reports as $icr) { $add = true; foreach ($reports as $r) { if ($r->getId() == $icr->getId()) { $add = false; break; } } if ($add) { $to_merge_reports[] = $icr; } } $reports = array_merge($reports, $to_merge_reports); $reports = feng_sort($reports, "getObjectName"); $result = array(); foreach ($reports as $report) { if (array_key_exists($report->getReportObjectTypeId(), $result)) { $result[$report->getReportObjectTypeId()][] = $report; } else { $result[$report->getReportObjectTypeId()] = array($report); } } return $result; }
/** * This function will return paginated result. Result is an array where first element is * array of returned object and second populated pagination object that can be used for * obtaining and rendering pagination data using various helpers. * * Items and pagination array vars are indexed with 0 for items and 1 for pagination * because you can't use associative indexing with list() construct * * @access public * @param array $arguments Query argumens (@see find()) Limit and offset are ignored! * @param integer $items_per_page Number of items per page * @param integer $current_page Current page number * @return array */ function paginate($arguments = null, $items_per_page = 10, $current_page = 1) { if (isset($this) && instance_of($this, 'Reports')) { return parent::paginate($arguments, $items_per_page, $current_page); } else { return Reports::instance()->paginate($arguments, $items_per_page, $current_page); } // if }
$coltype = $cp->getOgType(); } else { $name = lang('field ' . $model . ' ' . $condition->getFieldName()); $coltype = array_key_exists($condition->getFieldName(), $types) ? $types[$condition->getFieldName()] : ''; $paramName = $condition->getFieldName(); if (str_starts_with($coltype, 'DATE') && !$condition->getIsParametrizable()) { $cond_value = DateTimeValueLib::dateFromFormatAndString('m/d/Y', $condition->getValue())->format(user_config_option('date_format')); $condition->setValue($cond_value); } } $paramValue = isset($parameters[$paramName]) ? $parameters[$paramName] : ''; $value = $condition->getIsParametrizable() ? clean($paramValue) : clean($condition->getValue()); eval('$managerInstance = ' . $model . "::instance();"); $externalCols = $managerInstance->getExternalColumns(); if (in_array($condition->getFieldName(), $externalCols)) { $value = clean(Reports::instance()->getExternalColumnValue($condition->getFieldName(), $value, $managerInstance)); } if ($value != '') { $conditionHtml .= '- ' . $name . ' ' . ($condition->getCondition() != '%' ? $condition->getCondition() : lang('ends with')) . ' ' . format_value_to_print($condition->getFieldName(), $value, $coltype, '', '"', user_config_option('date_format')) . '<br/>'; } } } ?> <div id="pdfOptions" style="display:none;"> <span class="bold"><?php echo lang('report pdf options'); ?> </span><hr/> <?php echo lang('report pdf page layout');
/** * Return manager instance * * @access protected * @param void * @return Report */ function manager() { if(!($this->manager instanceof Reports )) $this->manager = Reports::instance(); return $this->manager; } // manager
/** * Return manager instance * * @access protected * @param void * @return Report */ function manager() { if (!$this->manager instanceof Reports) { $this->manager = Reports::instance(); } return $this->manager; }