Completed
Push — master ( d0bd11...fbf230 )
by
unknown
10s
created

ProfilesAdminPage   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 45
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A add_links() 0 16 1
A print_page() 0 19 2
1
<?php
2
require_once('class.FlipAdminPage.php');
3
require_once('class.FlipSession.php');
4
5
class ProfilesAdminPage extends FlipAdminPage
6
{
7
    function __construct($title)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
8
    {
9
        parent::__construct($title, 'LDAPAdmins');
10
        $this->addJSByURI('js/admin.js');
11
    }
12
13
    function add_links()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
14
    {
15
        $users_menu = array(
16
            'Current' => 'users_current.php',
17
            'Pending' => 'users_pending.php'
18
        );
19
        $pos_menu = array(
20
            'Areas' => 'areas.php',
21
            'Leads' => 'leads.php'
22
        );
23
        $this->addLink('<span class="glyphicon glyphicon-dashboard"></span> Dashboard', 'index.php');
24
        $this->addLink('<span class="glyphicon glyphicon-user"></span> Users', '#', $users_menu);
25
        $this->addLink('<span class="glyphicon glyphicon-tower"></span> Groups', 'groups.php');
26
        $this->addLink('<span class="glyphicon glyphicon-briefcase"></span> Positions', '#', $pos_menu);
27
        $this->addLink('<span class="glyphicon glyphicon-cloud"></span> Sessions', 'sessions.php');
28
    }
29
30
    function print_page($header = true)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
31
    {
32
        if(!$this->is_admin)
33
        {
34
            $this->body = '
35
        <div class="row">
36
            <div class="col-lg-12">
37
                <h1 class="page-header">
38
                  You must
39
                  <a href="'.$this->profilesUrl.'/login.php?return='.$this->currentUrl().'">log in
0 ignored issues
show
Bug introduced by
The property profilesUrl does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
40
                    <span class="glyphicon glyphicon-log-in"></span>
41
                  </a>
42
                  to access the Burning Flipside Profile Admin system!
43
                </h1>
44
            </div>
45
        </div>';
46
        }
47
        parent::printPage($header);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (printPage() instead of print_page()). Are you sure this is correct? If so, you might want to change this to $this->printPage().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
48
    }
49
}
50
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
51