Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 107... Línea 107...
107
 
107
 
108
    }
108
    }
Línea 109... Línea 109...
109
}
109
}
110
 
-
 
111
/**
-
 
112
 * remove all associations for the blog entries of a particular user
-
 
113
 * @param int userid - id of user whose blog associations will be deleted
-
 
114
 */
-
 
115
function blog_remove_associations_for_user($userid) {
-
 
116
    global $DB;
-
 
117
    throw new coding_exception('function blog_remove_associations_for_user() is not finished');
-
 
118
    /*
-
 
119
    $blogentries = blog_fetch_entries(array('user' => $userid), 'lasmodified DESC');
-
 
120
    foreach ($blogentries as $entry) {
-
 
121
        if (blog_user_can_edit_entry($entry)) {
-
 
122
            blog_remove_associations_for_entry($entry->id);
-
 
123
        }
-
 
124
    }
-
 
125
     */
-
 
126
}
-
 
127
 
110
 
128
/**
111
/**
129
 * remove all associations for the blog entries of a particular course
112
 * remove all associations for the blog entries of a particular course
130
 * @param int courseid - id of user whose blog associations will be deleted
113
 * @param int courseid - id of user whose blog associations will be deleted
131
 */
114
 */
Línea 336... Línea 319...
336
 *
319
 *
337
 * @param moodle_page $page The page to load for (normally $PAGE)
320
 * @param moodle_page $page The page to load for (normally $PAGE)
338
 * @param stdClass $userid Load for a specific user
321
 * @param stdClass $userid Load for a specific user
339
 * @return array An array of options organised by type.
322
 * @return array An array of options organised by type.
340
 */
323
 */
341
function blog_get_all_options(moodle_page $page, stdClass $userid = null) {
324
function blog_get_all_options(moodle_page $page, ?stdClass $userid = null) {
342
    global $CFG, $DB, $USER;
325
    global $CFG, $DB, $USER;
Línea 343... Línea 326...
343
 
326
 
Línea 344... Línea 327...
344
    $options = array();
327
    $options = array();
Línea 398... Línea 381...
398
 *
381
 *
399
 * @staticvar array $useroptions Cache so we don't have to regenerate multiple times
382
 * @staticvar array $useroptions Cache so we don't have to regenerate multiple times
400
 * @param stdClass $user
383
 * @param stdClass $user
401
 * @return array The array of options for the requested user
384
 * @return array The array of options for the requested user
402
 */
385
 */
403
function blog_get_options_for_user(stdClass $user=null) {
386
function blog_get_options_for_user(?stdClass $user=null) {
404
    global $CFG, $USER;
387
    global $CFG, $USER;
405
    // Cache.
388
    // Cache.
406
    static $useroptions = array();
389
    static $useroptions = array();
Línea 407... Línea 390...
407
 
390
 
Línea 469... Línea 452...
469
 * @staticvar array $courseoptions A cache so we can save regenerating multiple times
452
 * @staticvar array $courseoptions A cache so we can save regenerating multiple times
470
 * @param stdClass $course The course to load options for
453
 * @param stdClass $course The course to load options for
471
 * @param stdClass $user The user to load options for null == current user
454
 * @param stdClass $user The user to load options for null == current user
472
 * @return array The array of options
455
 * @return array The array of options
473
 */
456
 */
474
function blog_get_options_for_course(stdClass $course, stdClass $user=null) {
457
function blog_get_options_for_course(stdClass $course, ?stdClass $user=null) {
475
    global $CFG, $USER;
458
    global $CFG, $USER;
476
    // Cache.
459
    // Cache.
477
    static $courseoptions = array();
460
    static $courseoptions = array();
Línea 478... Línea 461...
478
 
461