Example #1
0
<!-- // $Id: forum_viewtopic.tpl.php 14314 2012-11-07 09:09:19Z zefredz $ -->

<h4 class="header">
<?php 
// Allow user to be have notification for this topic or disable it
if (claro_is_user_authenticated()) {
    //anonymous user do not have this function
    ?>
<span style="float: right;" class="claroCmd">
  <?php 
    if (is_topic_notification_requested($this->topic_id, 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 replies are posted');
        ?>
  [<a href="<?php 
        echo claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?forum=' . $this->forum_id . '&amp;topic=' . $this->topic_id . '&amp;cmd=exdoNotNotify'));
        ?>
"><?php 
        echo get_lang('Disable');
        ?>
</a>]
  <?php 
    } else {
        //display link to be notified for this topic
        ?>
Example #2
0
/**
 *
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @param int $userId
 * @param int $topicId
 * @return void
 */
function request_topic_notification($topicId, $userId)
{
    $tbl_cdb_names = claro_sql_get_course_tbl();
    $tbl_user_notify = $tbl_cdb_names['bb_rel_topic_userstonotify'];
    // check first if user is not regisitered for topic notification yet
    if (!is_topic_notification_requested($topicId, $userId)) {
        $sql = "INSERT INTO `" . $tbl_user_notify . "`\n                SET `user_id`  = '" . (int) $userId . "',\n                    `topic_id` = '" . (int) $topicId . "'";
        claro_sql_query($sql);
    }
}