Example #1
0
 /**
  * return the tutor and the member of the group
  *
  * @return array of int: user identification
  */
 public function getRecipientList()
 {
     $userList = array();
     // add user to the list
     $userGroupList = get_group_user_list($this->groupId, $this->courseId);
     if (is_array($userGroupList)) {
         foreach ($userGroupList as $user) {
             $userList[] = $user['id'];
         }
     }
     //add tutor to the list if he exist
     $dataGroup = claro_get_group_data(array(CLARO_CONTEXT_COURSE => $this->courseId, CLARO_CONTEXT_GROUP => $this->groupId), 'tutorId');
     if ($dataGroup['tutorId'] != 0) {
         $userList[] = $dataGroup['tutorId'];
     }
     return $userList;
 }
Example #2
0
/**
 * return the autorisation of the current user to send a message to the user in parameter
 *
 * @param int $userId user id of the recipient
 * @return bool true if the current user is autorised do send a message to the user in parameter
 *                 flase if the current user is not autorised do send a message to the user in parameter
 */
function current_user_is_allowed_to_send_message_to_user($userId)
{
    if (claro_is_platform_admin()) {
        return true;
    }
    if (claro_is_in_a_group()) {
        if (claro_is_group_tutor() || claro_is_course_manager()) {
            $userList = get_group_user_list(claro_get_current_group_id(), claro_get_current_course_id());
            for ($count = 0; $count < count($userList); $count++) {
                if ($userList[$count]['id'] == $userId) {
                    return true;
                }
            }
        }
        return false;
    } elseif (claro_is_in_a_course()) {
        if (claro_is_course_manager()) {
            $userList = claro_get_course_user_list();
            for ($count = 0; $count < count($userList); $count++) {
                if ($userList[$count]['user_id'] == $userId) {
                    return true;
                }
            }
        }
        return false;
    } else {
        // can answerd to a user
        $tableName = get_module_main_tbl(array('im_message', 'im_recipient'));
        $select = "SELECT count(*)\n" . " FROM `" . $tableName['im_message'] . "` as M\n" . " INNER JOIN `" . $tableName['im_recipient'] . "` as R ON R.message_id = M.message_id\n" . " WHERE (R.user_id = " . (int) claro_get_current_user_id() . " OR R.user_id = 0)\n" . " AND M.sender = " . (int) $userId;
        $nbMessage = claro_sql_query_fetch_single_value($select);
        if ($nbMessage > 0) {
            return true;
        } elseif (get_conf('userCanSendMessage')) {
        }
        return true;
        return false;
    }
}
Example #3
0
                    claro_redirect(dirname($_SERVER['PHP_SELF']) . '/group.php?gidReset=1&tutorUnregDone=1');
                    exit;
                }
            }
        } else {
            $dialogBox->form(get_lang('Confirm your unsubscription as tutor from the group &quot;<b>%group_name</b>&quot;', array('%group_name' => claro_get_current_group_data('name'))) . "\n" . '<form action="' . claro_htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">' . "\n" . claro_form_relay_context() . '<input type="hidden" name="tutorUnregistration" value="1" />' . "\n" . '<input type="hidden" name="doUnreg" value="1" />' . "\n" . '<br />' . "\n" . '<input type="submit" value="' . get_lang("Ok") . '" />' . "\n" . claro_html_button(claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'])), get_lang("Cancel")) . "\n" . '</form>' . "\n");
        }
    }
}
/********************************
 * GROUP INFORMATIONS RETRIVIAL
 ********************************/
/*----------------------------------------------------------------------------
GET GROUP MEMBER LIST
----------------------------------------------------------------------------*/
$groupMemberList = get_group_user_list(claro_get_current_group_id(), claro_get_current_course_id());
/*----------------------------------------------------------------------------
GET TUTOR(S) DATA
----------------------------------------------------------------------------*/
$sql = "SELECT user_id AS id, nom AS lastName, prenom AS firstName, email\n        FROM `" . $tbl_user . "` user\n        WHERE user.user_id='" . claro_get_current_group_data('tutorId') . "'";
$tutorDataList = claro_sql_query_fetch_all($sql);
/*----------------------------------------------------------------------------
GET FORUM POINTER
----------------------------------------------------------------------------*/
$forumId = claro_get_current_group_data('forumId');
$toolList = get_group_tool_list();
if (claro_is_in_a_course()) {
    $date = $claro_notifier->get_notification_date(claro_get_current_user_id());
    $modified_tools = $claro_notifier->get_notified_tools(claro_get_current_course_id(), $date, claro_get_current_user_id(), claro_get_current_group_id());
} else {
    $modified_tools = array();