function prepareForm($me) { $vcardform = $this->tpl(); $vcardform->assign('me', $me); $vcardform->assign('desc', trim($me->description)); $vcardform->assign('gender', getGender()); $vcardform->assign('marital', getMarital()); $vcardform->assign('countries', getCountries()); $me->isValidDate(); $vcardform->assign('submit', $this->call('ajaxVcardSubmit', "MovimUtils.formToJson('vcard4')")); $vcardform->assign('privacy', $this->call('ajaxChangePrivacy', "this.checked")); // The datepicker arrays $days = $months = $years = []; for ($i = 1; $i <= 31; $i++) { if ($i < 10) { $j = '0' . $i; } else { $j = (string) $i; } $days[$i] = $j; } for ($i = 1; $i <= 12; $i++) { if ($i < 10) { $j = '0' . $i; } else { $j = (string) $i; } $m = getMonths(); $months[$j] = $m[$i]; } for ($i = date('o'); $i >= 1920; $i--) { array_push($years, $i); } $vcardform->assign('days', $days); $vcardform->assign('months', $months); $vcardform->assign('years', $years); return $vcardform->draw('_vcard4_form', true); }
{ "use strict"; $(document).ready(function() { // Morris.js Graphs if(typeof Morris != 'undefined') { // Area Chart Morris.Area({ element: 'chart10', data: [ <?php $periods = getMonths('2014-09-22', date('Y-m-d')); $ii = 0; foreach ($periods as $dt) { $yearmonth = $dt->format("Y-m"); $ii++; $qry_roi_month = "SELECT SUM(avg_sale_revenue) as total_lifetime FROM roi WHERE roi_date LIKE '%" . $yearmonth . "%' AND client_id='" . $client_id . "'"; $res_roi_month = $db->Execute($qry_roi_month); $roi_total = $res_roi_month->fields['total_lifetime']; if ($roi_total == '') { $roi_total = 0; } ?> { y: '<?php echo $yearmonth; ?> ', a: <?php
public function getLeadsChartDataClient($period) { require_once dirname(__FILE__) . '/Client.php'; $campaigns = Client::get_campaigns(); $first_campaign_start = Client::getFirstCampaignStartDate(); //if(empty($campaigns)) return array(); $union_array = array(); foreach ($campaigns as $campaign) { $sql = "(SELECT * FROM calls WHERE gsm_number='" . $campaign['gsm_number'] . "'"; if ($campaign['start_date'] != '0000-00-00') { //if($date < $campaign['start_date']) continue; $sql .= " AND call_start>='" . $campaign['start_date'] . "'"; } if ($campaign['end_date'] != '0000-00-00') { //if($date > $campaign['end_date']) continue; $sql .= " AND call_end<='" . $campaign['end_date'] . "'"; } $sql .= ")"; $union_array[] = $sql; } $inner_sql = implode(" UNION ", $union_array); if ($inner_sql == '') { $inner_sql = "(SELECT * FROM calls WHERE id = NULL)"; } $client_calls_where = " AND test_data=0 ORDER BY call_start DESC"; $client_email_where = " AND client_id IN ('" . implode('\',\'', $this->get_unbounce_ids()) . "') AND test_data=0\n ORDER BY email_date DESC"; $data = array(); $period_days = array(); $date_filter = "Y-m-d"; if ($period == 'lifetime') { $period_days = getMonths($this->from, $this->to); $date_filter = "Y-m"; } elseif ($period == 'last_30_days' || $period == 'last_7_days' || $period == 'yesterday' || $period == 'month' || $period == 'daily' || $period == 'today' || $period == 'this_month' || $period == 'custom' || $period == 'last_month') { $period_days = createDateRangeArray($this->from, $this->to); } else { $period_days = createDateRangeArray($this->from, $this->to); } $campaign_start_limit = ""; if ($first_campaign_start != '') { $campaign_start_limit = "WHERE call_start>='{$first_campaign_start}'"; } if (!empty($period_days)) { foreach ($period_days as $date) { if ($date_filter === 'Y-m-d') { $date_filtered = $date; } else { $date_filtered = date_format($date, "{$date_filter}"); } $q1 = "SELECT count(*) as total_calls FROM ({$inner_sql}) AS calls WHERE call_start LIKE '%" . $date_filtered . "%' {$client_calls_where} "; $c_total = 0; $c_total = DashboardCommon::executeAndReturnSingleColResultAndCache($q1, 'total_calls'); $q2 = "SELECT count(*) as total_emails FROM emails WHERE \n CONVERT_TZ(email_date,'+00:00','+04:00') LIKE '" . $date_filtered . "%' {$client_email_where}"; $e_total = DashboardCommon::executeAndReturnSingleColResultAndCache($q2, 'total_emails'); $sql_leads = "SELECT * , tcalls+temails as total_leads\n FROM\n (SELECT \n /*COUNT(DISTINCT /*DATE_FORMAT(call_start,'%y-%m-%d') ,// gsm_number) as tcalls*/\n COUNT(*) AS tcalls\n FROM ({$inner_sql}) AS calls \n WHERE\n id IN ( SELECT id FROM calls {$campaign_start_limit} GROUP BY callerid HAVING MIN(call_start) ) AND\n call_start LIKE '%" . $date_filtered . "%' {$client_calls_where}\n ) as a , \n (SELECT \n COUNT(*) as temails\n FROM emails \n WHERE\n CONVERT_TZ(email_date,'+00:00','+04:00') LIKE '" . $date_filtered . "%' {$client_email_where}\n ) as b"; //echo $sql_leads; die(); $tot_leads = DashboardCommon::executeAndReturnSingleColResultAndCache($q1, 'total_leads'); $row = array('y' => $date_filtered, 'a' => $c_total, 'b' => $e_total, 'c' => $tot_leads); $data[] = $row; } } return $data; }
?> </th> <th><?php echo date('M-Y', getMonths(8)); ?> </th> <th><?php echo date('M-Y', getMonths(9)); ?> </th> <th><?php echo date('M-Y', getMonths(10)); ?> </th> <th><?php echo date('M-Y', getMonths(11)); ?> </th> </tr> </thead> <tbody> <?php if (isset($contents)) { for ($i = 0; $i < count($contents) - 1; $i++) { echo '<tr>'; echo '<td>' . $targets[0]->full_name . '</td>'; for ($j = 0; $j <= 12; $j++) { echo '<td>'; if (is_numeric($contents[$i][$j])) { echo number_format($contents[$i][$j], 2); } else {
public function getLeadsChartData($period) { if (!DashboardCommon::is_su()) { $client_calls_where = " AND gsm_number IN (" . $this->get_gsm_number() . ") AND test_data=0\n {$this->calls_data_limit_clause}\n ORDER BY call_start DESC"; $client_email_where = " AND client_id IN ('" . implode('\',\'', $this->get_unbounce_ids()) . "') AND test_data=0\n ORDER BY email_date DESC"; } $data = array(); $period_days = array(); $date_filter = "Y-m-d"; if ($period == 'lifetime') { $period_days = getMonths($this->from, $this->to); $date_filter = "Y-m"; } elseif ($period == 'last_30_days' || $period == 'last_7_days' || $period == 'yesterday' || $period == 'month' || $period == 'daily' || $period == 'today' || $period == 'this_month' || $period == 'custom' || $period == 'last_month') { $period_days = createDateRangeArray($this->from, $this->to); } else { $period_days = createDateRangeArray($this->from, $this->to); } if (!empty($period_days)) { foreach ($period_days as $date) { if ($date_filter === 'Y-m-d') { $date_filtered = $date; } else { $date_filtered = date_format($date, "{$date_filter}"); } $q1 = "SELECT count(*) as total_calls FROM calls WHERE call_start LIKE '%" . $date_filtered . "%' {$client_calls_where} "; $rc = DashboardCommon::db()->Execute($q1); $c_total = $rc->fields['total_calls']; if ($c_total == '') { $c_total = 0; } $q2 = "SELECT count(*) as total_emails FROM emails WHERE email_date LIKE '%" . $date_filtered . "%' {$client_email_where}"; $re = DashboardCommon::db()->Execute($q2); $e_total = $re->fields['total_emails']; if ($e_total == '') { $e_total = 0; } $sql_leads = "SELECT * , tcalls+temails as total_leads\n FROM\n (SELECT \n COUNT(DISTINCT DATE_FORMAT(call_start,'%y-%m-%d') , gsm_number) as tcalls\n FROM calls \n WHERE\n call_start LIKE '%" . $date_filtered . "%' {$client_calls_where}\n ) as a , \n (SELECT \n COUNT(*) as temails\n FROM emails \n WHERE\n email_date LIKE '%" . $date_filtered . "%' {$client_email_where}\n ) as b"; //echo $sql_leads; die(); $res_leads = DashboardCommon::db()->Execute($sql_leads); $tot_leads = $res_leads->fields['total_leads'] != '' ? $res_leads->fields['total_leads'] : 0; $row = array('y' => $date_filtered, 'a' => $c_total, 'b' => $e_total, 'c' => $tot_leads); $data[] = $row; } } return $data; }
</button> </div> <div class="section"> <br><br><br><br> </div> </div> <div class="shadow"></div> <div class="popup form"> <h2 id="title">April 2015</h2> <div class="item"><div class="itemTitle"><?php gs("Mesec"); ?> : </div><select id="mesec"> <?php getMonths(); ?> </select><input type="text" id="leto" placeholder="Leto"> </div> <div class="item"><div class="itemTitle"><?php gs("Razdalja"); ?> : </div><input type="text" id="razdalja"> km</div> <div class="item"><div class="itemTitle timepicker"><?php gs("Čas"); ?> : </div><input type="text" id="ura"> h <input type="text" id="minuta"> min <input type="text" id="sekunda"> s</div> <div class="item"><div class="itemTitle"><?php gs("Povprečna"); ?> <?php