Proyectos de Subversion Moodle

Rev

Rev 118 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

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