Documentation

CGradeBook::GetList

CDBResult
CGradeBook::GetList(
 array arOrder = Array("ID"=>"DESC"),
 array arFilter = Array()
);

The GetList method returns a list of the grade book records filtered by arFilter and sorted in the arOrder order. The current user access permissions are respected.

Parameters

ParameterDescription
arOrder An array in the format array("filter field"=>"sort order" [, ...]). The sorting field can have the following values:
  • ID - the record ID;
  • TEST_ID - the test ID;
  • STUDENT_ID - the student ID;
  • RESULT - score;
  • MAX_RESULT - maximum score;
  • COMPLETED - the test has been completed;
  • USER_NAME - the student name;
  • TEST_NAME - the test name.
Optional sort order can be one of the following:
  • asc - ascending;
  • desc - descending (default).
arFilter An array in the format array("filtered field"=>"filter value" [, ...]). The following values are possible:
  • ID - the record ID;
  • TEST_ID - the test ID;
  • STUDENT_ID - the student ID;
  • RESULT - score;
  • MAX_RESULT - maximum score;
  • COMPLETED - the test has been completed (Y|N); 
  • USER - the user (can be the combination of the ID, LOGIN, NAME, LAST_NAME fields);
  • MIN_PERMISSION - minimum access permission level. "R" by default. See CCourse::SetPermission for available access permissions;
  • CHECK_PERMISSIONS - the level of access permission will be checked. If set to "N", the check is not performed.
The following logic can be specified at the beginning of the field name:
  • "!" - not equal;
  • "<" - less than;
  • "<=" - less or equal;
  • ">" - more than;
  • ">=" - more or equal.

"filter values"  is a single value or an array.

Optional. By default, records are not filtered.

Return Values

The method returns an instance of the CDBResult object.

See Also

  • CDBResult
  • CGradeBook::GetByID
  • Grade book fields
  • Example

    
    <?
    if (CModule::IncludeModule("learning"))
    {
        $TEST_ID = 45;
        $res = CGradebook::GetList(
            Array("ID" => "ASC"), 
            Array("TEST_ID" => $TEST_ID)
        );
    
        while ($arGradebook = $res->GetNext())
        {
            echo "Student: ".$arGradebook["USER_NAME"].
                 "; Test name: ".$arGradebook["TEST_NAME"].
                 "; Completed: ".$arGradebook["COMPLETED"]."<br>";
        }
    }
    ?>
    
    <?
    
    if (CModule::IncludeModule("learning"))
    {
        $TEST_ID = 45;
        $STUDENT_ID = 3;
    
        $res = CGradebook::GetList(
            Array("ID" => "ASC"), 
            Array("CHECK_PERMISSIONS" => "N", "TEST_ID" => $TEST_ID, "STUDENT_ID" => $STUDENT_ID)
        );
    
        while ($arGradebook = $res->GetNext())
        {
            echo "Student: ".$arGradebook["USER_NAME"].
                 "; Test name: ".$arGradebook["TEST_NAME"].
                 "; Completed: ".$arGradebook["COMPLETED"]."<br>";
        }
    }
    ?>
    © «Bitrix24», 2001-2024
    Up