<?php
require_once('Page.php');
class Awardlist extends Page{
	function show(){
		$currentplug=isset($_GET['plug'])?strval($_GET['plug']):'';
		$this->_load->model('Lottery_model');
		$awardlist=$this->_load->lottery_model->getAwards($currentplug);
		$this->_load->model('Attachment_model');		
		foreach($awardlist as $key=>$v){
			if($v['imagepath']>0){
				$img=$this->_load->attachment_model->getById($v['imagepath']);
				$awardlist[$key]['imagepath']=$img['filepath'];
			}else{
				$awardlist[$key]['imagepath']='/wall/themes/meepo/assets/images/defaultaward.jpg';
			}
		}
		$this->assign('currentplug',$currentplug);
		$this->assign('awardlist',$awardlist);
		$this->display('templates/awardlist.html');
	}
}
$page=new Awardlist();
$page->setTitle('奖品管理页');
$page->show();
