Exemplo n.º 1
0
<table class="claroTable emphaseLine" width="100%">
    <tbody>
        <tr class="superHeader">
            <th colspan="<?php 
echo $this->is_allowedToEdit ? 9 : 6;
?>
">
            <?php 
// Allow course managers to receive notification for all new contributions in this forum or disable it
if (claro_is_user_authenticated() && claro_is_course_member()) {
    //anonymous user do not have this function
    ?>
            <span style="float: right;" class="claroCmd">
            <?php 
    if (is_forum_notification_requested($this->forumId, claro_get_current_user_id())) {
        // display link NOT to be notified
        ?>
                <img src="<?php 
        echo get_icon_url('mail_close');
        ?>
" alt="" style="vertical-align: text-bottom" />
                <?php 
        echo get_lang('Notify by email when topics are created');
        ?>
                [<a href="<?php 
        echo claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?forum=' . $this->forumId . '&amp;cmd=exdoNotNotify'));
        ?>
"><?php 
        echo get_lang('Disable');
        ?>
Exemplo n.º 2
0
/**
 *
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @param int $userId
 * @param int $forumId
 * @return void
 */
function request_forum_notification($forumId, $userId)
{
    $tbl_cdb_names = claro_sql_get_course_tbl();
    $tbl_user_notify = $tbl_cdb_names['bb_rel_forum_userstonotify'];
    // check first if user is not regisitered for forum notification yet
    if (!is_forum_notification_requested($forumId, $userId)) {
        $sql = "INSERT INTO `" . $tbl_user_notify . "`\n                SET `user_id`  = '" . (int) $userId . "',\n                    `forum_id` = '" . (int) $forumId . "'";
        claro_sql_query($sql);
    }
}