本文整理汇总了PHP中api_get_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP api_get_setting函数的具体用法?PHP api_get_setting怎么用?PHP api_get_setting使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api_get_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: event_login
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com> old code
* @author Julio Montoya 2013
* @desc Record information for login event when an user identifies himself with username & password
*/
function event_login(User $user)
{
$userId = $user->getUserId();
$TABLETRACK_LOGIN = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$reallyNow = api_get_utc_datetime();
$sql = "INSERT INTO " . $TABLETRACK_LOGIN . " (login_user_id, login_ip, login_date, logout_date) VALUES\n ('" . $userId . "',\n '" . Database::escape_string(api_get_real_ip()) . "',\n '" . $reallyNow . "',\n '" . $reallyNow . "'\n )";
Database::query($sql);
$roles = $user->getRoles();
// auto subscribe
foreach ($roles as $role) {
$userStatusParsed = 'student';
switch ($role) {
case 'ROLE_SESSION_MANAGER':
$userStatusParsed = 'sessionadmin';
break;
case 'ROLE_TEACHER':
$userStatusParsed = 'teacher';
break;
case 'ROLE_RRHH':
$userStatusParsed = 'DRH';
break;
}
$autoSubscribe = api_get_setting($userStatusParsed . '_autosubscribe');
if ($autoSubscribe) {
$autoSubscribe = explode('|', $autoSubscribe);
foreach ($autoSubscribe as $code) {
if (CourseManager::course_exists($code)) {
CourseManager::subscribe_user($userId, $code);
}
}
}
}
}
示例2: event_login
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @desc Record information for login event
* (when an user identifies himself with username & password)
*/
function event_login()
{
global $TABLETRACK_LOGIN;
global $_user;
// @todo use api_get_user_info();
//$userInfo = api_get_user_info();
$userInfo = $_user;
if (empty($userInfo)) {
return false;
}
$userId = api_get_user_id();
$reallyNow = api_get_utc_datetime();
$sql = "INSERT INTO " . $TABLETRACK_LOGIN . " (login_user_id, login_ip, login_date, logout_date) VALUES\n ('" . $userId . "',\n '" . Database::escape_string(api_get_real_ip()) . "',\n '" . $reallyNow . "',\n '" . $reallyNow . "'\n )";
Database::query($sql);
// Auto subscribe
$user_status = $userInfo['status'] == SESSIONADMIN ? 'sessionadmin' : $userInfo['status'] == COURSEMANAGER ? 'teacher' : $userInfo['status'] == DRH ? 'DRH' : 'student';
$autoSubscribe = api_get_setting($user_status . '_autosubscribe');
if ($autoSubscribe) {
$autoSubscribe = explode('|', $autoSubscribe);
foreach ($autoSubscribe as $code) {
if (CourseManager::course_exists($code)) {
CourseManager::subscribe_user($userId, $code);
}
}
}
}
示例3: process
public function process()
{
$results = array();
foreach ($this->rows as $row_val) {
$search_show_unlinked_results = api_get_setting('search_show_unlinked_results') == 'true';
$course_visible_for_user = api_is_course_visible_for_user(NULL, $row_val['courseid']);
// can view course?
if ($course_visible_for_user || $search_show_unlinked_results) {
// is visible?
$visibility = api_get_item_visibility(api_get_course_info($row_val['courseid']), TOOL_DOCUMENT, $row_val['xapian_data'][SE_DATA]['doc_id']);
if ($visibility) {
list($thumbnail, $image, $name, $author, $url) = $this->get_information($row_val['courseid'], $row_val['xapian_data'][SE_DATA]['doc_id']);
$result = array('toolid' => TOOL_DOCUMENT, 'score' => $row_val['score'], 'url' => $url, 'thumbnail' => $thumbnail, 'image' => $image, 'title' => $name, 'author' => $author);
if ($course_visible_for_user) {
$results[] = $result;
} else {
// course not visible for user
if ($search_show_unlinked_results) {
$result['url'] = '';
$results[] = $result;
}
}
}
}
}
// get information to sort
foreach ($results as $key => $row) {
$score[$key] = $row['score'];
}
// Sort results with score descending
array_multisort($score, SORT_DESC, $results);
return $results;
}
示例4: cloud_getScormEngineService
function cloud_getScormEngineService()
{
require_once 'CloudPHPLibrary/ScormEngineService.php';
$ServiceUrl = api_get_setting('scormCloudCredsUrl', 'appUrl');
$AppId = api_get_setting('scormCloudCredsId', 'appId');
$SecretKey = api_get_setting('scormCloudCredsPw', 'appPw');
return new ScormEngineService($ServiceUrl, $AppId, $SecretKey);
}
示例5: validate
/**
* Function to check if a username is of the correct format
*
* @param string $username Wanted username
* @param array $options
*
* @return boolean True if username is of the correct format
* @author Modified by Ivan Tcholakov, 15-SEP-2009.
* @see HTML_QuickForm_Rule
* The validation rule is served by the UserManager class as of this moment.
*/
public function validate($username, $options)
{
if (api_get_setting('login_is_email') == 'true') {
return api_valid_email($username);
} else {
return UserManager::is_username_valid($username);
}
}
示例6: getConditionalPlugins
/**
* @return array
*/
public function getConditionalPlugins()
{
$plugins = array();
if (api_get_setting('document.show_glossary_in_documents') == 'ismanual') {
$plugins[] = 'glossary';
}
return $plugins;
}
示例7: configEditorAction
/**
* @Route("/config_editor", name="config_editor")
* @Method({"GET"})
*
* @return Response
*/
public function configEditorAction()
{
$moreButtonsInMaximizedMode = false;
if (api_get_setting('editor.more_buttons_maximized_mode') == 'true') {
$moreButtonsInMaximizedMode = true;
}
return $this->render('ChamiloCoreBundle:default/javascript/editor/ckeditor:config_js.html.twig', array('more_buttons_in_max_mode' => $moreButtonsInMaximizedMode, 'course_id' => '1', 'session_id' => '1'));
}
示例8: showCourses
/**
* Check whether to display the courses list
* @global array $_configuration Configuration
*
* @return boolean whether to display
*/
public static function showCourses()
{
$catalogShow = intval(api_get_setting('platform.catalog_show_courses_sessions'));
if ($catalogShow == CATALOG_COURSES || $catalogShow == CATALOG_COURSES_SESSIONS) {
return true;
}
return false;
}
示例9: validate_data
function validate_data($users)
{
global $defined_auth_sources;
$errors = array();
$usernames = array();
// 1. Check if mandatory fields are set.
$mandatory_fields = array('LastName', 'FirstName');
if (api_get_setting('registration', 'email') == 'true') {
$mandatory_fields[] = 'Email';
}
foreach ($users as $index => $user) {
foreach ($mandatory_fields as $field) {
if (empty($user[$field])) {
$user['error'] = get_lang($field . 'Mandatory');
$errors[] = $user;
}
}
// 2. Check username, first, check whether it is empty.
if (!UserManager::is_username_empty($user['UserName'])) {
// 2.1. Check whether username is too long.
if (UserManager::is_username_too_long($user['UserName'])) {
$user['error'] = get_lang('UserNameTooLong');
$errors[] = $user;
}
// 2.2. Check whether the username was used twice in import file.
if (isset($usernames[$user['UserName']])) {
$user['error'] = get_lang('UserNameUsedTwice');
$errors[] = $user;
}
$usernames[$user['UserName']] = 1;
// 2.3. Check whether username is allready occupied.
if (!UserManager::is_username_available($user['UserName'])) {
$user['error'] = get_lang('UserNameNotAvailable');
$errors[] = $user;
}
}
// 3. Check status.
if (isset($user['Status']) && !api_status_exists($user['Status'])) {
$user['error'] = get_lang('WrongStatus');
$errors[] = $user;
}
// 4. Check classname
if (!empty($user['ClassName'])) {
if (!ClassManager::class_name_exists($user['ClassName'])) {
$user['error'] = get_lang('ClassNameNotAvailable');
$errors[] = $user;
}
}
// 5. Check authentication source
if (!empty($user['AuthSource'])) {
if (!in_array($user['AuthSource'], $defined_auth_sources)) {
$user['error'] = get_lang('AuthSourceNotAvailable');
$errors[] = $user;
}
}
}
return $errors;
}
示例10: getConfig
/**
* Get the toolbar config
* @return array
*/
public function getConfig()
{
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
$config['toolbar'] = $this->getNormalToolbar();
} else {
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
}
return $config;
}
示例11: uninstall
/**
* Uninstall the plugin
* @return void
*/
public function uninstall()
{
$setting = api_get_setting('plugin_pens');
if (!empty($setting)) {
$this->uninstallHook();
// Note: Keeping area field data is intended so it will not be removed
$this->uninstallDatabase();
}
}
示例12: indexAction
/**
* @Route("/courses/{cidReq}/{sessionId}")
* @Method({"GET"})
*
* @param string $cidReq
* @param int $id_session
* @return Response
*/
public function indexAction($cidReq, $id_session = null)
{
$courseCode = api_get_course_id();
$sessionId = api_get_session_id();
$userId = $this->getUser()->getUserId();
$coursesAlreadyVisited = $this->getRequest()->getSession()->get('coursesAlreadyVisited');
$result = $this->autolaunch();
$showAutoLaunchLpWarning = $result['show_autolaunch_lp_warning'];
$showAutoLaunchExerciseWarning = $result['show_autolaunch_exercise_warning'];
if ($showAutoLaunchLpWarning) {
$this->getTemplate()->assign('lp_warning', Display::return_message(get_lang('TheLPAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificLP'), 'warning'));
}
if ($showAutoLaunchExerciseWarning) {
$this->getTemplate()->assign('exercise_warning', Display::return_message(get_lang('TheExerciseAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificExercise'), 'warning'));
}
if ($this->isCourseTeacher()) {
$editIcons = Display::url(Display::return_icon('edit.png'), $this->generateUrl('course_home.controller:iconListAction', array('course' => api_get_course_id())));
$this->getTemplate()->assign('edit_icons', $editIcons);
}
if (!isset($coursesAlreadyVisited[$courseCode])) {
event_access_course();
$coursesAlreadyVisited[$courseCode] = 1;
$this->getRequest()->getSession()->set('coursesAlreadyVisited', $coursesAlreadyVisited);
}
$this->getRequest()->getSession()->remove('toolgroup');
$this->getRequest()->getSession()->remove('_gid');
$isSpecialCourse = \CourseManager::is_special_course($courseCode);
if ($isSpecialCourse) {
$autoreg = $this->getRequest()->get('autoreg');
if ($autoreg == 1) {
\CourseManager::subscribe_user($userId, $courseCode, STUDENT);
}
}
$script = 'activity.php';
if (api_get_setting('homepage_view') == 'activity' || api_get_setting('homepage_view') == 'activity_big') {
$script = 'activity.php';
} elseif (api_get_setting('homepage_view') == '2column') {
$script = '2column.php';
} elseif (api_get_setting('homepage_view') == '3column') {
$script = '3column.php';
} elseif (api_get_setting('homepage_view') == 'vertical_activity') {
$script = 'vertical_activity.php';
}
$result = (require_once api_get_path(SYS_CODE_PATH) . 'course_home/' . $script);
$toolList = $result['tool_list'];
$this->getTemplate()->assign('icons', $result['content']);
$introduction = Display::return_introduction_section($this->get('url_generator'), TOOL_COURSE_HOMEPAGE, $toolList);
$this->getTemplate()->assign('introduction_text', $introduction);
if (api_get_setting('show_session_data') == 'true' && $sessionId) {
$sessionInfo = \CourseHome::show_session_data($sessionId);
$this->getTemplate()->assign('session_info', $sessionInfo);
}
$response = $this->get('template')->render_template($this->getTemplatePath() . 'index.tpl');
return new Response($response, 200, array());
}
示例13: wsConvertPpt
/**
* Function to convert from ppt to png
* This function is used from Chamilo Rapid Lesson
*
* @param array $pptData
* @return string
*/
function wsConvertPpt($pptData)
{
$fileData = $pptData['file_data'];
$dataInfo = pathinfo($pptData['file_name']);
$fileName = basename($pptData['file_name'], '.' . $dataInfo['extension']);
$fullFileName = $pptData['file_name'];
$tempArchivePath = api_get_path(SYS_ARCHIVE_PATH);
$tempPath = $tempArchivePath . 'wsConvert/' . $fileName . '/';
$tempPathNewFiles = $tempArchivePath . 'wsConvert/' . $fileName . '-n/';
$perms = api_get_permissions_for_new_directories();
if (!is_dir($tempPath)) {
mkdir($tempPath, $perms, true);
}
if (!is_dir($tempPathNewFiles)) {
mkdir($tempPathNewFiles, $perms, true);
}
if (!is_dir($tempPathNewFiles . $fileName)) {
mkdir($tempPathNewFiles . $fileName, $perms, true);
}
$file = base64_decode($fileData);
file_put_contents($tempPath . $fullFileName, $file);
if (IS_WINDOWS_OS) {
// IS_WINDOWS_OS has been defined in main_api.lib.php
$converterPath = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png');
$classPath = $converterPath . ';' . $converterPath . '/jodconverter-2.2.2.jar;' . $converterPath . '/jodconverter-cli-2.2.2.jar';
$cmd = 'java -Dfile.encoding=UTF-8 -cp "' . $classPath . '" DokeosConverter';
} else {
$converterPath = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png';
$classPath = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar';
$cmd = 'cd ' . $converterPath . ' && java ' . $classPath . ' DokeosConverter';
}
$cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port');
$cmd .= ' -w 720 -h 540 -d oogie "' . $tempPath . $fullFileName . '" "' . $tempPathNewFiles . $fileName . '.html"';
$perms = api_get_permissions_for_new_files();
chmod($tempPathNewFiles . $fileName, $perms, true);
$files = array();
$return = 0;
$shell = exec($cmd, $files, $return);
if ($return === 0) {
$images = array();
foreach ($files as $file) {
$imageData = explode('||', $file);
$images[$imageData[1]] = base64_encode(file_get_contents($tempPathNewFiles . $fileName . '/' . $imageData[1]));
}
$data = array('files' => $files, 'images' => $images);
deleteDirectory($tempPath);
deleteDirectory($tempPathNewFiles);
return serialize($data);
} else {
deleteDirectory($tempPath);
deleteDirectory($tempPathNewFiles);
return false;
}
}
示例14: __construct
/**
*
*/
public function __construct()
{
$this->table = Database::get_main_table(TABLE_NOTIFICATION);
$this->sender_email = api_get_setting('noreply_email_address');
$this->sender_name = api_get_setting('siteName');
// If no-reply email doesn't exist use the admin email
if (empty($this->sender_email)) {
$this->sender_email = api_get_setting('emailAdministrator');
$this->sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
}
}
示例15: process
public function process() {
$results = array();
foreach ($this->links as $courseid => $one_course_links) {
$course_info = api_get_course_info($courseid);
$search_show_unlinked_results = (api_get_setting('search_show_unlinked_results') == 'true');
$course_visible_for_user = api_is_course_visible_for_user(NULL, $courseid);
// can view course?
if ($course_visible_for_user || $search_show_unlinked_results) {
$result = NULL;
foreach ($one_course_links['links'] as $one_link) {
// is visible?
$visibility = api_get_item_visibility($course_info, TOOL_LINK, $one_link['link_id']);
if ($visibility) {
// if one is visible let show the result for a course
// also asume all data of this item like the data of the whole group of links(Ex. author)
list($thumbnail, $image, $name, $author, $url) = $this->get_information($courseid, $one_link['link_id']);
$result_tmp = array(
'toolid' => TOOL_LINK,
'score' => $one_course_links['total_score'] / (count($one_course_links) - 1), // not count total_score array item
'url' => $url,
'thumbnail' => $thumbnail,
'image' => $image,
'title' => $name,
'author' => $author,
);
if ($course_visible_for_user) {
$result = $result_tmp;
} else { // course not visible for user
if ($search_show_unlinked_results) {
$result_tmp['url'] = '';
$result = $result_tmp;
}
}
break;
}
}
if (!is_null($result)) {
// if there is at least one link item found show link to course Links tool page
$results[] = $result;
}
}
}
// get information to sort
foreach ($results as $key => $row) {
$score[$key] = $row['score'];
}
// Sort results with score descending
array_multisort($score, SORT_DESC, $results);
return $results;
}