| Conditions | 23 |
| Paths | 7938 |
| Total Lines | 483 |
| Code Lines | 328 |
| Lines | 49 |
| Ratio | 10.14 % |
| Changes | 0 | ||
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 |
||
| 61 | private function loadAdminMenu() |
||
| 62 | { |
||
| 63 | // Access restrictions. |
||
| 64 | api_protect_admin_script(true); |
||
| 65 | |||
| 66 | $adminUrl = api_get_path(WEB_CODE_PATH).'admin/'; |
||
| 67 | $blocks = array(); |
||
| 68 | |||
| 69 | /* Users */ |
||
| 70 | $blocks['users']['icon'] = \Display::return_icon( |
||
| 71 | 'members.gif', |
||
| 72 | get_lang('Users'), |
||
| 73 | array(), |
||
| 74 | ICON_SIZE_SMALL, |
||
| 75 | false |
||
| 76 | ); |
||
| 77 | $blocks['users']['label'] = api_ucfirst(get_lang('Users')); |
||
| 78 | |||
| 79 | if (api_is_platform_admin()) { |
||
| 80 | $search_form = $this->getSearchForm($adminUrl.'user_list.php')->return_form(); |
||
|
|
|||
| 81 | $blocks['users']['search_form'] = $search_form; |
||
| 82 | $items = array( |
||
| 83 | array( |
||
| 84 | 'url' => $adminUrl.'user_list.php', |
||
| 85 | 'label' => get_lang('UserList'), |
||
| 86 | ), |
||
| 87 | array( |
||
| 88 | 'url' => $adminUrl.'user_add.php', |
||
| 89 | 'label' => get_lang('AddUsers'), |
||
| 90 | ), |
||
| 91 | array( |
||
| 92 | 'url' => $adminUrl.'user_export.php', |
||
| 93 | 'label' => get_lang('ExportUserListXMLCSV'), |
||
| 94 | ), |
||
| 95 | array( |
||
| 96 | 'url' => $adminUrl.'user_import.php', |
||
| 97 | 'label' => get_lang('ImportUserListXMLCSV'), |
||
| 98 | ), |
||
| 99 | ); |
||
| 100 | View Code Duplication | if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count( |
|
| 101 | $extAuthSource['ldap'] |
||
| 102 | ) > 0 |
||
| 103 | ) { |
||
| 104 | $items[] = array( |
||
| 105 | 'url' => $adminUrl.'ldap_users_list.php', |
||
| 106 | 'label' => get_lang('ImportLDAPUsersIntoPlatform'), |
||
| 107 | ); |
||
| 108 | } |
||
| 109 | $items[] = array( |
||
| 110 | 'url' => $adminUrl.'extra_fields.php?type=user', |
||
| 111 | 'label' => get_lang('ManageUserFields'), |
||
| 112 | ); |
||
| 113 | /*$items[] = array('url'=> api_get_path(WEB_PUBLIC_PATH) |
||
| 114 | .'admin/administrator/roles', 'label' => get_lang('Roles'));*/ |
||
| 115 | } else { |
||
| 116 | $items = array( |
||
| 117 | array( |
||
| 118 | 'url' => $adminUrl.'user_list.php', |
||
| 119 | 'label' => get_lang('UserList'), |
||
| 120 | ), |
||
| 121 | array( |
||
| 122 | 'url' => $adminUrl.'user_add.php', |
||
| 123 | 'label' => get_lang('AddUsers'), |
||
| 124 | ), |
||
| 125 | array( |
||
| 126 | 'url' => $adminUrl.'user_import.php', |
||
| 127 | 'label' => get_lang('ImportUserListXMLCSV'), |
||
| 128 | ), |
||
| 129 | ); |
||
| 130 | } |
||
| 131 | |||
| 132 | $items[] = array( |
||
| 133 | 'url' => $adminUrl.'usergroups.php', |
||
| 134 | 'label' => get_lang('Classes'), |
||
| 135 | ); |
||
| 136 | |||
| 137 | $blocks['users']['items'] = $items; |
||
| 138 | $blocks['users']['extra'] = null; |
||
| 139 | |||
| 140 | if (api_is_platform_admin()) { |
||
| 141 | /* Courses */ |
||
| 142 | $blocks['courses']['icon'] = \Display::return_icon( |
||
| 143 | 'course.png', |
||
| 144 | get_lang('Courses'), |
||
| 145 | array(), |
||
| 146 | ICON_SIZE_MEDIUM, |
||
| 147 | false |
||
| 148 | ); |
||
| 149 | $blocks['courses']['label'] = api_ucfirst(get_lang('Courses')); |
||
| 150 | |||
| 151 | $search_form = $this->getSearchForm( |
||
| 152 | $adminUrl.'course_list.php' |
||
| 153 | )->return_form(); |
||
| 154 | $blocks['courses']['search_form'] = $search_form; |
||
| 155 | |||
| 156 | $items = array(); |
||
| 157 | $items[] = array( |
||
| 158 | 'url' => $adminUrl.'course_list.php', |
||
| 159 | 'label' => get_lang('CourseList'), |
||
| 160 | ); |
||
| 161 | |||
| 162 | if (api_get_setting('course.course_validation') != 'true') { |
||
| 163 | $items[] = array( |
||
| 164 | 'url' => $adminUrl.'course_add.php', |
||
| 165 | 'label' => get_lang('AddCourse'), |
||
| 166 | ); |
||
| 167 | } else { |
||
| 168 | $items[] = array( |
||
| 169 | 'url' => $adminUrl.'course_request_review.php', |
||
| 170 | 'label' => get_lang('ReviewCourseRequests'), |
||
| 171 | ); |
||
| 172 | $items[] = array( |
||
| 173 | 'url' => $adminUrl.'course_request_accepted.php', |
||
| 174 | 'label' => get_lang('AcceptedCourseRequests'), |
||
| 175 | ); |
||
| 176 | $items[] = array( |
||
| 177 | 'url' => $adminUrl.'course_request_rejected.php', |
||
| 178 | 'label' => get_lang('RejectedCourseRequests'), |
||
| 179 | ); |
||
| 180 | } |
||
| 181 | |||
| 182 | $items[] = array( |
||
| 183 | 'url' => $adminUrl.'course_export.php', |
||
| 184 | 'label' => get_lang('ExportCourses'), |
||
| 185 | ); |
||
| 186 | $items[] = array( |
||
| 187 | 'url' => $adminUrl.'course_import.php', |
||
| 188 | 'label' => get_lang('ImportCourses'), |
||
| 189 | ); |
||
| 190 | $items[] = array( |
||
| 191 | 'url' => $adminUrl.'course_category.php', |
||
| 192 | 'label' => get_lang('AdminCategories'), |
||
| 193 | ); |
||
| 194 | $items[] = array( |
||
| 195 | 'url' => $adminUrl.'subscribe_user2course.php', |
||
| 196 | 'label' => get_lang('AddUsersToACourse'), |
||
| 197 | ); |
||
| 198 | $items[] = array( |
||
| 199 | 'url' => $adminUrl.'course_user_import.php', |
||
| 200 | 'label' => get_lang('ImportUsersToACourse'), |
||
| 201 | ); |
||
| 202 | $items[] = array( |
||
| 203 | 'url' => $adminUrl.'extra_fields.php?type=course', |
||
| 204 | 'label' => get_lang('ManageCourseFields'), |
||
| 205 | ); |
||
| 206 | $items[] = array( |
||
| 207 | 'url' => $adminUrl.'extra_fields.php?type=question', |
||
| 208 | 'label' => get_lang('ManageQuestionFields'), |
||
| 209 | ); |
||
| 210 | |||
| 211 | /*if (api_get_setting('gradebook.gradebook_enable_grade_model') == 'true') { |
||
| 212 | $items[] = array( |
||
| 213 | 'url' => $adminUrl.'grade_models.php', |
||
| 214 | 'label' => get_lang('GradeModel'), |
||
| 215 | ); |
||
| 216 | }*/ |
||
| 217 | |||
| 218 | View Code Duplication | if (isset($extAuthSource) && |
|
| 219 | isset($extAuthSource['ldap']) && |
||
| 220 | count($extAuthSource['ldap']) > 0 |
||
| 221 | ) { |
||
| 222 | $items[] = array( |
||
| 223 | 'url' => $adminUrl.'ldap_import_students.php', |
||
| 224 | 'label' => get_lang('ImportLDAPUsersIntoCourse'), |
||
| 225 | ); |
||
| 226 | } |
||
| 227 | $blocks['courses']['items'] = $items; |
||
| 228 | $blocks['courses']['extra'] = null; |
||
| 229 | |||
| 230 | /* Platform */ |
||
| 231 | $blocks['platform']['icon'] = \Display::return_icon( |
||
| 232 | 'platform.png', |
||
| 233 | get_lang('Platform'), |
||
| 234 | array(), |
||
| 235 | ICON_SIZE_MEDIUM, |
||
| 236 | false |
||
| 237 | ); |
||
| 238 | $blocks['platform']['label'] = api_ucfirst(get_lang('Platform')); |
||
| 239 | |||
| 240 | $form = $this->getSearchForm($adminUrl.'settings.php'); |
||
| 241 | $form->addElement('hidden', 'category', 'search_setting'); |
||
| 242 | $search_form = $form->return_form(); |
||
| 243 | $blocks['platform']['search_form'] = $search_form; |
||
| 244 | |||
| 245 | $items = array(); |
||
| 246 | $items[] = array( |
||
| 247 | 'url' => $this->generateUrl( |
||
| 248 | 'admin_settings' |
||
| 249 | ), |
||
| 250 | 'label' => get_lang('PlatformConfigSettings'), |
||
| 251 | ); |
||
| 252 | $items[] = array( |
||
| 253 | 'url' => $adminUrl.'settings.php?category=Plugins', |
||
| 254 | 'label' => get_lang('Plugins'), |
||
| 255 | ); |
||
| 256 | $items[] = array( |
||
| 257 | 'url' => $adminUrl.'settings.php?category=Regions', |
||
| 258 | 'label' => get_lang('Regions'), |
||
| 259 | ); |
||
| 260 | $items[] = array( |
||
| 261 | 'url' => $adminUrl.'system_announcements.php', |
||
| 262 | 'label' => get_lang('SystemAnnouncements'), |
||
| 263 | ); |
||
| 264 | $items[] = array( |
||
| 265 | 'url' => api_get_path( |
||
| 266 | WEB_CODE_PATH |
||
| 267 | ).'calendar/agenda_js.php?type=admin', |
||
| 268 | 'label' => get_lang('GlobalAgenda'), |
||
| 269 | ); |
||
| 270 | $items[] = array( |
||
| 271 | 'url' => $adminUrl.'configure_homepage.php', |
||
| 272 | 'label' => get_lang('ConfigureHomePage'), |
||
| 273 | ); |
||
| 274 | $items[] = array( |
||
| 275 | 'url' => $adminUrl.'configure_inscription.php', |
||
| 276 | 'label' => get_lang('ConfigureInscription'), |
||
| 277 | ); |
||
| 278 | $items[] = array( |
||
| 279 | 'url' => $adminUrl.'statistics/index.php', |
||
| 280 | 'label' => get_lang('Statistics'), |
||
| 281 | ); |
||
| 282 | $items[] = array( |
||
| 283 | 'url' => api_get_path( |
||
| 284 | WEB_CODE_PATH |
||
| 285 | ).'mySpace/company_reports.php', |
||
| 286 | 'label' => get_lang('Reports'), |
||
| 287 | ); |
||
| 288 | |||
| 289 | /* Event settings */ |
||
| 290 | |||
| 291 | if (api_get_setting('mail.activate_email_template') == 'true') { |
||
| 292 | $items[] = array( |
||
| 293 | 'url' => $adminUrl.'event_controller.php?action=listing', |
||
| 294 | 'label' => get_lang('EventMessageManagement'), |
||
| 295 | ); |
||
| 296 | } |
||
| 297 | |||
| 298 | if (api_get_multiple_access_url()) { |
||
| 299 | if (api_is_global_platform_admin()) { |
||
| 300 | $items[] = array( |
||
| 301 | 'url' => $adminUrl.'access_urls.php', |
||
| 302 | 'label' => get_lang('ConfigureMultipleAccessURLs'), |
||
| 303 | ); |
||
| 304 | } |
||
| 305 | } |
||
| 306 | |||
| 307 | View Code Duplication | if (api_get_setting('registration.allow_terms_conditions') == |
|
| 308 | 'true' |
||
| 309 | ) { |
||
| 310 | $items[] = array( |
||
| 311 | 'url' => $adminUrl.'legal_add.php', |
||
| 312 | 'label' => get_lang('TermsAndConditions'), |
||
| 313 | ); |
||
| 314 | } |
||
| 315 | $blocks['platform']['items'] = $items; |
||
| 316 | $blocks['platform']['extra'] = null; |
||
| 317 | } |
||
| 318 | |||
| 319 | /* Sessions */ |
||
| 320 | $blocks['sessions']['icon'] = \Display::return_icon( |
||
| 321 | 'session.png', |
||
| 322 | get_lang('Sessions'), |
||
| 323 | array(), |
||
| 324 | ICON_SIZE_SMALL, |
||
| 325 | false |
||
| 326 | ); |
||
| 327 | $blocks['sessions']['label'] = api_ucfirst(get_lang('Sessions')); |
||
| 328 | $search_form = $this->getSearchForm( |
||
| 329 | api_get_path(WEB_CODE_PATH).'session/session_list.php' |
||
| 330 | )->return_form(); |
||
| 331 | $blocks['sessions']['search_form'] = $search_form; |
||
| 332 | $items = array(); |
||
| 333 | $items[] = array( |
||
| 334 | 'url' => api_get_path( |
||
| 335 | WEB_CODE_PATH |
||
| 336 | ).'session/session_list.php', |
||
| 337 | 'label' => get_lang('ListSession'), |
||
| 338 | ); |
||
| 339 | $items[] = array( |
||
| 340 | 'url' => api_get_path( |
||
| 341 | WEB_CODE_PATH |
||
| 342 | ).'session/session_add.php', |
||
| 343 | 'label' => get_lang('AddSession'), |
||
| 344 | ); |
||
| 345 | $items[] = array( |
||
| 346 | 'url' => api_get_path(WEB_CODE_PATH).'session/session_category_list.php', |
||
| 347 | 'label' => get_lang('ListSessionCategory'), |
||
| 348 | ); |
||
| 349 | $items[] = array( |
||
| 350 | 'url' => api_get_path(WEB_CODE_PATH).'session/session_import.php', |
||
| 351 | 'label' => get_lang('ImportSessionListXMLCSV'), |
||
| 352 | ); |
||
| 353 | View Code Duplication | if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count( |
|
| 354 | $extAuthSource['ldap'] |
||
| 355 | ) > 0 |
||
| 356 | ) { |
||
| 357 | $items[] = array( |
||
| 358 | 'url' => $adminUrl.'ldap_import_students_to_session.php', |
||
| 359 | 'label' => get_lang('ImportLDAPUsersIntoSession'), |
||
| 360 | ); |
||
| 361 | } |
||
| 362 | $items[] = array( |
||
| 363 | 'url' => api_get_path(WEB_CODE_PATH).'session/session_export.php', |
||
| 364 | 'label' => get_lang('ExportSessionListXMLCSV'), |
||
| 365 | ); |
||
| 366 | $items[] = array( |
||
| 367 | 'url' => $adminUrl.'../coursecopy/copy_course_session.php', |
||
| 368 | 'label' => get_lang('CopyFromCourseInSessionToAnotherSession'), |
||
| 369 | ); |
||
| 370 | |||
| 371 | if (api_is_platform_admin()) { |
||
| 372 | View Code Duplication | if (is_dir( |
|
| 373 | api_get_path(SYS_TEST_PATH).'datafiller/' |
||
| 374 | )) { // option only visible in development mode. Enable through code if required |
||
| 375 | $items[] = array( |
||
| 376 | 'url' => $adminUrl.'user_move_stats.php', |
||
| 377 | 'label' => get_lang('MoveUserStats'), |
||
| 378 | ); |
||
| 379 | } |
||
| 380 | $items[] = array( |
||
| 381 | 'url' => $adminUrl.'career_dashboard.php', |
||
| 382 | 'label' => get_lang('CareersAndPromotions'), |
||
| 383 | ); |
||
| 384 | } |
||
| 385 | |||
| 386 | $items[] = array( |
||
| 387 | 'url' => $adminUrl.'exercise_report.php', |
||
| 388 | 'label' => get_lang('ExerciseReport'), |
||
| 389 | ); |
||
| 390 | $items[] = array( |
||
| 391 | 'url' => $adminUrl.'extra_fields.php?type=session', |
||
| 392 | 'label' => get_lang('ManageSessionFields'), |
||
| 393 | ); |
||
| 394 | |||
| 395 | $blocks['sessions']['items'] = $items; |
||
| 396 | $blocks['sessions']['extra'] = null; |
||
| 397 | |||
| 398 | /* Settings */ |
||
| 399 | if (api_is_platform_admin()) { |
||
| 400 | |||
| 401 | $blocks['settings']['icon'] = \Display::return_icon( |
||
| 402 | 'settings.png', |
||
| 403 | get_lang('System'), |
||
| 404 | array(), |
||
| 405 | ICON_SIZE_SMALL, |
||
| 406 | false |
||
| 407 | ); |
||
| 408 | $blocks['settings']['label'] = api_ucfirst(get_lang('System')); |
||
| 409 | |||
| 410 | $items = array(); |
||
| 411 | $items[] = array( |
||
| 412 | 'url' => $adminUrl.'special_exports.php', |
||
| 413 | 'label' => get_lang('SpecialExports'), |
||
| 414 | ); |
||
| 415 | $dbPath = api_get_configuration_value('db_admin_path'); |
||
| 416 | if (!empty($dbPath)) { |
||
| 417 | $items[] = array( |
||
| 418 | 'url' => $dbPath, |
||
| 419 | 'label' => get_lang('AdminDatabases').' ('.get_lang('DBManagementOnlyForServerAdmin').') ', |
||
| 420 | ); |
||
| 421 | } |
||
| 422 | $items[] = array( |
||
| 423 | 'url' => $adminUrl.'system_status.php', |
||
| 424 | 'label' => get_lang('SystemStatus'), |
||
| 425 | ); |
||
| 426 | View Code Duplication | if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) { |
|
| 427 | $items[] = array( |
||
| 428 | 'url' => $adminUrl.'filler.php', |
||
| 429 | 'label' => get_lang('DataFiller'), |
||
| 430 | ); |
||
| 431 | } |
||
| 432 | $items[] = array( |
||
| 433 | 'url' => $adminUrl.'archive_cleanup.php', |
||
| 434 | 'label' => get_lang('ArchiveDirCleanup'), |
||
| 435 | ); |
||
| 436 | //$items[] = array('url' => $adminUrl.'system_management.php', 'label' => get_lang('SystemManagement')); |
||
| 437 | |||
| 438 | $blocks['settings']['items'] = $items; |
||
| 439 | $blocks['settings']['extra'] = null; |
||
| 440 | |||
| 441 | $blocks['settings']['search_form'] = null; |
||
| 442 | |||
| 443 | //Skills |
||
| 444 | if (api_get_setting('skill.allow_skills_tool') == 'true') { |
||
| 445 | $blocks['skills']['icon'] = \Display::return_icon( |
||
| 446 | 'logo.png', |
||
| 447 | get_lang('Skills'), |
||
| 448 | array(), |
||
| 449 | ICON_SIZE_SMALL, |
||
| 450 | false |
||
| 451 | ); |
||
| 452 | $blocks['skills']['label'] = get_lang('Skills'); |
||
| 453 | |||
| 454 | $items = array(); |
||
| 455 | //$items[] = array('url' => $adminUrl.'skills.php', 'label' => get_lang('SkillsTree')); |
||
| 456 | $items[] = array( |
||
| 457 | 'url' => $adminUrl.'skills_wheel.php', |
||
| 458 | 'label' => get_lang('SkillsWheel'), |
||
| 459 | ); |
||
| 460 | $items[] = array( |
||
| 461 | 'url' => $adminUrl.'skills_import.php', |
||
| 462 | 'label' => get_lang('SkillsImport'), |
||
| 463 | ); |
||
| 464 | //$items[] = array('url' => $adminUrl.'skills_profile.php', 'label' => get_lang('SkillsProfile')); |
||
| 465 | $items[] = array( |
||
| 466 | 'url' => api_get_path( |
||
| 467 | WEB_CODE_PATH |
||
| 468 | ).'social/skills_ranking.php', |
||
| 469 | 'label' => get_lang('SkillsRanking'), |
||
| 470 | ); |
||
| 471 | $items[] = array( |
||
| 472 | 'url' => $adminUrl.'skills_gradebook.php', |
||
| 473 | 'label' => get_lang('SkillsAndGradebooks'), |
||
| 474 | ); |
||
| 475 | $blocks['skills']['items'] = $items; |
||
| 476 | $blocks['skills']['extra'] = null; |
||
| 477 | $blocks['skills']['search_form'] = null; |
||
| 478 | } |
||
| 479 | |||
| 480 | /** Chamilo.org */ |
||
| 481 | |||
| 482 | $blocks['chamilo']['icon'] = \Display::return_icon( |
||
| 483 | 'logo.png', |
||
| 484 | 'Chamilo.org', |
||
| 485 | array(), |
||
| 486 | ICON_SIZE_SMALL, |
||
| 487 | false |
||
| 488 | ); |
||
| 489 | $blocks['chamilo']['label'] = 'Chamilo.org'; |
||
| 490 | |||
| 491 | $items = array(); |
||
| 492 | $items[] = array( |
||
| 493 | 'url' => 'http://www.chamilo.org/', |
||
| 494 | 'label' => get_lang('ChamiloHomepage'), |
||
| 495 | ); |
||
| 496 | $items[] = array( |
||
| 497 | 'url' => 'http://www.chamilo.org/forum', |
||
| 498 | 'label' => get_lang('ChamiloForum'), |
||
| 499 | ); |
||
| 500 | $items[] = array( |
||
| 501 | 'url' => '../../documentation/installation_guide.html', |
||
| 502 | 'label' => get_lang('InstallationGuide'), |
||
| 503 | ); |
||
| 504 | $items[] = array( |
||
| 505 | 'url' => '../../documentation/changelog.html', |
||
| 506 | 'label' => get_lang('ChangesInLastVersion'), |
||
| 507 | ); |
||
| 508 | $items[] = array( |
||
| 509 | 'url' => '../../documentation/credits.html', |
||
| 510 | 'label' => get_lang('ContributorsList'), |
||
| 511 | ); |
||
| 512 | $items[] = array( |
||
| 513 | 'url' => '../../documentation/security.html', |
||
| 514 | 'label' => get_lang('SecurityGuide'), |
||
| 515 | ); |
||
| 516 | $items[] = array( |
||
| 517 | 'url' => '../../documentation/optimization.html', |
||
| 518 | 'label' => get_lang('OptimizationGuide'), |
||
| 519 | ); |
||
| 520 | $items[] = array( |
||
| 521 | 'url' => 'http://www.chamilo.org/extensions', |
||
| 522 | 'label' => get_lang('ChamiloExtensions'), |
||
| 523 | ); |
||
| 524 | $items[] = array( |
||
| 525 | 'url' => 'http://www.chamilo.org/en/providers', |
||
| 526 | 'label' => get_lang('ChamiloOfficialServicesProviders'), |
||
| 527 | ); |
||
| 528 | |||
| 529 | $blocks['chamilo']['items'] = $items; |
||
| 530 | $blocks['chamilo']['extra'] = null; |
||
| 531 | $blocks['chamilo']['search_form'] = null; |
||
| 532 | } |
||
| 533 | |||
| 534 | $admin_ajax_url = api_get_path(WEB_AJAX_PATH).'admin.ajax.php'; |
||
| 535 | |||
| 536 | return $this->render( |
||
| 537 | 'ChamiloCoreBundle:Admin:index.html.twig', |
||
| 538 | array( |
||
| 539 | 'blocks' => $blocks, |
||
| 540 | 'web_admin_ajax_url' => $admin_ajax_url, |
||
| 541 | ) |
||
| 542 | ); |
||
| 543 | } |
||
| 544 | } |
||
| 545 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.