コード例 #1
0
 /**
  * Lists all ContentRecord models.
  * @return mixed
  */
 public function actionIndex($topic_id)
 {
     $profile_videos = ContentRecord::find()->where(['topic_id' => $topic_id, 'type' => 'video'])->all();
     $profile_pdf = ContentRecord::find()->where(['topic_id' => $topic_id, 'type' => 'pdf'])->all();
     $profile_img = ContentRecord::find()->where(['topic_id' => $topic_id, 'type' => 'img'])->all();
     $topic = TopicRecord::findOne($topic_id);
     return $this->render('index', ['topic' => $topic, 'model_videos' => $profile_videos, 'model_pdf' => $profile_pdf, 'model_img' => $profile_img]);
 }
コード例 #2
0
 public function actionShow($id)
 {
     $program = ProgramRecord::findOne($id);
     $courses = CourseRecord::find()->where(['program_id' => $id])->all();
     $course_ids = ArrayHelper::getColumn($courses, 'id');
     $topics = TopicRecord::find()->where(['course_id' => $course_ids])->all();
     $topic_ids = ArrayHelper::getColumn($topics, 'id');
     $program_videos = ContentRecord::find()->where(['topic_id' => $topic_ids, 'type' => 'video'])->all();
     $program_pdf = ContentRecord::find()->where(['topic_id' => $topic_ids, 'type' => 'pdf'])->all();
     $program_img = ContentRecord::find()->where(['topic_id' => $topic_ids, 'type' => 'img'])->all();
     return $this->render('show', ['model_videos' => $program_videos, 'model_pdf' => $program_pdf, 'model_img' => $program_img, 'id' => $id, 'program' => $program]);
 }
コード例 #3
0
 public function actionNotifications()
 {
     $user = Yii::$app->user->identity->getId();
     $userRecord = User::findOne($user);
     if ($userRecord->role == 10) {
         $models = ContentRecord::find()->where(['uploadedBy' => $user])->all();
         //$models=$modelsUsers->filterWhere(['flag'=>1])->orWhere(['flag'=>-1]);
     } else {
         $models = [];
     }
     return $this->render('/notifications/index', ['models' => $models]);
 }
コード例 #4
0
                                                <li><i class="fa fa-clock-o"><?php 
    echo Yii::t('user', '{0, date}', $model->created_at);
    ?>
</i></li>
                                                <li>
                                                    <a href="#"><i class="fa fa-users">
                                                            <?php 
    echo \common\models\FollowerUsertoUser::find()->where(['followed_user_id' => $model->id])->count();
    ?>
</i>
                                                    </a>
                                                </li>
                                                <li>
                                                    <a href="#"><i class="fa fa-thumbs-o-up"> </i>
                                                        <?php 
    $contents = \common\models\content\ContentRecord::find()->where(['uploadedBy' => $model->id])->all();
    $contentsIds = \yii\helpers\ArrayHelper::getColumn($contents, 'id');
    $likeRecords = \common\models\LikeDislikeContent::find()->where(['content' => $contentsIds, 'likeOrDislike' => 1]);
    echo $likeRecords->count();
    ?>
                                                    </a>
                                                </li>
                                                <li>
                                                    <a href="#"><i class="fa fa-thumbs-o-down"> </i>
                                                        <?php 
    $dislikeRecords = \common\models\LikeDislikeContent::find()->where(['content' => $contentsIds, 'likeOrDislike' => 0]);
    echo $dislikeRecords->count();
    ?>
                                                    </a>
                                                </li>
                                            </ul>