php class staticAction extends sfAction public function execute date d

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
class staticAction extends sfAction
{
public function execute()
{
$date = date("Y-m-d");
$lastMonth = date('Y-m-d', (strtotime(date("Y-m-d")) - 30*24*60*60));
$c = new Criteria();
$c->add(ContentPeer::SERVICE, 28);
$c->add(ContentPeer::DATE, $lastMonth, Criteria::GREATER_EQUAL);
$c->add(ContentPeer::DATE, $date, Criteria::LESS_EQUAL);
//$c->addAscendingOrderByColumn(ContentPeer::DATE);
//$c->addGroupByColumn(ContentPeer::DATE);
$c->add(ContentPeer::SHORTCODE,'6771');
$contents = ContentPeer::doSelect($c);
$arrTF = array();
$arrDate = array();
foreach($contents as $content)
{
$date = $content->getDate();
$arrDate[] = $date;
echo $arrTF_temp[$date][] = $content->getTrueORFalse();
// $arr = $content->getShortCode().'-';
}
print_r($arrTF_temp);
$tf_re = 'F';
$arrTF = array();
foreach ($arrTF_temp as $key => $val) {
if(count($val) > 1) {
foreach($val as $TF) {
if ($TF == 'T') {
$tf_re = 'T';
}
}
$arrTF[] = $tf_re;
} else {
$arrTF[] = $val[0];
}
}
foreach ($arrTF as $value) {
echo $value;
}
$count = 1;
for($i = 1; $i<count($arrTF)-1; $i++)
{
if($arrTF[$i] == $arrTF[$i+1]) {
$count++;
} else {
echo $count . "<br>";
$count = 1;
}
}
}
}