SubPanelSearchForm::display()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6
Metric Value
cc 2
eloc 6
nc 2
nop 1
dl 0
loc 14
ccs 0
cts 9
cp 0
crap 6
rs 9.4285
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
}