| Current Path : /var/www/html/akept/backend/modules/pageVisitLog/controllers/ |
| Current File : /var/www/html/akept/backend/modules/pageVisitLog/controllers/PageVisitLogController.php |
<?php
namespace backend\modules\pageVisitLog\controllers;
use Yii;
use backend\modules\pageVisitLog\models\PageVisitLog;
use backend\modules\pageVisitLog\models\PageVisitLogSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use backend\modules\pageVisitLog\models\Detect;
//require_once ('Mobile_Detect.php');
//require_once ('Detect.php');
/**
* PageVisitLogController implements the CRUD actions for PageVisitLog model.
*/
class PageVisitLogController extends Controller {
/**
* {@inheritdoc}
*/
public function behaviors() {
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
public function actionAddvote($type, $forum_id, $user_id) {
//$MobileDetect = new MobileDetect();
$Detect = new Detect();
$model = new PageVisitLog();
$model->content_type = 'forum';
$model->table_related = 'forum_questions';
$model->id_column_name = 'id';
$model->title_column_name = 'title';
$model->data_id = $forum_id;
$model->action_type = $type;
$model->action_datetime = date("Y-m-d H:i:s");
$model->visitor_ip = $Detect->ip();
$model->visitor_os = $Detect->os();
$model->visitor_device = $Detect->deviceType();
$model->visitor_location_country = $model->ip_info("Visitor", "Country");
$model->visitor_location_state = $model->ip_info("Visitor", "State");
$model->visitor_location_city = $model->ip_info("Visitor", "City");
$model->visitor_browser = $Detect->browser();
$model->frontend_user_id = $user_id;
if ($model->save(false))
return 'success';
else
return 'failed';
}
public function actionRelease() {
return $this->render('release');
}
public function actionReleaseDetails($id) {
$page_title = '';
$model = (new \yii\db\Query())->from('release_settings')->where(['=', 'release_id', $id])->one();
if (!empty($model)) {
$page_title = $model['release_title'];
}
return $this->render('release_details', ['page_title' => $page_title, 'data_id' => $id]);
}
public function actionArticle() {
return $this->render('article');
}
public function actionArticleDetails($id) {
$page_title = '';
$model = (new \yii\db\Query())->from('content_article')
->innerJoin('content_article_translation', 'content_article.article_id=content_article_translation.article_translation_parent_id')
->where(['=', 'article_id', $id])->one();
if (!empty($model)) {
$page_title = $model['article_translation_title'];
}
return $this->render('article_details', ['page_title' => $page_title, 'data_id' => $id]);
}
public function actionPhotoGallery() {
return $this->render('photo_gallery');
}
public function actionPhotoGalleryDetails($id) {
$page_title = '';
$model = (new \yii\db\Query())->from('content_photo_gallery')->where(['=', 'gallery_id', $id])->one();
if (!empty($model)) {
$page_title = $model['gallery_title'];
}
return $this->render('photo_gallery_details', ['page_title' => $page_title, 'data_id' => $id]);
}
public function actionVideoGallery() {
return $this->render('video_gallery');
}
public function actionVideoGalleryDetails($id) {
$page_title = '';
$model = (new \yii\db\Query())->from('content_video')
->innerJoin('content_video_translation', 'content_video.video_id=content_video_translation.video_translation_parent_id')
->where(['=', 'video_id', $id])->one();
if (!empty($model)) {
$page_title = $model['video_translation_title'];
}
return $this->render('video_gallery_details', ['page_title' => $page_title, 'data_id' => $id]);
}
public function actionDocument() {
return $this->render('document');
}
public function actionDocumentDetails($id) {
$page_title = '';
$model = (new \yii\db\Query())->from('content_downloads')->where(['=', 'download_id', $id])->one();
if (!empty($model)) {
$page_title = $model['download_title'];
}
return $this->render('document_details', ['page_title' => $page_title, 'data_id' => $id]);
}
public function actionDocumentDownload() {
return $this->render('document_download');
}
public function actionDocumentDownloadDetails($id) {
$page_title = '';
$model = (new \yii\db\Query())->from('content_downloads')->where(['=', 'download_id', $id])->one();
if (!empty($model)) {
$page_title = $model['download_title'];
}
return $this->render('document_download_details', ['page_title' => $page_title, 'data_id' => $id]);
}
public function actionPublication() {
return $this->render('publication');
}
public function actionPublicationDetails($id) {
$page_title = '';
$model = (new \yii\db\Query())->from('publication_document')
->innerJoin('publication_document_translation', 'publication_document.document_id=publication_document_translation.document_translation_parent_id')
->where(['=', 'document_id', $id])->one();
if (!empty($model)) {
$page_title = $model['document_translation_title'];
}
return $this->render('publication_details', ['page_title' => $page_title, 'data_id' => $id]);
}
public function actionPublicationDownload() {
return $this->render('publication_download');
}
public function actionPublicationDownloadDetails($id) {
$page_title = '';
$model = (new \yii\db\Query())->from('publication_document')
->innerJoin('publication_document_translation', 'publication_document.document_id=publication_document_translation.document_translation_parent_id')
->where(['=', 'document_id', $id])->one();
if (!empty($model)) {
$page_title = $model['document_translation_title'];
}
return $this->render('publication_download_details', ['page_title' => $page_title, 'data_id' => $id]);
}
public function actionStatistics() {
return $this->render('statistics');
}
public function actionStatisticsDetails($id) {
$page_title = '';
$model = (new \yii\db\Query())->from('content_statistics')->where(['=', 'stats_id', $id])->one();
if (!empty($model)) {
$page_title = $model['stats_title'];
}
return $this->render('statistics_details', ['page_title' => $page_title, 'data_id' => $id]);
}
public function actionAnnouncement() {
return $this->render('announcement');
}
public function actionAnnouncementDetails($id) {
$page_title = '';
$model = (new \yii\db\Query())->from('content_announcement')
->innerJoin('content_announcement_translation', 'content_announcement.announcement_id=content_announcement_translation.announcement_translation_parent_id')
->where(['=', 'announcement_id', $id])->one();
if (!empty($model)) {
$page_title = $model['announcement_translation_title'];
}
return $this->render('announcement_details', ['page_title' => $page_title, 'data_id' => $id]);
}
}