Yii:如何在视图页面上显示动态引导程序进度条 [英] Yii: How to show dynamic bootstrap progress bars on view page
问题描述
我是一个yiibie.我的查看页面上有前 5 名非政府组织(每个月前 5 名非政府组织)以及同一页面上年底前 5 名的非政府组织.现在我想在每个非政府组织面前显示引导程序进度条.例如,如果 1 月是月份并且它向我显示该月的前 5 个非政府组织,我想在所有 5 个非政府组织的前面显示一个进度条,并且每个月我都想要它.年底也是一样.就像第一个非政府组织进度条将是 100%,第二个非政府组织将少于 100%,依此类推.请帮我做这件事,谢谢.这是我的控制器的代码,它具有视图文件功能
公共函数 actionNgostats(){$this->layout='main';$myCurrYear = date("Y");$userYear=UserRateReviewNgo::model()->findAll(array('条件' =>'YEAR(date_created)=:year','参数' =>数组(':year'=>$myCurrYear),'select'='DISTINCT rate,ngo_id','order'='rate DESC','限制' =>5));$this->render('ngostats', array("userYear"=>$userYear));}
这是我的视图文件(ngostats)
<?phpfor($month = 1 ; $month <=date('m') ; $month++){$user=UserRateReviewNgo::model()->findAll(array('条件' =>'YEAR(date_created)=:year 和 MONTH(date_created)=:month','参数' =>数组(':year'=>2015, ':month'=>$month),'select'='DISTINCT rate,ngo_id','order'='rate DESC','限制' =>5));foreach($user as $show) {$model = Ngo::model()->findByAttributes(array('id'=>$show->ngo_id,));如果(isset($模型)){?><div><h4><?php echo $model->ngo_name?></h4></div><div class="progress"><div class="progress-bar progress-bar-striped active" role="progressbar"aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width:40%">40%
<?php}}}?>
<h3>这是今年排名前 5 的 Ngo 的</h3><div><?php//年份foreach($userYear as $show) {$model = Ngo::model()->findByAttributes(array('id'=>$show->ngo_id,));如果(isset($模型)){?><div><h4><?php echo $model->ngo_name?></h4></div><div class="progress"><div class="progress-bar progress-bar-success progress-bar-striped active" role="progressbar"aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width:40%">40% 完成(成功)