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


PHP SessionManager::get_all_session_category方法代码示例

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


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

示例1: setForm

 /**
  * @param FormValidator $form
  *
  * @return array
  */
 public static function setForm(FormValidator &$form, $sessionId = 0)
 {
     $categoriesList = SessionManager::get_all_session_category();
     $userInfo = api_get_user_info();
     $categoriesOptions = array('0' => get_lang('None'));
     if ($categoriesList != false) {
         foreach ($categoriesList as $categoryItem) {
             $categoriesOptions[$categoryItem['id']] = $categoryItem['name'];
         }
     }
     // Database Table Definitions
     $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
     $form->addElement('text', 'name', get_lang('SessionName'), array('maxlength' => 50));
     $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
     $form->addRule('name', get_lang('SessionNameAlreadyExists'), 'callback', 'check_session_name');
     if (!api_is_platform_admin() && api_is_teacher()) {
         $form->addElement('select', 'coach_username', get_lang('CoachName'), [api_get_user_id() => $userInfo['complete_name']], array('id' => 'coach_username', 'class' => 'chzn-select', 'style' => 'width:370px;'));
     } else {
         $sql = "SELECT COUNT(1) FROM {$tbl_user} WHERE status = 1";
         $rs = Database::query($sql);
         $countUsers = Database::result($rs, 0, 0);
         if (intval($countUsers) < 50) {
             $orderClause = "ORDER BY ";
             $orderClause .= api_sort_by_first_name() ? "firstname, lastname, username" : "lastname, firstname, username";
             $sql = "SELECT user_id, lastname, firstname, username\n                        FROM {$tbl_user}\n                        WHERE status = '1' " . $orderClause;
             if (api_is_multiple_url_enabled()) {
                 $userRelAccessUrlTable = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
                 $accessUrlId = api_get_current_access_url_id();
                 if ($accessUrlId != -1) {
                     $sql = "SELECT user.user_id, username, lastname, firstname\n                        FROM {$tbl_user} user\n                        INNER JOIN {$userRelAccessUrlTable} url_user\n                        ON (url_user.user_id = user.user_id)\n                        WHERE\n                            access_url_id = {$accessUrlId} AND\n                            status = 1 " . $orderClause;
                 }
             }
             $result = Database::query($sql);
             $coachesList = Database::store_result($result);
             $coachesOptions = array();
             foreach ($coachesList as $coachItem) {
                 $coachesOptions[$coachItem['user_id']] = api_get_person_name($coachItem['firstname'], $coachItem['lastname']) . ' (' . $coachItem['username'] . ')';
             }
             $form->addElement('select', 'coach_username', get_lang('CoachName'), $coachesOptions);
         } else {
             $form->addElement('select_ajax', 'coach_username', get_lang('CoachName'), null, ['url' => api_get_path(WEB_AJAX_PATH) . 'session.ajax.php?a=search_general_coach', 'width' => '100%']);
         }
     }
     $form->addRule('coach_username', get_lang('ThisFieldIsRequired'), 'required');
     $form->addHtml('<div id="ajax_list_coachs"></div>');
     $form->addButtonAdvancedSettings('advanced_params');
     $form->addElement('html', '<div id="advanced_params_options" style="display:none">');
     $form->addSelect('session_category', get_lang('SessionCategory'), $categoriesOptions, array('id' => 'session_category', 'class' => 'chzn-select', 'style' => 'width:370px;'));
     $form->addHtmlEditor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'Minimal'));
     $form->addElement('checkbox', 'show_description', null, get_lang('ShowDescription'));
     $visibilityGroup = array();
     $visibilityGroup[] = $form->createElement('select', 'session_visibility', null, array(SESSION_VISIBLE_READ_ONLY => get_lang('SessionReadOnly'), SESSION_VISIBLE => get_lang('SessionAccessible'), SESSION_INVISIBLE => api_ucfirst(get_lang('SessionNotAccessible'))));
     $form->addGroup($visibilityGroup, 'visibility_group', get_lang('SessionVisibility'), null, false);
     $options = [0 => get_lang('ByDuration'), 1 => get_lang('ByDates')];
     $form->addSelect('access', get_lang('Access'), $options, array('onchange' => 'accessSwitcher()', 'id' => 'access'));
     $form->addElement('html', '<div id="duration" style="display:none">');
     $form->addElement('number', 'duration', array(get_lang('SessionDurationTitle'), get_lang('SessionDurationDescription')), array('maxlength' => 50));
     $form->addElement('html', '</div>');
     $form->addElement('html', '<div id="date_fields" style="display:none">');
     // Dates
     $form->addDateTimePicker('access_start_date', array(get_lang('SessionStartDate'), get_lang('SessionStartDateComment')), array('id' => 'access_start_date'));
     $form->addDateTimePicker('access_end_date', array(get_lang('SessionEndDate'), get_lang('SessionEndDateComment')), array('id' => 'access_end_date'));
     $form->addRule(array('access_start_date', 'access_end_date'), get_lang('StartDateMustBeBeforeTheEndDate'), 'compare_datetime_text', '< allow_empty');
     $form->addDateTimePicker('display_start_date', array(get_lang('SessionDisplayStartDate'), get_lang('SessionDisplayStartDateComment')), array('id' => 'display_start_date'));
     $form->addDateTimePicker('display_end_date', array(get_lang('SessionDisplayEndDate'), get_lang('SessionDisplayEndDateComment')), array('id' => 'display_end_date'));
     $form->addRule(array('display_start_date', 'display_end_date'), get_lang('StartDateMustBeBeforeTheEndDate'), 'compare_datetime_text', '< allow_empty');
     $form->addDateTimePicker('coach_access_start_date', array(get_lang('SessionCoachStartDate'), get_lang('SessionCoachStartDateComment')), array('id' => 'coach_access_start_date'));
     $form->addDateTimePicker('coach_access_end_date', array(get_lang('SessionCoachEndDate'), get_lang('SessionCoachEndDateComment')), array('id' => 'coach_access_end_date'));
     $form->addRule(array('coach_access_start_date', 'coach_access_end_date'), get_lang('StartDateMustBeBeforeTheEndDate'), 'compare_datetime_text', '< allow_empty');
     $form->addElement('html', '</div>');
     $form->addCheckBox('send_subscription_notification', [get_lang('SendSubscriptionNotification'), get_lang('SendAnEmailWhenAUserBeingSubscribed')]);
     // Extra fields
     $extra_field = new ExtraField('session');
     $extra = $extra_field->addElements($form, $sessionId);
     $form->addElement('html', '</div>');
     $js = $extra['jquery_ready_content'];
     return ['js' => $js];
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:83,代码来源:sessionmanager.lib.php

示例2: get_lang

    $errorMsg = get_lang('MsgErrorSessionCategory');
}
if (isset($_GET['msg']) && $_GET['msg'] == 'ok') {
    $OkMsg = get_lang('SessionCategoryUpdate');
}
$page = isset($_GET['page']) ? Security::remove_XSS($_GET['page']) : null;
Display::display_header($tool_name);
$where = '';
$rows_category_session = array();
if (isset($_POST['CategorySessionId']) && $_POST['formSent'] == 0 || isset($_GET['id_category'])) {
    $where = 'WHERE session_category_id != ' . $categoryId . ' OR session_category_id IS NULL';
    $sql = 'SELECT id, name  FROM ' . $tbl_session . ' WHERE session_category_id =' . $categoryId . ' ORDER BY name';
    $result = Database::query($sql);
    $rows_category_session = Database::store_result($result);
}
$rows_session_category = SessionManager::get_all_session_category();
if (empty($rows_session_category)) {
    Display::display_warning_message(get_lang('YouNeedToAddASessionCategoryFirst'));
    Display::display_footer();
    exit;
}
if (api_get_multiple_access_url()) {
    $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
    $access_url_id = api_get_current_access_url_id();
    $sql = "SELECT s.id, s.name  FROM {$tbl_session} s INNER JOIN {$table_access_url_rel_session} u ON s.id = u.session_id {$where} AND u.access_url_id = {$access_url_id} ORDER BY name";
} else {
    $sql = "SELECT id, name  FROM {$tbl_session} {$where} ORDER BY name";
}
$result = Database::query($sql);
$rows_session = Database::store_result($result);
?>
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:add_many_session_to_category.php

示例3: api_get_person_name

                <option value="<?php 
    echo $enreg['user_id'];
    ?>
" <?php 
    if ($enreg['user_id'] == $infos['id_coach'] || $enreg['user_id'] == $id_coach) {
        echo 'selected="selected"';
    }
    ?>
><?php 
    echo api_get_person_name($enreg['firstname'], $enreg['lastname']) . ' (' . $enreg['username'] . ')';
    ?>
</option>
                <?php 
}
unset($Coaches);
$Categories = SessionManager::get_all_session_category();
?>
        </select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">
            <?php 
echo get_lang('SessionCategory');
?>
        </label>
        <div class="controls">
                <select class="chzn-select" id="session_category" name="session_category" style="width:380px;" title="<?php 
echo get_lang('Select');
?>
">
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:session_edit.php

示例4: api_get_current_access_url_id

if (api_is_multiple_url_enabled()) {
    $table_access_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
    $access_url_id = api_get_current_access_url_id();
    if ($access_url_id != -1) {
        $sql = "SELECT DISTINCT u.user_id,lastname,firstname,username\n\t\t        FROM {$tbl_user} u\n                INNER JOIN {$table_access_url_rel_user} url_rel_user\n                ON (url_rel_user.user_id = u.user_id)\n\t\t\t    WHERE status='1' AND access_url_id = '{$access_url_id}' {$order_clause}";
    }
}
$result = Database::query($sql);
$coaches = Database::store_result($result);
$thisYear = date('Y');
$coachesOption = array('' => '----- ' . get_lang('None') . ' -----');
foreach ($coaches as $coach) {
    $personName = api_get_person_name($coach['firstname'], $coach['lastname']);
    $coachesOption[$coach['user_id']] = "{$personName} ({$coach['username']})";
}
$categoriesList = SessionManager::get_all_session_category();
$categoriesOption = array('0' => get_lang('None'));
if ($categoriesList != false) {
    foreach ($categoriesList as $categoryItem) {
        $categoriesOption[$categoryItem['id']] = $categoryItem['name'];
    }
}
$formAction = api_get_self() . '?';
$formAction .= http_build_query(array('page' => Security::remove_XSS($_GET['page']), 'id' => $id));
$form = new FormValidator('edit_session', 'post', $formAction);
$form->addElement('header', $tool_name);
$result = SessionManager::setForm($form, $id);
$htmlHeadXtra[] = '
<script>
$(function() {
    ' . $result['js'] . '
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:session_edit.php


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