Issues (80)

code/AdvertReport.php (3 issues)

1
<?php
2
3
class AdvertReport  extends SS_Report
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
Expected 1 space after class name; 2 found
Loading history...
Expected 1 space before extends keyword; 2 found
Loading history...
4
{
5
    /*
6
     *  SS_Report->getCMSFields() uses $description the property directly!
7
     */
8
    protected $description = 'Check on how many impressions and click throughs adverts have had';
9
10
    // the report title
11
    public function title()
12
    {
13
        return 'Advert Report';
14
    }
15
16
    /**
17
     * Return an array of columns to display in your report.
18
     */
19
    public function columns()
20
    {
21
        return array(
22
            'Title' => 'Title',
23
            'StartDate' => 'Start Date',
24
            'FinishDate' => 'Finish Time',
25
            'AdvertSource' => 'Advert Source',
26
            'Clickthroughs' => 'Click Throughs',
27
            'Impressions' => 'Impressions',
28
        );
29
    }
30
31
    public function sourceRecords($params = null)
32
    {
33
        return DataList::create('Advert');//->limit(10);
34
    }
35
36
    public function parameterFieldsTODO()
37
    {
38
        $params = new FieldList();
39
40
        //Colour filter
41
        /*
42
        $colours = singleton('Page')->dbObject('Colour')->enumValues();
43
         
44
        $params->push(new DropdownField(
45
            "Colour", 
46
            "Colour", 
47
            $colours
48
        ));
49
        */
50
51
        //Result Limit
52
        $filterOptions = array(
53
            1 => 'Available',
54
55
            2 => 'Training',
56
            3 => 'All Ice Slots',
57
        );
58
59
        $df = new DropdownField(
60
            'IceSlotFilter',
61
            'Limit results to',
62
            $filterOptions,
63
            50
64
        );
65
66
       // $df->setSize(100);
67
        $params->push($df);
68
69
        return $params;
70
    }
71
}
72