Skip to content

Instantly share code, notes, and snippets.

@pupi1985
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pupi1985/48fbc928cfd65e38db51 to your computer and use it in GitHub Desktop.
Save pupi1985/48fbc928cfd65e38db51 to your computer and use it in GitHub Desktop.
function ranking($ranking)
{
$this->part_title($ranking);
$class=(@$ranking['type']=='users') ? 'qa-top-users' : 'qa-top-tags';
$rows=min($ranking['rows'], count($ranking['items']));
if ($rows>0) {
$this->output('<table class="'.$class.'-table">');
$columns=qa_opt('columns_' . $ranking['type']);
for ($row=0; $row<$rows; $row++) {
$this->set_context('ranking_row', $row);
$this->output('<tr>');
for ($column=0; $column<$columns; $column++) {
$this->set_context('ranking_column', $column);
$this->ranking_item(@$ranking['items'][$columns*$row+$column], $class, $column>0);
}
$this->clear_context('ranking_column');
$this->output('</tr>');
}
$this->clear_context('ranking_row');
$this->output('</table>');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment