Exemple #1
0
 public function index()
 {
     $userInfo = $this->conf_data['userInfo'];
     if ($userInfo['modules'] != "*" && !in_array("dashboard", json_decode($userInfo['modules'], true))) {
         $modules = json_decode($userInfo['modules'], true);
         //$translate_modules = array("order_korean"=>"koreanpackage");
         //header('Location:http://usermgt.useetv.com'.DOO::conf()->SUBFOLDER."".$translate_modules[$modules[0]]);
     }
     set_time_limit(0);
     $data = $this->conf_data;
     Doo::loadClass('UserSession');
     Doo::loadClass('Movie');
     $usession = new UserSession();
     $mv = new Movie();
     $username = $usession->uget('username');
     if (!$username) {
         header('Location:' . DOO::conf()->SUBFOLDER . 'login');
     }
     $dbapi = $this->dbapi;
     $data['limit'] = 20;
     $gpage = $_GET['page'] - 1;
     if ($_REQUEST['print'] == 'excel') {
         set_time_limit(0);
         ini_set('memory_limit', '512M');
         $data['limit'] = 99999999;
         unset($gpage);
     }
     $gord = $_GET['ord'];
     $gsearch = addslashes($_GET['search']);
     $gdtform = addslashes($_GET['dtform']);
     $gdtto = addslashes($_GET['dtto']);
     $start = 0;
     $ord = '';
     $qsearch = '';
     $qutype = '';
     $qfilter = '';
     $qSpeedyReginal = '';
     $ordby = "ASC";
     if ($username == 'dcs_timur') {
         $_GET['userProvider'] = 1;
         if (!$_REQUEST['speedyRegional']) {
             $_REQUEST['speedyRegional'] = "14;15;16;17";
         }
     }
     if ($username == 'dcs_barat') {
         $_GET['userProvider'] = 1;
         if (!$_REQUEST['speedyRegional']) {
             $_REQUEST['speedyRegional'] = "11;12;13";
         }
     }
     if ($username == 'telkomsel') {
         $_GET['userProvider'] = 2;
     }
     if ($_REQUEST['speedyRegional']) {
         $tempSpeedyReg = explode(';', $_REQUEST['speedyRegional']);
         $impSpeedyReg = implode("','", $tempSpeedyReg);
         $qSpeedyReginal = " AND left( ota.bill_account,2) in ('{$impSpeedyReg}') ";
         if ($_REQUEST['speedySubRegional']) {
             $qSpeedyReginal = " AND left( ota.bill_account,5) in ('{$_REQUEST['speedySubRegional']}') ";
         }
     }
     if ($_GET['userProvider'] == 1) {
         $data['dcs_barat'] = $dbapi->get_billing_account("left( bill_account,2) in ('11','12','13') AND bill_account_type=1 ");
         $data['dcs_timur'] = $dbapi->get_billing_account("left( bill_account,2) in ('14','15','16','17') AND bill_account_type=1 ");
         $data['reg_1'] = $dbapi->get_billing_account("left( bill_account,2) in ('11') AND bill_account_type=1 ");
         $data['reg_2'] = $dbapi->get_billing_account("left( bill_account,2) in ('12') AND bill_account_type=1 ");
         $data['reg_3'] = $dbapi->get_billing_account("left( bill_account,2) in ('13') AND bill_account_type=1 ");
         $data['reg_4'] = $dbapi->get_billing_account("left( bill_account,2) in ('14') AND bill_account_type=1 ");
         $data['reg_5'] = $dbapi->get_billing_account("left( bill_account,2) in ('15') AND bill_account_type=1 ");
         $data['reg_6'] = $dbapi->get_billing_account("left( bill_account,2) in ('16') AND bill_account_type=1 ");
         $data['reg_7'] = $dbapi->get_billing_account("left( bill_account,2) in ('17') AND bill_account_type=1 ");
         if (array_key_exists($_REQUEST['speedyRegional'], $this->subregion)) {
             foreach ($this->subregion[$_REQUEST['speedyRegional']] as $kreg => $vreg) {
                 $data[$kreg] = $dbapi->get_billing_account("left( bill_account,5) in ('{$kreg}') AND bill_account_type=1 ");
             }
         }
     }
     if ($_GET['userProvider']) {
         $qutype = " AND type = '" . (int) $_GET['userProvider'] . "'";
     }
     $qwhere = "1=1  AND create_time > '2012-08-31' {$qutype} {$qSpeedyReginal}";
     $data['total_active'] = $dbapi->get_user('*', " create_time > '{$this->start_date}' ", false, false, false, true);
     if ($qSpeedyReginal) {
         $dbapi->join_table = "LEFT JOIN ott_business_account ota ON (ics.id=ota.subscriber_id)";
     }
     $data['total'] = $dbapi->get_user('*', $qwhere, false, false, false, true);
     $dbapi->join_table = '';
     $data['total_speedy'] = $dbapi->get_user('*', " type = '1' AND create_time > '{$this->start_date}' ", false, false, false, true);
     $total_binding = $dbapi->get_speedy_user_bind();
     $data['total_speedy_bind'] = count($total_binding);
     $data['total_telkomsel'] = $dbapi->get_user('*', " type = '2' AND create_time > '{$this->start_date}' ", false, false, false, true);
     $data['total_flexi'] = $dbapi->get_user('*', " type = '3' AND create_time > '{$this->start_date}' AND left(user_id,1) = '0' ", false, false, false, true);
     $data['total_others'] = $dbapi->get_user('*', " type = '3' AND create_time > '{$this->start_date}' AND left(user_id,1) != '0' ", false, false, false, true);
     $data['ppv_speedy'] = $mv->get_count_ppv("(user_id in ( SELECT user_id FROM ioss_cs_subscriber WHERE type=1) OR user_id in('88300500021','kokoronotompel')) ");
     $data['ppv_flexi'] = $mv->get_count_ppv("(user_id  in ( SELECT user_id FROM ioss_cs_subscriber WHERE type=3 AND left(user_id,1) = '0' ) OR ( left(user_id,2) != '08' AND user_id not in (SELECT user_id FROM ioss_cs_subscriber) AND left(user_id,1) = '0' ) )");
     $data['ppv_telkomsel'] = $mv->get_count_ppv('user_id in ( SELECT user_id FROM ioss_cs_subscriber WHERE type=2) ');
     $data['ppv_others'] = $mv->get_count_ppv("user_id in ( SELECT user_id FROM ioss_cs_subscriber WHERE type=3 AND left(user_id,1) != '0' ) ");
     $data['ppv_total'] = $mv->get_count_ppv();
     $data['svod_speedy'] = $mv->get_count_svod('user_id in ( SELECT user_id FROM ioss_cs_subscriber WHERE type=1)');
     $data['svod_flexi'] = $mv->get_count_svod("user_id in ( SELECT user_id FROM ioss_cs_subscriber WHERE type=3 AND left(user_id,1) = '0')");
     $data['svod_others'] = $mv->get_count_svod("user_id in ( SELECT user_id FROM ioss_cs_subscriber WHERE type=3 AND left(user_id,1) != '0')");
     $data['svod_telkomsel'] = $mv->get_count_svod("(user_id  in ( SELECT user_id FROM ioss_cs_subscriber WHERE type=2 ) OR ( left(user_id,2) = '08' AND user_id not in (SELECT user_id FROM ioss_cs_subscriber WHERE type=2) ) )");
     $data['svod_total'] = $mv->get_count_svod();
     $data['username'] = $username;
     $data['dbapi'] = $this->dbapi;
     $data['subregion'] = $this->subregion;
     //$cache_name = "google_analytics_".date("Y_m_d");
     //$mostview	= $this->cache->get($cache_name);
     //$mostview = $devices = array();
     //$prevmonth = date("Y-m-d",strtotime("-1 month"));
     //$prevmonth = $this->start_date;
     //Doo::loadClass('gapi/gapi.class');
     Doo::loadClass('GA');
     $ga = new GA();
     $data['most_view'] = $ga->get_most_view_movie();
     $data['devices'] = $ga->get_devices();
     $data['other_gstat'] = $ga->get_other_visits_stats();
     $this->view()->renderc(Doo::conf()->language . '/t3', $data);
 }