Conditions | 6 |
Paths | 32 |
Total Lines | 94 |
Code Lines | 63 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
109 | public function getMenuitemsSbadmin5() |
||
110 | { |
||
111 | $moduleDirName = \basename(\dirname(__DIR__)); |
||
112 | $pathname = \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'; |
||
113 | $urlModule = \XOOPS_URL . '/modules/' . $moduleDirName . '/'; |
||
114 | |||
115 | require_once $pathname . 'include/common.php'; |
||
116 | $helper = \XoopsModules\Wgevents\Helper::getInstance(); |
||
117 | |||
118 | //load necessary language files from this module |
||
119 | /* $helper->loadLanguage('common'); |
||
120 | $helper->loadLanguage('main');*/ |
||
121 | $helper->loadLanguage('modinfo'); |
||
122 | |||
123 | // start creation of link list as array |
||
124 | $permissionsHandler = $helper->getHandler('Permission'); |
||
125 | |||
126 | $requestUri = $_SERVER['REQUEST_URI']; |
||
127 | /*read navbar items related to perms of current user*/ |
||
128 | $nav_items1 = []; |
||
129 | $nav_items1[] = [ |
||
130 | 'highlight' => \strpos($requestUri, $moduleDirName . '/index.php') > 0, |
||
131 | 'url' => $urlModule . 'index.php', |
||
132 | 'icon' => '<i class="fa fa-tachometer fa-fw fa-lg"></i>', |
||
133 | 'name' => \_MI_WGEVENTS_SMNAME1, |
||
134 | 'sublinks' => [] |
||
135 | ]; |
||
136 | // Sub events |
||
137 | $nav_items1[] = [ |
||
138 | 'highlight' => \strpos($requestUri, $moduleDirName . '/event.php') > 0, |
||
139 | 'url' => $urlModule . 'event.php', |
||
140 | 'icon' => '<i class="fa fa-file fa-fw fa-lg"></i>', |
||
141 | 'name' => \_MI_WGEVENTS_SMNAME2, |
||
142 | 'sublinks' => [] |
||
143 | ]; |
||
144 | if ($permissionsHandler->getPermEventsSubmit()) { |
||
145 | // Sub Submit |
||
146 | $nav_items1[] = [ |
||
147 | 'highlight' => \strpos($requestUri, $moduleDirName . '/event.php?op=list&filter=me') > 0, |
||
148 | 'url' => $urlModule . 'event.php?op=list&filter=me', |
||
149 | 'icon' => '<i class="fa fa-user fa-fw fa-lg"></i>', |
||
150 | 'name' => \_MI_WGEVENTS_SMNAME10, |
||
151 | 'sublinks' => [] |
||
152 | ]; |
||
153 | } |
||
154 | if ($permissionsHandler->getPermEventsSubmit()) { |
||
155 | // Sub Submit |
||
156 | $nav_items1[] = [ |
||
157 | 'highlight' => \strpos($requestUri, $moduleDirName . '/event.php?op=new') > 0, |
||
158 | 'url' => $urlModule . 'event.php?op=new', |
||
159 | 'icon' => '<i class="fa fa-file-circle-plus fa-fw fa-lg"></i>', |
||
160 | 'name' => \_MI_WGEVENTS_SMNAME3, |
||
161 | 'sublinks' => [] |
||
162 | ]; |
||
163 | } |
||
164 | if ($permissionsHandler->getPermEventsSubmit()) { |
||
165 | // Sub Submit |
||
166 | $nav_items1[] = [ |
||
167 | 'highlight' => \strpos($requestUri, $moduleDirName . 'textblock.php') > 0, |
||
168 | 'url' => $urlModule . 'textblock.php?op=list', |
||
169 | 'icon' => '<i class="fa fa-file-lines fa-fw fa-lg"></i>', |
||
170 | 'name' => \_MI_WGEVENTS_SMNAME8, |
||
171 | 'sublinks' => [] |
||
172 | ]; |
||
173 | } |
||
174 | if ($permissionsHandler->getPermRegistrationsSubmit()) { |
||
175 | $nav_items1[] = [ |
||
176 | 'highlight' => \strpos($requestUri, $moduleDirName . 'registration.php') > 0, |
||
177 | 'url' => $urlModule . 'registration.php?op=listmy', |
||
178 | 'icon' => '<i class="fa fa-user fa-fw fa-lg"></i>', |
||
179 | 'name' => \_MI_WGEVENTS_SMNAME5, |
||
180 | 'sublinks' => [] |
||
181 | ]; |
||
182 | } |
||
183 | if ($helper->getConfig('cal_page')) { |
||
184 | // calendar |
||
185 | $nav_items1[] = [ |
||
186 | 'highlight' => \strpos($requestUri, $moduleDirName . 'calendar.php') > 0, |
||
187 | 'url' => $urlModule . 'calendar.php', |
||
188 | 'icon' => '<i class="fa fa-calendar fa-fw fa-lg"></i>', |
||
189 | 'name' => \_MI_WGEVENTS_SMNAME6, |
||
190 | 'sublinks' => [] |
||
191 | ]; |
||
192 | } |
||
193 | // export |
||
194 | $nav_items1[] = [ |
||
195 | 'highlight' => \strpos($requestUri, $moduleDirName . 'export.php') > 0, |
||
196 | 'url' => $urlModule . 'export.php?op=list&new=1', |
||
197 | 'icon' => '<i class="fa fa-download fa-fw fa-lg"></i>', |
||
198 | 'name' => \_MI_WGEVENTS_SMNAME11, |
||
199 | 'sublinks' => [] |
||
200 | ]; |
||
201 | |||
202 | return $nav_items1; |
||
203 | } |
||
207 |