Completed
Push — develop ( ff0f24...b7393c )
by Patrick
09:27
created

ProfilesLeadPage   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 0
loc 64
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 47 4
A add_leads_css() 0 6 1
A isAdmin() 0 4 1
1
<?php
2
require_once('../class.ProfilesPage.php');
3
class ProfilesLeadPage extends \Flipside\Http\FlipAdminPage
4
{
5
    private $is_lead;
6
7
    public function __construct($title)
8
    {
9
        parent::__construct($title);
10
        if($this->user == false)
11
        {
12
            $this->is_lead = false;
13
        }
14
        else
15
        {
16
            $this->is_lead = $this->user->isInGroupNamed('Leads');
17
            if(!$this->is_lead)
18
            {
19
                $this->is_lead = $this->user->isInGroupNamed('CC');
20
            }
21
        }
22
        if($this->is_lead)
23
        {
24
            $this->is_admin = $this->is_lead;
25
        }
26
        $this->add_leads_css();
27
        $this->addWellKnownJS(JS_DATATABLE, false);
0 ignored issues
show
Unused Code introduced by
The call to ProfilesLeadPage::addWellKnownJS() has too many arguments starting with false.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
28
        $this->addWellKnownJS(JQUERY_VALIDATE);
29
        $this->addWellKnownJS(JS_METISMENU);
30
        $this->addJS('../_admin/js/admin.js');
31
        $this->addWellKnownJS(JS_LOGIN);
32
33
        $dirMenu = array(
34
                'All' => 'directory.php',
35
                'AAR' => 'directory.php?filter=aar',
36
                'AFs' => 'directory.php?filter=af',
37
                'CC'  => 'directory.php?filter=cc',
38
                '360/24/7 Department' => 'directory.php?filter=360',
39
                'Art' => 'directory.php?filter=Art',
40
                'City Planning' => 'directory.php?filter=CityPlanning',
41
                'Communications' => 'directory.php?filter=Comm',
42
                'Genesis' => 'directory.php?filter=Genesis',
43
                'Safety' => 'directory.php?filter=Safety',
44
                'Site-Ops' => 'directory.php?filter=Ops',
45
                'Site Prep' => 'directory.php?filter=siteprep',
46
                'Site Sign-Off' => 'directory.php?filter=sign-off',
47
                'Volunteer Coordinator' => 'directory.php?filter=vc'
48
                );
49
50
        $this->content['header']['sidebar'] = array();
51
        $this->content['header']['sidebar']['Dashboard'] = array('icon' => 'fa-dashboard', 'url' => 'index.php');
52
        $this->content['header']['sidebar']['Directory'] = array('icon' => 'fa-th-list', 'menu' => $dirMenu);
53
    }
54
55
    protected function add_leads_css()
56
    {
57
        $this->addWellKnownCSS(CSS_DATATABLE);
58
        $this->addCSS('../css/profiles.css');
59
        $this->addCSS('css/lead.css');
60
    }
61
62
    public function isAdmin()
63
    {
64
        return $this->is_lead;
65
    }
66
}
67
/* vim: set tabstop=4 shiftwidth=4 expandtab: */
68