当前位置: 首页>>代码示例>>PHP>>正文


PHP GroupManager::is_subscribed方法代码示例

本文整理汇总了PHP中GroupManager::is_subscribed方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupManager::is_subscribed方法的具体用法?PHP GroupManager::is_subscribed怎么用?PHP GroupManager::is_subscribed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GroupManager的用法示例。


在下文中一共展示了GroupManager::is_subscribed方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: api_get_user_platform_status

/**
 * @param int $user_id
 *
 * @return array
 */
function api_get_user_platform_status($user_id = null)
{
    $status = array();
    $user_id = intval($user_id);
    if (empty($user_id)) {
        $user_id = api_get_user_id();
    }
    if (empty($user_id)) {
        return false;
    }
    $group_id = api_get_group_id();
    $course_id = api_get_course_int_id();
    $course_code = api_get_course_id();
    $session_id = api_get_session_id();
    //Group (in course)
    if ($group_id && $course_id) {
        $group_status = array();
        $is_subscribed = GroupManager::is_subscribed($user_id, $group_id);
        if ($is_subscribed) {
            $group_status = array('id' => $group_id, 'status' => 'student');
            $is_tutor = GroupManager::is_tutor_of_group($user_id, $group_id);
            if ($is_tutor) {
                $group_status['status'] = 'tutor';
            } else {
                $group_status['status'] = 'student';
            }
        }
        $status['group'] = $group_status;
    }
    //Session
    if ($session_id && $course_id) {
        $session_status = array('id' => $session_id, 'course_id' => $course_id);
        $session_user_status = SessionManager::get_user_status_in_course_session($user_id, $course_id, $session_id);
        switch ($session_user_status) {
            case 0:
                $session_status['status'] = 'student';
                break;
            case 2:
                $session_status['status'] = 'coach';
                break;
        }
        $is_general_coach = SessionManager::user_is_general_coach($user_id, $session_id);
        if ($is_general_coach) {
            $session_status['status'] = 'general_coach';
        }
        $status['session'] = $session_status;
    } elseif ($course_id) {
        //Course
        $course_status = array();
        if ($course_id) {
            $user_course_status = CourseManager::get_user_in_course_status($user_id, $course_code);
            if ($user_course_status) {
                $course_status = array('id' => $course_id);
                switch ($user_course_status) {
                    case 1:
                        $course_status['status'] = 'teacher';
                        break;
                    case 5:
                        $course_status['status'] = 'student';
                        //check if tutor
                        $tutor_course_status = CourseManager::get_tutor_in_course_status($user_id, $course_code);
                        if ($tutor_course_status) {
                            $course_status['status'] = 'tutor';
                        }
                        break;
                }
            }
        }
        $status['course'] = $course_status;
    }
    return $status;
}
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:77,代码来源:api.lib.php

示例2: array

        // Documents are private
        if ($is_allowed_to_edit || GroupManager::is_user_in_group($userId, $groupId)) {
            // Only courseadmin or group members (members + tutors) allowed
            $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group.php?' . api_get_cidreq(), 'name' => get_lang('Groups'));
            $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group_space.php?' . api_get_cidreq(), 'name' => get_lang('GroupSpace') . ' ' . $group_properties['name']);
            //they are allowed to upload
            $group_member_with_upload_rights = true;
        } else {
            $groupId = 0;
        }
    } elseif ($group_properties['doc_state'] == 1) {
        // Documents are public
        $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group.php?' . api_get_cidreq(), 'name' => get_lang('Groups'));
        $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group_space.php?' . api_get_cidreq(), 'name' => get_lang('GroupSpace') . ' ' . $group_properties['name']);
        //allowed to upload?
        if ($is_allowed_to_edit || GroupManager::is_subscribed($userId, $groupId)) {
            // Only courseadmin or group members can upload
            $group_member_with_upload_rights = true;
        }
    }
    Session::write('group_member_with_upload_rights', $group_member_with_upload_rights);
} else {
    Session::write('group_member_with_upload_rights', false);
}
// Actions.
$document_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$currentUrl = api_get_self() . '?' . api_get_cidreq() . '&id=' . $document_id;
if (Portfolio::controller()->accept()) {
    Portfolio::controller()->run();
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:document.php

示例3: auto_add_page_users

 /**
  * Function wizard individual assignment
  * @author Juan Carlos Raña <herodoto@telefonica.net>
  */
 public function auto_add_page_users($values)
 {
     $assignment_type = $values['assignment'];
     $session_id = $this->session_id;
     $groupId = api_get_group_id();
     if ($groupId == 0) {
         //extract course members
         if (!empty($session_id)) {
             $a_users_to_add = CourseManager::get_user_list_from_course_code(api_get_course_id(), $session_id);
         } else {
             $a_users_to_add = CourseManager::get_user_list_from_course_code(api_get_course_id(), 0);
         }
     } else {
         //extract group members
         $subscribed_users = GroupManager::get_subscribed_users($groupId);
         $subscribed_tutors = GroupManager::get_subscribed_tutors($groupId);
         $a_users_to_add_with_duplicates = array_merge($subscribed_users, $subscribed_tutors);
         //remove duplicates
         $a_users_to_add = $a_users_to_add_with_duplicates;
         //array_walk($a_users_to_add, create_function('&$value,$key', '$value = json_encode($value);'));
         $a_users_to_add = array_unique($a_users_to_add);
         //array_walk($a_users_to_add, create_function('&$value,$key', '$value = json_decode($value, true);'));
     }
     $all_students_pages = array();
     // Data about teacher
     $userId = api_get_user_id();
     $userinfo = api_get_user_info($userId);
     $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username'], ENT_QUOTES));
     $name = $userinfo['complete_name'] . " - " . $username;
     $photo = '<img src="' . $userinfo['avatar'] . '" alt="' . $name . '"  width="40" height="50" align="top" title="' . $name . '"  />';
     // teacher assignment title
     $title_orig = $values['title'];
     // teacher assignment reflink
     $link2teacher = $values['title'] = $title_orig . "_uass" . $userId;
     // first: teacher name, photo, and assignment description (original content)
     $content_orig_A = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6">
     <table border="0">
         <tr><td style="font-size:24px">' . get_lang('AssignmentDesc') . '</td></tr>
         <tr><td>' . $photo . '<br />' . Display::tag('span', api_get_person_name($userinfo['firstname'], $userinfo['lastname']), array('title' => $username)) . '</td></tr>
     </table></div>';
     $content_orig_B = '<br/><div align="center" style="font-size:24px">' . get_lang('AssignmentDescription') . ': ' . $title_orig . '</div><br/>' . $_POST['content'];
     //Second: student list (names, photo and links to their works).
     //Third: Create Students work pages.
     foreach ($a_users_to_add as $o_user_to_add) {
         if ($o_user_to_add['user_id'] != $userId) {
             // except that puts the task
             $assig_user_id = $o_user_to_add['user_id'];
             // identifies each page as created by the student, not by teacher
             $userPicture = UserManager::getUserPicture($assig_user_id);
             $username = api_htmlentities(sprintf(get_lang('LoginX'), $o_user_to_add['username'], ENT_QUOTES));
             $name = api_get_person_name($o_user_to_add['firstname'], $o_user_to_add['lastname']) . " . " . $username;
             $photo = '<img src="' . $userPicture . '" alt="' . $name . '"  width="40" height="50" align="bottom" title="' . $name . '"  />';
             $is_tutor_of_group = GroupManager::is_tutor_of_group($assig_user_id, $groupId);
             //student is tutor
             $is_tutor_and_member = GroupManager::is_tutor_of_group($assig_user_id, $groupId) && GroupManager::is_subscribed($assig_user_id, $groupId);
             // student is tutor and member
             if ($is_tutor_and_member) {
                 $status_in_group = get_lang('GroupTutorAndMember');
             } else {
                 if ($is_tutor_of_group) {
                     $status_in_group = get_lang('GroupTutor');
                 } else {
                     $status_in_group = " ";
                     //get_lang('GroupStandardMember')
                 }
             }
             if ($assignment_type == 1) {
                 $values['title'] = $title_orig;
                 $values['content'] = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6">
                 <table border="0">
                 <tr><td style="font-size:24px">' . get_lang('AssignmentWork') . '</td></tr>
                 <tr><td>' . $photo . '<br />' . $name . '</td></tr></table>
                 </div>[[' . $link2teacher . ' | ' . get_lang('AssignmentLinktoTeacherPage') . ']] ';
                 //If $content_orig_B is added here, the task written by the professor was copied to the page of each student. TODO: config options
                 // AssignmentLinktoTeacherPage
                 $all_students_pages[] = '<li>' . Display::tag('span', strtoupper($o_user_to_add['lastname']) . ', ' . $o_user_to_add['firstname'], array('title' => $username)) . ' [[' . $_POST['title'] . "_uass" . $assig_user_id . ' | ' . $photo . ']] ' . $status_in_group . '</li>';
                 //don't change this line without guaranteeing that users will be ordered by last names in the following format (surname, name)
                 $values['assignment'] = 2;
             }
             $this->assig_user_id = $assig_user_id;
             self::save_new_wiki($values);
         }
     }
     foreach ($a_users_to_add as $o_user_to_add) {
         if ($o_user_to_add['user_id'] == $userId) {
             $assig_user_id = $o_user_to_add['user_id'];
             if ($assignment_type == 1) {
                 $values['title'] = $title_orig;
                 $values['comment'] = get_lang('AssignmentDesc');
                 sort($all_students_pages);
                 $values['content'] = $content_orig_A . $content_orig_B . '<br/>
                 <div align="center" style="font-size:18px; background-color: #F5F8FB; border:solid; border-color:#E6E6E6">
                 ' . get_lang('AssignmentLinkstoStudentsPage') . '
                 </div><br/>
                 <div style="background-color: #F5F8FB; border:solid; border-color:#E6E6E6">
                 <ol>' . implode($all_students_pages) . '</ol>
//.........这里部分代码省略.........
开发者ID:daffef,项目名称:chamilo-lms,代码行数:101,代码来源:wiki.inc.php

示例4: get_lang

        ?>
&id=<?php 
        echo $document_id;
        ?>
&createdir=1">
        <?php 
        Display::display_icon('new_folder.png', get_lang('CreateDir'), '', ICON_SIZE_MEDIUM);
        ?>
</a>
        <?php 
    }
}
$table_footer = '';
$total_size = 0;
if (isset($docs_and_folders) && is_array($docs_and_folders)) {
    if (api_get_group_id() == 0 || (api_is_allowed_to_edit() || GroupManager::is_subscribed(api_get_user_id(), api_get_group_id()) || GroupManager::is_tutor_of_group(api_get_user_id(), api_get_group_id()) || UserManager::is_admin(api_get_user_id()))) {
        // Create a sortable table with our data
        $sortable_data = array();
        $count = 1;
        foreach ($docs_and_folders as $key => $document_data) {
            $row = array();
            $row['id'] = $document_data['id'];
            $row['type'] = $document_data['filetype'];
            // If the item is invisible, wrap it in a span with class invisible
            $is_visible = DocumentManager::is_visible_by_id($document_data['id'], $course_info, api_get_session_id(), api_get_user_id(), false);
            $invisibility_span_open = $is_visible == 0 ? '<span class="muted">' : '';
            $invisibility_span_close = $is_visible == 0 ? '</span>' : '';
            // Size (or total size of a directory)
            $size = $document_data['filetype'] == 'folder' ? FileManager::get_total_folder_size($document_data['path'], $is_allowed_to_edit) : $document_data['size'];
            // Get the title or the basename depending on what we're using
            if ($document_data['title'] != '') {
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:document.php

示例5: array

        // Documents are private
        if ($is_allowed_to_edit || GroupManager::is_user_in_group($userId, $groupId)) {
            // Only courseadmin or group members (members + tutors) allowed
            $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group.php?' . api_get_cidreq(), 'name' => get_lang('Groups'));
            $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group_space.php?' . api_get_cidreq(), 'name' => get_lang('GroupSpace') . ' ' . $group_properties['name']);
            //they are allowed to upload
            $group_member_with_upload_rights = true;
        } else {
            $groupId = 0;
        }
    } elseif ($group_properties['doc_state'] == 1) {
        // Documents are public
        $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group.php?' . api_get_cidreq(), 'name' => get_lang('Groups'));
        $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group_space.php?' . api_get_cidreq(), 'name' => get_lang('GroupSpace') . ' ' . $group_properties['name']);
        // Allowed to upload?
        if ($is_allowed_to_edit || GroupManager::is_subscribed($userId, $groupId) || GroupManager::is_tutor_of_group($userId, $groupId, $courseId)) {
            // Only course admin or group members can upload
            $group_member_with_upload_rights = true;
        }
    }
    Session::write('group_member_with_upload_rights', $group_member_with_upload_rights);
} else {
    Session::write('group_member_with_upload_rights', false);
}
// Actions.
$document_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$currentUrl = api_get_self() . '?' . api_get_cidreq() . '&id=' . $document_id;
if (Portfolio::controller()->accept()) {
    Portfolio::controller()->run();
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:document.php

示例6: auto_add_page_users

/**
 * Function wizard individual assignment
 * @author Juan Carlos Raña <herodoto@telefonica.net>
 */
function auto_add_page_users($assignment_type)
{
    global $assig_user_id, $session_id;
    //$assig_user_id is need to identify end reflinks
    $_clean['group_id'] = (int) $_SESSION['_gid'];
    if ($_clean['group_id'] == 0) {
        //extract course members
        if (!empty($session_id)) {
            $a_users_to_add = CourseManager::get_user_list_from_course_code($_SESSION['_course']['id'], $session_id);
        } else {
            $a_users_to_add = CourseManager::get_user_list_from_course_code($_SESSION['_course']['id'], 0);
        }
    } else {
        //extract group members
        $subscribed_users = GroupManager::get_subscribed_users($_clean['group_id']);
        $subscribed_tutors = GroupManager::get_subscribed_tutors($_clean['group_id']);
        $a_users_to_add_with_duplicates = array_merge($subscribed_users, $subscribed_tutors);
        //remove duplicates
        $a_users_to_add = $a_users_to_add_with_duplicates;
        //array_walk($a_users_to_add, create_function('&$value,$key', '$value = json_encode($value);'));
        $a_users_to_add = array_unique($a_users_to_add);
        //array_walk($a_users_to_add, create_function('&$value,$key', '$value = json_decode($value, true);'));
    }
    //echo print_r($a_users_to_add);
    $all_students_pages = array();
    //data about teacher
    $userinfo = api_get_user_info(api_get_user_id());
    $name = $userinfo['complete_name_login_as'];
    if (api_get_user_id() != 0) {
        $image_path = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'web', false, true);
        $image_repository = $image_path['dir'];
        $existing_image = $image_path['file'];
        $photo = '<img src="' . $image_repository . $existing_image . '" alt="' . $name . '"  width="40" height="50" align="top" title="' . $name . '"  />';
    } else {
        $photo = '<img src="' . api_get_path(WEB_CODE_PATH) . "img/unknown.jpg" . '" alt="' . $name . '"  width="40" height="50" align="top"  title="' . $name . '"  />';
    }
    //teacher assignment title
    $title_orig = $_POST['title'];
    //teacher assignment reflink
    $link2teacher = $_POST['title'] = $title_orig . "_uass" . api_get_user_id();
    //first: teacher name, photo, and assignment description (original content)
    // $content_orig_A='<div align="center" style="background-color: #F5F8FB;  border:double">'.$photo.'<br />'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'<br />('.get_lang('Teacher').')</div><br/><div>';
    $content_orig_A = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6"><table border="0"><tr><td style="font-size:24px">' . get_lang('AssignmentDesc') . '</td></tr><tr><td>' . $photo . '<br />' . Display::tag('span', $name) . '</td></tr></table></div>';
    $content_orig_B = '<br/><div align="center" style="font-size:24px">' . get_lang('AssignmentDescription') . ': ' . $title_orig . '</div><br/>' . $_POST['content'];
    //Second: student list (names, photo and links to their works).
    //Third: Create Students work pages.
    foreach ($a_users_to_add as $user_id => $o_user_to_add) {
        if ($o_user_to_add['user_id'] != api_get_user_id()) {
            $assig_user_id = $o_user_to_add['user_id'];
            //identifies each page as created by the student, not by teacher
            $image_path = UserManager::get_user_picture_path_by_id($assig_user_id, 'web', false, true);
            $image_repository = $image_path['dir'];
            $existing_image = $image_path['file'];
            $username = api_htmlentities(sprintf(get_lang('LoginX'), $o_user_to_add['username'], ENT_QUOTES));
            $name = api_get_person_name($o_user_to_add['firstname'], $o_user_to_add['lastname']) . " . " . $username;
            $photo = '<img src="' . $image_repository . $existing_image . '" alt="' . $name . '"  width="40" height="50" align="bottom" title="' . $name . '"  />';
            $is_tutor_of_group = GroupManager::is_tutor_of_group($assig_user_id, $_clean['group_id']);
            //student is tutor
            $is_tutor_and_member = GroupManager::is_tutor_of_group($assig_user_id, $_clean['group_id']) && GroupManager::is_subscribed($assig_user_id, $_clean['group_id']);
            //student is tutor and member
            if ($is_tutor_and_member) {
                $status_in_group = get_lang('GroupTutorAndMember');
            } else {
                if ($is_tutor_of_group) {
                    $status_in_group = get_lang('GroupTutor');
                } else {
                    $status_in_group = " ";
                    //get_lang('GroupStandardMember')
                }
            }
            if ($assignment_type == 1) {
                $_POST['title'] = $title_orig;
                $_POST['comment'] = get_lang('AssignmentFirstComToStudent');
                $_POST['content'] = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6"><table border="0"><tr><td style="font-size:24px">' . get_lang('AssignmentWork') . '</td></tr><tr><td>' . $photo . '<br />' . $name . '</td></tr></table></div>[[' . $link2teacher . ' | ' . get_lang('AssignmentLinktoTeacherPage') . ']] ';
                //If $content_orig_B is added here, the task written by the professor was copied to the page of each student. TODO: config options
                //AssignmentLinktoTeacherPage
                $all_students_pages[] = '<li>' . Display::tag('span', strtoupper($o_user_to_add['lastname']) . ', ' . $o_user_to_add['firstname'], array('title' => $username)) . ' [[' . $_POST['title'] . "_uass" . $assig_user_id . ' | ' . $photo . ']] ' . $status_in_group . '</li>';
                //don't change this line without guaranteeing that users will be ordered by last names in the following format (surname, name)
                //$all_students_pages[] = '<li><table border="0"><tr><td width="200">'.api_get_person_name($o_user_to_add['lastname'], $o_user_to_add['firstname']).'</td><td>[['.$_POST['title']."_uass".$assig_user_id.' | '.$photo.']] '.$status_in_group.'</td></tr></table></li>';
                $_POST['assignment'] = 2;
            }
            save_new_wiki();
        }
    }
    //end foreach for each user
    foreach ($a_users_to_add as $user_id => $o_user_to_add) {
        if ($o_user_to_add['user_id'] == api_get_user_id()) {
            $assig_user_id = $o_user_to_add['user_id'];
            if ($assignment_type == 1) {
                $_POST['title'] = $title_orig;
                $_POST['comment'] = get_lang('AssignmentDesc');
                sort($all_students_pages);
                $_POST['content'] = $content_orig_A . $content_orig_B . '<br/><div align="center" style="font-size:18px; background-color: #F5F8FB; border:solid; border-color:#E6E6E6">' . get_lang('AssignmentLinkstoStudentsPage') . '</div><br/><div style="background-color: #F5F8FB; border:solid; border-color:#E6E6E6"><ol>' . implode($all_students_pages) . '</ol></div><br/>';
                $_POST['assignment'] = 1;
            }
            save_new_wiki();
//.........这里部分代码省略.........
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:101,代码来源:wiki.inc.php


注:本文中的GroupManager::is_subscribed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。