addColumn() public method

Add a column to the table.
public addColumn ( string $key, string $name = '', array $attributes = [], string $columnClass = '' ) : TableSummaryModule
$key string The key name of the column.
$name string The display-name of the column.
$attributes array The attributes for the heading cell.
$columnClass string The css class to propagate to every cell in this column.
return TableSummaryModule $this
Ejemplo n.º 1
0
<?php

if (!defined('APPLICATION')) {
    exit;
}
?>
<h1><?php 
echo t('Dashboard Home');
?>
</h1>
<?php 
$this->RenderAsset('Messages');
$leaderboard = new TableSummaryModule(t('Active Users'));
$leaderboard->addColumn('users', t('Name'), [], TableSummaryModule::MAIN_CSS_CLASS)->addColumn('count-comments', t('Comments'), ['class' => 'column-xs']);
foreach ($this->ActiveUserData as $userdata) {
    $id = val('UserID', $userdata);
    $user = Gdn::userModel()->getID($id);
    $name = val('Name', $user);
    $userBlock = new MediaItemModule(val('Name', $user), userUrl($user), '', 'div');
    $userBlock->setView('media-sm')->setImage(userPhotoUrl($user))->addMeta(Gdn_Format::date(val('DateLastActive', $user), 'html'));
    $leaderboard->addRow(['users' => $userBlock, 'count-comments' => number_format($user->CountComments)]);
}
?>

<div class="summaries">
    <?php 
echo $leaderboard;
?>
</div>
<div class="summaries">
    <div class="ReleasesColumn">
Ejemplo n.º 2
0
<?php

if (!defined('APPLICATION')) {
    exit;
}
$userBoard = new TableSummaryModule(t('Active Users'));
$userBoard->addColumn('users', t('Name'), [], TableSummaryModule::MAIN_CSS_CLASS)->addColumn('count-comments', t('Comments'), ['class' => 'column-xs']);
foreach ($this->Data['UserData'] as $userdata) {
    $id = val('UserID', $userdata);
    $user = Gdn::userModel()->getID($id);
    $name = val('Name', $user);
    $userBlock = new MediaItemModule(val('Name', $user), userUrl($user), '', 'div');
    $userBlock->setView('media-sm')->setImage(userPhotoUrl($user))->addMeta(Gdn_Format::date(val('DateLastActive', $user), 'html'));
    $userBoard->addRow(['users' => $userBlock, 'count-comments' => number_format($user->CountComments)]);
}
echo $userBoard;
$discussionBoard = new TableSummaryModule(t('Popular Discussions'));
$discussionBoard->addColumn('discussion', t('Title'), ['class' => 'column-xs'], TableSummaryModule::MAIN_CSS_CLASS)->addColumn('count-comments', t('Comments'), ['class' => 'column-xs'])->addColumn('count-bookmarks', t('Follows'), ['class' => 'column-xs'])->addColumn('count-views', t('Views'), ['class' => 'column-xs']);
foreach ($this->Data['DiscussionData'] as $discussion) {
    $discussionBlock = new MediaItemModule(htmlspecialchars($discussion->Name), DiscussionUrl($discussion), '', 'div');
    $discussionBlock->setView('media-sm')->addMeta(Gdn_Format::date($discussion->DateInserted, 'html'));
    $discussionBoard->addRow(['discussion' => $discussionBlock, 'count-comments' => number_format($discussion->CountComments), 'count-bookmarks' => number_format($discussion->CountBookmarks), 'count-views' => number_format($discussion->CountViews)]);
}
echo $discussionBoard;