| 1 |  |  | <?php namespace EvolutionCMS\Support; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | use EvolutionCMS\Interfaces\MakeTableInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * A utility class for presenting a provided array as a table view.  Includes | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * support for pagination, sorting by any column, providing optional header arrays, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * providing classes for styling the table, rows, and cells (including alternate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * row styling), as well as adding form controls to each row. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * @author Jason Coward <[email protected]> (MODX) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | class MakeTable implements MakeTableInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |     public $actionField = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     public $cellAction = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     public $linkAction = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |      * @var int | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     public $tableWidth = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     public $tableClass = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |      * @var | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     public $tableID; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      * @var | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     public $thClass; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     public $rowHeaderClass = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     public $columnHeaderClass = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |     public $rowRegularClass = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |     public $rowAlternateClass = 'alt'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |     public $formName = 'tableForm'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |     public $formAction = '[~[*id*]~]'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |     public $formElementType = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     public $formElementName = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |     public $rowAlternatingScheme = 'EVEN'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |      * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |     public $excludeFields = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |      * @var int | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |     public $allOption = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |      * @var | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |     public $pageNav; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |      * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |     public $columnWidths = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |      * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |     public $selectedValues = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |      * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |     public $fieldHeaders = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |     public $extra = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |      * Sets the default link href for all cells in the table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |      * @param string $value A URL to execute when table cells are clicked. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |     public function setCellAction($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |         $this->cellAction = $this->prepareLink($value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |      * Sets the default link href for the text presented in a cell. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |      * @param string $value A URL to execute when text within table cells are clicked. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |     public function setLinkAction($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |         $this->linkAction = $this->prepareLink($value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |      * Sets the width attribute of the main HTML TABLE. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |      * @param int $value A valid width attribute for the HTML TABLE tag | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |     public function setTableWidth($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |         $this->tableWidth = (int)$value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |      * Sets the class attribute of the main HTML TABLE. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |      * @param string $value A class for the main HTML TABLE. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |     public function setTableClass($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |         $this->tableClass = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |      * Sets the id attribute of the main HTML TABLE. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |      * @param string $value A class for the main HTML TABLE. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |     public function setTableID($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |         $this->tableID = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |      * Sets the class attribute of the table header row. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |      * @param string $value A class for the table header row. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |     public function setRowHeaderClass($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |         $this->rowHeaderClass = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |      * Sets the class attribute of the table header row. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |      * @param string $value A class for the table header row. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |     public function setThHeaderClass($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |         $this->thClass = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |      * Sets the class attribute of the column header row. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |      * @param string $value A class for the column header row. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |     public function setColumnHeaderClass($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |         $this->columnHeaderClass = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |      * Sets the class attribute of regular table rows. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |      * @param string $value A class for regular table rows. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |     public function setRowRegularClass($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |         $this->rowRegularClass = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |      * Sets the class attribute of alternate table rows. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |      * @param string $value A class for alternate table rows. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |     public function setRowAlternateClass($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |         $this->rowAlternateClass = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |      * Sets the type of INPUT form element to be presented as the first column. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |      * @param string $value Indicates the INPUT form element type attribute. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |     public function setFormElementType($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |         $this->formElementType = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |      * Sets the name of the INPUT form element to be presented as the first column. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |      * @param string $value Indicates the INPUT form element name attribute. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |     public function setFormElementName($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |         $this->formElementName = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |      * Sets the name of the FORM to wrap the table in when a form element has | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |      * been indicated. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |      * @param string $value Indicates the FORM name attribute. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |     public function setFormName($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |         $this->formName = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |      * Sets the action of the FORM element. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |      * @param string $value Indicates the FORM action attribute. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |     public function setFormAction($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |         $this->formAction = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |      * Excludes fields from the table by array key. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |      * @param array $value An Array of field keys to exclude from the table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |     public function setExcludeFields($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |         $this->excludeFields = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |      * Sets the table to provide alternate row colors using ODD or EVEN rows | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |      * @param string $value 'ODD' or 'EVEN' to indicate the alternate row scheme. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |     public function setRowAlternatingScheme($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |         $this->rowAlternatingScheme = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |      * Sets the default field value to be used when appending query parameters | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |      * to link actions. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |      * @param string $value The key of the field to add as a query string parameter. | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 274 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 275 |  |  |     public function setActionFieldName($value) | 
            
                                                                        
                            
            
                                    
            
            
                | 276 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 277 |  |  |         $this->actionField = $value; | 
            
                                                                        
                            
            
                                    
            
            
                | 278 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |      * Sets the width attribute of each column in the array. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |      * @param array $value An Array of column widths in the order of the keys in the | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |      *            source table array. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |     public function setColumnWidths($widthArray) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |         $this->columnWidths = $widthArray; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |      * An optional array of values that can be preselected when using | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |      * @param array $value Indicates the INPUT form element type attribute. | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |     public function setSelectedValues($valueArray) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |         $this->selectedValues = $valueArray; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |      * Sets extra content to be presented following the table (but within | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |      * the form, if a form is being rendered with the table). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |      * @param string $value A string of additional content. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |     public function setExtra($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |         $this->extra = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |      * Retrieves the width of a specific table column by index position. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |      * @param int $columnPosition The index of the column to get the width for. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |     public function getColumnWidth($columnPosition) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |         $currentWidth = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |         if (is_array($this->columnWidths)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |             $currentWidth = $this->columnWidths[$columnPosition] ? ' width="' . $this->columnWidths[$columnPosition] . '" ' : ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |         return $currentWidth; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |      * Determines what class the current row should have applied. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |      * @param int $value The position of the current row being rendered. | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |     public function determineRowClass($position) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |         switch ($this->rowAlternatingScheme) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |             case 'ODD' : | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |                 $modRemainder = 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |             case 'EVEN' : | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |             default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |                 $modRemainder = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |         if ($position % 2 == $modRemainder) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |             $currentClass = $this->rowRegularClass; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |             $currentClass = $this->rowAlternateClass; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |         return ' class="' . $currentClass . '"'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |      * Generates an onclick action applied to the current cell, to execute | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |      * any specified cell actions. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |      * @param string $value Indicates the INPUT form element type attribute. | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 361 |  | View Code Duplication |     public function getCellAction($currentActionFieldValue) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |         $cellAction = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |         if ($this->cellAction) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |             $cellAction = ' onClick="javascript:window.location=\'' . $this->cellAction . $this->actionField . '=' . urlencode($currentActionFieldValue) . '\'" '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |         return $cellAction; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |      * Generates the cell content, including any specified action fields values. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |      * @param string $currentActionFieldValue The value to be applied to the link action. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |      * @param string $value The value of the cell. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 378 |  | View Code Duplication |     public function createCellText($currentActionFieldValue, $value) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |         $cell = $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |         if ($this->linkAction) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |             $cell = '<a href="' . $this->linkAction . $this->actionField . '=' . urlencode($currentActionFieldValue) . '">' . $cell . '</a>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |         return $cell; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |      * Sets an option to generate a check all link when checkbox is indicated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |      * as the table formElementType. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |     public function setAllOption() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |         $this->allOption = 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |      * Function to prepare a link generated in the table cell/link actions. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |      * @param string $value Indicates the INPUT form element type attribute. | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |     public function prepareLink($link) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |         if (strstr($link, '?')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |             $end = '&'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |             $end = '?'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |         return $link . $end; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |      * Generates the table content. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |      * @param array $fieldsArray The associative array representing the table rows | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |      * and columns. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |      * @param array $fieldHeadersArray An optional array of values for providing | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |      * alternative field headers; this is an associative arrays of keys from | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |      * the $fieldsArray where the values represent the alt heading content | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |      * for each column. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |     public function create($fieldsArray, $fieldHeadersArray = array(), $linkpage = "") | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |         global $_lang; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |         if (is_array($fieldsArray)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |             $i = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |             foreach ($fieldsArray as $fieldName => $fieldValue) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |                 $table .= "\t<tr" . $this->determineRowClass($i) . ">\n"; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |                 $currentActionFieldValue = $fieldValue[$this->actionField]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |                 if (is_array($this->selectedValues)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |                     $isChecked = array_search($currentActionFieldValue, $this->selectedValues) === false ? 0 : 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |                     $isChecked = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |                 $table .= $this->addFormField($currentActionFieldValue, $isChecked); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |                 $colPosition = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |                 foreach ($fieldValue as $key => $value) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |                     if (!in_array($key, $this->excludeFields)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |                         $table .= "\t\t<td" . $this->getCellAction($currentActionFieldValue) . ">"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |                         $table .= $this->createCellText($currentActionFieldValue, $value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |                         $table .= "</td>\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |                         if ($i == 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |                             if (empty ($header) && $this->formElementType) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |                                 $header .= "\t\t<th style=\"width:32px\" " . ($this->thClass ? 'class="' . $this->thClass . '"' : '') . ">" . ($this->allOption ? '<a href="javascript:clickAll()">all</a>' : '') . "</th>\n"; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |                             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |                             $headerText = array_key_exists($key, $fieldHeadersArray) ? $fieldHeadersArray[$key] : $key; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |                             $header .= "\t\t<th" . $this->getColumnWidth($colPosition) . ($this->thClass ? ' class="' . $this->thClass . '" ' : '') . ">" . $headerText . "</th>\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |                         $colPosition++; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |                 $i++; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |                 $table .= "\t</tr>\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |             $table = "\n" . '<table' . ($this->tableWidth > 0 ? ' width="' . $this->tableWidth . '"' : '') . ($this->tableClass ? ' class="' . $this->tableClass . '"' : '') . ($this->tableID ? ' id="' . $this->tableID . '"' : '') . ">\n" . ($header ? "\t<thead>\n\t<tr class=\"" . $this->rowHeaderClass . "\">\n" . $header . "\t</tr>\n\t</thead>\n" : '') . $table . "</table>\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |             if ($this->formElementType) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |                 $table = "\n" . '<form id="' . $this->formName . '" name="' . $this->formName . '" action="' . $this->formAction . '" method="POST">' . $table; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |             if (strlen($this->pageNav) > 1) {//changed to display the pagination if exists. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  |                 /* commented this part because of cookie | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |                 $table .= '<div id="max-display-records" ><select style="display:inline" onchange="javascript:updatePageSize(this[this.selectedIndex].value);">'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |                 $pageSizes= array (10, 25, 50, 100, 250); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |                 for ($i= 0; $i < count($pageSizes); $i ++) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  |                     $table .= '<option value="'.$pageSizes[$i].'"'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  |                     $table .= MAX_DISPLAY_RECORDS_NUM == $pageSizes[$i] ? ' selected ' : ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |                     $table .= '>'.$pageSizes[$i].'</option>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  |                 $table .= '</select>'.$_lang["pagination_table_perpage"].'</div>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |                 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |                 $table .= '<div id="pagination" class="paginate">' . $_lang["pagination_table_gotopage"] . '<ul>' . $this->pageNav . '</ul></div>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |                 //$table .= '<script language="javascript">function updatePageSize(size){window.location = \''.$this->prepareLink($linkpage).'pageSize=\'+size;}</script>'; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |             if ($this->allOption) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |                 $table .= ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  | <script language="javascript"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  | 	toggled = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  | 	function clickAll() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  | 		myform = document.getElementById("' . $this->formName . '"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  | 		for(i=0;i<myform.length;i++) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  | 			if(myform.elements[i].type==\'checkbox\') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  | 				myform.elements[i].checked=(toggled?false:true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  | 		toggled = (toggled?0:1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  | </script>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  |             if ($this->formElementType) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |                 if ($this->extra) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |                     $table .= "\n" . $this->extra . "\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |                 $table .= "\n" . '</form>' . "\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |             return $table; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  |         return ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  |      * Generates optional paging navigation controls for the table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  |      * @param int $numRecords The number of records to show per page. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  |      * @param string $qs An optional query string to be appended to the paging links | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  |      * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  |     public function createPagingNavigation($numRecords, $qs = '') | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  |         global $_lang; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  |         $currentPage = (is_numeric($_GET['page']) ? $_GET['page'] : 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |         $numPages = ceil($numRecords / MAX_DISPLAY_RECORDS_NUM); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  |         $nav = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  |         if ($numPages > 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  |             $currentURL = empty($qs) ? '' : '?' . $qs; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  |             if ($currentPage > 6) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  |                 $nav .= $this->createPageLink($currentURL, 1, $_lang["pagination_table_first"]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |             if ($currentPage != 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |                 $nav .= $this->createPageLink($currentURL, $currentPage - 1, '<<'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  |             $offset = -4 + ($currentPage < 5 ? (5 - $currentPage) : 0); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  |             $i = 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  |             while ($i < 10 && ($currentPage + $offset <= $numPages)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 |  |  |                 if ($currentPage == $currentPage + $offset) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  |                     $nav .= $this->createPageLink($currentURL, $currentPage + $offset, $currentPage + $offset, true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  |                     $nav .= $this->createPageLink($currentURL, $currentPage + $offset, $currentPage + $offset); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  |                 $i++; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  |                 $offset++; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  |             if ($currentPage < $numPages) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  |                 $nav .= $this->createPageLink($currentURL, $currentPage + 1, '>>'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  |             if ($currentPage != $numPages) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  |                 $nav .= $this->createPageLink($currentURL, $numPages, $_lang["pagination_table_last"]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |         $this->pageNav = ' ' . $nav; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |      * Creates an individual page link for the paging navigation. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  |      * @param string $link The link for the page, defaulted to the current document. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  |      * @param int $pageNum The page number of the link. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  |      * @param string $displayText The text of the link. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 |  |  |      * @param bool $currentPage Indicates if the link is to the current page. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  |      * @param string $qs And optional query string to be appended to the link. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  |     public function createPageLink($link = '', $pageNum, $displayText, $currentPage = false, $qs = '') | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 |  |  |         $modx = evolutionCMS(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 |  |  |         $orderBy = !empty($_GET['orderby']) ? '&orderby=' . $_GET['orderby'] : ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 |  |  |         $orderDir = !empty($_GET['orderdir']) ? '&orderdir=' . $_GET['orderdir'] : ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  |         if (!empty($qs)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 |  |  |             $qs = "?$qs"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 |  |  |         $link = empty($link) ? $modx->makeUrl($modx->documentIdentifier, $modx->documentObject['alias'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 |  |  |             $qs . "page=$pageNum$orderBy$orderDir") : $this->prepareLink($link) . "page=$pageNum"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 568 |  |  |         $nav = '<li' . ($currentPage ? ' class="currentPage"' : '') . '><a' . ($currentPage ? ' class="currentPage"' : '') . ' href="' . $link . '">' . $displayText . '</a></li>' . "\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 569 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 570 |  |  |         return $nav; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 571 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 572 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 573 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 574 |  |  |      * Adds an INPUT form element column to the table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 575 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 576 |  |  |      * @param string $value The value attribute of the element. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 577 |  |  |      * @param bool $isChecked Indicates if the checked attribute should apply to the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 578 |  |  |      * element. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 579 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 580 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 581 |  |  |     public function addFormField($value, $isChecked) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 582 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 583 |  |  |         $field = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 584 |  |  |         if ($this->formElementType) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 585 |  |  |             $checked = $isChecked ? "checked " : ""; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 586 |  |  |             $field = "\t\t" . '<td><input type="' . $this->formElementType . '" name="' . ($this->formElementName ? $this->formElementName : $value) . '"  value="' . $value . '" ' . $checked . '/></td>' . "\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 587 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 588 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 589 |  |  |         return $field; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 590 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 591 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 592 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 593 |  |  |      * Generates the proper LIMIT clause for queries to retrieve paged results in | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 |  |  |      * a MakeTable $fieldsArray. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 |  |  |     public function handlePaging() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 |  |  |         $offset = (is_numeric($_GET['page']) && $_GET['page'] > 0) ? $_GET['page'] - 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 |  |  |         $limitClause = ' LIMIT ' . ($offset * MAX_DISPLAY_RECORDS_NUM) . ', ' . MAX_DISPLAY_RECORDS_NUM; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 601 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  |         return $limitClause; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 |  |  |      * Generates the SORT BY clause for queries used to retrieve a MakeTable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 |  |  |      * $fieldsArray | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  |      * @param bool $natural_order If true, the results are returned in natural order. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 |  |  |     public function handleSorting($natural_order = false) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 |  |  |         $orderByClause = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 |  |  |         if ((bool)$natural_order === false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  |             $orderby = !empty($_GET['orderby']) ? $_GET['orderby'] : "id"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 |  |  |             $orderdir = !empty($_GET['orderdir']) ? $_GET['orderdir'] : "DESC"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 618 |  |  |             $orderByClause = !empty($orderby) ? ' ORDER BY ' . $orderby . ' ' . $orderdir . ' ' : ""; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 619 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 620 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 621 |  |  |         return $orderByClause; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 622 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 623 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 624 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 625 |  |  |      * Generates a link to order by a specific $fieldsArray key; use to generate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 626 |  |  |      * sort by links in the MakeTable $fieldHeadingsArray values. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 627 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 628 |  |  |      * @param string $key The $fieldsArray key for the column to sort by. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 629 |  |  |      * @param string $text The text for the link (e.g. table column header). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 630 |  |  |      * @param string $qs An optional query string to append to the order by link. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 631 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 632 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 633 |  |  |     public function prepareOrderByLink($key, $text, $qs = '') | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 634 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 635 |  |  |         $modx = evolutionCMS(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 636 |  |  |         if (!empty($_GET['orderdir'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 637 |  |  |             $orderDir = strtolower($_GET['orderdir']) == 'desc' ? '&orderdir=asc' : '&orderdir=desc'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 638 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 639 |  |  |             $orderDir = '&orderdir=asc'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 640 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 641 |  |  |         if (!empty($qs)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 642 |  |  |             if (!strrpos($qs, '&') == strlen($qs) - 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 643 |  |  |                 $qs .= '&'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 644 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 645 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 646 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 647 |  |  |         return '<a href="[~' . $modx->documentIdentifier . '~]?' . $qs . 'orderby=' . $key . $orderDir . '">' . $text . '</a>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 648 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 649 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 650 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 651 |  |  |  | 
            
                        
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
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.