%PDF-1.4
Directory : /var/www/vhosts/lautnusantara.com/httpdocs/mis/app/Controllers/ |
<?php namespace App\Controllers; use CodeIgniter\Controller; // use App\Models\DashboardModel; use App\Models\History_model; use App\Models\Video_Model; use App\Models\Video_category_Model; class Video_hits extends BaseController { protected $History; protected $session; protected $Video_Model; protected $Video_category_Model; protected $url_video_web; public function __construct() { $this->History = new History_model(); $this->session = session(); $this->Video_Model = new Video_Model(); $this->Video_category_Model = new Video_category_Model(); $parsed_url = parse_url(base_url()); // Mendapatkan host $host = $parsed_url['host']; // Mencari tanda '.' pertama untuk menentukan domain utama $dot_position = strpos($host, '.'); // Jika ada subdomain, maka indeks "." akan ada if ($dot_position !== false) { // Mengambil domain utama $main_domain = substr($host, $dot_position + 1); } else { // Jika tidak ada subdomain, domain adalah host itu sendiri $main_domain = $host; } // Membuat URL domain utama $this->url_video_web = $parsed_url['scheme'] . '://' . $main_domain . '/detail/video/'; } public function index() { $user_id = session()->get('user_id'); $username = session()->get('username'); $firstname = session()->get('firstname'); $lastname = session()->get('lastname'); $this->History->save([ 'user_id' => $user_id, 'username' => $username, 'name' => $firstname . ' ' . $lastname, 'kegiatan' => 'Hits Video', 'jenis_kegiatan' => 'Daftar Hits Video', 'tanggal_waktu' => date('Y-m-d H:i:s') ]); $thn = date('Y'); $bln = date('m'); // $this->data_dashboard = new DashboardModel(); $keyword = $this->request->getGet('search'); $order = $this->request->getGet('order'); $limit = 10; $data = array( 'title' => 'MCS - Manajemen Compro System', 'description' => 'Aplikasi MCS - Manajemen Compro System', 'keywords' => 'MCS, Manajemen, Compro', 'author' => 'SSN', 'parent_id_menu' => '41', 'parent_id_submenu' => '', 'id_menu' => '59', 'page1' => 'Hits Video', 'page2' => '', 'link01' => base_url() . '/video_hits', 'link02' => base_url() . '/video_hits', // 'data_video' => $this->Video_Model->get_video()->get()->getResultArray(), 'data_video' => $this->Video_Model->get_hits_video(false, false, false, $thn, $bln, $order)->paginate($limit), // 'componen' => 'theme/BeyondAdmin/halaman/master_data/video/daftar' ); if ($keyword != null) { $data['data_video'] = $this->Video_Model->get_hits_video(false, $keyword, false, $thn, $bln)->paginate($limit); } $data['url_video_web'] = $this->url_video_web; $data['pager'] = $this->Video_Model->pager->links(); $data['keyword'] = $keyword; $data['order'] = $order; $data['limit'] = $limit; $data['componen'] = 'theme/BeyondAdmin/halaman/master_data/video/daftar_hits'; $data['page'] = $this->request->getVar('page') ? $this->request->getVar('page') : 1; echo view('layout', $data); } } ?>