SubPanelSearchForm   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 1 Features 1
Metric Value
c 1
b 1
f 1
dl 0
loc 61
ccs 0
cts 39
cp 0
rs 10
wmc 10
lcom 1
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A SubPanelSearchForm() 0 10 2
A display() 0 14 2
A getCollectionList() 0 16 4
A displaySavedSearchSelect() 0 3 1
1
<?php
2
/**
3
 * SubPanelSearchForm.php
4
 * @author SalesAgility <[email protected]>
5
 * Date: 28/01/14
6
 */
7
8
require_once('include/SearchForm/SearchForm2.php');
9
10
class SubPanelSearchForm extends SearchForm  {
11
12
    var $subPanel; // the instantiated bean of the subPanel
13
14
    function __construct($seed, $module, $subPanel, $options = array()){
15
        $this->subPanel = $subPanel;
16
        parent::__construct($seed, $module, 'DetailView', $options);
0 ignored issues
show
Unused Code introduced by
The call to SearchForm::__construct() has too many arguments starting with $options.

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...
17
    }
18
19
    /**
20
     * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
21
     */
22
    function SubPanelSearchForm($seed, $module, $subPanel, $options = array()){
23
        $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
24
        if(isset($GLOBALS['log'])) {
25
            $GLOBALS['log']->deprecated($deprecatedMessage);
26
        }
27
        else {
28
            trigger_error($deprecatedMessage, E_USER_DEPRECATED);
29
        }
30
        self::__construct($seed, $module, $subPanel, $options);
31
    }
32
33
34
    function display($header = false){
35
        /*//global $app_list_strings;
36
        if($this->subPanel->subpanel_defs->isCollection() && isset($this->subPanel->subpanel_defs->base_collection_list)){
37
            $GLOBALS['app_list_strings']['collection_temp_list'] = $this->getCollectionList($this->subPanel->subpanel_defs->base_collection_list);
38
        }*/
39
        $this->th->ss->assign('subpanel', $this->subPanel->subpanel_id);
40
41
        // Adding the offset to subpanel search field - this has no affect on pagination
42
        if($this->subPanel->parent_bean->module_dir != ''){
43
            $this->th->ss->assign('subpanelPageOffset', '<input type="hidden" name="'.$this->subPanel->parent_bean->module_dir.'_'.$this->subPanel->subpanel_id.'_CELL_offset" value="0" />');
44
        }
45
        $this->parsedView = 'sps';
46
        return parent::display($header);
0 ignored issues
show
Bug introduced by
The method display() does not exist on SearchForm. Did you maybe mean displayTabs()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
47
    }
48
49
    function getCollectionList($collection = array()){
50
        global $app_list_strings;
51
52
        $select = array();
53
54
        if(!empty($collection)){
55
56
            $select = array();
57
            foreach($collection as $name => $value_array){
58
                if(isset($app_list_strings['moduleList'][$value_array['module']])){
59
                    $select[$name] = $app_list_strings['moduleList'][$value_array['module']];
60
                }
61
            }
62
        }
63
        return $select;
64
    }
65
66
    function displaySavedSearchSelect(){
67
        return null;
68
    }
69
70
}