public function actionViewDocument()
 {
     if (isset($_GET['doc_id'])) {
         $doc_id = StringHelper::filterString($_GET['doc_id']);
         $detail_doc = Doc::model()->findAll(array("select" => "*", "condition" => "doc_id = :doc_id", "params" => array(':doc_id' => $doc_id)));
         $spCriteria = new CDbCriteria();
         $spCriteria->select = "*";
         $spCriteria->condition = "doc_id = :doc_id";
         $spCriteria->params = array(':doc_id' => $doc_id);
         $subject_doc = SubjectDoc::model()->find($spCriteria);
         $spjCriteria = new CDbCriteria();
         $spjCriteria->select = "*";
         $spjCriteria->condition = "subject_id = :subject_id";
         $spjCriteria->params = array(':subject_id' => $subject_doc->subject_id);
         $subject = Subject::model()->find($spjCriteria);
         $related_doc = Doc::model()->findAll(array("select" => "*", "limit" => "3", "order" => "RAND()"));
         foreach ($detail_doc as $detail) {
             $title = $detail->doc_name . " | Bluebee - UET";
             $this->pageTitle = $title;
             if ($detail->doc_type == 3) {
                 $image = Yii::app()->getBaseUrl(true) . $detail->doc_url;
             } else {
                 $image = $detail->doc_url;
             }
             $des = $detail->doc_description;
             Yii::app()->clientScript->registerMetaTag($title, null, null, array('property' => 'og:title'));
             Yii::app()->clientScript->registerMetaTag($image, null, null, array('property' => 'og:image'));
             Yii::app()->clientScript->registerMetaTag(500, null, null, array('property' => 'og:image:width'));
             Yii::app()->clientScript->registerMetaTag(500, null, null, array('property' => 'og:image:height'));
             Yii::app()->clientScript->registerMetaTag("website", null, null, array('property' => 'og:type'));
             Yii::app()->clientScript->registerMetaTag($des, null, null, array('property' => 'og:description'));
         }
         $this->render('viewDocument', array('detail_doc' => $detail_doc, 'related_doc' => $related_doc, 'subject' => $subject));
     }
 }
 public function searchDocument($doc_name)
 {
     $docCriteria = new CDbCriteria();
     $docCriteria->select = "*";
     $docCriteria->addSearchCondition('doc_name', $doc_name);
     $doc_result = Doc::model()->findAll($docCriteria);
     return $doc_result;
 }
 public function actionSubject()
 {
     $subject_id = "";
     if (isset($_GET["subject_id"])) {
         $subject_id = StringHelper::filterString($_GET["subject_id"]);
     } else {
         if (isset($_GET["subject_code"])) {
             $subject_code = StringHelper::filterString($_GET["subject_code"]);
             $subject_by_code = Subject::model()->findByAttributes(array('subject_code' => $subject_code));
             $subject_id = $subject_by_code->subject_id;
         }
     }
     $subjectCriteria = new CDbCriteria();
     $subjectCriteria->select = "*";
     $subjectCriteria->condition = "subject_id = :subject_id";
     $subjectCriteria->params = array(":subject_id" => $subject_id);
     $subject = Subject::model()->findAll($subjectCriteria);
     $teachers = Teacher::model()->with(array("subject_teacher" => array("select" => false, "condition" => "subject_id = :subject_id", "params" => array(":subject_id" => $subject_id))))->findAll();
     //            $doc = Doc::model()->with(array("docs" => array(
     //                            "select" => "*",
     //                            "condition" => "subject_id = :subject_id and active = 1",
     //                            "params" => array(":subject_id" => $subject_id)
     //                )))->findAll(array("limit" => "3", "order" => "RAND()"));
     //
     //            $reference = Doc::model()->with(array("docs" => array(
     //                            "select" => "*",
     //                            "condition" => "subject_id = :subject_id and active = 0",
     //                            "params" => array(":subject_id" => $subject_id)
     //                )))->findAll(array("limit" => "3", "order" => "RAND()"));
     $lesson = Lesson::model()->findAll(array("select" => "*", "condition" => "lesson_subject = :lesson_subject", "params" => array(":lesson_subject" => $subject_id), "order" => "lesson_weeks ASC"));
     //            $doc_related = Doc::model()->with(array("docs" => array(
     //                            "condition" => "subject_id = :subject_id",
     //                            "params" => array(":subject_id" => $subject_id)
     //                )))->findAll();
     //   $sql = "SELECT * FROM tbl_doc JOIN tbl_subject_doc ON tbl_doc.doc_id = tbl_subject_doc.doc_id WHERE tbl_subject_doc.subject_id = " . $subject_id;
     // $doc_related = Yii::app()->db->createCommand($sql)->query();
     $criteria = new CDbCriteria();
     $criteria->select = 't.*';
     $criteria->join = 'JOIN tbl_subject_doc ON t.doc_id = tbl_subject_doc.doc_id';
     $criteria->condition = 'tbl_subject_doc.subject_id = :value';
     $criteria->params = array(":value" => $subject_id);
     $doc_related = Doc::model()->findAll($criteria);
     //            $doc_related = SubjectDoc::model()->findAll(array(
     //                'select' => '*',
     //                'condition' => 'subject_id = :subject_id',
     //                'params' => array(':subject_id' => $subject_id)));
     foreach ($subject as $subject_detail) {
         $title = $subject_detail->subject_name . " | Bluebee - UET";
         $des = $subject_detail->subject_target;
     }
     $this->pageTitle = $title;
     Yii::app()->clientScript->registerMetaTag($title, null, null, array('property' => 'og:title'));
     Yii::app()->clientScript->registerMetaTag(Yii::app()->createAbsoluteUrl('listOfSubject/subject?subject_id=') . $subject_id, null, null, array('property' => 'og:url'));
     Yii::app()->clientScript->registerMetaTag($des, null, null, array('property' => 'og:description'));
     $category_father = Faculty::model()->findAll();
     $subject_type = SubjectType::model()->findAll();
     $this->render('subject', array('subject' => $subject, 'category_father' => $category_father, 'subject_type' => $subject_type, 'teacher' => $teachers, 'lesson' => $lesson, 'doc_related' => $doc_related));
 }
Esempio n. 4
0
 public function actionUser()
 {
     if (isset($_GET["token"])) {
         $token = StringHelper::filterString($_GET["token"]);
         $user_current_token = User::model()->find(array('select' => '*', 'condition' => 'user_token = :user_token', 'params' => array(':user_token' => $token)));
         $spCriteria = new CDbCriteria();
         $spCriteria->select = "*";
         $spCriteria->condition = "user_id = '" . $user_current_token->user_id . "'";
         $spjCriteria = new CDbCriteria();
         $spjCriteria->select = "*";
         $spjCriteria->condition = "doc_author = :doc_author";
         $spjCriteria->params = array(':doc_author' => $user_current_token->user_id);
         $spjCriteria->order = 'doc_id DESC';
         $count = Doc::model()->count($spjCriteria);
         $pages = new CPagination($count);
         $pages->pageSize = 12;
         $pages->applyLimit($spjCriteria);
         $user_doc_info = Doc::model()->findAll($spjCriteria);
         $user_current_id = User::model()->findByAttributes(array('user_id' => $user_current_token->user_id));
         $this->pageTitle = $user_current_token->user_real_name . " | Bluebee - UET";
         Yii::app()->clientScript->registerMetaTag($user_current_token->user_real_name . " | Bluebee - UET", null, null, array('property' => 'og:title'));
         Yii::app()->clientScript->registerMetaTag($user_current_token->user_avatar, null, null, array('property' => 'og:image'));
         if ($user_current_id) {
             $this->render('user', array('user_detail_info' => User::model()->findAll($spCriteria), 'user_doc_info' => $user_doc_info, 'pages' => $pages, 'doc_count' => $count));
         }
     }
     if (isset($_GET["id"])) {
         $id = StringHelper::filterString($_GET["id"]);
         $spCriteria = new CDbCriteria();
         $spCriteria->select = "*";
         $spCriteria->condition = "user_id = :id";
         $spCriteria->params = array(':id' => $id);
         $spjCriteria = new CDbCriteria();
         $spjCriteria->select = "*";
         $spjCriteria->condition = "doc_author = :doc_author";
         $spjCriteria->params = array(':doc_author' => $id);
         $spjCriteria->order = 'doc_id DESC';
         $count = Doc::model()->count($spjCriteria);
         $pages = new CPagination($count);
         $pages->pageSize = 12;
         $pages->applyLimit($spjCriteria);
         $user_doc_info = Doc::model()->findAll($spjCriteria);
         $user_detail_info = User::model()->findAll($spCriteria);
         foreach ($user_detail_info as $user) {
             $this->pageTitle = "Bluebee - UET | " . $user['user_real_name'];
             Yii::app()->clientScript->registerMetaTag("Bluebee - UET | " . $user['user_real_name'], null, null, array('property' => 'og:title'));
             Yii::app()->clientScript->registerMetaTag($user['user_avatar'], null, null, array('property' => 'og:image'));
         }
         $this->render('user', array('user_detail_info' => $user_detail_info, 'user_doc_info' => $user_doc_info, 'pages' => $pages, 'doc_count' => $count));
     }
 }
Esempio n. 5
0
 public function actionSaveUser()
 {
     $this->retVal = new stdClass();
     $request = Yii::app()->request;
     if ($request->isPostRequest && isset($_POST['user_facebook_id'])) {
         try {
             $user_id_fb = StringHelper::filterString($request->getPost('user_facebook_id'));
             $check = User::model()->findByAttributes(array('user_id_fb' => $user_id_fb));
             $user_dob = $request->getPost('user_dob');
             $user_id = "";
             if ($check) {
                 $check->user_avatar = "http://graph.facebook.com/" . $user_id_fb . "/picture?type=large";
                 $check->user_id_fb = $user_id_fb;
                 $this->retVal->user_data = $check;
                 $this->retVal->message = 'true';
                 $check->save(FALSE);
                 $user_id = $check->user_id;
                 $this->retVal->user_data = $check;
             } else {
                 $user = new User();
                 $user->user_avatar = "http://graph.facebook.com/" . $user_id_fb . "/picture?type=large";
                 $user->user_dob = $user_dob;
                 $user->user_id_fb = $user_id_fb;
                 if ($user->save(FALSE)) {
                     $this->retVal->user_data = $user;
                     $this->retVal->message = 'true';
                     $user_id = $user->user_id;
                 } else {
                     $this->retVal->message = 'false';
                 }
             }
             $criteria = new CDbCriteria();
             $criteria->select = "*";
             $criteria->condition = "doc_author = :doc_author";
             $criteria->params = array(':doc_author' => $user_id);
             $count = Doc::model()->count($criteria);
             $this->retVal->doc_count = $count;
         } catch (exception $e) {
             $this->retVal->message = $e->getMessage();
         }
         echo CJSON::encode($this->retVal);
         Yii::app()->end();
     }
 }
Esempio n. 6
0
        echo $detail_vid->video_link;
        ?>
"></iframe>
                                            </div>
                                        </div>
                                    <?php 
    }
    ?>
                                    <div class="underline1"></div>
                                </div>
                                <div class="one-third">
                                    <div class="box more-box1">
                                        <h6 style="color: #262626"><strong>TÀI LIỆU</strong></h6>
                                        <?php 
    foreach ($doc_lesson as $doc) {
        $detail_doc = Doc::model()->find(array('select' => "*", 'condition' => "doc_id = :doc_id", 'params' => array(':doc_id' => $doc->doc_id)));
        ?>
                                            <div class="underline3"></div>
                                            <div class="block">
                                                <img src="<?php 
        echo $detail_doc->doc_url;
        ?>
" height="70" width="50"/>
                                                <a href="<?php 
        echo Yii::app()->createUrl('viewDocument?doc_id= ') . $detail_doc->doc_id;
        ?>
"><i class="icon-arrow-down"></i><?php 
        echo $detail_doc->doc_name;
        ?>
</a>
                                            </div>
Esempio n. 7
0
 public function actionFilterDocumentByTime()
 {
     $request = Yii::app()->request;
     if ($request->isPostRequest && isset($_POST)) {
         try {
             $FilerFormData = array('filter_time' => StringHelper::filterString($_POST['filter_time']));
             $Criteria = new CDbCriteria();
             //represent for query such as conditions, ordering by, limit/offset.
             $Criteria->select = "*";
             $Criteria->order = "doc_id " . $FilerFormData['filter_time'];
             $result = Doc::model()->findAll($Criteria);
             $this->retVal = $result;
         } catch (exception $e) {
             // $this->retVal->message = $e->getMessage();
         }
     }
     echo CJSON::encode($this->retVal);
     Yii::app()->end();
 }
Esempio n. 8
0
<?php

return array("fields" => array("lesson_id" => array("label" => "ID"), "lesson_weeks" => array("label" => "Lesson week"), "lesson_subject" => array("label" => "Lesson of Subject", "type" => "_dropdown", "_list" => array("primary" => "subject_id", "displayAttr" => "subject_name", "src" => function () {
    $rows = Subject::model()->findAll();
    return $rows;
})), "lesson_doc" => array("label" => "Document of Lesson", "type" => "_dropdown", "_list" => array("primary" => "doc_id", "displayAttr" => "doc_name", "src" => function () {
    $rows = Doc::model()->findAll();
    return $rows;
}))), "columns" => array("lesson_id", "lesson_weeks", "lesson_subject", "lesson_doc"), "actions" => array("_view" => true, "_edit" => array("lesson_weeks", "lesson_subject", "lesson_doc"), "_delete" => true, "_new" => array("type" => "popup", "attr" => array("lesson_weeks", "lesson_subject", "lesson_doc")), "_search" => array("lesson_weeks", "lesson_subject", "lesson_doc"), "_search_advanced" => array("lesson_weeks", "lesson_subject", "lesson_doc"), "_customButtons" => array()), "default" => array("orderBy" => "lesson_id", "orderType" => "asc", "page" => 1, "per_page" => 10, "search" => "", "search_advanced" => ""), "tableAlias" => "lesson", "title" => "Lesson Manager", "condition" => false, "limit_values" => array(10, 20, 30, 40), "model" => "Lesson", "primary" => "lesson_id", "itemLabel" => "lesson", "additionalFiles" => array());
 public function actionListDocumentFaculty()
 {
     $this->retVal = new stdClass();
     $request = Yii::app()->request;
     if ($request->isPostRequest && isset($_POST)) {
         try {
             $listSubjectData = array('subject_faculty' => StringHelper::filterString($_POST['subject_faculty']));
             //                $subject_data = Subject::model()->findAll(array(
             //                    'select' => '*',
             //                    'condition' => 'subject_faculty = ' . $listSubjectData['subject_faculty']
             //                    , 'order' => 'subject_name ASC'));
             $doc_data = Doc::model()->findAll(array('select' => '*', 'condition' => 'subject_faculty = ' . $listSubjectData['subject_faculty'], 'order' => 'doc_id DESC'));
             //  $this->retVal->subject_data = $subject_data;
             $this->retVal->doc_data = $doc_data;
             $this->retVal->message = 1;
         } catch (exception $e) {
             $this->retVal->message = $e->getMessage();
         }
         echo CJSON::encode($this->retVal);
         Yii::app()->end();
     }
 }