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


PHP api_get_configuration_value函数代码示例

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


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

示例1: import_users_from_file

/**
 * Import users into database from a file located on the server.
 * Function registered as service.
 * @param  string The csv (only csv) file containing users tom import
 * @param  string Security key (as found in configuration file)
 * @return string Error message
 */
function import_users_from_file($filepath, $security_key)
{
    $errors_returned = array(0 => 'success', 1 => 'file import does not exist', 2 => 'no users to import', 3 => 'wrong datas in file', 4 => 'security error');
    $security = api_get_configuration_value('security_key');
    // Check whether this script is launch by server and security key is ok.
    if (empty($_SERVER['REMOTE_ADDR']) || $_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR'] || $security_key != $security) {
        return $errors_returned[4];
    }
    // Libraries
    require_once 'import.lib.php';
    // Check is users file exists.
    if (!is_file($filepath)) {
        return $errors_returned[1];
    }
    // Get list of users
    $users = parse_csv_data($filepath);
    if (count($users) == 0) {
        return $errors_returned[2];
    }
    // Check the datas for each user
    $errors = validate_data($users);
    if (count($errors) > 0) {
        return $errors_returned[3];
    }
    // Apply modifications in database
    save_data($users);
    return $errors_returned[0];
    // Import successfull
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:36,代码来源:service.php

示例2: courses_list

/**
 * Get a list of courses (code, url, title, teacher, language) and return to caller
 * Function registered as service. Returns strings in UTF-8.
 * @param string Security key (the Dokeos install's API key)
 * @param mixed  Array or string. Type of visibility of course (public, public-registered, private, closed)
 * @return array Courses list (code=>[title=>'title',url='http://...',teacher=>'...',language=>''],code=>[...],...)
 */
function courses_list($security_key, $visibilities = 'public')
{
    $securityFromConfiguration = api_get_configuration_value('security_key');
    // Check if this script is launch by server and if security key is ok.
    if ($security_key != $securityFromConfiguration) {
        return array('error_msg' => 'Security check failed');
    }
    $vis = array('public' => '3', 'public-registered' => '2', 'private' => '1', 'closed' => '0');
    $courses_list = array();
    if (!is_array($visibilities)) {
        $tmp = $visibilities;
        $visibilities = array($tmp);
    }
    foreach ($visibilities as $visibility) {
        if (!in_array($visibility, array_keys($vis))) {
            return array('error_msg' => 'Security check failed');
        }
        $courses_list_tmp = CourseManager::get_courses_list(null, null, null, null, $vis[$visibility]);
        foreach ($courses_list_tmp as $index => $course) {
            $course_info = CourseManager::get_course_information($course['code']);
            $courses_list[$course['code']] = array('title' => api_utf8_encode($course_info['title']), 'url' => api_get_path(WEB_COURSE_PATH) . $course_info['directory'] . '/', 'teacher' => api_utf8_encode($course_info['tutor_name']), 'language' => $course_info['course_language']);
        }
    }
    return $courses_list;
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:32,代码来源:courses_list.rest.php

示例3: get_paths_data

 /**
  * @return array
  */
 public function get_paths_data()
 {
     global $paths;
     $list = $paths[api_get_path(WEB_PATH)];
     $list['url_append'] = api_get_configuration_value('url_append');
     asort($list);
     return ['headers' => ['Path', 'constant'], 'data' => $list];
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:11,代码来源:diagnoser.lib.php

示例4: getPasswordEncryption

 /**
  * @return bool|mixed
  */
 public static function getPasswordEncryption()
 {
     $encryptionMethod = self::$encryptionMethod;
     if (empty($encryptionMethod)) {
         $encryptionMethod = api_get_configuration_value('password_encryption');
     }
     return $encryptionMethod;
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:11,代码来源:usermanager.lib.php

示例5: getEntityManager

 /**
  * @return EntityManager
  */
 public function getEntityManager()
 {
     if (empty($this->manager)) {
         $dbParams = array('driver' => 'pdo_mysql', 'host' => api_get_configuration_value('db_host'), 'user' => api_get_configuration_value('db_user'), 'password' => api_get_configuration_value('db_password'), 'dbname' => api_get_configuration_value('main_database'));
         $database = new \Database();
         $database->connect($dbParams, __DIR__ . '/../../', __DIR__ . '/../../');
         $this->manager = $database->getManager();
     }
     return $this->manager;
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:13,代码来源:AbstractMigrationChamilo.php

示例6: __construct

 /**
  * Set ups DB tables
  */
 public function __construct()
 {
     $this->table = Database::get_main_table(TABLE_USERGROUP);
     $this->usergroup_rel_user_table = Database::get_main_table(TABLE_USERGROUP_REL_USER);
     $this->usergroup_rel_course_table = Database::get_main_table(TABLE_USERGROUP_REL_COURSE);
     $this->usergroup_rel_session_table = Database::get_main_table(TABLE_USERGROUP_REL_SESSION);
     $this->access_url_rel_usergroup = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP);
     $this->table_course = Database::get_main_table(TABLE_MAIN_COURSE);
     $this->table_user = Database::get_main_table(TABLE_MAIN_USER);
     $this->useMultipleUrl = api_get_configuration_value('enable_multiple_url_support_for_classes');
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:14,代码来源:usergroup.lib.php

示例7: WSHelperVerifyKey

function WSHelperVerifyKey($params)
{
    global $debug;
    $securityFromConfiguration = api_get_configuration_value('security_key');
    if (is_array($params)) {
        $secret_key = $params['secret_key'];
    } else {
        $secret_key = $params;
    }
    //error_log(print_r($params,1));
    $check_ip = false;
    $ip_matches = false;
    $ip = trim($_SERVER['REMOTE_ADDR']);
    // if we are behind a reverse proxy, assume it will send the
    // HTTP_X_FORWARDED_FOR header and use this IP instead
    if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        list($ip1) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
        $ip = trim($ip1);
    }
    if ($debug) {
        error_log("ip: {$ip}");
    }
    // Check if a file that limits access from webservices exists and contains
    // the restraining check
    if (is_file('webservice-auth-ip.conf.php')) {
        include 'webservice-auth-ip.conf.php';
        if ($debug) {
            error_log("webservice-auth-ip.conf.php file included");
        }
        if (!empty($ws_auth_ip)) {
            $check_ip = true;
            $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip);
            if ($debug) {
                error_log("ip_matches: {$ip_matches}");
            }
        }
    }
    if ($debug) {
        error_log("checkip " . intval($check_ip));
    }
    if ($check_ip) {
        $security_key = $securityFromConfiguration;
    } else {
        $security_key = $ip . $securityFromConfiguration;
        //error_log($secret_key.'-'.$security_key);
    }
    $result = api_is_valid_secret_key($secret_key, $security_key);
    //error_log($secret_key.'-'.$security_key);
    if ($debug) {
        error_log('WSHelperVerifyKey result: ' . intval($result));
    }
    return $result;
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:53,代码来源:lp.php

示例8: isTotalPortalSizeBiggerThanLimit

/**
 * Checks total platform size
 * @param bool $debug
 *
 * @return bool
 */
function isTotalPortalSizeBiggerThanLimit($debug = true)
{
    $sizeLimit = api_get_configuration_value('hosting_total_size_limit');
    if (empty($sizeLimit)) {
        return true;
    }
    $updateFile = true;
    $file = api_get_path(SYS_COURSE_PATH) . 'hosting_total_size.php';
    // Default data
    $hostingData = array('frequency' => 86400);
    $log = null;
    // Check if file exists and if it is updated
    if (file_exists($file)) {
        $hostingDataFromFile = (require $file);
        // Check time() is UTC
        if (isset($hostingDataFromFile['updated_at']) && isset($hostingDataFromFile['frequency']) && isset($hostingDataFromFile['size'])) {
            $hostingData = $hostingDataFromFile;
            $time = $hostingData['updated_at'] + $hostingData['frequency'];
            $diff = $time - time();
            if ($time > time()) {
                $log .= "You need to wait {$diff} seconds to update the file \n";
                $updateFile = false;
            }
        }
    }
    // Now get values for total portal size
    $log .= "Frequency loaded: " . $hostingData['frequency'] . "\n";
    if ($updateFile) {
        $log .= "Updating total size ... \n";
        $totalSize = calculateTotalPortalSize($debug);
        $log .= "Total size calculated: {$totalSize} \n";
        $hostingData['updated_at'] = time();
        $hostingData['size'] = $totalSize;
        $writer = new Zend\Config\Writer\PhpArray();
        $phpCode = $writer->toString($hostingData);
        file_put_contents($file, $phpCode);
        $log .= "File saved in {$file} \n";
    } else {
        $log .= "Total size not updated \n";
        $totalSize = $hostingData['size'];
    }
    $result = true;
    if ($totalSize > $sizeLimit) {
        $log .= "Current total size of {$totalSize} MB is bigger than limit: {$sizeLimit} MB \n";
        $result = false;
    }
    if ($debug) {
        echo $log;
    }
    return $result;
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:57,代码来源:hosting_total_size_limit.php

示例9: up

 /**
  * @param Schema $schema
  *
  * @throws \Doctrine\DBAL\Schema\SchemaException
  */
 public function up(Schema $schema)
 {
     // Move some settings from configuration.php to the database
     // Current settings categories are:
     // Platform, Course, Session, Languages, User, Tools, Editor, Security,
     // Tuning, Gradebook, Timezones, Tracking, Search, stylesheets (lowercase),
     // LDAP, CAS, Shibboleth, Facebook
     // Setting $_configuration['hide_home_top_when_connected'] = true;
     $value = api_get_configuration_value('hide_home_top_when_connected');
     $this->addSettingCurrent('hide_home_top_when_connected', '', 'radio', 'Platform', $value ? 'true' : 'false', 'HideHomeTopContentWhenLoggedInText', 'HideHomeTopContentWhenLoggedInComment', null, '', 1, true, false, [0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]);
     // Hide the global announcements for non-connected users
     //$_configuration['hide_global_announcements_when_not_connected'] = true;
     $value = api_get_configuration_value('hide_global_announcements_when_not_connected');
     $this->addSettingCurrent('hide_global_announcements_when_not_connected', '', 'radio', 'Platform', $value ? 'true' : 'false', 'HideGlobalAnnouncementsWhenNotLoggedInText', 'HideGlobalAnnouncementsWhenNotLoggedInComment', null, '', 1, true, false, [0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]);
     // Use this course as template for all new courses (define course real ID as value)
     //$_configuration['course_creation_use_template'] = 14;
     $value = api_get_configuration_value('course_creation_use_template');
     $this->addSettingCurrent('course_creation_use_template', '', 'textfield', 'Course', $value ? $value : '', 'CourseCreationUsesTemplateText', 'CourseCreationUsesTemplateComment', null, '', 1, true, false, [0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]);
     // Add password strength checker
     //$_configuration['allow_strength_pass_checker'] = true;
     $value = api_get_configuration_value('allow_strength_pass_checker');
     $this->addSettingCurrent('allow_strength_pass_checker', '', 'radio', 'Security', $value ? 'true' : 'false', 'EnablePasswordStrengthCheckerText', 'EnablePasswordStrengthCheckerComment', null, '', 1, true, false, [0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]);
     // Enable captcha
     // $_configuration['allow_captcha'] = true;
     $value = api_get_configuration_value('allow_captcha');
     $this->addSettingCurrent('allow_captcha', '', 'radio', 'Security', $value ? 'true' : 'false', 'EnableCaptchaText', 'EnableCaptchaComment', null, '', 1, true, false, [0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]);
     // Prevent account from logging in for a certain amount of time
     // if captcha is wrong for the specified number of times
     //$_configuration['captcha_number_mistakes_to_block_account'] = 5;
     $value = api_get_configuration_value('captcha_number_mistakes_to_block_account');
     $this->addSettingCurrent('captcha_number_mistakes_to_block_account', '', 'textfield', 'Security', $value ? $value : 5, 'CaptchaNumberOfMistakesBeforeBlockingAccountText', 'CaptchaNumberOfMistakesBeforeBlockingAccountComment', null, '', 1, true, false);
     // Prevent account from logging in for the specified number of minutes
     //$_configuration['captcha_time_to_block'] = 5;//minutes
     $value = api_get_configuration_value('captcha_time_to_block');
     $this->addSettingCurrent('captcha_time_to_block', '', 'textfield', 'Security', $value ? $value : 5, 'CaptchaTimeAccountIsLockedText', 'CaptchaTimeAccountIsLockedComment', null, '', 1, true, false);
     // Allow DRH role to access all content and users from the sessions he follows
     //$_configuration['drh_can_access_all_session_content'] = true;
     $value = api_get_configuration_value('drh_can_access_all_session_content');
     $this->addSettingCurrent('drh_can_access_all_session_content', '', 'radio', 'Session', $value ? 'true' : 'false', 'DRHAccessToAllSessionContentText', 'DRHAccessToAllSessionContentComment', null, '', 1, true, false, [0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]);
     // Display group's forum in general forum tool
     //$_configuration['display_groups_forum_in_general_tool'] = true;
     $value = api_get_configuration_value('display_groups_forum_in_general_tool');
     $this->addSettingCurrent('display_groups_forum_in_general_tool', '', 'radio', 'Tools', $value ? 'true' : 'false', 'ShowGroupForaInGeneralToolText', 'ShowGroupForaInGeneralToolComment', null, '', 1, true, false, [0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]);
     // Allow course tutors in sessions to add existing students to their session
     //$_configuration['allow_tutors_to_assign_students_to_session'] = 'false';
     $value = api_get_configuration_value('allow_tutors_to_assign_students_to_session');
     $this->addSettingCurrent('allow_tutors_to_assign_students_to_session', '', 'radio', 'Session', $value ? 'true' : 'false', 'TutorsCanAssignStudentsToSessionsText', 'TutorsCanAssignStudentsToSessionsComment', null, '', 1, true, false, [0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]);
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:53,代码来源:Version20150507152600.php

示例10: WSCourseList

/**
 * Get a list of courses (code, url, title, teacher, language) and return to caller
 * Function registered as service. Returns strings in UTF-8.
 * @param string User name in Chamilo
 * @param string Signature (composed of the sha1(username+apikey)
 * @param mixed  Array or string. Type of visibility of course (public, public-registered, private, closed)
 * @return array Courses list (code=>[title=>'title',url='http://...',teacher=>'...',language=>''],code=>[...],...)
 */
function WSCourseList($username, $signature, $visibilities = 'public')
{
    if (empty($username) or empty($signature)) {
        return -1;
    }
    $securityFromConfiguration = api_get_configuration_value('security_key');
    $info = api_get_user_info_from_username($username);
    $user_id = $info['user_id'];
    if (!UserManager::is_admin($user_id)) {
        return -1;
    }
    $list = UserManager::get_api_keys($user_id, 'dokeos');
    $key = '';
    foreach ($list as $key) {
        break;
    }
    $local_key = $username . $key;
    if (!api_is_valid_secret_key($signature, $local_key) && !api_is_valid_secret_key($signature, $username . $securityFromConfiguration)) {
        return -1;
        // The secret key is incorrect.
    }
    //public-registered = open
    $vis = array('public' => '3', 'public-registered' => '2', 'private' => '1', 'closed' => '0');
    $courses_list = array();
    if (!is_array($visibilities)) {
        $visibilities = split(',', $visibilities);
    }
    foreach ($visibilities as $visibility) {
        if (!in_array($visibility, array_keys($vis))) {
            return array('error_msg' => 'Security check failed');
        }
        $courses_list_tmp = CourseManager::get_courses_list(null, null, null, null, $vis[$visibility]);
        foreach ($courses_list_tmp as $index => $course) {
            $course_info = CourseManager::get_course_information($course['code']);
            $courses_list[] = array('code' => $course['code'], 'title' => api_utf8_encode($course_info['title']), 'url' => api_get_path(WEB_COURSE_PATH) . $course_info['directory'] . '/', 'teacher' => api_utf8_encode($course_info['tutor_name']), 'language' => $course_info['course_language']);
        }
    }
    return $courses_list;
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:47,代码来源:courses_list.soap.php

示例11: api_get_setting

    $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');
            if ($userScore[0] >= $gradebookMinScore) {
                Category::register_user_certificate($categories[0]->get_id(), $user_id);
            }
        }
    }
}
$template = \Chamilo\CoreBundle\Framework\Container::getTwig();
$template->addGlobal('glossary_extra_tools', api_get_setting('glossary.show_glossary_in_extra_tools'));
$fixLinkSetting = api_get_configuration_value('lp_fix_embed_content');
$fixLink = '';
if ($fixLinkSetting) {
    $fixLink = '{type:"script", id:"_fr10", src:"' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/fixlinks.js"}';
}
$template->addGlobal('fix_link', $fixLink);
$template->addGlobal('glossary_tool_availables', ['true', 'lp', 'exercise_and_lp']);
// If the global gamification mode is enabled...
$gamificationMode = api_get_setting('platform.gamification_mode');
// ...AND this learning path is set in gamification mode, then change the display
$gamificationMode = $gamificationMode && $learnPath->seriousgame_mode;
$template->addGlobal('show_glossary_in_documents', api_get_setting('document.show_glossary_in_documents'));
$template->addGlobal('jquery_web_path', api_get_jquery_web_path());
$template->addGlobal('jquery_ui_js_web_path', api_get_jquery_ui_js_web_path());
$template->addGlobal('jquery_ui_css_web_path', api_get_jquery_ui_css_web_path());
$template->addGlobal('is_allowed_to_edit', $is_allowed_to_edit);
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:lp_view.php

示例12: api_protect_admin_script

<?php

/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
//require_once '../inc/global.inc.php';
api_protect_admin_script();
if (!api_get_configuration_value('document_manage_deleted_files')) {
    api_not_allowed(true);
}
$courseInfo = api_get_course_info();
$sessionId = api_get_session_id();
$files = DocumentManager::getDeletedDocuments($courseInfo, $sessionId);
$actions = Display::url(get_lang('DownloadAll'), api_get_self() . '?' . api_get_cidreq() . '&action=download_all', ['class' => 'btn btn-default']);
$actions .= Display::url(get_lang('DeleteAll'), api_get_self() . '?' . api_get_cidreq() . '&action=delete_all', ['class' => 'btn btn-danger']);
$action = isset($_GET['action']) ? $_GET['action'] : '';
$id = isset($_GET['id']) ? intval($_GET['id']) : '';
$currentUrl = api_get_self() . '?' . api_get_cidreq();
switch ($action) {
    case 'delete':
        DocumentManager::purgeDocument($id, $courseInfo, $sessionId);
        Display::addFlash(Display::return_message(get_lang('Deleted')));
        header('Location: ' . $currentUrl);
        exit;
        break;
    case 'delete_all':
        DocumentManager::purgeDocuments($courseInfo, $sessionId);
        Display::addFlash(Display::return_message(get_lang('Deleted')));
        header('Location: ' . $currentUrl);
        exit;
        break;
    case 'download':
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:recycle.php

示例13: isset

/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
/**
 *  This script displays a form for registering new users.
 *  @package    chamilo.auth
 */
use ChamiloSession as Session;
//quick hack to adapt the registration form result to the selected registration language
if (!empty($_POST['language'])) {
    $_GET['language'] = $_POST['language'];
}
//require_once '../inc/global.inc.php';
$hideHeaders = isset($_GET['hide_headers']);
$allowedFields = ['official_code', 'phone', 'status', 'language', 'extra_fields'];
$allowedFieldsConfiguration = api_get_configuration_value('allow_fields_inscription');
if ($allowedFieldsConfiguration !== false) {
    $allowedFields = $allowedFieldsConfiguration;
}
$htmlHeadXtra[] = api_get_password_checker_js('#username', '#pass1');
// User is not allowed if Terms and Conditions are disabled and
// registration is disabled too.
$isNotAllowedHere = api_get_setting('registration.allow_terms_conditions') === 'false' && api_get_setting('registration.allow_registration') === 'false';
if ($isNotAllowedHere) {
    api_not_allowed(true, get_lang('RegistrationDisabled'));
}
if (!empty($_SESSION['user_language_choice'])) {
    $user_selected_language = $_SESSION['user_language_choice'];
} elseif (!empty($_SESSION['_user']['language'])) {
    $user_selected_language = $_SESSION['_user']['language'];
} else {
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:30,代码来源:inscription.php

示例14: array

        $data_array = $datagen->get_data(GradebookDataGenerator::GDG_SORT_NAME, 0, null, true);
        if (!empty($data_array)) {
            $newarray = array();
            foreach ($data_array as $data) {
                $newarray[] = array_slice($data, 1);
            }
            foreach ($newarray as $item) {
                $total_resource_weight = $total_resource_weight + $item['2'];
            }
        }
    }
    if ($total_resource_weight != $total_weight) {
        Display::display_warning_message(get_lang('SumOfActivitiesWeightMustBeEqualToTotalWeight'));
    }
}
$filter = api_get_configuration_value('certificate_filter_by_official_code');
$userList = array();
$filterForm = null;
$certificate_list = array();
if ($filter) {
    echo '<br />';
    $options = UserManager::getOfficialCodeGrouped();
    $options = array_merge(array('all' => get_lang('All')), $options);
    $form = new FormValidator('official_code_filter', 'POST', api_get_self() . '?' . api_get_cidreq() . '&cat_id=' . $cat_id);
    $form->addElement('select', 'filter', get_lang('OfficialCode'), $options);
    $form->add_button('submit', get_lang('Submit'));
    $filterForm = '<br />' . $form->return_form();
    if ($form->validate()) {
        $officialCode = $form->getSubmitValue('filter');
        if ($officialCode == 'all') {
            $certificate_list = get_list_users_certificates($cat_id);
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:gradebook_display_certificate.php

示例15: _api_get_person_name_convention

/**
 * Returns returns person name convention for a given language.
 * @param string $language	The input language.
 * @param string $type		The type of the requested convention.
 * It may be 'format' for name order convention or 'sort_by' for name sorting convention.
 * @return mixed Depending of the requested type,
 * the returned result may be string or boolean; null is returned on error;
 */
function _api_get_person_name_convention($language, $type)
{
    static $conventions;
    $language = api_purify_language_id($language);
    if (!isset($conventions)) {
        $file = dirname(__FILE__) . '/internationalization_database/name_order_conventions.php';
        if (file_exists($file)) {
            $conventions = (include $file);
        } else {
            $conventions = array('english' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'));
        }
        // Overwrite classic conventions
        $customConventions = api_get_configuration_value('name_order_conventions');
        if (!empty($customConventions)) {
            foreach ($customConventions as $key => $data) {
                $conventions[$key] = $data;
            }
        }
        $search1 = array('FIRST_NAME', 'LAST_NAME', 'TITLE');
        $replacement1 = array('%F', '%L', '%T');
        $search2 = array('first_name', 'last_name', 'title');
        $replacement2 = array('%f', '%l', '%t');
        foreach (array_keys($conventions) as $key) {
            $conventions[$key]['format'] = str_replace($search1, $replacement1, $conventions[$key]['format']);
            $conventions[$key]['format'] = _api_validate_person_name_format(_api_clean_person_name(str_replace('%', ' %', str_ireplace($search2, $replacement2, $conventions[$key]['format']))));
            $conventions[$key]['sort_by'] = strtolower($conventions[$key]['sort_by']) != 'last_name' ? true : false;
        }
    }
    switch ($type) {
        case 'format':
            return is_string($conventions[$language]['format']) ? $conventions[$language]['format'] : '%t %f %l';
        case 'sort_by':
            return is_bool($conventions[$language]['sort_by']) ? $conventions[$language]['sort_by'] : true;
    }
    return null;
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:44,代码来源:internationalization.lib.php


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