28 $args =
new stdClass();
29 $args->regdate = date(
'Ymd');
30 $args->ipaddress = $_SERVER[
'REMOTE_ADDR'];
31 $args->site_srl = $site_srl;
35 if($oCacheHandler->isSupport())
37 $object_key =
'counter:' . $site_srl .
'_' . str_replace(array(
'.',
':'),
'-',
$args->ipaddress);
38 $cache_key = $oCacheHandler->getGroupKey(
'counterIpLogged_' .
$args->regdate, $object_key);
39 $iplogged = $oCacheHandler->get($cache_key);
42 if($iplogged ===
false)
45 if(
$output->data->count) $iplogged = TRUE;
48 if($iplogged && $oCacheHandler->isSupport())
50 $oCacheHandler->put($cache_key, $iplogged);
65 $args->regdate = date(
'Ymd');
67 $insertedTodayStatus =
false;
69 if($oCacheHandler->isSupport())
71 $cache_key =
'counter:insertedTodayStatus:' . $site_srl .
'_' .
$args->regdate;
72 $insertedTodayStatus = $oCacheHandler->get($cache_key);
75 if($insertedTodayStatus ===
false)
79 $args->site_srl = $site_srl;
87 $insertedTodayStatus = !!
$output->data->count;
89 if($insertedTodayStatus && $oCacheHandler->isSupport())
91 $oCacheHandler->put($cache_key, TRUE);
92 $_old_date = date(
'Ymd', strtotime(
'-1 day'));
93 $oCacheHandler->delete(
'counter:insertedTodayStatus:' . $site_srl .
'_' . $_old_date);
97 return $insertedTodayStatus;
110 $args =
new stdClass();
111 $args->regdate = is_array($selected_date) ? join(
',', $selected_date) : $selected_date;
114 $args->site_srl = $site_srl;
123 if(!is_array($selected_date))
128 if(!is_array($status)) $status = array($status);
130 foreach($status as $val)
132 $output[substr($val->regdate, 0, 8)] = $val;
146 function getHourlyStatus($type =
'hour', $selected_date, $site_srl = 0, $isPageView =
false)
157 $args =
new stdClass();
158 $args->site_srl = $site_srl;
166 if(!($start_year = substr(
$output->data->regdate, 0, 4)))
168 $start_year = date(
"Y");
171 for($i = $start_year, $y = date(
"Y"); $i <= $y; $i++)
173 $args =
new stdClass();
174 $args->start_date = sprintf(
'%04d0000', $i);
175 $args->end_date = sprintf(
'%04d1231', $i);
179 $args->site_srl = $site_srl;
187 $count = (int)($isPageView ?
$output->data->pageview :
$output->data->unique_visitor);
188 $status->list[$i] = $count;
190 if($count > $max) $max = $count;
197 $time = strtotime($selected_date);
200 while(date(
"D", $time) !=
"Sun")
202 $time += 60 * 60 * 24;
205 $time -= 60 * 60 * 24;
207 while(date(
"D", $time) !=
"Sun")
209 $thisWeek[] = date(
"Ymd", $time);
210 $time -= 60 * 60 * 24;
213 $thisWeek[] = date(
"Ymd", $time);
217 foreach($thisWeek as $day)
219 $args =
new stdClass();
220 $args->start_date = $day;
221 $args->end_date = $day;
225 $args->site_srl = $site_srl;
233 $count = (int)($isPageView ?
$output->data->pageview :
$output->data->unique_visitor);
234 $status->list[$day] = $count;
236 if($count > $max) $max = $count;
243 $year = substr($selected_date, 0, 4);
244 for($i = 1; $i <= 12; $i++)
246 $args =
new stdClass();
247 $args->start_date = sprintf(
'%04d%02d00', $year, $i);
248 $args->end_date = sprintf(
'%04d%02d31', $year, $i);
252 $args->site_srl = $site_srl;
260 $count = (int)($isPageView ?
$output->data->pageview :
$output->data->unique_visitor);
261 $status->list[$i] = $count;
263 if($count > $max) $max = $count;
270 for($i = 0; $i < 24; $i++)
272 $args =
new stdClass();
273 $args->start_date = sprintf(
'%08d%02d0000', $selected_date, $i);
274 $args->end_date = sprintf(
'%08d%02d5959', $selected_date, $i);
278 $args->site_srl = $site_srl;
287 $count = (int)
$output->data->count;
288 $status->list[$i] = $count;
290 if($count > $max) $max = $count;
297 $year = substr($selected_date, 0, 4);
298 $month = substr($selected_date, 4, 2);
299 $end_day = date(
't', mktime(0, 0, 0, $month, 1, $year));
301 for($i = 1; $i <= $end_day; $i++)
303 $args =
new stdClass();
304 $args->start_date = sprintf(
'%04d%02d%02d', $year, $month, $i);
305 $args->end_date = sprintf(
'%04d%02d%02d', $year, $month, $i);
309 $args->site_srl = $site_srl;
317 $count = (int)($isPageView ?
$output->data->pageview :
$output->data->unique_visitor);
318 $status->list[$i] = $count;
320 if($count > $max) $max = $count;
336 $date1 = date(
'Ymd', strtotime(
'-1 week'));
340 foreach($output1->list as $key => $value)
342 $tmp[
"'" . $key .
"'"] = $value;
344 $output1->list = $tmp;
347 $date2 = date(
'Ymd');
351 foreach($output2->list as $key => $value)
353 $tmp[
"'" . $key .
"'"] = $value;
355 $output2->list = $tmp;
357 $this->
add(
'last_week', $output1);
358 $this->
add(
'this_week', $output2);
364 $date1 = date(
'Ymd', strtotime(
'-1 week'));
368 foreach($output1->list as $key => $value)
370 $tmp[
"'" . $key .
"'"] = $value;
372 $output1->list = $tmp;
375 $date2 = date(
'Ymd');
379 foreach($output2->list as $key => $value)
381 $tmp[
"'" . $key .
"'"] = $value;
383 $output2->list = $tmp;
385 $this->
add(
'last_week', $output1);
386 $this->
add(
'this_week', $output2);
& getInstance($target= 'object', $info=null, $always_use_file=false)
isInsertedTodayStatus($site_srl=0)
getHourlyStatus($type= 'hour', $selected_date, $site_srl=0, $isPageView=false)
getStatus($selected_date, $site_srl=0)
executeQuery($query_id, $args=NULL, $arg_columns=NULL)