Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 70... Línea 70...
70
        FEATURE_GROUPINGS => true,
70
        FEATURE_GROUPINGS => true,
71
        FEATURE_MOD_INTRO => true,
71
        FEATURE_MOD_INTRO => true,
72
        FEATURE_BACKUP_MOODLE2 => true,
72
        FEATURE_BACKUP_MOODLE2 => true,
73
        FEATURE_COMPLETION_TRACKS_VIEWS => true,
73
        FEATURE_COMPLETION_TRACKS_VIEWS => true,
74
        FEATURE_COMPLETION_HAS_RULES => true,
74
        FEATURE_COMPLETION_HAS_RULES => true,
75
        FEATURE_GRADE_HAS_GRADE => false,
75
        FEATURE_GRADE_HAS_GRADE => true,
76
        FEATURE_GRADE_OUTCOMES => false,
76
        FEATURE_GRADE_OUTCOMES => false,
77
        FEATURE_SHOW_DESCRIPTION => true,
77
        FEATURE_SHOW_DESCRIPTION => true,
78
        FEATURE_MOD_PURPOSE => MOD_PURPOSE_COMMUNICATION,
78
        FEATURE_MOD_PURPOSE => MOD_PURPOSE_COMMUNICATION,
79
    ];
79
    ];
80
    if (isset($features[(string) $feature])) {
80
    if (isset($features[(string) $feature])) {
Línea 109... Línea 109...
109
    // Complete the process.
109
    // Complete the process.
110
    mod_helper::process_post_save($bigbluebuttonbn);
110
    mod_helper::process_post_save($bigbluebuttonbn);
Línea 111... Línea 111...
111
 
111
 
112
    // Call any active subplugin so to signal a new creation.
112
    // Call any active subplugin so to signal a new creation.
-
 
113
    extension::add_instance($bigbluebuttonbn);
-
 
114
 
-
 
115
    // Create new grade item.
-
 
116
    bigbluebuttonbn_grade_item_update($bigbluebuttonbn);
113
    extension::add_instance($bigbluebuttonbn);
117
 
114
    return $bigbluebuttonbn->id;
118
    return $bigbluebuttonbn->id;
Línea 115... Línea 119...
115
}
119
}
116
 
120
 
Línea 136... Línea 140...
136
            \mod_bigbluebuttonbn\plugin::generate_guest_meeting_credentials();
140
            \mod_bigbluebuttonbn\plugin::generate_guest_meeting_credentials();
137
    }
141
    }
138
    // Update a record.
142
    // Update a record.
139
    $DB->update_record('bigbluebuttonbn', $bigbluebuttonbn);
143
    $DB->update_record('bigbluebuttonbn', $bigbluebuttonbn);
Línea -... Línea 144...
-
 
144
 
-
 
145
    bigbluebuttonbn_grade_item_update($bigbluebuttonbn);
140
 
146
 
141
    // Get the meetingid column in the bigbluebuttonbn table.
147
    // Get the meetingid column in the bigbluebuttonbn table.
Línea 142... Línea 148...
142
    $bigbluebuttonbn->meetingid = (string) $DB->get_field('bigbluebuttonbn', 'meetingid', ['id' => $bigbluebuttonbn->id]);
148
    $bigbluebuttonbn->meetingid = (string) $DB->get_field('bigbluebuttonbn', 'meetingid', ['id' => $bigbluebuttonbn->id]);
143
 
149
 
Línea 198... Línea 204...
198
        }
204
        }
199
    }
205
    }
Línea 200... Línea 206...
200
 
206
 
Línea -... Línea 207...
-
 
207
    $result = true;
-
 
208
 
-
 
209
    // Delete grades.
-
 
210
    $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', ['id' => $id]);
201
    $result = true;
211
    bigbluebuttonbn_grade_item_delete($bigbluebuttonbn);
202
 
212
 
Línea 203... Línea 213...
203
    // Call any active subplugin so to signal deletion.
213
    // Call any active subplugin so to signal deletion.
204
    extension::delete_instance($id);
214
    extension::delete_instance($id);
Línea 345... Línea 355...
345
        // Remove all the tags linked to the room/activities in this course.
355
        // Remove all the tags linked to the room/activities in this course.
346
        reset::reset_logs($data->courseid);
356
        reset::reset_logs($data->courseid);
347
        unset($items['logs']);
357
        unset($items['logs']);
348
        $status[] = reset::reset_getstatus('logs');
358
        $status[] = reset::reset_getstatus('logs');
349
    }
359
    }
-
 
360
    // Remove all grades from gradebook.
-
 
361
    if (!empty($data->reset_gradebook_grades)) {
-
 
362
        bigbluebuttonbn_reset_gradebook($data->courseid);
-
 
363
    }
350
    return $status;
364
    return $status;
351
}
365
}
Línea 352... Línea 366...
352
 
366
 
353
/**
367
/**
Línea 528... Línea 542...
528
        $string = get_string('view_conference_action_join', 'bigbluebuttonbn');
542
        $string = get_string('view_conference_action_join', 'bigbluebuttonbn');
529
        $url = new moodle_url('/mod/bigbluebuttonbn/bbb_view.php', [
543
        $url = new moodle_url('/mod/bigbluebuttonbn/bbb_view.php', [
530
                'action' => 'join',
544
                'action' => 'join',
531
                'id' => $cm->id,
545
                'id' => $cm->id,
532
                'bn' => $bigbluebuttonbn->id,
546
                'bn' => $bigbluebuttonbn->id,
533
                'timeline' => 1]
547
                'timeline' => 1,
-
 
548
                ]
534
        );
549
        );
535
    }
550
    }
Línea 536... Línea 551...
536
 
551
 
537
    return $factory->create_instance($string, $url, 1, $actionable);
552
    return $factory->create_instance($string, $url, 1, $actionable);
Línea 755... Línea 770...
755
 * @return bool True if the activity is branded, false otherwise.
770
 * @return bool True if the activity is branded, false otherwise.
756
 */
771
 */
757
function bigbluebuttonbn_is_branded(): bool {
772
function bigbluebuttonbn_is_branded(): bool {
758
    return true;
773
    return true;
759
}
774
}
-
 
775
 
-
 
776
/**
-
 
777
 * Update/create grade item for given BigBlueButtonBN activity
-
 
778
 *
-
 
779
 * @category grade
-
 
780
 * @param stdClass $bigbluebuttonbn instance object
-
 
781
 * @param array|object|string|null $grades Optional array/object of grade(s); 'reset' means reset grades in gradebook
-
 
782
 * @return int 0 if ok, error code otherwise
-
 
783
 */
-
 
784
function bigbluebuttonbn_grade_item_update(stdClass $bigbluebuttonbn, array|object|string|null $grades=null): int {
-
 
785
    global $CFG;
-
 
786
    require_once($CFG->libdir.'/gradelib.php');
-
 
787
    $params = ['itemname' => $bigbluebuttonbn->name];
-
 
788
    if ($bigbluebuttonbn->grade == 0) {
-
 
789
        $params['gradetype'] = GRADE_TYPE_NONE;
-
 
790
    } else if ($bigbluebuttonbn->grade > 0) {
-
 
791
        $params['gradetype'] = GRADE_TYPE_VALUE;
-
 
792
        $params['grademax'] = $bigbluebuttonbn->grade;
-
 
793
        $params['grademin'] = 0;
-
 
794
    } else if ($bigbluebuttonbn->grade < 0) {
-
 
795
        $params['gradetype'] = GRADE_TYPE_SCALE;
-
 
796
        $params['scaleid'] = -$bigbluebuttonbn->grade;
-
 
797
    }
-
 
798
    if ($grades === 'reset') {
-
 
799
        $params['reset'] = true;
-
 
800
        $grades = null;
-
 
801
    }
-
 
802
    return grade_update(
-
 
803
        source: 'mod/bigbluebuttonbn',
-
 
804
        courseid: $bigbluebuttonbn->course,
-
 
805
        itemtype: 'mod',
-
 
806
        itemmodule: 'bigbluebuttonbn',
-
 
807
        iteminstance: $bigbluebuttonbn->id,
-
 
808
        itemnumber: 0,
-
 
809
        grades: $grades,
-
 
810
        itemdetails: $params
-
 
811
    );
-
 
812
}
-
 
813
 
-
 
814
/**
-
 
815
 * Update activity grades.
-
 
816
 *
-
 
817
 * @param stdClass $bigbluebuttonbn instance object
-
 
818
 */
-
 
819
function bigbluebuttonbn_update_grades(stdClass $bigbluebuttonbn): void {
-
 
820
    // BigBlueButtonBN does not have a grades table, so we will only update grade item.
-
 
821
    bigbluebuttonbn_grade_item_update($bigbluebuttonbn);
-
 
822
}
-
 
823
 
-
 
824
/**
-
 
825
 * Removes all grades from gradebook
-
 
826
 *
-
 
827
 * @param int $courseid
-
 
828
 */
-
 
829
function bigbluebuttonbn_reset_gradebook(int $courseid): void {
-
 
830
    global $DB;
-
 
831
    $sql = "SELECT b.*, cm.idnumber as cmidnumber, b.course as courseid
-
 
832
              FROM {bigbluebuttonbn} b, {course_modules} cm, {modules} m
-
 
833
             WHERE m.name='bigbluebuttonbn' AND m.id=cm.module AND cm.instance=b.id AND b.course=?";
-
 
834
 
-
 
835
    if ($bigbluebuttonbns = $DB->get_records_sql($sql, [$courseid])) {
-
 
836
        foreach ($bigbluebuttonbns as $bigbluebuttonbn) {
-
 
837
            bigbluebuttonbn_grade_item_update($bigbluebuttonbn, 'reset');
-
 
838
        }
-
 
839
    }
-
 
840
}
-
 
841
 
-
 
842
/**
-
 
843
 * Delete grade item for given activity
-
 
844
 *
-
 
845
 * @param stdClass $bigbluebuttonbn instance object
-
 
846
 * @return int Returns GRADE_UPDATE_OK, GRADE_UPDATE_FAILED, GRADE_UPDATE_MULTIPLE or GRADE_UPDATE_ITEM_LOCKED
-
 
847
 */
-
 
848
function bigbluebuttonbn_grade_item_delete(stdClass $bigbluebuttonbn): int {
-
 
849
    global $CFG;
-
 
850
    require_once($CFG->libdir.'/gradelib.php');
-
 
851
    return grade_update(
-
 
852
        source: 'mod/bigbluebuttonbn',
-
 
853
        courseid: $bigbluebuttonbn->course,
-
 
854
        itemtype: 'mod',
-
 
855
        itemmodule: 'bigbluebuttonbn',
-
 
856
        iteminstance: $bigbluebuttonbn->id,
-
 
857
        itemnumber: 0,
-
 
858
        grades: null,
-
 
859
        itemdetails: ['deleted' => 1]
-
 
860
    );
-
 
861
}