fixed php notices, meaningful heredoc-modifiers

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@42159 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-16 20:35:04 +00:00
parent ddb0136c62
commit f1285c839d

View File

@ -15,16 +15,16 @@ class Statistics extends Controller {
static function TrendChart($table, $filter = "day", $name, $type, $color) static function TrendChart($table, $filter = "day", $name, $type, $color)
{ {
$top = <<<END $top = <<<HTML
<div id="trendchart" style="display: none"> <div id="trendchart" style="display: none">
<h2>Trends</h2> <h2>Trends</h2>
<div><canvas id="chart" height="400" width="700"></canvas></div> <div><canvas id="chart" height="400" width="700"></canvas></div>
<div id="chart_legend"><legend>Legend</legend></div> <div id="chart_legend"><legend>Legend</legend></div>
</div> </div>
<script type="text/javascript">\n <script type="text/javascript">\n
END; HTML;
$bot = <<<END $bot = <<<HTML
var chart = new Plotr.{$type}Chart('chart',options); var chart = new Plotr.{$type}Chart('chart',options);
chart.addDataset(chartdata); chart.addDataset(chartdata);
@ -35,7 +35,7 @@ var chart = new Plotr.{$type}Chart('chart',options);
chart.addLegend($('chart_legend')); chart.addLegend($('chart_legend'));
</script> </script>
END; HTML;
$ds = "var chartdata = { \n"; $ds = "var chartdata = { \n";
@ -122,7 +122,7 @@ END;
} }
$opts = <<<END $opts = <<<HTML
var options = { var options = {
axisLabelFontSize: 10, axisLabelFontSize: 10,
@ -133,7 +133,7 @@ var options = {
colorScheme: '{$color}',\n\n colorScheme: '{$color}',\n\n
END; HTML;
$opts .= $xt . "]\n};"; $opts .= $xt . "]\n};";
@ -142,7 +142,8 @@ END;
static function UserRecordTable() { static function UserRecordTable() {
$records = DataObject::get('Member'); $records = DataObject::get('Member');
$top = <<<END $baseURL = Director::baseURL();
$top = <<<HTML
<div id="usertable" style="display: none"> <div id="usertable" style="display: none">
<h2>Registered Users</h2> <h2>Registered Users</h2>
<p><a href="$baseURL/admin/statistics/usercsv">Export as CSV</a></p> <p><a href="$baseURL/admin/statistics/usercsv">Export as CSV</a></p>
@ -151,7 +152,7 @@ END;
<tr><th class="sortable-numeric">ID</th><th class="sortable-text">Email</th><th class="sortable-sortDatetime">Joined</th></tr> <tr><th class="sortable-numeric">ID</th><th class="sortable-text">Email</th><th class="sortable-sortDatetime">Joined</th></tr>
</thead> </thead>
<tbody> <tbody>
END; HTML;
$bod = ""; $bod = "";
foreach($records as $x) { foreach($records as $x) {
$r = $x->toMap(); $r = $x->toMap();
@ -160,11 +161,11 @@ END;
$date = date("F j, Y G:i:s", strtotime($r['Created'])); $date = date("F j, Y G:i:s", strtotime($r['Created']));
$bod .= "<tr><td>$id</td><td>$email</td><td>$date</td></tr>"; $bod .= "<tr><td>$id</td><td>$email</td><td>$date</td></tr>";
} }
$bot = <<<END $bot = <<<HTML
</tbody> </tbody>
</table> </table>
</div> </div>
END; HTML;
//$js = "\n\n<script type=\"text/javascript\">\n\tvar usertable = new TableKit('usertable');\nusertable.initialize();\n</script>\n"; //$js = "\n\n<script type=\"text/javascript\">\n\tvar usertable = new TableKit('usertable');\nusertable.initialize();\n</script>\n";
return $top . $bod . $bot; return $top . $bod . $bot;
} }
@ -177,7 +178,7 @@ END;
static function getRecentViews($limit = 15) { static function getRecentViews($limit = 15) {
$records = DataObject::get('PageView', null, 'Created DESC', null, $limit); $records = DataObject::get('PageView', null, 'Created DESC', null, $limit);
$top = <<<END $top = <<<HTML
<div id="recentviewtable"> <div id="recentviewtable">
<h2>Recent Page Views</h2> <h2>Recent Page Views</h2>
<table class="sortable-onload-1 rowstyle-alt no-arrow paginate-10 statstable" border="0" cellspacing="1" cellpadding="0"> <table class="sortable-onload-1 rowstyle-alt no-arrow paginate-10 statstable" border="0" cellspacing="1" cellpadding="0">
@ -185,7 +186,7 @@ END;
<tr><th class="sortable-numeric">ID</th><th class="sortable-sortDatetime">Time</th><th class="sortable-text">Browser</th><th class="sortable-text">OS</th><th>User</th><th class="sortable-text">Page</th></tr> <tr><th class="sortable-numeric">ID</th><th class="sortable-sortDatetime">Time</th><th class="sortable-text">Browser</th><th class="sortable-text">OS</th><th>User</th><th class="sortable-text">Page</th></tr>
</thead> </thead>
<tbody> <tbody>
END; HTML;
$bod = ""; $bod = "";
foreach($records as $x) { foreach($records as $x) {
$r = $x->toMap(); $r = $x->toMap();
@ -197,11 +198,11 @@ END;
$page = $r['PageID']; $page = $r['PageID'];
$bod .= "<tr><td>$id</td><td>$time</td><td>$browser</td><td>$os</td><td>$user</td><td>$page</td></tr>"; $bod .= "<tr><td>$id</td><td>$time</td><td>$browser</td><td>$os</td><td>$user</td><td>$page</td></tr>";
} }
$bot = <<<END $bot = <<<HTML
</tbody> </tbody>
</table> </table>
</div> </div>
END; HTML;
return $top . $bod . $bot; return $top . $bod . $bot;
} }
@ -255,7 +256,8 @@ END;
default: default:
$records = DataObject::get('PageView'); $records = DataObject::get('PageView');
} }
$top = <<<END $baseURL = Director::baseURL();
$top = <<<HTML
<div id="viewtable" style="display: none"> <div id="viewtable" style="display: none">
<h2>Page Views</h2> <h2>Page Views</h2>
<p><a href="$baseURL/admin/statistics/viewcsv">Export as CSV</a></p> <p><a href="$baseURL/admin/statistics/viewcsv">Export as CSV</a></p>
@ -264,7 +266,7 @@ END;
<tr><th class="sortable-numeric">ID</th><th class="sortable-sortDatetime">Time</th><th class="sortable-text">Browser</th><th class="sortable-text">OS</th><th class="sortable-text">User</th><th class="sortable-text">Page</th></tr> <tr><th class="sortable-numeric">ID</th><th class="sortable-sortDatetime">Time</th><th class="sortable-text">Browser</th><th class="sortable-text">OS</th><th class="sortable-text">User</th><th class="sortable-text">Page</th></tr>
</thead> </thead>
<tbody> <tbody>
END; HTML;
$bod = ""; $bod = "";
foreach($records as $x) { foreach($records as $x) {
$r = $x->toMap(); $r = $x->toMap();
@ -276,25 +278,25 @@ END;
$page = $r['PageID']; $page = $r['PageID'];
$bod .= "<tr><td>$id</td><td>$time</td><td>$browser</td><td>$os</td><td>$user</td><td>$page</td></tr>"; $bod .= "<tr><td>$id</td><td>$time</td><td>$browser</td><td>$os</td><td>$user</td><td>$page</td></tr>";
} }
$bot = <<<END $bot = <<<HTML
</tbody> </tbody>
</table> </table>
</div> </div>
END; HTML;
return $top . $bod . $bot; return $top . $bod . $bot;
} }
static function BrowserChart($type = "Pie", $color = "blue") { static function BrowserChart($type = "Pie", $color = "blue") {
$top = <<<END $top = <<<HTML
<div id="browserchart" style="display: none"> <div id="browserchart" style="display: none">
<h2>Browsers</h2> <h2>Browsers</h2>
<div><canvas id="bchart" height="400" width="700"></canvas></div> <div><canvas id="bchart" height="400" width="700"></canvas></div>
</div> </div>
<script type="text/javascript">\n <script type="text/javascript">\n
END; HTML;
$bot = <<<END $bot = <<<HTML
var bchart = new Plotr.{$type}Chart('bchart', boptions); var bchart = new Plotr.{$type}Chart('bchart', boptions);
bchart.addDataset(bchartdata); bchart.addDataset(bchartdata);
@ -303,7 +305,7 @@ var bchart = new Plotr.{$type}Chart('bchart', boptions);
bchart.render(); bchart.render();
</script> </script>
END; HTML;
$ds = "var bchartdata = { \n'Set': ["; $ds = "var bchartdata = { \n'Set': [";
@ -312,7 +314,7 @@ END;
foreach($records as $r) { foreach($records as $r) {
$ra = $r->toMap(); $ra = $r->toMap();
$cb = $ra['Browser'] . " " . $ra['BrowserVersion']; $cb = $ra['Browser'] . " " . $ra['BrowserVersion'];
if($browsers[$cb] >= 1) { if(isset($browsers[$cb]) && $browsers[$cb] >= 1) {
$browsers[$cb]++; $browsers[$cb]++;
} else { } else {
$browsers[$cb] = 1; $browsers[$cb] = 1;
@ -328,7 +330,7 @@ END;
} }
$ds .= "]\n"; $ds .= "]\n";
$opts = <<<END $opts = <<<HTML
var boptions = { var boptions = {
axisLabelFontSize: 10, axisLabelFontSize: 10,
@ -340,7 +342,7 @@ var boptions = {
colorScheme: '{$color}',\n\n colorScheme: '{$color}',\n\n
END; HTML;
$opts .= $xt . "]\n};"; $opts .= $xt . "]\n};";
@ -348,16 +350,16 @@ END;
} }
static function OSChart($type = "Pie", $color = "blue") { static function OSChart($type = "Pie", $color = "blue") {
$top = <<<END $top = <<<HTML
<div id="oschart" style="display: none"> <div id="oschart" style="display: none">
<h2>Operating Systems</h2> <h2>Operating Systems</h2>
<div><canvas id="ochart" height="400" width="700"></canvas></div> <div><canvas id="ochart" height="400" width="700"></canvas></div>
</div> </div>
<script type="text/javascript">\n <script type="text/javascript">\n
END; HTML;
$bot = <<<END $bot = <<<HTML
var ochart = new Plotr.{$type}Chart('ochart', ooptions); var ochart = new Plotr.{$type}Chart('ochart', ooptions);
ochart.addDataset(ochartdata); ochart.addDataset(ochartdata);
@ -366,7 +368,7 @@ var ochart = new Plotr.{$type}Chart('ochart', ooptions);
ochart.render(); ochart.render();
</script> </script>
END; HTML;
$ds = "var ochartdata = { \n'Set': ["; $ds = "var ochartdata = { \n'Set': [";
@ -375,7 +377,7 @@ END;
foreach($records as $r) { foreach($records as $r) {
$ra = $r->toMap(); $ra = $r->toMap();
$cb = $ra['OS']; $cb = $ra['OS'];
if($oss[$cb] >= 1) { if(isset($oss[$cb]) && $oss[$cb] >= 1) {
$oss[$cb]++; $oss[$cb]++;
} else { } else {
$oss[$cb] = 1; $oss[$cb] = 1;
@ -391,7 +393,7 @@ END;
} }
$ds .= "]\n"; $ds .= "]\n";
$opts = <<<END $opts = <<<HTML
var ooptions = { var ooptions = {
axisLabelFontSize: 10, axisLabelFontSize: 10,
@ -403,7 +405,7 @@ var ooptions = {
colorScheme: '{$color}',\n\n colorScheme: '{$color}',\n\n
END; HTML;
$opts .= $xt . "]\n};"; $opts .= $xt . "]\n};";
@ -411,16 +413,16 @@ END;
} }
static function ActivityChart($type = "Pie", $color = "blue") { static function ActivityChart($type = "Pie", $color = "blue") {
$top = <<<END $top = <<<HTML
<div id="uacchart" style="display: none"> <div id="uacchart" style="display: none">
<h2>User Activity</h2> <h2>User Activity</h2>
<div><canvas id="uchart" height="400" width="700"></canvas></div> <div><canvas id="uchart" height="400" width="700"></canvas></div>
</div> </div>
<script type="text/javascript">\n <script type="text/javascript">\n
END; HTML;
$bot = <<<END $bot = <<<HTML
var uacchart = new Plotr.{$type}Chart('uchart', uacoptions); var uacchart = new Plotr.{$type}Chart('uchart', uacoptions);
uacchart.addDataset(uacchartdata); uacchart.addDataset(uacchartdata);
@ -429,7 +431,7 @@ var uacchart = new Plotr.{$type}Chart('uchart', uacoptions);
uacchart.render(); uacchart.render();
</script> </script>
END; HTML;
$ds = "var uacchartdata = { \n'Set': ["; $ds = "var uacchartdata = { \n'Set': [";
@ -441,7 +443,7 @@ END;
if($cb == -1) { if($cb == -1) {
continue; continue;
} }
if($users[$cb] >= 1) { if(isset($users[$cb]) && $users[$cb] >= 1) {
$users[$cb]++; $users[$cb]++;
} else { } else {
$users[$cb] = 1; $users[$cb] = 1;
@ -457,7 +459,7 @@ END;
} }
$ds .= "]\n"; $ds .= "]\n";
$opts = <<<END $opts = <<<HTML
var uacoptions = { var uacoptions = {
axisLabelFontSize: 10, axisLabelFontSize: 10,
@ -469,7 +471,7 @@ var uacoptions = {
colorScheme: '{$color}',\n\n colorScheme: '{$color}',\n\n
END; HTML;
$opts .= $xt . "]\n};"; $opts .= $xt . "]\n};";