Admidio/admidio

View on GitHub
adm_program/modules/events/events.php

Summary

Maintainability
F
3 days
Test Coverage

File events.php has 650 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 ***********************************************************************************************
 * Show a list of all events
 *
Severity: Major
Found in adm_program/modules/events/events.php - About 1 day to fix

    Avoid deeply nested control flow statements.
    Open

                                    if ($gSettingsManager->getBool('events_may_take_part')) {
                                        $outputButtonParticipation .= '<li>
                                                <a class="icon-link dropdown-item admidio-event-approval-state-tentative ' . $disableStatusTentative . '" href="' . SecurityUtils::encodeUrl(ADMIDIO_URL . FOLDER_MODULES . '/events/events_function.php', array('mode' => 'participate_maybe', 'dat_uuid' => $dateUuid)) . '">
                                                    <i class="bi bi-question-circle-fill" data-bs-toggle="tooltip" title="' . $gL10n->get('SYS_EVENT_PARTICIPATION_TENTATIVE') . '"></i>' . $gL10n->get('SYS_EVENT_PARTICIPATION_TENTATIVE') . '
                                                </a>
    Severity: Major
    Found in adm_program/modules/events/events.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if ($outputNumberMembers > 0 || $outputNumberLeaders > 0) {
                                      $buttonURL = SecurityUtils::encodeUrl(ADMIDIO_URL . FOLDER_MODULES . '/messages/messages_write.php', array('role_uuid' => $event->getValue('rol_uuid')));
      
                                      if ($getView === 'detail') {
                                          $outputButtonParticipantsEmail = '
      Severity: Major
      Found in adm_program/modules/events/events.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if ($outputNumberMembers > 0 || $outputNumberLeaders > 0) {
                                        $buttonURL = SecurityUtils::encodeUrl(ADMIDIO_URL . FOLDER_MODULES . '/groups-roles/lists_show.php', array('mode' => 'html', 'role_list' => $eventRoleUUID));
        
                                        if ($getView === 'detail') {
                                            $outputButtonParticipants = '
        Severity: Major
        Found in adm_program/modules/events/events.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if ($event->participantLimitReached()) {
                                          // Check current user. If user is member of the event role then get his current approval status and set the options
                                          if (array_key_exists($gCurrentUserId, $participantsArray)) {
                                              switch ($participantsArray[$gCurrentUserId]['approved']) {
                                                  case Participants::PARTICIPATION_MAYBE:
          Severity: Major
          Found in adm_program/modules/events/events.php - About 45 mins to fix

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                        if ($gSettingsManager->getBool('events_rooms_enabled')) {
                            $selectBoxEntries = array(
                                'detail' => $gL10n->get('SYS_DETAILED'),
                                'compact' => $gL10n->get('SYS_COMPACT'),
                                'room' => $gL10n->get('SYS_COMPACT') . ' - ' . $gL10n->get('SYS_ROOM'),
            Severity: Major
            Found in adm_program/modules/events/events.php and 1 other location - About 5 hrs to fix
            src/UserInterface/Preferences.php on lines 869..884

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 199.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                                        if ($outputNumberMembers > 0 || $outputNumberLeaders > 0) {
                                            $buttonURL = SecurityUtils::encodeUrl(ADMIDIO_URL . FOLDER_MODULES . '/messages/messages_write.php', array('role_uuid' => $event->getValue('rol_uuid')));
            
                                            if ($getView === 'detail') {
                                                $outputButtonParticipantsEmail = '
            Severity: Major
            Found in adm_program/modules/events/events.php and 1 other location - About 1 hr to fix
            adm_program/modules/events/events.php on lines 583..595

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 114.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                                    if ($participants->isLeader($gCurrentUserId)) {
                                        $buttonURL = SecurityUtils::encodeUrl(ADMIDIO_URL . FOLDER_MODULES . '/groups-roles/members_assignment.php', array('role_uuid' => $event->getValue('rol_uuid')));
            
                                        if ($getView === 'detail') {
                                            $outputButtonParticipantsAssign = '
            Severity: Major
            Found in adm_program/modules/events/events.php and 1 other location - About 1 hr to fix
            adm_program/modules/events/events.php on lines 567..579

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 114.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                            case 'description':
                                $columnHeading = array('&nbsp;', $gL10n->get('SYS_PERIOD'), $gL10n->get('SYS_EVENT'), $gL10n->get('SYS_DESCRIPTION'));
                                $columnAlign = array('center', 'left', 'left', 'left');
                                $compactTable->disableDatatablesColumnsSort(array(5));
                                $compactTable->setDatatablesColumnsNotHideResponsive(array(5));
            Severity: Major
            Found in adm_program/modules/events/events.php and 1 other location - About 1 hr to fix
            adm_program/modules/events/events.php on lines 254..260

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 101.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                            case 'participants':
                                $columnHeading = array('&nbsp;', $gL10n->get('SYS_PERIOD'), $gL10n->get('SYS_EVENT'), $gL10n->get('SYS_PARTICIPANTS'));
                                $columnAlign = array('center', 'left', 'left', 'left');
                                $compactTable->disableDatatablesColumnsSort(array(5));
                                $compactTable->setDatatablesColumnsNotHideResponsive(array(5));
            Severity: Major
            Found in adm_program/modules/events/events.php and 1 other location - About 1 hr to fix
            adm_program/modules/events/events.php on lines 261..267

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 101.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    if ($gSettingsManager->getBool('enable_rss') && (int)$gSettingsManager->get('events_module_enabled') === 1) {
                        $page->addRssFile(
                            ADMIDIO_URL . FOLDER_MODULES . '/events/events_rss.php?organization_short_name=' . $gCurrentOrganization->getValue('org_shortname'),
                            $gL10n->get('SYS_RSS_FEED_FOR_VAR', array($gCurrentOrganization->getValue('org_longname') . ' - ' . $gL10n->get('SYS_EVENTS')))
                        );
            Severity: Minor
            Found in adm_program/modules/events/events.php and 1 other location - About 45 mins to fix
            adm_program/modules/guestbook/guestbook.php on lines 55..60

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 96.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            There are no issues that match your filters.

            Category
            Status