From a3279f92173087710ae18c9e2933b2c01b92a832 Mon Sep 17 00:00:00 2001 From: Julio Date: Mon, 25 Jul 2016 10:04:48 +0200 Subject: [PATCH] Adding ChamiloApi --- main/admin/configure_extensions.php | 11 ++-- main/inc/global.inc.php | 2 +- main/inc/lib/api.lib.php | 20 ------- main/upload/upload_ppt.php | 6 ++- .../CoreBundle/Component/Utils/ChamiloApi.php | 53 +++++++++++++++++++ 5 files changed, 65 insertions(+), 27 deletions(-) create mode 100644 src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php diff --git a/main/admin/configure_extensions.php b/main/admin/configure_extensions.php index a84e759a5f..cbe4202c82 100755 --- a/main/admin/configure_extensions.php +++ b/main/admin/configure_extensions.php @@ -1,14 +1,17 @@ 'index.php', 'name' => get_lang('PlatformAdmin')); +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); // Database Table Definitions $tbl_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); $message = ''; @@ -314,7 +317,7 @@ Display::display_header($nameTool); //$form -> addElement('html','

'); $form -> addElement('text', 'path_to_lzx', get_lang('PathToLzx')); //$form -> addElement('html','

'); - $options = api_get_document_conversion_sizes(); + $options = ChamiloApi::getDocumentConversionSizes(); $form -> addElement('select', 'size', get_lang('SlideSize'), $options); diff --git a/main/inc/global.inc.php b/main/inc/global.inc.php index 7eec09dd2f..3420ee250e 100755 --- a/main/inc/global.inc.php +++ b/main/inc/global.inc.php @@ -64,7 +64,7 @@ if (!isset($GLOBALS['_configuration'])) { require_once $_configuration['root_sys'].'main/inc/lib/api.lib.php'; $passwordEncryption = api_get_configuration_value('password_encryption'); -if ($passwordEncryption == 'bcrypt') { +if ($passwordEncryption === 'bcrypt') { require_once __DIR__.'/../../vendor/ircmaxell/password-compat/lib/password.php'; } diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index 40ed3f26f4..35b033329f 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -7997,23 +7997,3 @@ function api_protect_limit_for_session_admin() function api_is_student_view_active() { return (isset($_SESSION['studentview']) && $_SESSION['studentview'] == "studentview"); } - -/** - * Returns an array of resolutions that can be used for the conversion of documents to images - * @return array - */ -function api_get_document_conversion_sizes() -{ - return array( - '540x405'=>'540x405 (3/4)', - '640x480'=>'640x480 (3/4)', - '720x540'=>'720x540 (3/4)', - '800x600'=>'800x600 (3/4)', - '1024x576'=>'1024x576 (16/9)', - '1024x768'=>'1000x750 (3/4)', - '1280x720'=>'1280x720 (16/9)', - '1280x860'=>'1280x960 (3/4)', - '1400x1050'=>'1400x1050 (3/4)', - '1600x900'=>'1600x900 (16/9)' - ); -} \ No newline at end of file diff --git a/main/upload/upload_ppt.php b/main/upload/upload_ppt.php index 01ccfaf98a..9c457bfdea 100755 --- a/main/upload/upload_ppt.php +++ b/main/upload/upload_ppt.php @@ -1,5 +1,7 @@ addElement('header', get_lang("WelcomeOogieSubtitle")); $form->addElement('html', Display::return_message($message, 'info', false)); $form->addElement('file', 'user_file', array(Display::return_icon('powerpoint_big.gif'), $div_upload_limit)); $form->addElement('checkbox', 'take_slide_name', '', get_lang('TakeSlideName')); -$options = api_get_document_conversion_sizes(); +$options = ChamiloApi::getDocumentConversionSizes(); $form->addElement('select', 'slide_size', get_lang('SlideSize'), $options); -if (api_get_setting('search_enabled') == 'true') { +if (api_get_setting('search_enabled') === 'true') { require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'); $specific_fields = get_specific_field_list(); $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument')); diff --git a/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php b/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php new file mode 100644 index 0000000000..e47a1595e0 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php @@ -0,0 +1,53 @@ +configuration = $configuration; + } + + /** + * @return ChamiloApi|null + */ + public function getInstance($configuration = null) + { + if (is_null(self::$instance)) { + self::$instance = new ChamiloApi($configuration); + } + + return self::$instance; + } + + /** + * Returns an array of resolutions that can be used for the conversion of documents to images + * @return array + */ + public static function getDocumentConversionSizes() + { + return array( + '540x405' => '540x405 (3/4)', + '640x480' => '640x480 (3/4)', + '720x540' => '720x540 (3/4)', + '800x600' => '800x600 (3/4)', + '1024x576' => '1024x576 (16/9)', + '1024x768' => '1000x750 (3/4)', + '1280x720' => '1280x720 (16/9)', + '1280x860' => '1280x960 (3/4)', + '1400x1050' => '1400x1050 (3/4)', + '1600x900' => '1600x900 (16/9)', + ); + } + + +}