Completed
Push — master ( 5a1315...9d11bc )
by Gino
03:24
created

TemplatesAdminPages::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 16
rs 9.4285
cc 1
eloc 12
nc 1
nop 0
1
<?php
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
/**
13
 * tdmcreate module.
14
 *
15
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
16
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
17
 *
18
 * @since           2.5.0
19
 *
20
 * @author          Txmod Xoops http://www.txmodxoops.org
21
 *
22
 * @version         $Id: TemplatesAdminPages.php 12258 2014-01-02 09:33:29Z timgno $
23
 */
24
25
/**
26
 * Class TemplatesAdminPages.
27
 */
28
class TemplatesAdminPages extends TDMCreateFile
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
29
{
30
    /*
31
    *  @public function constructor
32
    *  @param null
33
    */
34
    /**
35
     *
36
     */
37
    public function __construct()
38
    {
39
        parent::__construct();
40
        $this->htmlcode = TDMCreateHtmlSmartyCodes::getInstance();
0 ignored issues
show
Documentation Bug introduced by
It seems like \TDMCreateHtmlSmartyCodes::getInstance() of type object<TDMCreateHtmlSmartyCodes> is incompatible with the declared type string of property $htmlcode.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
41
    }
42
43
    /*
44
    *  @static function &getInstance
45
    *  @param null
46
    */
47
    /**
48
     * @return TemplatesAdminPages
49
     */
50
    public static function &getInstance()
51
    {
52
        static $instance = false;
53
        if (!$instance) {
54
            $instance = new self();
55
        }
56
57
        return $instance;
58
    }
59
60
    /*
61
    *  @public function write
62
    *  @param string $module
63
    *  @param string $table
64
    */
65
    public function write($module, $table, $filename)
66
    {
67
        $this->setModule($module);
68
        $this->setTable($table);
69
		$this->setFileName($filename);
70
    }
71
72
    /*
73
    *  @private function getTemplatesAdminPagesHeader
74
    *  @param string $moduleDirname
75
    *  @return string
76
    */
77
    private function getTemplatesAdminPagesHeader($moduleDirname)
78
    {
79
        $ret = $this->htmlcode->getHtmlComment('Header').PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlComment cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
80
        $ret .= $this->htmlcode->getSmartyIncludeFile($moduleDirname, 'header', true).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getSmartyIncludeFile cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
81
82
        return $ret;
83
    }
84
85
    /*
86
    *  @private function getTemplatesAdminPagesTableThead
87
    *  @param string $moduleDirname
0 ignored issues
show
Bug introduced by
There is no parameter named $moduleDirname. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
88
    *  @param string $tableName
0 ignored issues
show
Bug introduced by
There is no parameter named $tableName. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
89
    *  @param string $fields
90
    *  @param string $language
91
    *  @return string
92
    */
93
    private function getTemplatesAdminPagesTableThead($tableSoleName, $tableAutoincrement, $fields, $language)
94
    {
95
        $th = '';
96
        $langHeadId = strtoupper($tableSoleName).'_ID';
97
        if (1 == $tableAutoincrement) {
98
            $lang = $this->htmlcode->getSmartyConst($language, $langHeadId);
0 ignored issues
show
Bug introduced by
The method getSmartyConst cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
99
            $th  .= $this->htmlcode->getHtmlTag('th', array('class' => 'center'), $lang).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
100
        }
101
        foreach (array_keys($fields) as $f) {
102
            $fieldName = $fields[$f]->getVar('field_name');
0 ignored issues
show
Bug introduced by
The method getVar cannot be called on $fields[$f] (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
103
            $rpFieldName = $this->getRightString($fieldName);
104
            $langFieldName = strtoupper($tableSoleName).'_'.strtoupper($rpFieldName);
105
            if (1 == $fields[$f]->getVar('field_inlist')) {
0 ignored issues
show
Bug introduced by
The method getVar cannot be called on $fields[$f] (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
106
                $lang = $this->htmlcode->getSmartyConst($language, $langFieldName);
0 ignored issues
show
Bug introduced by
The method getSmartyConst cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
107
                $th  .= $this->htmlcode->getHtmlTag('th', array('class' => 'center'), $lang).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
108
            }
109
        }
110
111
        $lang = $this->htmlcode->getSmartyConst($language, 'FORM_ACTION');
0 ignored issues
show
Bug introduced by
The method getSmartyConst cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
112
        $th  .= $this->htmlcode->getHtmlTag('th', array('class' => 'center width5'), $lang).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
113
        $tr = $this->htmlcode->getHtmlTag('tr', array('class' => 'head'), $th).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
114
        $ret = $this->htmlcode->getHtmlTag('thead', array(), $tr).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
115
116
        return $ret;
117
    }
118
119
    /*
120
    *  @private function getTemplatesAdminPagesTableTBody
121
    *  @param string $moduleDirname
122
    *  @param string $tableName
123
    *  @param string $fields
124
    *  @param string $language
0 ignored issues
show
Bug introduced by
There is no parameter named $language. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
125
    *  @return string
126
    */
127
    private function getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields)
128
    {
129
        $td = '';
130
        if (1 == $tableAutoincrement) {
131
            $double = $this->htmlcode->getSmartyDoubleVar($tableSoleName, 'id');
0 ignored issues
show
Bug introduced by
The method getSmartyDoubleVar cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
132
            $td    .= $this->htmlcode->getHtmlTableData($double, 'center').PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTableData cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
133
        }
134
        foreach (array_keys($fields) as $f) {
135
            $fieldName = $fields[$f]->getVar('field_name');
0 ignored issues
show
Bug introduced by
The method getVar cannot be called on $fields[$f] (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
136
            $fieldElement = $fields[$f]->getVar('field_element');
0 ignored issues
show
Bug introduced by
The method getVar cannot be called on $fields[$f] (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
137
            $rpFieldName = $this->getRightString($fieldName);
138
            if (0 == $f) {
139
                $fieldId = $fieldName;
140
            }
141
            if (1 == $fields[$f]->getVar('field_inlist')) {
0 ignored issues
show
Bug introduced by
The method getVar cannot be called on $fields[$f] (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
142
                switch ($fieldElement) {
143
                    case 9:
144
                        // This is to be reviewed, as it was initially to style = "backgroung-color: #"
145
                        // Now with HTML5 is not supported inline style in the parameters of the HTML tag
146
                        // Old code was <span style="background-color: #<{\$list.{$rpFieldName}}>;">...
147
                        $double = $this->htmlcode->getSmartyDoubleVar($tableSoleName, $rpFieldName);
0 ignored issues
show
Bug introduced by
The method getSmartyDoubleVar cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
148
                        $span = $this->htmlcode->getHtmlTag('span', array(), $double);
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
149
                        $td .= $this->htmlcode->getHtmlTag('td', array('class' => 'center'), $span).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
150
                        /*$ret .= <<<EOT
151
                    <td class="center"><span style="background-color: #<{\$list.{$rpFieldName}}>;">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>\n
152
EOT;*/
153
                        break;
154
                    case 10:
155
                        $src = $this->htmlcode->getSmartyNoSimbol('xoModuleIcons32');
0 ignored issues
show
Bug introduced by
The method getSmartyNoSimbol cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
156
                        $src .= $this->htmlcode->getSmartyDoubleVar($tableSoleName, $rpFieldName);
0 ignored issues
show
Bug introduced by
The method getSmartyDoubleVar cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
157
                        $img = $this->htmlcode->getHtmlTag('img', array('src' => $src, 'alt' => $tableName), '', false);
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
158
                        $td  .= $this->htmlcode->getHtmlTag('td', array('class' => 'center'), $img).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
159
                        break;
160
                    case 13:
161
                        $single = $this->htmlcode->getSmartySingleVar($moduleDirname.'_upload_url');
0 ignored issues
show
Bug introduced by
The method getSmartySingleVar cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
162
                        $double = $this->htmlcode->getSmartyDoubleVar($tableSoleName, $rpFieldName);
0 ignored issues
show
Bug introduced by
The method getSmartyDoubleVar cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
163
                        $img = $this->htmlcode->getHtmlTag('img', array('src' => $single."/images/{$tableName}/".$double, 'alt' => $tableName, 'style' => 'max-width:100px'), '', false);
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
164
                        $td    .= $this->htmlcode->getHtmlTag('td', array('class' => 'center'), $img).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
165
                        break;
166
                    default:
167
                        if (0 != $f) {
168
                            $double = $this->htmlcode->getSmartyDoubleVar($tableSoleName, $rpFieldName);
0 ignored issues
show
Bug introduced by
The method getSmartyDoubleVar cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
169
                            $td    .= $this->htmlcode->getHtmlTag('td', array('class' => 'center'), $double).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
170
                        }
171
                        break;
172
                }
173
            }
174
        }
175
        $lang = $this->htmlcode->getSmartyConst('', '_EDIT');
0 ignored issues
show
Bug introduced by
The method getSmartyConst cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
176
        $double = $this->htmlcode->getSmartyDoubleVar($tableSoleName, 'id');
0 ignored issues
show
Bug introduced by
The method getSmartyDoubleVar cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
177
        $src = $this->htmlcode->getSmartyNoSimbol('xoModuleIcons16 edit.png');
0 ignored issues
show
Bug introduced by
The method getSmartyNoSimbol cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
178
        $img = $this->htmlcode->getHtmlTag('img', array('src' => $src, 'alt' => $tableName), '', false);
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
179
        $anchor = $this->htmlcode->getHtmlTag('a', array('href' => $tableName.".php?op=edit&amp;{$fieldId}=".$double, 'title' => $lang), $img).PHP_EOL;
0 ignored issues
show
Bug introduced by
The variable $fieldId does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
180
        $lang = $this->htmlcode->getSmartyConst('', '_DELETE');
0 ignored issues
show
Bug introduced by
The method getSmartyConst cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
181
        $double = $this->htmlcode->getSmartyDoubleVar($tableSoleName, 'id');
0 ignored issues
show
Bug introduced by
The method getSmartyDoubleVar cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
182
        $src = $this->htmlcode->getSmartyNoSimbol('xoModuleIcons16 delete.png');
0 ignored issues
show
Bug introduced by
The method getSmartyNoSimbol cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
183
        $img = $this->htmlcode->getHtmlTag('img', array('src' => $src, 'alt' => $tableName), '', false);
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
184
        $anchor .= $this->htmlcode->getHtmlTag('a', array('href' => $tableName.".php?op=delete&amp;{$fieldId}=".$double, 'title' => $lang), $img).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
185
        $td     .= $this->htmlcode->getHtmlTag('td', array('class' => 'center  width5'), "\n".$anchor).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
186
        $cycle = $this->htmlcode->getSmartyNoSimbol('cycle values="odd, even"');
0 ignored issues
show
Bug introduced by
The method getSmartyNoSimbol cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
187
        $tr = $this->htmlcode->getHtmlTag('tr', array('class' => $cycle), $td).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
188
        $foreach = $this->htmlcode->getSmartyForeach($tableSoleName, $tableName.'_list', $tr).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getSmartyForeach cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
189
        $tbody = $this->htmlcode->getHtmlTag('tbody', array(), $foreach).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
190
191
        return $this->htmlcode->getSmartyConditions($tableName.'_count', '', '', $tbody).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getSmartyConditions cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
192
    }
193
194
    /*
195
    *  @private function getTemplatesAdminPagesTable
196
    *  @param string $moduleDirname
197
    *  @param string $tableName
198
    *  @param string $fields
199
    *  @param string $language
200
    *  @return string
201
    */
202
    private function getTemplatesAdminPagesTable($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, $language)
203
    {
204
        $tbody = $this->getTemplatesAdminPagesTableThead($tableSoleName, $tableAutoincrement, $fields, $language);
205
        $tbody .= $this->getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields);
206
207
        return $this->htmlcode->getHtmlTable($tbody, 'table table-bordered').PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTable cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
208
    }
209
210
    /*
211
    *  @private function getTemplatesAdminPages
212
    *  @param string $moduleDirname
213
    *  @param string $tableName
214
    *  @param string $fields
215
    *  @param string $language
216
    *  @return string
217
    */
218
    private function getTemplatesAdminPages($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, $language)
219
    {
220
        $htmlTable = $this->getTemplatesAdminPagesTable($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, $language);
221
        $htmlTable .= $this->htmlcode->getHtmlTag('div', array('class' => 'clear'), '&nbsp;').PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
222
        $single = $this->htmlcode->getSmartySingleVar('pagenav');
0 ignored issues
show
Bug introduced by
The method getSmartySingleVar cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
223
        $div = $this->htmlcode->getHtmlTag('div', array('class' => 'xo-pagenav floatright'), $single);
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
224
        $div       .= $this->htmlcode->getHtmlTag('div', array('class' => 'clear spacer'), '').PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
225
        $htmlTable .= $this->htmlcode->getSmartyConditions('pagenav', '', '', $div).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getSmartyConditions cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
226
        $ifList = $this->htmlcode->getSmartyConditions($tableName.'_list', '', '', $htmlTable).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getSmartyConditions cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
227
        $single = $this->htmlcode->getSmartySingleVar('form');
0 ignored issues
show
Bug introduced by
The method getSmartySingleVar cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
228
        $divComm = $this->htmlcode->getHtmlComment('Display navigation').PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlComment cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
$divComm is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
229
        //$divComm .= $this->htmlcode->getHtmlTag('div', array('class' => 'errorMsg'), $single).PHP_EOL;
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
230
        $ifList .= $this->htmlcode->getSmartyConditions('form', '', '', $single).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getSmartyConditions cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
231
        $single = $this->htmlcode->getSmartySingleVar('error');
0 ignored issues
show
Bug introduced by
The method getSmartySingleVar cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
232
        $strong = $this->htmlcode->getHtmlTag('strong', array(), $single).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
233
        $div = $this->htmlcode->getHtmlTag('div', array('class' => 'errorMsg'), $strong).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
234
        $ifList .= $this->htmlcode->getSmartyConditions('error', '', '', $div).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getSmartyConditions cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
235
236
        return $ifList;
237
    }
238
239
    /*
240
    *  @private function getTemplatesAdminPagesFooter
241
    *  @param string $moduleDirname
242
    *  @return string
243
    */
244
    private function getTemplatesAdminPagesFooter($moduleDirname)
245
    {
246
        $ret = $this->htmlcode->getHtmlTag('br', array(), '', false).PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlTag cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
247
        $ret .= $this->htmlcode->getHtmlComment('Footer').PHP_EOL;
0 ignored issues
show
Bug introduced by
The method getHtmlComment cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
248
        $ret .= $this->htmlcode->getSmartyIncludeFile($moduleDirname, 'footer', true);
0 ignored issues
show
Bug introduced by
The method getSmartyIncludeFile cannot be called on $this->htmlcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
249
250
        return $ret;
251
    }
252
253
    /*
254
    *  @public function render
255
    *  @param null
256
    *  @return bool|string
257
    */
258
    public function render()
259
    {
260
        $module = $this->getModule();
261
        $table = $this->getTable();
262
		$filename = $this->getFileName();
263
        $moduleDirname = $module->getVar('mod_dirname');
264
        $language = $this->getLanguage($moduleDirname, 'AM');
265
        $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id'), 'field_order');
266
        $content = $this->getTemplatesAdminPagesHeader($moduleDirname);
267
        $content .= $this->getTemplatesAdminPages($moduleDirname, $table->getVar('table_name'), $table->getVar('table_solename'), $table->getVar('table_autoincrement'), $fields, $language);
268
        $content .= $this->getTemplatesAdminPagesFooter($moduleDirname);
269
        //
270
        $this->create($moduleDirname, 'templates/admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
271
272
        return $this->renderFile();
273
    }
274
}
275