本文整理汇总了PHP中Reports::getReportPagination方法的典型用法代码示例。如果您正苦于以下问题:PHP Reports::getReportPagination方法的具体用法?PHP Reports::getReportPagination怎么用?PHP Reports::getReportPagination使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reports
的用法示例。
在下文中一共展示了Reports::getReportPagination方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeReport
//.........这里部分代码省略.........
'table' => Objects::instance()->getTableName(),
'jt_field' => 'id',
'e_field' => $original_order_by_col,
'join_type' => 'left'
);
$select_columns = array();
$tmp_cols = $managerInstance->getColumns();
foreach ($tmp_cols as $col) $select_columns[] = "e.$col";
$tmp_cols = Objects::instance()->getColumns();
foreach ($tmp_cols as $col) $select_columns[] = "o.$col";
$select_columns[] = 'jt.name as name_order';
}
if ($order_by_asc == null) $order_by_asc = $report->getIsOrderByAsc();
if ($ot->getName() == 'task' && !SystemPermissions::userHasSystemPermission(logged_user(), 'can_see_assigned_to_other_tasks')) {
$allConditions .= " AND assigned_to_contact_id = ".logged_user()->getId();
}
if ($managerInstance) {
$result = $managerInstance->listing(array(
"select_columns" => $select_columns,
"order" => "$order_by_col",
"order_dir" => ($order_by_asc ? "ASC" : "DESC"),
"extra_conditions" => $allConditions,
"join_params" => $join_params
));
}else{
// TODO Performance Killer
$result = ContentDataObjects::getContentObjects(active_context(), $ot, $order_by_col, ($order_by_asc ? "ASC" : "DESC"), $allConditions);
}
$objects = $result->objects;
$totalResults = $result->total;
$results['pagination'] = Reports::getReportPagination($id, $params, $order_by_col, $order_by_asc, $offset, $limit, $totalResults);
$dimensions_cache = array();
foreach($report_columns as $column){
if ($column->getCustomPropertyId() == 0) {
$field = $column->getFieldName();
if (str_starts_with($field, 'dim_')) {
$dim_id = str_replace("dim_", "", $field);
$dimension = Dimensions::getDimensionById($dim_id);
$dimensions_cache[$dim_id] = $dimension;
$doptions = $dimension->getOptions(true);
$column_name = $doptions && isset($doptions->useLangs) && $doptions->useLangs ? lang($dimension->getCode()) : $dimension->getName();
$results['columns'][$field] = $column_name;
$results['db_columns'][$column_name] = $field;
} else {
if ($managerInstance->columnExists($field) || Objects::instance()->columnExists($field)) {
$column_name = Localization::instance()->lang('field '.$ot->getHandlerClass().' '.$field);
if (is_null($column_name)) $column_name = lang('field Objects '.$field);
$results['columns'][$field] = $column_name;
$results['db_columns'][$column_name] = $field;
}
}
} else {
$results['columns'][$column->getCustomPropertyId()] = $column->getCustomPropertyId();
}
}
$report_rows = array();
foreach($objects as &$object){/* @var $object Object */
$obj_name = $object->getObjectName();
$icon_class = $object->getIconClass();
示例2: executeReport
//.........这里部分代码省略.........
$select_columns[] = "e.{$col}";
}
$tmp_cols = Objects::instance()->getColumns();
foreach ($tmp_cols as $col) {
$select_columns[] = "o.{$col}";
}
$select_columns[] = 'jt.name as name_order';
}
if ($order_by_asc == null) {
$order_by_asc = $report->getIsOrderByAsc();
}
if ($ot->getName() == 'task' && !SystemPermissions::userHasSystemPermission(logged_user(), 'can_see_assigned_to_other_tasks')) {
$allConditions .= " AND assigned_to_contact_id = " . logged_user()->getId();
}
if ($managerInstance) {
if ($order_by_col == "order") {
$order_by_col = "`{$order_by_col}`";
}
$listing_parameters = array("select_columns" => $select_columns, "order" => "{$order_by_col}", "order_dir" => $order_by_asc ? "ASC" : "DESC", "extra_conditions" => $allConditions, "count_results" => true, "join_params" => $join_params);
if ($limit > 0) {
$listing_parameters["start"] = $offset;
$listing_parameters["limit"] = $limit;
}
if ($show_archived) {
$listing_parameters["archived"] = true;
}
$result = $managerInstance->listing($listing_parameters);
} else {
// TODO Performance Killer
$result = ContentDataObjects::getContentObjects(active_context(), $ot, $order_by_col, $order_by_asc ? "ASC" : "DESC", $allConditions);
}
$objects = $result->objects;
$totalResults = $result->total;
$results['pagination'] = Reports::getReportPagination($id, $params, $original_order_by_col, $order_by_asc, $offset, $limit, $totalResults);
$dimensions_cache = array();
foreach ($report_columns as $column) {
if ($column->getCustomPropertyId() == 0) {
$field = $column->getFieldName();
if (str_starts_with($field, 'dim_')) {
$dim_id = str_replace("dim_", "", $field);
$dimension = Dimensions::getDimensionById($dim_id);
$dimensions_cache[$dim_id] = $dimension;
$column_name = $dimension->getName();
$results['columns'][$field] = $column_name;
$results['db_columns'][$column_name] = $field;
} else {
if ($managerInstance->columnExists($field) || Objects::instance()->columnExists($field)) {
$column_name = Localization::instance()->lang('field ' . $ot->getHandlerClass() . ' ' . $field);
if (is_null($column_name)) {
$column_name = lang('field Objects ' . $field);
}
$results['columns'][$field] = $column_name;
$results['db_columns'][$column_name] = $field;
} else {
if ($ot->getHandlerClass() == 'Contacts') {
if (in_array($field, $contact_extra_columns)) {
$results['columns'][$field] = lang($field);
$results['db_columns'][lang($field)] = $field;
}
} else {
if ($ot->getHandlerClass() == 'Timeslots') {
if (in_array($field, array('time', 'billing'))) {
$results['columns'][$field] = lang('field Objects ' . $field);
$results['db_columns'][lang('field Objects ' . $field)] = $field;
}
} else {
示例3: executeReport
//.........这里部分代码省略.........
$allConditions .= ' AND ';
$allConditions .= 't.id IN ( SELECT object_id as id FROM ' . TABLE_PREFIX . 'custom_property_values cpv WHERE ';
$allConditions .= ' cpv.custom_property_id = ' . $condCp->getCustomPropertyId();
$fieldType = $object->getColumnType($condCp->getFieldName());
if ($condCp->getCondition() == 'like' || $condCp->getCondition() == 'not like') {
$value = '%' . $value . '%';
}
if ($cp->getType() == 'date') {
$dtValue = DateTimeValueLib::dateFromFormatAndString($dateFormat, $value);
$value = $dtValue->format('Y-m-d H:i:s');
}
if ($condCp->getCondition() != '%') {
if ($cp->getType() == 'numeric') {
$allConditions .= ' AND cpv.value ' . $condCp->getCondition() . ' ' . mysql_real_escape_string($value);
} else {
$allConditions .= ' AND cpv.value ' . $condCp->getCondition() . ' "' . mysql_real_escape_string($value) . '"';
}
} else {
$allConditions .= ' AND cpv.value like "%' . mysql_real_escape_string($value) . '"';
}
$allConditions .= ')';
}
}
}
if ($manager != 'Projects' && $manager != 'Users') {
$allConditions .= ' AND t.trashed_by_id = 0 ';
}
$sql .= $allConditions;
$rows = DB::executeAll($sql);
if (is_null($rows)) {
$rows = array();
}
$totalResults = count($rows);
$results['pagination'] = Reports::getReportPagination($id, $params, $order_by_col, $order_by_asc, $offset, $limit, $totalResults);
$selectCols = 'distinct(t.id) as "id"';
$titleCols = $managerInstance->getReportObjectTitleColumns();
$titleColAlias = array();
foreach ($titleCols as $num => $title) {
$selectCols .= ', t.' . $title . ' as "titleCol' . $num . '"';
$titleColAlias['titleCol' . $num] = $title;
}
$selectFROM = TABLE_PREFIX . $table . ' t ';
$selectWHERE = "WHERE {$allConditions}";
$order = $order_by_col != '' ? $order_by_col : $report->getOrderBy();
$order_asc = $order_by_col != '' ? $order_by_asc : $report->getIsOrderByAsc();
$allColumns = ReportColumns::getAllReportColumns($id);
$print_ws_idx = -1;
$print_tags_idx = -1;
if (is_array($allColumns) && count($allColumns) > 0) {
$first = true;
$openPar = '';
$index = 0;
foreach ($allColumns as $column) {
if ($column->getCustomPropertyId() == 0) {
$field = $column->getFieldName();
if ($managerInstance->columnExists($field)) {
$selectCols .= ', t.' . $field;
$results['columns'][] = lang('field ' . $report->getObjectType() . ' ' . $field);
$results['db_columns'][lang('field ' . $report->getObjectType() . ' ' . $field)] = $field;
$first = false;
} else {
if ($field === 'workspace') {
$print_ws_idx = $index;
} else {
if ($field === 'tag') {
$print_tags_idx = $index;