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

ProfilesPage::addLinks()   B

Complexity

Conditions 8
Paths 5

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
nc 5
nop 0
dl 0
loc 15
rs 8.4444
c 0
b 0
f 0
1
<?php
2
require_once('Autoload.php');
3
class ProfilesPage extends \Flipside\Http\WebPage
4
{
5
    public $profiles_root;
6
7
    public function __construct($title)
8
    {
9
        parent::__construct($title, true);
0 ignored issues
show
Unused Code introduced by
The call to WebPage::__construct() has too many arguments starting with true.

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...
10
        $root = $_SERVER['DOCUMENT_ROOT'];
11
        $script_dir = dirname(__FILE__);
12
        if(strstr($script_dir, $root) === false)
13
        {
14
            $this->profiles_root = dirname($_SERVER['SCRIPT_NAME']);
15
        }
16
        else
17
        {
18
            $this->profiles_root = substr($script_dir, strlen($root));
19
        }
20
        $this->content['root'] = $this->profiles_root;
21
        $this->addTemplateDir('./templates', 'Profiles');
22
        $this->setTemplateName('@Profiles/profile-main.html');
23
    }
24
25
    public function addLinks()
26
    {
27
        if($this->user !== false && $this->user !== null)
28
        {
29
            if($this->user->isInGroupNamed('LDAPAdmins') || $this->user->isInGroupNamed('AFs'))
30
            {
31
                $this->addLink('Admin', $this->profiles_root.'/_admin/index.php');
32
            }
33
            if(($this->user->isInGroupNamed('Leads') || $this->user->isInGroupNamed('CC')) || $this->user->isInGroupNamed('AFs'))
34
            {
35
                $this->addLink('Leads', $this->profiles_root.'/lead/index.php');
36
            }
37
            $this->addLink('My Profile', $this->profiles_root.'/profile.php');
38
        }
39
    }
40
}
41
/* vim: set tabstop=4 shiftwidth=4 expandtab: */
42