1
0

Added new Images for programs/index (+ other things)

This commit is contained in:
2014-06-03 14:24:37 +02:00
parent 1b23097722
commit df2d966eb4
8 changed files with 208 additions and 122 deletions

View File

@@ -1,7 +1,14 @@
<?php
/**
* Class ProgramHelper
*/
class ProgramHelper {
/**
* @param bool $doDelimiter
* @return Program[]
*/
public static function GetHighlightedProgList($doDelimiter)
{
$dropDownModels = array();
@@ -26,7 +33,7 @@ class ProgramHelper {
foreach (Program::model()->findAll($criteria) as $row) {
$contains = false;
foreach($dropDownModels as $modelElem)
if ($modelElem != null && $modelElem->attributes['ID'] == $row->attributes['ID'])
if ($modelElem != null && $modelElem->ID == $row->ID)
$contains = true;
if (! $contains)
$dropDownModels[] = $row;
@@ -35,6 +42,9 @@ class ProgramHelper {
return $dropDownModels;
}
/**
* @return Program
*/
public static function GetRecentProg()
{
$criteria = new CDbCriteria;
@@ -45,6 +55,9 @@ class ProgramHelper {
return Program::model()->find($criteria);
}
/**
* @return Program
*/
public static function GetDailyProg()
{
$recent = self::GetRecentProg();
@@ -62,6 +75,9 @@ class ProgramHelper {
return $result;
}
/**
* @return array
*/
public static function GetProgDropDownList()
{
$progDropDown = array();
@@ -72,7 +88,7 @@ class ProgramHelper {
if (is_null($row))
$progDropDown[] = TbHtml::menuDivider();
else
$progDropDown[] = array('label' => $row->attributes['Name'], 'url' => '/programs/view/' . $row->attributes['Name']);
$progDropDown[] = array('label' => $row->Name, 'url' => $row->getLink());
}
return $progDropDown;
}

View File

@@ -11,10 +11,12 @@ class ThumbnailPreview extends CWidget {
public $downloads = 0;
public $date = null;
public $image = '';
public $programminglang = '???';
public function run() {
if ($this->date == null)
$this->date = new DateTime('2000-01-01');
$this->render('thumbnailPreview');
}
}

View File

@@ -7,7 +7,7 @@
<div class="thumbnail <?php if (! $this->enabled) print("thumbnailDisabled"); ?>">
<div class="thumbnailInnerHead">
<a <?php if($this->enabled) echo 'href="'. $this->link . '"'; ?>>
<img style="width: 100%" <?php if (! $this->enabled) print('class="grayscale"'); ?> src="<?php echo $this->image; ?>">
<img class="thumbnailInnerImage <?php if (! $this->enabled) print('grayscale'); ?>" src="<?php echo $this->image; ?>">
</a>
</div>
<div class="caption">
@@ -66,8 +66,8 @@
<div class="span4"><b><?php echo $this->date->format('d.m.y'); ?></b><br/>
<small>Added On</small>
</div>
<div class="span4"><b><?php echo $this->starcount . '/4'; ?></b><br/>
<small>Rating</small>
<div class="span4"><b><?php echo $this->programminglang; ?></b><br/>
<small>Language</small>
</div>
</div>
</div>