Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 118
Línea 37... Línea 37...
37
 *              commentarea => string comment area
37
 *              commentarea => string comment area
38
 *              itemid      => int itemid
38
 *              itemid      => int itemid
39
 * }
39
 * }
40
 * @return boolean
40
 * @return boolean
41
 */
41
 */
42
function block_comments_comment_validate($comment_param) {
42
function block_comments_comment_validate($comment_param)
-
 
43
{
43
    if ($comment_param->commentarea != 'page_comments') {
44
    if ($comment_param->commentarea != 'page_comments') {
44
        throw new comment_exception('invalidcommentarea');
45
        throw new comment_exception('invalidcommentarea');
45
    }
46
    }
46
    if ($comment_param->itemid != 0) {
47
    if ($comment_param->itemid != 0) {
47
        throw new comment_exception('invalidcommentitemid');
48
        throw new comment_exception('invalidcommentitemid');
Línea 56... Línea 57...
56
 * @category comment
57
 * @category comment
57
 *
58
 *
58
 * @param stdClass $args
59
 * @param stdClass $args
59
 * @return array
60
 * @return array
60
 */
61
 */
61
function block_comments_comment_permissions($args) {
62
function block_comments_comment_permissions($args)
-
 
63
{
62
    global $DB, $USER;
64
    global $DB, $USER;
63
    // By default, anyone can post and view comments.
65
    // By default, anyone can post and view comments.
64
    $canpost = $canview = true;
66
    $canpost = $canview = true;
65
    // Check if it's the user context and not the owner's profile.
67
    // Check if it's the user context and not the owner's profile.
66
    if ($args->context->contextlevel == CONTEXT_USER && $USER->id != $args->context->instanceid) {
68
    if ($args->context->contextlevel == CONTEXT_USER && $USER->id != $args->context->instanceid) {
Línea 89... Línea 91...
89
 *
91
 *
90
 * @param stdClass $comment
92
 * @param stdClass $comment
91
 * @param stdClass $args
93
 * @param stdClass $args
92
 * @return boolean
94
 * @return boolean
93
 */
95
 */
94
function block_comments_comment_display($comments, $args) {
96
function block_comments_comment_display($comments, $args)
-
 
97
{
95
    if ($args->commentarea != 'page_comments') {
98
    if ($args->commentarea != 'page_comments') {
96
        throw new comment_exception('invalidcommentarea');
99
        throw new comment_exception('invalidcommentarea');
97
    }
100
    }
98
    if ($args->itemid != 0) {
101
    if ($args->itemid != 0) {
99
        throw new comment_exception('invalidcommentitemid');
102
        throw new comment_exception('invalidcommentitemid');