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


PHP UrlManager类代码示例

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


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

示例1: loadBody

 function loadBody()
 {
     switch ($GLOBALS['op']) {
         case 'showresults':
             $id_course = Get::req('id_course', DOTY_INT, false);
             $_SESSION['idCourse'] = $id_course;
             Util::jump_to('index.php?modname=organization&op=showresults&idcourse=' . $id_course);
             break;
         case "mycourses":
         case "unregistercourse":
             require_once $GLOBALS['where_lms'] . '/modules/' . $this->module_name . '/course.php';
             require_once _base_ . '/lib/lib.urlmanager.php';
             $url =& UrlManager::getInstance('course');
             $url->setStdQuery('r=' . _after_login_);
             mycourses($url);
             break;
         case "donwloadmaterials":
             downloadMaterials();
             break;
         default:
             require_once $GLOBALS['where_lms'] . '/modules/' . $this->module_name . '/infocourse.php';
             infocourseDispatch($GLOBALS['op']);
             break;
     }
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:25,代码来源:class.course.php

示例2: mycompetencesDispatch

function mycompetencesDispatch($op)
{
    require_once _base_ . '/lib/lib.urlmanager.php';
    $url =& UrlManager::getInstance('competences');
    $url->setStdQuery('modname=mycompetences&op=mycompetences');
    switch ($op) {
        case "mycompetences":
        default:
            mycompetences($url);
    }
}
开发者ID:abhinay100,项目名称:forma_app,代码行数:11,代码来源:mycompetences.php

示例3: reservation

 function reservation()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.tab.php';
     require_once _base_ . '/lib/lib.urlmanager.php';
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     $mod_perm = checkPerm('mod', true);
     $lang =& DoceboLanguage::createInstance('reservation');
     $um =& UrlManager::getInstance("reservation");
     $out = $GLOBALS['page'];
     $out->setWorkingZone('content');
     $man_res = new Man_Reservation();
     $tab_man = new TabView('reservation', '');
     $tab_events = new TabElemDefault('events', $lang->def('_RESERVATION_EVENTS'));
     $tab_my_events = new TabElemDefault('my_events', $lang->def('_RESERVATION_MY_EVENTS'));
     $tab_past_event = new TabElemDefault('past_events', $lang->def('_RESERVATION_PAST_EVENTS'));
     if ($mod_perm) {
         $tab_subscribed_user = new TabElemDefault('subscribed_user', $lang->def('_RESERVATION_SUBSCRIBED_USER'));
     }
     $tab_man->addTab($tab_events);
     $tab_man->addTab($tab_my_events);
     $tab_man->addTab($tab_past_event);
     if ($mod_perm) {
         $tab_man->addTab($tab_subscribed_user);
     }
     $tab_man->parseInput($_POST, $_SESSION);
     $active_tab = $tab_man->getActiveTab();
     if ($active_tab != 'events' && $active_tab != 'my_events' && $active_tab != 'past_events' && $active_tab != 'subscribed_user') {
         $active_tab = importVar('active_tab', false, 'events');
         $tab_man->setActiveTab($active_tab);
     }
     $out->add(getTitleArea(Lang::t('_RESERVATION', 'reservation')) . '<div class="std_block">', 'content');
     $out->add(Form::openForm('tab_reservation', 'index.php?modname=reservation&amp;op=reservation&amp;confirm=1&amp;ap=mod_profile&amp;from=2') . $tab_man->printTabView_Begin('', false), 'content');
     switch ($active_tab) {
         case 'events':
             events();
             break;
         case 'my_events':
             myEvents();
             break;
         case 'past_events':
             pastEvents();
             break;
         case 'subscribed_user':
             subscribedUser();
             break;
     }
     $out->add($tab_man->printTabView_End() . Form::closeForm(), 'content');
     $out->add('</div>', 'content');
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:51,代码来源:reservation.php

示例4: getURLImages

 /**
  * Does not look like this function is being used is being used 
  * 
  * @param type $url_id
  * @return string 
  */
 public static function getURLImages($url_id = null)
 {
     if (is_null($url_id)) {
         $url = 'http://' . $_SERVER['HTTP_HOST'] . '/';
         $url_id = UrlManager::get_url_id($url);
     }
     $url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/';
     $images = array();
     for ($img_id = 1; $img_id <= 3; $img_id++) {
         if (file_exists($url_images_dir . $url_id . '_url_image_' . $img_id . '.png')) {
             $images[] = api_get_path(WEB_PATH) . 'custompages/url-images/' . $url_id . '_url_image_' . $img_id . '.png';
         }
     }
     return $images;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:21,代码来源:custom_pages.class.php

示例5: get_lang

$form->addElement('textarea', 'description', get_lang('Description'));
//the first url with id = 1 will be always active
if (isset($_GET['url_id']) && $_GET['url_id'] != 1) {
    $form->addElement('checkbox', 'active', null, get_lang('Active'));
}
$defaults['url'] = 'http://';
$form->setDefaults($defaults);
$submit_name = get_lang('AddUrl');
if (isset($_GET['url_id'])) {
    $url_id = intval($_GET['url_id']);
    $num_url_id = UrlManager::url_id_exist($url_id);
    if ($num_url_id != 1) {
        header('Location: access_urls.php');
        exit;
    }
    $url_data = UrlManager::get_url_data_from_id($url_id);
    $form->addElement('hidden', 'id', $url_data['id']);
    $form->setDefaults($url_data);
    $submit_name = get_lang('AddUrl');
}
if (!api_is_multiple_url_enabled()) {
    header('Location: index.php');
    exit;
}
$tool_name = get_lang('AddUrl');
$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array("url" => 'access_urls.php', "name" => get_lang('MultipleAccessURLs'));
Display::display_header($tool_name);
if (isset($_GET['action'])) {
    switch ($_GET['action']) {
        case 'show_message':
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:access_url_edit.php

示例6: register_course


//.........这里部分代码省略.........
     }
     if (empty($visual_code)) {
         $error_msg[] = 'courseScreenCode is missing';
         $ok_to_register_course = false;
     }
     if (empty($directory)) {
         $error_msg[] = 'courseRepository is missing';
         $ok_to_register_course = false;
     }
     if (empty($title)) {
         $error_msg[] = 'title is missing';
         $ok_to_register_course = false;
     }
     if (empty($expiration_date)) {
         $expiration_date = api_get_utc_datetime(time() + $firstExpirationDelay);
     } else {
         $expiration_date = api_get_utc_datetime($expiration_date);
     }
     if ($visibility < 0 || $visibility > 4) {
         $error_msg[] = 'visibility is invalid';
         $ok_to_register_course = false;
     }
     if (empty($disk_quota)) {
         $disk_quota = api_get_setting('document.default_document_quotum');
     }
     $time = api_get_utc_datetime();
     if (stripos($department_url, 'http://') === false && stripos($department_url, 'https://') === false) {
         $department_url = 'http://' . $department_url;
     }
     //just in case
     if ($department_url == 'http://') {
         $department_url = '';
     }
     $course_id = 0;
     if ($ok_to_register_course) {
         // Here we must add 2 fields.
         $sql = "INSERT INTO " . $TABLECOURSE . " SET\n                        code = '" . Database::escape_string($code) . "',\n                        directory = '" . Database::escape_string($directory) . "',\n                        course_language = '" . Database::escape_string($course_language) . "',\n                        title = '" . Database::escape_string($title) . "',\n                        description = '" . self::lang2db(get_lang('CourseDescription')) . "',\n                        category_code = '" . Database::escape_string($category_code) . "',\n                        visibility      = '" . $visibility . "',\n                        show_score      = '1',\n                        disk_quota      = '" . intval($disk_quota) . "',\n                        creation_date   = '{$time}',\n                        expiration_date = '" . $expiration_date . "',\n                        last_edit       = '{$time}',\n                        last_visit      = NULL,\n                        tutor_name = '" . Database::escape_string($tutor_name) . "',\n                        department_name = '" . Database::escape_string($department_name) . "',\n                        department_url = '" . Database::escape_string($department_url) . "',\n                        subscribe = '" . intval($subscribe) . "',\n                        unsubscribe = '" . intval($unsubscribe) . "',\n                        visual_code = '" . Database::escape_string($visual_code) . "'";
         Database::query($sql);
         $course_id = Database::insert_id();
         if ($course_id) {
             $sort = api_max_sort_value('0', api_get_user_id());
             // Default true
             $addTeacher = isset($params['add_user_as_teacher']) ? $params['add_user_as_teacher'] : true;
             if ($addTeacher) {
                 $i_course_sort = CourseManager::userCourseSort($user_id, $code);
                 if (!empty($user_id)) {
                     $sql = "INSERT INTO " . $TABLECOURSUSER . " SET\n                                c_id     = '" . $course_id . "',\n                                user_id         = '" . intval($user_id) . "',\n                                status          = '1',\n                                is_tutor        = '0',\n                                sort            = '" . $i_course_sort . "',\n                                user_course_cat = '0'";
                     Database::query($sql);
                 }
             }
             if (!empty($teachers)) {
                 if (!is_array($teachers)) {
                     $teachers = array($teachers);
                 }
                 foreach ($teachers as $key) {
                     //just in case
                     if ($key == $user_id) {
                         continue;
                     }
                     if (empty($key)) {
                         continue;
                     }
                     $sql = "INSERT INTO " . $TABLECOURSUSER . " SET\n                            c_id     = '" . Database::escape_string($course_id) . "',\n                            user_id         = '" . Database::escape_string($key) . "',\n                            status          = '1',\n                            is_tutor        = '0',\n                            sort            = '" . ($sort + 1) . "',\n                            user_course_cat = '0'";
                     Database::query($sql);
                 }
             }
             // Adding the course to an URL.
             if (api_is_multiple_url_enabled()) {
                 $url_id = 1;
                 if (api_get_current_access_url_id() != -1) {
                     $url_id = api_get_current_access_url_id();
                 }
                 UrlManager::add_course_to_url($course_id, $url_id);
             } else {
                 UrlManager::add_course_to_url($course_id, 1);
             }
             // Add event to the system log.
             $user_id = api_get_user_id();
             Event::addEvent(LOG_COURSE_CREATE, LOG_COURSE_CODE, $code, api_get_utc_datetime(), $user_id, $course_id);
             $send_mail_to_admin = api_get_setting('course.send_email_to_admin_when_create_course');
             // @todo Improve code to send to all current portal administrators.
             if ($send_mail_to_admin == 'true') {
                 $siteName = api_get_setting('platform.site_name');
                 $recipient_email = api_get_setting('admin.administrator_email');
                 $recipient_name = api_get_person_name(api_get_setting('admin.administrator_name'), api_get_setting('admin.administrator_surname'));
                 $iname = api_get_setting('platform.institution');
                 $subject = get_lang('NewCourseCreatedIn') . ' ' . $siteName . ' - ' . $iname;
                 $message = get_lang('Dear') . ' ' . $recipient_name . ",\n\n" . get_lang('MessageOfNewCourseToAdmin') . ' ' . $siteName . ' - ' . $iname . "\n";
                 $message .= get_lang('CourseName') . ' ' . $title . "\n";
                 $message .= get_lang('Category') . ' ' . $category_code . "\n";
                 $message .= get_lang('Tutor') . ' ' . $tutor_name . "\n";
                 $message .= get_lang('Language') . ' ' . $course_language;
                 $userInfo = api_get_user_info($user_id);
                 $additionalParameters = array('smsType' => SmsPlugin::NEW_COURSE_BEEN_CREATED, 'userId' => $user_id, 'courseName' => $title, 'creatorUsername' => $userInfo['username']);
                 api_mail_html($recipient_name, $recipient_email, $subject, $message, $siteName, $recipient_email, null, null, null, $additionalParameters);
             }
         }
     }
     return $course_id;
 }
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:101,代码来源:add_course.lib.inc.php

示例7: addToUrl

 /**
  * @param int $id
  *
  * @return bool
  */
 function addToUrl($id)
 {
     if (!self::isMultipleUrlSupport()) {
         return false;
     }
     UrlManager::addCourseCategoryListToUrl(array($id), array(api_get_current_access_url_id()));
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:12,代码来源:course_category.lib.php

示例8: dispatchConference

function dispatchConference($op)
{
    require_once _base_ . '/lib/lib.urlmanager.php';
    $url =& UrlManager::getInstance();
    $url->setStdQuery('modname=conference&op=list');
    if (isset($_POST['undo'])) {
        $op = 'list';
    }
    switch ($op) {
        case 'list':
            conference_list($url);
            break;
        case 'startnewconf':
            conference_startnewconf($url);
            break;
        case 'modconf':
            conference_modconf();
            break;
        case 'delconf':
            conference_delconf();
            break;
        case 'booking':
            booking();
            break;
        case 'modbooking':
            modBooking();
            break;
        case 'history':
            showHistory();
            break;
        case 'log':
            showLog();
            break;
        default:
            conference_list($url);
    }
}
开发者ID:abhinay100,项目名称:forma_app,代码行数:37,代码来源:conference.php

示例9: api_display_tool_title

echo '</div>';
api_display_tool_title($tool_name);
if ($_POST['form_sent']) {
    $form_sent = $_POST['form_sent'];
    $users = is_array($_POST['user_list']) ? $_POST['user_list'] : array();
    $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array();
    $first_letter_user = $_POST['first_letter_user'];
    foreach ($users as $key => $value) {
        $users[$key] = intval($value);
    }
    if ($form_sent == 1) {
        if (count($users) == 0 || count($url_list) == 0) {
            Display::display_error_message(get_lang('AtLeastOneUserAndOneURL'));
            //header('Location: access_urls.php?action=show_message&message='.get_lang('AtLeastOneUserAndOneURL'));
        } else {
            UrlManager::add_users_to_urls($users, $url_list);
            Display::display_confirmation_message(get_lang('UsersBelongURL'));
            //header('Location: access_urls.php?action=show_message&message='.get_lang('UsersBelongURL'));
        }
    }
}
/*	Display GUI	*/
if (empty($first_letter_user)) {
    $sql = "SELECT count(*) as nb_users FROM {$tbl_user}";
    $result = Database::query($sql);
    $num_row = Database::fetch_array($result);
    if ($num_row['nb_users'] > 1000) {
        //if there are too much users to gracefully handle with the HTML select list,
        // assign a default filter on users names
        $first_letter_user = 'A';
    }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:access_url_add_users_to_url.php

示例10: mycertificateDispatch

function mycertificateDispatch($op)
{
    require_once $GLOBALS['where_lms'] . '/lib/lib.certificate.php';
    require_once _base_ . '/lib/lib.urlmanager.php';
    $url =& UrlManager::getInstance('mycertificate');
    $url->setStdQuery('modname=mycertificate&op=mycertificate');
    switch ($op) {
        case "preview_cert":
            preview_cert($url);
            break;
        case "release_cert":
            release_cert($url);
            break;
        case "mycertificate":
        default:
            mycertificate($url);
    }
}
开发者ID:abhinay100,项目名称:forma_app,代码行数:18,代码来源:mycertificate.php

示例11: array

 $conditions = array('username' => $keyword);
 $user_list = UserManager::get_user_list($conditions, array(), false, ' OR ');
 if (!empty($user_list)) {
     $extra_search_options = Display::page_subheader(get_lang('UsersFoundInOtherPortals'));
     $table = new HTML_Table(array('class' => 'data_table'));
     $column = 0;
     $row = 0;
     $headers = array(get_lang('User'), 'URL', get_lang('Actions'));
     foreach ($headers as $header) {
         $table->setHeaderContents($row, $column, $header);
         $column++;
     }
     $row++;
     foreach ($user_list as $user) {
         $column = 0;
         $access_info = UrlManager::get_access_url_from_user($user['id']);
         $access_info_to_string = '';
         $add_user = true;
         if (!empty($access_info)) {
             foreach ($access_info as $url_info) {
                 if ($current_access_url_id == $url_info['access_url_id']) {
                     $add_user = false;
                 }
                 $access_info_to_string .= $url_info['url'] . '<br />';
             }
         }
         if ($add_user) {
             $row_table = array();
             $row_table[] = api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ') ';
             $row_table[] = $access_info_to_string;
             $url = api_get_self() . '?action=add_user_to_my_url&user_id=' . $user['id'] . '&sec_token=' . $_SESSION['sec_token'];
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:user_list.php

示例12: delete_user

 /**
  * Delete a user from the platform, and all its belongings. This is a
  * very dangerous function that should only be accessible by
  * super-admins. Other roles should only be able to disable a user,
  * which removes access to the platform but doesn't delete anything.
  * @param int The ID of th user to be deleted
  * @return boolean true if user is successfully deleted, false otherwise
  * @assert (null) === false
  * @assert ('abc') === false
  */
 public static function delete_user($user_id)
 {
     if ($user_id != strval(intval($user_id))) {
         return false;
     }
     if ($user_id === false) {
         return false;
     }
     if (!self::can_delete_user($user_id)) {
         return false;
     }
     $table_user = Database::get_main_table(TABLE_MAIN_USER);
     $usergroup_rel_user = Database::get_main_table(TABLE_USERGROUP_REL_USER);
     $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
     $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
     $table_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $table_admin = Database::get_main_table(TABLE_MAIN_ADMIN);
     $table_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
     $table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
     $table_group = Database::get_course_table(TABLE_GROUP_USER);
     $table_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
     // Unsubscribe the user from all groups in all his courses
     $sql = "SELECT c.id FROM {$table_course} c, {$table_course_user} cu\n                WHERE\n                    cu.user_id = '" . $user_id . "' AND\n                    relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND\n                    c.id = cu.c_id";
     $res = Database::query($sql);
     while ($course = Database::fetch_object($res)) {
         $sql = "DELETE FROM {$table_group}\n                    WHERE c_id = {$course->id} AND user_id = {$user_id}";
         Database::query($sql);
     }
     // Unsubscribe user from all classes
     //Classes are not longer supported
     /* $sql = "DELETE FROM $table_class_user WHERE user_id = '".$user_id."'";
        Database::query($sql); */
     // Unsubscribe user from usergroup_rel_user
     $sql = "DELETE FROM {$usergroup_rel_user} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // Unsubscribe user from all courses
     $sql = "DELETE FROM {$table_course_user} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // Unsubscribe user from all courses in sessions
     $sql = "DELETE FROM {$table_session_course_user} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // If the user was added as a id_coach then set the current admin as coach see BT#
     $currentUserId = api_get_user_id();
     $sql = "UPDATE {$table_session} SET id_coach = {$currentUserId}  WHERE id_coach = '" . $user_id . "'";
     Database::query($sql);
     $sql = "UPDATE {$table_session} SET id_coach = {$currentUserId}  WHERE session_admin_id = '" . $user_id . "'";
     Database::query($sql);
     // Unsubscribe user from all sessions
     $sql = "DELETE FROM {$table_session_user} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // Delete user picture
     /* TODO: Logic about api_get_setting('split_users_upload_directory') == 'true'
        a user has 4 different sized photos to be deleted. */
     $user_info = api_get_user_info($user_id);
     if (strlen($user_info['picture_uri']) > 0) {
         $path = self::getUserPathById($user_id, 'system');
         $img_path = $path . $user_info['picture_uri'];
         if (file_exists($img_path)) {
             unlink($img_path);
         }
     }
     // Delete the personal course categories
     $course_cat_table = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
     $sql = "DELETE FROM {$course_cat_table} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // Delete user from database
     $sql = "DELETE FROM {$table_user} WHERE id = '" . $user_id . "'";
     Database::query($sql);
     // Delete user from the admin table
     $sql = "DELETE FROM {$table_admin} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // Delete the personal agenda-items from this user
     $agenda_table = Database::get_main_table(TABLE_PERSONAL_AGENDA);
     $sql = "DELETE FROM {$agenda_table} WHERE user = '" . $user_id . "'";
     Database::query($sql);
     $gradebook_results_table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
     $sql = 'DELETE FROM ' . $gradebook_results_table . ' WHERE user_id = ' . $user_id;
     Database::query($sql);
     $extraFieldValue = new ExtraFieldValue('user');
     $extraFieldValue->deleteValuesByItem($user_id);
     if (api_get_multiple_access_url()) {
         $url_id = api_get_current_access_url_id();
         UrlManager::delete_url_rel_user($user_id, $url_id);
     } else {
         //we delete the user from the url_id =1
         UrlManager::delete_url_rel_user($user_id, 1);
     }
     if (api_get_setting('allow_social_tool') == 'true') {
         $userGroup = new UserGroup();
         //Delete user from portal groups
//.........这里部分代码省略.........
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:101,代码来源:usermanager.lib.php

示例13: delete_course

 /**
  * Delete a course
  * This function deletes a whole course-area from the platform. When the
  * given course is a virtual course, the database and directory will not be
  * deleted.
  * When the given course is a real course, also all virtual courses refering
  * to the given course will be deleted.
  * Considering the fact that we remove all traces of the course in the main
  * database, it makes sense to remove all tracking as well (if stats databases exist)
  * so that a new course created with this code would not use the remains of an older
  * course.
  *
  * @param string The code of the course to delete
  * @todo When deleting a virtual course: unsubscribe users from that virtual
  * course from the groups in the real course if they are not subscribed in
  * that real course.
  * @todo Remove globals
  */
 public static function delete_course($code)
 {
     $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
     $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
     $table_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
     $table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
     $table_course_survey = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY);
     $table_course_survey_question = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION);
     $table_course_survey_question_option = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION_OPTION);
     $table_course_rel_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
     $table_stats_hotpots = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
     $table_stats_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
     $table_stats_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
     $table_stats_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
     $table_stats_lastaccess = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
     $table_stats_course_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
     $table_stats_online = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
     $table_stats_default = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
     $table_stats_downloads = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
     $table_stats_links = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
     $table_stats_uploads = Database::get_main_table(TABLE_STATISTIC_TRACK_E_UPLOADS);
     $codeFiltered = Database::escape_string($code);
     $sql = "SELECT * FROM {$table_course} WHERE code='" . $codeFiltered . "'";
     $res = Database::query($sql);
     if (Database::num_rows($res) == 0) {
         return;
     }
     $sql = "SELECT * FROM {$table_course}\n                WHERE code = '" . $codeFiltered . "'";
     $res = Database::query($sql);
     $course = Database::fetch_array($res);
     $courseId = $course['id'];
     $count = 0;
     if (api_is_multiple_url_enabled()) {
         $url_id = 1;
         if (api_get_current_access_url_id() != -1) {
             $url_id = api_get_current_access_url_id();
         }
         UrlManager::delete_url_rel_course($courseId, $url_id);
         $count = UrlManager::getCountUrlRelCourse($courseId);
     }
     if ($count == 0) {
         self::create_database_dump($code);
         $course_tables = AddCourse::get_course_tables();
         // Cleaning c_x tables
         if (!empty($courseId)) {
             foreach ($course_tables as $table) {
                 $table = Database::get_course_table($table);
                 $sql = "DELETE FROM {$table} WHERE c_id = {$courseId} ";
                 Database::query($sql);
             }
         }
         $course_dir = api_get_path(SYS_COURSE_PATH) . $course['directory'];
         $archive_dir = api_get_path(SYS_ARCHIVE_PATH) . $course['directory'] . '_' . time();
         if (is_dir($course_dir)) {
             rename($course_dir, $archive_dir);
         }
         // Unsubscribe all users from the course
         $sql = "DELETE FROM {$table_course_user} WHERE c_id='" . $courseId . "'";
         Database::query($sql);
         // Delete the course from the sessions tables
         $sql = "DELETE FROM {$table_session_course} WHERE c_id='" . $courseId . "'";
         Database::query($sql);
         $sql = "DELETE FROM {$table_session_course_user} WHERE c_id='" . $courseId . "'";
         Database::query($sql);
         // Delete from Course - URL
         $sql = "DELETE FROM {$table_course_rel_url} WHERE c_id = '" . $courseId . "'";
         Database::query($sql);
         $sql = 'SELECT survey_id FROM ' . $table_course_survey . ' WHERE course_code="' . $codeFiltered . '"';
         $result_surveys = Database::query($sql);
         while ($surveys = Database::fetch_array($result_surveys)) {
             $survey_id = $surveys[0];
             $sql = 'DELETE FROM ' . $table_course_survey_question . ' WHERE survey_id="' . $survey_id . '"';
             Database::query($sql);
             $sql = 'DELETE FROM ' . $table_course_survey_question_option . ' WHERE survey_id="' . $survey_id . '"';
             Database::query($sql);
             $sql = 'DELETE FROM ' . $table_course_survey . ' WHERE survey_id="' . $survey_id . '"';
             Database::query($sql);
         }
         // Cleaning group categories
         $groupCategories = GroupManager::get_categories($course['code']);
         if (!empty($groupCategories)) {
             foreach ($groupCategories as $category) {
//.........这里部分代码省略.........
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:101,代码来源:course.lib.php

示例14: array

$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
Display::display_header($tool_name);
echo '<div class="actions">';
echo Display::url(Display::return_icon('edit.png', get_lang('EditUserGroupToURL'), ''), api_get_path(WEB_CODE_PATH) . 'admin/access_url_edit_usergroup_to_url.php');
echo '</div>';
api_display_tool_title($tool_name);
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
    $form_sent = $_POST['form_sent'];
    $userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : array();
    $urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : array();
    $firstLetterUserGroup = $_POST['first_letter_user_group'];
    if ($form_sent == 1) {
        if (count($userGroups) == 0 || count($urlList) == 0) {
            Display::display_error_message(get_lang('AtLeastOneUserGroupAndOneURL'));
        } else {
            UrlManager::addUserGroupListToUrl($userGroups, $urlList);
            Display::display_confirmation_message(get_lang('UserGroupBelongURL'));
        }
    }
}
$firstLetterUser = null;
if ($userGroup->getTotalCount() > 1000) {
    //if there are too much num_courses to gracefully handle with the HTML select list,
    // assign a default filter on users names
    $firstLetterUser = 'A';
}
$dbUserGroups = $userGroup->filterByFirstLetter($firstLetterUserGroup);
$sql = "SELECT id, url FROM {$tbl_access_url}  WHERE active = 1 ORDER BY url";
$result = Database::query($sql);
$db_urls = Database::store_result($result);
?>
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:access_url_add_usergroup_to_url.php

示例15: update_urls_rel_session

 /**
  * Updates the access_url_rel_session table with a given user list
  * @author Julio Montoya
  * @param array user list
  * @param int access_url_id
  * */
 public static function update_urls_rel_session($session_list, $access_url_id)
 {
     $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
     $sql = "SELECT session_id FROM {$table_url_rel_session} WHERE access_url_id=" . intval($access_url_id);
     $result = Database::query($sql);
     $existing_sessions = array();
     while ($row = Database::fetch_array($result)) {
         $existing_sessions[] = $row['session_id'];
     }
     // Adding users
     foreach ($session_list as $session) {
         if (!in_array($session, $existing_sessions)) {
             if (!empty($session) && !empty($access_url_id)) {
                 UrlManager::add_session_to_url($session, $access_url_id);
             }
         }
     }
     // Deleting old users
     foreach ($existing_sessions as $existing_session) {
         if (!in_array($existing_session, $session_list)) {
             if (!empty($existing_session) && !empty($access_url_id)) {
                 UrlManager::delete_url_rel_session($existing_session, $access_url_id);
             }
         }
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:32,代码来源:urlmanager.lib.php


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