示例#1
0
 public function action_view($data_id = null)
 {
     ini_set('memory_limit', '-1');
     ini_set('max_execution_time', 300);
     if (!is_null($data_id)) {
         $listDetails = \Data\Model_Data::get_stats($data_id);
         $oneList = $listDetails[0];
         $basicStats = array('cost' => $oneList['cost'], 'purchased' => $oneList['purchased_leads'], 'duplicates' => $oneList['duplicates'], 'tps' => $oneList['tps'], 'dialable' => $oneList['dialable_leads'], 'contacted' => $oneList['contacted_leads'], 'referrals' => $oneList['referrals'], 'packout' => $oneList['pack_out'], 'packin' => $oneList['pack_in'], 'paid' => $oneList['first_payment'], 'listid' => $oneList['dialler_id']);
         //	    $invalidLeads = \Data\Model_Data::get_invalids($data_id);
         $tpsNumbers = $duplicateNumbers = array();
         foreach ($invalidLeads as $singleLead) {
             $leadDetails = unserialize($singleLead['number_data']);
             if (isset($leadDetails['duplicates']) && count($leadDetails['duplicates']) > 0) {
                 $duplicateNumbers[] = array('leadDetails' => $singleLead, 'number' => $leadDetails['duplicates']['number'], 'list_ids' => $leadDetails['duplicates']['list_ids']);
             }
             if (isset($leadDetails['tps']) && count($leadDetails['tps']) > 0) {
                 $tpsNumbers[] = array('leadDetails' => $singleLead, 'number' => $leadDetails['tps'][0]);
             }
         }
         $statusPie = \Data\Model_Data::get_statuses($data_id);
         // Turn the status results into a flot pie chart
         $pieText = "";
         foreach ($statusPie as $status => $total) {
             $pieText .= '{ label: "' . $status . '",  data: ' . $total . '},';
         }
         list($lastSoftReset, $lastHardReset, $softCount, $hardCount, $allResets) = Model_Data::get_reset_dates($data_id);
         $this->template->title = 'Statistics for List ' . $data_id;
         $this->template->content = \View::forge('view/view', array('listID' => $data_id, 'basicStats' => $basicStats, 'statuses' => $pieText, 'importantDates' => array('added' => $oneList['added_date'], 'lastSoft' => $lastSoftReset, 'lastHard' => $lastHardReset, 'softCount' => $softCount, 'hardCount' => $hardCount, 'allResets' => $allResets)), false);
     } else {
         // List ID has not been given
     }
 }