本文整理汇总了PHP中Reports::removeDuplicateRows方法的典型用法代码示例。如果您正苦于以下问题:PHP Reports::removeDuplicateRows方法的具体用法?PHP Reports::removeDuplicateRows怎么用?PHP Reports::removeDuplicateRows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reports
的用法示例。
在下文中一共展示了Reports::removeDuplicateRows方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeReport
//.........这里部分代码省略.........
$first = false;
if ($order == $colCp) {
if ($cp->getType() == 'date') {
$order_by = 'ORDER BY STR_TO_DATE(cpv' . $colCp . '.value, "%Y-%m-%d %H:%i:%s") ' . ($order_asc ? 'asc' : 'desc');
} else {
$order_by = 'ORDER BY cpv' . $colCp . '.value ' . ($order_asc ? 'asc' : 'desc');
}
}
}
}
$index++;
}
}
if ($order_by == '') {
if (is_numeric($order)) {
$id = $order;
$openPar .= '(';
$selectFROM .= ' LEFT OUTER JOIN ' . TABLE_PREFIX . 'custom_property_values cpv' . $id . ' ON (t.id = cpv' . $id . '.object_id AND cpv' . $id . '.custom_property_id = ' . $id . '))';
$order_by = 'ORDER BY ' . $order;
} else {
if ($object->getColumnType($order) == 'date') {
$order_by = 'ORDER BY STR_TO_DATE(t.' . $order . ', "%Y-%m-%d %H:%i:%s") ' . ($order_asc ? 'asc' : 'desc');
} else {
$order_by = 'ORDER BY t.' . $order . ' ' . ($order_asc ? 'asc' : 'desc');
}
}
}
if ($to_print) {
$limit_str = '';
} else {
$limit_str = ' LIMIT ' . $offset . ',' . $limit;
}
$sql = 'SELECT ' . $selectCols . ' FROM (' . $openPar . $selectFROM . ') ' . $selectWHERE . ' GROUP BY id ' . $order_by . $limit_str;
$rows = DB::executeAll($sql);
if (is_null($rows)) {
$rows = array();
}
$rows = Reports::removeDuplicateRows($rows);
$reportObjTitleCols = array();
foreach ($rows as &$row) {
foreach ($row as $col => $value) {
if (isset($titleColAlias[$col])) {
$reportObjTitleCols[$titleColAlias[$col]] = $value;
}
}
$title = $managerInstance->getReportObjectTitle($reportObjTitleCols);
$iconame = strtolower($managerInstance->getItemClass());
$id = $row['id'];
unset($row['id']);
$row = array_slice($row, count($titleCols));
if (!$to_print) {
$row = array('link' => '<a class="link-ico ico-' . $iconame . '" title="' . clean($title) . '" target="new" href="' . get_url($controller, $view, array('id' => $id)) . '"> </a>') + $row;
}
foreach ($row as $col => &$value) {
if (in_array($col, $managerInstance->getExternalColumns())) {
$value = self::getExternalColumnValue($col, $value);
} else {
if ($col != 'link') {
$value = html_to_text(clean($value));
}
}
if (self::isReportColumnEmail($value)) {
if (logged_user()->hasMailAccounts()) {
$value = '<a class="internalLink" href="' . get_url('mail', 'add_mail', array('to' => clean($value))) . '">' . clean($value) . '</a></div>';
} else {
$value = '<a class="internalLink" target="_self" href="mailto:' . clean($value) . '">' . clean($value) . '</a></div>';
}
}
}
if ($print_tags_idx > -1) {
$row['tag'] = implode(", ", Tags::getTagNamesByObjectIds($id, $report->getObjectType()));
}
if ($print_ws_idx > -1) {
$row['workspace'] = "";
$workspaces = WorkspaceObjects::getWorkspacesByObject($report->getObjectType(), $id, logged_user()->getWorkspacesQuery());
foreach ($workspaces as $workspace) {
$row['workspace'] .= ($row['workspace'] == "" ? "" : ", ") . $workspace->getName();
}
}
// TODO: reorder columns
$row = str_replace('|', ',', $row);
}
// TODO: reorder column titles
if ($print_tags_idx > -1) {
$results['columns'][] = lang('tags');
}
if ($print_ws_idx > -1) {
$results['columns'][] = lang('workspaces');
}
if (!$to_print) {
if (is_array($results['columns'])) {
array_unshift($results['columns'], '');
} else {
$results['columns'] = array('');
}
}
$results['rows'] = $rows;
}
return $results;
}