/**
  * Lists all TopicRecord models.
  * @return mixed
  */
 public function actionIndex($course_id, $university, $faculty, $program)
 {
     $model = TopicRecord::findAll(['course_id' => $course_id]);
     //$university=UniversityRecord::findOne(['id'=>$university])->name;
     //$faculty=FacultyRecord::findOne($faculty)->name;
     $course = CourseRecord::findOne($course_id)->name;
     return $this->render('index', ['model' => $model, 'university' => $university, 'faculty' => $faculty, 'program' => $program, 'course' => $course]);
 }
 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
                    <?php 
} else {
    ?>
                        <?php 
    echo Html::img('@web/assets/Uploads/' . $model->name, ['class' => "img-responsive", 'style' => 'margin:0 auto;']);
    ?>
                        <?php 
}
?>
            </div>
<span class="label green">
                    <strong>
                        <?php 
$topic = \common\models\topic\TopicRecord::findOne($model->topic_id);
$course = \common\models\course\CourseRecord::findOne($topic->course_id);
$program = \common\models\program\ProgramRecord::findOne($course->program_id);
$faculty = \common\models\faculty\FacultyRecord::findOne($program->faculty_id);
$univ = \common\models\university\UniversityRecord::findOne($faculty->university_id);
echo Html::a($topic->name, ['content/index', 'topic_id' => $topic->id, 'university' => $univ->name, 'faculty' => $faculty->name, 'program' => $program->name, 'course' => $course->name], ['style' => 'color:black;']);
?>
                    </strong>
                </span>
                <span class="label blue">
                    <strong>
                        <?php 
echo Html::a($course->name, ['topic/index', 'course_id' => $course->id, 'university' => $univ->name, 'faculty' => $faculty->name, 'program' => $program->name], ['style' => 'color:black;']);
?>
                    </strong>
                </span>
                <span class="label blue-grey">
 public function actionUpdate()
 {
     if (Yii::$app->request->isAjax) {
         Yii::$app->response->format = Response::FORMAT_JSON;
         $data = Yii::$app->request->post();
         $like_status = $data['like_status'];
         $present_status = $data['present_status'];
         $id = $data['id'];
         //echo $data;
         //for finding program of content
         $topic_id = ContentRecord::findOne($id)->topic_id;
         $course_id = TopicRecord::findOne($topic_id)->course_id;
         $program_id = CourseRecord::findOne($course_id)->program_id;
         $program = ProgramRecord::findOne($program_id);
         //end of finding program of content
         if ($like_status != $present_status) {
             if ($like_status == -1) {
                 $likeOrDislike = new LikeDislikeContent();
                 $likeOrDislike->content = $id;
                 $likeOrDislike->likedOrDislikedBy = \Yii::$app->user->identity->getId();
                 $likeOrDislike->likeOrDislike = $present_status;
                 $likeOrDislike->save();
                 //for program like counter
                 if ($present_status == 0) {
                     $program->noOfDislikes += 1;
                 } else {
                     $program->noOLikes += 1;
                 }
                 $program->save();
             } else {
                 $likeOrDislike = LikeDislikeContent::findOne(['content' => $id, 'likedOrDislikedBy' => \Yii::$app->user->identity->getId()]);
                 $likeOrDislike->likeOrDislike = $present_status;
                 $likeOrDislike->save();
                 //for program counter
                 if ($present_status == 0) {
                     $program->noOfDislikes += 1;
                     $program->noOLikes -= 1;
                 } else {
                     $program->noOfDislikes -= 1;
                     $program->noOLikes += 1;
                 }
                 $program->save();
             }
         } else {
             $likeOrDislike = LikeDislikeContent::findOne(['content' => $id, 'likedOrDislikedBy' => \Yii::$app->user->identity->getId()]);
             $likeOrDislike->delete();
             //for program like counter
             if ($present_status == 0) {
                 $program->noOfDislikes -= 1;
             } else {
                 $program->noOLikes -= 1;
             }
             $program->save();
         }
         $likes = LikeDislikeContent::find()->where(['content' => $id, 'likeOrDislike' => 1]);
         $dislikes = LikeDislikeContent::find()->where(['content' => $id, 'likeOrDislike' => 0]);
         $likeOrDislike = LikeDislikeContent::findOne(['content' => $id, 'likedOrDislikedBy' => \Yii::$app->user->identity->getId()]);
         if ($likeOrDislike == null) {
             $new_like_status = -1;
         } else {
             $new_like_status = $likeOrDislike->likeOrDislike;
         }
         return ['new_like_status' => $new_like_status, 'new_id' => $id, 'likes' => $likes->count(), 'dislikes' => $dislikes->count()];
     }
 }
Пример #5
0
use yii\helpers\Html;
$faculty = \common\models\faculty\FacultyRecord::findOne($faculty_id)->name;
$breadcrumbs = $university . '/' . $faculty;
$this->params['breadcrumbs'][] = $breadcrumbs;
?>

<div class="card-panel horizontal-listing no-padding search-class">
    <div class="container-fluid">
        <h4 class="black-text"><?php 
echo $faculty;
?>
<i class="material-icons"></i></h4>
        <hr>
        <?php 
foreach ($models as $model) {
    $courses = \common\models\course\CourseRecord::find()->where(['program_id' => $model->id]);
    ?>
            <a>
                <div class="row hoverable">
                    <div class="col-sm-4">
                        <img src="http://mdbootstrap.com/images/reg/reg%20(54).jpg" class="img-responsive z-depth-2">
                    </div>
                    <div class="col-sm-8">
                        <?php 
    $link_program = '<h5 class="title">' . $model->name . '</h5>';
    echo Html::a($link_program, ['/course/index', 'program_id' => $model->id, 'faculty' => $faculty, 'university' => $university]);
    ?>
                        <ul class="list-inline item-details">
                            <li><i class="fa fa-clock-o"> 05/10/2015 | </i></li>
                            <li><a>Courses <?php 
    echo $courses->count();
 public function actionCourses($id)
 {
     $first = 1;
     $count = CourseRecord::find()->where(['program_id' => $id])->count();
     $courses = CourseRecord::find()->where(['program_id' => $id])->all();
     if ($count > 0) {
         echo "<option value='" . $first . "'>" . 'select' . "</option>";
         foreach ($courses as $course) {
             echo "<option data-toggle='modal' data-target='#myModal' value='" . $course->id . "'>" . $course->name . "</option>";
         }
     } else {
         echo "<option>-</option>";
     }
 }
 /**
  * Lists all CourseRecord models.
  * @return mixed
  */
 public function actionIndex($program_id, $university, $faculty)
 {
     $models = CourseRecord::findAll(['program_id' => $program_id]);
     return $this->render('index', ['models' => $models, 'program_id' => $program_id, 'university' => $university, 'faculty' => $faculty]);
 }
 public function actionTop($course_id)
 {
     $searchModel = new TopicSearchModel();
     $dataProvider = $searchModel->topSearch($course_id);
     $id = $course_id;
     $model = CourseRecord::findOne($id);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'id' => $course_id, 'model' => $model, 'num' => 1]);
 }