chamilo/chamilo-lms

View on GitHub
public/main/group/group_space.php

Summary

Maintainability
A
0 mins
Test Coverage

The method get_group_user_data uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $sql = 'SELECT DISTINCT
                        user.id     AS col0,
                        '.(
                api_is_western_name_order() ?
Severity: Minor
Found in public/main/group/group_space.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method get_group_user_data uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

    } else {
        if (api_is_allowed_to_edit()) {
            $sql = 'SELECT DISTINCT
                        u.id AS col0,
                        '.(api_is_western_name_order() ?
Severity: Minor
Found in public/main/group/group_space.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The parameter $number_of_items is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

Variable "unsubscribe_group" is not in valid camel caps format
Open

$unsubscribe_group = '';

Variable "user_id" is not in valid camel caps format
Open

if (GroupManager::is_self_unregistration_allowed($user_id, $groupEntity)) {

Variable "actions_array" is not in valid camel caps format
Open

        echo Display::actions($actions_array);

Variable "tutor_info" is not in valid camel caps format
Open

        $tutor_info .= '<li>';

Variable "course_id" is not in valid camel caps format
Open

    if (empty($groupInfo) || empty($course_id)) {

Variable "table_group_user" is not in valid camel caps format
Open

    $table_group_user = Database::get_course_table(TABLE_GROUP_USER);

Variable "current_course_tool" is not in valid camel caps format
Open

$current_course_tool = TOOL_GROUP;

Variable "user_id" is not in valid camel caps format
Open

$user_id = api_get_user_id();

Variable "actions_array" is not in valid camel caps format
Open

            $actions_array[] = [

Variable "actions_array" is not in valid camel caps format
Open

            $actions_array[] = [

Variable "actions_array" is not in valid camel caps format
Open

            $actions_array[] = [

Variable "group_id" is not in valid camel caps format
Open

            href="'.api_get_self().'?selfReg=1&group_id='.$group_id.'"

Variable "edit_url" is not in valid camel caps format
Open

    $edit_url = '<a

Variable "actions_array" is not in valid camel caps format
Open

                    $actions_array[] = [

Variable "actions_array" is not in valid camel caps format
Open

        $actions_array[] = [

Variable "course_id" is not in valid camel caps format
Open

    if (empty($groupInfo) || empty($course_id)) {

Missing function doc comment
Open

function activeFilter($isActive)

Variable "edit_url" is not in valid camel caps format
Open

    Security::remove_XSS($groupEntity->getTitle()).' '.$edit_url.' '.$subscribe_group.' '.$unsubscribe_group

Variable "actions_array" is not in valid camel caps format
Open

        $actions_array[] = [

Variable "group_id" is not in valid camel caps format
Open

        if (!empty($group_id)) {

Variable "tutor_info" is not in valid camel caps format
Open

    $tutor_info .= '<ul class="thumbnails">';

Variable "my_gidreq" is not in valid camel caps format
Open

$my_gidreq = isset($_GET['gid']) ? (int) $_GET['gid'] : 0;

Variable "course_id" is not in valid camel caps format
Open

                c_id = $course_id AND

Variable "number_of_items" is not in valid camel caps format
Open

function get_group_user_data($from, $number_of_items, $column, $direction)

Variable "user_id" is not in valid camel caps format
Open

    GroupManager::userHasAccessToBrowse($user_id, $groupEntity, api_get_session_id())

Variable "group_id" is not in valid camel caps format
Open

            $groupFilter = "&type=course&user_id=GROUP:$group_id";

Variable "actions_array" is not in valid camel caps format
Open

    if (!empty($actions_array)) {

Variable "actions_array" is not in valid camel caps format
Open

        $actions_array[] = [

Variable "tutor_info" is not in valid camel caps format
Open

    $tutor_info = get_lang('(none)');

Consider putting global function "get_number_of_group_users" in a static class
Open

function get_number_of_group_users()

Variable "table_user" is not in valid camel caps format
Open

    $table_user = Database::get_main_table(TABLE_MAIN_USER);

Variable "number_of_items" is not in valid camel caps format
Open

                LIMIT $from, $number_of_items";

Variable "group_id" is not in valid camel caps format
Open

    $groupEntity = api_get_group_entity($group_id);

Variable "unsubscribe_group" is not in valid camel caps format
Open

    Security::remove_XSS($groupEntity->getTitle()).' '.$edit_url.' '.$subscribe_group.' '.$unsubscribe_group

Variable "group_id" is not in valid camel caps format
Open

            $groupFilter = "&type=course&user_id=GROUP:$group_id";

Variable "group_id" is not in valid camel caps format
Open

                api_get_cidreq().'&action=show&title=index&sid='.api_get_session_id().'&gid='.$group_id,

Variable "table_user" is not in valid camel caps format
Open

                    FROM $table_user u

Variable "course_id" is not in valid camel caps format
Open

                        group_rel_user.c_id = $course_id AND

Variable "subscribe_group" is not in valid camel caps format
Open

    $subscribe_group = '<a

Variable "actions_array" is not in valid camel caps format
Open

        $actions_array[] = [

Variable "group_id" is not in valid camel caps format
Open

                'url' => api_get_path(WEB_CODE_PATH).'chat/chat.php?'.api_get_cidreq().'&toolgroup='.$group_id,

Variable "actions_array" is not in valid camel caps format
Open

    if (!empty($actions_array)) {

Variable "tutor_info" is not in valid camel caps format
Open

$tutor_info = '';

Variable "tutor_info" is not in valid camel caps format
Open

if (!empty($tutor_info)) {

Variable "course_id" is not in valid camel caps format
Open

                        gu.c_id = $course_id

Variable "table_user" is not in valid camel caps format
Open

                    FROM $table_user user

Variable "number_of_items" is not in valid camel caps format
Open

                    LIMIT $from, $number_of_items";

Variable "user_id" is not in valid camel caps format
Open

    GroupManager::subscribeUsers($user_id, $groupEntity);

Variable "user_id" is not in valid camel caps format
Open

    GroupManager::isTutorOfGroup($user_id, $groupEntity)

Variable "actions_array" is not in valid camel caps format
Open

        $actions_array[] = [

Variable "actions_array" is not in valid camel caps format
Open

        echo Display::actions($actions_array);

Variable "course_id" is not in valid camel caps format
Open

                    group_rel_user.c_id = $course_id AND

Variable "actions_array" is not in valid camel caps format
Open

        $actions_array[] = [

Variable "actions_array" is not in valid camel caps format
Open

                    $actions_array[] = [

Variable "group_id" is not in valid camel caps format
Open

                'url' => "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq().'&toolgroup='.$group_id."','window_chat_group_".api_get_course_id().'_'.api_get_group_id()."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \"",

Variable "tutor_info" is not in valid camel caps format
Open

    echo $tutor_info;

Variable "my_cidreq" is not in valid camel caps format
Open

$my_cidreq = isset($_GET['cid']) ? (int) $_GET['cid'] : 0;

Variable "my_cidreq" is not in valid camel caps format
Open

$parameters = ['cid' => $my_cidreq, 'origin' => $origin, 'gid' => $my_gidreq];

Variable "course_id" is not in valid camel caps format
Open

    $course_id = api_get_course_int_id();

Variable "table_group_user" is not in valid camel caps format
Open

                    INNER JOIN $table_group_user gu

Variable "user_id" is not in valid camel caps format
Open

if (!GroupManager::userHasAccessToBrowse($user_id, $groupEntity, api_get_session_id())) {

Variable "actions_array" is not in valid camel caps format
Open

    $actions_array = [];

Variable "actions_array" is not in valid camel caps format
Open

    $actions_array = [];

Variable "actions_array" is not in valid camel caps format
Open

        $actions_array[] = [

Variable "tutor_info" is not in valid camel caps format
Open

        $tutor_info .= $photo.$completeName;

Variable "user_is_tutor" is not in valid camel caps format
Open

                    !empty($user_is_tutor) ||

Variable "my_gidreq" is not in valid camel caps format
Open

$parameters = ['cid' => $my_cidreq, 'origin' => $origin, 'gid' => $my_gidreq];

Consider putting global function "activeFilter" in a static class
Open

function activeFilter($isActive)

Variable "unsubscribe_group" is not in valid camel caps format
Open

    $unsubscribe_group = '<a

Variable "actions_array" is not in valid camel caps format
Open

        $actions_array[] = [

Consider putting global function "get_group_user_data" in a static class
Open

function get_group_user_data($from, $number_of_items, $column, $direction)

Variable "table_group_user" is not in valid camel caps format
Open

                    INNER JOIN $table_group_user group_rel_user

Variable "group_id" is not in valid camel caps format
Open

if (!empty($group_id)) {

Variable "this_section" is not in valid camel caps format
Open

$this_section = SECTION_COURSES;

Variable "user_id" is not in valid camel caps format
Open

if (GroupManager::is_self_registration_allowed($user_id, $groupEntity)) {

Variable "group_id" is not in valid camel caps format
Open

        if (!empty($group_id)) {

Variable "tutor_info" is not in valid camel caps format
Open

        $tutor_info .= '</li>';

Variable "user_id" is not in valid camel caps format
Open

    GroupManager::unsubscribeUsers($user_id, $groupEntity);

Variable "subscribe_group" is not in valid camel caps format
Open

$subscribe_group = '';

Variable "edit_url" is not in valid camel caps format
Open

$edit_url = '';

Variable "subscribe_group" is not in valid camel caps format
Open

    Security::remove_XSS($groupEntity->getTitle()).' '.$edit_url.' '.$subscribe_group.' '.$unsubscribe_group

Variable "actions_array" is not in valid camel caps format
Open

        $actions_array[] = [

Variable "group_id" is not in valid camel caps format
Open

$group_id = api_get_group_id();

Variable "user_id" is not in valid camel caps format
Open

    GroupManager::is_self_registration_allowed($user_id, $groupEntity)

Variable "user_id" is not in valid camel caps format
Open

    GroupManager::is_self_unregistration_allowed($user_id, $groupEntity)

Variable "tutor_info" is not in valid camel caps format
Open

    $tutor_info .= '</ul>';

Variable "course_id" is not in valid camel caps format
Open

    $course_id = api_get_course_int_id();

Consider putting global function "email_filter" in a static class
Open

function email_filter($email)

Variable "actions_array" is not in valid camel caps format
Open

        $actions_array[] = [

Variable "table_user" is not in valid camel caps format
Open

                FROM $table_user user

Variable "table_group_user" is not in valid camel caps format
Open

                INNER JOIN $table_group_user group_rel_user

Variable "number_of_items" is not in valid camel caps format
Open

                    LIMIT $from, $number_of_items";

The variable $number_of_items is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $number_of_items is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $table_group_user is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_id is not named in camelCase.
Open

function get_number_of_group_users()
{
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();

Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $table_group_user is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $table_group_user is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $table_user is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_id is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $table_group_user is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $number_of_items is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_id is not named in camelCase.
Open

function get_number_of_group_users()
{
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();

Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $table_user is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_id is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_id is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_id is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $table_user is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_id is not named in camelCase.
Open

function get_number_of_group_users()
{
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();

Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_id is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $table_user is not named in camelCase.
Open

function get_group_user_data($from, $number_of_items, $column, $direction)
{
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $groupInfo = GroupManager::get_group_properties(api_get_group_id());
    $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/group/group_space.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

There are no issues that match your filters.

Category
Status