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


PHP api_get_course_setting函数代码示例

本文整理汇总了PHP中api_get_course_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP api_get_course_setting函数的具体用法?PHP api_get_course_setting怎么用?PHP api_get_course_setting使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: deleteWorkItem

/**
 * @param int $item_id
 * @param array course info
 * @return bool
 */
function deleteWorkItem($item_id, $courseInfo)
{
    $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
    $TSTDPUBASG = Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT);

    $currentCourseRepositorySys = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/';

    $is_allowed_to_edit = api_is_allowed_to_edit();
    $file_deleted = false;
    $item_id = intval($item_id);

    $is_author = user_is_author($item_id);
    $work_data = get_work_data_by_id($item_id);
    $locked = api_resource_is_locked_by_gradebook($work_data['parent_id'], LINK_STUDENTPUBLICATION);
    $course_id = $courseInfo['real_id'];

    if (($is_allowed_to_edit && $locked == false) ||
        (
            $locked == false &&
            $is_author &&
            api_get_course_setting('student_delete_own_publication') == 1 &&
            $work_data['qualificator_id'] == 0
        )
    ) {
        // We found the current user is the author
        $sql = "SELECT url, contains_file FROM $work_table
                WHERE c_id = $course_id AND id = $item_id";
        $result = Database::query($sql);
        $row = Database::fetch_array($result);

        if (Database::num_rows($result) > 0) {
            $sql = "UPDATE $work_table SET active = 2
                    WHERE c_id = $course_id AND id = $item_id";
            Database::query($sql);
            $sql = "DELETE FROM $TSTDPUBASG
                    WHERE c_id = $course_id AND publication_id = $item_id";
            Database::query($sql);

            api_item_property_update(
                $courseInfo,
                'work',
                $item_id,
                'DocumentDeleted',
                api_get_user_id()
            );
            $work = $row['url'];

            if ($row['contains_file'] == 1) {
                if (!empty($work)) {
                    if (api_get_setting('permanently_remove_deleted_files') == 'true') {
                        my_delete($currentCourseRepositorySys.'/'.$work);
                        $file_deleted = true;
                    } else {
                        $extension = pathinfo($work, PATHINFO_EXTENSION);
                        $new_dir = $work.'_DELETED_'.$item_id.'.'.$extension;

                        if (file_exists($currentCourseRepositorySys.'/'.$work)) {
                            rename($currentCourseRepositorySys.'/'.$work, $currentCourseRepositorySys.'/'.$new_dir);
                            $file_deleted = true;
                        }
                    }
                }
            } else {
                $file_deleted = true;
            }
        }
    }
    return $file_deleted;
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:74,代码来源:work.lib.php

示例2: api_not_allowed

         require 'lp_add.php';
     }
     break;
 case 'admin_view':
     if (!$is_allowed_to_edit) {
         api_not_allowed(true);
     }
     if ($debug > 0) error_log('New LP - admin_view action triggered', 0);
     if (!$lp_found) { error_log('New LP - No learnpath given for admin_view', 0); require 'lp_list.php'; }
     else {
         $_SESSION['refresh'] = 1;
         require 'lp_admin_view.php';
     }
     break;
 case 'auto_launch':
     if (api_get_course_setting('enable_lp_auto_launch') == 1) { //Redirect to a specific LP
         if (!$is_allowed_to_edit) {
             api_not_allowed(true);
         }
         if ($debug > 0) error_log('New LP - auto_launch action triggered', 0);
         if (!$lp_found) { error_log('New LP - No learnpath given for set_autolunch', 0); require 'lp_list.php'; }
         else {
             $_SESSION['oLP']->set_autolunch($_GET['lp_id'], $_GET['status']);
             require 'lp_list.php';
             exit;
         }
     }
     break;
 case 'build':
     if (!$is_allowed_to_edit) {
         api_not_allowed(true);
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:lp_controller.php

示例3: api_not_allowed

     if (!$is_allowed_to_edit) {
         api_not_allowed(true);
     }
     if ($debug > 0) {
         error_log('New LP - admin_view action triggered', 0);
     }
     if (!$lp_found) {
         error_log('New LP - No learnpath given for admin_view', 0);
         require 'lp_list.php';
     } else {
         $_SESSION['refresh'] = 1;
         require 'lp_admin_view.php';
     }
     break;
 case 'auto_launch':
     if (api_get_course_setting('enable_lp_auto_launch') == 1) {
         //Redirect to a specific LP
         if (!$is_allowed_to_edit) {
             api_not_allowed(true);
         }
         if ($debug > 0) {
             error_log('New LP - auto_launch action triggered', 0);
         }
         if (!$lp_found) {
             error_log('New LP - No learnpath given for set_autolunch', 0);
             require 'lp_list.php';
         } else {
             $_SESSION['oLP']->set_autolunch($_GET['lp_id'], $_GET['status']);
             require 'lp_list.php';
             exit;
         }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:lp_controller.php

示例4: array

    $group_properties = GroupManager::get_group_properties($group_id);
    $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']);
}
if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') {
    //we are not in the learning path
    Display::display_header($nameTools, get_lang('Announcements'));
}
// Tool introduction
if (empty($_GET['origin']) || $_GET['origin'] !== 'learnpath') {
    Display::display_introduction_section(TOOL_ANNOUNCEMENT);
}
// Actions
$show_actions = false;
$actionsLeft = '';
if ((api_is_allowed_to_edit(false, true) || api_get_course_setting('announcement.allow_user_edit_announcement') && !api_is_anonymous()) && (empty($_GET['origin']) || $_GET['origin'] !== 'learnpath')) {
    if (in_array($action, array('add', 'modify', 'view'))) {
        $actionsLeft .= "<a href='" . api_get_self() . "?" . api_get_cidreq() . "&origin=" . $origin . "'>" . Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM) . "</a>";
    } else {
        $actionsLeft .= "<a href='" . api_get_self() . "?" . api_get_cidreq() . "&action=add&origin=" . $origin . "'>" . Display::return_icon('new_announce.png', get_lang('AddAnnouncement'), '', ICON_SIZE_MEDIUM) . "</a>";
    }
    $show_actions = true;
} else {
    if (in_array($action, array('view'))) {
        $actionsLeft .= "<a href='" . api_get_self() . "?" . api_get_cidreq() . "&origin=" . $origin . "'>" . Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM) . "</a>";
        echo '</div>';
    }
}
if (api_is_allowed_to_edit() && $announcement_number > 1) {
    if (api_get_group_id() == 0) {
        if (!isset($_GET['action'])) {
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:announcements.php

示例5: expire

 /**
 * See this file in you BBB to set up default values
 * @param   array $params Array of parameters that will be completed if not containing all expected variables
 
   /var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties
 *
   More record information:
   http://code.google.com/p/bigbluebutton/wiki/RecordPlaybackSpecification
 
   # Default maximum number of users a meeting can have.
    # Doesn't get enforced yet but is the default value when the create
    # API doesn't pass a value.
    defaultMaxUsers=20
 
    # Default duration of the meeting in minutes.
    # Current default is 0 (meeting doesn't end).
    defaultMeetingDuration=0
 
    # Remove the meeting from memory when the end API is called.
    # This allows 3rd-party apps to recycle the meeting right-away
    # instead of waiting for the meeting to expire (see below).
    removeMeetingWhenEnded=false
 
    # The number of minutes before the system removes the meeting from memory.
    defaultMeetingExpireDuration=1
 
    # The number of minutes the system waits when a meeting is created and when
    # a user joins. If after this period, a user hasn't joined, the meeting is
    # removed from memory.
    defaultMeetingCreateJoinDuration=5
 *
 */
 public function createMeeting($params)
 {
     $params['c_id'] = api_get_course_int_id();
     $courseCode = api_get_course_id();
     $params['session_id'] = api_get_session_id();
     $params['attendee_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : api_get_course_id();
     $attendeePassword = $params['attendee_pw'];
     $params['moderator_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $this->getModMeetingPassword();
     $moderatorPassword = $params['moderator_pw'];
     $params['record'] = api_get_course_setting('big_blue_button_record_and_store', $courseCode) == 1 ? true : false;
     $max = api_get_course_setting('big_blue_button_max_students_allowed', $courseCode);
     $max = isset($max) ? $max : -1;
     $params['status'] = 1;
     // Generate a pseudo-global-unique-id to avoid clash of conferences on
     // the same BBB server with several Chamilo portals
     $params['remote_id'] = uniqid(true, true);
     // Each simultaneous conference room needs to have a different
     // voice_bridge composed of a 5 digits number, so generating a random one
     $params['voice_bridge'] = rand(10000, 99999);
     if ($this->debug) {
         error_log("enter create_meeting " . print_r($params, 1));
     }
     $params['created_at'] = api_get_utc_datetime();
     $id = Database::insert($this->table, $params);
     if ($id) {
         if ($this->debug) {
             error_log("create_meeting: {$id} ");
         }
         $meetingName = isset($params['meeting_name']) ? $params['meeting_name'] : api_get_course_id() . '-' . api_get_session_id();
         $welcomeMessage = isset($params['welcome_msg']) ? $params['welcome_msg'] : null;
         $record = isset($params['record']) && $params['record'] ? 'true' : 'false';
         $duration = isset($params['duration']) ? intval($params['duration']) : 0;
         // This setting currently limits the maximum conference duration,
         // to avoid lingering sessions on the video-conference server #6261
         $duration = 300;
         $bbbParams = array('meetingId' => $params['remote_id'], 'meetingName' => $meetingName, 'attendeePw' => $attendeePassword, 'moderatorPw' => $moderatorPassword, 'welcomeMsg' => $welcomeMessage, 'dialNumber' => '', 'voiceBridge' => $params['voice_bridge'], 'webVoice' => '', 'logoutUrl' => $this->logout_url, 'maxParticipants' => $max, 'record' => $record, 'duration' => $duration);
         if ($this->debug) {
             error_log("create_meeting params: " . print_r($bbbParams, 1));
         }
         $status = false;
         $meeting = null;
         while ($status == false) {
             $result = $this->api->createMeetingWithXmlResponseArray($bbbParams);
             if (isset($result) && strval($result['returncode']) == 'SUCCESS') {
                 if ($this->debug) {
                     error_log("create_meeting result: " . print_r($result, 1));
                 }
                 $meeting = $this->joinMeeting($meetingName, true);
                 return $meeting;
             }
         }
         return $this->logout;
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:86,代码来源:bbb.lib.php

示例6: array

if ($is_allowed_to_edit) {
    global $interbreadcrumb;
    $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list&isStudentView=false', 'name' => get_lang('LearningPaths'));
    $interbreadcrumb[] = array('url' => api_get_self() . "?action=add_item&type=step&lp_id={$learnPath->lp_id}&isStudentView=false", 'name' => $learnPath->get_name());
    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Preview'));
    $breadcrumb = Display::returnBreadcrumb($interbreadcrumb, null, null);
}
// Return to course home.
if ($is_allowed_to_edit) {
    $buttonHomeUrl = 'lp_controller.php?' . api_get_cidreq() . '&' . http_build_query(['isStudentView' => 'false', 'action' => 'return_to_course_homepage']);
} else {
    $buttonHomeUrl = 'lp_controller.php?' . api_get_cidreq() . '&' . http_build_query(['action' => 'return_to_course_homepage']);
}
$buttonHomeText = get_lang('CourseHomepageLink');
// Return to lp list
if (api_get_course_setting('lp_return_link') == 1) {
    $buttonHomeUrl .= '&redirectTo=lp_list';
    $buttonHomeText = get_lang('LearningPathList');
}
$lpPreviewImagePath = api_get_path(WEB_IMG_PATH) . 'icons/64/unknown.png';
if ($learnPath->get_preview_image()) {
    $lpPreviewImagePath = $learnPath->get_preview_image_path();
}
if ($learnPath->current == $learnPath->get_last()) {
    $categories = Category::load(null, null, $course_code, null, null, $sessionId);
    if (!empty($categories)) {
        $gradebookEvaluations = $categories[0]->get_evaluations();
        $gradebookLinks = $categories[0]->get_links();
        if (count($gradebookEvaluations) === 0 && count($gradebookLinks) === 1 && $gradebookLinks[0]->get_type() == LINK_LEARNPATH && $gradebookLinks[0]->get_ref_id() == $learnPath->lp_id) {
            $gradebookMinScore = $categories[0]->get_certificate_min_score();
            $userScore = $gradebookLinks[0]->calc_score($user_id, 'best');
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:lp_view.php

示例7: getDocumentDefaultVisibility

 /**
  * @param string $courseCode
  * @return string 'visible' or 'invisible' string
  */
 public static function getDocumentDefaultVisibility($courseCode)
 {
     $settings = api_get_setting('document.tool_visible_by_default_at_creation');
     $defaultVisibility = 'visible';
     if (isset($settings['documents'])) {
         $portalDefaultVisibility = 'invisible';
         if ($settings['documents'] == 'true') {
             $portalDefaultVisibility = 'visible';
         }
         $defaultVisibility = $portalDefaultVisibility;
     }
     if (api_get_setting('document.documents_default_visibility_defined_in_course') == 'true') {
         $courseVisibility = api_get_course_setting('documents_default_visibility', $courseCode);
         if (!empty($courseVisibility) && in_array($courseVisibility, array('visible', 'invisible'))) {
             $defaultVisibility = $courseVisibility;
         }
     }
     return $defaultVisibility;
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:23,代码来源:document.lib.php

示例8: getUserCertificatesInSessions

 /**
  * Get the achieved certificates for a user in course sessions
  * @param int $userId The user id
  * @param type $includeNonPublicCertificates Whether include the non-plublic certificates
  * @return array
  */
 public static function getUserCertificatesInSessions($userId, $includeNonPublicCertificates = true)
 {
     $userId = intval($userId);
     $sessionList = [];
     $sessions = SessionManager::get_sessions_by_user($userId);
     foreach ($sessions as $session) {
         if (empty($session['courses'])) {
             continue;
         }
         $sessionCourses = SessionManager::get_course_list_by_session_id($session['session_id']);
         foreach ($sessionCourses as $course) {
             if (!$includeNonPublicCertificates) {
                 $allowPublicCertificates = api_get_course_setting('allow_public_certificates', $course['code']);
                 if (empty($allowPublicCertificates)) {
                     continue;
                 }
             }
             $courseGradebookCategory = Category::load(null, null, $course['code'], null, null, $session['session_id']);
             if (empty($courseGradebookCategory)) {
                 continue;
             }
             $courseGradebookId = $courseGradebookCategory[0]->get_id();
             $certificateInfo = GradebookUtils::get_certificate_by_user_id($courseGradebookId, $userId);
             if (empty($certificateInfo)) {
                 continue;
             }
             $sessionList[] = ['session' => $session['session_name'], 'course' => $course['title'], 'score' => $certificateInfo['score_certificate'], 'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT), 'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}"];
         }
     }
     return $sessionList;
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:37,代码来源:GradebookUtils.php

示例9: remove_resource_from_course_gradebook

         $link_id = $link_info['id'];
         if ($link_info !== false) {
             remove_resource_from_course_gradebook($link_id);
         }
         Display::display_confirmation_message(get_lang('DirDeleted') . ': ' . $work_to_delete['title']);
     } else {
         Display::display_warning_message(get_lang('ResourceLockedByGradebook'));
     }
 }
 /*	DELETE WORK COMMAND */
 if ($action == 'delete' && $item_id) {
     $file_deleted = false;
     $is_author = user_is_author($item_id);
     $work_data = get_work_data_by_id($item_id);
     $locked = api_resource_is_locked_by_gradebook($work_data['parent_id'], LINK_STUDENTPUBLICATION);
     if ($is_allowed_to_edit && $locked == false || ($locked == false and $is_author && api_get_course_setting('student_delete_own_publication') == 1 && $work_data['qualificator_id'] == 0)) {
         //we found the current user is the author
         $queryString1 = "SELECT url, contains_file FROM " . $work_table . " WHERE c_id = {$course_id} AND id = {$item_id}";
         $result1 = Database::query($queryString1);
         $row = Database::fetch_array($result1);
         if (Database::num_rows($result1) > 0) {
             $queryString2 = "UPDATE " . $work_table . "  SET active = 2 WHERE c_id = {$course_id} AND id = {$item_id}";
             $queryString3 = "DELETE FROM  " . $TSTDPUBASG . " WHERE c_id = {$course_id} AND publication_id = {$item_id}";
             Database::query($queryString2);
             Database::query($queryString3);
             api_item_property_update($_course, 'work', $item_id, 'DocumentDeleted', $user_id);
             $work = $row['url'];
             if ($row['contains_file'] == 1) {
                 if (!empty($work)) {
                     if (api_get_setting('permanently_remove_deleted_files') == 'true') {
                         my_delete($currentCourseRepositorySys . '/' . $work);
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:work.php

示例10: show_navigation_tool_shortcuts

 /**
  * Show a toolbar with shortcuts to the course tool
  */
 public static function show_navigation_tool_shortcuts($orientation = SHORTCUTS_HORIZONTAL)
 {
     $navigation_items = self::get_navigation_items(false);
     $html = '';
     if (!empty($navigation_items)) {
         if ($orientation == SHORTCUTS_HORIZONTAL) {
             $style_id = "toolshortcuts_horizontal";
         } else {
             $style_id = "toolshortcuts_vertical";
         }
         $html .= '<div id="' . $style_id . '">';
         foreach ($navigation_items as $key => $navigation_item) {
             if (strpos($navigation_item['link'], 'chat') !== false && api_get_course_setting('allow_open_chat_window')) {
                 $html .= '<a href="javascript: void(0);" onclick="javascript: window.open(\'' . $navigation_item['link'] . '\',\'window_chat' . $_SESSION['_cid'] . '\',config=\'height=\'+600+\', width=\'+825+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $navigation_item['target'] . '"';
             } else {
                 $html .= '<a href="' . $navigation_item['link'] . '"';
             }
             if (strpos(api_get_self(), $navigation_item['link']) !== false) {
                 $html .= ' id="here"';
             }
             $html .= ' target="_top" title="' . $navigation_item['name'] . '">';
             $html .= '<img src="' . api_get_path(WEB_IMG_PATH) . $navigation_item['image'] . '" alt="' . $navigation_item['name'] . '"/>';
             $html .= '</a> ';
             if ($orientation == SHORTCUTS_VERTICAL) {
                 $html .= '<br />';
             }
         }
         $html .= '</div>';
     }
     return $html;
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:34,代码来源:course_home.lib.php

示例11: sprintf

     $titleclass = 'forum_message_post_title';
     $messageclass = 'forum_message_post_text';
     $leftclass = 'forum_message_left';
 }
 $indent = $post['indent_cnt'] * '20';
 echo "<div style=\"margin-left: " . $indent . "px;\">";
 echo "<table width=\"100%\"  class=\"post\" cellspacing=\"5\" border=\"0\">";
 echo "<tr>";
 echo "<td rowspan=\"3\" class=\"{$leftclass}\">";
 $username = sprintf(get_lang('LoginX'), $post['username']);
 if ($post['user_id'] == '0') {
     $name = $post['poster_name'];
 } else {
     $name = api_get_person_name($post['firstname'], $post['lastname']);
 }
 if (api_get_course_setting('allow_user_image_forum')) {
     echo '<br />' . display_user_image($post['user_id'], $name, $origin) . '<br />';
 }
 echo display_user_link($post['user_id'], $name, $origin, $username) . "<br />";
 echo api_convert_and_format_date($post['post_date']) . '<br /><br />';
 // get attach id
 $attachment_list = get_attachment($post['post_id']);
 $id_attach = !empty($attachment_list) ? $attachment_list['id'] : '';
 // The user who posted it can edit his thread only if the course admin allowed this in the properties of the forum
 // The course admin him/herself can do this off course always
 if (GroupManager::is_tutor_of_group(api_get_user_id(), $group_id) or $current_forum['allow_edit'] == 1 and $row['user_id'] == $_user['user_id'] or api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) {
     if ($locked == false) {
         echo "<a href=\"editpost.php?" . api_get_cidreq() . "&forum=" . $clean_forum_id . "&thread=" . $clean_thread_id . "&post=" . $post['post_id'] . "&amp;id_attach=" . $id_attach . "\">" . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . "</a>";
     }
 }
 if (GroupManager::is_tutor_of_group(api_get_user_id(), $group_id) or api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) {
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:viewthread_nested.inc.php

示例12: empty

 $mylpid = empty($learnpath_id) ? '' : '&learnpath_id=' . $learnpath_id;
 $mylpitemid = empty($learnpath_item_id) ? '' : '&learnpath_item_id=' . $learnpath_item_id;
 $token = Security::get_token();
 $i = 1;
 if ($is_allowedToEdit) {
     $headers = array(array('name' => get_lang('ExerciseName')), array('name' => get_lang('QuantityQuestions'), 'params' => array('width' => '100px')), array('name' => get_lang('Actions'), 'params' => array('width' => '180px')));
 } else {
     $headers = array(array('name' => get_lang('ExerciseName')), array('name' => get_lang('Status')));
 }
 $header_list = '';
 foreach ($headers as $header) {
     $params = isset($header['params']) ? $header['params'] : null;
     $header_list .= Display::tag('th', $header['name'], $params);
 }
 echo Display::tag('tr', $header_list);
 $autolaunch_setting_on = api_get_course_setting('enable_exercise_auto_launch') == 1;
 $count = 0;
 if (!empty($exercise_list)) {
     foreach ($exercise_list as $row) {
         $my_exercise_id = $row['iid'];
         $exercise_obj = new Exercise();
         $exercise_obj->read($my_exercise_id, false);
         $locked = $exercise_obj->is_gradebook_locked;
         //echo '<div  id="tabs-'.$i.'">';
         $i++;
         // Validation when belongs to a session
         $session_img = api_get_session_image($row['session_id'], $_user['status']);
         $time_limits = false;
         if ($row['start_time'] != '0000-00-00 00:00:00' || $row['end_time'] != '0000-00-00 00:00:00') {
             $time_limits = true;
         }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:exercice.php

示例13: get_announcements

 private function get_announcements($username, $course_code, $announcement_id = 0)
 {
     $session_id = api_get_session_id();
     $condition_session = api_get_session_condition($session_id);
     $announcement_id = $announcement_id == 0 ? "" : "AND announcement.id=" . $announcement_id;
     $user_id = UserManager::get_user_id_from_username($username);
     $course_info = CourseManager::get_course_information($course_code);
     $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
     $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
     $maximum = '12';
     $group_memberships = GroupManager::get_group_ids($course_info['real_id'], $user_id);
     if (api_get_group_id() == 0) {
         $cond_user_id = " AND (\n                ip.to_user_id='" . $user_id . "' OR\n                ip.to_group_id IN (0, " . implode(", ", $group_memberships) . ") OR\n                ip.to_group_id IS NULL\n            ) ";
     } else {
         $cond_user_id = " AND (\n                ip.to_user_id='" . $user_id . "' OR\n                ip.to_group_id IN (0, " . api_get_group_id() . ") OR\n                ip.to_group_id IS NULL\n            ) ";
     }
     // the user is member of several groups => display personal
     // announcements AND his group announcements AND the general announcements
     if (is_array($group_memberships) && count($group_memberships) > 0) {
         $sql = "SELECT\n                    announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id\n                FROM {$tbl_announcement} announcement, {$tbl_item_property} ip\n                WHERE\n                    announcement.id = ip.ref AND\n                    ip.tool='announcement' AND\n                    ip.visibility='1'\n                    {$announcement_id}\n                    {$cond_user_id}\n                    {$condition_session}\n                GROUP BY ip.ref\n                ORDER BY display_order DESC\n                LIMIT 0,{$maximum}";
     } else {
         // the user is not member of any group
         // this is an identified user => show the general announcements AND his personal announcements
         if ($user_id) {
             if (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous()) {
                 $cond_user_id = " AND (\n                        ip.lastedit_user_id = '" . api_get_user_id() . "' OR\n                        ( ip.to_user_id='" . $user_id . "' OR ip.to_group_id='0' OR ip.to_group_id IS NULL)\n                    ) ";
             } else {
                 $cond_user_id = " AND ( ip.to_user_id='" . $user_id . "' OR ip.to_group_id='0' OR ip.to_group_id IS NULL) ";
             }
             $sql = "SELECT\n                        announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id\n                        FROM {$tbl_announcement} announcement, {$tbl_item_property} ip\n                        WHERE\n                            announcement.id = ip.ref AND\n                            ip.tool='announcement' AND\n                            ip.visibility='1'\n                            {$announcement_id}\n                            {$cond_user_id}\n                            {$condition_session}\n                        GROUP BY ip.ref\n                        ORDER BY display_order DESC\n                        LIMIT 0,{$maximum}";
         } else {
             if (api_get_course_setting('allow_user_edit_announcement')) {
                 $cond_user_id = " AND (\n                        ip.lastedit_user_id = '" . api_get_user_id() . "' OR ip.to_group_id='0' OR ip.to_group_id IS NULL\n                    ) ";
             } else {
                 $cond_user_id = " AND ip.to_group_id='0' ";
             }
             // the user is not identiefied => show only the general announcements
             $sql = "SELECT\n                        announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id\n                        FROM {$tbl_announcement} announcement, {$tbl_item_property} ip\n                        WHERE announcement.id = ip.ref\n                        AND ip.tool='announcement'\n                        AND ip.visibility='1'\n                        AND ip.to_group_id='0'\n                        {$announcement_id}\n                        {$condition_session}\n                        GROUP BY ip.ref\n                        ORDER BY display_order DESC\n                        LIMIT 0,{$maximum}";
         }
     }
     $result = Database::query($sql);
     return $result;
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:43,代码来源:cm_webservice_announcements.php

示例14: api_get_course_int_id

                    $show_autolaunch_lp_warning = true;
                } else {
                    $session_key = 'lp_autolaunch_' . $session_id . '_' . api_get_course_int_id() . '_' . api_get_user_id();
                    if (!isset($_SESSION[$session_key])) {
                        //redirecting to the LP
                        $url = api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php?' . api_get_cidreq() . '&action=view&lp_id=' . $lp_data['id'];
                        $_SESSION[$session_key] = true;
                        header("Location: {$url}");
                        exit;
                    }
                }
            }
        }
    }
}
$forumAutoLaunch = api_get_course_setting('enable_forum_auto_launch');
if ($forumAutoLaunch == 1) {
    if (api_is_platform_admin() || api_is_allowed_to_edit()) {
        Display::addFlash(Display::return_message(get_lang('TheForumAutoLaunchSettingIsOnStudentsWillBeRedirectToTheForumTool'), 'warning'));
    } else {
        //$forumKey = 'forum_auto_launch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id();
        //if (!isset($_SESSION[$forumKey])) {
        //redirecting to the LP
        $url = api_get_path(WEB_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&id_session=' . $session_id;
        //  $_SESSION[$forumKey] = true;
        header("Location: {$url}");
        exit;
        //}
    }
}
$tool_table = Database::get_course_table(TABLE_TOOL_LIST);
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:course_home.php

示例15: subscribe_user

 /**
  * Subscribe the user to a given course
  * @param string Course code
  * @return string  Message about results
  */
 public function subscribe_user($course_code)
 {
     $user_id = api_get_user_id();
     $all_course_information = CourseManager::get_course_information($course_code);
     if ($all_course_information['registration_code'] == '' || $_POST['course_registration_code'] == $all_course_information['registration_code']) {
         if (api_is_platform_admin()) {
             $status_user_in_new_course = COURSEMANAGER;
         } else {
             $status_user_in_new_course = null;
         }
         if (CourseManager::add_user_to_course($user_id, $course_code, $status_user_in_new_course)) {
             $send = api_get_course_setting('email_alert_to_teacher_on_new_user_in_course', $course_code);
             if ($send == 1) {
                 CourseManager::email_to_tutor($user_id, $course_code, $send_to_tutor_also = false);
             } else {
                 if ($send == 2) {
                     CourseManager::email_to_tutor($user_id, $course_code, $send_to_tutor_also = true);
                 }
             }
             $url = Display::url($all_course_information['title'], api_get_course_url($course_code));
             $message = sprintf(get_lang('EnrollToCourseXSuccessful'), $url);
         } else {
             $message = get_lang('ErrorContactPlatformAdmin');
         }
         return array('message' => $message);
     } else {
         if (isset($_POST['course_registration_code']) && $_POST['course_registration_code'] != $all_course_information['registration_code']) {
             return false;
         }
         $message = get_lang('CourseRequiresPassword') . '<br />';
         $message .= $all_course_information['title'] . ' (' . $all_course_information['visual_code'] . ') ';
         $action = api_get_path(WEB_CODE_PATH) . "auth/courses.php?action=subscribe_user_with_password&sec_token=" . $_SESSION['sec_token'];
         $form = new FormValidator('subscribe_user_with_password', 'post', $action);
         $form->addElement('hidden', 'sec_token', $_SESSION['sec_token']);
         $form->addElement('hidden', 'subscribe_user_with_password', $all_course_information['code']);
         $form->addElement('text', 'course_registration_code');
         $form->addButton(get_lang('SubmitRegistrationCode'));
         $content = $form->returnForm();
         return array('message' => $message, 'content' => $content);
     }
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:46,代码来源:auth.lib.php


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