1
0
www.mikescher.com/www/protected/views/programs/index.php

93 lines
2.1 KiB
PHP
Raw Normal View History

<?php
/* @var $this ProgramController */
/* @var $dataProvider CActiveDataProvider */
?>
<?php
2014-06-02 19:31:14 +02:00
const PROGS_INDEX_ROWSIZE = 4;
const PROGS_INDEX_PAGESIZE = 16;
?>
<?php
$this->breadcrumbs = array(
'Programs',
);
$this->menu = array(
array('label' => 'Create Program', 'url' => array('create')),
array('label' => 'Manage Program', 'url' => array('admin')),
);
?>
2014-05-23 11:22:34 +02:00
<div class="container">
2014-05-28 21:29:49 +02:00
<h1>My Programs</h1>
<br><br>
2014-05-28 17:19:57 +02:00
<div class="row-fluid">
2014-05-23 11:22:34 +02:00
<?php
2014-06-02 19:31:14 +02:00
2014-05-28 21:29:49 +02:00
$criteria = new CDbCriteria;
$criteria->order = "Sterne DESC, add_date DESC";
2014-05-28 21:29:49 +02:00
$criteria->condition = "visible=1";
$all = Program::model()->findAll($criteria);
2014-05-23 11:22:34 +02:00
2014-06-02 19:31:14 +02:00
$pagecount = ceil(count($all) / PROGS_INDEX_PAGESIZE);
$all = array_slice($all, ($page - 1) * PROGS_INDEX_PAGESIZE, PROGS_INDEX_PAGESIZE);
$rowcount = ceil((count($all) / PROGS_INDEX_ROWSIZE));
for ($i = 0; $i < $rowcount; $i++) {
2014-05-28 17:19:57 +02:00
echo '<ul class="thumbnails">';
2014-05-23 11:22:34 +02:00
2014-06-02 19:31:14 +02:00
foreach (array_slice($all, $i * PROGS_INDEX_ROWSIZE, PROGS_INDEX_ROWSIZE) as $record) {
/* @var $record Program */
2014-06-04 18:06:38 +02:00
$this->widget('ThumbnailProgPreview',
2014-05-28 17:19:57 +02:00
[
'caption' => $record->Thumbnailname,
'link' => $record->getLink(),
'description' => $record->Description,
'category' => $record->Kategorie,
'language' => $record->getLanguageList(),
'image' => $record->getImagePath(),
'starcount' => $record->Sterne,
'downloads' => $record->Downloads,
'date' => new DateTime($record->add_date),
'enabled' => $record->enabled,
'programminglang' => $record->programming_lang,
2014-05-28 17:19:57 +02:00
]);
}
2014-05-23 11:22:34 +02:00
2014-05-28 17:19:57 +02:00
echo '</ul>';
}
2014-05-23 11:22:34 +02:00
?>
2014-05-28 17:19:57 +02:00
2014-05-23 11:22:34 +02:00
</div>
2014-06-02 19:31:14 +02:00
<?php
if ($pagecount > 1) {
$pagination_arr = array();
$pagination_arr[] = ['label' => '&laquo;', 'url' => '?page=' . ($page-1), 'disabled' => ($page <= 1)];
for($i = 1; $i <= $pagecount; $i++) {
$pagination_arr[] = ['label' => $i, 'url' => '?page=' . $i, 'active' => ($i == $page)];
}
$pagination_arr[] = ['label' => '&raquo;', 'url' => '?page=' . ($page+1), 'disabled' => ($page >= $pagecount)];
echo TbHtml::pagination($pagination_arr,
[
'align' => 'right',
]);
}
?>
2014-05-23 11:22:34 +02:00
</div>