diff --git a/.htaccess b/.htaccess index b488d37009..02f247bf80 100644 --- a/.htaccess +++ b/.htaccess @@ -45,3 +45,8 @@ RewriteRule ^badge/(\d{1,}) main/badge/issued.php?issue=$1 [L] RewriteRule ^skill/(\d{1,})/user/(\d{1,}) main/badge/issued_all.php?skill=$1&user=$2 [L] # Support deprecated URL (avoid 404) RewriteRule ^badge/(\d{1,})/user/(\d{1,}) main/badge/issued_all.php?skill=$1&user=$2 [L] + +# Support old URLs using the exercice (with a c) folder rather than exercise +RewriteRule ^main/exercice/(.*)$ main/exercise/$1 [QSA,L] +# Support old URLs using the newscorm folder rather than lp +RewriteRule ^main/newscorm/(.*)$ main/lp/$1 [QSA,L] diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 56f6bfe3bf..1a8701c1a3 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -3,6 +3,7 @@ # Chamilo includes but that we cannot update without patching upstream. build: environment: + mysql: 5.5 php: version: 5.6.0 ini: @@ -11,8 +12,10 @@ build: hosts: my.chamilodev.net: '127.0.0.1' dependencies: + override: + - true before: - - php -d memory_limit=-1 /usr/local/bin/composer -v update + - php -d memory_limit=2G /usr/bin/composer.phar -v update filter: excluded_paths: - tests/* @@ -27,18 +30,18 @@ filter: - main/inc/lib/browser/* - main/inc/lib/elfinder/* - main/inc/lib/freemindflashbrowser/* - - main/inc/lib/kses-0.2.2 - - main/inc/lib/mimetex - - main/inc/lib/nanogong - - main/inc/lib/pclzip - - main/inc/lib/pear - - main/inc/lib/phpmailer - - main/inc/lib/phpseclib - - main/inc/lib/svg-edit - - main/inc/lib/swfobject - - main/inc/lib/wami-recorder - - main/inc/lib/xajax - - main/auth/cas/lib/CAS + - main/inc/lib/kses-0.2.2/* + - main/inc/lib/mimetex/* + - main/inc/lib/nanogong/* + - main/inc/lib/pclzip/* + - main/inc/lib/pear/* + - main/inc/lib/phpmailer/* + - main/inc/lib/phpseclib/* + - main/inc/lib/svg-edit/* + - main/inc/lib/swfobject/* + - main/inc/lib/wami-recorder/* + - main/inc/lib/xajax/* + - main/auth/cas/lib/CAS/* checks: php: code_rating: true diff --git a/.travis.yml b/.travis.yml index e4bcacdd95..c1ec855ef8 100755 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,18 @@ before_install: - sudo apt-get update -qq - sudo apt-get install -qq mysql-server - sudo apt-get install -qq apache2 libapache2-mod-fastcgi + # enable php-fpm + - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf + - sudo a2enmod rewrite actions fastcgi alias + - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - echo "memory_limit = 2G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - echo "phar.readonly = 0" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - echo "date.timezone = Europe/Paris" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm + # configure apache virtual hosts + - sudo cp -f tests/travis-apache /etc/apache2/sites-available/default + - sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default + - sudo service apache2 restart # Install additional PHP packages (check http://docs.travis-ci.com/user/ci-environment/#CI-environment-OS # for pre-installed packages) #- sudo apt-get install -qq php5-imagick @@ -19,12 +31,12 @@ before_install: # php is compiled with --enable-fpm, so no install of FPM is needed. # However, not installing it generates errors with service php5-fpm restart # further down (need to use php-fpm without 5) - - sudo apt-get install -qq php5-cli php5-fpm + #- sudo apt-get install -qq php5-cli php5-fpm before_script: - - php5 -v - - php5 -m - - composer self-update + #- which composer + #- php -d memory_limit=2G /usr/bin/composer update + #- php -d memory_limit=2G /home/travis/.phpenv/shims/composer update # Previously, fxp/composer-asset-plugin was required but was causing a lot of trouble updating. Now it's disabled. #- composer global require "fxp/composer-asset-plugin:1.0.3" # You can either use the composer install method and face the Github limit @@ -43,23 +55,14 @@ before_script: # Continue... - phpenv config-add tests/travis-php-config.ini # enable php-fpm - - sudo /etc/init.d/php5-fpm stop - - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf - - sudo a2enmod rewrite actions fastcgi alias - - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm # configure apache virtual hosts - - sudo cp -f tests/travis-apache /etc/apache2/sites-available/default - - sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default - - sudo service apache2 restart - - sudo service php5-fpm restart - - php5 -v + - php -v # install Chash, a database, and then install Chamilo - git clone https://github.com/chamilo/chash - cd chash - composer install - composer update - - php5 -d phar.readonly=0 createPhar.php + - php -d phar.readonly=0 createPhar.php - chmod +x chash.phar - sudo mv chash.phar /usr/local/bin/chash #- cd .. @@ -74,7 +77,7 @@ before_script: - cd /home/travis/build/chamilo/chamilo-lms # There's an issue with Chash, starting in version 1.10, whereby PHP CLI on Travis-ci is PHP5.3, whatever the version you ask for. # This effectively breaks the installer and renders these tests useless. We are looking for a solution (for example using containers) - - sudo chash chash:chamilo_install --no-interaction --sitename="Chamilo" --site_url="http://localhost/" --institution="Chamilo" --institution_url="https://chamilo.org" --encrypt_method="sha1" --firstname="John" --lastname="Doe" --language="english" --driver="mysqlnd" --host="localhost" --port="3306" --dbname="chamilo" --dbuser="root" --permissions_for_new_directories="0777" --permissions_for_new_files="0666" --linux-user="www-data" --linux-group="www-data" --username="admin" --password="admin" --email="admin@example.com" --phone="555-5555" 1.10.x + - sudo chash chash:chamilo_install --no-interaction --sitename="Chamilo" --site_url="http://localhost/" --institution="Chamilo" --institution_url="https://chamilo.org" --encrypt_method="sha1" --firstname="John" --lastname="Doe" --language="english" --driver="pdo_mysql" --host="localhost" --port="3306" --dbname="chamilo" --dbuser="root" --permissions_for_new_directories="0777" --permissions_for_new_files="0666" --linux-user="www-data" --linux-group="www-data" --username="admin" --password="admin" --email="admin@example.com" --phone="555-5555" 1.10.x script: # - phpunit -c tests/phpunit diff --git a/README.md b/README.md index d874f363a2..b0915ad82c 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ php bin/doctrine.php migrations:execute 20150527120703 --up --configuration=app/ You can also print the differences between your database and what it should be by issuing the following command from the Chamilo base folder: ``` -php bin/doctrine.php orm:schema:update --dump-sql +php bin/doctrine.php orm:schema-tool:update --dump-sql ``` ## Contributing diff --git a/app/Migrations/Schema/V111/Version111.php b/app/Migrations/Schema/V111/Version111.php index a4db353595..965b2773ef 100644 --- a/app/Migrations/Schema/V111/Version111.php +++ b/app/Migrations/Schema/V111/Version111.php @@ -288,6 +288,10 @@ class Version111 extends AbstractMigrationChamilo $this->addSql('ALTER TABLE user ADD profile_completed TINYINT(1) DEFAULT NULL;'); $this->addSql('ALTER TABLE extra_field_options CHANGE display_text display_text VARCHAR(255) DEFAULT NULL'); $this->addSql('ALTER TABLE extra_field CHANGE variable variable VARCHAR(255) NOT NULL'); + + if (!$schema->hasTable('version')) { + $this->addSql('CREATE TABLE version (version varchar(255), PRIMARY KEY(version));'); + } } /** diff --git a/app/Migrations/Schema/V111/Version20160610142700.php b/app/Migrations/Schema/V111/Version20160610142700.php new file mode 100644 index 0000000000..d89ba8c733 --- /dev/null +++ b/app/Migrations/Schema/V111/Version20160610142700.php @@ -0,0 +1,92 @@ +connection + ->executeQuery(" + SELECT id FROM extra_field + WHERE variable = 'skype' AND extra_field_type = 1 + ") + ->fetchAll(); + + if (empty($dataList)) { + $this->addSql(" + INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, created_at) + VALUES (1, 1, 'skype', 'Skype', 1, 1, now()) + "); + } + + $this->addSql(" + INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, created_at) + VALUES (1, 1, 'linkedin_url', 'LinkedInUrl', 1, 1, now()) + "); + + $this->addSettingCurrent( + 'allow_show_skype_account', + null, + 'radio', + 'Platform', + 'true', + 'AllowShowSkypeAccountTitle', + 'AllowShowSkypeAccountComment', + null, + null, + 1, + true, + false, + [ + ['value' => 'false', 'text' => 'No'], + ['value' => 'true', 'text' => 'Yes'] + ] + ); + + $this->addSettingCurrent( + 'allow_show_linkedin_url', + null, + 'radio', + 'Platform', + 'true', + 'AllowShowLinkedInUrlTitle', + 'AllowShowLinkedInUrlComment', + null, + null, + 1, + true, + false, + [ + ['value' => 'false', 'text' => 'No'], + ['value' => 'true', 'text' => 'Yes'] + ] + ); + } + + /** + * @param Schema $schema + * @throws \Doctrine\DBAL\DBALException + * @throws \Doctrine\DBAL\Schema\SchemaException + */ + public function down(Schema $schema) + { + + } +} \ No newline at end of file diff --git a/app/Migrations/Schema/V111/Version20160623143200.php b/app/Migrations/Schema/V111/Version20160623143200.php new file mode 100644 index 0000000000..fb62902722 --- /dev/null +++ b/app/Migrations/Schema/V111/Version20160623143200.php @@ -0,0 +1,36 @@ +getTable('user') + ->dropColumn('chatcall_user_id') + ->dropColumn('chatcall_date') + ->dropColumn('chatcall_text'); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + } +} \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/CHANGELOG.md b/app/Resources/public/assets/ckeditor/plugins/scayt/CHANGELOG.md index d956208b3f..05cf2ddc7e 100644 --- a/app/Resources/public/assets/ckeditor/plugins/scayt/CHANGELOG.md +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/CHANGELOG.md @@ -1,20 +1,20 @@ -SCAYT plugin for CKEditor 4 Changelog -==================== -### CKEditor 4.5.6 - -New Features: -* CKEditor [language addon](http://ckeditor.com/addon/language) support -* CKEditor [placeholder addon](http://ckeditor.com/addon/placeholder) support -* Drag and Drop support -* *Experimental* GRAYT functionality http://www.webspellchecker.net/samples/scayt-ckeditor-plugin.html#25 - -Fixed issues: -* [#98](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/98) SCAYT Affects Dialog Double Click. Fixed in SCAYT Core. -* [#102](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/102) SCAYT Core performance enhancements -* [#104](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/104) SCAYT's spans leak into the clipboard and after pasting -* [#105](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/105) Javascript error fired in case of multiple instances of CKEditor in one page -* [#107](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/107) SCAYT should not check non-editable parts of content -* [#108](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/108) Latest SCAYT copies id of editor element to the iframe -* SCAYT stops working when CKEditor Undo plug-in not enabled -* Issue with pasting SCAYT markup in CKEditor -* [#32](https://github.com/WebSpellChecker/ckeditor-plugin-wsc/issues/32) SCAYT stops working after pressing Cancel button in WSC dialog +SCAYT plugin for CKEditor 4 Changelog +==================== +### CKEditor 4.5.6 + +New Features: +* CKEditor [language addon](http://ckeditor.com/addon/language) support +* CKEditor [placeholder addon](http://ckeditor.com/addon/placeholder) support +* Drag and Drop support +* *Experimental* GRAYT functionality http://www.webspellchecker.net/samples/scayt-ckeditor-plugin.html#25 + +Fixed issues: +* [#98](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/98) SCAYT Affects Dialog Double Click. Fixed in SCAYT Core. +* [#102](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/102) SCAYT Core performance enhancements +* [#104](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/104) SCAYT's spans leak into the clipboard and after pasting +* [#105](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/105) Javascript error fired in case of multiple instances of CKEditor in one page +* [#107](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/107) SCAYT should not check non-editable parts of content +* [#108](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/108) Latest SCAYT copies id of editor element to the iframe +* SCAYT stops working when CKEditor Undo plug-in not enabled +* Issue with pasting SCAYT markup in CKEditor +* [#32](https://github.com/WebSpellChecker/ckeditor-plugin-wsc/issues/32) SCAYT stops working after pressing Cancel button in WSC dialog diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/LICENSE.md b/app/Resources/public/assets/ckeditor/plugins/scayt/LICENSE.md index 844ab4de0b..610c807808 100644 --- a/app/Resources/public/assets/ckeditor/plugins/scayt/LICENSE.md +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/LICENSE.md @@ -1,28 +1,28 @@ -Software License Agreement -========================== - -**CKEditor SCAYT Plugin** -Copyright © 2012, [CKSource](http://cksource.com) - Frederico Knabben. All rights reserved. - -Licensed under the terms of any of the following licenses at your choice: - -* GNU General Public License Version 2 or later (the "GPL"): - http://www.gnu.org/licenses/gpl.html - -* GNU Lesser General Public License Version 2.1 or later (the "LGPL"): - http://www.gnu.org/licenses/lgpl.html - -* Mozilla Public License Version 1.1 or later (the "MPL"): - http://www.mozilla.org/MPL/MPL-1.1.html - -You are not required to, but if you want to explicitly declare the license you have chosen to be bound to when using, reproducing, modifying and distributing this software, just include a text file titled "legal.txt" in your version of this software, indicating your license choice. - -Sources of Intellectual Property Included in this plugin --------------------------------------------------------- - -Where not otherwise indicated, all plugin content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, the plugin will incorporate work done by developers outside of CKSource with their express permission. - -Trademarks ----------- - -CKEditor is a trademark of CKSource - Frederico Knabben. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders. +Software License Agreement +========================== + +**CKEditor SCAYT Plugin** +Copyright © 2012, [CKSource](http://cksource.com) - Frederico Knabben. All rights reserved. + +Licensed under the terms of any of the following licenses at your choice: + +* GNU General Public License Version 2 or later (the "GPL"): + http://www.gnu.org/licenses/gpl.html + +* GNU Lesser General Public License Version 2.1 or later (the "LGPL"): + http://www.gnu.org/licenses/lgpl.html + +* Mozilla Public License Version 1.1 or later (the "MPL"): + http://www.mozilla.org/MPL/MPL-1.1.html + +You are not required to, but if you want to explicitly declare the license you have chosen to be bound to when using, reproducing, modifying and distributing this software, just include a text file titled "legal.txt" in your version of this software, indicating your license choice. + +Sources of Intellectual Property Included in this plugin +-------------------------------------------------------- + +Where not otherwise indicated, all plugin content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, the plugin will incorporate work done by developers outside of CKSource with their express permission. + +Trademarks +---------- + +CKEditor is a trademark of CKSource - Frederico Knabben. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders. diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/README.md b/app/Resources/public/assets/ckeditor/plugins/scayt/README.md new file mode 100644 index 0000000000..ac94ab09be --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/README.md @@ -0,0 +1,25 @@ +CKEditor SCAYT Plugin +===================== + +This plugin brings Spell Check As You Type (SCAYT) into up to CKEditor 4+. + +SCAYT is a "installation-less", using the web-services of [WebSpellChecker.net](http://www.webspellchecker.net/). It's an out of the box solution. + +Installation +------------ + +1. Clone/copy this repository contents in a new "plugins/scayt" folder in your CKEditor installation. +2. Enable the "scayt" plugin in the CKEditor configuration file (config.js): + + config.extraPlugins = 'scayt'; + +That's all. SCAYT will appear on the editor toolbar and will be ready to use. + +License +------- + +Licensed under the terms of any of the following licenses at your choice: [GPL](http://www.gnu.org/licenses/gpl.html), [LGPL](http://www.gnu.org/licenses/lgpl.html) and [MPL](http://www.mozilla.org/MPL/MPL-1.1.html). + +See LICENSE.md for more information. + +Developed in cooperation with [WebSpellChecker.net](http://www.webspellchecker.net/). diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/dialogs/options.js b/app/Resources/public/assets/ckeditor/plugins/scayt/dialogs/options.js index 12dbfd132d..a82e7c3797 100644 --- a/app/Resources/public/assets/ckeditor/plugins/scayt/dialogs/options.js +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/dialogs/options.js @@ -1,19 +1,573 @@ -CKEDITOR.dialog.add("scaytDialog",function(c){var f=c.scayt,q='\x3cp\x3e\x3cimg src\x3d"'+f.getLogo()+'" /\x3e\x3c/p\x3e\x3cp\x3e'+f.getLocal("version")+f.getVersion()+"\x3c/p\x3e\x3cp\x3e"+f.getLocal("text_copyrights")+"\x3c/p\x3e",r=CKEDITOR.document,n={isChanged:function(){return null===this.newLang||this.currentLang===this.newLang?!1:!0},currentLang:f.getLang(),newLang:null,reset:function(){this.currentLang=f.getLang();this.newLang=null},id:"lang"},q=[{id:"options",label:f.getLocal("tab_options"), -onShow:function(){},elements:[{type:"vbox",id:"scaytOptions",children:function(){var a=f.getApplicationConfig(),b=[],g={"ignore-all-caps-words":"label_allCaps","ignore-domain-names":"label_ignoreDomainNames","ignore-words-with-mixed-cases":"label_mixedCase","ignore-words-with-numbers":"label_mixedWithDigits"},e;for(e in a)a={type:"checkbox"},a.id=e,a.label=f.getLocal(g[e]),b.push(a);return b}(),onShow:function(){this.getChild();for(var a=c.scayt,b=0;bb[1]?c=1:a[1]

' + + '

' + scayt_instance.getLocal('version') + scayt_instance.getVersion() + '

' + + '

' + scayt_instance.getLocal('text_copyrights') + '

'; + + var doc = CKEDITOR.document; + + var optionGenerator = function() { + var scayt_instance_ = editor.scayt, + applicationConfig = scayt_instance.getApplicationConfig(), + optionArrayUiCheckboxes = [], + optionLocalizationList = { + "ignore-all-caps-words" : "label_allCaps", + "ignore-domain-names" : "label_ignoreDomainNames", + "ignore-words-with-mixed-cases" : "label_mixedCase", + "ignore-words-with-numbers" : "label_mixedWithDigits" + }; + + for(var option in applicationConfig) { + + var checkboxConfig = { + type: "checkbox" + }; + + checkboxConfig.id = option; + checkboxConfig.label = scayt_instance.getLocal(optionLocalizationList[option]); + + optionArrayUiCheckboxes.push(checkboxConfig); + } + + return optionArrayUiCheckboxes; + }; + + var languageModelState = { + isChanged : function() { + return (this.newLang === null || this.currentLang === this.newLang) ? false : true; + }, + currentLang: scayt_instance.getLang(), + newLang: null, + reset: function() { + this.currentLang = scayt_instance.getLang(); + this.newLang = null; + }, + id: 'lang' + }; + + var generateDialogTabs = function(tabsList, editor) { + var tabs = [], + uiTabs = editor.config.scayt_uiTabs; + + if(!uiTabs) { + return tabsList; + } else { + for(var i in uiTabs) { + (uiTabs[i] == 1) && tabs.push(tabsList[i]); + } + + tabs.push(tabsList[tabsList.length - 1]); + } + + return tabs; + }; + + var dialogTabs = [{ + id : 'options', + label : scayt_instance.getLocal('tab_options'), + onShow: function() { + // console.log("tab show"); + }, + elements : [ + { + type: 'vbox', + id: 'scaytOptions', + children: optionGenerator(), + onShow: function() { + var optionsTab = this.getChild(), + scayt_instance = editor.scayt; + for(var i = 0; i < this.getChild().length; i++) { + this.getChild()[i].setValue(scayt_instance.getApplicationConfig()[this.getChild()[i].id]); + } + + } + } + + ] + }, + { + id : 'langs', + label : scayt_instance.getLocal('tab_languages'), + elements : [ + { + id: "leftLangColumn", + type: 'vbox', + align: 'left', + widths: ['100'], + children: [ + { + type: 'html', + id: 'langBox', + style: 'overflow: hidden; white-space: normal;margin-bottom:15px;', + html: '
', + onShow: function() { + var scayt_instance = editor.scayt; + var lang = scayt_instance.getLang(), + prefix_id = "scaytLang_", + radio = doc.getById(prefix_id + editor.name + '_' + lang); + + radio.$.checked = true; + } + }, + { + type: 'html', + id: 'graytLanguagesHint', + html: '
- This languages are supported by Grammar As You Type(GRAYT).
', + onShow: function() { + var graytLanguagesHint = doc.getById(editor.name + 'graytLanguagesHint'); + + if (!editor.config.grayt_autoStartup) { + graytLanguagesHint.$.style.display = 'none'; + } + } + } + ] + } + ] + }, + { + id : 'dictionaries', + label : scayt_instance.getLocal('tab_dictionaries'), + elements : [ + { + type: 'vbox', + id: 'rightCol_col__left', + children: [ + { + type: 'html', + id: 'dictionaryNote', + html: '' + }, + { + type: 'text', + id: 'dictionaryName', + label: scayt_instance.getLocal('label_fieldNameDic') || 'Dictionary name', + onShow: function(data) { + var dialog = data.sender, + scayt_instance = editor.scayt; + + // IE7 specific fix + setTimeout(function() { + // clear dictionaryNote field + dialog.getContentElement("dictionaries", "dictionaryNote").getElement().setText(''); + + // restore/clear dictionaryName field + if(scayt_instance.getUserDictionaryName() != null && scayt_instance.getUserDictionaryName() != '') { + dialog.getContentElement("dictionaries", "dictionaryName").setValue(scayt_instance.getUserDictionaryName()); + } + }, 0); + } + }, + { + type: 'hbox', + id: 'notExistDic', + align: 'left', + style: 'width:auto;', + widths: [ '50%', '50%' ], + children: [ + { + type: 'button', + id: 'createDic', + label: scayt_instance.getLocal('btn_createDic'), + title: scayt_instance.getLocal('btn_createDic'), + onClick: function() { + var dialog = this.getDialog(), + self = dialogDefinition, + scayt_instance = editor.scayt, + name = dialog.getContentElement("dictionaries", "dictionaryName").getValue(); + + scayt_instance.createUserDictionary(name, function(response) { + if(!response.error) { + self.toggleDictionaryButtons.call(dialog, true); + } + response.dialog = dialog; + response.command = "create"; + response.name = name; + editor.fire("scaytUserDictionaryAction", response); + }, function(error) { + error.dialog = dialog; + error.command = "create"; + error.name = name; + editor.fire("scaytUserDictionaryActionError", error); + }); + } + }, + { + type: 'button', + id: 'restoreDic', + label: scayt_instance.getLocal('btn_restoreDic'), + title: scayt_instance.getLocal('btn_restoreDic'), + onClick: function() { + var dialog = this.getDialog(), + scayt_instance = editor.scayt, + self = dialogDefinition, + name = dialog.getContentElement("dictionaries", "dictionaryName").getValue(); + + scayt_instance.restoreUserDictionary(name, function(response) { + response.dialog = dialog; + if(!response.error) { + self.toggleDictionaryButtons.call(dialog, true); + } + response.command = "restore"; + response.name = name; + editor.fire("scaytUserDictionaryAction", response); + }, function(error) { + error.dialog = dialog; + error.command = "restore"; + error.name = name; + editor.fire("scaytUserDictionaryActionError", error); + }); + } + } + ] + }, + { + type: 'hbox', + id: 'existDic', + align: 'left', + style: 'width:auto;', + widths: [ '50%', '50%' ], + children: [ + { + type: 'button', + id: 'removeDic', + label: scayt_instance.getLocal('btn_deleteDic'), + title: scayt_instance.getLocal('btn_deleteDic'), + onClick: function() { + var dialog = this.getDialog(), + scayt_instance = editor.scayt, + self = dialogDefinition, + dictionaryNameField = dialog.getContentElement("dictionaries", "dictionaryName"), + name = dictionaryNameField.getValue(); + + scayt_instance.removeUserDictionary(name, function(response) { + dictionaryNameField.setValue(""); + if(!response.error) { + self.toggleDictionaryButtons.call(dialog, false); + } + response.dialog = dialog; + response.command = "remove"; + response.name = name; + editor.fire("scaytUserDictionaryAction", response); + }, function(error) { + error.dialog = dialog; + error.command = "remove"; + error.name = name; + editor.fire("scaytUserDictionaryActionError", error); + }); + } + }, + { + type: 'button', + id: 'renameDic', + label: scayt_instance.getLocal('btn_renameDic'), + title: scayt_instance.getLocal('btn_renameDic'), + onClick: function() { + var dialog = this.getDialog(), + scayt_instance = editor.scayt, + name = dialog.getContentElement("dictionaries", "dictionaryName").getValue(); + + scayt_instance.renameUserDictionary(name, function(response) { + response.dialog = dialog; + response.command = "rename"; + response.name = name; + editor.fire("scaytUserDictionaryAction", response); + }, function(error) { + error.dialog = dialog; + error.command = "rename"; + error.name = name; + editor.fire("scaytUserDictionaryActionError", error); + }); + } + } + ] + }, + { + type: 'html', + id: 'dicInfo', + html: '
' + scayt_instance.getLocal('text_descriptionDic') + '
' + } + ] + } + ] + }, + { + id : 'about', + label : scayt_instance.getLocal('tab_about'), + elements : [ + { + type : 'html', + id : 'about', + style : 'margin: 5px 5px;', + html : '
' + + aboutTabDefinition + + '
' + } + ] + }]; + + editor.on("scaytUserDictionaryAction", function(event) { + var UILib = SCAYT.prototype.UILib, + dialog = event.data.dialog, + dictionaryNote = dialog.getContentElement("dictionaries", "dictionaryNote").getElement(), + scayt_instance = event.editor.scayt, + messageTemplate; + + if(event.data.error === undefined) { + + // success message + messageTemplate = scayt_instance.getLocal("message_success_" + event.data.command + "Dic"); + messageTemplate = messageTemplate.replace('%s', event.data.name); + dictionaryNote.setText(messageTemplate); + UILib.css(dictionaryNote.$, {color: 'blue'}); + } else { + + // error message + if(event.data.name === '') { + + // empty dictionary name + dictionaryNote.setText(scayt_instance.getLocal('message_info_emptyDic')); + } else { + messageTemplate = scayt_instance.getLocal("message_error_" + event.data.command + "Dic"); + messageTemplate = messageTemplate.replace('%s', event.data.name); + dictionaryNote.setText(messageTemplate); + } + UILib.css(dictionaryNote.$, {color: 'red'}); + + if(scayt_instance.getUserDictionaryName() != null && scayt_instance.getUserDictionaryName() != '') { + dialog.getContentElement("dictionaries", "dictionaryName").setValue(scayt_instance.getUserDictionaryName()); + } else { + dialog.getContentElement("dictionaries", "dictionaryName").setValue(""); + } + } + }); + + editor.on("scaytUserDictionaryActionError", function(event) { + var UILib = SCAYT.prototype.UILib, + dialog = event.data.dialog, + dictionaryNote = dialog.getContentElement("dictionaries", "dictionaryNote").getElement(), + scayt_instance = event.editor.scayt, + messageTemplate; + + if(event.data.name === '') { + + // empty dictionary name + dictionaryNote.setText(scayt_instance.getLocal('message_info_emptyDic')); + } else { + messageTemplate = scayt_instance.getLocal("message_error_" + event.data.command + "Dic"); + messageTemplate = messageTemplate.replace('%s', event.data.name); + dictionaryNote.setText(messageTemplate); + } + UILib.css(dictionaryNote.$, {color: 'red'}); + + + if(scayt_instance.getUserDictionaryName() != null && scayt_instance.getUserDictionaryName() != '') { + dialog.getContentElement("dictionaries", "dictionaryName").setValue(scayt_instance.getUserDictionaryName()); + } else { + dialog.getContentElement("dictionaries", "dictionaryName").setValue(""); + } + + }); + + var plugin = CKEDITOR.plugins.scayt; + + var dialogDefinition = { + title: scayt_instance.getLocal('text_title'), + resizable: CKEDITOR.DIALOG_RESIZE_BOTH, + minWidth: 340, + minHeight: 260, + onLoad: function() { + if(editor.config.scayt_uiTabs[1] == 0) { + return; + } + + var dialog = this, + self = dialogDefinition, + langBoxes = self.getLangBoxes.call(dialog); + + langBoxes.getParent().setStyle("white-space", "normal"); + + //dialog.data = editor.fire( 'scaytDialog', {} ); + self.renderLangList(langBoxes); + + var scayt_instance = editor.scayt; + + this.definition.minWidth = this.getSize().width; + this.resize(this.definition.minWidth, this.definition.minHeight); + }, + onCancel: function() { + languageModelState.reset(); + }, + onHide: function() { + editor.unlockSelection(); + }, + onShow: function() { + editor.fire("scaytDialogShown", this); + + if(editor.config.scayt_uiTabs[2] == 0) { + return; + } + + var scayt_instance = editor.scayt, + self = dialogDefinition, + dialog = this, + dictionaryNameField = dialog.getContentElement("dictionaries", "dictionaryName"), + existance = dialog.getContentElement("dictionaries", "existDic").getElement().getParent(), + notExistance = dialog.getContentElement("dictionaries", "notExistDic").getElement().getParent(); + + existance.hide(); + notExistance.hide(); + + if(scayt_instance.getUserDictionaryName() != null && scayt_instance.getUserDictionaryName() != '') { + dialog.getContentElement("dictionaries", "dictionaryName").setValue(scayt_instance.getUserDictionaryName()); + existance.show(); + } else { + dictionaryNameField.setValue(""); + notExistance.show(); + } + }, + onOk: function() { + var dialog = this, + self = dialogDefinition, + scayt_instance = editor.scayt, + scaytOptions = dialog.getContentElement("options", "scaytOptions"), + changedOptions = self.getChangedOption.call(dialog); + + scayt_instance.commitOption({ changedOptions: changedOptions }); + }, + toggleDictionaryButtons: function(exist) { + var existance = this.getContentElement("dictionaries", "existDic").getElement().getParent(), + notExistance = this.getContentElement("dictionaries", "notExistDic").getElement().getParent(); + + if(exist) { + existance.show(); + notExistance.hide(); + } else { + existance.hide(); + notExistance.show(); + } + + }, + getChangedOption: function() { + var changedOption = {}; + + if(editor.config.scayt_uiTabs[0] == 1) { + var dialog = this, + scaytOptions = dialog.getContentElement("options", "scaytOptions").getChild(); + + for(var i = 0; i < scaytOptions.length; i++) { + if(scaytOptions[i].isChanged()) { + changedOption[scaytOptions[i].id] = scaytOptions[i].getValue(); + } + } + } + + if(languageModelState.isChanged()) { + changedOption[languageModelState.id] = editor.config.scayt_sLang = languageModelState.currentLang = languageModelState.newLang; + } + + return changedOption; + }, + buildRadioInputs: function(key, value, isSupportedByGrayt) { + var divContainer = new CKEDITOR.dom.element( 'div' ), + doc = CKEDITOR.document, + id = "scaytLang_" + editor.name + '_' + value, + radio = CKEDITOR.dom.element.createFromHtml( '' ), + + radioLabel = new CKEDITOR.dom.element( 'label' ), + scayt_instance = editor.scayt; + + divContainer.setStyles({ + "white-space": "normal", + 'position': 'relative', + 'padding-bottom': '2px' + }); + + radio.on( 'click', function(data) { + languageModelState.newLang = data.sender.getValue(); + }); + + radioLabel.appendText(key); + radioLabel.setAttribute("for", id); + + if(isSupportedByGrayt && editor.config.grayt_autoStartup) { + radioLabel.setStyles({ + 'color': '#02b620' + }); + } + + divContainer.append(radio); + divContainer.append(radioLabel); + + if(value === scayt_instance.getLang()) { + radio.setAttribute("checked", true); + radio.setAttribute('defaultChecked', 'defaultChecked'); + } + + return divContainer; + }, + renderLangList: function(langBoxes) { + var dialog = this, + leftCol = langBoxes.find('#left-col-' + editor.name).getItem(0), + rightCol = langBoxes.find('#right-col-' + editor.name).getItem(0), + scaytLangList = scayt_instance.getScaytLangList(), + graytLangList = scayt_instance.getGraytLangList(), + mergedLangList = {}, + sortable = [], + counter = 0, + isSupportedByGrayt = false, + half, lang; + + for(lang in scaytLangList.ltr) { + mergedLangList[lang] = scaytLangList.ltr[lang]; + } + + for(lang in scaytLangList.rtl) { + mergedLangList[lang] = scaytLangList.rtl[lang]; + } + + // sort alphabetically lang list + for(lang in mergedLangList) { + sortable.push([lang, mergedLangList[lang]]); + } + sortable.sort(function(a, b) { + var result = 0; + if(a[1] > b[1]) { + result = 1; + } else if(a[1] < b[1]) { + result = -1; + } + return result; + }); + mergedLangList = {}; + for(var i = 0; i < sortable.length; i++) { + mergedLangList[sortable[i][0]] = sortable[i][1]; + } + + half = Math.round(sortable.length / 2); + + for(lang in mergedLangList) { + counter++; + isSupportedByGrayt = (lang in graytLangList.ltr) || (lang in graytLangList.rtl); + dialog.buildRadioInputs(mergedLangList[lang], lang, isSupportedByGrayt).appendTo(counter <= half ? leftCol : rightCol); + } + }, + getLangBoxes: function() { + var dialog = this, + langboxes = dialog.getContentElement("langs", "langBox").getElement(); + + return langboxes; + }, + contents: generateDialogTabs(dialogTabs, editor) + }; + + return dialogDefinition; +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/dialogs/toolbar.css b/app/Resources/public/assets/ckeditor/plugins/scayt/dialogs/toolbar.css index ecabdac9d2..861f43e3b4 100644 --- a/app/Resources/public/assets/ckeditor/plugins/scayt/dialogs/toolbar.css +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/dialogs/toolbar.css @@ -1,71 +1,71 @@ -a -{ - text-decoration:none; - padding: 2px 4px 4px 6px; - display : block; - border-width: 1px; - border-style: solid; - margin : 0px; -} - -a.cke_scayt_toogle:hover, -a.cke_scayt_toogle:focus, -a.cke_scayt_toogle:active -{ - border-color: #316ac5; - background-color: #dff1ff; - color : #000; - cursor: pointer; - margin : 0px; -} -a.cke_scayt_toogle { - color : #316ac5; - border-color: #fff; -} -.scayt_enabled a.cke_scayt_item { - color : #316ac5; - border-color: #fff; - margin : 0px; -} -.scayt_disabled a.cke_scayt_item { - color : gray; - border-color : #fff; -} -.scayt_enabled a.cke_scayt_item:hover, -.scayt_enabled a.cke_scayt_item:focus, -.scayt_enabled a.cke_scayt_item:active -{ - border-color: #316ac5; - background-color: #dff1ff; - color : #000; - cursor: pointer; -} -.scayt_disabled a.cke_scayt_item:hover, -.scayt_disabled a.cke_scayt_item:focus, -.scayt_disabled a.cke_scayt_item:active -{ - border-color: gray; - background-color: #dff1ff; - color : gray; - cursor: no-drop; -} -.cke_scayt_set_on, .cke_scayt_set_off -{ - display: none; -} -.scayt_enabled .cke_scayt_set_on -{ - display: none; -} -.scayt_disabled .cke_scayt_set_on -{ - display: inline; -} -.scayt_disabled .cke_scayt_set_off -{ - display: none; -} -.scayt_enabled .cke_scayt_set_off -{ - display: inline; -} +a +{ + text-decoration:none; + padding: 2px 4px 4px 6px; + display : block; + border-width: 1px; + border-style: solid; + margin : 0px; +} + +a.cke_scayt_toogle:hover, +a.cke_scayt_toogle:focus, +a.cke_scayt_toogle:active +{ + border-color: #316ac5; + background-color: #dff1ff; + color : #000; + cursor: pointer; + margin : 0px; +} +a.cke_scayt_toogle { + color : #316ac5; + border-color: #fff; +} +.scayt_enabled a.cke_scayt_item { + color : #316ac5; + border-color: #fff; + margin : 0px; +} +.scayt_disabled a.cke_scayt_item { + color : gray; + border-color : #fff; +} +.scayt_enabled a.cke_scayt_item:hover, +.scayt_enabled a.cke_scayt_item:focus, +.scayt_enabled a.cke_scayt_item:active +{ + border-color: #316ac5; + background-color: #dff1ff; + color : #000; + cursor: pointer; +} +.scayt_disabled a.cke_scayt_item:hover, +.scayt_disabled a.cke_scayt_item:focus, +.scayt_disabled a.cke_scayt_item:active +{ + border-color: gray; + background-color: #dff1ff; + color : gray; + cursor: no-drop; +} +.cke_scayt_set_on, .cke_scayt_set_off +{ + display: none; +} +.scayt_enabled .cke_scayt_set_on +{ + display: none; +} +.scayt_disabled .cke_scayt_set_on +{ + display: inline; +} +.scayt_disabled .cke_scayt_set_off +{ + display: none; +} +.scayt_enabled .cke_scayt_set_off +{ + display: inline; +} diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/icons/hidpi/scayt.png b/app/Resources/public/assets/ckeditor/plugins/scayt/icons/hidpi/scayt.png new file mode 100644 index 0000000000..58a9f4c132 Binary files /dev/null and b/app/Resources/public/assets/ckeditor/plugins/scayt/icons/hidpi/scayt.png differ diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/icons/scayt.png b/app/Resources/public/assets/ckeditor/plugins/scayt/icons/scayt.png new file mode 100644 index 0000000000..701ceee69f Binary files /dev/null and b/app/Resources/public/assets/ckeditor/plugins/scayt/icons/scayt.png differ diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/af.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/af.js new file mode 100644 index 0000000000..38135977f0 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/af.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'af', { + btn_about: 'SCAYT info', + btn_dictionaries: 'Woordeboeke', + btn_disable: 'SCAYT af', + btn_enable: 'SCAYT aan', + btn_langs:'Tale', + btn_options: 'Opsies', + text_title: 'Speltoets terwyl u tik' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ar.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ar.js new file mode 100644 index 0000000000..d6aee64861 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ar.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'ar', { + btn_about: 'عن SCAYT', + btn_dictionaries: 'قواميس', + btn_disable: 'تعطيل SCAYT', + btn_enable: 'تفعيل SCAYT', + btn_langs:'لغات', + btn_options: 'خيارات', + text_title: 'تدقيق إملائي أثناء الكتابة' +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/bg.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/bg.js new file mode 100644 index 0000000000..38acdd1a3e --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/bg.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'bg', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Речници', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/bn.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/bn.js new file mode 100644 index 0000000000..f1c9c58f2d --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/bn.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'bn', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/bs.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/bs.js new file mode 100644 index 0000000000..a96b4cc924 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/bs.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'bs', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ca.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ca.js new file mode 100644 index 0000000000..4955b65a47 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ca.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'ca', { + btn_about: 'Quant a l\'SCAYT', + btn_dictionaries: 'Diccionaris', + btn_disable: 'Deshabilita SCAYT', + btn_enable: 'Habilitat l\'SCAYT', + btn_langs:'Idiomes', + btn_options: 'Opcions', + text_title: 'Spell Check As You Type' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/cs.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/cs.js new file mode 100644 index 0000000000..1d3fb68fd8 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/cs.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'cs', { + btn_about: 'O aplikaci SCAYT', + btn_dictionaries: 'Slovníky', + btn_disable: 'Vypnout SCAYT', + btn_enable: 'Zapnout SCAYT', + btn_langs:'Jazyky', + btn_options: 'Nastavení', + text_title: 'Kontrola pravopisu během psaní (SCAYT)' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/cy.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/cy.js new file mode 100644 index 0000000000..23f16e0fa7 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/cy.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'cy', { + btn_about: 'Ynghylch SCAYT', + btn_dictionaries: 'Geiriaduron', + btn_disable: 'Analluogi SCAYT', + btn_enable: 'Galluogi SCAYT', + btn_langs:'Ieithoedd', + btn_options: 'Opsiynau', + text_title: 'Gwirio\'r Sillafu Wrth Deipio' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/da.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/da.js new file mode 100644 index 0000000000..a6eb642704 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/da.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'da', { + btn_about: 'Om SCAYT', + btn_dictionaries: 'Ordbøger', + btn_disable: 'Deaktivér SCAYT', + btn_enable: 'Aktivér SCAYT', + btn_langs:'Sprog', + btn_options: 'Indstillinger', + text_title: 'Stavekontrol mens du skriver' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/de.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/de.js new file mode 100644 index 0000000000..293326f5c3 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/de.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'de', { + btn_about: 'Über SCAYT', + btn_dictionaries: 'Wörterbücher', + btn_disable: 'SCAYT ausschalten', + btn_enable: 'SCAYT einschalten', + btn_langs:'Sprachen', + btn_options: 'Optionen', + text_title: 'Rechtschreibprüfung während der Texteingabe (SCAYT)' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/el.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/el.js new file mode 100644 index 0000000000..ad6d53c8ed --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/el.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'el', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Λεξικά', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Γλώσσες', + btn_options: 'Επιλογές', + text_title: 'Spell Check As You Type' +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/en-au.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/en-au.js new file mode 100644 index 0000000000..9be05862d4 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/en-au.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'en-au', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/en-ca.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/en-ca.js new file mode 100644 index 0000000000..bf9e89a1ba --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/en-ca.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'en-ca', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/en-gb.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/en-gb.js new file mode 100644 index 0000000000..f2d159d1ba --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/en-gb.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'en-gb', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/en.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/en.js new file mode 100644 index 0000000000..5e32b23fe4 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/en.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'en', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/eo.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/eo.js new file mode 100644 index 0000000000..582fabcbe1 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/eo.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'eo', { + btn_about: 'Pri OKDVT', + btn_dictionaries: 'Vortaroj', + btn_disable: 'Malebligi OKDVT', + btn_enable: 'Ebligi OKDVT', + btn_langs:'Lingvoj', + btn_options: 'Opcioj', + text_title: 'OrtografiKontrolado Dum Vi Tajpas (OKDVT)' +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/es.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/es.js new file mode 100644 index 0000000000..9ca5d8610c --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/es.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'es', { + btn_about: 'Acerca de Corrector', + btn_dictionaries: 'Diccionarios', + btn_disable: 'Desactivar Corrector', + btn_enable: 'Activar Corrector', + btn_langs:'Idiomas', + btn_options: 'Opciones', + text_title: 'Comprobar Ortografía Mientras Escribe' +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/et.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/et.js new file mode 100644 index 0000000000..1c888de531 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/et.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'et', { + btn_about: 'SCAYT-ist lähemalt', + btn_dictionaries: 'Sõnaraamatud', + btn_disable: 'SCAYT keelatud', + btn_enable: 'SCAYT lubatud', + btn_langs:'Keeled', + btn_options: 'Valikud', + text_title: 'Õigekirjakontroll kirjutamise ajal' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/eu.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/eu.js new file mode 100644 index 0000000000..217be7a83e --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/eu.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'eu', { + btn_about: 'SCAYTi buruz', + btn_dictionaries: 'Hiztegiak', + btn_disable: 'Desgaitu SCAYT', + btn_enable: 'Gaitu SCAYT', + btn_langs:'Hizkuntzak', + btn_options: 'Aukerak', + text_title: 'Ortografia Zuzenketa Idatzi Ahala (SCAYT)' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/fa.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/fa.js new file mode 100644 index 0000000000..b78e9f3801 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/fa.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'fa', { + btn_about: 'درباره SCAYT', + btn_dictionaries: 'دیکشنریها', + btn_disable: 'غیرفعالسازی SCAYT', + btn_enable: 'فعالسازی SCAYT', + btn_langs:'زبانها', + btn_options: 'گزینهها', + text_title: 'بررسی املای تایپ شما' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/fi.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/fi.js new file mode 100644 index 0000000000..a34bfd4468 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/fi.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'fi', { + btn_about: 'Tietoja oikoluvusta kirjoitetaessa', + btn_dictionaries: 'Sanakirjat', + btn_disable: 'Poista käytöstä oikoluku kirjoitetaessa', + btn_enable: 'Ota käyttöön oikoluku kirjoitettaessa', + btn_langs:'Kielet', + btn_options: 'Asetukset', + text_title: 'Oikolue kirjoitettaessa' +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/fo.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/fo.js new file mode 100644 index 0000000000..0e1fbe8561 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/fo.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'fo', { + btn_about: 'Um SCAYT', + btn_dictionaries: 'Orðabøkur', + btn_disable: 'Nokta SCAYT', + btn_enable: 'Loyv SCAYT', + btn_langs:'Tungumál', + btn_options: 'Uppseting', + text_title: 'Kanna stavseting, meðan tú skrivar' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/fr-ca.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/fr-ca.js new file mode 100644 index 0000000000..7b1ddf3b1e --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/fr-ca.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'fr-ca', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/fr.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/fr.js new file mode 100644 index 0000000000..719312b9b9 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/fr.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'fr', { + btn_about: 'A propos de SCAYT', + btn_dictionaries: 'Dictionnaires', + btn_disable: 'Désactiver SCAYT', + btn_enable: 'Activer SCAYT', + btn_langs:'Langues', + btn_options: 'Options', + text_title: 'Vérification de l\'Orthographe en Cours de Frappe (SCAYT)' +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/gl.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/gl.js new file mode 100644 index 0000000000..5e7b30d132 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/gl.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'gl', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/gu.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/gu.js new file mode 100644 index 0000000000..b29bf1ebee --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/gu.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'gu', { + btn_about: 'SCAYT વિષે', + btn_dictionaries: 'શબ્દકોશ', + btn_disable: 'SCAYT ડિસેબલ કરવું', + btn_enable: 'SCAYT એનેબલ કરવું', + btn_langs:'ભાષાઓ', + btn_options: 'વિકલ્પો', + text_title: 'ટાઈપ કરતા સ્પેલ તપાસો' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/he.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/he.js new file mode 100644 index 0000000000..da89f474bd --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/he.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'he', { + btn_about: 'אודות SCAYT', + btn_dictionaries: 'מילון', + btn_disable: 'בטל SCAYT', + btn_enable: 'אפשר SCAYT', + btn_langs:'שפות', + btn_options: 'אפשרויות', + text_title: 'בדיקת איות בזמן כתיבה (SCAYT)' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/hi.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/hi.js new file mode 100644 index 0000000000..6a08c00b4c --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/hi.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'hi', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/hr.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/hr.js new file mode 100644 index 0000000000..6cc9e5a28e --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/hr.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'hr', { + btn_about: 'O SCAYT', + btn_dictionaries: 'Rječnici', + btn_disable: 'Onemogući SCAYT', + btn_enable: 'Omogući SCAYT', + btn_langs:'Jezici', + btn_options: 'Opcije', + text_title: 'Provjeri pravopis tijekom tipkanja (SCAYT)' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/hu.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/hu.js new file mode 100644 index 0000000000..b5b8ff5348 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/hu.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'hu', { + btn_about: 'SCAYT névjegy', + btn_dictionaries: 'Szótár', + btn_disable: 'SCAYT letiltása', + btn_enable: 'SCAYT engedélyezése', + btn_langs:'Nyelvek', + btn_options: 'Beállítások', + text_title: 'Helyesírás ellenőrzés gépelés közben' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/is.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/is.js new file mode 100644 index 0000000000..3b0b75942f --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/is.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'is', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/it.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/it.js new file mode 100644 index 0000000000..15e0af8b54 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/it.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'it', { + btn_about: 'About COMS', + btn_dictionaries: 'Dizionari', + btn_disable: 'Disabilita COMS', + btn_enable: 'Abilita COMS', + btn_langs:'Lingue', + btn_options: 'Opzioni', + text_title: 'Controllo Ortografico Mentre Scrivi' +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ja.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ja.js new file mode 100644 index 0000000000..9097f9cda1 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ja.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'ja', { + btn_about: 'SCAYTバージョン', + btn_dictionaries: '辞書', + btn_disable: 'SCAYT無効', + btn_enable: 'SCAYT有効', + btn_langs:'言語', + btn_options: 'オプション', + text_title: 'スペルチェック設定(SCAYT)' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ka.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ka.js new file mode 100644 index 0000000000..6f3d3ba371 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ka.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'ka', { + btn_about: 'SCAYT-ის შესახებ', + btn_dictionaries: 'ლექსიკონები', + btn_disable: 'SCAYT-ის გამორთვა', + btn_enable: 'SCAYT-ის ჩართვა', + btn_langs:'ენები', + btn_options: 'პარამეტრები', + text_title: 'მართლწერის შემოწმება კრეფისას' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/km.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/km.js new file mode 100644 index 0000000000..5e21114582 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/km.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'km', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ko.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ko.js new file mode 100644 index 0000000000..9bce7a42be --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ko.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'ko', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ku.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ku.js new file mode 100644 index 0000000000..09d82b0fc0 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ku.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'ku', { + btn_about: 'دهربارهی SCAYT', + btn_dictionaries: 'فهرههنگهکان', + btn_disable: 'ناچالاککردنی SCAYT', + btn_enable: 'چالاککردنی SCAYT', + btn_langs:'زمانهکان', + btn_options: 'ههڵبژارده', + text_title: 'پشکنینی نووسه لهکاتی نووسین' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/lt.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/lt.js new file mode 100644 index 0000000000..2da3b320aa --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/lt.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'lt', { + btn_about: 'Apie SCAYT', + btn_dictionaries: 'Žodynai', + btn_disable: 'Išjungti SCAYT', + btn_enable: 'Įjungti SCAYT', + btn_langs:'Kalbos', + btn_options: 'Parametrai', + text_title: 'Tikrinti klaidas kai rašoma' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/lv.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/lv.js new file mode 100644 index 0000000000..809855af54 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/lv.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'lv', { + btn_about: 'Par SCAYT', + btn_dictionaries: 'Vārdnīcas', + btn_disable: 'Atslēgt SCAYT', + btn_enable: 'Ieslēgt SCAYT', + btn_langs:'Valodas', + btn_options: 'Uzstādījumi', + text_title: 'Pārbaudīt gramatiku rakstot' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/mk.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/mk.js new file mode 100644 index 0000000000..49ab39bfc5 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/mk.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'mk', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/mn.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/mn.js new file mode 100644 index 0000000000..a932def9fe --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/mn.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'mn', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Толь бичгүүд', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Хэлүүд', + btn_options: 'Сонголт', + text_title: 'Spell Check As You Type' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ms.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ms.js new file mode 100644 index 0000000000..98fd51f62d --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ms.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'ms', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' // MISSING +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/nb.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/nb.js new file mode 100644 index 0000000000..e82fab357b --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/nb.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'nb', { + btn_about: 'Om SCAYT', + btn_dictionaries: 'Ordbøker', + btn_disable: 'Slå av SCAYT', + btn_enable: 'Slå på SCAYT', + btn_langs:'Språk', + btn_options: 'Valg', + text_title: 'Stavekontroll mens du skriver' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/nl.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/nl.js new file mode 100644 index 0000000000..3a3078680c --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/nl.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'nl', { + btn_about: 'Over SCAYT', + btn_dictionaries: 'Woordenboeken', + btn_disable: 'SCAYT uitschakelen', + btn_enable: 'SCAYT inschakelen', + btn_langs:'Talen', + btn_options: 'Opties', + text_title: 'Controleer de spelling tijdens het typen' +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/no.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/no.js new file mode 100644 index 0000000000..a955c1f080 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/no.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'no', { + btn_about: 'Om SCAYT', + btn_dictionaries: 'Ordbøker', + btn_disable: 'Slå av SCAYT', + btn_enable: 'Slå på SCAYT', + btn_langs:'Språk', + btn_options: 'Valg', + text_title: 'Stavekontroll mens du skriver' +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/pl.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/pl.js new file mode 100644 index 0000000000..18a600512c --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/pl.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'pl', { + btn_about: 'Informacje o SCAYT', + btn_dictionaries: 'Słowniki', + btn_disable: 'Wyłącz SCAYT', + btn_enable: 'Włącz SCAYT', + btn_langs:'Języki', + btn_options: 'Opcje', + text_title: 'Sprawdź pisownię podczas pisania (SCAYT)' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/pt-br.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/pt-br.js new file mode 100644 index 0000000000..b0a81944c0 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/pt-br.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'pt-br', { + btn_about: 'Sobre a correção ortográfica durante a digitação', + btn_dictionaries: 'Dicionários', + btn_disable: 'Desabilitar correção ortográfica durante a digitação', + btn_enable: 'Habilitar correção ortográfica durante a digitação', + btn_langs:'Idiomas', + btn_options: 'Opções', + text_title: 'Correção ortográfica durante a digitação' +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/pt.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/pt.js new file mode 100644 index 0000000000..58a8e4924d --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/pt.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'pt', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' // MISSING +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ro.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ro.js new file mode 100644 index 0000000000..706ea7948a --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ro.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'ro', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' // MISSING +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ru.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ru.js new file mode 100644 index 0000000000..11e6a14d44 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ru.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'ru', { + btn_about: 'О SCAYT', + btn_dictionaries: 'Словари', + btn_disable: 'Отключить SCAYT', + btn_enable: 'Включить SCAYT', + btn_langs:'Языки', + btn_options: 'Настройки', + text_title: 'Проверка орфографии по мере ввода (SCAYT)' +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/sk.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/sk.js new file mode 100644 index 0000000000..0a09b53da3 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/sk.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'sk', { + btn_about: 'O KPPP (Kontrola pravopisu počas písania)', + btn_dictionaries: 'Slovníky', + btn_disable: 'Zakázať KPPP (Kontrola pravopisu počas písania)', + btn_enable: 'Povoliť KPPP (Kontrola pravopisu počas písania)', + btn_langs:'Jazyky', + btn_options: 'Možnosti', + text_title: 'Kontrola pravopisu počas písania' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/sl.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/sl.js new file mode 100644 index 0000000000..301f72a51d --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/sl.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'sl', { + btn_about: 'O storitvi SCAYT', + btn_dictionaries: 'Slovarji', + btn_disable: 'Onemogoči SCAYT', + btn_enable: 'Omogoči SCAYT', + btn_langs:'Jeziki', + btn_options: 'Možnosti', + text_title: 'Črkovanje med tipkanjem' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/sr-latn.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/sr-latn.js new file mode 100644 index 0000000000..02a6554458 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/sr-latn.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'sr-latn', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' // MISSING +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/sr.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/sr.js new file mode 100644 index 0000000000..067e401c28 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/sr.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'sr', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' // MISSING +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/sv.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/sv.js new file mode 100644 index 0000000000..e9da617d2a --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/sv.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'sv', { + btn_about: 'Om SCAYT', + btn_dictionaries: 'Ordlistor', + btn_disable: 'Inaktivera SCAYT', + btn_enable: 'Aktivera SCAYT', + btn_langs:'Språk', + btn_options: 'Inställningar', + text_title: 'Stavningskontroll medan du skriver' +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/th.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/th.js new file mode 100644 index 0000000000..4842cdf18d --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/th.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'th', { + btn_about: 'About SCAYT', + btn_dictionaries: 'Dictionaries', + btn_disable: 'Disable SCAYT', + btn_enable: 'Enable SCAYT', + btn_langs:'Languages', + btn_options: 'Options', + text_title: 'Spell Check As You Type' // MISSING +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/tr.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/tr.js new file mode 100644 index 0000000000..fb574c165d --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/tr.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'tr', { + btn_about: 'SCAYT\'ı hakkında', + btn_dictionaries: 'Sözlükler', + btn_disable: 'SCAYT\'ı pasifleştir', + btn_enable: 'SCAYT\'ı etkinleştir', + btn_langs:'Diller', + btn_options: 'Seçenekler', + text_title: 'Girmiş olduğunuz kelime denetimi' +}); \ No newline at end of file diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ug.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ug.js new file mode 100644 index 0000000000..a03b535e49 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/ug.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'ug', { + btn_about: 'شۇئان ئىملا تەكشۈرۈش ھەققىدە', + btn_dictionaries: 'لۇغەت', + btn_disable: 'شۇئان ئىملا تەكشۈرۈشنى چەكلە', + btn_enable: 'شۇئان ئىملا تەكشۈرۈشنى قوزغات', + btn_langs:'تىل', + btn_options: 'تاللانما', + text_title: 'شۇئان ئىملا تەكشۈر' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/uk.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/uk.js new file mode 100644 index 0000000000..18cfdc4aad --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/uk.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'uk', { + btn_about: 'Про SCAYT', + btn_dictionaries: 'Словники', + btn_disable: 'Вимкнути SCAYT', + btn_enable: 'Ввімкнути SCAYT', + btn_langs:'Мови', + btn_options: 'Опції', + text_title: 'Перефірка орфографії по мірі набору' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/vi.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/vi.js new file mode 100644 index 0000000000..efd1fda22e --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/vi.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'vi', { + btn_about: 'Thông tin về SCAYT', + btn_dictionaries: 'Từ điển', + btn_disable: 'Tắt SCAYT', + btn_enable: 'Bật SCAYT', + btn_langs:'Ngôn ngữ', + btn_options: 'Tùy chọn', + text_title: 'Kiểm tra chính tả ngay khi gõ chữ (SCAYT)' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/zh-cn.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/zh-cn.js new file mode 100644 index 0000000000..46efa2fa94 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/zh-cn.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'zh-cn', { + btn_about: '关于即时拼写检查', + btn_dictionaries: '字典', + btn_disable: '禁用即时拼写检查', + btn_enable: '启用即时拼写检查', + btn_langs:'语言', + btn_options: '选项', + text_title: '即时拼写检查' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/lang/zh.js b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/zh.js new file mode 100644 index 0000000000..05524e5285 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/lang/zh.js @@ -0,0 +1,13 @@ +/* +Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang( 'scayt', 'zh', { + btn_about: '關於即時拼寫檢查', + btn_dictionaries: '字典', + btn_disable: '關閉即時拼寫檢查', + btn_enable: '啟用即時拼寫檢查', + btn_langs: '語言', + btn_options: '選項', + text_title: '即時拼寫檢查' +}); diff --git a/app/Resources/public/assets/ckeditor/plugins/scayt/plugin.js b/app/Resources/public/assets/ckeditor/plugins/scayt/plugin.js new file mode 100644 index 0000000000..eba747e3d2 --- /dev/null +++ b/app/Resources/public/assets/ckeditor/plugins/scayt/plugin.js @@ -0,0 +1,1877 @@ +'use strict'; +CKEDITOR.plugins.add('scayt', { + + //requires : ['menubutton', 'dialog'], + requires: 'menubutton,dialog', + lang: 'af,ar,bg,bn,bs,ca,cs,cy,da,de,el,en-au,en-ca,en-gb,en,eo,es,et,eu,fa,fi,fo,fr-ca,fr,gl,gu,he,hi,hr,hu,is,it,ja,ka,km,ko,lt,lv,mk,mn,ms,nb,nl,no,pl,pt-br,pt,ro,ru,sk,sl,sr-latn,sr,sv,th,tr,ug,uk,vi,zh-cn,zh', // %REMOVE_LINE_CORE% + icons: 'scayt', // %REMOVE_LINE_CORE% + hidpi: true, // %REMOVE_LINE_CORE% + tabToOpen : null, + dialogName: 'scaytDialog', + init: function(editor) { + var self = this, + plugin = CKEDITOR.plugins.scayt; + + this.bindEvents(editor); + this.parseConfig(editor); + this.addRule(editor); + + // source mode + CKEDITOR.dialog.add(this.dialogName, CKEDITOR.getUrl(this.path + 'dialogs/options.js')); + // end source mode + + this.addMenuItems(editor); + var config = editor.config, + lang = editor.lang.scayt, + env = CKEDITOR.env; + + editor.ui.add('Scayt', CKEDITOR.UI_MENUBUTTON, { + label : lang.text_title, + title : ( editor.plugins.wsc ? editor.lang.wsc.title : lang.text_title ), + // SCAYT doesn't work in IE Compatibility Mode and IE (8 & 9) Quirks Mode + modes : {wysiwyg: !(env.ie && ( env.version < 8 || env.quirks ) ) }, + toolbar: 'spellchecker,20', + refresh: function() { + var buttonState = editor.ui.instances.Scayt.getState(); + + // check if scayt is created + if(editor.scayt) { + // check if scayt is enabled + if(plugin.state.scayt[editor.name]) { + buttonState = CKEDITOR.TRISTATE_ON; + } else { + buttonState = CKEDITOR.TRISTATE_OFF; + } + } + + editor.fire('scaytButtonState', buttonState); + }, + onRender: function() { + var that = this; + + editor.on('scaytButtonState', function(ev) { + if(typeof ev.data !== undefined) { + that.setState(ev.data); + } + }); + }, + onMenu : function() { + var scaytInstance = editor.scayt; + + editor.getMenuItem('scaytToggle').label = editor.lang.scayt[(scaytInstance ? plugin.state.scayt[editor.name] : false) ? 'btn_disable' : 'btn_enable']; + + // If UI tab is disabled we shouldn't show menu item + var menuDefinition = { + scaytToggle : CKEDITOR.TRISTATE_OFF, + scaytOptions : scaytInstance ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED, + scaytLangs : scaytInstance ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED, + scaytDict : scaytInstance ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED, + scaytAbout : scaytInstance ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED, + WSC : editor.plugins.wsc ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED + }; + + if(!editor.config.scayt_uiTabs[0]) { + delete menuDefinition.scaytOptions; + } + + if(!editor.config.scayt_uiTabs[1]) { + delete menuDefinition.scaytLangs; + } + + if(!editor.config.scayt_uiTabs[2]) { + delete menuDefinition.scaytDict; + } + + return menuDefinition; + } + }); + + // If the 'contextmenu' plugin is loaded, register the listeners. + if(editor.contextMenu && editor.addMenuItems) { + editor.contextMenu.addListener(function(element, selection) { + var scaytInstance = editor.scayt, + result, selectionNode; + + if(scaytInstance) { + selectionNode = scaytInstance.getSelectionNode(); + + // SCAYT shouldn't build context menu if instance isnot created or word is without misspelling or grammar problem + if(selectionNode) { + var items = self.menuGenerator(editor, selectionNode); + + scaytInstance.showBanner('.' + editor.contextMenu._.definition.panel.className.split(' ').join(' .')); + result = items; + } + } + + return result; + }); + + editor.contextMenu._.onHide = CKEDITOR.tools.override(editor.contextMenu._.onHide, function(org) { + return function() { + var scaytInstance = editor.scayt; + + if(scaytInstance) { + scaytInstance.hideBanner(); + } + + return org.apply(this); + }; + }); + } + }, + addMenuItems: function(editor) { + var self = this, + plugin = CKEDITOR.plugins.scayt, + graytGroups = ['grayt_description', 'grayt_suggest', 'grayt_control'], + menuGroup = 'scaytButton'; + + editor.addMenuGroup(menuGroup); + + var items_order = editor.config.scayt_contextMenuItemsOrder.split('|'); + + for(var pos = 0 ; pos < items_order.length ; pos++) { + items_order[pos] = 'scayt_' + items_order[pos]; + } + items_order = graytGroups.concat(items_order); + + if(items_order && items_order.length) { + for(var pos = 0 ; pos < items_order.length ; pos++) { + editor.addMenuGroup(items_order[pos], pos - 10); + } + } + + editor.addCommand( 'scaytToggle', { + exec: function(editor) { + var scaytInstance = editor.scayt; + + plugin.state.scayt[editor.name] = !plugin.state.scayt[editor.name]; + + if(plugin.state.scayt[editor.name] === true) { + if(!scaytInstance) { + plugin.createScayt(editor); + } + } else { + if(scaytInstance) { + plugin.destroy(editor); + } + } + } + } ); + + editor.addCommand( 'scaytAbout', { + exec: function(editor) { + var scaytInstance = editor.scayt; + + scaytInstance.tabToOpen = 'about'; + editor.lockSelection(); + editor.openDialog(self.dialogName); + } + } ); + + editor.addCommand( 'scaytOptions', { + exec: function(editor) { + var scaytInstance = editor.scayt; + + scaytInstance.tabToOpen = 'options'; + editor.lockSelection(); + editor.openDialog(self.dialogName); + } + } ); + + editor.addCommand( 'scaytLangs', { + exec: function(editor) { + var scaytInstance = editor.scayt; + + scaytInstance.tabToOpen = 'langs'; + editor.lockSelection(); + editor.openDialog(self.dialogName); + } + } ); + + editor.addCommand( 'scaytDict', { + exec: function(editor) { + var scaytInstance = editor.scayt; + + scaytInstance.tabToOpen = 'dictionaries'; + editor.lockSelection(); + editor.openDialog(self.dialogName); + } + } ); + + var uiMenuItems = { + scaytToggle: { + label : editor.lang.scayt.btn_enable, + group : menuGroup, + command: 'scaytToggle' + }, + scaytAbout: { + label : editor.lang.scayt.btn_about, + group : menuGroup, + command: 'scaytAbout' + }, + scaytOptions: { + label : editor.lang.scayt.btn_options, + group : menuGroup, + command: 'scaytOptions' + }, + scaytLangs: { + label : editor.lang.scayt.btn_langs, + group : menuGroup, + command: 'scaytLangs' + }, + scaytDict: { + label : editor.lang.scayt.btn_dictionaries, + group : menuGroup, + command: 'scaytDict' + } + }; + + if(editor.plugins.wsc) { + uiMenuItems.WSC = { + label : editor.lang.wsc.toolbar, + group : menuGroup, + onClick: function() { + var inlineMode = (editor.elementMode == CKEDITOR.ELEMENT_MODE_INLINE), + plugin = CKEDITOR.plugins.scayt, + scaytInstance = editor.scayt, + text = inlineMode ? editor.container.getText() : editor.document.getBody().getText(); + + text = text.replace(/\s/g, ''); + + if(text) { + if(scaytInstance && plugin.state.scayt[editor.name] && scaytInstance.setMarkupPaused) { + scaytInstance.setMarkupPaused(true); + } + + editor.lockSelection(); + editor.execCommand('checkspell'); + } else { + alert('Nothing to check!'); + } + } + } + } + + editor.addMenuItems(uiMenuItems); + }, + bindEvents: function(editor) { + var self = this, + plugin = CKEDITOR.plugins.scayt, + inline_mode = (editor.elementMode == CKEDITOR.ELEMENT_MODE_INLINE); + + var scaytDestroy = function() { + plugin.destroy(editor); + }; + + /* + * Dirty fix for placeholder drag&drop + * Should be fixed with next release + */ + /* + editor.on('drop', function(evt) { + var dropRange = evt.data.dropRange; + var b = dropRange.createBookmark(true); + editor.scayt.removeMarkupInSelectionNode({ selectionNode: evt.data.target.$, forceBookmark: false }); + dropRange.moveToBookmark(b); + + evt.data.dropRange = dropRange; + return evt; + }, this, null, 0); // We should be sure that we modify dropRange before CKEDITOR.plugins.clipboard calls + */ + + var contentDomReady = function() { + // The event is fired when editable iframe node was reinited so we should restart our service + if (plugin.state.scayt[editor.name] && !editor.readOnly && !editor.scayt) { + plugin.createScayt(editor); + } + }; + + var addMarkupStateHandlers = function() { + var editable = editor.editable(); + + editable.attachListener( editable, 'focus', function( evt ) { + if( CKEDITOR.plugins.scayt && !editor.scayt ) { + setTimeout(contentDomReady, 0); // we need small timeout in order to correctly set initial 'focused' option value in SCAYT core + } + + var pluginStatus = CKEDITOR.plugins.scayt && CKEDITOR.plugins.scayt.state.scayt[editor.name] && editor.scayt, + selectedElement, ranges, textLength, range; + + if((inline_mode ? true : pluginStatus) && editor._.savedSelection) { + selectedElement = editor._.savedSelection.getSelectedElement(); + ranges = !selectedElement && editor._.savedSelection.getRanges(); + + for(var i = 0; i < ranges.length; i++) { + range = ranges[i]; + // we need to check type of node value in order to avoid error in IE when accessing 'nodeValue' property + if(typeof range.startContainer.$.nodeValue === 'string') { + textLength = range.startContainer.getText().length; + if(textLength < range.startOffset || textLength < range.endOffset) { + editor.unlockSelection(false); + } + } + } + } + }, this, null, -10 ); // priority "-10" is set to call SCAYT CKEDITOR.editor#unlockSelection before CKEDITOR.editor#unlockSelection call + }; + + var contentDomHandler = function() { + if(inline_mode) { + + if (!editor.config.scayt_inlineModeImmediateMarkup) { + /* + * Give an opportunity to CKEditor to perform all needed updates + * and only after that call 'scaytDestroy' method (#72725) + */ + editor.on('blur', function () { setTimeout( scaytDestroy, 0 ); } ); + editor.on('focus', contentDomReady); + + // We need to check if editor has focus(created) right now. + // If editor is active - make attempt to create scayt + if(editor.focusManager.hasFocus) { + contentDomReady(); + } + + } else { + contentDomReady(); + } + + } else { + contentDomReady(); + } + + addMarkupStateHandlers(); + + /* + * 'mousedown' handler handle widget selection (click on widget). To + * fix the issue when widget#wrapper referenced to element which can + * be broken after markup. + */ + var editable = editor.editable(); + editable.attachListener(editable, 'mousedown', function( evt ) { + var target = evt.data.getTarget(); + var widget = editor.widgets && editor.widgets.getByElement( target ); + if ( widget ) { + widget.wrapper = target.getAscendant( function( el ) { + return el.hasAttribute( 'data-cke-widget-wrapper' ) + }, true ); + } + }, this, null, -10); // '-10': we need to be shure that widget#wrapper updated before any other calls + }; + + editor.on('contentDom', contentDomHandler); + + editor.on('beforeCommandExec', function(ev) { + var scaytInstance = editor.scayt, + selectedLangElement = null, + forceBookmark = false, + removeMarkupInsideSelection = true; + + // TODO: after switching in source mode not recreate SCAYT instance, try to just rerun markuping to don't make requests to server + if(ev.data.name in plugin.options.disablingCommandExec && editor.mode == 'wysiwyg') { + if(scaytInstance) { + plugin.destroy(editor); + editor.fire('scaytButtonState', CKEDITOR.TRISTATE_DISABLED); + } + } else if( ev.data.name === 'bold' || ev.data.name === 'italic' || ev.data.name === 'underline' || + ev.data.name === 'strike' || ev.data.name === 'subscript' || ev.data.name === 'superscript' || + ev.data.name === 'enter' || ev.data.name === 'cut' || ev.data.name === 'language') { + if(scaytInstance) { + if(ev.data.name === 'cut') { + removeMarkupInsideSelection = false; + // We need to force bookmark before we remove our markup. + // Otherwise we will get issues with cutting text via context menu. + forceBookmark = true; + } + + // We need to remove all SCAYT markup from 'lang' node before it will be deleted. + // We need to remove SCAYT markup from selected text before creating 'lang' node as well. + if(ev.data.name === 'language') { + selectedLangElement = editor.plugins.language.getCurrentLangElement(editor); + selectedLangElement = selectedLangElement && selectedLangElement.$; + // We need to force bookmark before we remove our markup. + // Otherwise we will get issues with cutting text via language plugin menu. + forceBookmark = true; + } + + editor.fire('reloadMarkupScayt', { + removeOptions: { + removeInside: removeMarkupInsideSelection, + forceBookmark: forceBookmark, + selectionNode: selectedLangElement + }, + timeout: 0 + }); + } + } + }); + + editor.on('beforeSetMode', function(ev) { + var scaytInstance; + // needed when we use: + // CKEDITOR.instances.editor_ID.setMode("source") + // CKEDITOR.instances.editor_ID.setMode("wysiwyg") + // can't be implemented in editor.on('mode', function(ev) {}); + if (ev.data == 'source') { + scaytInstance = editor.scayt; + if(scaytInstance) { + plugin.destroy(editor); + editor.fire('scaytButtonState', CKEDITOR.TRISTATE_DISABLED); + } + + // remove custom data from body, to prevent waste properties showing in IE8 + if(editor.document) { //GitHub #84 : make sure that document exists(e.g. when startup mode set to 'source') + editor.document.getBody().removeAttribute('_jquid'); + } + } + }); + + editor.on('afterCommandExec', function(ev) { + if(editor.mode == 'wysiwyg' && (ev.data.name == 'undo' || ev.data.name == 'redo')) { + setTimeout(function() { + var scaytInstance = editor.scayt, + scaytLangList = scaytInstance && scaytInstance.getScaytLangList(); + + /* + * Checks SCAYT initialization of LangList. To prevent immediate + * markup which is triggered by 'startSpellCheck' event. + * E.g.: Drop into inline CKEDITOR with scayt_autoStartup = true; + */ + if (!scaytLangList || !(scaytLangList.ltr && scaytLangList.rtl)) return; + + scaytInstance.fire('startSpellCheck, startGrammarCheck'); + }, 250); + } + }); + + // handle readonly changes + editor.on('readOnly', function(ev) { + var scaytInstance; + + if(ev) { + scaytInstance = editor.scayt; + + if(ev.editor.readOnly === true) { + if(scaytInstance) { + scaytInstance.fire('removeMarkupInDocument', {}); + } + } else { + if(scaytInstance) { + scaytInstance.fire('startSpellCheck, startGrammarCheck'); + } else if(ev.editor.mode == 'wysiwyg' && plugin.state.scayt[ev.editor.name] === true) { + plugin.createScayt(editor); + ev.editor.fire('scaytButtonState', CKEDITOR.TRISTATE_ON); + } + } + } + }); + + // we need to destroy SCAYT before CK editor will be completely destroyed + editor.on('beforeDestroy', scaytDestroy); + + //#9439 after SetData method fires contentDom event and SCAYT create additional instanse + // This way we should destroy SCAYT on setData event when contenteditable Iframe was re-created + editor.on('setData', function() { + scaytDestroy(); + + // in inline mode SetData does not fire contentDom event + if(editor.elementMode == CKEDITOR.ELEMENT_MODE_INLINE || editor.plugins.divarea) { + contentDomHandler(); + } + }, this, null, 50); + + /* + * Main entry point to react on changes in document + */ + editor.on('reloadMarkupScayt', function(ev) { + var removeOptions = ev.data && ev.data.removeOptions, + timeout = ev.data && ev.data.timeout; + + /* + * Perform removeMarkupInSelectionNode and 'startSpellCheck' fire + * asynchroniosly and keep CKEDITOR flow as expected + */ + setTimeout(function() { + var scaytInstance = editor.scayt, + scaytLangList = scaytInstance && scaytInstance.getScaytLangList(); + + /* + * Checks SCAYT initialization of LangList. To prevent immediate + * markup which is triggered by 'startSpellCheck' event. + * E.g.: Drop into inline CKEDITOR with scayt_autoStartup = true; + */ + if (!scaytLangList || !(scaytLangList.ltr && scaytLangList.rtl)) return; + + /* + * CKEditor can keep \u200B character in document (with selection#selectRanges) + * we need to take care about that. For this case we fire + * 'keydown' [left arrow], what will trigger 'removeFillingChar' on Webkit + * to cleanup the document + */ + editor.document.fire( 'keydown', new CKEDITOR.dom.event( { keyCode: 37 } ) ); + + /* trigger remove markup with 'startSpellCheck' */ + scaytInstance.removeMarkupInSelectionNode(removeOptions); + scaytInstance.fire('startSpellCheck, startGrammarCheck'); + }, timeout || 0 ); + }); + + // Reload spell-checking for current word after insertion completed. + editor.on('insertElement', function() { + // IE bug: we need wait here to make sure that focus is returned to editor, and we can store the selection before we proceed with markup + editor.fire('reloadMarkupScayt', {removeOptions: {forceBookmark: true}}); + }, this, null, 50); + + editor.on('insertHtml', function() { + editor.fire('reloadMarkupScayt'); + }, this, null, 50); + + editor.on('insertText', function() { + editor.fire('reloadMarkupScayt'); + }, this, null, 50); + + // The event is listening to open necessary dialog tab + editor.on('scaytDialogShown', function(ev) { + var dialog = ev.data, + scaytInstance = editor.scayt; + + dialog.selectPage(scaytInstance.tabToOpen); + }); + }, + parseConfig: function(editor) { + var plugin = CKEDITOR.plugins.scayt; + + // preprocess config for backward compatibility + plugin.replaceOldOptionsNames(editor.config); + + // Checking editor's config after initialization + if(typeof editor.config.scayt_autoStartup !== 'boolean') { + editor.config.scayt_autoStartup = false; + } + plugin.state.scayt[editor.name] = editor.config.scayt_autoStartup; + + if(typeof editor.config.grayt_autoStartup !== 'boolean') { + editor.config.grayt_autoStartup = false; + } + if(typeof editor.config.scayt_inlineModeImmediateMarkup !== 'boolean') { + editor.config.scayt_inlineModeImmediateMarkup = false; + } + plugin.state.grayt[editor.name] = editor.config.grayt_autoStartup; + + if(!editor.config.scayt_contextCommands) { + editor.config.scayt_contextCommands = 'ignore|ignoreall|add'; + } + + if(!editor.config.scayt_contextMenuItemsOrder) { + editor.config.scayt_contextMenuItemsOrder = 'suggest|moresuggest|control'; + } + + if(!editor.config.scayt_sLang) { + editor.config.scayt_sLang = 'en_US'; + } + + if(editor.config.scayt_maxSuggestions === undefined || typeof editor.config.scayt_maxSuggestions != 'number' || editor.config.scayt_maxSuggestions < 0) { + editor.config.scayt_maxSuggestions = 5; + } + + if(editor.config.scayt_minWordLength === undefined || typeof editor.config.scayt_minWordLength != 'number' || editor.config.scayt_minWordLength < 1) { + editor.config.scayt_minWordLength = 4; + } + + if(editor.config.scayt_customDictionaryIds === undefined || typeof editor.config.scayt_customDictionaryIds !== 'string') { + editor.config.scayt_customDictionaryIds = ''; + } + + if(editor.config.scayt_userDictionaryName === undefined || typeof editor.config.scayt_userDictionaryName !== 'string') { + editor.config.scayt_userDictionaryName = null; + } + + if(typeof editor.config.scayt_uiTabs === 'string' && editor.config.scayt_uiTabs.split(',').length === 3) { + var scayt_uiTabs = [], _tempUITabs = []; + editor.config.scayt_uiTabs = editor.config.scayt_uiTabs.split(','); + + CKEDITOR.tools.search(editor.config.scayt_uiTabs, function(value) { + if (Number(value) === 1 || Number(value) === 0) { + _tempUITabs.push(true); + scayt_uiTabs.push(Number(value)); + } else { + _tempUITabs.push(false); + } + }); + + if (CKEDITOR.tools.search(_tempUITabs, false) === null) { + editor.config.scayt_uiTabs = scayt_uiTabs; + } else { + editor.config.scayt_uiTabs = [1,1,1]; + } + + } else { + editor.config.scayt_uiTabs = [1,1,1]; + } + + if(typeof editor.config.scayt_serviceProtocol != 'string') { + editor.config.scayt_serviceProtocol = null; + } + + if(typeof editor.config.scayt_serviceHost != 'string') { + editor.config.scayt_serviceHost = null; + } + + if(typeof editor.config.scayt_servicePort != 'string') { + editor.config.scayt_servicePort = null; + } + + if(typeof editor.config.scayt_servicePath != 'string') { + editor.config.scayt_servicePath = null; + } + + if(!editor.config.scayt_moreSuggestions) { + editor.config.scayt_moreSuggestions = 'on'; + } + + if(typeof editor.config.scayt_customerId !== 'string') { + editor.config.scayt_customerId = '1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2'; + } + + if(typeof editor.config.scayt_srcUrl !== 'string') { + var protocol = document.location.protocol; + protocol = protocol.search(/https?:/) != -1 ? protocol : 'http:'; + + editor.config.scayt_srcUrl = protocol + '//svc.webspellchecker.net/spellcheck31/lf/scayt3/ckscayt/ckscayt.js'; + } + + if(typeof CKEDITOR.config.scayt_handleCheckDirty !== 'boolean') { + CKEDITOR.config.scayt_handleCheckDirty = true; + } + + if(typeof CKEDITOR.config.scayt_handleUndoRedo !== 'boolean') { + /* set default as 'true' */ + CKEDITOR.config.scayt_handleUndoRedo = true; + } + /* checking 'undo' plugin, if no disable SCAYT handler */ + CKEDITOR.config.scayt_handleUndoRedo = CKEDITOR.plugins.undo ? CKEDITOR.config.scayt_handleUndoRedo : false; + + if(typeof editor.config.scayt_multiLanguageMode !== 'boolean') { + editor.config.scayt_multiLanguageMode = false; + } + + if(typeof editor.config.scayt_multiLanguageStyles !== 'object') { + editor.config.scayt_multiLanguageStyles = {}; + } + + if(editor.config.scayt_ignoreAllCapsWords && typeof editor.config.scayt_ignoreAllCapsWords !== 'boolean') { + editor.config.scayt_ignoreAllCapsWords = false; + } + + if(editor.config.scayt_ignoreDomainNames && typeof editor.config.scayt_ignoreDomainNames !== 'boolean') { + editor.config.scayt_ignoreDomainNames = false; + } + + if(editor.config.scayt_ignoreWordsWithMixedCases && typeof editor.config.scayt_ignoreWordsWithMixedCases !== 'boolean') { + editor.config.scayt_ignoreWordsWithMixedCases = false; + } + + if(editor.config.scayt_ignoreWordsWithNumbers && typeof editor.config.scayt_ignoreWordsWithNumbers !== 'boolean') { + editor.config.scayt_ignoreWordsWithNumbers = false; + } + + if( editor.config.scayt_disableOptionsStorage ) { + var userOptions = CKEDITOR.tools.isArray( editor.config.scayt_disableOptionsStorage ) ? editor.config.scayt_disableOptionsStorage : ( typeof editor.config.scayt_disableOptionsStorage === 'string' ) ? [ editor.config.scayt_disableOptionsStorage ] : undefined, + availableValue = [ 'all', 'options', 'lang', 'ignore-all-caps-words', 'ignore-domain-names', 'ignore-words-with-mixed-cases', 'ignore-words-with-numbers'], + valuesOption = ['lang', 'ignore-all-caps-words', 'ignore-domain-names', 'ignore-words-with-mixed-cases', 'ignore-words-with-numbers'], + search = CKEDITOR.tools.search, + indexOf = CKEDITOR.tools.indexOf; + + var isValidOption = function( option ) { + return !!search( availableValue, option ); + }; + + var makeOptionsToStorage = function( options ) { + var retval = []; + + for (var i = 0; i < options.length; i++) { + var value = options[i], + isGroupOptionInUserOptions = !!search( options, 'options' ); + + if( !isValidOption( value ) || isGroupOptionInUserOptions && !!search( valuesOption, function( val ) { if( val === 'lang' ) { return false; } } ) ) { + return; + } + + if( !!search( valuesOption, value ) ) { + valuesOption.splice( indexOf( valuesOption, value ), 1 ); + } + + if( value === 'all' || isGroupOptionInUserOptions && !!search( options, 'lang' )) { + return []; + } + + if( value === 'options' ) { + valuesOption = [ 'lang' ]; + } + } + + retval = retval.concat( valuesOption ); + + return retval; + }; + + editor.config.scayt_disableOptionsStorage = makeOptionsToStorage( userOptions ); + } + }, + addRule: function(editor) { + var plugin = CKEDITOR.plugins.scayt, + dataProcessor = editor.dataProcessor, + htmlFilter = dataProcessor && dataProcessor.htmlFilter, + pathFilters = editor._.elementsPath && editor._.elementsPath.filters, + dataFilter = dataProcessor && dataProcessor.dataFilter, + removeFormatFilter = editor.addRemoveFormatFilter, + pathFilter = function(element) { + var scaytInstance = editor.scayt; + + if( scaytInstance && (element.hasAttribute(plugin.options.data_attribute_name) || element.hasAttribute(plugin.options.problem_grammar_data_attribute)) ) { + return false; + } + }, + removeFormatFilterTemplate = function(element) { + var scaytInstance = editor.scayt, + result = true; + + if( scaytInstance && (element.hasAttribute(plugin.options.data_attribute_name) || element.hasAttribute(plugin.options.problem_grammar_data_attribute)) ) { + result = false; + } + + return result; + }; + + if(pathFilters) { + pathFilters.push(pathFilter); + } + + if(dataFilter) { + var dataFilterRules = { + elements: { + span: function(element) { + + var scaytState = element.hasClass(plugin.options.misspelled_word_class) && element.attributes[plugin.options.data_attribute_name], + graytState = element.hasClass(plugin.options.problem_grammar_class) && element.attributes[plugin.options.problem_grammar_data_attribute]; + + if(plugin && (scaytState || graytState)) { + delete element.name; + } + + return element; + } + } + }; + + dataFilter.addRules(dataFilterRules); + } + + if (htmlFilter) { + var htmlFilterRules = { + elements: { + span: function(element) { + + var scaytState = element.hasClass(plugin.options.misspelled_word_class) && element.attributes[plugin.options.data_attribute_name], + graytState = element.hasClass(plugin.options.problem_grammar_class) && element.attributes[plugin.options.problem_grammar_data_attribute]; + + if(plugin && (scaytState || graytState)) { + delete element.name; + } + + return element; + } + } + }; + + htmlFilter.addRules(htmlFilterRules); + } + + if(removeFormatFilter) { + removeFormatFilter.call(editor, removeFormatFilterTemplate); + } + }, + scaytMenuDefinition: function(editor) { + var self = this, + plugin = CKEDITOR.plugins.scayt, + scayt_instance = editor.scayt; + + return { + scayt: { + scayt_ignore: { + label: scayt_instance.getLocal('btn_ignore'), + group : 'scayt_control', + order : 1, + exec: function(editor) { + var scaytInstance = editor.scayt; + scaytInstance.ignoreWord(); + } + }, + scayt_ignoreall: { + label : scayt_instance.getLocal('btn_ignoreAll'), + group : 'scayt_control', + order : 2, + exec: function(editor) { + var scaytInstance = editor.scayt; + scaytInstance.ignoreAllWords(); + } + }, + scayt_add: { + label : scayt_instance.getLocal('btn_addWord'), + group : 'scayt_control', + order : 3, + exec : function(editor) { + var scaytInstance = editor.scayt; + + // @TODO: We need to add set/restore bookmark logic to 'addWordToUserDictionary' method inside dictionarymanager. + // Timeout is used as tmp fix for IE9, when after hitting 'Add word' menu item, document container was blurred. + setTimeout(function() { + scaytInstance.addWordToUserDictionary(); + }, 10); + } + }, + scayt_option: { + label : scayt_instance.getLocal('btn_options'), + group : 'scayt_control', + order : 4, + exec: function(editor) { + var scaytInstance = editor.scayt; + + scaytInstance.tabToOpen = 'options'; + editor.lockSelection(); + editor.openDialog(self.dialogName); + }, + verification: function(editor) { + return (editor.config.scayt_uiTabs[0] == 1) ? true : false; + } + }, + scayt_language: { + label : scayt_instance.getLocal('btn_langs'), + group : 'scayt_control', + order : 5, + exec: function(editor) { + var scaytInstance = editor.scayt; + + scaytInstance.tabToOpen = 'langs'; + editor.lockSelection(); + editor.openDialog(self.dialogName); + }, + verification: function(editor) { + return (editor.config.scayt_uiTabs[1] == 1) ? true : false; + } + }, + scayt_dictionary: { + label : scayt_instance.getLocal('btn_dictionaries'), + group : 'scayt_control', + order : 6, + exec: function(editor) { + var scaytInstance = editor.scayt; + + scaytInstance.tabToOpen = 'dictionaries'; + editor.lockSelection(); + editor.openDialog(self.dialogName); + }, + verification: function(editor) { + return (editor.config.scayt_uiTabs[2] == 1) ? true : false; + } + }, + scayt_about: { + label : scayt_instance.getLocal('btn_about'), + group : 'scayt_control', + order : 7, + exec: function(editor) { + var scaytInstance = editor.scayt; + + scaytInstance.tabToOpen = 'about'; + editor.lockSelection(); + editor.openDialog(self.dialogName); + } + } + }, + grayt: { + grayt_problemdescription: { + label : 'Grammar problem description', + group : 'grayt_description', // look at addMenuItems method for further info + order : 1, + state : CKEDITOR.TRISTATE_DISABLED, + exec: function(editor) {} + }, + grayt_ignore: { + label : scayt_instance.getLocal('btn_ignore'), + group : 'grayt_control', + order : 2, + exec: function(editor) { + var scaytInstance = editor.scayt; + + scaytInstance.ignorePhrase(); + } + } + } + }; + }, + buildSuggestionMenuItems: function(editor, suggestions, isScaytNode) { + var self = this, + itemList = {}, + subItemList = {}, + replaceKeyName = isScaytNode ? 'word' : 'phrase', + updateEventName = isScaytNode ? 'startGrammarCheck' : 'startSpellCheck', + plugin = CKEDITOR.plugins.scayt, + scayt_instance = editor.scayt; + + if(suggestions.length > 0 && suggestions[0] !== 'no_any_suggestions') { + + if(isScaytNode) { + // build SCAYT suggestions + for(var i = 0; i < suggestions.length; i++) { + + var commandName = 'scayt_suggest_' + CKEDITOR.plugins.scayt.suggestions[i].replace(' ', '_'); + + editor.addCommand(commandName, self.createCommand(CKEDITOR.plugins.scayt.suggestions[i], replaceKeyName, updateEventName)); + + if(i < editor.config.scayt_maxSuggestions) { + + // mainSuggestions + editor.addMenuItem(commandName, { + label: suggestions[i], + command: commandName, + group: 'scayt_suggest', + order: i + 1 + }); + + itemList[commandName] = CKEDITOR.TRISTATE_OFF; + + } else { + + // moreSuggestions + editor.addMenuItem(commandName, { + label: suggestions[i], + command: commandName, + group: 'scayt_moresuggest', + order: i + 1 + }); + + subItemList[commandName] = CKEDITOR.TRISTATE_OFF; + + if(editor.config.scayt_moreSuggestions === 'on') { + + editor.addMenuItem('scayt_moresuggest', { + label : scayt_instance.getLocal('btn_moreSuggestions'), + group : 'scayt_moresuggest', + order : 10, + getItems : function() { + return subItemList; + } + }); + + itemList['scayt_moresuggest'] = CKEDITOR.TRISTATE_OFF; + } + } + } + } else { + // build GRAYT suggestions + for(var i = 0; i < suggestions.length; i++) { + var commandName = 'grayt_suggest_' + CKEDITOR.plugins.scayt.suggestions[i].replace(' ', '_'); + + editor.addCommand(commandName, self.createCommand(CKEDITOR.plugins.scayt.suggestions[i], replaceKeyName, updateEventName)); + + // mainSuggestions + editor.addMenuItem(commandName, { + label: suggestions[i], + command: commandName, + group: 'grayt_suggest', + order: i + 1 + }); + + itemList[commandName] = CKEDITOR.TRISTATE_OFF; + } + } + } else { + var noSuggestionsCommand = 'no_scayt_suggest'; + itemList[noSuggestionsCommand] = CKEDITOR.TRISTATE_DISABLED; + + editor.addCommand(noSuggestionsCommand, { + exec: function() { + + } + }); + + editor.addMenuItem(noSuggestionsCommand, { + label : scayt_instance.getLocal('btn_noSuggestions') || noSuggestionsCommand, + command: noSuggestionsCommand, + group : 'scayt_suggest', + order : 0 + }); + } + + return itemList; + }, + menuGenerator: function(editor, selectionNode) { + var self = this, + scaytInstance = editor.scayt, + menuItems = this.scaytMenuDefinition(editor), + itemList = {}, + allowedOption = editor.config.scayt_contextCommands.split('|'), + lang = selectionNode.getAttribute(scaytInstance.getLangAttribute()) || scaytInstance.getLang(), + word, grammarPhrase, isScaytNode, isGrammarNode, problemDescriptionText; + + + isScaytNode = scaytInstance.isScaytNode(selectionNode); + isGrammarNode = scaytInstance.isGraytNode(selectionNode); + + if(isScaytNode) { + // we clicked scayt misspelling + // get suggestions + menuItems = menuItems.scayt; + + word = selectionNode.getAttribute(scaytInstance.getScaytNodeAttributeName()); + + scaytInstance.fire('getSuggestionsList', { + lang: lang, + word: word + }); + + itemList = this.buildSuggestionMenuItems(editor, CKEDITOR.plugins.scayt.suggestions, isScaytNode); + } else if(isGrammarNode) { + // we clicked grammar problem + // get suggestions + menuItems = menuItems.grayt; + grammarPhrase = selectionNode.getAttribute(scaytInstance.getGraytNodeAttributeName()); + + // setup grammar problem description + problemDescriptionText = scaytInstance.getProblemDescriptionText(grammarPhrase, lang); + if(menuItems.grayt_problemdescription && problemDescriptionText) { + menuItems.grayt_problemdescription.label = problemDescriptionText; + } + + scaytInstance.fire('getGrammarSuggestionsList', { + lang: lang, + phrase: grammarPhrase + }); + + itemList = this.buildSuggestionMenuItems(editor, CKEDITOR.plugins.scayt.suggestions, isScaytNode); + } + + if(isScaytNode && editor.config.scayt_contextCommands == 'off') { + return itemList; + } + + for(var key in menuItems) { + if(isScaytNode && CKEDITOR.tools.indexOf(allowedOption, key.replace('scayt_', '')) == -1 && editor.config.scayt_contextCommands != 'all') { + continue; + } + + if(typeof menuItems[key].state != 'undefined') { + itemList[key] = menuItems[key].state; + } else { + itemList[key] = CKEDITOR.TRISTATE_OFF; + } + + // delete item from context menu if its state isn't verified as allowed + if(typeof menuItems[key].verification === 'function' && !menuItems[key].verification(editor)) { + // itemList[key] = (menuItems[key].verification(editor)) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED; + delete itemList[key]; + } + + editor.addCommand(key, { + exec: menuItems[key].exec + }); + + editor.addMenuItem(key, { + label : editor.lang.scayt[menuItems[key].label] || menuItems[key].label, + command: key, + group : menuItems[key].group, + order : menuItems[key].order + }); + } + + return itemList; + }, + createCommand: function(suggestion, replaceKeyName, updateEventName) { + return { + exec: function(editor) { + var scaytInstance = editor.scayt, + eventObject = {}; + + eventObject[replaceKeyName] = suggestion; + scaytInstance.replaceSelectionNode(eventObject); + + // we need to remove grammar markup from selection node if we just performed replace action for misspelling + if(updateEventName === 'startGrammarCheck') { + scaytInstance.removeMarkupInSelectionNode({grammarOnly: true}); + } + // for grayt problem replacement we need to fire 'startSpellCheck' + // for scayt misspelling replacement we need to fire 'startGrammarCheck' + scaytInstance.fire(updateEventName); + } + }; + } +}); + +CKEDITOR.plugins.scayt = { + state: { + scayt: {}, + grayt: {} + }, + suggestions: [], + loadingHelper: { + loadOrder: [] + }, + isLoading: false, + options: { + disablingCommandExec: { + source: true, + newpage: true, + templates: true + }, + data_attribute_name: 'data-scayt-word', + misspelled_word_class: 'scayt-misspell-word', + problem_grammar_data_attribute: 'data-grayt-phrase', + problem_grammar_class: 'gramm-problem' + }, + backCompatibilityMap: { + 'scayt_service_protocol': 'scayt_serviceProtocol', + 'scayt_service_host' : 'scayt_serviceHost', + 'scayt_service_port' : 'scayt_servicePort', + 'scayt_service_path' : 'scayt_servicePath', + 'scayt_customerid' : 'scayt_customerId' + }, + replaceOldOptionsNames: function(config) { + for(var key in config) { + if(key in this.backCompatibilityMap) { + config[this.backCompatibilityMap[key]] = config[key]; + delete config[key]; + } + } + }, + createScayt : function(editor) { + var self = this, + plugin = CKEDITOR.plugins.scayt; + + this.loadScaytLibrary(editor, function(_editor) { + var textContainer = _editor.window && _editor.window.getFrame() || _editor.editable(); + + // Do not create SCAYT if there is no text container for usage + if(!textContainer) { + plugin.state.scayt[_editor.name] = false; + return; + } + + var scaytInstanceOptions = { + lang : _editor.config.scayt_sLang, + container : textContainer.$, + customDictionary : _editor.config.scayt_customDictionaryIds, + userDictionaryName : _editor.config.scayt_userDictionaryName, + localization : _editor.langCode, + customer_id : _editor.config.scayt_customerId, + debug : _editor.config.scayt_debug, + data_attribute_name : self.options.data_attribute_name, + misspelled_word_class: self.options.misspelled_word_class, + problem_grammar_data_attribute: self.options.problem_grammar_data_attribute, + problem_grammar_class: self.options.problem_grammar_class, + 'options-to-restore': _editor.config.scayt_disableOptionsStorage, + focused : _editor.editable().hasFocus, // #30260 we need to set focused=true if CKEditor is focused before SCAYT initialization + ignoreElementsRegex : _editor.config.scayt_elementsToIgnore, + minWordLength : _editor.config.scayt_minWordLength, + multiLanguageMode : _editor.config.scayt_multiLanguageMode, + multiLanguageStyles : _editor.config.scayt_multiLanguageStyles, + graytAutoStartup : plugin.state.grayt[_editor.name] + }; + + if(_editor.config.scayt_serviceProtocol) { + scaytInstanceOptions['service_protocol'] = _editor.config.scayt_serviceProtocol; + } + + if(_editor.config.scayt_serviceHost) { + scaytInstanceOptions['service_host'] = _editor.config.scayt_serviceHost; + } + + if(_editor.config.scayt_servicePort) { + scaytInstanceOptions['service_port'] = _editor.config.scayt_servicePort; + } + + if(_editor.config.scayt_servicePath) { + scaytInstanceOptions['service_path'] = _editor.config.scayt_servicePath; + } + + //predefined options + if(typeof _editor.config.scayt_ignoreAllCapsWords === 'boolean') { + scaytInstanceOptions['ignore-all-caps-words'] = _editor.config.scayt_ignoreAllCapsWords; + } + + if(typeof _editor.config.scayt_ignoreDomainNames === 'boolean') { + scaytInstanceOptions['ignore-domain-names'] = _editor.config.scayt_ignoreDomainNames; + } + + if(typeof _editor.config.scayt_ignoreWordsWithMixedCases === 'boolean') { + scaytInstanceOptions['ignore-words-with-mixed-cases'] = _editor.config.scayt_ignoreWordsWithMixedCases; + } + + if(typeof _editor.config.scayt_ignoreWordsWithNumbers === 'boolean') { + scaytInstanceOptions['ignore-words-with-numbers'] = _editor.config.scayt_ignoreWordsWithNumbers; + } + + var scaytInstance = new SCAYT.CKSCAYT(scaytInstanceOptions, function() { + // success callback + }, function() { + // error callback + }), + wordsPrefix = 'word_'; + + scaytInstance.subscribe('suggestionListSend', function(data) { + // TODO: 1. Maybe store suggestions for specific editor + // TODO: 2. Fix issue with suggestion duplicates on on server + //CKEDITOR.plugins.scayt.suggestions = data.suggestionList; + var _wordsCollection = {}, + _suggestionList =[]; + + for (var i = 0; i < data.suggestionList.length; i++) { + if (!_wordsCollection[wordsPrefix + data.suggestionList[i]]) { + _wordsCollection[wordsPrefix + data.suggestionList[i]] = data.suggestionList[i]; + _suggestionList.push(data.suggestionList[i]); + } + } + + CKEDITOR.plugins.scayt.suggestions = _suggestionList; + }); + + // if selection has changed programmatically by SCAYT we need to react appropriately + scaytInstance.subscribe('selectionIsChanged', function(data) { + var selection = _editor.getSelection(); + + if(selection.isLocked) { + _editor.lockSelection(); + } + }); + + scaytInstance.subscribe('graytStateChanged', function(data) { + plugin.state.grayt[_editor.name] = data.state; + }); + + _editor.scayt = scaytInstance; + + _editor.fire('scaytButtonState', _editor.readOnly ? CKEDITOR.TRISTATE_DISABLED : CKEDITOR.TRISTATE_ON); + }); + }, + destroy: function(editor) { + if(editor.scayt) { + editor.scayt.destroy(); + } + + delete editor.scayt; + editor.fire('scaytButtonState', CKEDITOR.TRISTATE_OFF); + }, + loadScaytLibrary: function(editor, callback) { + var self = this, + date, + timestamp, + scaytUrl; + + // no need to process load requests from same editor as it can cause bugs with + // loading ckscayt app due to subsequent calls of some events + // need to be before 'if' statement, because of timing issue in CKEDITOR.scriptLoader + // when callback executing is delayed for a few milliseconds, and scayt can be created twise + // on one instance + if(this.loadingHelper[editor.name]) return; + + if(typeof window.SCAYT === 'undefined' || typeof window.SCAYT.CKSCAYT !== 'function') { + + // add onLoad callbacks for editors while SCAYT is loading + this.loadingHelper[editor.name] = callback; + this.loadingHelper.loadOrder.push(editor.name); + + //creating unique timestamp for SCAYT URL + date = new Date(); + timestamp = date.getTime(); + scaytUrl = editor.config.scayt_srcUrl; + + //if there already implemented timstamp for scayr_srcURL use it, if not use our timestamp + scaytUrl = scaytUrl + (scaytUrl.indexOf('?') >= 0 ? '' : '?' + timestamp); + + if (!this.loadingHelper.ckscaytLoading) { + CKEDITOR.scriptLoader.load(scaytUrl, function(success) { + var editorName; + + if ( success ) { + CKEDITOR.fireOnce('scaytReady'); + + for(var i = 0; i < self.loadingHelper.loadOrder.length; i++) { + editorName = self.loadingHelper.loadOrder[i]; + + if(typeof self.loadingHelper[editorName] === 'function') { + self.loadingHelper[editorName](CKEDITOR.instances[editorName]); + } + + delete self.loadingHelper[editorName]; + } + self.loadingHelper.loadOrder = []; + } + }); + this.loadingHelper.ckscaytLoading = true; + } + + + } else if(window.SCAYT && typeof window.SCAYT.CKSCAYT === 'function') { + CKEDITOR.fireOnce('scaytReady'); + + if(!editor.scayt) { + if(typeof callback === 'function') { + callback(editor); + } + } + } + } +}; + +CKEDITOR.on('dialogDefinition', function(dialogDefinitionEvent) { + var dialogName = dialogDefinitionEvent.data.name, + dialogDefinition = dialogDefinitionEvent.data.definition, + dialog = dialogDefinition.dialog; + + if (dialogName === 'scaytDialog') { + dialog.on('cancel', function(cancelEvent) { + return false; + }, this, null, -1); + } + + if ( dialogName === 'checkspell' ) { + dialog.on( 'cancel', function( cancelEvent ) { + var editor = cancelEvent.sender && cancelEvent.sender.getParentEditor(), + plugin = CKEDITOR.plugins.scayt, + scaytInstance = editor.scayt; + + if ( scaytInstance && plugin.state.scayt[ editor.name ] && scaytInstance.setMarkupPaused ) { + scaytInstance.setMarkupPaused( false ); + } + + editor.unlockSelection(); + }, this, null, -2 ); // we need to call cancel callback before WSC plugin + } + + if (dialogName === 'link') { + dialog.on('ok', function(okEvent) { + var editor = okEvent.sender && okEvent.sender.getParentEditor(); + + if(editor) { + setTimeout(function() { + editor.fire('reloadMarkupScayt', { + removeOptions: { + removeInside: true, + forceBookmark: true + }, + timeout: 0 + }); + }, 0); + } + }); + } +}); + +CKEDITOR.on('scaytReady', function() { + + // Override editor.checkDirty method avoid CK checkDirty functionality to fix SCAYT issues with incorrect checkDirty behavior. + if(CKEDITOR.config.scayt_handleCheckDirty === true) { + var editorCheckDirty = CKEDITOR.editor.prototype; + + editorCheckDirty.checkDirty = CKEDITOR.tools.override(editorCheckDirty.checkDirty, function(org) { + + return function() { + var retval = null, + pluginStatus = CKEDITOR.plugins.scayt && CKEDITOR.plugins.scayt.state.scayt[this.name] && this.scayt, + scaytInstance = this.scayt; + + if(!pluginStatus) { + retval = org.call(this); + } else { + retval = (this.status == 'ready'); + + if (retval) { + var currentData = scaytInstance.removeMarkupFromString(this.getSnapshot()), + prevData = scaytInstance.removeMarkupFromString(this._.previousValue); + + retval = (retval && (prevData !== currentData)) + } + } + + return retval; + }; + }); + + editorCheckDirty.resetDirty = CKEDITOR.tools.override(editorCheckDirty.resetDirty, function(org) { + return function() { + var pluginStatus = CKEDITOR.plugins.scayt && CKEDITOR.plugins.scayt.state.scayt[this.name] && this.scayt, + scaytInstance = this.scayt;//CKEDITOR.plugins.scayt.getScayt(this); + + if(!pluginStatus) { + org.call(this); + } else { + this._.previousValue = scaytInstance.removeMarkupFromString(this.getSnapshot()); + } + }; + }); + } + + if (CKEDITOR.config.scayt_handleUndoRedo === true) { + var undoImagePrototype = CKEDITOR.plugins.undo.Image.prototype; + + // add backword compatibility for CKEDITOR 4.2. method equals was repleced on other method + var equalsContentMethodName = (typeof undoImagePrototype.equalsContent == "function") ? 'equalsContent' : 'equals'; + + undoImagePrototype[equalsContentMethodName] = CKEDITOR.tools.override(undoImagePrototype[equalsContentMethodName], function(org) { + return function(otherImage) { + var pluginState = CKEDITOR.plugins.scayt && CKEDITOR.plugins.scayt.state.scayt[otherImage.editor.name] && otherImage.editor.scayt, + scaytInstance = otherImage.editor.scayt, + thisContents = this.contents, + otherContents = otherImage.contents, + retval = null; + + // Making the comparison based on content without SCAYT word markers. + if(pluginState) { + this.contents = scaytInstance.removeMarkupFromString(thisContents) || ''; + otherImage.contents = scaytInstance.removeMarkupFromString(otherContents) || ''; + } + + var retval = org.apply(this, arguments); + + this.contents = thisContents; + otherImage.contents = otherContents; + + return retval; + }; + }); + } +}); + +/** + * Automatically enables SCAYT on editor startup. When set to `true`, this option turns on SCAYT automatically + * after loading the editor. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * config.scayt_autoStartup = true; + * + * @cfg {Boolean} [scayt_autoStartup=false] + * @member CKEDITOR.config + */ + +/** + * Enables Grammar As You Type (GRAYT) on SCAYT startup. When set to `true`, this option turns on GRAYT automatically + * after SCAYT started. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * config.grayt_autoStartup = true; + * + * @since 4.5.6 + * @cfg {Boolean} [grayt_autoStartup=false] + * @member CKEDITOR.config + */ + +/** + * Enables SCAYT initialization when inline CKEditor is not focused. When set to `true`, SCAYT markup is + * displayed in both inline editor states, focused and unfocused, so the SCAYT instance is not destroyed. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * config.scayt_inlineModeImmediateMarkup = true; + * + * @since 4.5.6 + * @cfg {Boolean} [scayt_inlineModeImmediateMarkup=false] + * @member CKEDITOR.config + */ + +/** + * Defines the number of SCAYT suggestions to show in the main context menu. + * Possible values are: + * + * * `0` (zero) – No suggestions are shown in the main context menu. All + * entries will be listed in the "More Suggestions" sub-menu. + * * Positive number – The maximum number of suggestions to show in the context + * menu. Other entries will be shown in the "More Suggestions" sub-menu. + * * Negative number – Five suggestions are shown in the main context menu. All other + * entries will be listed in the "More Suggestions" sub-menu. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * Examples: + * + * // Display only three suggestions in the main context menu. + * config.scayt_maxSuggestions = 3; + * + * // Do not show the suggestions directly. + * config.scayt_maxSuggestions = 0; + * + * @cfg {Number} [scayt_maxSuggestions=5] + * @member CKEDITOR.config + */ + +/** + * Defines the minimum length of words that will be collected from the editor content for spell checking. + * Possible value is any positive number. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * Examples: + * + * // Set the minimum length of words that will be collected from editor text. + * config.scayt_minWordLength = 5; + * + * @cfg {Number} [scayt_minWordLength=4] + * @member CKEDITOR.config + */ + +/** + * Sets the customer ID for SCAYT. Used for hosted users only. Required for migration from free + * to trial or paid versions. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * // Load SCAYT using my customer ID. + * config.scayt_customerId = 'your-encrypted-customer-id'; + * + * @cfg {String} [scayt_customerId='1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2'] + * @member CKEDITOR.config + */ + +/** + * Enables and disables the "More Suggestions" sub-menu in the context menu. + * Possible values are `'on'` and `'off'`. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * // Disables the "More Suggestions" sub-menu. + * config.scayt_moreSuggestions = 'off'; + * + * @cfg {String} [scayt_moreSuggestions='on'] + * @member CKEDITOR.config + */ + +/** + * Customizes the display of SCAYT context menu commands ("Add Word", "Ignore", + * "Ignore All", "Options", "Languages", "Dictionaries" and "About"). + * This must be a string with one or more of the following + * words separated by a pipe character (`'|'`): + * + * * `off` – Disables all options. + * * `all` – Enables all options. + * * `ignore` – Enables the "Ignore" option. + * * `ignoreall` – Enables the "Ignore All" option. + * * `add` – Enables the "Add Word" option. + * * `option` – Enables the "Options" menu item. + * * `language` – Enables the "Languages" menu item. + * * `dictionary` – Enables the "Dictionaries" menu item. + * * `about` – Enables the "About" menu item. + * + * Please note that availability of the "Options", "Languages" and "Dictionaries" items + * also depends on the {@link CKEDITOR.config#scayt_uiTabs} option. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * Example: + * + * // Show only "Add Word" and "Ignore All" in the context menu. + * config.scayt_contextCommands = 'add|ignoreall'; + * + * @cfg {String} [scayt_contextCommands='ignore|ignoreall|add'] + * @member CKEDITOR.config + */ + +/** + * Sets the default spell checking language for SCAYT. Possible values are: + * `'en_US'`, `'en_GB'`, `'pt_BR'`, `'da_DK'`, + * `'nl_NL'`, `'en_CA'`, `'fi_FI'`, `'fr_FR'`, + * `'fr_CA'`, `'de_DE'`, `'el_GR'`, `'it_IT'`, + * `'nb_NO'`, `'pt_PT'`, `'es_ES'`, `'sv_SE'`. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * // Sets SCAYT to German. + * config.scayt_sLang = 'de_DE'; + * + * @cfg {String} [scayt_sLang='en_US'] + * @member CKEDITOR.config + */ + +/** + * Customizes the SCAYT dialog and SCAYT toolbar menu to show particular tabs and items. + * This setting must contain a `1` (enabled) or `0` + * (disabled) value for each of the following entries, in this precise order, + * separated by a comma (`','`): `'Options'`, `'Languages'`, and `'Dictionary'`. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * // Hides the "Languages" tab. + * config.scayt_uiTabs = '1,0,1'; + * + * @cfg {String} [scayt_uiTabs='1,1,1'] + * @member CKEDITOR.config + */ + +/** + * Sets the protocol for the WebSpellChecker service (`ssrv.cgi`) full path. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * // Defines the protocol for the WebSpellChecker service (ssrv.cgi) path. + * config.scayt_serviceProtocol = 'https'; + * + * @cfg {String} [scayt_serviceProtocol='http'] + * @member CKEDITOR.config + */ + +/** + * Sets the host for the WebSpellChecker service (`ssrv.cgi`) full path. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * // Defines the host for the WebSpellChecker service (ssrv.cgi) path. + * config.scayt_serviceHost = 'my-host'; + * + * @cfg {String} [scayt_serviceHost='svc.webspellchecker.net'] + * @member CKEDITOR.config + */ + +/** + * Sets the port for the WebSpellChecker service (`ssrv.cgi`) full path. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * // Defines the port for the WebSpellChecker service (ssrv.cgi) path. + * config.scayt_servicePort = '2330'; + * + * @cfg {String} [scayt_servicePort='80'] + * @member CKEDITOR.config + */ + +/** + * Sets the path to the WebSpellChecker service (`ssrv.cgi`). + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * // Defines the path to the WebSpellChecker service (ssrv.cgi). + * config.scayt_servicePath = 'my-path/ssrv.cgi'; + * + * @cfg {String} [scayt_servicePath='spellcheck31/script/ssrv.cgi'] + * @member CKEDITOR.config + */ + +/** + * Sets the URL to SCAYT core. Required to switch to the licensed version of SCAYT. + * + * Refer to [SCAYT documentation](http://wiki.webspellchecker.net/doku.php?id=migration:hosredfreetolicensedck) + * for more details. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * config.scayt_srcUrl = "http://my-host/spellcheck/lf/scayt/scayt.js"; + * + * @cfg {String} [scayt_srcUrl='//svc.webspellchecker.net/spellcheck31/lf/scayt3/ckscayt/ckscayt.js'] + * @member CKEDITOR.config + */ + +/** + * Links SCAYT to custom dictionaries. This is a string containing the dictionary IDs + * separated by commas (`','`). Available only for the licensed version. + * + * Refer to [SCAYT documentation](http://wiki.webspellchecker.net/doku.php?id=installationandconfiguration:customdictionaries:licensed) + * for more details. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * config.scayt_customDictionaryIds = '3021,3456,3478'; + * + * @cfg {String} [scayt_customDictionaryIds=''] + * @member CKEDITOR.config + */ + +/** + * Activates a User Dictionary in SCAYT. The user + * dictionary name must be used. Available only for the licensed version. + * + * Refer to [SCAYT documentation](http://wiki.webspellchecker.net/doku.php?id=installationandconfiguration:userdictionaries) + * for more details. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * config.scayt_userDictionaryName = 'MyDictionary'; + * + * @cfg {String} [scayt_userDictionaryName=''] + * @member CKEDITOR.config + */ + +/** + * Defines the order of SCAYT context menu items by groups. + * This must be a string with one or more of the following + * words separated by a pipe character (`'|'`): + * + * * `suggest` – The main suggestion word list. + * * `moresuggest` – The "More suggestions" word list. + * * `control` – SCAYT commands, such as "Ignore" and "Add Word". + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * Example: + * + * config.scayt_contextMenuItemsOrder = 'moresuggest|control|suggest'; + * + * @cfg {String} [scayt_contextMenuItemsOrder='suggest|moresuggest|control'] + * @member CKEDITOR.config + */ + +/** + * If set to `true`, it overrides the {@link CKEDITOR.editor#checkDirty checkDirty} functionality of CKEditor + * to fix SCAYT issues with incorrect `checkDirty` behavior. If set to `false`, + * it provides better performance on big preloaded text. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * config.scayt_handleCheckDirty = 'false'; + * + * @cfg {String} [scayt_handleCheckDirty='true'] + * @member CKEDITOR.config + */ + +/** + * Configures undo/redo behavior of SCAYT in CKEditor. + * If set to `true`, it overrides the undo/redo functionality of CKEditor + * to fix SCAYT issues with incorrect undo/redo behavior. If set to `false`, + * it provides better performance on text undo/redo. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * config.scayt_handleUndoRedo = 'false'; + * + * @cfg {String} [scayt_handleUndoRedo='true'] + * @member CKEDITOR.config + */ + +/** + * Enables the "Ignore All-Caps Words" option by default. + * You may need to {@link CKEDITOR.config#scayt_disableOptionsStorage disable option storing} for this setting to be + * effective because option storage has a higher priority. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * config.scayt_ignoreAllCapsWords = true; + * + * @since 4.5.6 + * @cfg {Boolean} [scayt_ignoreAllCapsWords=false] + * @member CKEDITOR.config + */ + +/** + * Enables the "Ignore Domain Names" option by default. + * You may need to {@link CKEDITOR.config#scayt_disableOptionsStorage disable option storing} for this setting to be + * effective because option storage has a higher priority. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * config.scayt_ignoreDomainNames = true; + * + * @since 4.5.6 + * @cfg {Boolean} [scayt_ignoreDomainNames=false] + * @member CKEDITOR.config + */ + +/** + * Enables the "Ignore Words with Mixed Case" option by default. + * You may need to {@link CKEDITOR.config#scayt_disableOptionsStorage disable option storing} for this setting to be + * effective because option storage has a higher priority. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * config.scayt_ignoreWordsWithMixedCases = true; + * + * @since 4.5.6 + * @cfg {Boolean} [scayt_ignoreWordsWithMixedCases=false] + * @member CKEDITOR.config + */ + +/** + * Enables the "Ignore Words with Numbers" option by default. + * You may need to {@link CKEDITOR.config#scayt_disableOptionsStorage disable option storing} for this setting to be + * effective because option storage has a higher priority. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * config.scayt_ignoreWordsWithNumbers = true; + * + * @since 4.5.6 + * @cfg {Boolean} [scayt_ignoreWordsWithNumbers=false] + * @member CKEDITOR.config + */ + +/** + * Disables storing of SCAYT options between sessions. Option storing will be turned off after a page refresh. + * The following settings can be used: + * + * * `'options'` – Disables storing of all SCAYT Ignore options. + * * `'ignore-all-caps-words'` – Disables storing of the "Ignore All-Caps Words" option. + * * `'ignore-domain-names'` – Disables storing of the "Ignore Domain Names" option. + * * `'ignore-words-with-mixed-cases'` – Disables storing of the "Ignore Words with Mixed Case" option. + * * `'ignore-words-with-numbers'` – Disables storing of the "Ignore Words with Numbers" option. + * * `'lang'` – Disables storing of the SCAYT spell check language. + * * `'all'` – Disables storing of all SCAYT options. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * Example: + * + * // Disabling one option. + * config.scayt_disableOptionsStorage = 'all'; + * + * // Disabling several options. + * config.scayt_disableOptionsStorage = ['lang', 'ignore-domain-names', 'ignore-words-with-numbers']; + * + * + * @cfg {String|Array} [scayt_disableOptionsStorage = ''] + * @member CKEDITOR.config + */ + +/** + * Specifies the names of tags that will be skipped while spell checking. This is a string containing tag names + * separated by commas (`','`). Please note that the `'style'` tag would be added to specified tags list. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * config.scayt_elementsToIgnore = 'del,pre'; + * + * @cfg {String} [scayt_elementsToIgnore='style'] + * @member CKEDITOR.config + */ + +/** + * Enables multi-language support in SCAYT. If set to `true`, turns on SCAYT multi-language support after loading the editor. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * config.scayt_multiLanguageMode = true; + * + * @cfg {Boolean} [scayt_multiLanguageMode=false] + * @member CKEDITOR.config + */ + +/** + * Defines additional styles for misspellings for specified languages. Styles will be applied only if + * the {@link CKEDITOR.config#scayt_multiLanguageMode} option is set to `true` and the [Language](http://ckeditor.com/addon/language) + * plugin is included and loaded in the editor. By default, all misspellings will still be underlined with the red waveline. + * + * Read more in the [documentation](#!/guide/dev_spellcheck) and see the [SDK sample](http://sdk.ckeditor.com/samples/spellchecker.html). + * + * Example: + * + * // Display misspellings in French language with green color and underlined with red waveline. + * config.scayt_multiLanguageStyles = { + * 'fr': 'color: green' + * }; + * + * // Display misspellings in Italian language with green color and underlined with red waveline + * // and German misspellings with red color only. + * config.scayt_multiLanguageStyles = { + * 'it': 'color: green', + * 'de': 'background-image: none; color: red' + * }; + * + * @cfg {Object} [scayt_multiLanguageStyles = {}] + * @member CKEDITOR.config + */ diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index 82ccb6af59..3394e57e08 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -71,7 +71,7 @@ a.thumbnail:hover{ display: block; padding-bottom: 100%; overflow: hidden; - + } .gallery .frame{ background-color: #eeeeee; @@ -128,6 +128,14 @@ a.thumbnail:hover{ padding-top: 10px; margin-top: 5px; } +#toolbar-admin.navbar{ + margin-bottom: 0; + border-radius: 0; + border: none; +} +header{ + padding-top: 20px; +} .blackboard_show { float:left; position:absolute; @@ -5786,7 +5794,7 @@ a.sessionView { } /* Landscape phones and down */ @media only screen and (min-device-width : 320px) and (max-device-width : 480px) { - + #learning_path_breadcrumb_zone { } #learning_path_main{ @@ -5861,7 +5869,7 @@ a.sessionView { #show_graph{ text-align: center; } - + } @media (min-width : 480px) and (max-width: 767px) { #touch-button{ @@ -5972,3 +5980,7 @@ a.sessionView { font-size: 120%; margin-bottom: 0; } + +#upload_form .fa-plus-square-o, #upload_form .fa-minus-square-o { + cursor:pointer; +} \ No newline at end of file diff --git a/app/Resources/public/css/chat.css b/app/Resources/public/css/chat.css index 6f9d2a9e1d..8578b287e3 100644 --- a/app/Resources/public/css/chat.css +++ b/app/Resources/public/css/chat.css @@ -1,13 +1,5 @@ -body{ - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 13px; - line-height: 18px; - color: #333333; - margin: 0; - padding: 0; -} .page-chat{ - padding: 10px; + padding: 10px 0; background:#ffffff; } .message-form-chat .nav{ @@ -16,48 +8,7 @@ body{ .message-form-chat .nav-tabs .active a{ background-color: #f6f6f6; } -#clear-chat{ - width:140px; - padding: 13px; - font-size: 14px; - float:right; -} -#clear-chat img{ - width: 20px; - float: left; - margin-right: 5px; -} -#clear-chat a{ - text-decoration: none; -} -#clear-chat a:hover{ - opacity: 0.7; -} -#content-chat{ - background:#ffffff; - padding: 30px; - -webkit-border-radius: 10px; - -moz-border-radius: 10px; - border-radius: 10px; -} - -textarea { - width: 52%; - padding: 3%; - height: 100px; - float: left; - border: 0; - background-color: #ffffff; - - font-family: Helvetica, arial, sans-serif; - -webkit-border-radius: 10px; - -moz-border-radius: 10px; - border-radius: 10px; - border: 1px solid #EEEEEE; - color: #666; - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35) inset; -} .message-student .chat-image, .message-teacher .chat-image{ width: 80px; height: auto; @@ -85,7 +36,7 @@ textarea { font-size: 13px; padding: 15px; vertical-align: top; - width: 310px; + width: calc(100% - 100px); } .message-teacher .icon-message{ display: inline-block; @@ -121,7 +72,7 @@ textarea { font-size: 13px; padding: 15px; vertical-align: top; - width: 360px; + width: calc(100% - 100px); } .message-teacher .message-date{ color: #666; @@ -138,121 +89,30 @@ textarea { text-align: right; margin-top: 10px; } -.user-online .profile{ - list-style: none; - padding: 0; - margin:0; -} -.chat-message-block-name { - font-style: italic; - color: #666; -} -.user-online .profile li{ - margin-bottom: 5px; -} -.user-online .profile li a{ - color: #0088AA; - text-decoration: none; -} -.user-online .title{ - background: url(chat.png) no-repeat 0 center; - color: #0088AA; - padding-top: 5px; - padding-left: 30px; - font-weight: bold; - font-size: 16px; - margin-bottom: 15px; - width: 90%; -} -.delete-chat{ - background: #F8F8F8; - padding-bottom: 15px; -} -.list-group { - margin-bottom: 20px; - padding-left: 0; -} -.list-group-item { - position: relative; - display: block; - padding-top: 5px; - padding-bottom: 10px; - padding-left: 10px; - padding-right: 10px; - margin-bottom: -1px; - background-color: #EEEEEE; - border: 1px solid #E2E2E2; - -webkit-border-radius: 10px; + +.chat-user { + background-color: #EEEEEE; + border: 1px solid #E2E2E2; + -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; color: #666; + margin-bottom: -1px; + padding: 10px; } -.user-connected{ - border-right: 1px dashed #cccccc; - margin-right: 5px; -} -li.list-group-item:hover, li.list-group-item:focus { - text-decoration: none; - background-color: #E2E2E2; - cursor: pointer; - border: 1px solid #EEEEEE; -} -li.list-group-item:hover a{ - color: #000; -} -.user-image-chat{ - width: 40px; - height: auto; - max-height: 40px; - display: inline-block; - vertical-align: top; - -webkit-border-radius: 10px; +.chat-user .user-image-chat { + -webkit-border-radius: 10px; -moz-border-radius: 10px; + border: 2px solid #FFF; border-radius: 10px; - border:2px solid #ffffff; + display: inline-block; + height: auto; + margin-right: 10px; + max-height: 40px; float: left; - margin-right: 5px; -} -.noSelect { - user-select: none; - -o-user-select: none; - -moz-user-select: none; - -khtml-user-select: none; - -webkit-user-select: none; -} -.btn-send { - background: #87e0fd; /* Old browsers */ - background: -moz-linear-gradient(top, #87e0fd 0%, #53cbf1 40%, #05abe0 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#87e0fd), color-stop(40%,#53cbf1), color-stop(100%,#05abe0)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #87e0fd 0%,#53cbf1 40%,#05abe0 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #87e0fd 0%,#53cbf1 40%,#05abe0 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #87e0fd 0%,#53cbf1 40%,#05abe0 100%); /* IE10+ */ - background: linear-gradient(to bottom, #87e0fd 0%,#53cbf1 40%,#05abe0 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#87e0fd', endColorstr='#05abe0',GradientType=0 ); /* IE6-9 */ - -webkit-border-radius: 15px; - -moz-border-radius: 15px; - border-radius: 15px; - border:1px solid #53cbf1; - display:inline-block; - color:#ffffff; - font-family:Arial; - font-size:22px; - font-weight:bold; - font-style:normal; - height:80px; - line-height:80px; - width:131px; - text-decoration:none; - text-align:center; - cursor: pointer; -} -.btn-send:hover { - opacity: 0.8; -} -.btn-send:active { - position:relative; - top:1px; + width: 40px; } + .emoticons-chat img{ width: 24px; border: none; @@ -267,21 +127,17 @@ li.list-group-item:hover a{ } .emoji-menu { - margin-left: 0px; - width:468px; - left: 11px !important; + margin-left: -234px; + margin-top: -224px; + width: 468px; } .emoji-wysiwyg-editor-preview, .emoji-wysiwyg-editor { - width: 454px; padding: 3%; height: 50px; - float: left; border: 0; background-color: #ffffff; - - font-family: Helvetica, arial, sans-serif; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; @@ -289,3 +145,19 @@ li.list-group-item:hover a{ color: #666; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35) inset; } + +#chat-tabs .tab-content{ + margin-top: 15px; +} + +.chat-history { + height: 400px; + overflow: auto; +} + +#chat-users { + margin-left: 0; +} +#chat-users div.chat-user > div { + padding: 5px; +} diff --git a/app/Resources/public/css/scorm.css b/app/Resources/public/css/scorm.css index c51b04bc75..15ee7332f9 100644 --- a/app/Resources/public/css/scorm.css +++ b/app/Resources/public/css/scorm.css @@ -109,7 +109,7 @@ See https://support.chamilo.org/issues/6976 } .inner_lp_toc .scorm_item_section .scorm_item:before { - content : url('../../main/img/lp_section.png'); /* path from main/newscorm/lp_controller.php file */ + content : url('../../main/img/lp_section.png'); /* path from main/lp/lp_controller.php file */ vertical-align: text-top; margin-right : 5px; } diff --git a/app/Resources/public/css/themes/chamilo/default.css b/app/Resources/public/css/themes/chamilo/default.css index 7866ee62c1..d6a0c16b48 100644 --- a/app/Resources/public/css/themes/chamilo/default.css +++ b/app/Resources/public/css/themes/chamilo/default.css @@ -56,7 +56,7 @@ a:focus { overflow: hidden !important; } .navbar-default { - background: #3C8DBC; + background: #337AB7; -webkit-box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1); } @@ -68,7 +68,7 @@ a:focus { .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus{ color: #fff; - background-color:#367FA9; + background-color:#2C5B8E; } .navbar-default .navbar-nav > li > a{ color: #ffffff; @@ -76,7 +76,7 @@ a:focus { .navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .open > a:hover, .navbar-default .navbar-nav > .open > a:focus{ - background: #367FA9; + background: #18477A; color: #ffffff; } .navbar-nav > li > .dropdown-menu{ @@ -140,13 +140,8 @@ a:focus { } /* End Jquery UI */ footer{ - background-color:#2C3E50; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff54b4eb', endColorstr='#ff1d9ce5', GradientType=0); - border-bottom: 1px solid #2C3E50; - -webkit-filter: none; - filter: none; - -webkit-box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1); - box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1); + background-color:#1A2226; + border-top: 2px solid #D2D6DE; } footer{ color: #ffffff; diff --git a/app/bootstrap.php.cache b/app/bootstrap.php.cache index ae5ff197bb..35212edfb3 100644 --- a/app/bootstrap.php.cache +++ b/app/bootstrap.php.cache @@ -1358,7 +1358,7 @@ const HTTP_REQUEST_URI_TOO_LONG = 414; const HTTP_UNSUPPORTED_MEDIA_TYPE = 415; const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416; const HTTP_EXPECTATION_FAILED = 417; -const HTTP_I_AM_A_TEAPOT = 418; const HTTP_MISDIRECTED_REQUEST = 421; const HTTP_UNPROCESSABLE_ENTITY = 422; const HTTP_LOCKED = 423; const HTTP_FAILED_DEPENDENCY = 424; const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; const HTTP_UPGRADE_REQUIRED = 426; const HTTP_PRECONDITION_REQUIRED = 428; const HTTP_TOO_MANY_REQUESTS = 429; const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; const HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451; +const HTTP_I_AM_A_TEAPOT = 418; const HTTP_UNPROCESSABLE_ENTITY = 422; const HTTP_LOCKED = 423; const HTTP_FAILED_DEPENDENCY = 424; const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; const HTTP_UPGRADE_REQUIRED = 426; const HTTP_PRECONDITION_REQUIRED = 428; const HTTP_TOO_MANY_REQUESTS = 429; const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; const HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451; const HTTP_INTERNAL_SERVER_ERROR = 500; const HTTP_NOT_IMPLEMENTED = 501; const HTTP_BAD_GATEWAY = 502; @@ -1407,7 +1407,7 @@ public static $statusTexts = array( 415 =>'Unsupported Media Type', 416 =>'Range Not Satisfiable', 417 =>'Expectation Failed', -418 =>'I\'m a teapot', 421 =>'Misdirected Request', 422 =>'Unprocessable Entity', 423 =>'Locked', 424 =>'Failed Dependency', 425 =>'Reserved for WebDAV advanced collections expired proposal', 426 =>'Upgrade Required', 428 =>'Precondition Required', 429 =>'Too Many Requests', 431 =>'Request Header Fields Too Large', 451 =>'Unavailable For Legal Reasons', 500 =>'Internal Server Error', +418 =>'I\'m a teapot', 422 =>'Unprocessable Entity', 423 =>'Locked', 424 =>'Failed Dependency', 425 =>'Reserved for WebDAV advanced collections expired proposal', 426 =>'Upgrade Required', 428 =>'Precondition Required', 429 =>'Too Many Requests', 431 =>'Request Header Fields Too Large', 451 =>'Unavailable For Legal Reasons', 500 =>'Internal Server Error', 501 =>'Not Implemented', 502 =>'Bad Gateway', 503 =>'Service Unavailable', @@ -2204,10 +2204,6 @@ if ($e instanceof InactiveScopeException && self::EXCEPTION_ON_INVALID_REFERENCE return; } throw $e; -} catch (\Throwable $e) { -unset($this->loading[$id]); -unset($this->services[$id]); -throw $e; } unset($this->loading[$id]); return $service; @@ -2432,11 +2428,11 @@ protected $booted = false; protected $name; protected $startTime; protected $loadClassCache; -const VERSION ='2.8.7'; -const VERSION_ID = 20807; +const VERSION ='2.8.6'; +const VERSION_ID = 20806; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; -const RELEASE_VERSION = 7; +const RELEASE_VERSION = 6; const EXTRA_VERSION =''; const END_OF_MAINTENANCE ='11/2018'; const END_OF_LIFE ='11/2019'; @@ -3325,10 +3321,6 @@ $response = parent::handle($request, $type, $catch); $this->container->set('request', null,'request'); $this->container->leaveScope('request'); throw $e; -} catch (\Throwable $e) { -$this->container->set('request', null,'request'); -$this->container->leaveScope('request'); -throw $e; } $this->container->set('request', null,'request'); $this->container->leaveScope('request'); diff --git a/app/check.php b/app/check.php index bd56279f3c..cf1e6b0609 100644 --- a/app/check.php +++ b/app/check.php @@ -12,7 +12,7 @@ echo '> PHP is using the following php.ini file:'.PHP_EOL; if ($iniPath) { echo_style('green', ' '.$iniPath); } else { - echo_style('warning', ' WARNING: No configuration file (php.ini) used by PHP!'); + echo_style('yellow', ' WARNING: No configuration file (php.ini) used by PHP!'); } echo PHP_EOL.PHP_EOL; diff --git a/app/config/config.yml b/app/config/config.yml index 7b9288985c..c5ac2b86c8 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -74,9 +74,8 @@ framework: http_method_override: true theodo_evolution_session: - bag_manager: - class: Theodo\Evolution\Bundle\SessionBundle\Manager\Symfony1\BagManager - configuration_class: Theodo\Evolution\Bundle\SessionBundle\Manager\Symfony1\BagConfiguration + bag_manager_service: theodo_evolution.session.symfony1.bag_manager + bag_configuration_service: theodo_evolution.session.symfony1.bag_manager_configuration # Twig Configuration twig: diff --git a/cli-config.php b/cli-config.php index 33fc98bc60..d3744e4650 100644 --- a/cli-config.php +++ b/cli-config.php @@ -35,10 +35,10 @@ $dbParams = array( ); $database->connect($dbParams, realpath(__DIR__).'/', realpath(__DIR__).'/'); -$entityManager = $database->getManager(); +$entityManager = $database::getManager(); $helperSet = ConsoleRunner::createHelperSet($entityManager); -$dialogHelper = new Symfony\Component\Console\Helper\DialogHelper(); +$dialogHelper = new Symfony\Component\Console\Helper\QuestionHelper(); $helperSet->set($dialogHelper); return $helperSet; diff --git a/composer.json b/composer.json index 8cf644dfc9..a08177d8ba 100755 --- a/composer.json +++ b/composer.json @@ -22,9 +22,9 @@ "main/cron/lang", "main/course_description", "main/dropbox", - "main/exercice", + "main/exercise", "main/gradebook/lib", - "main/newscorm", + "main/lp", "main/inc/lib", "plugin", "main/install", @@ -119,7 +119,7 @@ "ezyang/htmlpurifier": "4.6.0", "szymach/c-pchart": "1.*", "aferrandini/phpqrcode": "1.0.1", - "mpdf/mpdf": "5.7.4", + "mpdf/mpdf": "6.1.*", "barryvdh/elfinder-builds": "2.1.0.3", "jbroadway/urlify": "1.0.3-stable", "monolog/monolog": "~1.0", diff --git a/documentation/changelog.html b/documentation/changelog.html index 3438b6985d..478fd6d068 100755 --- a/documentation/changelog.html +++ b/documentation/changelog.html @@ -47,6 +47,48 @@

Note: most #wxyz references are issue numbers you can find in our public bug tracking system. Some references marked BT#xyz are developments made externally for BeezNest customers and integrated into Chamilo. The details of these tasks cannot be seen for confidentiality reasons, but the code change is public and can be reviewed by anyone.

 

+ + +

Chamilo 1.11.0 - tobenamed, xxth of July 2016

+

Release notes - summary

+

Chamilo 1.11.0 is a major release of the 1.11.x branch. It is meant as a transition between 1.10 and 2.0 versions.

+

Release name

+

+

Security fixes

+

None in this version.

+

Possibly breaking changes

+

None in this version.

+

Notable new Features

+

For end-users, teachers and Chamilo admins

+ +

For developers and sysadmins

+ +

Stylesheets and theming

+ +

Files structure

+ +

Web services

+ +

Removals

+ +

Known issues

+ + +

Chamilo 1.10.6 - Zacatecas, 24th of May 2016

diff --git a/documentation/installation_guide.html b/documentation/installation_guide.html index 50e5b106cb..d9e2838145 100755 --- a/documentation/installation_guide.html +++ b/documentation/installation_guide.html @@ -680,6 +680,8 @@ If you have issues with files taking a long time to download, make sure you reco RewriteRule ^courses/([^/]+)/course-pic.png$ app/courses/$1/course-pic.png [QSA,L] RewriteRule ^session/(\d{1,})/about/?$ main/session/about.php?session_id=$1 [L] RewriteRule ^badge/(\d{1,})/user/(\d{1,}) main/badge/issued.php?skill=$1&user=$2 [L] + RewriteRule ^main/exercice/(.+)$ main/exercise/$1 [QSA,L] + RewriteRule ^main/newscorm/(.*)$ main/lp/$1 [QSA,L] </Directory>

Nginx

@@ -718,6 +720,8 @@ If you have issues with files taking a long time to download, make sure you reco rewrite ^/courses/([^/]+)/$ /main/course_home/course_home.php?cDir=$1 last; rewrite ^/courses/([^/]+)/index.php$ /main/course_home/course_home.php?cDir=$1 last; rewrite ^/session/([^/]+)/about/?$ /main/session/about.php?session_id=$1 last; + rewrite ^/main/exercice/(.+)$ /main/exercise/$1 last; + rewrite ^/main/newscorm/(.+)$ /main/lp/$1 last; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; diff --git a/documentation/installation_guide_es_ES.html b/documentation/installation_guide_es_ES.html index 96ba9d2732..c9b0a024a2 100755 --- a/documentation/installation_guide_es_ES.html +++ b/documentation/installation_guide_es_ES.html @@ -711,6 +711,8 @@ por ejemplo. El efecto debería ser inmediato. rewrite ^/courses/([^/]+)/$ /main/course_home/course_home.php?cDir=$1 last; rewrite ^/courses/([^/]+)/index.php$ /main/course_home/course_home.php?cDir=$1 last; rewrite ^/session/([^/]+)/about/?$ /main/session/about.php?session_id=$1 last; + rewrite ^/main/exercice/(.+)$ /main/exercise/$1 last; + rewrite ^/main/newscorm/(.+)$ /main/lp/$1 last; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; @@ -777,6 +779,8 @@ Apache2: La configuración para nuestro sitio de ejemplo my.chamilo10.net sería RewriteRule ^courses/([^/]+)/course-pic.png$ app/courses/$1/course-pic.png [QSA,L] RewriteRule ^session/(\d{1,})/about/?$ main/session/about.php?session_id=$1 [L] RewriteRule ^badge/(\d{1,})/user/(\d{1,}) main/badge/issued.php?skill=$1&user=$2 [L] + RewriteRule ^main/exercice/(.+)$ main/exercise/$1 [QSA,L] + RewriteRule ^main/newscorm/(.*)$ main/lp/$1 [QSA,L] </Directory> php_value display_errors Off diff --git a/documentation/installation_guide_fr_FR.html b/documentation/installation_guide_fr_FR.html index 7e32ea1953..b9fda6ff36 100644 --- a/documentation/installation_guide_fr_FR.html +++ b/documentation/installation_guide_fr_FR.html @@ -739,6 +739,8 @@ ou, si vous travaillez avec Apache 2.4, la syntaxe est légèrement différente RewriteRule ^courses/([^/]+)/course-pic.png$ app/courses/$1/course-pic.png [QSA,L] RewriteRule ^session/(\d{1,})/about/?$ main/session/about.php?session_id=$1 [L] RewriteRule "^badge/(\d{1,})/user/(\d{1,})$" main/badge/issued.php?skill=$1&user=$2 [L] + RewriteRule ^main/exercice/(.+)$ main/exercise/$1 [QSA,L] + RewriteRule ^main/newscorm/(.*)$ main/lp/$1 [QSA,L] </Directory>

Nginx

@@ -777,6 +779,8 @@ Ce sont uniquement les redirections à placer dans un bloc server{}, comme les a rewrite ^/courses/([^/]+)/$ /main/course_home/course_home.php?cDir=$1 last; rewrite ^/courses/([^/]+)/index.php$ /main/course_home/course_home.php?cDir=$1 last; rewrite ^/session/([^/]+)/about/?$ /main/session/about.php?session_id=$1 last; + rewrite ^/main/exercice/(.+)$ /main/exercise/$1 last; + rewrite ^/main/newscorm/(.+)$ /main/lp/$1 last; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; diff --git a/documentation/optimization.html b/documentation/optimization.html index b9cfbc9a77..c4fab30f43 100755 --- a/documentation/optimization.html +++ b/documentation/optimization.html @@ -171,9 +171,9 @@ An optional additional caching mechanism you may use is the realpath_cache_size See the PHP documentation for more details.
-
+

APC

-If you prefer using APC, + If you prefer using APC, you can use the same kind of trick as above, just changing the code a little:
     $xc = function_exists('apc_exists');
@@ -209,6 +209,77 @@ If you prefer using APC,
         }
      ...
 
+
+
+

APCu

+In PHP 5.5 and above, APC is rendered practically obsolete by the presence of ZendOPCache by default. + However, APC does not cover the "user cache", like the caching of specific variables in memory. + Considering this, you can APCu to add the same level of variable caching as described above, just changing the code a little: + On a local computer, this lead to an increase of RAM consumption and a decrease of 20% of CPU time (for just one user). This has been included in 1.11.x, so this section is only there for historical purposes. +
+function return_notification_menu()
+{
+    $_course = api_get_course_info();
+    $course_id = 0;
+    if (!empty($_course)) {
+        $course_id  = $_course['code'];
+    }
+
+    $user_id = api_get_user_id();
+
+    $html = '';
+    $cacheEnabled = function_exists('apcu_exists');
+
+    if ((api_get_setting('showonline', 'world') == 'true' && !$user_id) ||
+        (api_get_setting('showonline', 'users') == 'true' && $user_id) ||
+        (api_get_setting('showonline', 'course') == 'true' && $user_id && $course_id)
+    ) {
+
+        if ($cacheEnabled) {
+            $apc = apcu_cache_info(null,true);
+            $apc_end = $apc['start_time']+$apc['ttl'];
+            if (apcu_exists('my_campus_whoisonline_count_simple') AND (time() < $apc_end) AND apcu_fetch('my_campus_whoisonline_count_simple') > 0 ) {
+                $number = apcu_fetch('my_campus_whoisonline_count_simple');
+            } else {
+                $number = who_is_online_count(api_get_setting('time_limit_whosonline'));
+                apcu_clear_cache();
+                apcu_store('my_campus_whoisonline_count_simple',$number,15);
+            }
+        } else {
+            $number = who_is_online_count(api_get_setting('time_limit_whosonline'));
+        }
+
+        $number_online_in_course = 0;
+        if (!empty($_course['id'])) {
+            if ($cacheEnabled) {
+                $apc = apcu_cache_info(null,true);
+                $apc_end = $apc['start_time']+$apc['ttl'];
+                if (apcu_exists('my_campus_whoisonline_count_simple_'.$_course['id']) AND (time() < $apc_end) AND apcu_fetch('my_campus_whoisonline_count_simple_'.$_course['id']) > 0) {
+                    $number_online_in_course = apcu_fetch('my_campus_whoisonline_count_simple_'.$_course['id']);
+                } else {
+                    $number_online_in_course = who_is_online_in_this_course_count($user_id, api_get_setting('time_limit_whosonline'), $_course['id']);
+                    apcu_store('my_campus_whoisonline_count_simple_'.$_course['id'],$number_online_in_course,15);
+                }
+            } else {
+                $number_online_in_course = who_is_online_in_this_course_count(
+                    $user_id,
+                    api_get_setting('time_limit_whosonline'),
+                    $_course['id']
+                );
+            }
+        }
+
+        // Display the who's online of the platform
+        if ($number) {
+            if ((api_get_setting('showonline', 'world') == 'true' && !$user_id) ||
+                (api_get_setting('showonline', 'users') == 'true' && $user_id)
+            ) {
+                $html .= '
  • '. + Display::return_icon('user.png', get_lang('UsersOnline'), array(), ICON_SIZE_TINY).' '.$number.'
  • '; + } + } + ... +

    Memcached

    If you use php5-memcached (different set of functions than php5-memcache!), diff --git a/index.php b/index.php index e1424d20cd..bb3235d0c9 100755 --- a/index.php +++ b/index.php @@ -14,7 +14,6 @@ define('CHAMILO_LOAD_WYSIWYG', false); $cidReset = true; require_once 'main/inc/global.inc.php'; -require_once 'main/chat/chat_functions.lib.php'; //require_once 'main/auth/external_login/facebook.inc.php'; // The section (for the tabs). diff --git a/main/admin/access_url_check_user_session.php b/main/admin/access_url_check_user_session.php index cf627677d7..4b753fb90c 100755 --- a/main/admin/access_url_check_user_session.php +++ b/main/admin/access_url_check_user_session.php @@ -107,7 +107,6 @@ foreach($session_list as $session_item) { '; } $html .= ''; - } else { } } echo $html; diff --git a/main/admin/add_courses_to_usergroup.php b/main/admin/add_courses_to_usergroup.php index acda43459d..b7880f5adb 100755 --- a/main/admin/add_courses_to_usergroup.php +++ b/main/admin/add_courses_to_usergroup.php @@ -147,12 +147,10 @@ function search($needle,$type) $xajax_response = new xajaxResponse(); $return = ''; if (!empty($needle) && !empty($type)) { - if ($type == 'single') { - } else { + if ($type != 'single') { $list = CourseManager::get_courses_list(0, 0, 2, 'ASC', -1, $needle); } - if ($type=='single') { - } else { + if ($type != 'single') { $return .= ''; foreach ($session_list as $row ) { diff --git a/main/admin/add_users_to_usergroup.php b/main/admin/add_users_to_usergroup.php index 4998fe451c..e7622c2b90 100755 --- a/main/admin/add_users_to_usergroup.php +++ b/main/admin/add_users_to_usergroup.php @@ -318,9 +318,7 @@ if (!empty($user_list)) { ).' ('.$item['username'].') '; } - if (in_array($item['user_id'], $list_in)) { - //$elements_in[$item['user_id']] = $person_name; - } else { + if (!in_array($item['user_id'], $list_in)) { $elements_not_in[$item['user_id']] = $person_name; } } diff --git a/main/admin/course_add.php b/main/admin/course_add.php index 91c75aa596..2994777e98 100755 --- a/main/admin/course_add.php +++ b/main/admin/course_add.php @@ -100,8 +100,21 @@ $form->applyFilter('department_name', 'trim'); $form->addText('department_url', get_lang('CourseDepartmentURL'), false, array ('size' => '60')); $form->applyFilter('department_url', 'html_filter'); -$form->addElement('select_language', 'course_language', get_lang('CourseLanguage')); -$form->applyFilter('select_language', 'html_filter'); +// Course language. +$languages = api_get_languages(); +if (count($languages['name']) === 1) { + // If there's only one language available, there's no point in asking + $form->addElement('hidden', 'course_language', $languages['folder'][0]); +} else { + $form->addElement( + 'select_language', + 'course_language', + get_lang('Ln'), + array(), + array('style' => 'width:150px') + ); + $form->applyFilter('select_language', 'html_filter'); +} if (api_get_setting('teacher_can_select_course_template') === 'true') { $form->addElement( diff --git a/main/admin/course_import.php b/main/admin/course_import.php index d80ce8af58..7c80118333 100755 --- a/main/admin/course_import.php +++ b/main/admin/course_import.php @@ -55,16 +55,11 @@ function validate_data($courses) if (empty($teacherInfo)) { $course['error'] = get_lang('UnknownTeacher').' ('.$teacher.')'; $errors[] = $course; - } else { - /*if ($teacherInfo['status'] != COURSEMANAGER) { - $course['error'] = get_lang('UserIsNotATeacher').' ('.$teacher.')'; - $errors[] = $course; - }*/ } } } - if(!empty($course['CourseCategory'])) { + if (!empty($course['CourseCategory'])) { $categoryInfo = CourseCategory::getCategory($course['CourseCategory']); if (empty($categoryInfo)) { CourseCategory::addNode($course['CourseCategory'], $course['CourseCategoryName'] ? $course['CourseCategoryName'] : $course['CourseCategory'], 'TRUE', null); diff --git a/main/admin/course_information.php b/main/admin/course_information.php index 871e13e0ca..0a1896090b 100755 --- a/main/admin/course_information.php +++ b/main/admin/course_information.php @@ -10,80 +10,77 @@ require_once '../inc/global.inc.php'; $this_section = SECTION_PLATFORM_ADMIN; api_protect_admin_script(); -/** - * - */ -function get_course_usage($course_code, $session_id = 0) + +if (!isset($_GET['code'])) { + api_not_allowed(true); +} + +$courseInfo = api_get_course_info($_GET['code']); +if (empty($courseInfo)) { + api_not_allowed(true); +} + +$sessionId = isset($_GET['id_session']) ? (int) $_GET['id_session'] : 0; + +function get_course_usage($course, $session_id = 0) { - $table = Database::get_main_table(TABLE_MAIN_COURSE); - $course_code = Database::escape_string($course_code); - $sql = "SELECT * FROM $table WHERE code='".$course_code."'"; - $res = Database::query($sql); - $course = Database::fetch_object($res); + $courseId = $course['real_id']; // Learnpaths $table = Database :: get_course_table(TABLE_LP_MAIN); $usage[] = array( get_lang(ucfirst(TOOL_LEARNPATH)), - CourseManager::count_rows_course_table($table, $session_id, $course->id) + CourseManager::count_rows_course_table($table, $session_id, $courseId) ); // Forums $table = Database :: get_course_table(TABLE_FORUM); - $usage[] = array(get_lang('Forums'), CourseManager::count_rows_course_table($table, $session_id, $course->id)); + $usage[] = array(get_lang('Forums'), CourseManager::count_rows_course_table($table, $session_id, $courseId)); // Quizzes $table = Database :: get_course_table(TABLE_QUIZ_TEST); $usage[] = array( get_lang(ucfirst(TOOL_QUIZ)), - CourseManager::count_rows_course_table($table, $session_id, $course->id) + CourseManager::count_rows_course_table($table, $session_id, $courseId) ); // Documents $table = Database :: get_course_table(TABLE_DOCUMENT); $usage[] = array( get_lang(ucfirst(TOOL_DOCUMENT)), - CourseManager::count_rows_course_table($table, $session_id, $course->id) + CourseManager::count_rows_course_table($table, $session_id, $courseId) ); // Groups $table = Database :: get_course_table(TABLE_GROUP); $usage[] = array( get_lang(ucfirst(TOOL_GROUP)), - CourseManager::count_rows_course_table($table, $session_id, $course->id) + CourseManager::count_rows_course_table($table, $session_id, $courseId) ); // Calendar $table = Database :: get_course_table(TABLE_AGENDA); $usage[] = array( get_lang(ucfirst(TOOL_CALENDAR_EVENT)), - CourseManager::count_rows_course_table($table, $session_id, $course->id) + CourseManager::count_rows_course_table($table, $session_id, $courseId) ); // Link $table = Database::get_course_table(TABLE_LINK); $usage[] = array( get_lang(ucfirst(TOOL_LINK)), - CourseManager::count_rows_course_table($table, $session_id, $course->id) + CourseManager::count_rows_course_table($table, $session_id, $courseId) ); // Announcements $table = Database::get_course_table(TABLE_ANNOUNCEMENT); $usage[] = array( get_lang(ucfirst(TOOL_ANNOUNCEMENT)), - CourseManager::count_rows_course_table($table, $session_id, $course->id) + CourseManager::count_rows_course_table($table, $session_id, $courseId) ); return $usage; } -if (!isset ($_GET['code'])) { - api_not_allowed(); -} $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin')); $interbreadcrumb[] = array("url" => 'course_list.php', "name" => get_lang('Courses')); -$table_course = Database :: get_main_table(TABLE_MAIN_COURSE); -$code = Database::escape_string($_GET['code']); -$sql = "SELECT * FROM $table_course WHERE code = '".$code."'"; -$res = Database::query($sql); -$course = Database::fetch_object($res); -$courseId = $course->id; -$tool_name = $course->title.' ('.$course->visual_code.')'; +$courseId = $courseInfo['real_id']; +$tool_name = $courseInfo['title'].' ('.$courseInfo['visual_code'].')'; Display::display_header($tool_name); ?> @@ -91,9 +88,9 @@ Display::display_header($tool_name); echo Display::page_header(get_lang('CourseUsage')); -$id_session = isset($_GET['id_session']) ? $_GET['id_session'] : 0; -$table = new SortableTableFromArray(get_course_usage($course->code, $id_session), 0, 20, 'usage_table'); -$table->set_additional_parameters(array('code' => Security::remove_XSS($_GET['code']))); + +$table = new SortableTableFromArray(get_course_usage($courseInfo, $sessionId), 0, 20, 'usage_table'); +$table->set_additional_parameters(array('code' => $courseInfo['code'])); $table->set_other_tables(array('user_table', 'class_table')); $table->set_header(0, get_lang('Tool'), true); $table->set_header(1, get_lang('NumberOfItems'), true); @@ -103,14 +100,16 @@ $table->display(); * Show all users subscribed in this course */ echo Display::page_header(get_lang('Users')); -$table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); -$table_user = Database :: get_main_table(TABLE_MAIN_USER); + +$table_course_user = Database:: get_main_table(TABLE_MAIN_COURSE_USER); +$table_user = Database:: get_main_table(TABLE_MAIN_USER); $sql = "SELECT *, cu.status as course_status FROM $table_course_user cu, $table_user u"; if (api_is_multiple_url_enabled()) { $sql .= " INNER JOIN ".Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER)." url_rel_user - ON u.user_id = url_rel_user.user_id - AND url_rel_user.access_url_id = ".intval(api_get_current_access_url_id()); + ON + u.user_id = url_rel_user.user_id AND + url_rel_user.access_url_id = ".api_get_current_access_url_id(); } $sql .= " WHERE cu.user_id = u.user_id AND @@ -130,13 +129,14 @@ if (Database::num_rows($res) > 0) { $user[] = $obj->lastname; $user[] = $obj->firstname; } - $user[] = Display :: encrypted_mailto_link($obj->email, $obj->email); - $user[] = $obj->course_status == 5 ? get_lang('Student') : get_lang('Teacher'); - $user[] = ''.Display::return_icon('synthese_view.gif', get_lang('UserInfo')).''; + $user[] = Display:: encrypted_mailto_link($obj->email, $obj->email); + $user[] = $obj->course_status == 5 ? get_lang('Student') : get_lang('Teacher'); + $user[] = ''. + Display::return_icon('synthese_view.gif', get_lang('UserInfo')).''; $users[] = $user; } $table = new SortableTableFromArray($users, 0, 20, 'user_table'); - $table->set_additional_parameters(array('code' => $code)); + $table->set_additional_parameters(array('code' => $courseInfo['code'])); $table->set_other_tables(array('usage_table', 'class_table')); $table->set_header(0, get_lang('OfficialCode'), true); if ($is_western_name_order) { @@ -154,11 +154,11 @@ if (Database::num_rows($res) > 0) { echo get_lang('NoUsersInCourse'); } -$session_list = SessionManager::get_session_by_course($course->id); +$sessionList = SessionManager::get_session_by_course($courseInfo['real_id']); $url = api_get_path(WEB_CODE_PATH); -if (!empty($session_list)) { - foreach ($session_list as &$session) { +if (!empty($sessionList)) { + foreach ($sessionList as &$session) { $session[0] = Display::url($session[0], $url.'admin/resume_session.php?id_session='.$session['id']); unset($session[1]); } @@ -167,7 +167,4 @@ if (!empty($session_list)) { $table->display(); } -/*$group = new UserGroup(); -$usegroups = $group->get_usergroup_by_course($course->id);*/ - Display::display_footer(); diff --git a/main/admin/extra_field_options.php b/main/admin/extra_field_options.php index 82d0e89224..3257b51770 100755 --- a/main/admin/extra_field_options.php +++ b/main/admin/extra_field_options.php @@ -172,7 +172,7 @@ switch ($action) { if ($check) { $values = $form->exportValues(); $res = $obj->update($values); - Display::display_confirmation_message(sprintf(get_lang('ItemUpdated'), $values['name']), false); + Display::display_confirmation_message(sprintf(get_lang('ItemUpdated'), $values['display_text']), false); } $obj->display(); } else { diff --git a/main/admin/index.php b/main/admin/index.php index b5dd1babb9..3e446a1b29 100644 --- a/main/admin/index.php +++ b/main/admin/index.php @@ -402,6 +402,34 @@ if (api_is_platform_admin()) { $blocks['skills']['search_form'] = null; } + /* Plugins */ + global $_plugins; + if (isset($_plugins['menu_administrator']) && count($_plugins['menu_administrator']) > 0) { + $blocks['plugins']['icon'] = Display::return_icon( + 'plugins.png', + get_lang('Plugins'), + array(), + ICON_SIZE_MEDIUM, + false + ); + $blocks['plugins']['label'] = api_ucfirst(get_lang('Plugins')); + $blocks['plugins']['class'] = 'block-admin-platform'; + $blocks['plugins']['editable'] = true; + + $plugin_obj = new AppPlugin(); + $items = array(); + foreach ($_plugins['menu_administrator'] as $plugin_name) { + $plugin_info = $plugin_obj->getPluginInfo($plugin_name); + $items[] = array( + 'url' => api_get_path(WEB_CODE_PATH) . '../plugin/'.$plugin_name.'/start.php', + 'label' => $plugin_info['title'] + ); + } + + $blocks['plugins']['items'] = $items; + $blocks['plugins']['extra'] = null; + } + /* Chamilo.org */ $blocks['chamilo']['icon'] = Display::return_icon('logo.png', 'Chamilo.org', array(), ICON_SIZE_MEDIUM, false); diff --git a/main/admin/settings.lib.php b/main/admin/settings.lib.php index c8a049e680..57f7559c3e 100755 --- a/main/admin/settings.lib.php +++ b/main/admin/settings.lib.php @@ -19,10 +19,10 @@ use Symfony\Component\Filesystem\Filesystem; * This function allows easy activating and inactivating of regions * @author Julio Montoya Beeznest 2012 */ -function handle_regions() +function handleRegions() { if (isset($_POST['submit_plugins'])) { - store_regions(); + storeRegions(); // Add event to the system log. $user_id = api_get_user_id(); $category = $_GET['category']; @@ -93,7 +93,7 @@ function handle_regions() echo ''; } -function handle_extensions() +function handleExtensions() { echo Display::page_subheader(get_lang('ConfigureExtensions')); echo ''.get_lang('Ppt2lp').''; @@ -106,12 +106,12 @@ function handle_extensions() * @author Patrick Cool , Ghent University * @author Julio Montoya Beeznest 2012 */ -function handle_plugins() +function handlePlugins() { $plugin_obj = new AppPlugin(); $token = Security::get_token(); if (isset($_POST['submit_plugins'])) { - store_plugins(); + storePlugins(); // Add event to the system log. $user_id = api_get_user_id(); $category = $_GET['category']; @@ -222,24 +222,14 @@ function handle_plugins() * @author Patrick Cool , Ghent University * @author Julio Montoya , Chamilo */ -function handle_stylesheets() +function handleStylesheets() { global $_configuration; // Current style. $currentstyle = api_get_setting('stylesheets'); - $is_style_changeable = false; - - if ($_configuration['access_url'] != 1) { - $style_info = api_get_settings('stylesheets', '', 1, 0); - $url_info = api_get_access_url($_configuration['access_url']); - if ($style_info[0]['access_url_changeable'] == 1 && $url_info['active'] == 1) { - $is_style_changeable = true; - } - } else { - $is_style_changeable = true; - } + $is_style_changeable = isStyleChangeable(); $form = new FormValidator( 'stylesheet_upload', @@ -250,21 +240,7 @@ function handle_stylesheets() array('size' => '40', 'maxlength' => '40')); $form->addRule('name_stylesheet', get_lang('ThisFieldIsRequired'), 'required'); $form->addElement('file', 'new_stylesheet', get_lang('UploadNewStylesheet')); - $allowed_file_types = array( - 'css', - 'zip', - 'jpeg', - 'jpg', - 'png', - 'gif', - 'ico', - 'psd', - 'xcf', - 'svg', - 'webp', - 'woff', - 'woff2' - ); + $allowed_file_types = getAllowedFileTypes(); $form->addRule('new_stylesheet', get_lang('InvalidExtension') . ' (' . implode(',', $allowed_file_types) . ')', 'filetype', $allowed_file_types); @@ -293,7 +269,7 @@ function handle_stylesheets() $values = $form->exportValues(); $picture_element = $form->getElement('new_stylesheet'); $picture = $picture_element->getValue(); - $result = upload_stylesheet($values, $picture); + $result = uploadStylesheet($values, $picture); // Add event to the system log. $user_id = api_get_user_id(); @@ -375,22 +351,11 @@ function handle_stylesheets() if ($form_change->validate()) { // Submit stylesheets. if (isset($_POST['save'])) { - store_stylesheets(); + storeStylesheets(); Display::display_normal_message(get_lang('Saved')); } if (isset($_POST['download'])) { - $arch = api_get_path(SYS_ARCHIVE_PATH).$safe_style_dir.'.zip'; - $dir = api_get_path(SYS_CSS_PATH).'themes/'.$safe_style_dir; - if (is_dir($dir)) { - $zip = new PclZip($arch); - // Remove path prefix except the style name and put file on disk - $zip->create($dir, PCLZIP_OPT_REMOVE_PATH, substr($dir,0,-strlen($safe_style_dir))); - //@TODO: use more generic script to download. - $str = ''.get_lang('ClickHereToDownloadTheFile').''; - Display::display_normal_message($str, false); - } else { - Display::addFlash(Display::return_message(get_lang('FileNotFound'), 'warning')); - } + generateCSSDownloadLink($safe_style_dir); } } @@ -502,15 +467,14 @@ function handle_stylesheets() /** * Creates the folder (if needed) and uploads the stylesheet in it - * * @param array $values the values of the form * @param array $picture the values of the uploaded file - * + * @return bool * @author Patrick Cool , Ghent University, Belgium * @version May 2008 - * @since Dokeos 1.8.5 + * @since v1.8.5 */ -function upload_stylesheet($values, $picture) +function uploadStylesheet($values, $picture) { $result = false; // Valid name for the stylesheet folder. @@ -535,20 +499,7 @@ function upload_stylesheet($values, $picture) $single_directory = true; $invalid_files = array(); - $allowedFiles = array( - 'jpg', - 'jpeg', - 'png', - 'gif', - 'css', - 'ico', - 'psd', - 'woff', - 'woff2', - 'xcf', - 'svg', - 'webp' - ); + $allowedFiles = getAllowedFileTypes(); for ($i = 0; $i < $num_files; $i++) { $file = $zip->statIndex($i); @@ -632,7 +583,7 @@ function upload_stylesheet($values, $picture) /** * Store plugin regions. */ -function store_regions() +function storeRegions() { $plugin_obj = new AppPlugin(); @@ -670,7 +621,7 @@ function store_regions() * This function allows easy activating and inactivating of plugins * @author Patrick Cool , Ghent University */ -function store_plugins() +function storePlugins() { $appPlugin = new AppPlugin(); @@ -701,10 +652,10 @@ function store_plugins() * This function allows the platform admin to choose which should be the default stylesheet * @author Patrick Cool , Ghent University */ -function store_stylesheets() +function storeStylesheets() { // Insert the stylesheet. - if (is_style($_POST['style'])) { + if (isStyle($_POST['style'])) { api_set_setting( 'stylesheets', $_POST['style'], @@ -722,7 +673,7 @@ function store_stylesheets() * @param string Style * @return bool True if this style is recognized, false otherwise */ -function is_style($style) +function isStyle($style) { $dir = CSS_UPLOAD_PATH; $dirs = scandir($dir); @@ -738,7 +689,7 @@ function is_style($style) * TODO: support for multiple site. aka $_configuration['access_url'] == 1 * @author Marco Villegas */ -function handle_search() +function handleSearch() { global $SettingsStored, $_configuration; @@ -749,37 +700,25 @@ function handle_search() $values = api_get_settings_options('search_enabled'); $form->addElement('header', null, get_lang('SearchEnabledTitle')); - $group = array (); - if (is_array($values)) { - foreach ($values as $key => $value) { - $element = & $form->createElement('radio', 'search_enabled', '', $value['display_text'], $value['value']); - $group[] = $element; - } - } + $group = formGenerateElementsGroup($form, $values, 'search_enabled'); + //SearchEnabledComment $form->addGroup($group, 'search_enabled', array(get_lang('SearchEnabledTitle'), get_lang('SearchEnabledComment')), '
    ', false); $search_enabled = api_get_setting('search_enabled'); if ($form->validate()) { - $formvalues = $form->exportValues(); - $r = api_set_settings_category('Search', 'false', $_configuration['access_url']); - // Save the settings. - foreach ($formvalues as $key => $value) { - $result = api_set_setting($key, $value, null, null); - } - $search_enabled = $formvalues['search_enabled']; + $formValues = $form->exportValues(); + setConfigurationSettingsInDatabase($formValues, $_configuration['access_url']); + $search_enabled = $formValues['search_enabled']; Display::display_confirmation_message($SettingsStored); } $specific_fields = get_specific_field_list(); if ($search_enabled == 'true') { $values = api_get_settings_options('search_show_unlinked_results'); - $group = array (); - foreach ($values as $key => $value) { - $element = & $form->createElement('radio', 'search_show_unlinked_results', '', $value['display_text'], $value['value']); - $group[] = $element; - } + + $group = formGenerateElementsGroup($form, $values, 'search_show_unlinked_results'); $form->addGroup($group, 'search_show_unlinked_results', array(get_lang('SearchShowUnlinkedResultsTitle'),get_lang('SearchShowUnlinkedResultsComment')), '', false); $default_values['search_show_unlinked_results'] = api_get_setting('search_show_unlinked_results'); @@ -787,7 +726,6 @@ function handle_search() foreach ($specific_fields as $sf) { $sf_values[$sf['code']] = $sf['name']; } - $group = array(); $url = Display::div(Display::url(get_lang('AddSpecificSearchField'), 'specific_fields.php'), array('class'=>'sectioncomment')); if (empty($sf_values)) { $form->addElement('label', [get_lang('SearchPrefilterPrefix'), $url]); @@ -807,33 +745,33 @@ function handle_search() echo ''; if ($search_enabled == 'true') { - $xapian_path = api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb'; + $xapianPath = api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb'; /* @todo Test the Xapian connection if (extension_loaded('xapian')) { require_once 'xapian.php'; try { - $db = new XapianDatabase($xapian_path.'/'); + $db = new XapianDatabase($xapianPath.'/'); } catch (Exception $e) { var_dump($e->getMessage()); } - require_once api_get_path(LIBRARY_PATH) . 'search/DokeosIndexer.class.php'; + require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'; require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; $indexable = new IndexableChunk(); $indexable->addValue("content", 'Test'); - $di = new DokeosIndexer(); + $di = new ChamiloIndexer(); $di->connectDb(NULL, NULL, 'english'); $di->addChunk($indexable); $did = $di->index(); } */ - $xapian_loaded = Display::return_icon('bullet_green.png', get_lang('Ok')); + $xapianLoaded = Display::return_icon('bullet_green.png', get_lang('Ok')); $dir_exists = Display::return_icon('bullet_green.png', get_lang('Ok')); $dir_is_writable = Display::return_icon('bullet_green.png', get_lang('Ok')); $specific_fields_exists = Display::return_icon('bullet_green.png', get_lang('Ok')); @@ -844,58 +782,25 @@ function handle_search() } //Testing xapian extension if (!extension_loaded('xapian')) { - $xapian_loaded = Display::return_icon('bullet_red.png', get_lang('Error')); + $xapianLoaded = Display::return_icon('bullet_red.png', get_lang('Error')); } //Testing xapian searchdb path - if (!is_dir($xapian_path)) { + if (!is_dir($xapianPath)) { $dir_exists = Display::return_icon('bullet_red.png', get_lang('Error')); } //Testing xapian searchdb path is writable - if (!is_writable($xapian_path)) { + if (!is_writable($xapianPath)) { $dir_is_writable = Display::return_icon('bullet_red.png', get_lang('Error')); } - $data[] = array(get_lang('XapianModuleInstalled'),$xapian_loaded); - $data[] = array(get_lang('DirectoryExists').' - '.$xapian_path,$dir_exists); - $data[] = array(get_lang('IsWritable').' - '.$xapian_path,$dir_is_writable); - $data[] = array(get_lang('SpecificSearchFieldsAvailable') ,$specific_fields_exists); + $data = array(); + $data[] = array(get_lang('XapianModuleInstalled'), $xapianLoaded); + $data[] = array(get_lang('DirectoryExists').' - '.$xapianPath, $dir_exists); + $data[] = array(get_lang('IsWritable').' - '.$xapianPath, $dir_is_writable); + $data[] = array(get_lang('SpecificSearchFieldsAvailable'), $specific_fields_exists); - echo Display::tag('h3', get_lang('Settings')); - $table = new SortableTableFromArray($data); - $table->set_header(0, get_lang('Setting'), false); - $table->set_header(1, get_lang('Status'), false); - echo $table->display(); - - //@todo windows support - if (api_is_windows_os() == false) { - $list_of_programs = array('pdftotext','ps2pdf', 'catdoc','html2text','unrtf', 'catppt', 'xls2csv'); - - foreach($list_of_programs as $program) { - $output = []; - $ret_val = null; - exec("which $program", $output, $ret_val); - - if (!$output) { - $output[] = ''; - } - - $icon = Display::return_icon('bullet_red.png', get_lang('NotInstalled')); - if (!empty($output[0])) { - $icon = Display::return_icon('bullet_green.png', get_lang('Installed')); - } - $data2[]= array($program, $output[0], $icon); - } - echo Display::tag('h3', get_lang('ProgramsNeededToConvertFiles')); - $table = new SortableTableFromArray($data2); - $table->set_header(0, get_lang('Program'), false); - $table->set_header(1, get_lang('Path'), false); - $table->set_header(2, get_lang('Status'), false); - echo $table->display(); - } else { - Display::display_warning_message( - get_lang('YouAreUsingChamiloInAWindowsPlatformSadlyYouCantConvertDocumentsInOrderToSearchTheContentUsingThisTool') - ); - } + showSearchSettingsTable($data); + showSearchToolsStatusTable(); } } @@ -905,9 +810,9 @@ function handle_search() * @author Patrick Cool , Ghent University, Belgium * @author Julio Montoya. * @version August 2008 - * @since Dokeos 1.8.6 + * @since v1.8.6 */ -function handle_templates() +function handleTemplates() { /* Drive-by fix to avoid undefined var warnings, without repeating * isset() combos all over the place. */ @@ -921,7 +826,7 @@ function handle_templates() } if ($action == 'add' || ($action == 'edit' && is_numeric($_GET['id']))) { - add_edit_template(); + addEditTemplate(); // Add event to the system log. $user_id = api_get_user_id(); @@ -935,7 +840,7 @@ function handle_templates() ); } else { if ($action == 'delete' && is_numeric($_GET['id'])) { - delete_template($_GET['id']); + deleteTemplate($_GET['id']); // Add event to the system log $user_id = api_get_user_id(); @@ -948,7 +853,7 @@ function handle_templates() $user_id ); } - display_templates(); + displayTemplates(); } } @@ -957,17 +862,17 @@ function handle_templates() * * @author Patrick Cool , Ghent University, Belgium * @version August 2008 - * @since Dokeos 1.8.6 + * @since v1.8.6 */ -function display_templates() +function displayTemplates() { - $table = new SortableTable('templates', 'get_number_of_templates', 'get_template_data', 1); + $table = new SortableTable('templates', 'getNumberOfTemplates', 'getTemplateData', 1); $table->set_additional_parameters(array('category' => Security::remove_XSS($_GET['category']))); $table->set_header(0, get_lang('Image'), true, array('style' => 'width: 101px;')); $table->set_header(1, get_lang('Title')); $table->set_header(2, get_lang('Actions'), false, array('style' => 'width:50px;')); - $table->set_column_filter(2, 'actions_filter'); - $table->set_column_filter(0, 'image_filter'); + $table->set_column_filter(2, 'actionsFilter'); + $table->set_column_filter(0, 'searchImageFilter'); $table->display(); } @@ -978,9 +883,9 @@ function display_templates() * * @author Patrick Cool , Ghent University, Belgium * @version August 2008 - * @since Dokeos 1.8.6 + * @since v1.8.6 */ -function get_number_of_templates() +function getNumberOfTemplates() { // Database table definition. $table_system_template = Database :: get_main_table('system_template'); @@ -1005,9 +910,9 @@ function get_number_of_templates() * * @author Patrick Cool , Ghent University, Belgium * @version August 2008 - * @since Dokeos 1.8.6 + * @since v1.8.6 */ -function get_template_data($from, $number_of_items, $column, $direction) +function getTemplateData($from, $number_of_items, $column, $direction) { // Database table definition. $table_system_template = Database :: get_main_table('system_template'); @@ -1034,9 +939,9 @@ function get_template_data($from, $number_of_items, $column, $direction) * * @author Patrick Cool , Ghent University, Belgium * @version August 2008 - * @since Dokeos 1.8.6 + * @since v1.8.6 */ -function actions_filter($id) { +function actionsFilter($id) { $return = ''.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).''; $return .= ''.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).''; return $return; @@ -1050,9 +955,9 @@ function actions_filter($id) { * * @author Patrick Cool , Ghent University, Belgium * @version August 2008 - * @since Dokeos 1.8.6 + * @since v1.8.6 */ -function image_filter($image) +function searchImageFilter($image) { if (!empty($image)) { return ''.get_lang('TemplatePreview').''; @@ -1067,9 +972,9 @@ function image_filter($image) * * @author Patrick Cool , Ghent University, Belgium * @version August 2008 - * @since Dokeos 1.8.6 + * @since v1.8.6 */ -function add_edit_template() +function addEditTemplate() { // Initialize the object. $id = isset($_GET['id']) ? '&id='.Security::remove_XSS($_GET['id']) : ''; @@ -1195,7 +1100,7 @@ function add_edit_template() } } Security::clear_token(); - display_templates(); + displayTemplates(); } else { $token = Security::get_token(); $form->addElement('hidden','sec_token'); @@ -1212,9 +1117,9 @@ function add_edit_template() * * @author Patrick Cool , Ghent University, Belgium * @version August 2008 - * @since Dokeos 1.8.6 + * @since v1.8.6 */ -function delete_template($id) +function deleteTemplate($id) { // First we remove the image. $table_system_template = Database :: get_main_table('system_template'); @@ -1257,45 +1162,37 @@ function select_gradebook_number_decimals() { return array('0', '1', '2'); } +/** + * Get the options for a select element to select gradebook default grade model + * @return array + */ function select_gradebook_default_grade_model_id() { $grade_model = new GradeModel(); $models = $grade_model->get_all(); $options = array(); $options[-1] = get_lang('None'); + if (!empty($models)) { foreach ($models as $model) { $options[$model['id']] = $model['name']; } } + return $options; } /** - * Updates the gradebook score custom values using the scoredisplay class of the - * gradebook module + * @param array $settings + * @param array $settings_by_access_list * - * @param array List of gradebook score custom values + * @return FormValidator * - * @author Guillaume Viguier + * @throws \Doctrine\ORM\ORMException + * @throws \Doctrine\ORM\OptimisticLockException + * @throws \Doctrine\ORM\TransactionRequiredException */ -function update_gradebook_score_display_custom_values($values) -{ - $scoredisplay = ScoreDisplay::instance(); - $scores = $values['gradebook_score_display_custom_values_endscore']; - $displays = $values['gradebook_score_display_custom_values_displaytext']; - $nr_displays = count($displays); - $final = array(); - for ($i = 1; $i < $nr_displays; $i++) { - if (!empty($scores[$i]) && !empty($displays[$i])) { - $final[$i]['score'] = $scores[$i]; - $final[$i]['display'] = $displays[$i]; - } - } - $scoredisplay->update_custom_score_display_settings($final); -} - -function generate_settings_form($settings, $settings_by_access_list) +function generateSettingsForm($settings, $settings_by_access_list) { global $_configuration, $settings_to_avoid, $convert_byte_to_mega_list; $em = Database::getManager(); @@ -1303,8 +1200,11 @@ function generate_settings_form($settings, $settings_by_access_list) $form = new FormValidator('settings', 'post', 'settings.php?category='.Security::remove_XSS($_GET['category'])); - $form->addElement('hidden', 'search_field', - (!empty($_GET['search_field']) ? Security::remove_XSS($_GET['search_field']) : null)); + $form->addElement( + 'hidden', + 'search_field', + (!empty($_GET['search_field']) ? Security::remove_XSS($_GET['search_field']) : null) + ); $url_id = api_get_current_access_url_id(); @@ -1335,19 +1235,31 @@ function generate_settings_form($settings, $settings_by_access_list) if ($row['access_url_locked'] == 0) { if ($url_id == 1) { if ($row['access_url_changeable'] == '1') { - $form->addElement('html', ''); + $form->addElement( + 'html', + '' + ); } else { - $form->addElement('html', ''); + $form->addElement( + 'html', + '' + ); } } else { if ($row['access_url_changeable'] == '1') { - $form->addElement('html', '
    '. - Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting')).'
    '); + $form->addElement( + 'html', + '
    '. + Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting')).'
    ' + ); } else { - $form->addElement('html', '
    '. - Display::return_icon('shared_setting_na.png', get_lang('ChangeSharedSetting')).'
    '); + $form->addElement( + 'html', + '
    '. + Display::return_icon('shared_setting_na.png', get_lang('ChangeSharedSetting')).'
    ' + ); } } } @@ -1393,7 +1305,7 @@ function generate_settings_form($settings, $settings_by_access_list) array( get_lang($row['title']), get_lang($row['comment']), - get_lang('MB'), + get_lang('MB') ), array('maxlength' => '8') ); @@ -1422,7 +1334,7 @@ function generate_settings_form($settings, $settings_by_access_list) $row['variable'], array( get_lang($row['title']), - get_lang($row['comment']), + get_lang($row['comment']) ), $hideme ); @@ -1461,7 +1373,7 @@ function generate_settings_form($settings, $settings_by_access_list) 'radio', $row['variable'], '', - $value['display_text'], + get_lang($value['display_text']), $value['value'] ); if ($hide_element) { @@ -1479,7 +1391,7 @@ function generate_settings_form($settings, $settings_by_access_list) ); $default_values[$row['variable']] = $row['selected_value']; break; - case 'checkbox'; + case 'checkbox': // 1. We collect all the options of this variable. $sql = "SELECT * FROM $table_settings_current WHERE variable='".$row['variable']."' AND access_url = 1"; @@ -1489,13 +1401,13 @@ function generate_settings_form($settings, $settings_by_access_list) while ($rowkeys = Database::fetch_array($result)) { // Profile tab option should be hidden when the social tool is enabled. if (api_get_setting('allow_social_tool') == 'true') { - if ($rowkeys['variable'] == 'show_tabs' && $rowkeys['subkey'] == 'my_profile') { + if ($rowkeys['variable'] === 'show_tabs' && $rowkeys['subkey'] === 'my_profile') { continue; } } // Hiding the gradebook option. - if ($rowkeys['variable'] == 'show_tabs' && $rowkeys['subkey'] == 'my_gradebook') { + if ($rowkeys['variable'] === 'show_tabs' && $rowkeys['subkey'] === 'my_gradebook') { continue; } @@ -1520,11 +1432,11 @@ function generate_settings_form($settings, $settings_by_access_list) access_url = $access_url"; $result_access = Database::query($sql); $row_access = Database::fetch_array($result_access); - if ($row_access['selected_value'] == 'true' && !$form->isSubmitted()) { + if ($row_access['selected_value'] === 'true' && !$form->isSubmitted()) { $element->setChecked(true); } } else { - if ($rowkeys['selected_value'] == 'true' && !$form->isSubmitted()) { + if ($rowkeys['selected_value'] === 'true' && !$form->isSubmitted()) { $element->setChecked(true); } } @@ -1536,7 +1448,7 @@ function generate_settings_form($settings, $settings_by_access_list) $form->addGroup( $group, $row['variable'], - array(get_lang($row['title']), get_lang($row['comment'])), + array(get_lang($row['title']), get_lang($row['comment']) . 'aaaaaa'), '' ); break; @@ -1549,7 +1461,13 @@ function generate_settings_form($settings, $settings_by_access_list) * To populate the list of options, the select type dynamically calls a function that must be called select_ + the name of the variable being displayed. * The functions being called must be added to the file settings.lib.php. */ - $form->addElement('select', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), call_user_func('select_'.$row['variable']), $hideme); + $form->addElement( + 'select', + $row['variable'], + array(get_lang($row['title']), get_lang($row['comment'])), + call_user_func('select_'.$row['variable']), + $hideme + ); $default_values[$row['variable']] = $row['selected_value']; break; case 'custom': @@ -1612,7 +1530,7 @@ function generate_settings_form($settings, $settings_by_access_list) * @param string $search * @return array */ -function search_setting($search) +function searchSetting($search) { if (empty($search)) { return array(); @@ -1655,3 +1573,146 @@ function search_setting($search) } return $settings; } +/** + * Helper function to generates a form elements group + * @param object $form The form where the elements group has to be added + * @param array $values Values to browse through + * @return array + */ +function formGenerateElementsGroup($form, $values = array(), $elementName) +{ + $group = array(); + if (is_array($values)) { + foreach ($values as $key => $value) { + $element = &$form->createElement('radio', $elementName, '', get_lang($value['display_text']), $value['value']); + $group[] = $element; + } + } + return $group; +} +/** + * Helper function with allowed file types for CSS + * @return array Array of file types (no indexes) + */ +function getAllowedFileTypes() +{ + $allowedFiles = array( + 'css', + 'zip', + 'jpeg', + 'jpg', + 'png', + 'gif', + 'ico', + 'psd', + 'xcf', + 'svg', + 'webp', + 'woff', + 'woff2' + ); + return $allowedFiles; +} +/** + * Helper function to set settings in the database + * @param array $parameters List of values + * @param int $accessUrl The current access URL + * @return void + */ +function setConfigurationSettingsInDatabase($parameters, $accessUrl) +{ + $r = api_set_settings_category('Search', 'false', $accessUrl); + // Save the settings. + foreach ($parameters as $key => $value) { + $result = api_set_setting($key, $value, null, null); + } +} + +/** + * Helper function to show the status of the search settings table + * @param array $data Data to show + * @return void + */ +function showSearchSettingsTable($data) +{ + echo Display::tag('h3', get_lang('Settings')); + $table = new SortableTableFromArray($data); + $table->set_header(0, get_lang('Setting'), false); + $table->set_header(1, get_lang('Status'), false); + echo $table->display(); +} +/** + * Helper function to show status table for each command line tool installed + * @return void + */ +function showSearchToolsStatusTable() +{ + //@todo windows support + if (api_is_windows_os() == false) { + $list_of_programs = array('pdftotext', 'ps2pdf', 'catdoc', 'html2text', 'unrtf', 'catppt', 'xls2csv'); + + foreach($list_of_programs as $program) { + $output = []; + $ret_val = null; + exec("which $program", $output, $ret_val); + + if (!$output) { + $output[] = ''; + } + + $icon = Display::return_icon('bullet_red.png', get_lang('NotInstalled')); + if (!empty($output[0])) { + $icon = Display::return_icon('bullet_green.png', get_lang('Installed')); + } + $data2[]= array($program, $output[0], $icon); + } + echo Display::tag('h3', get_lang('ProgramsNeededToConvertFiles')); + $table = new SortableTableFromArray($data2); + $table->set_header(0, get_lang('Program'), false); + $table->set_header(1, get_lang('Path'), false); + $table->set_header(2, get_lang('Status'), false); + echo $table->display(); + } else { + Display::display_warning_message( + get_lang('YouAreUsingChamiloInAWindowsPlatformSadlyYouCantConvertDocumentsInOrderToSearchTheContentUsingThisTool') + ); + } +} +/** + * Helper function to generate and show CSS Zip download message + * @param string $style Style path + * @return void + */ +function generateCSSDownloadLink($style) +{ + $arch = api_get_path(SYS_ARCHIVE_PATH).$style.'.zip'; + $dir = api_get_path(SYS_CSS_PATH).'themes/'.$style; + if (is_dir($dir)) { + $zip = new PclZip($arch); + // Remove path prefix except the style name and put file on disk + $zip->create($dir, PCLZIP_OPT_REMOVE_PATH, substr($dir,0,-strlen($style))); + //@TODO: use more generic script to download. + $str = ''.get_lang('ClickHereToDownloadTheFile').''; + Display::display_normal_message($str, false); + } else { + Display::addFlash(Display::return_message(get_lang('FileNotFound'), 'warning')); + } +} +/** + * Helper function to tell if the style is changeable in the current URL + * @return bool $changeable Whether the style can be changed in this URL or not + */ +function isStyleChangeable() { + global $_configuration; + $changeable = false; + if ($_configuration['access_url'] != 1) { + $style_info = api_get_settings('stylesheets', '', 1, 0); + $url_info = api_get_access_url($_configuration['access_url']); + if ($style_info[0]['access_url_changeable'] == 1 && $url_info['active'] == 1) { + $changeable = true; + } + } else { + $changeable = true; + } + return $changeable; +} \ No newline at end of file diff --git a/main/admin/settings.php b/main/admin/settings.php index 8977bae149..504a6e2d36 100755 --- a/main/admin/settings.php +++ b/main/admin/settings.php @@ -124,7 +124,7 @@ function get_settings($category = null) if (isset($category) && $category== 'search_setting') { if (!empty($_REQUEST['search_field'])) { - $settings = search_setting($_REQUEST['search_field']); + $settings = searchSetting($_REQUEST['search_field']); } } @@ -142,7 +142,7 @@ if (!empty($_GET['category']) && $settings_array = get_settings($my_category); $settings = $settings_array['settings']; $settings_by_access_list = $settings_array['settings_by_access_list']; - $form = generate_settings_form($settings, $settings_by_access_list); + $form = generateSettingsForm($settings, $settings_by_access_list); if ($form->validate()) { $values = $form->exportValues(); @@ -193,7 +193,7 @@ if (!empty($_GET['category']) && $settings_array = get_settings($my_category); $settings = $settings_array['settings']; $settings_by_access_list = $settings_array['settings_by_access_list']; - $form = generate_settings_form( + $form = generateSettingsForm( $settings, $settings_by_access_list ); @@ -469,7 +469,7 @@ echo $form_search_html; if (!empty($_GET['category'])) { switch ($_GET['category']) { case 'Regions': - handle_regions(); + handleRegions(); break; case 'Plugins': // Displaying the extensions: Plugins. @@ -505,7 +505,7 @@ if (!empty($_GET['category'])) { echo ''; echo '
    '; - handle_plugins(); + handlePlugins(); echo '
    '; echo '
    '; @@ -513,30 +513,30 @@ if (!empty($_GET['category'])) { echo '
    '; echo '
    '; - handle_extensions(); + handleExtensions(); echo '
    '; echo ''; break; case 'Stylesheets': // Displaying the extensions: Stylesheets. - handle_stylesheets(); + handleStylesheets(); break; case 'Search': - handle_search(); + handleSearch(); break; case 'Templates': - handle_templates(); + handleTemplates(); break; case 'search_setting': if (isset($_REQUEST['search_field'])) { - - search_setting($_REQUEST['search_field']); + searchSetting($_REQUEST['search_field']); $form->display(); } break; default: - if (isset($form)) + if (isset($form)) { $form->display(); + } } } diff --git a/main/admin/sub_language.php b/main/admin/sub_language.php index a0437bd813..9613f9c42c 100755 --- a/main/admin/sub_language.php +++ b/main/admin/sub_language.php @@ -265,6 +265,10 @@ function search_language_term( continue; } + if (is_array($variable_value)) { + continue; + } + $founded = false; // searching the item in the parent tool if (preg_match($term,$variable_value)!==0) { @@ -308,44 +312,6 @@ if (isset($_REQUEST['txt_search_word'])) { } } -if ( - (isset($_GET['extra_field']) && !empty($_GET['extra_field'])) || - (isset($_GET['extra_field_option']) && !empty($_GET['extra_field_option'])) -) { - if (isset($_GET['extra_field'])) { - $extraFieldInfo = ExtraField::getInfoById($_GET['extra_field'], false); - $variable_language = '$' . api_underscore_to_camel_case($extraFieldInfo['variable']); - $original_name = $extraFieldInfo['display_text']; - } elseif (isset($_GET['extra_field_option'])) { - $extraFieldOptionInfo = ExtraFieldOption::getInfoById($_GET['extra_field_option'], false); - $variable_language = '$' . api_underscore_to_camel_case($extraFieldOptionInfo['display_text']); - $original_name = $extraFieldOptionInfo['display_text']; - } - - $platformLanguage = api_get_setting('platformLanguage'); - $languageId = api_get_language_id($platformLanguage); - $languageInfo = api_get_language_info($languageId); - $translateUrl = api_get_path(WEB_CODE_PATH) . 'admin/sub_language_ajax.inc.php'; - - $form = new FormValidator('new_lang_variable', 'POST', $translateUrl); - $form->addHeader(get_lang('AddWordForTheSubLanguage')); - $form->addText('variable_language', get_lang('LanguageVariable'), false); - $form->addText('original_name', get_lang('OriginalName'), false); - $form->addText('new_language', get_lang('SubLanguage')); - $form->addHidden('file_id', 0); - $form->addHidden('id', $languageInfo['parent_id']); - $form->addHidden('sub', $languageInfo['id']); - $form->addHidden('sub_language_id', $languageInfo['id']); - $form->addHidden('redirect', true); - $form->addButtonSave(get_lang('Save')); - $form->setDefaults([ - 'variable_language' => $variable_language, - 'original_name' => $original_name - ]); - $form->freeze(['variable_language', 'original_name']); - $form->display(); -} - $parameters = array( 'id' => intval($_GET['id']), 'sub_language_id' => intval($_GET['sub_language_id']), @@ -357,8 +323,8 @@ $table->set_header(0, get_lang('LanguageFile')); $table->set_header(1, get_lang('LanguageVariable')); $table->set_header(2, get_lang('EnglishName')); $table->set_header(3, get_lang('OriginalName')); -$table->set_header(4, get_lang('SubLanguage'),false); -$table->set_header(5, get_lang('Edit'),false); +$table->set_header(4, get_lang('Translation'),false); +$table->set_header(5, get_lang('Action'),false); $table->display(); Display :: display_footer(); diff --git a/main/admin/sub_language_ajax.inc.php b/main/admin/sub_language_ajax.inc.php index 088a47a44b..79d4442a69 100755 --- a/main/admin/sub_language_ajax.inc.php +++ b/main/admin/sub_language_ajax.inc.php @@ -45,16 +45,26 @@ if (isset($new_language) && isset($language_variable) && isset($file_id)) { } } - if (isset($_REQUEST['redirect'])) { + if (isset($_REQUEST['redirect'], $_REQUEST['extra_field_type'])) { Display::addFlash( Display::return_message(get_lang('TheNewWordHasBeenAdded'), 'success') ); - header('Location: ' . api_get_path(WEB_CODE_PATH) . 'admin/sub_language.php?' . http_build_query([ - 'id' => $id_language, - 'sub_language_id' => $sub_language_id, - 'txt_search_word' => ltrim($language_variable, '$') - ])); + $redirectUrl = api_get_path(WEB_CODE_PATH) . 'admin/extra_fields.php?type='; + + switch ($_REQUEST['extra_field_type']) { + case \Chamilo\CoreBundle\Entity\ExtraField::USER_FIELD_TYPE: + $redirectUrl .= 'user'; + break; + case \Chamilo\CoreBundle\Entity\ExtraField::COURSE_FIELD_TYPE: + $redirectUrl .= 'course'; + break; + case \Chamilo\CoreBundle\Entity\ExtraField::SESSION_FIELD_TYPE: + $redirectUrl .= 'session'; + break; + } + + header("Location: $redirectUrl"); exit; } diff --git a/main/admin/subscribe_user2course.php b/main/admin/subscribe_user2course.php index fedaf42ca0..fac2d0915b 100755 --- a/main/admin/subscribe_user2course.php +++ b/main/admin/subscribe_user2course.php @@ -11,7 +11,6 @@ * @todo use formvalidator for the form */ -/* INIT SECTION */ $cidReset = true; require_once '../inc/global.inc.php'; $this_section = SECTION_PLATFORM_ADMIN; @@ -23,28 +22,28 @@ api_protect_admin_script(); $form_sent = 0; $first_letter_user = ''; $first_letter_course = ''; -$courses = array (); +$courses = array(); $users = array(); $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); -$tbl_user = Database :: get_main_table(TABLE_MAIN_USER); +$tbl_user = Database :: get_main_table(TABLE_MAIN_USER); /* Header */ $tool_name = get_lang('AddUsersToACourse'); $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); -$htmlHeadXtra[] = ' -'; // displaying the header Display :: display_header($tool_name); -$link_add_group = ''.Display::return_icon('multiple.gif',get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups').''; +$link_add_group = ''. + Display::return_icon('multiple.gif', get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups').''; echo '
    '.$link_add_group.'
    '; $form = new FormValidator('subscribe_user2course'); @@ -52,13 +51,18 @@ $form->addElement('header', '', $tool_name); $form->display(); //checking for extra field with filter on -$extra_field_list= UserManager::get_extra_fields(); +$extra_field_list = UserManager::get_extra_fields(); + $new_field_list = array(); if (is_array($extra_field_list)) { foreach ($extra_field_list as $extra_field) { //if is enabled to filter and is a " - - - + + @@ -309,15 +307,11 @@ if (is_array($extra_field_list)) { diff --git a/main/admin/teachers_time_by_session_report.php b/main/admin/teachers_time_by_session_report.php new file mode 100644 index 0000000000..39860d928e --- /dev/null +++ b/main/admin/teachers_time_by_session_report.php @@ -0,0 +1,203 @@ +addSelect('session', get_lang('Session'), [0 => get_lang('None')]); +$form->addButtonFilter(get_lang('Filter')); + +foreach ($sessionsInfo as $sessionInfo) { + $selectSession->addOption($sessionInfo['name'], $sessionInfo['id']); +} + +if (isset($_GET['session']) && intval($_GET['session'])) { + $form->setDefaults(['session' => intval($_GET['session'])]); + + $session = $em->find('ChamiloCoreBundle:Session', intval($_GET['session'])); +} + +$data = []; +$coursesInfo = []; +$usersInfo = []; + +if ($session) { + $sessionCourses = $session->getCourses(); + + foreach ($sessionCourses as $sessionCourse) { + $course = $sessionCourse->getCourse(); + $coursesInfo[$course->getId()] = $course->getCode(); + $criteria = Criteria::create()->where( + Criteria::expr()->eq("status", Session::COACH) + ); + $userCourseSubscriptions = $session + ->getUserCourseSubscriptions() + ->matching($criteria); + + foreach ($userCourseSubscriptions as $userCourseSubscription) { + $user = $userCourseSubscription->getUser(); + + if (!array_key_exists($user->getId(), $usersInfo)) { + $usersInfo[$user->getId()] = [ + 'code' => $user->getOfficialCode(), + 'complete_name' => $user->getCompleteName(), + 'time_in_platform' => api_time_to_hms( + Tracking::get_time_spent_on_the_platform($user->getId()) + ), + 'first_connection' => Tracking::get_first_connection_date($user->getId()), + 'last_connection' => Tracking::get_last_connection_date($user->getId()), + ]; + } + + $usersInfo[$user->getId()][$course->getId() . '_number_of_students'] = null; + $usersInfo[$user->getId()][$course->getId() . '_number_of_works'] = null; + $usersInfo[$user->getId()][$course->getId() . '_last_work'] = null; + $usersInfo[$user->getId()][$course->getId() . '_time_spent_of_course'] = null; + + if (!$session->hasCoachInCourseWithStatus($user, $course)) { + continue; + } + + $works = $em + ->getRepository('ChamiloCourseBundle:CStudentPublication') + ->findByTeacher($user, $course, $session->getId()); + $lastWork = array_pop($works); + + $usersInfo[$user->getId()][$course->getId() . '_number_of_students'] = $sessionCourse->getNbrUsers(); + $usersInfo[$user->getId()][$course->getId() . '_number_of_works'] = count($works); + $usersInfo[$user->getId()][$course->getId() . '_time_spent_of_course'] = api_time_to_hms( + Tracking::get_time_spent_on_the_course($user->getId(), $course->getId(), $session->getId()) + ); + + if (!$lastWork) { + continue; + } + + $lastFormattedDate = api_format_date($lastWork->getSentDate()->getTimestamp(), DATE_TIME_FORMAT_SHORT); + + $usersInfo[$user->getId()][$course->getId() . '_last_work'] = api_format_date( + $lastWork->getSentDate()->getTimestamp(), + DATE_TIME_FORMAT_SHORT + ); + } + } +} + +if (isset($_GET['export']) && $session && ($coursesInfo && $usersInfo)) { + $fileName = get_lang('TeacherTimeReport') . ' ' . api_get_local_time(); + + $dataToExport = []; + $dataToExport[] = [$toolName, $session->getName()]; + $dataToExport['headers'] = [ + get_lang('OfficialCode'), + get_lang('CoachName'), + get_lang('TimeSpentOnThePlatform'), + get_lang('FirstLoginInPlatform'), + get_lang('LatestLoginInPlatform'), + ]; + + foreach ($coursesInfo as $courseCode) { + $dataToExport['headers'][] = $courseCode; + $dataToExport['headers'][] = get_lang('NumberOfWorks'); + $dataToExport['headers'][] = get_lang('LastWork'); + $dataToExport['headers'][] = sprintf(get_lang('TimeReportForCourseX'), $courseCode); + } + + foreach ($usersInfo as $user) { + $dataToExport[] = $user; + } + + foreach ($data as $row) { + $contents = [ + $row['code'], + $row['complete_name'], + $row['time_in_platform'], + $row['first_connection'], + $row['last_connection'] + ]; + + foreach ($row['courses'] as $course) { + $headers[] = $course['code']; + $headers[] = get_lang('NumberOfWorks'); + $headers[] = get_lang('LastWork'); + $headers[] = sprintf(get_lang('TimeReportForCourseX'), $course['code']); + $contents[] = $course['number_of_students']; + $contents[] = $course['number_of_works']; + $contents[] = $course['last_work']; + $contents[] = $course['time_spent_of_course']; + } + + $dataToExport[] = [get_lang('Session'), $session->getName()]; + + $dataToExport[] = $headers; + $dataToExport[] = $contents; + } + + switch ($_GET['export']) { + case 'xls': + Export::export_table_xls_html($dataToExport, $fileName); + break; + case 'csv': + Export::arrayToCsv($dataToExport, $fileName); + break; + } + exit; +} + +$this_section = SECTION_PLATFORM_ADMIN; +$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('Administration')]; +$interbreadcrumb[] = [ + 'url' => api_get_path(WEB_CODE_PATH) . 'admin/teacher_time_report.php', + 'name' => get_lang('TeacherTimeReport') +]; + +$actions = []; + +if ($session) { + $actions = [ + Display::url( + Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), [], ICON_SIZE_MEDIUM), + api_get_self() . '?' . http_build_query(['export' => 'csv', 'session' => $session->getId()]) + ), + Display::url( + Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), [], ICON_SIZE_MEDIUM), + api_get_self() . '?' . http_build_query(['export' => 'xls', 'session' => $session->getId()]) + ) + ]; +} + +$view = new Template($toolName); +$view->assign('form', $form->returnForm()); + +if ($session) { + $view->assign('session', ['id' => $session->getId(), 'name' => $session->getName()]); + $view->assign('courses', $coursesInfo); + $view->assign('users', $usersInfo); +} + +$template = $view->get_template('admin/teachers_time_by_session_report.tpl'); +$content = $view->fetch($template); + +$view->assign('header', $toolName); +$view->assign('actions', implode(' ', $actions)); +$view->assign('content', $content); +$view->display_one_col_template(); diff --git a/main/admin/user_edit.php b/main/admin/user_edit.php index 72d3bc4b8a..337316e09f 100755 --- a/main/admin/user_edit.php +++ b/main/admin/user_edit.php @@ -68,16 +68,16 @@ function confirmation(name) { } '; +$userGeolocalization = api_get_setting('enable_profile_user_address_geolocalization') == 'true'; + $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; +$htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; +} + // Create the form $form = new FormValidator( 'user_edit', @@ -205,6 +305,32 @@ if (api_get_setting('openid_authentication') == 'true') { // Phone $form->addElement('text', 'phone', get_lang('PhoneNumber')); +if ($userGeolocalization) { + // Geolocation + $form->addElement('text', 'address', get_lang('AddressField'), ['id' => 'address']); + $form->addHtml(' +
    + +
    + + +
    +
    + '); + + $form->addHtml(' +
    + +
    +
    +
    +
    +
    + '); +} + // Picture $form->addElement('file', 'picture', get_lang('AddPicture'), array('id' => 'picture', 'class' => 'picture-form')); $allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif'); @@ -477,7 +603,8 @@ if ($form->validate()) { $language, null, $send_mail, - $reset_password + $reset_password, + $user['address'] ); if (isset($user['student_boss'])) { diff --git a/main/admin/user_list.php b/main/admin/user_list.php index 162471a4e2..42f67bf064 100755 --- a/main/admin/user_list.php +++ b/main/admin/user_list.php @@ -1,14 +1,14 @@ BeezNest 2011 * @package chamilo.admin */ -use ChamiloSession as Session; - $cidReset = true; require_once '../inc/global.inc.php'; @@ -25,6 +25,24 @@ if (api_get_configuration_value('deny_delete_users')) { $url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=get_user_courses'; $urlSession = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=get_user_sessions'; + +$extraField = new ExtraField('user'); +$variables = $extraField->get_all_extra_field_by_type(ExtraField::FIELD_TYPE_TAG); +$variablesSelect = $extraField->get_all_extra_field_by_type(ExtraField::FIELD_TYPE_SELECT); +if (!empty($variablesSelect)) { + $variables = array_merge($variables, $variablesSelect); +} +$variablesToShow = []; +if ($variables) { + foreach ($variables as $variableId) { + $extraFieldInfo = $extraField->get($variableId); + $variablesToShow[] = $extraFieldInfo['variable']; + } +} + +Session::write('variables_to_show', $variablesToShow); + + $htmlHeadXtra[] = ' +'; + +$form->addButtonSearch(get_lang('SearchUsers')); $defaults = array(); $defaults['keyword_active'] = 1; @@ -857,7 +910,6 @@ $extra_search_options = ''; //Try to search the user everywhere if ($table->get_total_number_of_items() == 0) { - if (api_get_multiple_access_url() && isset($_REQUEST['keyword'])) { $keyword = Database::escape_string($_REQUEST['keyword']); $conditions = array('username' => $keyword); @@ -910,7 +962,11 @@ if ($table->get_total_number_of_items() == 0) { } } } -$toolbarActions = Display::toolbarAction('toolbarUser', array(0 => $actionsLeft, 1 => $actionsCenter, 2 => $actionsRight), 3); +$toolbarActions = Display::toolbarAction( + 'toolbarUser', + array($actionsLeft, $actionsCenter, $actionsRight), + 3 +); $tpl = new Template($tool_name); $tpl->assign('actions', $toolbarActions); diff --git a/main/attendance/attendance_controller.php b/main/attendance/attendance_controller.php index 7d1774cb02..80ba155ee8 100755 --- a/main/attendance/attendance_controller.php +++ b/main/attendance/attendance_controller.php @@ -608,7 +608,6 @@ class AttendanceController * Gets attendance base in the table: * TABLE_STATISTIC_TRACK_E_COURSE_ACCESS * @param bool $showForm - * @throws ViewException */ public function getAttendanceBaseInLogin($showForm = false, $exportToPdf = true) { diff --git a/main/attendance/attendance_edit.php b/main/attendance/attendance_edit.php index 1ab565e6ea..4bcbd90e13 100755 --- a/main/attendance/attendance_edit.php +++ b/main/attendance/attendance_edit.php @@ -70,11 +70,11 @@ $form->addButtonUpdate(get_lang('Save')); // set default values $default['title'] = Security::remove_XSS($title); -$default['description'] = Security::remove_XSS($description,STUDENT); +$default['description'] = Security::remove_XSS($description, STUDENT); $default['attendance_qualify_title'] = $attendance_qualify_title; $default['attendance_weight'] = $attendance_weight; -$link_info = GradebookUtils::is_resource_in_course_gradebook( +$link_info = GradebookUtils::isResourceInCourseGradebook( api_get_course_id(), 7, $attendance_id, diff --git a/main/auth/courses.php b/main/auth/courses.php index 736ea09825..e4b3a97816 100755 --- a/main/auth/courses.php +++ b/main/auth/courses.php @@ -12,7 +12,6 @@ use \Chamilo\CoreBundle\Entity\SequenceResource; // Delete the globals['_cid'], we don't need it here. $cidReset = true; // Flag forcing the 'current course' reset -// including files require_once '../inc/global.inc.php'; $ctok = Security::get_existing_token(); @@ -31,7 +30,7 @@ if (api_get_setting('course_catalog_published') !== 'true') { $user_can_view_page = false; //For students -if (api_get_setting('allow_students_to_browse_courses') == 'false') { +if (api_get_setting('allow_students_to_browse_courses') === 'false') { $user_can_view_page = false; } else { $user_can_view_page = true; @@ -62,7 +61,8 @@ if (isset($_GET['action']) && in_array($_GET['action'], $actions)) { $action = Security::remove_XSS($_GET['action']); } -$categoryCode = isset($_GET['category_code']) ? $_GET['category_code'] : 'ALL'; +$categoryCode = isset($_GET['category_code']) && !empty($_GET['category_code']) ? $_GET['category_code'] : 'ALL'; + $nameTools = CourseCategory::getCourseCatalogNameTools($action); if (empty($nameTools)) { $nameTools = get_lang('CourseManagement'); @@ -73,7 +73,8 @@ if (empty($nameTools)) { 'name' => get_lang('CourseManagement'), ); } - if ($action == 'createcoursecategory') { + + if ($action === 'createcoursecategory') { $interbreadcrumb[] = array( 'url' => api_get_path(WEB_CODE_PATH).'auth/courses.php?action=sortmycourses', 'name' => get_lang('SortMyCourses'), @@ -153,19 +154,19 @@ if (isset($_REQUEST['subscribe_course'])) { $courses_controller->subscribe_user($_GET['subscribe_course'], $_GET['search_term'], $categoryCode); } } + // We are unsubscribing from a course (=Unsubscribe from course). if (isset($_GET['unsubscribe'])) { $search_term = isset($_GET['search_term']) ? $_GET['search_term'] : null; if ($ctok == $_GET['sec_token']) { $courses_controller->unsubscribe_user_from_course($_GET['unsubscribe'], $search_term, $categoryCode); - //$message = remove_user_from_course($_user['user_id'], $_POST['unsubscribe']); } } + // We are unsubscribing from a course (=Unsubscribe from course). if (isset($_POST['unsubscribe'])) { if ($ctok == $_POST['sec_token']) { $courses_controller->unsubscribe_user_from_course($_POST['unsubscribe']); - //$message = remove_user_from_course($_user['user_id'], $_POST['unsubscribe']); } } @@ -215,7 +216,7 @@ switch ($action) { if (!$user_can_view_page) { api_not_allowed(true); } - + $courses_controller->courses_categories( $action, $categoryCode, diff --git a/main/auth/courses_controller.php b/main/auth/courses_controller.php index ec8daa9090..8b6119ed67 100755 --- a/main/auth/courses_controller.php +++ b/main/auth/courses_controller.php @@ -90,14 +90,20 @@ class CoursesController * @internal param \action $string * @internal param \Category $string code (optional) */ - public function courses_categories($action, $category_code = null, $message = '', $error = '', $content = null, $limit = array()) - { + public function courses_categories( + $action, + $category_code = null, + $message = '', + $error = '', + $content = null, + $limit = array() + ) { $data = array(); $browse_course_categories = $this->model->browse_course_categories(); $data['countCoursesInCategory'] = $this->model->count_courses_in_category($category_code); - if ($action == 'display_random_courses') { + if ($action === 'display_random_courses') { // Random value is used instead limit filter - $data['browse_courses_in_category'] = $this->model->browse_courses_in_category(null, 10); + $data['browse_courses_in_category'] = $this->model->browse_courses_in_category(null, 12); $data['countCoursesInCategory'] = count($data['browse_courses_in_category']); } else { if (!isset($category_code)) { @@ -110,6 +116,7 @@ class CoursesController $data['browse_course_categories'] = $browse_course_categories; $data['code'] = Security::remove_XSS($category_code); + // getting all the courses to which the user is subscribed to $curr_user_id = api_get_user_id(); $user_courses = $this->model->get_courses_of_user($curr_user_id); @@ -117,7 +124,7 @@ class CoursesController // we need only the course codes as these will be used to match against the courses of the category if ($user_courses != '') { - foreach($user_courses as $key => $value) { + foreach ($user_courses as $key => $value) { $user_coursecodes[] = $value['code']; } } @@ -143,7 +150,7 @@ class CoursesController } // render to the view - + $this->view->set_data($data); $this->view->set_layout('catalog_layout'); $this->view->set_template('courses_categories'); @@ -750,7 +757,7 @@ class CoursesController 'coach_access_start_date' => $session->getCoachAccessStartDate(), 'coach_access_end_date' => $session->getCoachAccessEndDate(), ]); - + $imageField = $extraFieldValue->get_values_by_handler_and_field_variable($session->getId(), 'image'); $sessionCourseTags = []; @@ -799,7 +806,7 @@ class CoursesController } else { $catName = $cat->getName(); } - + $coachId = $session->getGeneralCoach()->getId(); $coachName = $session->getGeneralCoach()->getCompleteName(); $actions = null; @@ -834,7 +841,7 @@ class CoursesController 'tags' => $sessionCourseTags, 'edit_actions' => $actions ); - + $sessionsBlock = array_merge($sessionsBlock, $sequences); $sessionsBlocks[] = $sessionsBlock; } diff --git a/main/auth/external_login/ldap.inc.php b/main/auth/external_login/ldap.inc.php index 9b53245f9b..1051f0f23d 100755 --- a/main/auth/external_login/ldap.inc.php +++ b/main/auth/external_login/ldap.inc.php @@ -278,11 +278,6 @@ function extldap_import_all_users() for ($key = 0; $key < $users['count']; $key++) { $user_id = extldap_add_user_by_array($users[$key], true); $count++; - if ($user_id) { - // echo "User #$user_id created or updated\n"; - } else { - // echo "User was not created\n"; - } } } } diff --git a/main/auth/inscription.php b/main/auth/inscription.php index 3de5fb61f7..91abf0e83d 100755 --- a/main/auth/inscription.php +++ b/main/auth/inscription.php @@ -48,11 +48,12 @@ if (!empty($_SESSION['user_language_choice'])) { } else { $user_selected_language = api_get_setting('platformLanguage'); } +$htmlHeadXtra[] = ''; if ($userGeolocalization) { - $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; -if ($userGeolocalization) { - $htmlHeadXtra[] = ''; -} +$htmlHeadXtra[] = ''; $htmlHeadXtra[] = '"; - $sql = "update $track_user_table set chatcall_user_id = '', chatcall_date = '', chatcall_text='' WHERE (user_id = $talk_to)"; - $result = Database::query($sql); - } -} -require 'footer_frame.inc.php'; diff --git a/main/chat/chat_message.php b/main/chat/chat_message.php deleted file mode 100755 index c78356aefc..0000000000 --- a/main/chat/chat_message.php +++ /dev/null @@ -1,128 +0,0 @@ - - - close_chat_window(); '; -} else { - api_protect_course_script(); -} - -if (empty($course) || empty($userId)) { - exit; -} - -/* Constants and variables */ -$tbl_user = Database::get_main_table(TABLE_MAIN_USER); -$sent = isset($_REQUEST['sent']) ? $_REQUEST['sent'] : null; - -require 'header_frame.inc.php'; -$chat_size = 0; - -if ($sent) { - saveMessage( - $_POST['message'], - $userId, - $_course, - $session_id, - $group_id, - false - ); -} -?> -
    - -
    -
    - -
    -
    - - - - - - - -
    - - -
    -
    - -
    -
    -
    -
    - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -".COURSE_RELATION_TYPE_RRHH." AND - t3.c_id = '".$courseInfo['real_id']."' AND - t2.last_connection>'".$date_inter."' $extra_condition - ORDER BY username"; - - $result = Database::query($sql); - $users = Database::store_result($result); - } else { - $session_condition = api_get_session_condition($session_id, true, false, 't3.session_id'); - // select learners - $query = "SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri,email - FROM $tbl_user t1, $tbl_chat_connected t2, $tbl_session_course_user t3 - WHERE - t2.c_id = $course_id AND - t1.user_id=t2.user_id AND t3.user_id=t2.user_id AND - t3.session_id = '".$session_id."' AND - t3.c_id = '".$courseInfo['real_id']."' AND - t2.last_connection>'".$date_inter."' $session_condition - ORDER BY username"; - $result = Database::query($query); - while ($learner = Database::fetch_array($result)) { - $users[$learner['user_id']] = $learner; - } - - // select session coach - $query = "SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri,email - FROM $tbl_user t1,$tbl_chat_connected t2,$tbl_session t3 - WHERE - t2.c_id = $course_id AND - t1.user_id=t2.user_id AND - t3.id_coach=t2.user_id AND - t3.id = '".$session_id."' AND - t2.last_connection > '".$date_inter."' - $extra_condition - ORDER BY username"; - $result = Database::query($query); - if ($coach = Database::fetch_array($result)) { - $users[$coach['user_id']] = $coach; - } - - // select session course coach - $query = "SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri,email - FROM $tbl_user t1,$tbl_chat_connected t2,$tbl_session_course_user t3 - WHERE - t2.c_id = $course_id AND - t1.user_id=t2.user_id - AND t3.user_id =t2.user_id AND t3.status=2 - AND t3.session_id = '".$session_id."' - AND t3.c_id = '".$course_id."' - AND t2.last_connection>'".$date_inter."' $extra_condition - ORDER BY username"; - - $result = Database::query($query); - $course_coaches = array(); - while ($coaches = Database::fetch_array($result)) { - $users[$coaches['user_id']] = $coaches; - } - } - require 'header_frame.inc.php'; - - ?> -
    -
    -
    -
    -
    -
      - -
    • - -
      - - - - '18')); - } else { - echo Display::return_icon('students.gif', get_lang('Student'), array('height' => '18')); - } - ?> -
      -
      -
    • - -
    -
    - - - - \ No newline at end of file diff --git a/main/chat/header_frame.inc.php b/main/chat/header_frame.inc.php deleted file mode 100755 index d7f52f8027..0000000000 --- a/main/chat/header_frame.inc.php +++ /dev/null @@ -1,272 +0,0 @@ -'; - echo "parent.chat_message.location.href='chat_whoisonline.php?".api_get_cidreq()."';"; - echo ''; -} - -/* - * Choose CSS style (platform's, user's, or course's) - */ -$my_style = api_get_visual_theme(); -$chat_size_old = isset($chat_size_old) ? $chat_size_old : null; -$chat_size_new = isset($chat_size_new) ? $chat_size_new : null; -$connected_new = isset($connected_new) ? $connected_new : null; -$connected_old = isset($connected_old) ? $connected_old : null; - -$icons = Emojione\Emojione::$shortcode_replace; -$iconList = array(); -$iconNameToInclude = array( - ':bowtie:', - ':smile:', - ':laughing:', - ':blush:', - ':smiley:', - ':relaxed:', - ':smirk:', - ':heart_eyes:', - ':kissing_heart:', - ':kissing_closed_eyes:', - ':flushed:', - ':relieved:', - ':satisfied:', - ':grin:', - ':wink:', - ':stuck_out_tongue_winking_eye:', - ':stuck_out_tongue_closed_eyes:', - ':grinning:', - ':kissing:', - ':kissing_smiling_eyes:', - ':stuck_out_tongue:', - ':sleeping:', - ':worried:', - ':frowning:', - ':anguished:', - ':open_mouth:', - ':grimacing:', - ':confused:', - ':hushed:', - ':expressionless:', - ':unamused:', - ':sweat_smile:', - ':sweat:', - ':disappointed_relieved:', - ':weary:', - ':pensive:', - ':disappointed:', - ':confounded:', - ':fearful:', - ':cold_sweat:', - ':persevere:', - ':cry:', - ':sob:', - ':joy:', - ':astonished:', - ':scream:', - ':neckbeard:', - ':tired_face:', - ':angry:', - ':rage:', - ':triumph:', - ':sleepy:', - ':yum:', - ':mask:', - ':sunglasses:', - ':dizzy_face:', - ':imp:', - ':smiling_imp:', - ':neutral_face:', - ':no_mouth:', - ':innocent:', - ':alien:', -); - -foreach ($icons as $key => $icon) { - if (in_array($key, $iconNameToInclude)) { - $iconList[$key] = strtoupper($icon) . '.png'; - } -} - -$icons = json_encode($iconList); -$ajax = api_get_path(WEB_AJAX_PATH).'chat.ajax.php?action=preview&'.api_get_cidreq(); -header('Content-Type: text/html; charset=UTF-8'); - -?> - - - -Chat - - - - - - - - - - - - - - - - - - > diff --git a/main/course_description/add.php b/main/course_description/add.php index e8882410d9..dadeab0606 100755 --- a/main/course_description/add.php +++ b/main/course_description/add.php @@ -13,7 +13,7 @@ api_protect_course_script(true); // display categories $categories = array (); foreach ($default_description_titles as $id => $title) { - $categories[$id] = $title; + $categories[$id] = $title; } $categories[ADD_BLOCK] = get_lang('NewBloc'); diff --git a/main/course_description/edit.php b/main/course_description/edit.php index 63de92ea87..55eb7b4820 100755 --- a/main/course_description/edit.php +++ b/main/course_description/edit.php @@ -73,12 +73,12 @@ $form = new FormValidator( 'index.php?action=edit&id='.$original_id.'&description_type='.$description_type.'&'.api_get_cidreq() ); -$form->addElement('header','',$header); +$form->addElement('header', $header); $form->addElement('hidden', 'id', $original_id); -$form->addElement('hidden', 'description_type',$description_type); -$form->addElement('hidden', 'sec_token',$token); -$form->addText('title', get_lang('Title'), true, array('size'=>'50')); -$form->applyFilter('title','html_filter'); +$form->addElement('hidden', 'description_type', $description_type); +$form->addElement('hidden', 'sec_token', $token); +$form->addText('title', get_lang('Title'), true, array('size' => '50')); +$form->applyFilter('title', 'html_filter'); $form->addHtmlEditor( 'contentDescription', get_lang('Content'), @@ -97,7 +97,7 @@ if (!empty($description_title)) { $default['title'] = Security::remove_XSS($description_title); } if (!empty($description_content)) { - $default['contentDescription'] = Security::remove_XSS($description_content,COURSEMANAGERLOWSECURITY); + $default['contentDescription'] = Security::remove_XSS($description_content, COURSEMANAGERLOWSECURITY); } $default['description_type'] = $description_type; diff --git a/main/course_description/listing.php b/main/course_description/listing.php index 8618df1111..7f1c079f24 100755 --- a/main/course_description/listing.php +++ b/main/course_description/listing.php @@ -24,11 +24,11 @@ if (api_is_allowed_to_edit(null,true)) { foreach ($categories as $id => $title) { if ($i==ADD_BLOCK) { echo ''. - Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).''; + Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).''; break; } else { echo ''. - Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).''; + Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).''; $i++; } } diff --git a/main/course_home/2column.php b/main/course_home/2column.php index 15b597ae2d..eec0ed9b71 100755 --- a/main/course_home/2column.php +++ b/main/course_home/2column.php @@ -29,28 +29,21 @@ if (api_is_allowed_to_edit(null, true)) { $msgDestroy = get_lang('DelLk').'
    '; $msgDestroy .= ''.get_lang('No').' | '; $msgDestroy .= ''.get_lang('Yes').''; - $show_message .= Display :: return_message($msgDestroy, 'confirmation',false); - } - - /* - * Process hiding a tools from available tools. - * visibility=2 are only view by Dokeos Administrator (visibility 0,1->2) - */ - - elseif ($_GET['destroy']) { + $show_message .= Display :: return_message($msgDestroy, 'confirmation', false); + } elseif ($_GET['destroy']) { + /* + * Process hiding a tools from available tools. + * visibility=2 are only view by Dokeos Administrator (visibility 0,1->2) + */ Database::query("UPDATE $tool_table SET visibility='2' WHERE c_id = $course_id AND id='".$id."'"); - } - - /* HIDE */ - - elseif ($_GET['hide']) { // visibility 1 -> 0 + } elseif ($_GET['hide']) { + /* HIDE */ + // visibility 1 -> 0 Database::query("UPDATE $tool_table SET visibility=0 WHERE c_id = $course_id AND id='".$id."'"); $show_message .= Display::return_message(get_lang('ToolIsNowHidden'), 'confirmation'); - } - - /* REACTIVATE */ - - elseif ($_GET["restore"]) { // visibility 0,2 -> 1 + } elseif ($_GET["restore"]) { + // visibility 0,2 -> 1 + /* REACTIVATE */ Database::query("UPDATE $tool_table SET visibility=1 WHERE c_id = $course_id AND id='".$id."'"); $show_message .= Display::return_message(get_lang('ToolIsNowVisible'), 'confirmation'); } @@ -79,8 +72,8 @@ if (api_is_platform_admin()) { /* TOOLS VISIBLE FOR EVERYBODY */ -$content .= '
    '; -$content .= ''; +$content .= '
    '; +$content .= '
    '; $content .= CourseHome::show_tool_2column(TOOL_PUBLIC); $content .= '
    '; $content .= '
    '; diff --git a/main/course_home/3column.php b/main/course_home/3column.php index d9273aa495..7adb095842 100755 --- a/main/course_home/3column.php +++ b/main/course_home/3column.php @@ -13,8 +13,8 @@ * @package chamilo.course_home */ -$hide = isset($_GET['hide']) && $_GET['hide'] == 'yes' ? 'yes' : null; -$restore = isset($_GET['restore']) && $_GET['restore'] == 'yes' ? 'yes' : null; +$hide = isset($_GET['hide']) && $_GET['hide'] === 'yes' ? 'yes' : null; +$restore = isset($_GET['restore']) && $_GET['restore'] === 'yes' ? 'yes' : null; $id = isset($_GET['id']) ? intval($_GET['id']) : null; $TBL_ACCUEIL = Database::get_course_table(TABLE_TOOL_LIST); $course_id = api_get_course_int_id(); @@ -108,12 +108,12 @@ elseif ($restore) { // visibility 0,2 -> 1 * Editing "apparance" of a tools on the course Home Page. */ elseif (isset($update) && $update) { - $result = Database::query("SELECT * FROM $TBL_ACCUEIL WHERE c_id = $course_id AND id=$id"); - $tool = Database::fetch_array($result); - $racine = api_get_path(SYS_PATH).'/'.$currentCourseID.'/images/'; - $chemin = $racine; - $name = $tool[1]; - $image = $tool[3]; + $result = Database::query("SELECT * FROM $TBL_ACCUEIL WHERE c_id = $course_id AND id=$id"); + $tool = Database::fetch_array($result); + $racine = api_get_path(SYS_PATH).'/'.$currentCourseID.'/images/'; + $chemin = $racine; + $name = $tool[1]; + $image = $tool[3]; $content .= "\n". "\n". @@ -159,9 +159,7 @@ elseif (isset($update) && $update) { } } - // Work with data post askable by admin of course - if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) { // Show message to confirm that a tools must be hide from aivailable tools // visibility 0,1->2 @@ -191,13 +189,10 @@ if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coa $content .= "\n"; /* TOOLS FOR EVERYBODY */ - $content .= "\n\n\n"; $content .= "\n\n\n"; diff --git a/main/course_home/activity.php b/main/course_home/activity.php index 676e63b410..324aa6651b 100755 --- a/main/course_home/activity.php +++ b/main/course_home/activity.php @@ -39,7 +39,7 @@ if (api_is_platform_admin()) { // Course legal $enabled = api_get_plugin_setting('courselegal', 'tool_enable'); $pluginExtra = null; -if ($enabled == 'true') { +if ($enabled === 'true') { require_once api_get_path(SYS_PLUGIN_PATH).'courselegal/config.php'; $plugin = CourseLegalPlugin::create(); $pluginExtra = $plugin->getTeacherLink(); diff --git a/main/course_home/course_home.php b/main/course_home/course_home.php index 319ecd721a..7f345597b8 100755 --- a/main/course_home/course_home.php +++ b/main/course_home/course_home.php @@ -209,7 +209,7 @@ if (!empty($auto_launch)) { $session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id(); if (!isset($_SESSION[$session_key])) { //redirecting to the LP - $url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&id_session='.$session_id; + $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq() . '&id_session=' . $session_id; $_SESSION[$session_key] = true; header("Location: $url"); exit; @@ -246,7 +246,7 @@ if (!empty($auto_launch)) { $session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id(); if (!isset($_SESSION[$session_key])) { //redirecting to the LP - $url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp_data['id']; + $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq() . '&action=view&lp_id=' . $lp_data['id']; $_SESSION[$session_key] = true; header("Location: $url"); @@ -305,15 +305,13 @@ if ($show_autolaunch_lp_warning) { ); } -if (api_get_setting('homepage_view') == 'activity' || - api_get_setting('homepage_view') == 'activity_big' -) { +if (api_get_setting('homepage_view') === 'activity' || api_get_setting('homepage_view') === 'activity_big') { require 'activity.php'; -} elseif (api_get_setting('homepage_view') == '2column') { +} elseif (api_get_setting('homepage_view') === '2column') { require '2column.php'; -} elseif (api_get_setting('homepage_view') == '3column') { +} elseif (api_get_setting('homepage_view') === '3column') { require '3column.php'; -} elseif (api_get_setting('homepage_view') == 'vertical_activity') { +} elseif (api_get_setting('homepage_view') === 'vertical_activity') { require 'vertical_activity.php'; } diff --git a/main/course_home/vertical_activity.php b/main/course_home/vertical_activity.php index 4bbfe16785..a59f95536c 100755 --- a/main/course_home/vertical_activity.php +++ b/main/course_home/vertical_activity.php @@ -13,7 +13,6 @@ * @package chamilo.course_home */ -// MAIN CODE $id = isset($_GET['id']) ? intval($_GET['id']) : null; $course_id = api_get_course_int_id(); $session_id = api_get_session_id(); @@ -99,26 +98,25 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) { $content .= CourseHome::show_tools_category($my_list); $content .= ''; // TOOLS AUTHORING - } else { $my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW); if (count($my_list) > 0) { $content .= '
    '; //ordering by get_lang name $order_tool_list = array(); - foreach($my_list as $key=>$new_tool) { + foreach ($my_list as $key => $new_tool) { $tool_name = CourseHome::translate_tool_name($new_tool); $order_tool_list [$key]= $tool_name; } natsort($order_tool_list); $my_temp_tool_array = array(); - foreach($order_tool_list as $key=>$new_tool) { + foreach ($order_tool_list as $key => $new_tool) { $my_temp_tool_array[] = $my_list[$key]; } $my_list = $my_temp_tool_array; $i = 0; - foreach($my_list as $new_tool) { + foreach ($my_list as $new_tool) { if ($i >= 10) { $my_list2[] = $new_tool; } else { @@ -126,8 +124,8 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) { } $i++; } - $content .=CourseHome::show_tools_category($my_list1); - $content .=CourseHome::show_tools_category($my_list2); + $content .= CourseHome::show_tools_category($my_list1); + $content .= CourseHome::show_tools_category($my_list2); $content .= '
    '; } } diff --git a/main/course_info/delete_course.php b/main/course_info/delete_course.php index 79c7d1aa95..b411fbb77d 100755 --- a/main/course_info/delete_course.php +++ b/main/course_info/delete_course.php @@ -21,12 +21,12 @@ $current_course_code = $_course['official_code']; $current_course_name = $_course['name']; if (!api_is_allowed_to_edit()) { - api_not_allowed(true); + api_not_allowed(true); } $tool_name = get_lang('DelCourse'); - if (isset($_GET['delete']) && $_GET['delete'] == 'yes') { +if (isset($_GET['delete']) && $_GET['delete'] === 'yes') { CourseManager::delete_course($_course['sysCode']); $obj_cat = new Category(); $obj_cat->update_category_delete($_course['sysCode']); @@ -38,7 +38,6 @@ $tool_name = get_lang('DelCourse'); $message = '

    '.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.')

    '; $message .=get_lang('HasDel'); $message .= '

    '.get_lang('BackHome').' '.api_get_setting('siteName').''; - } else { $message = '

    '.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.')

    '; $message .= '

    '.get_lang('ByDel').'

    '; diff --git a/main/course_info/download.php b/main/course_info/download.php index fbfc4bfddb..beee7b1921 100755 --- a/main/course_info/download.php +++ b/main/course_info/download.php @@ -31,12 +31,12 @@ $content_type = ''; if (in_array($extension, array('xml', 'csv')) && (api_is_platform_admin(true) || api_is_drh())) { $content_type = 'application/force-download'; -} elseif ($extension == 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) { +} elseif ($extension === 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) { $content_type = 'application/force-download'; } if (empty($content_type)) { - api_not_allowed(true); + api_not_allowed(true); } if (Security::check_abs_path($archive_path.$archive_file, $archive_path)) { diff --git a/main/course_info/tools.php b/main/course_info/tools.php index 0ca2dde374..e88c1352a7 100644 --- a/main/course_info/tools.php +++ b/main/course_info/tools.php @@ -150,9 +150,7 @@ switch ($action) { } $iconsTools .= ''; $iconsTools .= ''; - $content = $iconsTools; - break; } @@ -163,7 +161,7 @@ function getCustomWebIconPath() { // Check if directory exists or create it if it doesn't $dir = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/course_home_icons/'; - + return $dir; } $tpl = new Template($toolName); diff --git a/main/course_progress/index.php b/main/course_progress/index.php index ceeb175470..035716da26 100755 --- a/main/course_progress/index.php +++ b/main/course_progress/index.php @@ -239,7 +239,7 @@ switch ($action) { case 'thematic_import': case 'moveup': case 'movedown': - if (!api_is_allowed_to_edit(null,true)) { + if (!api_is_allowed_to_edit(null, true)) { api_not_allowed(); } case 'thematic_list': @@ -251,7 +251,7 @@ switch ($action) { case 'thematic_plan_add': case 'thematic_plan_edit': case 'thematic_plan_delete': - if (!api_is_allowed_to_edit(null,true)) { + if (!api_is_allowed_to_edit(null, true)) { api_not_allowed(); } case 'thematic_plan_list': @@ -260,7 +260,7 @@ switch ($action) { case 'thematic_advance_add': case 'thematic_advance_edit': case 'thematic_advance_delete': - if (!api_is_allowed_to_edit(null,true)) { + if (!api_is_allowed_to_edit(null, true)) { api_not_allowed(); } case 'thematic_advance_list': diff --git a/main/course_progress/layout_no_header.php b/main/course_progress/layout_no_header.php index 0c3374098f..0702d4a267 100755 --- a/main/course_progress/layout_no_header.php +++ b/main/course_progress/layout_no_header.php @@ -10,6 +10,5 @@ $tool = isset($tool) ? $tool : null; // Tracking Event::event_access_tool($tool); - // Display echo $content; diff --git a/main/course_progress/thematic_advance.php b/main/course_progress/thematic_advance.php index 30ea5d3a9c..56b775a69e 100755 --- a/main/course_progress/thematic_advance.php +++ b/main/course_progress/thematic_advance.php @@ -11,10 +11,10 @@ // protect a course script api_protect_course_script(true); -if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') { +if ($action === 'thematic_advance_add' || $action === 'thematic_advance_edit') { $header_form = get_lang('NewThematicAdvance'); - if ($action == 'thematic_advance_edit') { + if ($action === 'thematic_advance_edit') { $header_form = get_lang('EditThematicAdvance'); } @@ -25,17 +25,17 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') { 'index.php?action=thematic_advance_list&thematic_id='.$thematic_id.'&'.api_get_cidreq( ) ); - $form->addElement('header', $header_form); + $form->addElement('header', $header_form); //$form->addElement('hidden', 'thematic_advance_token',$token); $form->addElement('hidden', 'action', $action); if (!empty($thematic_advance_id)) { - $form->addElement('hidden', 'thematic_advance_id',$thematic_advance_id); + $form->addElement('hidden', 'thematic_advance_id', $thematic_advance_id); } if (!empty($thematic_id)) { - $form->addElement('hidden', 'thematic_id',$thematic_id); + $form->addElement('hidden', 'thematic_id', $thematic_id); } - + $radios = array(); $radios[] = $form->createElement( 'radio', @@ -80,14 +80,30 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') { } if (count($attendance_select) > 1) { - $form->addElement('select', 'attendance_select', get_lang('Attendances'), $attendance_select, array('id' => 'id_attendance_select', 'onchange' => 'datetime_by_attendance(this.value)')); + $form->addElement( + 'select', + 'attendance_select', + get_lang('Attendances'), + $attendance_select, + array('id' => 'id_attendance_select', 'onchange' => 'datetime_by_attendance(this.value)') + ); } else { - $form->addElement('label', get_lang('Attendances'), ''.get_lang('ThereAreNoAttendancesInsideCourse').''); + $form->addElement( + 'label', + get_lang('Attendances'), + ''.get_lang('ThereAreNoAttendancesInsideCourse').'' + ); } $form->addElement('html', '
    '); if (!empty($calendar_select)) { - $form->addElement('select', 'start_date_by_attendance', get_lang('StartDate'), $calendar_select, array('id'=>'start_date_select_calendar')); + $form->addElement( + 'select', + 'start_date_by_attendance', + get_lang('StartDate'), + $calendar_select, + array('id' => 'start_date_select_calendar') + ); } $form->addElement('html', '
    '); $form->addElement('html', ''); diff --git a/main/course_progress/thematic_controller.php b/main/course_progress/thematic_controller.php index 43525bed29..c8f885d5bc 100755 --- a/main/course_progress/thematic_controller.php +++ b/main/course_progress/thematic_controller.php @@ -30,7 +30,7 @@ class ThematicController /** * This method is used for thematic control (update, insert or listing) - * @param string Action + * @param string $action * render to thematic.php */ public function thematic($action) @@ -39,7 +39,7 @@ class ThematicController $data = array(); $check = Security::check_token('request'); $thematic_id = isset($_REQUEST['thematic_id']) ? intval($_REQUEST['thematic_id']) : null; - $displayHeader = (!empty($_REQUEST['display']) && $_REQUEST['display'] === 'no_header') ? false : true; + $displayHeader = !empty($_REQUEST['display']) && $_REQUEST['display'] === 'no_header' ? false : true; if ($check) { switch ($action) { @@ -351,7 +351,7 @@ class ThematicController $description_type = isset($_GET['description_type']) ? intval($_GET['description_type']) : null; if (!empty($thematic_id) && !empty($description_type)) { - if ($action == 'thematic_plan_delete') { + if ($action === 'thematic_plan_delete') { if (api_is_allowed_to_edit(null, true)) { $thematic->thematic_plan_destroy($thematic_id, $description_type); } @@ -362,7 +362,7 @@ class ThematicController } $data['thematic_id'] = $thematic_id; $data['description_type'] = $description_type; - } else if (!empty($thematic_id) && $action == 'thematic_plan_list') { + } else if (!empty($thematic_id) && $action === 'thematic_plan_list') { $data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id); $data['thematic_id'] = $thematic_id; } @@ -386,11 +386,11 @@ class ThematicController /** * This method is used for thematic advance control (update, insert or listing) * render to thematic_advance.php - * @param string $action + * @param string $action * */ public function thematic_advance($action) - { + { $thematic = new Thematic(); $attendance = new Attendance(); $data = array(); diff --git a/main/course_progress/thematic_plan.php b/main/course_progress/thematic_plan.php index 9b1182c540..a444d19854 100755 --- a/main/course_progress/thematic_plan.php +++ b/main/course_progress/thematic_plan.php @@ -16,11 +16,12 @@ foreach($thematic_plan_data as $thematic_item) { } $new_id = ADD_THEMATIC_PLAN; -if (!empty($thematic_simple_list)) -foreach($thematic_simple_list as $item) { - if ($item >= ADD_THEMATIC_PLAN) { - $new_id = $item + 1; - $default_thematic_plan_title[$item] = $new_thematic_plan_data[$item]['title']; +if (!empty($thematic_simple_list)) { + foreach ($thematic_simple_list as $item) { + if ($item >= ADD_THEMATIC_PLAN) { + $new_id = $item + 1; + $default_thematic_plan_title[$item] = $new_thematic_plan_data[$item]['title']; + } } } @@ -33,46 +34,46 @@ if (isset($message) && $message == 'ok') { Display::display_normal_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull')); } -if ($action == 'thematic_plan_list') { - $form = new FormValidator( - 'thematic_plan_add', - 'POST', - 'index.php?action=thematic_plan_list&thematic_id='.$thematic_id.'&'.api_get_cidreq() - ); - $form->addElement('hidden', 'action', 'thematic_plan_add'); - //$form->addElement('hidden', 'thematic_plan_token', $token); - $form->addElement('hidden', 'thematic_id', $thematic_id); +if ($action === 'thematic_plan_list') { + $form = new FormValidator( + 'thematic_plan_add', + 'POST', + 'index.php?action=thematic_plan_list&thematic_id='.$thematic_id.'&'.api_get_cidreq() + ); + $form->addElement('hidden', 'action', 'thematic_plan_add'); + //$form->addElement('hidden', 'thematic_plan_token', $token); + $form->addElement('hidden', 'thematic_id', $thematic_id); - foreach ($default_thematic_plan_title as $id => $title) { - $form->addElement('hidden', 'description_type['.$id.']', $id); - $form->addText('title['.$id.']', get_lang('Title'), false, array('size'=>'50')); - $form->addHtmlEditor( - 'description['.$id.']', - get_lang('Description'), - false, - false, - array( - 'ToolbarStartExpanded' => 'false', - 'ToolbarSet' => 'TrainingDescription', - 'Height' => '150' - ) - ); + foreach ($default_thematic_plan_title as $id => $title) { + $form->addElement('hidden', 'description_type['.$id.']', $id); + $form->addText('title['.$id.']', get_lang('Title'), false, array('size'=>'50')); + $form->addHtmlEditor( + 'description['.$id.']', + get_lang('Description'), + false, + false, + array( + 'ToolbarStartExpanded' => 'false', + 'ToolbarSet' => 'TrainingDescription', + 'Height' => '150' + ) + ); - if (!empty($thematic_simple_list) && in_array($id, $thematic_simple_list)) { - $thematic_plan = $new_thematic_plan_data[$id]; - // set default values - $default['title['.$id.']'] = $thematic_plan['title']; - $default['description['.$id.']'] = $thematic_plan['description']; - $thematic_plan = null; - } else { - $thematic_plan = null; - $default['title['.$id.']'] = $title; - $default['description['.$id.']']= ''; - } - $form->setDefaults($default); + if (!empty($thematic_simple_list) && in_array($id, $thematic_simple_list)) { + $thematic_plan = $new_thematic_plan_data[$id]; + // set default values + $default['title['.$id.']'] = $thematic_plan['title']; + $default['description['.$id.']'] = $thematic_plan['description']; + $thematic_plan = null; + } else { + $thematic_plan = null; + $default['title['.$id.']'] = $title; + $default['description['.$id.']']= ''; } - $form->addButtonSave(get_lang('Save')); - $form->display(); + $form->setDefaults($default); + } + $form->addButtonSave(get_lang('Save')); + $form->display(); } elseif ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') { if ($description_type >= ADD_THEMATIC_PLAN) { $header_form = get_lang('NewBloc'); @@ -80,7 +81,7 @@ if ($action == 'thematic_plan_list') { $header_form = $default_thematic_plan_title[$description_type]; } if (!$error) { - $token = md5(uniqid(rand(),TRUE)); + $token = md5(uniqid(rand(), true)); $_SESSION['thematic_plan_token'] = $token; } @@ -135,7 +136,7 @@ if ($action == 'thematic_plan_list') { // error messages if ($error) { - Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false); + Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false); } $form->display(); } diff --git a/main/coursecopy/import_backup.php b/main/coursecopy/import_backup.php index 2388c6f83f..5ec2bf37cf 100755 --- a/main/coursecopy/import_backup.php +++ b/main/coursecopy/import_backup.php @@ -5,7 +5,6 @@ use Chamilo\CourseBundle\Component\CourseCopy\CourseSelectForm; use Chamilo\CourseBundle\Component\CourseCopy\CourseArchiver; use Chamilo\CourseBundle\Component\CourseCopy\CourseRestorer; - /** * Import a backup. * diff --git a/main/create_course/add_course.php b/main/create_course/add_course.php index f67fccbba1..dd738129b1 100755 --- a/main/create_course/add_course.php +++ b/main/create_course/add_course.php @@ -11,7 +11,6 @@ * "Course validation" feature, technical adaptation for Chamilo 1.8.8: * @author Ivan Tcholakov */ -use \ChamiloSession as Session; // Flag forcing the "current course" reset. $cidReset = true; @@ -26,7 +25,7 @@ $this_section = SECTION_COURSES; // true - the new course is requested only and it is created after approval; // false - the new course is created immediately, after filling this form. $course_validation_feature = false; -if (api_get_setting('course_validation') == 'true' && !api_is_platform_admin()) { +if (api_get_setting('course_validation') === 'true' && !api_is_platform_admin()) { $course_validation_feature = true; } @@ -49,10 +48,7 @@ $tool_name = $course_validation_feature ? get_lang('CreateCourseRequest') : get_ $tpl = new Template($tool_name); -if ( - api_get_setting('allow_users_to_create_courses') == 'false' && - !api_is_platform_admin() -) { +if (api_get_setting('allow_users_to_create_courses') === 'false' && !api_is_platform_admin()) { api_not_allowed(true); } @@ -123,7 +119,6 @@ $form->addRule( ); // The teacher -//array(get_lang('Professor'), null), null, array('size' => '60', 'disabled' => 'disabled')); $titular = & $form->addElement('hidden', 'tutor_name', ''); if ($course_validation_feature) { @@ -153,14 +148,20 @@ if ($course_validation_feature) { } // Course language. -$form->addElement( - 'select_language', - 'course_language', - get_lang('Ln'), - array(), - array('style' => 'width:150px') -); -$form->applyFilter('select_language', 'html_filter'); +$languages = api_get_languages(); +if (count($languages['name']) === 1) { + // If there's only one language available, there's no point in asking + $form->addElement('hidden', 'course_language', $languages['folder'][0]); +} else { + $form->addElement( + 'select_language', + 'course_language', + get_lang('Ln'), + array(), + array('style' => 'width:150px') + ); + $form->applyFilter('select_language', 'html_filter'); +} // Exemplary content checkbox. $form->addElement( @@ -361,7 +362,7 @@ if ($form->validate()) { false ); // Display the form. - $content = $form->return_form(); + $content = $form->returnForm(); } } } else { @@ -371,7 +372,7 @@ if ($form->validate()) { false ); // Display the form. - $content = $form->return_form(); + $content = $form->returnForm(); } } else { if (!$course_validation_feature) { diff --git a/main/cron/import_csv.php b/main/cron/import_csv.php index b93d632347..e7ee86e4fa 100755 --- a/main/cron/import_csv.php +++ b/main/cron/import_csv.php @@ -838,7 +838,7 @@ class ImportCsv $item = null; foreach ($items as $tempItem) { - if ($tempItem['c_id'] == $event['course_id']) { + if ($tempItem['item_id'] == $event['course_id']) { $item = $tempItem; } } diff --git a/main/dashboard/dashboard_controller.php b/main/dashboard/dashboard_controller.php index 8a5f389165..e371a86a87 100755 --- a/main/dashboard/dashboard_controller.php +++ b/main/dashboard/dashboard_controller.php @@ -85,40 +85,40 @@ class DashboardController $this->view->render(); } - /** - * This method allow store user blocks from dashboard manager - * render to dashboard.php view - */ - public function store_user_block() + /** + * This method allow store user blocks from dashboard manager + * render to dashboard.php view + */ + public function store_user_block() { - $data = array(); - $user_id = $this->user_id; - if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") { - $enabled_blocks = $_POST['enabled_blocks']; - $columns = $_POST['columns']; - $affected_rows = DashboardManager::store_user_blocks($user_id, $enabled_blocks, $columns); - if ($affected_rows) { - $data['success'] = true; - } - } - - $data['dashboard_view'] = 'list'; - - // render to the view - $this->view->set_data($data); - $this->view->set_layout('layout'); - $this->view->set_template('dashboard'); - $this->view->render(); - } - - /** - * This method is used when you close a block from dashboard block interface - * render to dashboard.php view - */ - public function close_user_block($path) + $data = array(); + $user_id = $this->user_id; + if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") { + $enabled_blocks = $_POST['enabled_blocks']; + $columns = $_POST['columns']; + $affected_rows = DashboardManager::store_user_blocks($user_id, $enabled_blocks, $columns); + if ($affected_rows) { + $data['success'] = true; + } + } + + $data['dashboard_view'] = 'list'; + + // render to the view + $this->view->set_data($data); + $this->view->set_layout('layout'); + $this->view->set_template('dashboard'); + $this->view->render(); + } + + /** + * This method is used when you close a block from dashboard block interface + * render to dashboard.php view + */ + public function close_user_block($path) { - $user_id = $this->user_id; - $result = DashboardManager::close_user_block($user_id, $path); - $this->display($result); - } + $user_id = $this->user_id; + $result = DashboardManager::close_user_block($user_id, $path); + $this->display($result); + } } diff --git a/main/dashboard/index.php b/main/dashboard/index.php index 8046fc73f3..45f8af415f 100755 --- a/main/dashboard/index.php +++ b/main/dashboard/index.php @@ -51,6 +51,6 @@ switch ($action) { case 'disable_block': $dashboard_controller->close_user_block($path); break; - default : + default: $dashboard_controller->display(); } diff --git a/main/dashboard/layout.php b/main/dashboard/layout.php index bfa323f657..442cbb36e0 100755 --- a/main/dashboard/layout.php +++ b/main/dashboard/layout.php @@ -2,7 +2,7 @@ /* For licensing terms, see /license.txt */ /** -* Layout (principal view) used for structuring other views +* Layout (principal view) used for structuring other views * @author Christian Fasanando * @package chamilo.dashboard */ @@ -17,5 +17,4 @@ Display :: display_header($tool_name); // Display echo $content; -// Footer Display :: display_footer(); \ No newline at end of file diff --git a/main/document/edit_document.php b/main/document/edit_document.php index fae0d76283..a8c28a89de 100755 --- a/main/document/edit_document.php +++ b/main/document/edit_document.php @@ -591,7 +591,8 @@ function show_return($document_id, $path, $call_from_tool='', $slide_id=0, $is_c $url = api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq().'&id='.$parent_id; if ($is_certificate_mode) { - echo ''. + $selectedCategory = (isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : ''); + echo ''. Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).''; } elseif($call_from_tool=='slideshow') { echo ''. diff --git a/main/dropbox/dropbox_class.inc.php b/main/dropbox/dropbox_class.inc.php index 9c223622f4..d6f8ddf0ff 100755 --- a/main/dropbox/dropbox_class.inc.php +++ b/main/dropbox/dropbox_class.inc.php @@ -54,7 +54,8 @@ class Dropbox_Work public $upload_date; public $last_upload_date; public $isOldWork; - public $feedback_date, $feedback; + public $feedback_date; + public $feedback; /** * Constructor calls private functions to create a new work or retreive an existing work from DB @@ -126,7 +127,7 @@ class Dropbox_Work 'description' => $this->description, 'author' => $this->author, 'last_upload_date' => $this->last_upload_date, - 'session_id' => api_get_session_id(), + 'session_id' => api_get_session_id() ]; Database::update( @@ -220,9 +221,10 @@ class Dropbox_Work // Getting the feedback on the work. if ($action == 'viewfeedback' AND $this->id == $_GET['id']) { $feedback2 = array(); - $sql_feedback = "SELECT * FROM ".$dropbox_cnf['tbl_feedback']." - WHERE c_id = $course_id AND file_id='".$id."' ORDER BY feedback_id ASC"; - $result = Database::query($sql_feedback); + $sql = "SELECT * FROM ".$dropbox_cnf['tbl_feedback']." + WHERE c_id = $course_id AND file_id='".$id."' + ORDER BY feedback_id ASC"; + $result = Database::query($sql); while ($row_feedback = Database::fetch_array($result)) { $row_feedback['feedback'] = Security::remove_XSS($row_feedback['feedback']); $feedback2[] = $row_feedback; @@ -381,7 +383,6 @@ class Dropbox_SentWork extends Dropbox_Work WHERE c_id = $course_id AND file_id = ".intval($id).""; $result = Database::query($sql); while ($res = Database::fetch_array($result, 'ASSOC')) { - // Check for deleted users $dest_user_id = $res['dest_user_id']; $user_info = api_get_user_info($dest_user_id); @@ -571,7 +572,7 @@ class Dropbox_Person /** * Deletes all the received work of this person */ - function deleteAllReceivedWork() + public function deleteAllReceivedWork() { $course_id = api_get_course_int_id(); $dropbox_cnf = getDropboxConf(); @@ -589,7 +590,7 @@ class Dropbox_Person * Deletes all the received categories and work of this person * @param integer $id */ - function deleteReceivedWorkFolder($id) + public function deleteReceivedWorkFolder($id) { $dropbox_cnf = getDropboxConf(); $course_id = api_get_course_int_id(); @@ -612,7 +613,7 @@ class Dropbox_Person * * @param integer $id */ - function deleteReceivedWork($id) + public function deleteReceivedWork($id) { $course_id = api_get_course_int_id(); $dropbox_cnf = getDropboxConf(); @@ -642,7 +643,7 @@ class Dropbox_Person /** * Deletes all the sent dropbox files of this person */ - function deleteAllSentWork() + public function deleteAllSentWork() { $course_id = api_get_course_int_id(); $dropbox_cnf = getDropboxConf(); @@ -661,7 +662,7 @@ class Dropbox_Person * * @param unknown_type $id */ - function deleteSentWork($id) + public function deleteSentWork($id) { $course_id = api_get_course_int_id(); $dropbox_cnf = getDropboxConf(); @@ -696,7 +697,7 @@ class Dropbox_Person * @param string $id * @param string $text */ - function updateFeedback($id, $text) + public function updateFeedback($id, $text) { $course_id = api_get_course_int_id(); $_course = api_get_course_info(); @@ -760,7 +761,7 @@ class Dropbox_Person * @param string $type * @param string $value */ - function filter_received_work($type, $value) + public function filter_received_work($type, $value) { $dropbox_cnf = getDropboxConf(); $new_received_work = array(); diff --git a/main/exercice/Draggable.php b/main/exercise/Draggable.php similarity index 100% rename from main/exercice/Draggable.php rename to main/exercise/Draggable.php diff --git a/main/exercice/Hpdownload.php b/main/exercise/Hpdownload.php similarity index 97% rename from main/exercice/Hpdownload.php rename to main/exercise/Hpdownload.php index 5b53ba32d9..6d4920f7e8 100755 --- a/main/exercice/Hpdownload.php +++ b/main/exercise/Hpdownload.php @@ -128,7 +128,7 @@ if ($content_type == 'text/html') { $newcontent = str_replace($mit,$js_content,$content); $prehref="javascript:void(0);"; - $posthref=$_configuration['root_web']."main/exercice/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid; + $posthref = api_get_path(WEB_CODE_PATH) . "main/exercise/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid; $newcontent = str_replace($prehref,$posthref,$newcontent); diff --git a/main/exercice/MatchingDraggable.php b/main/exercise/MatchingDraggable.php similarity index 100% rename from main/exercice/MatchingDraggable.php rename to main/exercise/MatchingDraggable.php diff --git a/main/exercice/TestCategory.php b/main/exercise/TestCategory.php similarity index 100% rename from main/exercice/TestCategory.php rename to main/exercise/TestCategory.php diff --git a/main/exercice/UniqueAnswerImage.php b/main/exercise/UniqueAnswerImage.php similarity index 100% rename from main/exercice/UniqueAnswerImage.php rename to main/exercise/UniqueAnswerImage.php diff --git a/main/exercice/admin.php b/main/exercise/admin.php similarity index 96% rename from main/exercice/admin.php rename to main/exercise/admin.php index 095a2c2865..616f5f24bd 100755 --- a/main/exercice/admin.php +++ b/main/exercise/admin.php @@ -186,7 +186,7 @@ if (!is_object($objExercise)) { // Exercise can be edited in their course. if ($objExercise->sessionId != $sessionId) { api_not_allowed(true); - /*header('Location: '.api_get_path(WEB_CODE_PATH).'exercice/exercise.php?'.api_get_cidreq()); + /*header('Location: '.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq()); exit;*/ } @@ -230,7 +230,7 @@ if ($cancelExercise) { } else { // new exercise // goes back to the exercise list - header('Location: '.api_get_path(WEB_CODE_PATH).'exercice/exercise.php?'.api_get_cidreq()); + header('Location: '.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq()); exit(); } } @@ -302,7 +302,7 @@ if (isset($_GET['newQuestion']) || isset($_GET['editQuestion']) ) { // shows a link to go back to the question pool if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')){ $interbreadcrumb[]=array( - "url" => api_get_path(WEB_CODE_PATH)."exercice/question_pool.php?fromExercise=$fromExercise&".api_get_cidreq(), + "url" => api_get_path(WEB_CODE_PATH)."exercise/question_pool.php?fromExercise=$fromExercise&".api_get_cidreq(), "name" => get_lang('QuestionPool') ); } @@ -363,22 +363,22 @@ $inATest = isset($exerciseId) && $exerciseId > 0; if ($inATest) { echo '
    '; if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) - echo ''. + echo ''. Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).''; if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) { - echo ''. + echo ''. Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).''; } - echo ''. + echo ''. Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_MEDIUM).''; echo Display::url( Display::return_icon('test_results.png', get_lang('Results'),'',ICON_SIZE_MEDIUM), - api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id + api_get_path(WEB_CODE_PATH).'exercise/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id ); - echo ''. + echo ''. Display::return_icon('settings.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).''; $maxScoreAllQuestions = 0; @@ -396,13 +396,13 @@ if ($inATest) { } else if (isset($_GET['newQuestion'])) { // we are in create a new question from question pool not in a test echo ''; } else { // If we are in question_pool but not in an test, go back to question create in pool echo ''; diff --git a/main/exercice/adminhp.php b/main/exercise/adminhp.php similarity index 97% rename from main/exercice/adminhp.php rename to main/exercise/adminhp.php index 49932f6c62..c3768b2abc 100755 --- a/main/exercice/adminhp.php +++ b/main/exercise/adminhp.php @@ -54,7 +54,7 @@ $nameTools = get_lang('adminHP'); Display::display_header($nameTools,"Exercise"); /** @todo probably wrong !!!! */ -require_once(api_get_path(SYS_CODE_PATH).'/exercice/hotpotatoes.lib.php'); +require_once(api_get_path(SYS_CODE_PATH).'/exercise/hotpotatoes.lib.php'); ?> diff --git a/main/exercice/aiken.php b/main/exercise/aiken.php similarity index 91% rename from main/exercice/aiken.php rename to main/exercise/aiken.php index 052821cf0f..a75755276f 100755 --- a/main/exercice/aiken.php +++ b/main/exercise/aiken.php @@ -15,8 +15,8 @@ $lib_path = api_get_path(LIBRARY_PATH); $main_path = api_get_path(SYS_CODE_PATH); // including additional libraries -require_once $main_path.'exercice/export/aiken/aiken_import.inc.php'; -require_once $main_path.'exercice/export/aiken/aiken_classes.php'; +require_once $main_path.'exercise/export/aiken/aiken_import.inc.php'; +require_once $main_path.'exercise/export/aiken/aiken_classes.php'; // section (for the tabs) $this_section = SECTION_COURSES; diff --git a/main/exercice/answer.class.php b/main/exercise/answer.class.php similarity index 100% rename from main/exercice/answer.class.php rename to main/exercise/answer.class.php diff --git a/main/exercice/calculated_answer.class.php b/main/exercise/calculated_answer.class.php similarity index 99% rename from main/exercice/calculated_answer.class.php rename to main/exercise/calculated_answer.class.php index fc92aaad36..88ab4b21c4 100644 --- a/main/exercice/calculated_answer.class.php +++ b/main/exercise/calculated_answer.class.php @@ -138,7 +138,7 @@ class CalculatedAnswer extends Question $notationListButton = Display::url( get_lang('NotationList'), - api_get_path(WEB_PATH).'main/exercice/evalmathnotation.php', + api_get_path(WEB_CODE_PATH).'exercise/evalmathnotation.php', array( 'class' => 'btn btn-info ajax', 'data-title' => get_lang('NotationList'), diff --git a/main/exercice/evalmathnotation.php b/main/exercise/evalmathnotation.php similarity index 100% rename from main/exercice/evalmathnotation.php rename to main/exercise/evalmathnotation.php diff --git a/main/exercice/exercice.php b/main/exercise/exercice.php similarity index 100% rename from main/exercice/exercice.php rename to main/exercise/exercice.php diff --git a/main/exercice/exercise.class.php b/main/exercise/exercise.class.php similarity index 99% rename from main/exercice/exercise.class.php rename to main/exercise/exercise.class.php index 8aa5681209..9540427bcf 100755 --- a/main/exercice/exercise.class.php +++ b/main/exercise/exercise.class.php @@ -2191,7 +2191,7 @@ class Exercise $form->addCheckBox( 'save_correct_answers', null, - get_lang('Save the correct answers for the next attempt') + get_lang('SaveTheCorrectAnswersForTheNextAttempt') ); $form->addElement('html','
     
    '); $form->addElement('checkbox', 'review_answers', null, get_lang('ReviewAnswers')); @@ -5165,7 +5165,7 @@ class Exercise } $url_email = api_get_path(WEB_CODE_PATH) - . 'exercice/exercise_show.php?' + . 'exercise/exercise_show.php?' . api_get_cidreq() . '&id_session=' . $sessionId @@ -5241,7 +5241,7 @@ class Exercise $course_info = api_get_course_info($courseCode); $url_email = api_get_path(WEB_CODE_PATH) - . 'exercice/exercise_show.php?' + . 'exercise/exercise_show.php?' . api_get_cidreq() . '&id_session=' . api_get_session_id() @@ -5337,7 +5337,7 @@ class Exercise $course_info = api_get_course_info($courseCode); $url_email = api_get_path(WEB_CODE_PATH) - . 'exercice/exercise_show.php?' + . 'exercise/exercise_show.php?' . api_get_cidreq() . '&id_session=' . api_get_session_id() diff --git a/main/exercice/exercise.php b/main/exercise/exercise.php similarity index 98% rename from main/exercice/exercise.php rename to main/exercise/exercise.php index e3d8f221bc..0dd1689507 100644 --- a/main/exercice/exercise.php +++ b/main/exercise/exercise.php @@ -116,7 +116,7 @@ if (!empty($gradebook) && $gradebook == 'view') { $nameTools = get_lang('Exercises'); $errorXmlExport = null; if ($is_allowedToEdit && !empty($choice) && $choice == 'exportqti2') { - require_once api_get_path(SYS_CODE_PATH).'exercice/export/qti2/qti2_export.php'; + require_once api_get_path(SYS_CODE_PATH).'exercise/export/qti2/qti2_export.php'; $export = export_exercise_to_qti($exerciseId, true); $archive_path = api_get_path(SYS_ARCHIVE_PATH); @@ -223,7 +223,12 @@ if ($is_allowedToEdit) { // deletes an exercise if ($exercise_action_locked == false) { $objExerciseTmp->delete(); - $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 1, $exerciseId, api_get_session_id()); + $link_info = GradebookUtils::isResourceInCourseGradebook( + api_get_course_id(), + 1, + $exerciseId, + api_get_session_id() + ); if ($link_info !== false) { GradebookUtils::remove_resource_from_course_gradebook($link_info['id']); } @@ -443,25 +448,25 @@ $total = $total_exercises + $hp_count; $token = Security::get_token(); if ($is_allowedToEdit && $origin != 'learnpath') { - echo ''. + echo ''. Display :: return_icon('new_exercice.png', get_lang('NewEx'), '', ICON_SIZE_MEDIUM).''; - echo ''. + echo ''. Display :: return_icon('new_question.png', get_lang('AddQ'), '', ICON_SIZE_MEDIUM).''; // Question category - echo ''; + echo ''; echo Display::return_icon('green_open.png', get_lang('QuestionCategory'), '', ICON_SIZE_MEDIUM); echo ''; - echo ''; + echo ''; echo Display::return_icon('database.png', get_lang('QuestionPool'), '', ICON_SIZE_MEDIUM); echo ''; //echo Display::url(Display::return_icon('looknfeel.png', get_lang('Media')), 'media.php?' . api_get_cidreq()); // end question category - echo ''.Display :: return_icon('import_hotpotatoes.png', get_lang('ImportHotPotatoesQuiz'), '', ICON_SIZE_MEDIUM).''; + echo ''.Display :: return_icon('import_hotpotatoes.png', get_lang('ImportHotPotatoesQuiz'), '', ICON_SIZE_MEDIUM).''; // link to import qti2 ... - echo ''.Display :: return_icon('import_qti2.png', get_lang('ImportQtiQuiz'), '', ICON_SIZE_MEDIUM).''; - echo ''.Display :: return_icon('import_aiken.png', get_lang('ImportAikenQuiz'), '', ICON_SIZE_MEDIUM).''; - echo ''.Display :: return_icon('import_excel.png', get_lang('ImportExcelQuiz'), '', ICON_SIZE_MEDIUM).''; + echo ''.Display :: return_icon('import_qti2.png', get_lang('ImportQtiQuiz'), '', ICON_SIZE_MEDIUM).''; + echo ''.Display :: return_icon('import_aiken.png', get_lang('ImportAikenQuiz'), '', ICON_SIZE_MEDIUM).''; + echo ''.Display :: return_icon('import_excel.png', get_lang('ImportExcelQuiz'), '', ICON_SIZE_MEDIUM).''; echo Display::url( Display::return_icon( 'clean_all.png', @@ -472,7 +477,7 @@ if ($is_allowedToEdit && $origin != 'learnpath') { '', array( 'onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToEmptyAllTestResults'), ENT_QUOTES, $charset))."')) return false;", - 'href' => api_get_path(WEB_CODE_PATH).'exercice/exercise.php?'.api_get_cidreq().'&choice=clean_all_test&sec_token='.$token + 'href' => api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq().'&choice=clean_all_test&sec_token='.$token ) ); } diff --git a/main/exercice/exercise_admin.php b/main/exercise/exercise_admin.php similarity index 96% rename from main/exercice/exercise_admin.php rename to main/exercise/exercise_admin.php index e8568417cb..b4e61d6542 100755 --- a/main/exercice/exercise_admin.php +++ b/main/exercise/exercise_admin.php @@ -197,7 +197,7 @@ if ($form->validate()) { } else { $lp_id = intval($_GET['lp_id']); } - echo "".Display::return_icon('back.png', get_lang("BackTo").' '.get_lang("LearningPaths"),'',ICON_SIZE_MEDIUM).""; + echo "".Display::return_icon('back.png', get_lang("BackTo").' '.get_lang("LearningPaths"),'',ICON_SIZE_MEDIUM).""; } else { echo '' . Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM). diff --git a/main/exercice/exercise_history.php b/main/exercise/exercise_history.php similarity index 97% rename from main/exercice/exercise_history.php rename to main/exercise/exercise_history.php index 3ebf08d3b5..f87aed6ae5 100755 --- a/main/exercice/exercise_history.php +++ b/main/exercise/exercise_history.php @@ -21,7 +21,7 @@ $is_allowedToEdit = api_is_allowed_to_edit(null,true); $is_tutor = api_is_allowed_to_edit(true); if (!$is_allowedToEdit){ - header('Location: /main/exercice/exercise.php?'.api_get_cidreq()); + header('Location: ' . api_get_path(WEB_CODE_PATH) . 'exercise/exercise.php?' . api_get_cidreq()); exit; } diff --git a/main/exercice/exercise_reminder.php b/main/exercise/exercise_reminder.php similarity index 100% rename from main/exercice/exercise_reminder.php rename to main/exercise/exercise_reminder.php diff --git a/main/exercice/exercise_report.php b/main/exercise/exercise_report.php similarity index 99% rename from main/exercice/exercise_report.php rename to main/exercise/exercise_report.php index 9ee7bb9596..46d3e338bb 100755 --- a/main/exercice/exercise_report.php +++ b/main/exercise/exercise_report.php @@ -151,7 +151,7 @@ if (isset($_REQUEST['comments']) && null, PERSON_NAME_EMAIL_ADDRESS ); - $url = api_get_path(WEB_CODE_PATH).'exercice/result.php?id='.$track_exercise_info['exe_id'].'&'.api_get_cidreq().'&show_headers=1&id_session='.$session_id; + $url = api_get_path(WEB_CODE_PATH).'exercise/result.php?id='.$track_exercise_info['exe_id'].'&'.api_get_cidreq().'&show_headers=1&id_session='.$session_id; $my_post_info = array(); $post_content_id = array(); @@ -261,7 +261,7 @@ if (isset($_REQUEST['comments']) && Database::query($sql); if ($origin == 'tracking_course') { //Redirect to the course detail in lp - header('location: '.api_get_path(WEB_CODE_PATH).'exercice/exercise.php?course='.Security :: remove_XSS($_GET['course'])); + header('location: '.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?course='.Security :: remove_XSS($_GET['course'])); exit; } else { // Redirect to the reporting diff --git a/main/exercice/exercise_result.class.php b/main/exercise/exercise_result.class.php similarity index 100% rename from main/exercice/exercise_result.class.php rename to main/exercise/exercise_result.class.php diff --git a/main/exercice/exercise_result.php b/main/exercise/exercise_result.php similarity index 96% rename from main/exercice/exercise_result.php rename to main/exercise/exercise_result.php index fa5dae3cb4..63f9807af4 100755 --- a/main/exercice/exercise_result.php +++ b/main/exercise/exercise_result.php @@ -151,7 +151,7 @@ if ($objExercise->selectAttempts() > 0) { if ($remainingAttempts) { $attemptButton = Display::toolbarButton( get_lang('AnotherAttempt'), - api_get_path(WEB_CODE_PATH) . 'exercice/overview.php?' . api_get_cidreq() . '&' . http_build_query([ + api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?' . api_get_cidreq() . '&' . http_build_query([ 'exerciseId' => $objExercise->id ]), 'pencil-square-o', @@ -204,7 +204,7 @@ if ($origin != 'learnpath') { Display::display_footer(); } else { $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null; - $url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type; + $url = '../lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type; $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"'; if (api_is_allowed_to_session_edit()) { diff --git a/main/exercice/exercise_show.php b/main/exercise/exercise_show.php similarity index 99% rename from main/exercice/exercise_show.php rename to main/exercise/exercise_show.php index 7e866929b7..bb828e99d1 100755 --- a/main/exercice/exercise_show.php +++ b/main/exercise/exercise_show.php @@ -855,7 +855,7 @@ if ($isFeedbackAllowed) { if ($isFeedbackAllowed) { if (in_array($origin, array('tracking_course', 'user_course', 'correct_exercise_in_lp'))) { - $formUrl = api_get_path(WEB_CODE_PATH) . 'exercice/exercise_report.php?' . api_get_cidreq() . '&'; + $formUrl = api_get_path(WEB_CODE_PATH) . 'exercise/exercise_report.php?' . api_get_cidreq() . '&'; $formUrl .= http_build_query([ 'exerciseId' => $exercise_id, 'filter' => 2, @@ -874,7 +874,7 @@ if ($isFeedbackAllowed) { echo ' '; echo ' '; } else { - $formUrl = api_get_path(WEB_CODE_PATH) . 'exercice/exercise_report.php?' . api_get_cidreq() . '&'; + $formUrl = api_get_path(WEB_CODE_PATH) . 'exercise/exercise_report.php?' . api_get_cidreq() . '&'; $formUrl .= http_build_query([ 'exerciseId' => $exercise_id, 'filter' => 1, @@ -919,7 +919,7 @@ if ($origin != 'learnpath') { } else { if (!isset($_GET['fb_type'])) { $lp_mode = $_SESSION['lp_mode']; - $url = '../newscorm/lp_controller.php?' . api_get_cidreq() . '&'; + $url = '../lp/lp_controller.php?' . api_get_cidreq() . '&'; $url .= http_build_url([ 'action' => 'view', 'lp_id' => $learnpath_id, diff --git a/main/exercice/exercise_submit.php b/main/exercise/exercise_submit.php similarity index 100% rename from main/exercice/exercise_submit.php rename to main/exercise/exercise_submit.php diff --git a/main/exercice/exercise_submit_modal.php b/main/exercise/exercise_submit_modal.php similarity index 99% rename from main/exercice/exercise_submit_modal.php rename to main/exercise/exercise_submit_modal.php index e43bf145e2..a474176387 100755 --- a/main/exercice/exercise_submit_modal.php +++ b/main/exercise/exercise_submit_modal.php @@ -513,7 +513,7 @@ if (isset($try) && $try==1) { // the link to theory (a learning path) if (!empty($lp)) { - $lp_url= api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; + $lp_url= api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; $list = new LearnpathList(api_get_user_id()); $flat_list = $list->get_flat_list(); $links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).''.get_lang('SeeTheory').'
    '; diff --git a/main/exercice/export/aiken/aiken_classes.php b/main/exercise/export/aiken/aiken_classes.php similarity index 100% rename from main/exercice/export/aiken/aiken_classes.php rename to main/exercise/export/aiken/aiken_classes.php diff --git a/main/exercice/export/aiken/aiken_import.inc.php b/main/exercise/export/aiken/aiken_import.inc.php similarity index 100% rename from main/exercice/export/aiken/aiken_import.inc.php rename to main/exercise/export/aiken/aiken_import.inc.php diff --git a/main/exercice/export/exercise_import.inc.php b/main/exercise/export/exercise_import.inc.php similarity index 100% rename from main/exercice/export/exercise_import.inc.php rename to main/exercise/export/exercise_import.inc.php diff --git a/main/exercice/export/exercise_import.php b/main/exercise/export/exercise_import.php similarity index 100% rename from main/exercice/export/exercise_import.php rename to main/exercise/export/exercise_import.php diff --git a/main/exercice/export/index.php b/main/exercise/export/index.php similarity index 100% rename from main/exercice/export/index.php rename to main/exercise/export/index.php diff --git a/main/exercice/export/qti2/qti2_classes.php b/main/exercise/export/qti2/qti2_classes.php similarity index 100% rename from main/exercice/export/qti2/qti2_classes.php rename to main/exercise/export/qti2/qti2_classes.php diff --git a/main/exercice/export/qti2/qti2_export.php b/main/exercise/export/qti2/qti2_export.php similarity index 100% rename from main/exercice/export/qti2/qti2_export.php rename to main/exercise/export/qti2/qti2_export.php diff --git a/main/exercice/export/scorm/scorm_classes.php b/main/exercise/export/scorm/scorm_classes.php similarity index 99% rename from main/exercice/export/scorm/scorm_classes.php rename to main/exercise/export/scorm/scorm_classes.php index 5ec81cac14..0b31f22a2e 100755 --- a/main/exercice/export/scorm/scorm_classes.php +++ b/main/exercise/export/scorm/scorm_classes.php @@ -757,7 +757,7 @@ class ScormAssessmentItem */ function common_js() { - $js = file_get_contents('../newscorm/js/api_wrapper.js'); + $js = file_get_contents('../lp/js/api_wrapper.js'); $js .= 'var questions = new Array();' . "\n"; $js .= 'var questions_answers = new Array();' . "\n"; $js .= 'var questions_answers_correct = new Array();' . "\n"; @@ -998,7 +998,7 @@ class ScormSection { $js = "\n"; $js .= file_get_contents('../inc/lib/javascript/hotspot/js/hotspot.js'); - $js .= file_get_contents('../newscorm/js/api_wrapper.js'); + $js .= file_get_contents('../lp/js/api_wrapper.js'); $js .= 'var questions = new Array();' . "\n"; $js .= 'var questions_answers = new Array();' . "\n"; $js .= 'var questions_answers_correct = new Array();' . "\n"; diff --git a/main/exercice/feedback.php b/main/exercise/feedback.php similarity index 100% rename from main/exercice/feedback.php rename to main/exercise/feedback.php diff --git a/main/exercice/fill_blanks.class.php b/main/exercise/fill_blanks.class.php similarity index 100% rename from main/exercice/fill_blanks.class.php rename to main/exercise/fill_blanks.class.php diff --git a/main/exercice/freeanswer.class.php b/main/exercise/freeanswer.class.php similarity index 100% rename from main/exercice/freeanswer.class.php rename to main/exercise/freeanswer.class.php diff --git a/main/exercice/global_multiple_answer.class.php b/main/exercise/global_multiple_answer.class.php similarity index 97% rename from main/exercice/global_multiple_answer.class.php rename to main/exercise/global_multiple_answer.class.php index f98ecbff0a..dbcc71a8a4 100755 --- a/main/exercice/global_multiple_answer.class.php +++ b/main/exercise/global_multiple_answer.class.php @@ -1,243 +1,243 @@ -type = GLOBAL_MULTIPLE_ANSWER; - $this->isContent = $this->getIsContent(); - } - - /** - * function which redefines Question::createAnswersForm - * @param FormValidator $form - */ - public function createAnswersForm($form) - { - $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; - $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0)); - - $obj_ex = $_SESSION['objExercise']; - - /* Mise en variable de Affichage "Reponses" et son icone, "N�", "Vrai", "Reponse" */ - $html = '
     
    "; - $content .= CourseHome::show_tool_3column('Basic'); $content .= CourseHome::show_tool_3column('External'); - $content .= "
    - - - - '; - - $html .=''; - $html .=''; - $form->addElement( - 'label', - get_lang('Answers') . - '
    '.Display::return_icon('fill_field.png'), - $html - ); - $defaults = array(); - $correct = 0; - $answer = false; - if (!empty($this->id)) { - $answer = new Answer($this->id); - $answer->read(); - if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) { - $nb_answers = $answer->nbrAnswers; - } - } - - #le nombre de r�ponses est bien enregistr� sous la forme int(nb) - - /* Ajout mise en forme nb reponse */ - $form->addElement('hidden', 'nb_answers'); - $boxes_names = array(); - - /* V�rification : Cr�action d'au moins une r�ponse */ - if ($nb_answers < 1) { - $nb_answers = 1; - Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer')); - } - - //D�but affichage score global dans la modification d'une question - $scoreA = "0"; //par reponse - $scoreG = "0"; //Global - - /* boucle pour sauvegarder les donn�es dans le tableau defaults */ - for ($i = 1; $i <= $nb_answers; ++$i) { - /* si la reponse est de type objet */ - if (is_object($answer)) { - $defaults['answer[' . $i . ']'] = $answer->answer[$i]; - $defaults['comment[' . $i . ']'] = $answer->comment[$i]; - $defaults['correct[' . $i . ']'] = $answer->correct[$i]; - - // start - $scoreA = $answer->weighting[$i]; - } - if ($scoreA > 0) { - $scoreG = $scoreG + $scoreA; - } - //------------- Fin - //------------- Debut si un des scores par reponse est egal � 0 : la coche vaut 1 (coch�) - if ($scoreA == 0) { - $defaults['pts'] = 1; - } - - $renderer = & $form->defaultRenderer(); - - $renderer->setElementTemplate('', 'correct['.$i.']'); - $renderer->setElementTemplate('', 'counter['.$i.']'); - $renderer->setElementTemplate('', 'answer['.$i.']'); - $renderer->setElementTemplate('', 'comment['.$i.']'); - //$renderer->setElementTemplate('', 'weighting['.$i.']'); - - $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); - $answer_number->freeze(); - - $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox"'); - $boxes_names[] = 'correct[' . $i . ']'; - - $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); - $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); - - $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); - - $form->addElement('html', ''); - } - //--------- Mise en variable du score global lors d'une modification de la question/r�ponse - $defaults['weighting[1]'] = (round($scoreG)); - - $form->addElement('html', '
    - ' . get_lang('Number') . ' - - ' . get_lang('True') . ' - - ' . get_lang('Answer') . ' - ' . get_lang('Comment') . '
    {error}
    {element}
    {error}
    {element}
    {error}
    {element}
    {error}
    {element}
    {error}
    {element}
    '); - - //$form -> addElement ('html', '
    '); - $form->add_multiple_required_rule($boxes_names, get_lang('ChooseAtLeastOneCheckbox'), 'multiple_required'); - - //only 1 answer the all deal ... - $form->addElement('text', 'weighting[1]', get_lang('Score')); - - global $pts; - //--------- Creation coche pour ne pas prendre en compte les n�gatifs - $form->addElement('checkbox', 'pts', '', get_lang('NoNegativeScore')); - $form->addElement('html', '
    '); - - // Affiche un message si le score n'est pas renseign� - $form->addRule('weighting[1]', get_lang('ThisFieldIsRequired'), 'required'); - - global $text, $class; - - if ($obj_ex->edit_exercise_in_lp == true) { - $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers'); - $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers'); - $form->addButtonSave($text, 'submitQuestion'); - // setting the save button here and not in the question class.php - } - - $renderer->setElementTemplate('{element} ', 'lessAnswers'); - $renderer->setElementTemplate('{element} ', 'submitQuestion'); - $renderer->setElementTemplate('{element}', 'moreAnswers'); - - $form->addElement('html', ''); - - $defaults['correct'] = $correct; - - if (!empty($this->id)) { - $form->setDefaults($defaults); - } else { - if ($this->isContent == 1) { - $form->setDefaults($defaults); - } - } - $form->setConstants(array('nb_answers' => $nb_answers)); - } - - /** - * abstract function which creates the form to create / edit the answers of the question - * @param FormValidator $form - */ - function processAnswersCreation($form) - { - $questionWeighting = $nbrGoodAnswers = 0; - $objAnswer = new Answer($this->id); - $nb_answers = $form->getSubmitValue('nb_answers'); - - // Score total - $answer_score = trim($form->getSubmitValue('weighting[1]')); - - // Reponses correctes - $nbr_corrects = 0; - for ($i = 1; $i <= $nb_answers; $i++) { - $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']')); - if ($goodAnswer) { - $nbr_corrects++; - } - } - // Set question weighting (score total) - $questionWeighting = $answer_score; - - // Set score per answer - $nbr_corrects = $nbr_corrects == 0 ? 1 : $nbr_corrects; - $answer_score = $nbr_corrects == 0 ? 0 : $answer_score; - - $answer_score = ($answer_score / $nbr_corrects); - - //$answer_score �quivaut � la valeur d'une bonne r�ponse - // cr�ation variable pour r�cuperer la valeur de la coche pour la prise en compte des n�gatifs - $test = $form->getSubmitValue('pts'); - - for ($i = 1; $i <= $nb_answers; $i++) { - $answer = trim($form->getSubmitValue('answer[' . $i . ']')); - $comment = trim($form->getSubmitValue('comment[' . $i . ']')); - $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']')); - - if ($goodAnswer) { - $weighting = abs($answer_score); - } else { - if ($test == 1) { - $weighting = 0; - } else { - $weighting = -abs($answer_score); - } - } - - $objAnswer->createAnswer($answer, $goodAnswer, $comment, $weighting, $i); - } - // saves the answers into the data base - $objAnswer->save(); - - // sets the total weighting of the question --> sert � donner le score total pendant l'examen - $this->updateWeighting($questionWeighting); - $this->save(); - } - - public function return_header( - $feedback_type = null, - $counter = null, - $score = null - ) { - $header = parent::return_header($feedback_type, $counter, $score); - $header .= ' - - - - '; - $header .= ''; - $header .= ''; - - return $header; - } -} +type = GLOBAL_MULTIPLE_ANSWER; + $this->isContent = $this->getIsContent(); + } + + /** + * function which redefines Question::createAnswersForm + * @param FormValidator $form + */ + public function createAnswersForm($form) + { + $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; + $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0)); + + $obj_ex = $_SESSION['objExercise']; + + /* Mise en variable de Affichage "Reponses" et son icone, "N�", "Vrai", "Reponse" */ + $html = '
    ' . get_lang("Choice") . '' . get_lang("ExpectedChoice") . '' . get_lang("Answer") . '' . get_lang("Comment") . '
    + + + + '; + + $html .=''; + $html .=''; + $form->addElement( + 'label', + get_lang('Answers') . + '
    '.Display::return_icon('fill_field.png'), + $html + ); + $defaults = array(); + $correct = 0; + $answer = false; + if (!empty($this->id)) { + $answer = new Answer($this->id); + $answer->read(); + if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) { + $nb_answers = $answer->nbrAnswers; + } + } + + #le nombre de r�ponses est bien enregistr� sous la forme int(nb) + + /* Ajout mise en forme nb reponse */ + $form->addElement('hidden', 'nb_answers'); + $boxes_names = array(); + + /* V�rification : Cr�action d'au moins une r�ponse */ + if ($nb_answers < 1) { + $nb_answers = 1; + Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer')); + } + + //D�but affichage score global dans la modification d'une question + $scoreA = "0"; //par reponse + $scoreG = "0"; //Global + + /* boucle pour sauvegarder les donn�es dans le tableau defaults */ + for ($i = 1; $i <= $nb_answers; ++$i) { + /* si la reponse est de type objet */ + if (is_object($answer)) { + $defaults['answer[' . $i . ']'] = $answer->answer[$i]; + $defaults['comment[' . $i . ']'] = $answer->comment[$i]; + $defaults['correct[' . $i . ']'] = $answer->correct[$i]; + + // start + $scoreA = $answer->weighting[$i]; + } + if ($scoreA > 0) { + $scoreG = $scoreG + $scoreA; + } + //------------- Fin + //------------- Debut si un des scores par reponse est egal � 0 : la coche vaut 1 (coch�) + if ($scoreA == 0) { + $defaults['pts'] = 1; + } + + $renderer = & $form->defaultRenderer(); + + $renderer->setElementTemplate('', 'correct['.$i.']'); + $renderer->setElementTemplate('', 'counter['.$i.']'); + $renderer->setElementTemplate('', 'answer['.$i.']'); + $renderer->setElementTemplate('', 'comment['.$i.']'); + //$renderer->setElementTemplate('', 'weighting['.$i.']'); + + $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); + $answer_number->freeze(); + + $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox"'); + $boxes_names[] = 'correct[' . $i . ']'; + + $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); + $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); + + $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); + + $form->addElement('html', ''); + } + //--------- Mise en variable du score global lors d'une modification de la question/r�ponse + $defaults['weighting[1]'] = (round($scoreG)); + + $form->addElement('html', '
    + ' . get_lang('Number') . ' + + ' . get_lang('True') . ' + + ' . get_lang('Answer') . ' + ' . get_lang('Comment') . '
    {error}
    {element}
    {error}
    {element}
    {error}
    {element}
    {error}
    {element}
    {error}
    {element}
    '); + + //$form -> addElement ('html', '
    '); + $form->add_multiple_required_rule($boxes_names, get_lang('ChooseAtLeastOneCheckbox'), 'multiple_required'); + + //only 1 answer the all deal ... + $form->addElement('text', 'weighting[1]', get_lang('Score')); + + global $pts; + //--------- Creation coche pour ne pas prendre en compte les n�gatifs + $form->addElement('checkbox', 'pts', '', get_lang('NoNegativeScore')); + $form->addElement('html', '
    '); + + // Affiche un message si le score n'est pas renseign� + $form->addRule('weighting[1]', get_lang('ThisFieldIsRequired'), 'required'); + + global $text, $class; + + if ($obj_ex->edit_exercise_in_lp == true) { + $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers'); + $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers'); + $form->addButtonSave($text, 'submitQuestion'); + // setting the save button here and not in the question class.php + } + + $renderer->setElementTemplate('{element} ', 'lessAnswers'); + $renderer->setElementTemplate('{element} ', 'submitQuestion'); + $renderer->setElementTemplate('{element}', 'moreAnswers'); + + $form->addElement('html', ''); + + $defaults['correct'] = $correct; + + if (!empty($this->id)) { + $form->setDefaults($defaults); + } else { + if ($this->isContent == 1) { + $form->setDefaults($defaults); + } + } + $form->setConstants(array('nb_answers' => $nb_answers)); + } + + /** + * abstract function which creates the form to create / edit the answers of the question + * @param FormValidator $form + */ + function processAnswersCreation($form) + { + $questionWeighting = $nbrGoodAnswers = 0; + $objAnswer = new Answer($this->id); + $nb_answers = $form->getSubmitValue('nb_answers'); + + // Score total + $answer_score = trim($form->getSubmitValue('weighting[1]')); + + // Reponses correctes + $nbr_corrects = 0; + for ($i = 1; $i <= $nb_answers; $i++) { + $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']')); + if ($goodAnswer) { + $nbr_corrects++; + } + } + // Set question weighting (score total) + $questionWeighting = $answer_score; + + // Set score per answer + $nbr_corrects = $nbr_corrects == 0 ? 1 : $nbr_corrects; + $answer_score = $nbr_corrects == 0 ? 0 : $answer_score; + + $answer_score = ($answer_score / $nbr_corrects); + + //$answer_score �quivaut � la valeur d'une bonne r�ponse + // cr�ation variable pour r�cuperer la valeur de la coche pour la prise en compte des n�gatifs + $test = $form->getSubmitValue('pts'); + + for ($i = 1; $i <= $nb_answers; $i++) { + $answer = trim($form->getSubmitValue('answer[' . $i . ']')); + $comment = trim($form->getSubmitValue('comment[' . $i . ']')); + $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']')); + + if ($goodAnswer) { + $weighting = abs($answer_score); + } else { + if ($test == 1) { + $weighting = 0; + } else { + $weighting = -abs($answer_score); + } + } + + $objAnswer->createAnswer($answer, $goodAnswer, $comment, $weighting, $i); + } + // saves the answers into the data base + $objAnswer->save(); + + // sets the total weighting of the question --> sert � donner le score total pendant l'examen + $this->updateWeighting($questionWeighting); + $this->save(); + } + + public function return_header( + $feedback_type = null, + $counter = null, + $score = null + ) { + $header = parent::return_header($feedback_type, $counter, $score); + $header .= ' + + + + '; + $header .= ''; + $header .= ''; + + return $header; + } +} diff --git a/main/exercice/hotpotatoes.lib.php b/main/exercise/hotpotatoes.lib.php similarity index 100% rename from main/exercice/hotpotatoes.lib.php rename to main/exercise/hotpotatoes.lib.php diff --git a/main/exercice/hotpotatoes.php b/main/exercise/hotpotatoes.php similarity index 99% rename from main/exercice/hotpotatoes.php rename to main/exercise/hotpotatoes.php index 242639f05c..d058a688cb 100755 --- a/main/exercice/hotpotatoes.php +++ b/main/exercise/hotpotatoes.php @@ -31,7 +31,7 @@ if (!empty($gradebook) && $gradebook == 'view') { } // The breadcrumbs. $interbreadcrumb[] = array( - 'url' => api_get_path(WEB_CODE_PATH) . '.exercice/exercise.php?' . api_get_cidreq(), + 'url' => api_get_path(WEB_CODE_PATH) . '.exercise/exercise.php?' . api_get_cidreq(), 'name' => get_lang('Exercises') ); diff --git a/main/exercice/hotpotatoes_exercise_report.php b/main/exercise/hotpotatoes_exercise_report.php similarity index 100% rename from main/exercice/hotpotatoes_exercise_report.php rename to main/exercise/hotpotatoes_exercise_report.php diff --git a/main/exercice/hotpotatoes_exercise_result.class.php b/main/exercise/hotpotatoes_exercise_result.class.php similarity index 100% rename from main/exercice/hotpotatoes_exercise_result.class.php rename to main/exercise/hotpotatoes_exercise_result.class.php diff --git a/main/exercice/hotspot.class.php b/main/exercise/hotspot.class.php similarity index 100% rename from main/exercice/hotspot.class.php rename to main/exercise/hotspot.class.php diff --git a/main/exercice/hotspot.inc.php b/main/exercise/hotspot.inc.php similarity index 100% rename from main/exercice/hotspot.inc.php rename to main/exercise/hotspot.inc.php diff --git a/main/exercice/hotspot_actionscript.as.php b/main/exercise/hotspot_actionscript.as.php similarity index 100% rename from main/exercice/hotspot_actionscript.as.php rename to main/exercise/hotspot_actionscript.as.php diff --git a/main/exercice/hotspot_actionscript_admin.as.php b/main/exercise/hotspot_actionscript_admin.as.php similarity index 100% rename from main/exercice/hotspot_actionscript_admin.as.php rename to main/exercise/hotspot_actionscript_admin.as.php diff --git a/main/exercice/hotspot_admin.inc.php b/main/exercise/hotspot_admin.inc.php similarity index 99% rename from main/exercice/hotspot_admin.inc.php rename to main/exercise/hotspot_admin.inc.php index 15092a80cc..f53d20b15d 100755 --- a/main/exercice/hotspot_admin.inc.php +++ b/main/exercise/hotspot_admin.inc.php @@ -64,7 +64,7 @@ if ($modifyIn) { unset($buttonBack); } -$hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&exerciseId=' . $exerciseId; +$hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercise/admin.php?' . api_get_cidreq() . '&exerciseId=' . $exerciseId; // the answer form has been submitted $submitAnswers = isset($_POST['submitAnswers']) ? true : false; @@ -572,7 +572,7 @@ if ($modifyAnswers) { Display::display_normal_message($msgErr); //main API } - $hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&hotspotadmin=' . $modifyAnswers . '&exerciseId=' . $exerciseId . '&' . api_get_cidreq(); + $hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercise/admin.php?' . api_get_cidreq() . '&hotspotadmin=' . $modifyAnswers . '&exerciseId=' . $exerciseId . '&' . api_get_cidreq(); ?>
    diff --git a/main/exercice/hotspot_answers.as.php b/main/exercise/hotspot_answers.as.php similarity index 100% rename from main/exercice/hotspot_answers.as.php rename to main/exercise/hotspot_answers.as.php diff --git a/main/exercice/hotspot_lang_conversion.php b/main/exercise/hotspot_lang_conversion.php similarity index 100% rename from main/exercice/hotspot_lang_conversion.php rename to main/exercise/hotspot_lang_conversion.php diff --git a/main/exercice/hotspot_save.inc.php b/main/exercise/hotspot_save.inc.php similarity index 100% rename from main/exercice/hotspot_save.inc.php rename to main/exercise/hotspot_save.inc.php diff --git a/main/exercice/hotspot_savescore.inc.php b/main/exercise/hotspot_savescore.inc.php similarity index 100% rename from main/exercice/hotspot_savescore.inc.php rename to main/exercise/hotspot_savescore.inc.php diff --git a/main/exercice/hotspot_updatescore.inc.php b/main/exercise/hotspot_updatescore.inc.php similarity index 100% rename from main/exercice/hotspot_updatescore.inc.php rename to main/exercise/hotspot_updatescore.inc.php diff --git a/main/exercice/index.html b/main/exercise/index.html similarity index 100% rename from main/exercice/index.html rename to main/exercise/index.html diff --git a/main/exercice/live_stats.php b/main/exercise/live_stats.php similarity index 100% rename from main/exercice/live_stats.php rename to main/exercise/live_stats.php diff --git a/main/exercice/matching.class.php b/main/exercise/matching.class.php similarity index 100% rename from main/exercice/matching.class.php rename to main/exercise/matching.class.php diff --git a/main/exercice/multiple_answer.class.php b/main/exercise/multiple_answer.class.php similarity index 100% rename from main/exercice/multiple_answer.class.php rename to main/exercise/multiple_answer.class.php diff --git a/main/exercice/multiple_answer_combination.class.php b/main/exercise/multiple_answer_combination.class.php similarity index 100% rename from main/exercice/multiple_answer_combination.class.php rename to main/exercise/multiple_answer_combination.class.php diff --git a/main/exercice/multiple_answer_combination_true_false.class.php b/main/exercise/multiple_answer_combination_true_false.class.php similarity index 100% rename from main/exercice/multiple_answer_combination_true_false.class.php rename to main/exercise/multiple_answer_combination_true_false.class.php diff --git a/main/exercice/multiple_answer_true_false.class.php b/main/exercise/multiple_answer_true_false.class.php similarity index 100% rename from main/exercice/multiple_answer_true_false.class.php rename to main/exercise/multiple_answer_true_false.class.php diff --git a/main/exercice/oral_expression.class.php b/main/exercise/oral_expression.class.php similarity index 100% rename from main/exercice/oral_expression.class.php rename to main/exercise/oral_expression.class.php diff --git a/main/exercice/overview.php b/main/exercise/overview.php similarity index 96% rename from main/exercice/overview.php rename to main/exercise/overview.php index d8c4c2e654..3e05fc6465 100755 --- a/main/exercice/overview.php +++ b/main/exercise/overview.php @@ -78,7 +78,7 @@ $edit_link = ''; if ($is_allowed_to_edit && $objExercise->sessionId == $sessionId) { $edit_link = Display::url( Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), - api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&exerciseId='.$objExercise->id + api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&exerciseId='.$objExercise->id ); } $iconExercise = Display::return_icon('test-quiz.png', null, array(), ICON_SIZE_MEDIUM); @@ -118,7 +118,7 @@ if (!empty($attempt_list)) { // 2. Exercise button // Notice we not add there the lp_item_view_id because is not already generated -$exercise_url = api_get_path(WEB_CODE_PATH).'exercice/exercise_submit.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&origin='.$origin.'&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.$extra_params; +$exercise_url = api_get_path(WEB_CODE_PATH) . 'exercise/exercise_submit.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&origin='.$origin.'&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.$extra_params; $exercise_url_button = Display::url( $label, $exercise_url, @@ -184,7 +184,7 @@ if (!empty($attempts)) { $attempt_result['exe_result'], $attempt_result['exe_weighting'] ); - $attempt_url = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?'; + $attempt_url = api_get_path(WEB_CODE_PATH) . 'exercise/result.php?'; $attempt_url .= api_get_cidreq() . '&show_headers=1&'; $attempt_url .= http_build_query([ 'id' => $attempt_result['exe_id'] diff --git a/main/exercice/qti2.php b/main/exercise/qti2.php similarity index 84% rename from main/exercice/qti2.php rename to main/exercise/qti2.php index cd95b7e26b..a34731d272 100755 --- a/main/exercice/qti2.php +++ b/main/exercise/qti2.php @@ -22,7 +22,7 @@ if (!api_is_allowed_to_edit(null, true)) { // the breadcrumbs $interbreadcrumb[]= array ( - "url" => api_get_path(WEB_CODE_PATH)."exercice/exercise.php?".api_get_cidreq(), + "url" => api_get_path(WEB_CODE_PATH) . "exercise/exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises') ); $is_allowedToEdit = api_is_allowed_to_edit(null, true); @@ -34,7 +34,7 @@ function ch_qti2_display_form() { $name_tools = get_lang('ImportQtiQuiz'); $form = ''; $formValidator = new FormValidator( @@ -67,8 +67,8 @@ function ch_qti2_import_file($array_file) if ($process && $unzip == 1) { $main_path = api_get_path(SYS_CODE_PATH); - require_once $main_path.'exercice/export/exercise_import.inc.php'; - require_once $main_path.'exercice/export/qti2/qti2_classes.php'; + require_once $main_path.'exercise/export/exercise_import.inc.php'; + require_once $main_path.'exercise/export/qti2/qti2_classes.php'; return import_exercise($array_file['name']); } @@ -84,7 +84,7 @@ if ((api_is_allowed_to_edit(null, true))) { $imported = ch_qti2_import_file($_FILES['userFile']); if (is_numeric($imported) && !empty($imported)) { - header('Location: '.api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&exerciseId='.$imported); + header('Location: '.api_get_path(WEB_CODE_PATH) . 'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$imported); exit; } else { $message = Display::return_message(get_lang($imported)); diff --git a/main/exercice/question.class.php b/main/exercise/question.class.php similarity index 99% rename from main/exercice/question.class.php rename to main/exercise/question.class.php index 82c93746bc..486c7dd7eb 100755 --- a/main/exercice/question.class.php +++ b/main/exercise/question.class.php @@ -1362,7 +1362,7 @@ abstract class Question public function get_question_type_name() { $key = self::$questionTypes[$this->type]; - + return get_lang($key[1]); } @@ -1615,14 +1615,20 @@ abstract class Question eval('$explanation = get_lang(' . $a_type[1] . '::$explanationLangVar);'); echo '
  • '; echo '
    '; - if ($objExercise->exercise_was_added_in_lp == true) { - $img = pathinfo($img); - $img = $img['filename'] . '_na.' . $img['extension']; - echo Display::return_icon($img, $explanation, null, ICON_SIZE_BIG); - } else { - echo '' . + + + $icon = '' . Display::return_icon($img, $explanation, null, ICON_SIZE_BIG) . ''; + + if ($objExercise->force_edit_exercise_in_lp === false) { + if ($objExercise->exercise_was_added_in_lp == true) { + $img = pathinfo($img); + $img = $img['filename'].'_na.'.$img['extension']; + $icon = Display::return_icon($img, $explanation, null, ICON_SIZE_BIG); + } } + + echo $icon; echo '
    '; echo '
  • '; } diff --git a/main/exercice/question_admin.inc.php b/main/exercise/question_admin.inc.php similarity index 100% rename from main/exercice/question_admin.inc.php rename to main/exercise/question_admin.inc.php diff --git a/main/exercice/question_create.php b/main/exercise/question_create.php similarity index 100% rename from main/exercice/question_create.php rename to main/exercise/question_create.php diff --git a/main/exercice/question_list_admin.inc.php b/main/exercise/question_list_admin.inc.php similarity index 100% rename from main/exercice/question_list_admin.inc.php rename to main/exercise/question_list_admin.inc.php diff --git a/main/exercice/question_pool.php b/main/exercise/question_pool.php similarity index 100% rename from main/exercice/question_pool.php rename to main/exercise/question_pool.php diff --git a/main/exercice/quiz_template.xls b/main/exercise/quiz_template.xls similarity index 100% rename from main/exercice/quiz_template.xls rename to main/exercise/quiz_template.xls diff --git a/main/exercice/result.php b/main/exercise/result.php similarity index 100% rename from main/exercice/result.php rename to main/exercise/result.php diff --git a/main/exercice/savescores.php b/main/exercise/savescores.php similarity index 100% rename from main/exercice/savescores.php rename to main/exercise/savescores.php diff --git a/main/exercice/showinframes.php b/main/exercise/showinframes.php similarity index 82% rename from main/exercice/showinframes.php rename to main/exercise/showinframes.php index 0f6e2df9bb..7e80be4b7d 100755 --- a/main/exercice/showinframes.php +++ b/main/exercise/showinframes.php @@ -8,7 +8,7 @@ */ require_once '../inc/global.inc.php'; -require_once api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php'; +require_once api_get_path(SYS_CODE_PATH).'exercise/hotpotatoes.lib.php'; $_course = api_get_course_info(); $time = time(); @@ -38,9 +38,9 @@ if ($content == '') { if (SaveScoreVariable==0) { SaveScoreVariable = 1; if (C.ie) { - document.location.href = '".api_get_path(WEB_PATH)."main/exercice/savescores.php?lp_view_id=$lpViewId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&time=".Security::remove_XSS($time)."&test=".$doc_url."&uid=".$user_id."&cid=".$cid."&score='+Score; + document.location.href = '" . api_get_path(WEB_CODE_PATH) . "exercise/savescores.php?lp_view_id=$lpViewId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&time=".Security::remove_XSS($time)."&test=".$doc_url."&uid=".$user_id."&cid=".$cid."&score='+Score; } else { - window.location.href = '".api_get_path(WEB_PATH)."main/exercice/savescores.php?lp_view_id=$lpViewId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&time=".Security::remove_XSS($time)."&test=".$doc_url."&uid=".$user_id."&cid=".$cid."&score='+Score; + window.location.href = '" . api_get_path(WEB_CODE_PATH) . "exercise/savescores.php?lp_view_id=$lpViewId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&time=".Security::remove_XSS($time)."&test=".$doc_url."&uid=".$user_id."&cid=".$cid."&score='+Score; } } } diff --git a/main/exercice/stats.php b/main/exercise/stats.php similarity index 100% rename from main/exercice/stats.php rename to main/exercise/stats.php diff --git a/main/exercice/tests_category.php b/main/exercise/tests_category.php similarity index 100% rename from main/exercice/tests_category.php rename to main/exercise/tests_category.php diff --git a/main/exercice/unique_answer.class.php b/main/exercise/unique_answer.class.php similarity index 100% rename from main/exercice/unique_answer.class.php rename to main/exercise/unique_answer.class.php diff --git a/main/exercice/unique_answer_no_option.class.php b/main/exercise/unique_answer_no_option.class.php similarity index 100% rename from main/exercice/unique_answer_no_option.class.php rename to main/exercise/unique_answer_no_option.class.php diff --git a/main/exercice/upload_exercise.php b/main/exercise/upload_exercise.php similarity index 98% rename from main/exercice/upload_exercise.php rename to main/exercise/upload_exercise.php index aac9a6d76e..7b1b397f85 100755 --- a/main/exercice/upload_exercise.php +++ b/main/exercise/upload_exercise.php @@ -85,7 +85,7 @@ function lp_upload_quiz_main() { $form->addElement('header', get_lang('ImportExcelQuiz')); $form->addElement('file', 'user_upload_quiz', get_lang('FileUpload')); - $link = ''. + $link = ''. Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate')).get_lang('DownloadExcelTemplate').''; $form->addElement('label', '', $link); @@ -618,11 +618,11 @@ function lp_upload_quiz_action_handling() { // Add a Quiz as Lp Item $_SESSION['oLP']->add_item($parent, $previous, TOOL_QUIZ, $quiz_id, $quiz_title, ''); // Redirect to home page for add more content - header('location: ../newscorm/lp_controller.php?'.api_get_cidreq().'&action=add_item&type=step&lp_id='.Security::remove_XSS($_GET['lp_id'])); + header('location: ../lp/lp_controller.php?'.api_get_cidreq().'&action=add_item&type=step&lp_id='.Security::remove_XSS($_GET['lp_id'])); exit; } else { - // header('location: exercice.php?' . api_get_cidreq()); - echo ''; + // header('location: exercise.php?' . api_get_cidreq()); + echo ''; } } } diff --git a/main/extrafield/translate.php b/main/extrafield/translate.php new file mode 100644 index 0000000000..4abddddf52 --- /dev/null +++ b/main/extrafield/translate.php @@ -0,0 +1,101 @@ +find('ChamiloCoreBundle:ExtraField', intval($_GET['extra_field'])); + $variableLanguage = '$' . api_underscore_to_camel_case($extraField->getVariable()); + $originalName = $extraField->getDisplayText(false); +} elseif (isset($_GET['extra_field_option'])) { + $extraFieldOption = $em->find('ChamiloCoreBundle:ExtraFieldOptions', intval($_GET['extra_field_option'])); + $extraField = $extraFieldOption->getField(); + $variableLanguage = '$' . ExtraFieldOption::getLanguageVariable($extraFieldOption->getDisplayText()); + $originalName = $extraFieldOption->getDisplayText(false); +} + +if (!$extraField || empty($variableLanguage) || empty($originalName)) { + api_not_allowed(true); +} + +$languageId = isset($_GET['sub_language']) ? intval($_GET['sub_language']) : 0; + +$languages = $em + ->getRepository('ChamiloCoreBundle:Language') + ->findAllPlatformSubLanguages(); + +$languagesOptions = [0 => get_lang('None')]; + +foreach ($languages as $language) { + $languagesOptions[$language->getId()] = $language->getOriginalName(); +} + +$translateUrl = api_get_path(WEB_CODE_PATH) . 'admin/sub_language_ajax.inc.php'; + +$form = new FormValidator('new_lang_variable', 'POST', $translateUrl); +$form->addHeader(get_lang('AddWordForTheSubLanguage')); +$form->addText('variable_language', get_lang('LanguageVariable'), false); +$form->addText('original_name', get_lang('OriginalName'), false); +$form->addSelect('sub_language', [get_lang('SubLanguage'), get_lang('OnlyActiveSubLanguagesAreListed')], $languagesOptions); + +if ($languageId) { + $languageInfo = api_get_language_info($languageId); + + $form->addText('new_language', [get_lang('Translation'), get_lang('IfThisTranslationExistsThisWillReplaceTheTerm')]); + $form->addHidden('file_id', 0); + $form->addHidden('id', $languageInfo['parent_id']); + $form->addHidden('sub', $languageInfo['id']); + $form->addHidden('sub_language_id', $languageInfo['id']); + $form->addHidden('redirect', true); + $form->addHidden('extra_field_type', $extraField->getExtraFieldType()); + $form->addButtonSave(get_lang('Save')); +} + +$form->setDefaults([ + 'variable_language' => $variableLanguage, + 'original_name' => $originalName, + 'sub_language' => $languageId +]); +$form->addRule('sub_language', get_lang('Required'), 'required'); +$form->freeze(['variable_language', 'original_name']); + +$interbreadcrumb[] = ['url' => api_get_path(WEB_CODE_PATH) . 'admin', 'name' => get_lang('Administration')]; + +switch ($extraField->getExtraFieldType()) { + case \Chamilo\CoreBundle\Entity\ExtraField::USER_FIELD_TYPE: + $interbreadcrumb[] = [ + 'url' => api_get_path(WEB_CODE_PATH) . 'admin/extra_fields.php?type=user', + 'name' => get_lang('UserFields') + ]; + break; + case \Chamilo\CoreBundle\Entity\ExtraField::COURSE_FIELD_TYPE: + $interbreadcrumb[] = [ + 'url' => api_get_path(WEB_CODE_PATH) . 'admin/extra_fields.php?type=course', + 'name' => get_lang('CourseFields') + ]; + break; + case \Chamilo\CoreBundle\Entity\ExtraField::SESSION_FIELD_TYPE: + $interbreadcrumb[] = [ + 'url' => api_get_path(WEB_CODE_PATH) . 'admin/extra_fields.php?type=session', + 'name' => get_lang('SessionFields') + ]; + break; +} + +$view = new Template(get_lang('AddWordForTheSubLanguage')); +$view->assign('form', $form->returnForm()); +$template = $view->get_template('extrafield/translate.tpl'); +$content = $view->fetch($template); +$view->assign('content', $content); +$view->display_one_col_template(); diff --git a/main/forum/editpost.php b/main/forum/editpost.php index ff272e06e2..2ebac7625a 100755 --- a/main/forum/editpost.php +++ b/main/forum/editpost.php @@ -21,7 +21,7 @@ * * @package chamilo.forum */ -// Including the global initialization file. + require_once '../inc/global.inc.php'; // The section (tabs). diff --git a/main/forum/forumfunction.inc.php b/main/forum/forumfunction.inc.php index a1e0094f77..44dbaf125a 100755 --- a/main/forum/forumfunction.inc.php +++ b/main/forum/forumfunction.inc.php @@ -136,7 +136,7 @@ function handle_forum_and_forumcategories($lp_id = null) for ($i = 0; $i < count($list_threads); $i++) { deleteForumCategoryThread('thread', $list_threads[$i]['thread_id']); - $link_info = GradebookUtils::is_resource_in_course_gradebook( + $link_info = GradebookUtils::isResourceInCourseGradebook( api_get_course_id(), 5, intval($list_threads[$i]['thread_id']), @@ -718,8 +718,8 @@ function store_forum($values, $courseInfo = array(), $returnId = false) 'forum_of_group'=> isset($values['group_forum']) ? $values['group_forum'] : null, 'forum_group_public_private'=> isset($values['public_private_group_forum_group']['public_private_group_forum']) ? $values['public_private_group_forum_group']['public_private_group_forum'] : null, 'moderated'=> isset($values['moderated']['moderated']) ? 1 : 0, - 'start_time' => isset($values['start_time']) ? api_get_utc_datetime($values['start_time']) : null, - 'end_time' => isset($values['end_time']) ? api_get_utc_datetime($values['end_time']) : null, + 'start_time' => !empty($values['start_time']) ? api_get_utc_datetime($values['start_time']) : null, + 'end_time' => !empty($values['end_time']) ? api_get_utc_datetime($values['end_time']) : null, 'forum_order'=> isset($new_max) ? $new_max : null, 'session_id'=> $session_id, 'lp_id' => isset($values['lp_id']) ? intval($values['lp_id']) : 0 @@ -761,8 +761,8 @@ function store_forum($values, $courseInfo = array(), $returnId = false) 'forum_of_group'=> isset($values['group_forum']) ? $values['group_forum'] : null, 'forum_group_public_private'=> isset($values['public_private_group_forum_group']['public_private_group_forum']) ? $values['public_private_group_forum_group']['public_private_group_forum'] : null, 'moderated'=> isset($values['moderated']['moderated']) ? 1 : 0, - 'start_time' => isset($values['start_time']) ? api_get_utc_datetime($values['start_time']) : null, - 'end_time' => isset($values['end_time']) ? api_get_utc_datetime($values['end_time']) : null, + 'start_time' => !empty($values['start_time']) ? api_get_utc_datetime($values['start_time']) : null, + 'end_time' => !empty($values['end_time']) ? api_get_utc_datetime($values['end_time']) : null, 'forum_order'=> isset($new_max) ? $new_max : null, 'session_id'=> $session_id, 'lp_id' => isset($values['lp_id']) ? intval($values['lp_id']) : 0, @@ -1930,7 +1930,7 @@ function getPosts($forumInfo, $threadId, $orderDirection = 'ASC', $recursive = f ->andWhere($visibleCriteria) ; - if (!api_is_allowed_to_edit()) { + if (! (api_is_allowed_to_edit() || GroupManager::is_tutor_of_group(api_get_user_id(), api_get_group_id()))) { if ($forumInfo['moderated']) { $criteria->where(Criteria::expr()->eq('status', 1)); } @@ -2366,7 +2366,7 @@ function updateThread($values) $sessionId = api_get_session_id(); $courseId = api_get_course_id(); - $linkInfo = GradebookUtils::is_resource_in_course_gradebook( + $linkInfo = GradebookUtils::isResourceInCourseGradebook( $courseId, LINK_FORUM_THREAD, $id, @@ -2636,7 +2636,7 @@ function store_thread($current_forum, $values, $courseInfo = array(), $showMessa Session::erase('breadcrumbs'); Session::erase('addedresource'); Session::erase('addedresourceid'); - + if ($showMessage) { Display::addFlash(Display::return_message($message, 'success', false)); } @@ -3520,7 +3520,12 @@ function show_edit_post_form( $form->addElement('label', ''.get_lang('AlterQualifyThread').''); $form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'), 'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"'); - $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 5, $_GET['thread'], api_get_session_id()); + $link_info = GradebookUtils::isResourceInCourseGradebook( + api_get_course_id(), + 5, + $_GET['thread'], + api_get_session_id() + ); if (!empty($link_info)) { $defaults['thread_qualify_gradebook'] = true; $defaults['category_id'] = $link_info['category_id']; diff --git a/main/forum/index.php b/main/forum/index.php index d173fee568..322eb226e9 100755 --- a/main/forum/index.php +++ b/main/forum/index.php @@ -180,7 +180,7 @@ echo '
    '; //if is called from learning path if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) { - echo "" . Display::return_icon( diff --git a/main/forum/viewforum.php b/main/forum/viewforum.php index dad2b115ff..bbfa27367a 100755 --- a/main/forum/viewforum.php +++ b/main/forum/viewforum.php @@ -193,7 +193,7 @@ if ( $message = deleteForumCategoryThread($_GET['content'], $_GET['id']); // Delete link - $link_info = GradebookUtils::is_resource_in_course_gradebook( + $link_info = GradebookUtils::isResourceInCourseGradebook( api_get_course_id(), 5, intval($_GET['id']), diff --git a/main/forum/viewthread_flat.inc.php b/main/forum/viewthread_flat.inc.php index aa52ed4a16..33602855c4 100755 --- a/main/forum/viewthread_flat.inc.php +++ b/main/forum/viewthread_flat.inc.php @@ -44,8 +44,7 @@ if (isset($current_thread['thread_id'])) { if (!empty($rows)) { $postCount = count($rows); - //$postCount = 1; - + foreach ($rows as $row) { if ($row['user_id'] == '0') { $name = prepare4display($row['poster_name']); @@ -90,7 +89,6 @@ if (isset($current_thread['thread_id'])) { } } } else { - if (($current_forum_category && $current_forum_category['locked'] == 1)) { $closedPost = Display::tag( 'div', @@ -163,11 +161,13 @@ if (isset($current_thread['thread_id'])) { $attachment_list = get_attachment($row['post_id']); $id_attach = !empty($attachment_list) ? $attachment_list['iid'] : ''; $iconEdit = ''; + $statusIcon = ''; + + // The user who posted it can edit his thread only if the course admin allowed // this in the properties of the forum // The course admin him/herself can do this off course always - if ( - GroupManager::is_tutor_of_group($userId, $groupId) || + if (GroupManager::is_tutor_of_group($userId, $groupId) || ($current_forum['allow_edit'] == 1 && $row['user_id'] == $_user['user_id']) || ( api_is_allowed_to_edit(false, true) && @@ -189,8 +189,7 @@ if (isset($current_thread['thread_id'])) { api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId) ) { - - if ($locked == false) { + if ($locked === false) { $deleteUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ 'forum' => $clean_forum_id, 'thread' => $clean_thread_id, @@ -210,9 +209,12 @@ if (isset($current_thread['thread_id'])) { ); } } + if ( - api_is_allowed_to_edit(false, true) && - !(api_is_course_coach() && $current_forum['session_id'] != $sessionId) + GroupManager::is_tutor_of_group($userId, $groupId) || + (api_is_allowed_to_edit(false, true) && + !(api_is_course_coach() && $current_forum['session_id'] != $sessionId) + ) ) { $statusIcon = getPostStatus($current_forum, $row); $iconEdit .= return_visible_invisible_icon( @@ -222,10 +224,10 @@ if (isset($current_thread['thread_id'])) { array( 'forum' => $clean_forum_id, 'thread' => $clean_thread_id, - 'origin' => $origin, + 'origin' => $origin ) ); - $iconEdit .= ""; + if ($increment > 0) { $iconEdit .= " 0 && $origin != 'learnpath' ) { $my_forum_id = $clean_forum_id; @@ -267,12 +265,8 @@ if (isset($current_thread['thread_id'])) { if ($iconEdit != '') { $html .= '
    ' . $iconEdit . $statusIcon.'
    '; } - - - $html .= $closedPost; $html .= '
    '; - $html .= '
    '; $titlePost = Display::tag( @@ -288,7 +282,6 @@ if (isset($current_thread['thread_id'])) { ); // see comments inside forumfunction.inc.php to lower filtering and allow more visual changes - $html .= Display::tag( 'div', $row['post_text'], @@ -301,10 +294,7 @@ if (isset($current_thread['thread_id'])) { $html .= '
    '; // prepare the notification icon - if ( - isset( - $whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']] - ) && + if (isset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]) && !empty( $whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']] ) && diff --git a/main/gamification/my_progress.php b/main/gamification/my_progress.php index 5493b00589..db5c8cdff9 100644 --- a/main/gamification/my_progress.php +++ b/main/gamification/my_progress.php @@ -116,7 +116,7 @@ if ($currentSession) { foreach ($learningPathList->list as $learningPathId => $learningPath) { $courseData['stats'][] = [ $learningPath['lp_name'], - 'newscorm/lp_controller.php?' . http_build_query([ + 'lp/lp_controller.php?' . http_build_query([ 'action' => 'stats', 'cidReq' => $course->getCode(), 'id_session' => $currentSession->getId(), diff --git a/main/glossary/glossary_ajax_request.php b/main/glossary/glossary_ajax_request.php index 3c66bef06a..059f604221 100644 --- a/main/glossary/glossary_ajax_request.php +++ b/main/glossary/glossary_ajax_request.php @@ -46,14 +46,14 @@ if (isset($_POST['glossary_id']) && $my_glossary_name = api_convert_encoding($my_glossary_name, $charset, 'UTF-8'); $my_glossary_name = trim($my_glossary_name); - $glossary_description = GlossaryManager::get_glossary_term_by_glossary_name( + $glossaryInfo = GlossaryManager::get_glossary_term_by_glossary_name( $my_glossary_name ); - + $glossary_description = str_replace( $path_image_search, $path_image, - $glossary_description + $glossaryInfo['description'] ); if (is_null($glossary_description) || strlen(trim($glossary_description)) == 0) { diff --git a/main/glossary/index.php b/main/glossary/index.php index bba49123af..3e8a51690e 100755 --- a/main/glossary/index.php +++ b/main/glossary/index.php @@ -1,6 +1,8 @@ '; -// setting the tool constants -$tool = TOOL_GLOSSARY; // Tracking Event::event_access_tool(TOOL_GLOSSARY); function sorter($item1, $item2) { - if ($item1[2] == $item2[2]) - return 0; - return $item1[2] < $item2[2] ? -1 : 1; + if ($item1[2] == $item2[2]) { + return 0; + } + + return $item1[2] < $item2[2] ? -1 : 1; } // Displaying the header -$action = isset($_GET['action']) ? $_GET['action'] : null; - -$tool = 'GlossaryManagement'; +$action = isset($_GET['action']) ? $_GET['action'] : ''; +$currentUrl = api_get_self().'?'.api_get_cidreq(); +$interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq(), 'name' => get_lang('Glossary')); -$interbreadcrumb[] = array ("url"=>"index.php", "name"=> get_lang('Glossary')); - -if (!empty($action)) { - -} +$content = ''; +$tool_name = ''; switch ($action) { case 'addglossary': + if (!api_is_allowed_to_edit(null, true)) { + api_not_allowed(true); + } $tool_name = get_lang('Add'); + $form = new FormValidator( + 'glossary', + 'post', + api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&'.api_get_cidreq() + ); + // Setting the form elements + $form->addElement('header', get_lang('TermAddNew')); + $form->addElement( + 'text', + 'name', + get_lang('TermName'), + array('id' => 'glossary_title') + ); + + $form->addElement( + 'html_editor', + 'description', + get_lang('TermDefinition'), + null, + array('ToolbarSet' => 'Glossary', 'Height' => '300') + ); + $form->addButtonCreate(get_lang('TermAddButton'), 'SubmitGlossary'); + // setting the rules + $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); + // The validation or display + if ($form->validate()) { + $check = Security::check_token('post'); + if ($check) { + $values = $form->exportValues(); + GlossaryManager::save_glossary($values); + } + Security::clear_token(); + header('Location: '.$currentUrl); + exit; + } else { + $token = Security::get_token(); + $form->addElement('hidden', 'sec_token'); + $form->setConstants(array('sec_token' => $token)); + $content = $form->returnForm(); + } break; case 'edit_glossary': - $tool_name = get_lang('Edit'); - break; - case 'import': - $tool_name = get_lang('ImportGlossary'); - break; - case 'changeview': - default: - $tool_name = get_lang('List'); - break; -} + if (!api_is_allowed_to_edit(null, true)) { + api_not_allowed(true); + } + $tool_name = get_lang('Edit'); + if (is_numeric($_GET['glossary_id'])) { + // initiate the object + $form = new FormValidator( + 'glossary', + 'post', + api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&glossary_id='.intval($_GET['glossary_id']).'&'.api_get_cidreq() + ); + // Setting the form elements + $form->addElement('header', get_lang('TermEdit')); + $form->addElement('hidden', 'glossary_id'); + $form->addElement('text', 'name', get_lang('TermName')); + + $form->addElement( + 'html_editor', + 'description', + get_lang('TermDefinition'), + null, + array('ToolbarSet' => 'Glossary', 'Height' => '300') + ); -if (isset($_GET['action']) && $_GET['action'] == 'export') { - $data = GlossaryManager::get_glossary_data( - 0, - GlossaryManager::get_number_glossary_terms(api_get_session_id()), - 0, - 'ASC' - ); - - usort($data, "sorter"); - $list = array(); - $list[] = array('term','definition'); - foreach($data as $line) { - $list[] = array ($line[0], $line[1]); - } - $filename = 'glossary_course_'.api_get_course_id(); - Export::arrayToCsv($list, $filename); -} -if (isset($_GET['action']) && $_GET['action'] == 'export_to_pdf') { - GlossaryManager::export_to_pdf(); -} + // setting the defaults + $glossary_data = GlossaryManager::get_glossary_information($_GET['glossary_id']); -Display::display_header($tool_name); + // Date treatment for timezones + if (!empty($glossary_data['insert_date'])) { + $glossary_data['insert_date'] = Display::tip( + date_to_str_ago($glossary_data['insert_date']), + api_get_local_time($glossary_data['insert_date']) + ); + } else { + $glossary_data['insert_date'] = ''; + } -// Tool introduction -Display::display_introduction_section(TOOL_GLOSSARY); + if (!empty($glossary_data['update_date'])) { + $glossary_data['update_date'] = Display::tip( + date_to_str_ago($glossary_data['update_date']), + api_get_local_time($glossary_data['update_date']) + ); + } else { + $glossary_data['update_date'] = ''; + } -if (isset($_GET['action']) && $_GET['action'] == 'changeview' && in_array($_GET['view'], array('list','table'))) { - $_SESSION['glossary_view'] = $_GET['view']; -} else { - if (!isset($_SESSION['glossary_view'])) { - $_SESSION['glossary_view'] = 'table';//Default option - } -} + $form->addLabel(get_lang('CreationDate'), $glossary_data['insert_date']); + $form->addLabel(get_lang('UpdateDate'), $glossary_data['update_date']); -if (api_is_allowed_to_edit(null, true)) { + $form->addButtonUpdate(get_lang('TermUpdateButton'), 'SubmitGlossary'); + $form->setDefaults($glossary_data); - switch ($action) { - case 'addglossary': - $form = new FormValidator( - 'glossary', - 'post', - api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&'.api_get_cidreq() - ); - // Setting the form elements - $form->addElement('header', '', get_lang('TermAddNew')); - $form->addElement('text', 'glossary_title', get_lang('TermName'), array('size'=>'80', 'id'=>'glossary_title')); - //$form->applyFilter('glossary_title', 'html_filter'); - $form->addElement('html_editor', 'glossary_comment', get_lang('TermDefinition'), null, array('ToolbarSet' => 'Glossary', 'Height' => '300')); - $form->addButtonCreate(get_lang('TermAddButton'), 'SubmitGlossary'); // setting the rules - $form->addRule('glossary_title', get_lang('ThisFieldIsRequired'), 'required'); + $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); + // The validation or display if ($form->validate()) { $check = Security::check_token('post'); if ($check) { $values = $form->exportValues(); - GlossaryManager::save_glossary($values); + GlossaryManager::update_glossary($values); } Security::clear_token(); - GlossaryManager::display_glossary(); + header('Location: '.$currentUrl); + exit; } else { $token = Security::get_token(); $form->addElement('hidden', 'sec_token'); $form->setConstants(array('sec_token' => $token)); - $form->display(); + $content = $form->returnForm(); } - break; - case 'edit_glossary': - if (is_numeric($_GET['glossary_id'])) { - // initiate the object - $form = new FormValidator( - 'glossary', - 'post', - api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&glossary_id='.intval($_GET['glossary_id']).'&'.api_get_cidreq() - ); - // Setting the form elements - $form->addElement('header', '', get_lang('TermEdit')); - $form->addElement('hidden', 'glossary_id'); - $form->addElement('text', 'glossary_title', get_lang('TermName'),array('size'=>'80')); - //$form->applyFilter('glossary_title', 'html_filter'); - $form->addElement('html_editor', 'glossary_comment', get_lang('TermDefinition'), null, array('ToolbarSet' => 'Glossary', 'Height' => '300')); - $element = $form->addElement('text', 'insert_date', get_lang('CreationDate'),array('size'=>'100')); - $element->freeze(); - $element = $form->addElement('text', 'update_date', get_lang('UpdateDate'),array('size'=>'100')); - $element->freeze(); - $form->addButtonUpdate(get_lang('TermUpdateButton'), 'SubmitGlossary'); - - // setting the defaults - $glossary_data = GlossaryManager::get_glossary_information($_GET['glossary_id']); - - // Date treatment for timezones - if (!empty($glossary_data['insert_date'])) { - $glossary_data['insert_date'] = api_get_local_time($glossary_data['insert_date']); - } else { - $glossary_data['insert_date'] = ''; + } + break; + case 'delete_glossary': + if (!api_is_allowed_to_edit(null, true)) { + api_not_allowed(true); + } + GlossaryManager::delete_glossary($_GET['glossary_id']); + Security::clear_token(); + header('Location: '.$currentUrl); + exit; + break; + case 'moveup': + //GlossaryManager::move_glossary('up',$_GET['glossary_id']); //actions not available + GlossaryManager::display_glossary(); + break; + case 'movedown': + //GlossaryManager::move_glossary('down',$_GET['glossary_id']); //actions not available + GlossaryManager::display_glossary(); + break; + case 'import': + if (!api_is_allowed_to_edit(null, true)) { + api_not_allowed(true); + } + $tool_name = get_lang('ImportGlossary'); + $form = new FormValidator( + 'glossary', + 'post', + api_get_self().'?action=import&'.api_get_cidreq() + ); + $form->addElement('header', '', get_lang('ImportGlossary')); + $form->addElement('file', 'file', get_lang('ImportCSVFileLocation')); + + $form->addElement('checkbox', 'replace', null, get_lang('DeleteAllGlossaryTerms')); + $form->addElement('checkbox', 'update', null, get_lang('UpdateExistingGlossaryTerms')); + + $form->addButtonImport(get_lang('Import'), 'SubmitImport'); + $content = $form->returnForm(); + + $content .= get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; + $content .= '
    +                term;definition;
    +                "Hello";"Hola";
    +                "Goodbye";"Adiós";
    +        
    '; + + if ($form->validate()) { + $termsDeleted = []; + + //this is a bad idea //jm + if (isset($_POST['replace']) && $_POST['replace']) { + foreach (GlossaryManager::get_glossary_terms() as $term) { + if (!GlossaryManager::delete_glossary($term['id'], false)) { + Display::addFlash( + Display::return_message(get_lang("CannotDeleteGlossary") . ':' . $term['id'], 'error') + ); + } else { + $termsDeleted[] = $term['name']; + } } + } - if (!empty($glossary_data['update_date'])) { - $glossary_data['update_date'] = api_get_local_time($glossary_data['update_date']); - } else { - $glossary_data['update_date'] = ''; - } + $updateTerms = isset($_POST['update']) && $_POST['update'] ? true : false; - $form->setDefaults($glossary_data); + $data = Import::csv_reader($_FILES['file']['tmp_name']); + $goodList = []; + $updatedList = []; + $addedList = []; + $badList = []; + $doubles = []; + $added = []; + $termsPerKey = []; - // setting the rules - $form->addRule('glossary_title', get_lang('ThisFieldIsRequired'), 'required'); + if ($data) { + $termsToAdd = []; + foreach ($data as $item) { + $items = [ + 'name' => $item['term'], + 'description' => $item['definition'] + ]; + $termsToAdd[] = $items; + $termsPerKey[$item['term']] = $items; + } - // The validation or display - if ($form->validate()) { - $check = Security::check_token('post'); - if ($check) { - $values = $form->exportValues(); - GlossaryManager::update_glossary($values); + if (empty($termsToAdd)) { + Display::addFlash( + Display::return_message(get_lang('NothingToAdd'), 'warning') + ); + header('Location: '.$currentUrl); + exit; + } + + $repeatItems = array_count_values(array_column($termsToAdd, 'name')); + foreach ($repeatItems as $item => $count) { + if ($count > 1) { + $doubles[] = $item; } - Security::clear_token(); - GlossaryManager::display_glossary(); - } else { - $token = Security::get_token(); - $form->addElement('hidden', 'sec_token'); - $form->setConstants(array('sec_token' => $token)); - $form->display(); } - } - break; - case 'delete_glossary': - GlossaryManager::delete_glossary($_GET['glossary_id']); - GlossaryManager::display_glossary(); - break; - case 'moveup': - //GlossaryManager::move_glossary('up',$_GET['glossary_id']); //actions not available - GlossaryManager::display_glossary(); - break; - case 'movedown': - //GlossaryManager::move_glossary('down',$_GET['glossary_id']); //actions not available - GlossaryManager::display_glossary(); - break; - case 'import': - $form = new FormValidator( - 'glossary', - 'post', - api_get_self().'?action=import&'.api_get_cidreq() - ); - $form->addElement('header', '', get_lang('ImportGlossary')); - $form->addElement('file', 'file', get_lang('ImportCSVFileLocation')); - $form->addElement('checkbox', 'replace', null, get_lang('DeleteAllGlossaryTerms')); - $form->addButtonImport(get_lang('Import'), 'SubmitImport'); - $form->display(); - - echo get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; - echo '
    -                    term;definition;
    -                    "Hello";"Hola";
    -                    "Good";"Bueno";
    '; - if ($form->validate()) { - //this is a bad idea //jm - if (isset($_POST['replace']) && $_POST['replace']) { - foreach (GlossaryManager::get_glossary_terms() as $term) { - if (!GlossaryManager::delete_glossary($term['id'], false)) { - Display::display_error_message(get_lang ("CannotDeleteGlossary") . ':' . $term['id']); + $uniqueTerms = array_unique(array_keys($repeatItems)); + + foreach ($uniqueTerms as $itemTerm) { + $item = $termsPerKey[$itemTerm]; + + if ($updateTerms) { + $glossaryInfo = GlossaryManager::get_glossary_term_by_glossary_name($item['name']); + + if (!empty($glossaryInfo)) { + $glossaryInfo['description'] = $item['description']; + GlossaryManager::update_glossary($glossaryInfo, false); + $updatedList[] = $item['name']; + } else { + $result = GlossaryManager::save_glossary($item, false); + if ($result) { + $addedList[] = $item['name']; + } else { + $badList[] = $item['name']; + } + } + } else { + $result = GlossaryManager::save_glossary($item, false); + if ($result) { + $addedList[] = $item['name']; + } else { + $badList[] = $item['name']; } } } - //$data = Import::csvToArray($_FILES['file']['tmp_name']); - $data = Import::csv_reader($_FILES['file']['tmp_name']); - $good = 0; - $bad = 0; - foreach ($data as $item) { - $result = GlossaryManager::save_glossary( - array( - 'glossary_title' => $item['term'], - 'glossary_comment' => $item['definition'], - ), - false - ); + } - if ($result) - $good++; - else - $bad++; - } + if (count($termsDeleted) > 0) { + Display::addFlash( + Display::return_message(get_lang("TermDeleted").': '.implode(', ', $termsDeleted)) + ); + } - Display::display_confirmation_message(get_lang ("TermsImported") . ':' . $good); + if (count($updatedList) > 0) { + Display::addFlash( + Display::return_message(get_lang("TermsUpdated").': '.implode(', ', $updatedList)) + ); + } - if ($bad) { - Display::display_error_message (get_lang ("TermsNotImported") . ':' . $bad); - } + if (count($addedList) > 0) { + Display::addFlash( + Display::return_message(get_lang("TermsAdded").': '.implode(', ', $addedList)) + ); + } - GlossaryManager::display_glossary(); + if (count($badList) > 0) { + Display::addFlash( + Display::return_message(get_lang("GlossaryTermAlreadyExists").': ' . implode(', ', $badList), 'error') + ); } - break; - default: - GlossaryManager::display_glossary(); - break; - } -} else { - GlossaryManager::display_glossary(); + + if (count($doubles) > 0) { + Display::addFlash( + Display::return_message(get_lang("TermsDuplicatedInFile").': '.implode(', ', $doubles), 'warning') + ); + } + + header('Location: '.$currentUrl); + exit; + } + break; + case 'export': + if (!api_is_allowed_to_edit(null, true)) { + api_not_allowed(true); + } + $data = GlossaryManager::get_glossary_data( + 0, + GlossaryManager::get_number_glossary_terms(api_get_session_id()), + 0, + 'ASC' + ); + + usort($data, "sorter"); + $list = array(); + $list[] = array('term','definition'); + foreach ($data as $line) { + $list[] = array ($line[0], $line[1]); + } + $filename = 'glossary_course_'.api_get_course_id(); + Export::arrayToCsv($list, $filename); + break; + case 'export_to_pdf': + GlossaryManager::export_to_pdf(); + break; + case 'changeview': + if (in_array($_GET['view'], array('list','table'))) { + Session::write('glossary_view', $_GET['view']); + } else { + $view = Session::read('glossary_view'); + if (empty($view)) { + Session::write('glossary_view', 'table'); + } + } + header('Location: '.$currentUrl); + exit; + break; + default: + $tool_name = get_lang('List'); + $content = GlossaryManager::display_glossary(); + break; } -// Footer +Display::display_header($tool_name); + +// Tool introduction +Display::display_introduction_section(TOOL_GLOSSARY); + +echo $content; + Display::display_footer(); diff --git a/main/gradebook/certificate_report.php b/main/gradebook/certificate_report.php index 38930081d9..8098c826bf 100644 --- a/main/gradebook/certificate_report.php +++ b/main/gradebook/certificate_report.php @@ -1,12 +1,13 @@ * @package chamilo.gradebook */ -use ChamiloSession as Session; $cidReset = true; diff --git a/main/gradebook/exercise_jump.php b/main/gradebook/exercise_jump.php index 8c154c5386..6f830aa2c0 100755 --- a/main/gradebook/exercise_jump.php +++ b/main/gradebook/exercise_jump.php @@ -22,7 +22,7 @@ $type = Security::remove_XSS($_GET['type']); $doExerciseUrl = ''; if (isset($_GET['doexercise'])) { - $doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercice/overview.php?' . http_build_query([ + $doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?' . http_build_query([ 'session_id' => $session_id, 'cidReq' => $cidReq, 'gradebook' => $gradebook, @@ -35,14 +35,14 @@ if (isset($_GET['doexercise'])) { // no support for hot potatoes if ($type == LINK_HOTPOTATOES) { - $doExerciseUrl = api_get_path(WEB_CODE_PATH).'exercice/exercice.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq); + $doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercise/exercice.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq); } if (isset($_GET['doexercise'])) { header('Location: '.$doExerciseUrl); exit; } else { - $url = api_get_path(WEB_CODE_PATH).'exercice/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq); + $url = api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq); if (isset($_GET['gradebook'])) { $url .= '&gradebook=view&exerciseId='.intval($_GET['exerciseId']); @@ -58,11 +58,11 @@ if (isset($_GET['doexercise'])) { // If the exercise was added once redirect to the LP $firstLp = current($exercise->lpList); if (isset($firstLp['lp_id'])) { - $url = api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php?' . api_get_cidreq() . '&lp_id=' . $firstLp['lp_id'] . '&action=view&isStudentView=true'; + $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq() . '&lp_id=' . $firstLp['lp_id'] . '&action=view&isStudentView=true'; } } else { // If the exercise was added multiple times show the LP list - $url = api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php?' . api_get_cidreq().'&action=list'; + $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq().'&action=list'; } } } diff --git a/main/gradebook/get_badges.php b/main/gradebook/get_badges.php index f477cc8908..5b918792ee 100644 --- a/main/gradebook/get_badges.php +++ b/main/gradebook/get_badges.php @@ -57,9 +57,11 @@ $tpl = new Template(get_lang('Badges'), false, false); $tpl->assign( 'content', - "" + "" ); $tpl->display_one_col_template(); diff --git a/main/gradebook/gradebook.php b/main/gradebook/gradebook.php index f8919e83df..ed96babf4c 100755 --- a/main/gradebook/gradebook.php +++ b/main/gradebook/gradebook.php @@ -1,9 +1,11 @@ +$htmlHeadXtra[] = ''; api_block_anonymous_users(); -$htmlHeadXtra[]= ' + '); + $form->addHtml(' +
    + +
    + + +
    +
    + '); + + $form->addHtml(' +
    + +
    +
    +
    +
    +
    + '); break; } } @@ -1619,7 +1742,11 @@ EOF; return $return; } - function setupBreadcrumb(&$breadcrumb, $action) + /** + * @param $breadcrumb + * @param $action + */ + public function setupBreadcrumb(&$breadcrumb, $action) { if ($action == 'add') { $breadcrumb[] = array('url' => $this->pageUrl, 'name' => $this->pageName); @@ -1763,24 +1890,18 @@ EOF; $form->addElement('header', $header); - $platformLanguage = api_get_setting('platformLanguage'); - $languageId = api_get_language_id($platformLanguage); - $languageInfo = api_get_language_info($languageId); - - if ($action === 'edit' && $languageInfo['parent_id']) { - $translateUrl = api_get_path(WEB_CODE_PATH) . 'admin/sub_language.php?' . http_build_query([ - 'id' => $languageInfo['parent_id'], - 'action' => 'registersublanguage', - 'sub_language_id' => $languageInfo['id'], + if ($action == 'edit') { + $translateUrl = api_get_path(WEB_CODE_PATH) . 'extrafield/translate.php?' . http_build_query([ 'extra_field' => $id ]); $translateButton = Display::toolbarButton(get_lang('TranslateThisTerm'), $translateUrl, 'language', 'link'); + $form->addText( 'display_text', [get_lang('Name'), $translateButton] ); } else { - $form->addText('display_text', get_lang('Name')); + $form->addElement('text', 'display_text', get_lang('Name')); } // Field type @@ -2090,7 +2211,7 @@ JAVASCRIPT; //filter can be all/any = and/or $inject_joins = null; $inject_where = null; - $where = null; + $where = null; if (!empty($options['where'])) { if (!empty($options['extra'])) { @@ -2419,37 +2540,25 @@ JAVASCRIPT; } /** - * Get the info from an extra field by its id - * @param int $id - * @param bool $translateDisplayText + * @param int $fieldId + * @param string $tag + * * @return array - * @throws \Doctrine\ORM\ORMException - * @throws \Doctrine\ORM\OptimisticLockException - * @throws \Doctrine\ORM\TransactionRequiredException */ - public static function getInfoById($id, $translateDisplayText = true) + public function getAllUserPerTag($fieldId, $tag) { - $extraField = Database::getManager() - ->find('ChamiloCoreBundle:ExtraField', $id); - - $objExtraField = null; - - switch ($extraField->getExtraFieldType()) { - case \Chamilo\CoreBundle\Entity\ExtraField::USER_FIELD_TYPE: - $objExtraField = new self('user'); - break; - case \Chamilo\CoreBundle\Entity\ExtraField::COURSE_FIELD_TYPE: - $objExtraField = new self('course'); - break; - case \Chamilo\CoreBundle\Entity\ExtraField::SESSION_FIELD_TYPE: - $objExtraField = new self('session'); - break; - } + $tagRelUserTable = Database::get_main_table(TABLE_MAIN_USER_REL_TAG); + $tag = Database::escape_string($tag); + $fieldId = (int) $fieldId; + + $sql = "SELECT user_id + FROM {$this->table_field_tag} f INNER JOIN $tagRelUserTable ft + ON tag_id = f.id + WHERE tag = '$tag' AND f.field_id = $fieldId; + "; - if (!$objExtraField) { - return []; - } + $result = Database::query($sql); - return $objExtraField->get($extraField->getId(), $translateDisplayText); + return Database::store_result($result, 'ASSOC'); } } diff --git a/main/inc/lib/extra_field_option.lib.php b/main/inc/lib/extra_field_option.lib.php index b9ca30ce4d..81c30a4169 100755 --- a/main/inc/lib/extra_field_option.lib.php +++ b/main/inc/lib/extra_field_option.lib.php @@ -26,6 +26,7 @@ class ExtraFieldOption extends Model */ public function __construct($type) { + parent::__construct(); $this->type = $type; $extraField = new ExtraField($this->type); $this->extraField = $extraField; @@ -73,12 +74,12 @@ class ExtraFieldOption extends Model $fieldId = intval($fieldId); $sql = "SELECT count(*) as count - FROM $this->table o INNER JOIN $this->tableExtraField e + FROM $this->table o + INNER JOIN $this->tableExtraField e ON o.field_id = e.id WHERE o.field_id = $fieldId AND - e.extra_field_type = ".$extraFieldType." - "; + e.extra_field_type = $extraFieldType "; $result = Database::query($sql); $result = Database::fetch_array($result); @@ -171,7 +172,6 @@ class ExtraFieldOption extends Model return false; } - $time = api_get_utc_datetime(); if (!empty($params['field_options']) && in_array( $params['field_type'], @@ -411,72 +411,116 @@ class ExtraFieldOption extends Model * Gets an array of options for a specific field * @param int $field_id The field ID * @param bool $add_id_in_array Whether to add the row ID in the result - * @param string $ordered_by Extra ordering query bit - * @result mixed Row on success, false on failure - * @assert (0, '') === false + * @param null $ordered_by Extra ordering query bit + * @return array The options if they exists. Otherwise return false */ public function get_field_options_by_field($field_id, $add_id_in_array = false, $ordered_by = null) { $field_id = intval($field_id); - $sql = "SELECT * FROM {$this->table} - WHERE field_id = $field_id "; + $orderBy = null; - if (!empty($ordered_by)) { - $sql .= " ORDER BY $ordered_by "; + switch ($ordered_by) { + case 'id': + $orderBy = ['id' => 'ASC']; + break; + case 'field_id': + $orderBy = ['fieldId' => 'ASC']; + break; + case 'option_value': + $orderBy = ['optionValue' => 'ASC']; + break; + case 'display_text': + $orderBy = ['displayText' => 'ASC']; + break; + case 'priority': + $orderBy = ['priority' => 'ASC']; + break; + case 'priority_message': + $orderBy = ['priorityMessage' => 'ASC']; + break; + case 'option_order': + $orderBy = ['optionOrder' => 'ASC']; + break; } - $result = Database::query($sql); - if (Database::num_rows($result) > 0) { + $result = Database::getManager() + ->getRepository('ChamiloCoreBundle:ExtraFieldOptions') + ->findBy(['field' => $field_id], $orderBy); + + if (!$result) { + return false; + } + + $options = []; + + foreach ($result as $row) { + $option = [ + 'id' => $row->getId(), + 'field_id' => $row->getField()->getId(), + 'option_value' => $row->getValue(), + 'display_text' => $row->getDisplayText(), + 'priority' => $row->getPriority(), + 'priority_message' => $row->getPriorityMessage(), + 'option_order' => $row->getOptionOrder() + ]; + if ($add_id_in_array) { - $options = array(); - while ($row = Database::fetch_array($result, 'ASSOC')) { - $options[$row['id']] = $row; - } + $options[$row->getId()] = $option; - return $options; - } else { - return Database::store_result($result, 'ASSOC'); + continue; } + + $options[] = $option; } - return false; + return $options; } /** * Get options for a specific field as array or in JSON format suited for the double-select format - * @param int $field_id * @param int $option_value_id Option value ID * @param bool $to_json Return format (whether it should be formatted to JSON or not) * @return mixed Row/JSON on success */ - public function get_second_select_field_options_by_field($field_id, $option_value_id, $to_json = false) + public function get_second_select_field_options_by_field($option_value_id, $to_json = false) { - $field_id = intval($field_id); - $option_value_id = intval($option_value_id); - $options = array(); - $sql = "SELECT * FROM {$this->table} - WHERE field_id = $field_id AND option_value = $option_value_id - ORDER BY display_text"; - $result = Database::query($sql); - if (Database::num_rows($result) > 0) { - $options = Database::store_result($result, 'ASSOC'); + $em = Database::getManager(); + $option = $em->find('ChamiloCoreBundle:ExtraFieldOptions', intval($option_value_id)); + + if (!$option) { + return !$to_json ? [] : '{}'; } - if ($to_json) { - $string = null; - if (!empty($options)) { - $array = array(); - foreach ($options as $option) { - $array[$option['id']] = $option['display_text']; - } - $string = json_encode($array); - } + $subOptions = $em + ->getRepository('ChamiloCoreBundle:ExtraFieldOptions') + ->findSecondaryOptions($option); + + $optionsInfo = []; + + foreach ($subOptions as $subOption) { + $optionsInfo[] = [ + 'id' => $subOption->getId(), + 'field_id' => $subOption->getField()->getId(), + 'option_value' => $subOption->getValue(), + 'display_text' => $subOption->getDisplayText(), + 'priority' => $subOption->getPriority(), + 'priority_message' => $subOption->getPriorityMessage(), + 'option_order' => $subOption->getOptionOrder() + ]; + } - return $string; + if (!$to_json) { + return $optionsInfo; } - return $options; + $json = []; + + foreach ($optionsInfo as $optionInfo) { + $json[$optionInfo['id']] = $optionInfo['display_text']; + } + + return json_encode($json); } /** @@ -552,7 +596,7 @@ class ExtraFieldOption extends Model echo '
    '; echo Display::grid_html('extra_field_options'); } @@ -616,18 +660,15 @@ class ExtraFieldOption extends Model $form->addElement('hidden', 'field_id', $this->field_id); if ($action == 'edit') { - $platformLanguage = api_get_setting('platformLanguage'); - $languageId = api_get_language_id($platformLanguage); - $languageInfo = api_get_language_info($languageId); - $translateUrl = api_get_path(WEB_CODE_PATH) . 'admin/sub_language.php?' . http_build_query([ - 'id' => $languageInfo['parent_id'], - 'action' => 'registersublanguage', - 'sub_language_id' => $languageInfo['id'], + $translateUrl = api_get_path(WEB_CODE_PATH) . 'extrafield/translate.php?' . http_build_query([ 'extra_field_option' => $id ]); $translateButton = Display::toolbarButton(get_lang('TranslateThisTerm'), $translateUrl, 'language', 'link'); - $form->addElement('text', 'display_text', [get_lang('Name'), $translateButton]); + $form->addText( + 'display_text', + [get_lang('Name'), $translateButton] + ); } else { $form->addElement('text', 'display_text', get_lang('Name')); } @@ -681,6 +722,7 @@ class ExtraFieldOption extends Model if (Database::num_rows($result)) { $values = Database::store_result($result, 'ASSOC'); } + return $values; } @@ -734,45 +776,36 @@ class ExtraFieldOption extends Model */ public static function translateDisplayName($defaultDisplayText) { - $camelCase = api_underscore_to_camel_case($defaultDisplayText); - $camelCase = ucwords($camelCase); - $camelCase = str_replace(' ', '', $camelCase); + $variableLanguage = self::getLanguageVariable($defaultDisplayText); - return isset($GLOBALS[$camelCase]) ? $GLOBALS[$camelCase] : $defaultDisplayText; + return isset($GLOBALS[$variableLanguage]) ? $GLOBALS[$variableLanguage] : $defaultDisplayText; } /** - * Get the info from an extra field option by its id - * @param int $id - * @param bool $translateDisplayText - * @return array - * @throws \Doctrine\ORM\ORMException - * @throws \Doctrine\ORM\OptimisticLockException - * @throws \Doctrine\ORM\TransactionRequiredException + * @param $defaultDisplayText + * @return mixed|string */ - public static function getInfoById($id, $translateDisplayText = true) + public static function getLanguageVariable($defaultDisplayText) { - $extraField = Database::getManager() - ->find('ChamiloCoreBundle:ExtraFieldOptions', $id); + $variableLanguage = api_replace_dangerous_char($defaultDisplayText); + $variableLanguage = str_replace('-', '_', $variableLanguage); + $variableLanguage = api_underscore_to_camel_case($variableLanguage); - $objExtraField = null; + return $variableLanguage; + } - switch ($extraField->getField()->getExtraFieldType()) { - case \Chamilo\CoreBundle\Entity\ExtraField::USER_FIELD_TYPE: - $objExtraField = new self('user'); - break; - case \Chamilo\CoreBundle\Entity\ExtraField::COURSE_FIELD_TYPE: - $objExtraField = new self('course'); - break; - case \Chamilo\CoreBundle\Entity\ExtraField::SESSION_FIELD_TYPE: - $objExtraField = new self('session'); - break; - } + /** + * @param null $options + * @return array + */ + public function get_all($options = null) + { + $result = parent::get_all($options); - if (!$objExtraField) { - return []; + foreach ($result as &$row) { + $row['display_text'] = self::translateDisplayName($row['display_text']); } - return $objExtraField->get($extraField->getId(), $translateDisplayText); + return $result; } } diff --git a/main/inc/lib/extra_field_value.lib.php b/main/inc/lib/extra_field_value.lib.php index 6a7d401c31..cb4724b7d0 100755 --- a/main/inc/lib/extra_field_value.lib.php +++ b/main/inc/lib/extra_field_value.lib.php @@ -24,7 +24,7 @@ class ExtraFieldValue extends Model 'created_at', 'updated_at', ); - /** @var string session_id, course_code, user_id, question id */ + /** @var ExtraField */ public $extraField; /** @@ -36,6 +36,7 @@ class ExtraFieldValue extends Model */ public function __construct($type) { + parent::__construct(); $this->type = $type; $extraField = new ExtraField($this->type); $this->extraField = $extraField; @@ -173,7 +174,7 @@ class ExtraFieldValue extends Model $tags = array_merge($tags, $tagsResult); } } - + foreach ($tags as $tag) { $tagUses = $em ->getRepository('ChamiloCoreBundle:ExtraFieldRelTag') @@ -585,8 +586,8 @@ class ExtraFieldValue extends Model /** * @param string $tag - * @param int $field_id - * @param int $limit + * @param int $field_id + * @param int $limit * * @return array */ @@ -691,7 +692,8 @@ class ExtraFieldValue extends Model $field_variable, $field_value, $transform = false, - $last = false + $last = false, + $all = false ) { $field_value = Database::escape_string($field_value); $field_variable = Database::escape_string($field_variable); @@ -706,7 +708,7 @@ class ExtraFieldValue extends Model sf.extra_field_type = $extraFieldType ORDER BY item_id "; - + if ($last) { // If we want the last element instead of the first // This is useful in special cases where there might @@ -716,7 +718,11 @@ class ExtraFieldValue extends Model $result = Database::query($sql); if ($result !== false && Database::num_rows($result)) { - $result = Database::fetch_array($result, 'ASSOC'); + if ($all) { + $result = Database::store_result($result, 'ASSOC'); + } else { + $result = Database::fetch_array($result, 'ASSOC'); + } return $result; } else { @@ -744,6 +750,7 @@ class ExtraFieldValue extends Model $result = Database::query($sql); if (Database::num_rows($result)) { + return Database::store_result($result, 'ASSOC'); } @@ -831,8 +838,10 @@ class ExtraFieldValue extends Model $result = Database::query($sql); if (Database::num_rows($result)) { + return Database::store_result($result, 'ASSOC'); } + return false; } @@ -868,7 +877,7 @@ class ExtraFieldValue extends Model $sql = "DELETE FROM {$this->table} WHERE item_id = '$item_id' AND - field_id = '".$field_id."' AND + field_id = '$field_id' AND extra_field_type = $extraFieldType "; Database::query($sql); @@ -906,12 +915,11 @@ class ExtraFieldValue extends Model $itemId = intval($itemId); $fieldId = intval($fieldId); $fieldValue = Database::escape_string($fieldValue); - //$extraFieldType = $this->getExtraField()->getExtraFieldType(); $sql = "DELETE FROM {$this->table} WHERE item_id = '$itemId' AND - field_id = '".$fieldId."' AND + field_id = '$fieldId' AND value = '$fieldValue' "; Database::query($sql); diff --git a/main/inc/lib/fileUpload.lib.php b/main/inc/lib/fileUpload.lib.php index 3b6f1413b1..1a3b6b5dd1 100755 --- a/main/inc/lib/fileUpload.lib.php +++ b/main/inc/lib/fileUpload.lib.php @@ -765,11 +765,11 @@ function dir_total_space($dir_path) * Note : some browsers don't send the MIME Type (e.g. Netscape 4). * We don't have solution for this kind of situation * - * @author - Hugues Peeters - * @author - Bert Vanderkimpen - * @param - file_name (string) - Name of the file - * @param - file_type (string) - Type of the file - * @return - file_name (string) + * @author Hugues Peeters + * @author Bert Vanderkimpen + * @param string $file_name Name of the file + * @param string $file_type Type of the file + * @return string File name */ function add_ext_on_mime($file_name, $file_type) { diff --git a/main/inc/lib/formvalidator/FormValidator.class.php b/main/inc/lib/formvalidator/FormValidator.class.php index 9f2b66a498..75c63dbb62 100755 --- a/main/inc/lib/formvalidator/FormValidator.class.php +++ b/main/inc/lib/formvalidator/FormValidator.class.php @@ -840,6 +840,7 @@ EOT; /** @var HtmlEditor $element */ $element = $this->getElement($name); + if ($style) { $config['style'] = true; } @@ -953,8 +954,8 @@ EOT; /** * This function has been created for avoiding changes directly within QuickForm class. * When we use it, the element is threated as 'required' to be dealt during validation. - * @param array $element The array of elements - * @param string $message The message displayed + * @param array $element The array of elements + * @param string $message The message displayed */ public function add_multiple_required_rule($elements, $message) { diff --git a/main/inc/lib/glossary.lib.php b/main/inc/lib/glossary.lib.php index 6aa6e6b884..cdbfcaa3bb 100755 --- a/main/inc/lib/glossary.lib.php +++ b/main/inc/lib/glossary.lib.php @@ -1,10 +1,17 @@ , Ghent University, Belgium januari 2009, dokeos 1.8.6 + * * @package chamilo.library */ class GlossaryManager @@ -59,44 +66,44 @@ class GlossaryManager /** * Get glossary term by glossary id * @author Isaac Flores - * @param string The glossary term name - * @return string The glossary description + * @param string $glossary_name The glossary term name + * + * @return array The glossary info */ - public static function get_glossary_term_by_glossary_name ($glossary_name) + public static function get_glossary_term_by_glossary_name($glossary_name) { $glossary_table = Database::get_course_table(TABLE_GLOSSARY); $session_id = api_get_session_id(); $course_id = api_get_course_int_id(); $sql_filter = api_get_session_condition($session_id); - $sql = 'SELECT description FROM '.$glossary_table.' + $sql = 'SELECT * FROM '.$glossary_table.' WHERE c_id = '.$course_id.' AND name LIKE trim("'.Database::escape_string($glossary_name).'")'.$sql_filter; $rs = Database::query($sql); if (Database::num_rows($rs) > 0) { - $row = Database::fetch_array($rs); + $row = Database::fetch_array($rs, 'ASSOC'); - return $row['description']; - } else { - - return ''; + return $row; } + + return []; } /** * This functions stores the glossary in the database * - * @param array Array of title + description (glossary_title => $title, glossary_comment => $comment) + * @param array $values Array of title + description (name => $title, description => $comment) + * * @return mixed Term id on success, false on failure - * @author Christian Fasanando - * @author Patrick Cool , Ghent University, Belgium - * @version januari 2009, dokeos 1.8.6 + * */ - public static function save_glossary($values, $message = true) + public static function save_glossary($values, $showMessage = true) { - if (!is_array($values) or !isset($values['glossary_title'])) { + if (!is_array($values) || !isset($values['name'])) { return false; } + // Database table definition $t_glossary = Database :: get_course_table(TABLE_GLOSSARY); @@ -107,24 +114,27 @@ class GlossaryManager $session_id = api_get_session_id(); // check if the glossary term already exists - if (GlossaryManager::glossary_exists($values['glossary_title'])) { + if (GlossaryManager::glossary_exists($values['name'])) { // display the feedback message - if ($message) - Display::display_error_message(get_lang('GlossaryTermAlreadyExistsYouShouldEditIt')); + if ($showMessage) { + Display::addFlash( + Display::return_message(get_lang('GlossaryTermAlreadyExistsYouShouldEditIt'), 'error') + ); + } return false; } else { $params = [ 'glossary_id' => 0, 'c_id' => api_get_course_int_id(), - 'name' => $values['glossary_title'], - 'description' => $values['glossary_comment'], + 'name' => $values['name'], + 'description' => $values['description'], 'display_order' => $max_glossary_item + 1, 'session_id' => $session_id, ]; $id = Database::insert($t_glossary, $params); - if ($id) { + if ($id) { $sql = "UPDATE $t_glossary SET glossary_id = $id WHERE iid = $id"; Database::query($sql); @@ -137,11 +147,11 @@ class GlossaryManager api_get_user_id() ); } - - $_SESSION['max_glossary_display'] = GlossaryManager::get_max_glossary_item(); // display the feedback message - if ($message) { - Display::display_confirmation_message(get_lang('TermAdded')); + if ($showMessage) { + Display::addFlash( + Display::return_message(get_lang('TermAdded')) + ); } return $id; @@ -153,33 +163,36 @@ class GlossaryManager * * @param array $values an array containing all the form elements * @return boolean True on success, false on failure - * @author Christian Fasanando - * @author Patrick Cool , Ghent University, Belgium - * @version januari 2009, dokeos 1.8.6 */ - public static function update_glossary($values, $message = true) + public static function update_glossary($values, $showMessage = true) { // Database table definition $t_glossary = Database :: get_course_table(TABLE_GLOSSARY); $course_id = api_get_course_int_id(); // check if the glossary term already exists - if (GlossaryManager::glossary_exists($values['glossary_title'],$values['glossary_id'])) { + if (GlossaryManager::glossary_exists($values['name'], $values['glossary_id'])) { // display the feedback message - if ($message) - Display::display_error_message(get_lang('GlossaryTermAlreadyExistsYouShouldEditIt')); + if ($showMessage) { + Display::addFlash( + Display::return_message(get_lang('GlossaryTermAlreadyExistsYouShouldEditIt'), 'error') + ); + } + return false; } else { $sql = "UPDATE $t_glossary SET - name = '".Database::escape_string($values['glossary_title'])."', - description = '".Database::escape_string($values['glossary_comment'])."' + name = '".Database::escape_string($values['name'])."', + description = '".Database::escape_string($values['description'])."' WHERE c_id = $course_id AND glossary_id = ".intval($values['glossary_id']); $result = Database::query($sql); if ($result === false) { + return false; } + //update glossary into item_property api_item_property_update( api_get_course_info(), @@ -188,9 +201,13 @@ class GlossaryManager 'GlossaryUpdated', api_get_user_id() ); - // display the feedback message - if ($message) - Display::display_confirmation_message(get_lang('TermUpdated')); + + if ($showMessage) { + // display the feedback message + Display::addFlash( + Display::return_message(get_lang('TermUpdated')) + ); + } } return true; @@ -199,9 +216,6 @@ class GlossaryManager /** * Get the maximum display order of the glossary item * @return integer Maximum glossary display order - * @author Christian Fasanando - * @author Patrick Cool , Ghent University, Belgium - * @version januari 2009, dokeos 1.8.6 */ public static function get_max_glossary_item() { @@ -225,14 +239,12 @@ class GlossaryManager /** * check if the glossary term exists or not * - * @param string Term to look for - * @param integer ID to counter-check if the term exists with this ID as well (optional) + * @param string $term Term to look for + * @param integer $not_id ID to counter-check if the term exists with this ID as well (optional) * @return bool True if term exists * - * @author Patrick Cool , Ghent University, Belgium - * @version januari 2009, dokeos 1.8.6 */ - public static function glossary_exists($term, $not_id='') + public static function glossary_exists($term, $not_id = '') { // Database table definition $t_glossary = Database :: get_course_table(TABLE_GLOSSARY); @@ -257,10 +269,9 @@ class GlossaryManager /** * Get one specific glossary term data * - * @param integer ID of the flossary term - * @return mixed Array(glossary_id,glossary_title,glossary_comment,glossary_display_order) or false on error + * @param integer $glossary_id ID of the flossary term + * @return mixed Array(glossary_id,name,description,glossary_display_order) or false on error * - * @author Patrick Cool , Ghent University, Belgium */ public static function get_glossary_information($glossary_id) { @@ -272,60 +283,78 @@ class GlossaryManager } $sql = "SELECT g.glossary_id as glossary_id, - g.name as glossary_title, - g.description as glossary_comment, + g.name as name, + g.description as description, g.display_order as glossary_display_order, ip.insert_date as insert_date, ip.lastedit_date as update_date, g.session_id FROM $t_glossary g, $t_item_propery ip WHERE - g.glossary_id = ip.ref AND - tool = '".TOOL_GLOSSARY."' AND - g.glossary_id = '".intval($glossary_id)."' AND - g.c_id = ".api_get_course_int_id()." AND - ip.c_id = ".api_get_course_int_id()." - "; + g.glossary_id = ip.ref AND + tool = '".TOOL_GLOSSARY."' AND + g.glossary_id = '".intval($glossary_id)."' AND + g.c_id = ".api_get_course_int_id()." AND + ip.c_id = ".api_get_course_int_id(); + $result = Database::query($sql); if ($result === false || Database::num_rows($result) != 1) { return false; } + return Database::fetch_array($result); } /** * Delete a glossary term (and re-order all the others) * - * @param integer The id of the glossary term to delete + * @param integer $glossary_id + * @param bool $showMessage + * * @return bool True on success, false on failure - * @author Patrick Cool , Ghent University, Belgium - * @version januari 2009, dokeos 1.8.6 */ - public static function delete_glossary($glossary_id, $message = true) + public static function delete_glossary($glossary_id, $showMessage = true) { // Database table definition $t_glossary = Database :: get_course_table(TABLE_GLOSSARY); $course_id = api_get_course_int_id(); - if (empty($glossary_id)) { return false; } + $glossaryInfo = self::get_glossary_information($glossary_id); + + if (empty($glossaryInfo)) { - $sql = "DELETE FROM $t_glossary WHERE c_id = $course_id AND glossary_id='".intval($glossary_id)."'"; + return false; + } + + $glossary_id = (int) $glossary_id; + + $sql = "DELETE FROM $t_glossary + WHERE + c_id = $course_id AND + glossary_id='".$glossary_id."'"; $result = Database::query($sql); - if ($result === false or Database::affected_rows($result) < 1) { return false; } - //update item_property (delete) + if ($result === false || Database::affected_rows($result) < 1) { + return false; + } + + // update item_property (delete) api_item_property_update( api_get_course_info(), TOOL_GLOSSARY, - intval($glossary_id), + $glossary_id, 'delete', api_get_user_id() ); // reorder the remaining terms GlossaryManager::reorder_glossary(); - $_SESSION['max_glossary_display'] = GlossaryManager::get_max_glossary_item(); - if ($message) - Display::display_confirmation_message(get_lang('TermDeleted')); + + if ($showMessage) { + Display::addFlash( + Display::return_message(get_lang('TermDeleted').': '.$glossaryInfo['name']) + ); + } + return true; } @@ -334,28 +363,28 @@ class GlossaryManager * the glossary terms * @param string View ('table' or 'list'). Optional parameter. * Defaults to 'table' and prefers glossary_view from the session by default. - * @return void - * @author Patrick Cool , Ghent University, Belgium - * @version januari 2009, dokeos 1.8.6 + * + * @return string */ public static function display_glossary($view = 'table') { // This function should always be called with the corresponding // parameter for view type. Meanwhile, use this cheap trick. - if (empty($_SESSION['glossary_view'])) { - $_SESSION['glossary_view'] = $view; + $view = Session::read('glossary_view'); + if (empty($view)) { + Session::write('glossary_view', $view); } // action links //echo '
    '; $actionsLeft = ''; - if (api_is_allowed_to_edit(null,true)) { + if (api_is_allowed_to_edit(null, true)) { $actionsLeft .= ''. Display::return_icon('new_glossary_term.png',get_lang('TermAddNew'),'', ICON_SIZE_MEDIUM).''; } $actionsLeft .= ''. Display::return_icon('export_csv.png',get_lang('ExportGlossaryAsCSV'),'',ICON_SIZE_MEDIUM).''; - if (api_is_allowed_to_edit(null,true)) { + if (api_is_allowed_to_edit(null, true)) { $actionsLeft .= ''. Display::return_icon('import_csv.png',get_lang('ImportGlossary'),'',ICON_SIZE_MEDIUM).''; } @@ -363,7 +392,7 @@ class GlossaryManager $actionsLeft .= ''. Display::return_icon('pdf.png',get_lang('ExportToPDF'),'', ICON_SIZE_MEDIUM).''; - if ((isset($_SESSION['glossary_view']) && $_SESSION['glossary_view'] == 'table') or (!isset($_SESSION['glossary_view']))){ + if (($view == 'table') || (!isset($view))) { $actionsLeft .= ''. Display::return_icon('view_detailed.png',get_lang('ListView'),'',ICON_SIZE_MEDIUM).''; } else { @@ -391,9 +420,9 @@ class GlossaryManager array(0 => $actionsLeft, 1 => $actionsRight) ); - echo $toolbar; + $content = $toolbar; - if (!$_SESSION['glossary_view'] || $_SESSION['glossary_view'] == 'table') { + if (!$view || $view === 'table') { $table = new SortableTable( 'glossary', array('GlossaryManager', 'get_number_glossary_terms'), @@ -403,34 +432,36 @@ class GlossaryManager //$table->set_header(0, '', false); $table->set_header(0, get_lang('TermName'), true); $table->set_header(1, get_lang('TermDefinition'), true); - if (api_is_allowed_to_edit(null,true)) { + if (api_is_allowed_to_edit(null, true)) { $table->set_header(2, get_lang('Actions'), false, 'width=90px', array('class' => 'td_actions')); $table->set_column_filter(2, array('GlossaryManager','actions_filter')); } - $table->display(); + $content .= $table->return_table(); } - if ($_SESSION['glossary_view'] == 'list') { - GlossaryManager::display_glossary_list(); + + if ($view === 'list') { + $content .= GlossaryManager::displayGlossaryList(); } + + return $content; } /** * Display the glossary terms in a list - * @return bool True - * @author Patrick Cool , Ghent University, Belgium - * @version januari 2009, dokeos 1.8.6 + * @return bool true */ - public static function display_glossary_list() + public static function displayGlossaryList() { $glossary_data = self::get_glossary_data(0,1000,0,'ASC'); + $content = ''; foreach ($glossary_data as $key => $glossary_item) { $actions = ''; if (api_is_allowed_to_edit(null,true)) { $actions = '
    '.self::actions_filter($glossary_item[2], '',$glossary_item).'
    '; } - echo Display::panel($glossary_item[1], $glossary_item[0].' '.$actions); + $content .= Display::panel($glossary_item[1], $glossary_item[0].' '.$actions); } - return true; + return $content; } /** @@ -438,8 +469,6 @@ class GlossaryManager * @param int Session ID filter (optional) * @return integer Count of glossary terms * - * @author Patrick Cool , Ghent University, Belgium - * @version januari 2009, dokeos 1.8.6 */ public static function get_number_glossary_terms($session_id=0) { @@ -471,19 +500,18 @@ class GlossaryManager /** * Get all the data of a glossary * - * @param integer From which item - * @param integer Number of items to collect - * @param string Name of column on which to order - * @param string Whether to sort in ascending (ASC) or descending (DESC) - * @return unknown + * @param int $from From which item + * @param int $number_of_items Number of items to collect + * @param string $column Name of column on which to order + * @param string $direction Whether to sort in ascending (ASC) or descending (DESC) * - * @author Patrick Cool - * @author Julio Montoya fixing this function, adding intvals - * @version januari 2009, dokeos 1.8.6 + * @return array */ - public static function get_glossary_data($from, $number_of_items, $column, $direction) + public static function get_glossary_data($from, $number_of_items, $column, $direction) { $_user = api_get_user_info(); + $view = Session::read('glossary_view'); + // Database table definition $t_glossary = Database :: get_course_table(TABLE_GLOSSARY); $t_item_propery = Database :: get_course_table(TABLE_ITEM_PROPERTY); @@ -491,7 +519,7 @@ class GlossaryManager if (api_is_allowed_to_edit(null, true)) { $col2 = " glossary.glossary_id as col2, "; } else { - $col2 = " "; + $col2 = ' '; } //condition for the session @@ -538,7 +566,7 @@ class GlossaryManager $session_img = api_get_session_image($data['session_id'], $_user['status']); $array[0] = $data[0] . $session_img; - if (!$_SESSION['glossary_view'] || $_SESSION['glossary_view'] == 'table') { + if (!$view || $view === 'table') { $array[1] = str_replace(array('

    ', '

    '), array('', '
    '), $data[1]); } else { $array[1] = $data[1]; @@ -557,26 +585,24 @@ class GlossaryManager * Update action icons column * * @param integer $glossary_id - * @param array Parameters to use to affect links - * @param array The line of results from a query on the glossary table - * @return string HTML string for the action icons columns + * @param array $url_params Parameters to use to affect links + * @param array $row The line of results from a query on the glossary table * - * @author Patrick Cool , Ghent University, Belgium - * @version januari 2009, dokeos 1.8.6 + * @return string HTML string for the action icons columns */ public static function actions_filter($glossary_id, $url_params, $row) { $glossary_id = $row[2]; - $return = ''.Display::return_icon('edit.png',get_lang('Edit'),'',22).''; + $return = ''. + Display::return_icon('edit.png',get_lang('Edit'),'',22).''; $glossary_data = GlossaryManager::get_glossary_information($glossary_id); - - $glossary_term = $glossary_data['glossary_title']; - + $glossary_term = $glossary_data['name']; if (api_is_allowed_to_edit(null, true)) { if ($glossary_data['session_id'] == api_get_session_id()) { - $return .= ''.Display::return_icon('delete.png', get_lang('Delete'),'',22).''; + $return .= ''. + Display::return_icon('delete.png', get_lang('Delete'),'',22).''; } else { - $return = get_lang('EditionNotAvailableFromSession'); + $return = get_lang('EditionNotAvailableFromSession'); } } @@ -588,28 +614,25 @@ class GlossaryManager * * @return string HTML string including JavaScript * - * @author Patrick Cool , Ghent University, Belgium - * @version januari 2009, dokeos 1.8.6 */ public static function javascript_glossary() { - return ""; + return ""; } /** * Re-order glossary - * - * @author Patrick Cool , Ghent University, Belgium - * @version januari 2009, dokeos 1.8.6 */ - public static function reorder_glossary() { + public static function reorder_glossary() + { // Database table definition $t_glossary = Database :: get_course_table(TABLE_GLOSSARY); $course_id = api_get_course_int_id(); @@ -630,19 +653,16 @@ class GlossaryManager /** * Move a glossary term * - * @param unknown_type $direction - * @param unknown_type $glossary_id - * - * @author Patrick Cool , Ghent University, Belgium - * @version januari 2009, dokeos 1.8.6 + * @param string $direction + * @param string $glossary_id */ - public static function move_glossary($direction, $glossary_id, $message = true) + public static function move_glossary($direction, $glossary_id) { // Database table definition $t_glossary = Database :: get_course_table(TABLE_GLOSSARY); // sort direction - if ($direction == 'up') { + if ($direction === 'up') { $sortorder = 'DESC'; } else { $sortorder = 'ASC'; @@ -655,7 +675,7 @@ class GlossaryManager $res = Database::query($sql); $found = false; while ($row = Database::fetch_array($res)) { - if ($found && empty($next_id)) { + if ($found && empty($next_id)) { $next_id = $row['glossary_id']; $next_display_order = $row['display_order']; } @@ -672,16 +692,21 @@ class GlossaryManager WHERE c_id = $course_id AND glossary_id = '".Database::escape_string($next_id)."'"; Database::query($sql1); Database::query($sql2); - if ($message) - Display::display_confirmation_message(get_lang('TermMoved')); + + Display::addFlash(Display::return_message(get_lang('TermMoved'))); } /** - * + * Export to pdf */ public static function export_to_pdf() { - $data = GlossaryManager::get_glossary_data(0, GlossaryManager::get_number_glossary_terms(api_get_session_id()), 0, 'ASC'); + $data = GlossaryManager::get_glossary_data( + 0, + GlossaryManager::get_number_glossary_terms(api_get_session_id()), + 0, + 'ASC' + ); $html = ''; $html .= '

    '.get_lang('Glossary').'




    '; foreach ($data as $item) { @@ -690,15 +715,8 @@ class GlossaryManager $html .= '

    '.$term.'

    '.$description.'


    '; } $html .= ''; - $course_code = api_get_course_id(); + $courseCode = api_get_course_id(); $pdf = new PDF(); - //$pdf->set_custom_header($title); - /*$css_file = api_get_path(SYS_CODE_PATH).'css/print.css'; - if (file_exists($css_file)) { - $css = @file_get_contents($css_file); - } else { - $css = ''; - }*/ - $pdf->content_to_pdf($html, '', get_lang('Glossary').'_'.$course_code, $course_code); + $pdf->content_to_pdf($html, '', get_lang('Glossary').'_'.$courseCode, $courseCode); } } diff --git a/main/inc/lib/grade_model.lib.php b/main/inc/lib/grade_model.lib.php index 7545e1c16b..1f5ac7c654 100755 --- a/main/inc/lib/grade_model.lib.php +++ b/main/inc/lib/grade_model.lib.php @@ -15,6 +15,7 @@ class GradeModel extends Model */ public function __construct() { + parent::__construct(); $this->table = Database::get_main_table(TABLE_GRADE_MODEL); } @@ -123,11 +124,11 @@ class GradeModel extends Model for ($i = 0; $i <= $max; $i++) { $counter = $i; $form->addElement('text', 'components['.$i.'][percentage]', null); - $form->addElement('text', 'components['.$i.'][acronym]', null); - $form->addElement('text', 'components['.$i.'][title]', null); - $form->addElement('hidden', 'components['.$i.'][id]', null); + $form->addElement('text', 'components['.$i.'][acronym]', null); + $form->addElement('text', 'components['.$i.'][title]', null); + $form->addElement('hidden', 'components['.$i.'][id]', null); - $template_percentage = + $template_percentage = '

    @@ -195,6 +196,10 @@ class GradeModel extends Model return $form; } + /** + * @param $id + * @return array|null + */ public function get_components($id) { $obj = new GradeModelComponents(); @@ -204,6 +209,11 @@ class GradeModel extends Model return null; } + /** + * @param array $params + * @param bool $show_query + * @return bool + */ public function save($params, $show_query = false) { $id = parent::save($params, $show_query); @@ -242,10 +252,12 @@ class GradeModel extends Model //$params['components'] } + /** + * @param int $id + */ public function delete($id) { parent::delete($id); - //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); } public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', $default_value = null) @@ -290,14 +302,24 @@ class GradeModelComponents extends Model public $table; public $columns = array('id', 'title', 'percentage', 'acronym', 'grade_model_id'); + /** + * GradeModelComponents constructor. + */ public function __construct() { - $this->table = Database::get_main_table(TABLE_GRADE_MODEL_COMPONENTS); + parent::__construct(); + $this->table = Database::get_main_table(TABLE_GRADE_MODEL_COMPONENTS); } + /** + * @param array $params + * @param bool $show_query + * @return bool + */ public function save($params, $show_query = false) { $id = parent::save($params, $show_query); + return $id; } } diff --git a/main/inc/lib/groupmanager.lib.php b/main/inc/lib/groupmanager.lib.php index 4feba04c9d..68be503460 100755 --- a/main/inc/lib/groupmanager.lib.php +++ b/main/inc/lib/groupmanager.lib.php @@ -386,7 +386,7 @@ class GroupManager if (api_is_course_coach()) { //a coach can only delete courses from his session - for ($i=0 ; $inumber_of_groups; } @@ -682,7 +683,8 @@ class GroupManager $id = intval($id); $table_group_cat = Database :: get_course_table(TABLE_GROUP_CATEGORY); $sql = "SELECT * FROM $table_group_cat - WHERE c_id = $course_id AND id = $id LIMIT 1"; + WHERE c_id = $course_id AND id = $id + LIMIT 1"; $res = Database::query($sql); return Database::fetch_array($res); @@ -815,7 +817,7 @@ class GroupManager WHERE c_id = $course_id "; $res = Database::query($sql); $obj = Database::fetch_object($res); - if (!isset ($obj->new_order)) { + if (!isset($obj->new_order)) { $obj->new_order = 1; } @@ -1078,6 +1080,7 @@ class GroupManager while ($obj = Database::fetch_object($res)) { $users[] = api_get_user_info($obj->user_id); } + return $users; } @@ -1100,6 +1103,7 @@ class GroupManager while ($obj = Database::fetch_object($res)) { $users[] = api_get_user_info($obj->user_id); } + return $users; } @@ -1121,6 +1125,7 @@ class GroupManager while ($obj = Database::fetch_object($res)) { $users[] = api_get_user_info($obj->user_id); } + return $users; } @@ -1146,6 +1151,7 @@ class GroupManager while ($row = Database::fetch_array($rs)) { $result[] = $row['user_id']; } + return $result; } @@ -1180,7 +1186,7 @@ class GroupManager $group_ids = array_map('intval', $group_ids); if (api_is_course_coach()) { - for ($i=0 ; $i< count($group_ids) ; $i++) { + for ($i=0 ; $i < count($group_ids) ; $i++) { if (!api_is_element_in_the_session(TOOL_GROUP, $group_ids[$i])){ array_splice($group_ids,$i,1); $i--; diff --git a/main/inc/lib/icalcreator/iCalcreator.class.php b/main/inc/lib/icalcreator/iCalcreator.class.php index d89833039e..327b3a91d5 100755 --- a/main/inc/lib/icalcreator/iCalcreator.class.php +++ b/main/inc/lib/icalcreator/iCalcreator.class.php @@ -327,7 +327,7 @@ class vcalendar { * @param array $params optional * @return bool */ - function setXprop( $label, $value, $params=FALSE ) { + function setXprop($label, $value, $params = array()) { if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; if( empty( $label )) return FALSE; $xprop = array( 'value' => $value ); @@ -343,11 +343,11 @@ class vcalendar { * * @author Kjell-Inge Gustafsson * @since 2.4.5 - 2008-11-14 - * @param mixed $propName, bool FALSE => X-property - * @param mixed @propix optional, if specific property is wanted in case of multiple instances + * @param mixed $propName bool FALSE => X-property + * @param mixed $propix optional, if specific property is wanted in case of multiple instances * @return bool if successful delete */ - function deleteProperty( $propName, $propix=FALSE ) { + function deleteProperty( $propName, $propix = FALSE ) { $propName = ( $propName ) ? strtoupper( $propName ) : 'X-PROP'; if( !$propix ) $propix = ( isset( $this->propdelix[$propName] )) ? $this->propdelix[$propName] + 2 : 1; @@ -394,9 +394,9 @@ class vcalendar { * * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-02 - * @param string $propName, optional - * @param int @propix, optional, if specific property is wanted in case of multiply occurences - * @param bool $inclParam=FALSE + * @param string $propName optional + * @param int $propix optional, if specific property is wanted in case of multiply occurences + * @param bool $inclParam FALSE by default * @return mixed */ function getProperty( $propName=FALSE, $propix=FALSE, $inclParam=FALSE ) { @@ -447,7 +447,7 @@ class vcalendar { * * @author Kjell-Inge Gustafsson * @since 2.2.13 - 2007-11-04 - * @param mixed $args variable number of function arguments, + * @param mixed variable number of function arguments, * first argument is ALWAYS component name, * second ALWAYS component value! * @return bool @@ -470,7 +470,6 @@ class vcalendar { if( !isset( $arglist[2] )) $arglist[2] = null; return $this->setXprop( $arglist[0], $arglist[1], $arglist[2] ); } - return FALSE; } /*********************************************************************************/ /** @@ -555,7 +554,7 @@ class vcalendar { return $this->url; else return FALSE; - break; + // no break needed } } /** @@ -590,10 +589,10 @@ class vcalendar { $this->directory = $value; $this->url = null; return TRUE; + } else { + return false; } - else - return FALSE; - break; + // no break needed case 'FILENAME': $value = trim( $value ); if( !empty( $this->url )) { @@ -608,18 +607,18 @@ class vcalendar { clearstatcache(); $this->filename = $value; return TRUE; - } - else + } else { return FALSE; + } } elseif( FALSE !== touch( $dirfile )) { /* new local file created */ $this->filename = $value; return TRUE; + } else { + return false; } - else - return FALSE; - break; + // no break needed case 'FORMAT': $value = trim( $value ); if( 'xcal' == strtolower( $value )) { @@ -1638,7 +1637,7 @@ class vcalendar { header( 'Content-Length: '.$filesize ); header( 'Content-Disposition: attachment; filename="'.$filename.'"' ); header( 'Cache-Control: max-age=10' ); - $fp = @$fopen( $dirfile, 'r' ); + $fp = @fopen($dirfile, 'r'); if ( $fp ) { fpassthru( $fp ); fclose( $fp ); @@ -1766,8 +1765,8 @@ class calendarComponent { * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-06 * @param string $value - * @param array $params, optional - * @param integer $index, optional + * @param array $params optional + * @param integer $index optional * @return bool */ function setAttach( $value, $params=FALSE, $index=FALSE ) { @@ -1856,8 +1855,8 @@ class calendarComponent { * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-05 * @param string $value - * @param array $params, optional - * @param integer $index, optional + * @param array $params optional + * @param integer $index optional * @return bool */ function setAttendee( $value, $params=FALSE, $index=FALSE ) { @@ -1957,8 +1956,8 @@ class calendarComponent { * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-06 * @param mixed $value - * @param array $params, optional - * @param integer $index, optional + * @param array $params optional + * @param integer $index optional * @return bool */ function setCategories( $value, $params=FALSE, $index=FALSE ) { @@ -2023,14 +2022,15 @@ class calendarComponent { } return $output; } + /** * set calendar component property comment * * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-06 * @param string $value - * @param array $params, optional - * @param integer $index, optional + * @param array|bool $params optional + * @param bool|int $index optional * @return bool */ function setComment( $value, $params=FALSE, $index=FALSE ) { @@ -2078,7 +2078,7 @@ class calendarComponent { * @param array $params optional * @return bool */ - function setCompleted( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) { + function setCompleted( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=array() ) { if( empty( $year )) { if( $this->getConfig( 'allowEmpty' )) { $this->completed = array( 'value' => null, 'params' => $this->_setParams( $params )); @@ -2120,8 +2120,8 @@ class calendarComponent { * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-05 * @param string $value - * @param array $params, optional - * @param integer $index, optional + * @param array $params optional + * @param integer $index optional * @return bool */ function setContact( $value, $params=FALSE, $index=FALSE ) { @@ -2197,8 +2197,8 @@ class calendarComponent { * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-05 * @param string $value - * @param array $params, optional - * @param integer $index, optional + * @param array $params optional + * @param integer $index optional * @return bool */ function setDescription( $value, $params=FALSE, $index=FALSE ) { @@ -2362,7 +2362,7 @@ class calendarComponent { * @param array $params optional * @return bool */ - function setDtstart( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) { + function setDtstart( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=array() ) { if( empty( $year )) { if( $this->getConfig( 'allowEmpty' )) { $this->dtstart = array( 'value' => null, 'params' => $this->_setParams( $params )); @@ -2414,7 +2414,7 @@ class calendarComponent { * @param array $params optional * @return bool */ - function setDue( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=FALSE ) { + function setDue( $year, $month=FALSE, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $tz=FALSE, $params=array() ) { if( empty( $year )) { if( $this->getConfig( 'allowEmpty' )) { $this->due = array( 'value' => null, 'params' => $this->_setParams( $params )); @@ -2463,7 +2463,7 @@ class calendarComponent { * @param array $params optional * @return bool */ - function setDuration( $week, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=FALSE ) { + function setDuration( $week, $day=FALSE, $hour=FALSE, $min=FALSE, $sec=FALSE, $params=array() ) { if( empty( $week )) if( $this->getConfig( 'allowEmpty' )) $week = null; else return FALSE; if( is_array( $week ) && ( 1 <= count( $week ))) $this->duration = array( 'value' => $this->_duration_array( $week ), 'params' => $this->_setParams( $day )); @@ -2472,11 +2472,14 @@ class calendarComponent { if( in_array( substr( $week, 0, 1 ), array( '+', '-' ))) $week = substr( $week, 1 ); $this->duration = array( 'value' => $this->_duration_string( $week ), 'params' => $this->_setParams( $day )); + } elseif (empty( $week ) && empty( $day ) && empty( $hour ) && empty( $min ) && empty( $sec )) { + return false; + } else { + $this->duration = array( + 'value' => $this->_duration_array(array($week, $day, $hour, $min, $sec)), + 'params' => $this->_setParams($params) + ); } - elseif( empty( $week ) && empty( $day ) && empty( $hour ) && empty( $min ) && empty( $sec )) - return FALSE; - else - $this->duration = array( 'value' => $this->_duration_array( array( $week, $day, $hour, $min, $sec )), 'params' => $this->_setParams( $params )); return TRUE; } /*********************************************************************************/ @@ -2530,8 +2533,8 @@ class calendarComponent { * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-05 * @param array exdates - * @param array $params, optional - * @param integer $index, optional + * @param array $params optional + * @param integer $index optional * @return bool */ function setExdate( $exdates, $params=FALSE, $index=FALSE ) { @@ -2595,8 +2598,8 @@ class calendarComponent { * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-05 * @param array $exruleset - * @param array $params, optional - * @param integer $index, optional + * @param array $params optional + * @param integer $index optional * @return bool */ function setExrule( $exruleset, $params=FALSE, $index=FALSE ) { @@ -2667,8 +2670,8 @@ class calendarComponent { * @since 2.5.1 - 2008-11-05 * @param string $fbType * @param array $fbValues - * @param array $params, optional - * @param integer $index, optional + * @param array $params optional + * @param integer $index optional * @return bool */ function setFreebusy( $fbType, $fbValues, $params=FALSE, $index=FALSE ) { @@ -2751,7 +2754,7 @@ class calendarComponent { * @param array $params optional * @return bool */ - function setGeo( $latitude, $longitude, $params=FALSE ) { + function setGeo( $latitude, $longitude, $params=array() ) { if( !empty( $latitude ) && !empty( $longitude )) { if( !is_array( $this->geo )) $this->geo = array(); $this->geo['value']['latitude'] = $latitude; @@ -2933,7 +2936,7 @@ class calendarComponent { * @param array $params optional * @return bool */ - function setPriority( $value, $params=FALSE ) { + function setPriority( $value, $params=array() ) { if( empty( $value )) if( $this->getConfig( 'allowEmpty' )) $value = null; else return FALSE; $this->priority = array( 'value' => $value, 'params' => $this->_setParams( $params )); return TRUE; @@ -3044,8 +3047,8 @@ class calendarComponent { * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-07 * @param array $rdates - * @param array $params, optional - * @param integer $index, optional + * @param array $params optional + * @param integer $index optional * @return bool */ function setRdate( $rdates, $params=FALSE, $index=FALSE ) { @@ -3215,8 +3218,8 @@ class calendarComponent { * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-07 * @param float $relid - * @param array $params, optional - * @param index $index, optional + * @param array $params optional + * @param index $index optional * @return bool */ function setRelatedTo( $value, $params=FALSE, $index=FALSE ) { @@ -3293,9 +3296,9 @@ class calendarComponent { * @since 2.5.1 - 2008-11-05 * @param float $statcode * @param string $text - * @param string $extdata, optional - * @param array $params, optional - * @param integer $index, optional + * @param string $extdata optional + * @param array $params optional + * @param integer $index optional * @return bool */ function setRequestStatus( $statcode, $text, $extdata=FALSE, $params=FALSE, $index=FALSE ) { @@ -3343,8 +3346,8 @@ class calendarComponent { * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-05 * @param mixed $value - * @param array $params, optional - * @param integer $index, optional + * @param array $params optional + * @param integer $index optional * @return bool */ function setResources( $value, $params=FALSE, $index=FALSE ) { @@ -3373,8 +3376,8 @@ class calendarComponent { * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-05 * @param array $rruleset - * @param array $params, optional - * @param integer $index, optional + * @param array $params optional + * @param integer $index optional * @return void */ function setRrule( $rruleset, $params=FALSE, $index=FALSE ) { @@ -3703,8 +3706,8 @@ class calendarComponent { * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-05 * @param string $value - * @param string $params, optional - * @param integer $index, optional + * @param string $params optional + * @param integer $index optional * @return bool */ function setTzname( $value, $params=FALSE, $index=FALSE ) { @@ -4139,9 +4142,9 @@ class calendarComponent { * * @author Kjell-Inge Gustafsson * @since 2.4.16 - 2008-10-25 - * @param array $date, date to check - * @param int $parno, no of date parts (i.e. year, month.. .) - * @return array $params, property parameters + * @param array $date date to check + * @param int $parno no of date parts (i.e. year, month.. .) + * @return array $params property parameters */ function _chkdatecfg( $theDate, & $parno, & $params ) { if( isset( $params['TZID'] )) @@ -4194,8 +4197,8 @@ class calendarComponent { * * @author Kjell-Inge Gustafsson * @since 2.2.11 - 2007-11-03 - * @param array $startdate, optional - * @param array $duration, optional + * @param array $startdate optional + * @param array $duration optional * @return array duration */ function _date2duration( $startdate=FALSE, $enddate=FALSE ) { @@ -4473,8 +4476,8 @@ class calendarComponent { * * @author Kjell-Inge Gustafsson * @since 2.4.8 - 2008-10-30 - * @param array $startdate, optional - * @param array $duration, optional + * @param array $startdate optional + * @param array $duration optional * @return array date format */ function duration2date( $startdate=FALSE, $duration=FALSE ) { @@ -4574,8 +4577,8 @@ class calendarComponent { * @author Kjell-Inge Gustafsson * @since 2.4.16 - 2008-11-08 * @param array $array - * @param string $expkey, expected key - * @param string $expval, expected value + * @param string $expkey expected key + * @param string $expval expected value * @param int $hitVal optional, return value if found * @param int $elseVal optional, return value if not found * @param int $preSet optional, return value if already preset @@ -4602,7 +4605,7 @@ class calendarComponent { * @author Kjell-Inge Gustafsson * @since 2.4.8 - 2008-10-30 * @param array $datetime - * @param int $parno, optional, default 6 + * @param int $parno optional, default 6 * @return string */ function _format_date_time( $datetime, $parno=6 ) { @@ -4877,11 +4880,11 @@ class calendarComponent { * * @author Kjell-Inge Gustafsson * @since 2.4.16 - 2008-10-18 - * @param array $result, array to update, array([timestamp] => timestamp) - * @param array $recur, pattern for recurrency (only value part, params ignored) - * @param array $wdate, component start date - * @param array $startdate, start date - * @param array $enddate, optional + * @param array $result array to update, array([timestamp] => timestamp) + * @param array $recur pattern for recurrency (only value part, params ignored) + * @param array $wdate component start date + * @param array $startdate start date + * @param array $enddate optional * @return array of recurrence (start-)dates as index * @todo BYHOUR, BYMINUTE, BYSECOND, ev. BYSETPOS due to ambiguity, WEEKLY at year end/start */ @@ -5489,9 +5492,9 @@ class calendarComponent { * * @author Kjell-Inge Gustafsson * @since 2.4.16 - 2008-10-18 - * @param array $date, date to step + * @param array $date date to step * @param int $timestamp - * @param array $step, default array( 'day' => 1 ) + * @param array $step default array( 'day' => 1 ) * @return void */ function _stepdate( &$date, &$timestamp, $step=array( 'day' => 1 )) { @@ -5719,7 +5722,7 @@ class calendarComponent { * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-14 * @param string $propName - * @param int @propix, optional, if specific property is wanted in case of multiply occurences + * @param int $propix optional, if specific property is wanted in case of multiply occurences * @return bool if successfull delete TRUE */ function deleteProperty( $propName, $propix=FALSE ) { @@ -5979,8 +5982,8 @@ class calendarComponent { * * @author Kjell-Inge Gustafsson * @since 2.4.5 - 2008-11-07 - * @param array $multiprop, reference to a component property - * @param int @propix, default 0 + * @param array $multiprop reference to a component property + * @param int $propix default 0 * @return bool TRUE */ function deletePropertyM( & $multiprop, $propix=0 ) { @@ -5996,10 +5999,10 @@ class calendarComponent { * * @author Kjell-Inge Gustafsson * @since 2.5.1 - 2008-11-02 - * @param string $propName, optional - * @param int @propix, optional, if specific property is wanted in case of multiply occurences - * @param bool $inclParam=FALSE - * @param bool $specform=FALSE + * @param string $propName optional + * @param int $propix optional, if specific property is wanted in case of multiply occurences + * @param bool $inclParam =FALSE + * @param bool $specform =FALSE * @return mixed */ function getProperty( $propName=FALSE, $propix=FALSE, $inclParam=FALSE, $specform=FALSE ) { @@ -6307,7 +6310,7 @@ class calendarComponent { * * @author Kjell-Inge Gustafsson * @since 2.5.2 - 2008-10-23 - * @param mixed $unparsedtext, optional, strict rfc2445 formatted, single property string or array of property strings + * @param mixed $unparsedtext optional, strict rfc2445 formatted, single property string or array of property strings * @return bool FALSE if error occurs during parsing * */ diff --git a/main/inc/lib/image.lib.php b/main/inc/lib/image.lib.php index 0e5893fc83..1f83cd00b0 100755 --- a/main/inc/lib/image.lib.php +++ b/main/inc/lib/image.lib.php @@ -30,7 +30,8 @@ class Image } } - public function resize($max_size_for_picture) { + public function resize($max_size_for_picture) + { $image_size = $this->get_image_size($this->image_wrapper->path); $width = $image_size['width']; $height = $image_size['height']; @@ -49,7 +50,8 @@ class Image } } - public function crop($cropParameters) { + public function crop($cropParameters) + { $image_size = $this->get_image_size($this->image_wrapper->path); $src_width = $image_size['width']; $src_height = $image_size['height']; diff --git a/main/inc/lib/import.lib.php b/main/inc/lib/import.lib.php index 6231905773..7e59967241 100755 --- a/main/inc/lib/import.lib.php +++ b/main/inc/lib/import.lib.php @@ -61,7 +61,7 @@ class Import $resultArray = []; if ($csvReader) { - $workflow = new Workflow($csvReader); + $workflow = new Workflow\StepAggregator($csvReader); $writer = new ArrayWriter($resultArray); $workflow->addWriter($writer)->process(); } diff --git a/main/inc/lib/internationalization.lib.php b/main/inc/lib/internationalization.lib.php index fe432d6f3c..9db4bf2dd8 100755 --- a/main/inc/lib/internationalization.lib.php +++ b/main/inc/lib/internationalization.lib.php @@ -644,15 +644,19 @@ function api_format_date($time, $format = null, $language = null) * Example: $date = '2008-03-07 15:44:08'; * date_to_str($date) it will return 3 days, 20 hours * The given date should be in the timezone chosen by the user or administrator. Use api_get_local_time() to get it... + * You can use it like this: + * Display::tip(date_to_str_ago($dateInUtc), api_get_local_time($dateInUtc)); + * + * @param string $date The string has to be the result of a date function in this format -> date('Y-m-d H:i:s', time()); + * @return string $timeZone * - * @param string The string has to be the result of a date function in this format -> date('Y-m-d H:i:s', time()); - * @return string The difference between the current date and the parameter in a literal way "3 days, 2 hour" * * @author Julio Montoya */ function date_to_str_ago($date, $timeZone = 'UTC') { - if ($date == '0000-00-00 00:00:00') { + if ($date === '0000-00-00 00:00:00') { + return ''; } @@ -1048,7 +1052,7 @@ function api_transliterate($string, $unknown = '?', $from_encoding = null) * @link http://php.net/manual/en/function.ord.php * Note the difference with the original funtion ord(): ord('') returns 0, api_ord('') returns 0xFFFD (unknown character). */ -function api_ord($character, $encoding) { +function api_ord($character, $encoding = null) { return Patchwork\Utf8::ord(api_utf8_encode($character, $encoding)); } @@ -1965,15 +1969,15 @@ function _api_convert_encoding_supports($encoding) { function apiGetHumanDateTime($date, $showTime = true, $humanForm = false) { if ($showTime) { if ($humanForm) { - return $date->format('j M Y H:i:s'); + return $date->format('j M Y H:i:s'); } else { - return $date->format('Y-m-d H:i:s'); + return $date->format('Y-m-d H:i:s'); } } else { if ($humanForm) { - return $date->format('j M Y'); + return $date->format('j M Y'); } else { - return $date->format('Y-m-d'); + return $date->format('Y-m-d'); } } } diff --git a/main/inc/lib/javascript/hotspot/js/hotspot.js b/main/inc/lib/javascript/hotspot/js/hotspot.js index 96f85972b2..6375d964fd 100755 --- a/main/inc/lib/javascript/hotspot/js/hotspot.js +++ b/main/inc/lib/javascript/hotspot/js/hotspot.js @@ -1139,13 +1139,13 @@ window.HotspotQuestion = (function () { switch (config.for) { case 'admin': - xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript_admin.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercise/hotspot_actionscript_admin.as.php', { modifyAnswers: parseInt(config.questionId) }); break; case 'user': - xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercise/hotspot_actionscript.as.php', { modifyAnswers: parseInt(config.questionId), exe_id: parseInt(config.exerciseId) }); @@ -1154,7 +1154,7 @@ window.HotspotQuestion = (function () { case 'solution': //no break case 'preview': - xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_answers.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercise/hotspot_answers.as.php', { modifyAnswers: parseInt(config.questionId), exe_id: parseInt(config.exerciseId) }); @@ -1763,13 +1763,13 @@ window.DelineationQuestion = (function () { switch (config.for) { case 'admin': - xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript_admin.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercise/hotspot_actionscript_admin.as.php', { modifyAnswers: parseInt(config.questionId) }); break; case 'user': - xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercise/hotspot_actionscript.as.php', { modifyAnswers: parseInt(config.questionId) }); break; @@ -1777,7 +1777,7 @@ window.DelineationQuestion = (function () { case 'solution': //no break case 'preview': - xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_answers.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercise/hotspot_answers.as.php', { modifyAnswers: parseInt(config.questionId), exe_id: parseInt(config.exerciseId) }); diff --git a/main/inc/lib/javascript/jquery-textcomplete/jquery.textcomplete.js b/main/inc/lib/javascript/jquery-textcomplete/jquery.textcomplete.js index 47304c3e5c..770c2b9070 100644 --- a/main/inc/lib/javascript/jquery-textcomplete/jquery.textcomplete.js +++ b/main/inc/lib/javascript/jquery-textcomplete/jquery.textcomplete.js @@ -1,553 +1,1483 @@ +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if (typeof module === "object" && module.exports) { + var $ = require('jquery'); + module.exports = factory($); + } else { + // Browser globals + factory(jQuery); + } +}(function (jQuery) { + /*! - * jQuery.textcomplete.js + * jQuery.textcomplete * - * Repositiory: https://github.com/yuku-t/jquery-textcomplete - * License: MIT - * Author: Yuku Takahashi + * Repository: https://github.com/yuku-t/jquery-textcomplete + * License: MIT (https://github.com/yuku-t/jquery-textcomplete/blob/master/LICENSE) + * Author: Yuku Takahashi */ -;(function ($) { - - 'use strict'; - - /** - * Exclusive execution control utility. - */ - var lock = function (func) { - var free, locked; - free = function () { locked = false; }; - return function () { - var args; - if (locked) return; - locked = true; - args = toArray(arguments); - args.unshift(free); - func.apply(this, args); - }; - }; +if (typeof jQuery === 'undefined') { + throw new Error('jQuery.textcomplete requires jQuery'); +} - /** - * Convert arguments into a real array. - */ - var toArray = function (args) { - var result; - result = Array.prototype.slice.call(args); - return result; - }; ++function ($) { + 'use strict'; - /** - * Get the styles of any element from property names. - */ - var getStyles = (function () { - var color; - color = $('

    ').css(['color']).color; - if (typeof color !== 'undefined') { - return function ($el, properties) { - return $el.css(properties); - }; - } else { // for jQuery 1.8 or below - return function ($el, properties) { - var styles; - styles = {}; - $.each(properties, function (i, property) { - styles[property] = $el.css(property); - }); - return styles; - }; + var warn = function (message) { + if (console.warn) { console.warn(message); } + }; + + var id = 1; + + $.fn.textcomplete = function (strategies, option) { + var args = Array.prototype.slice.call(arguments); + return this.each(function () { + var self = this; + var $this = $(this); + var completer = $this.data('textComplete'); + if (!completer) { + option || (option = {}); + option._oid = id++; // unique object id + completer = new $.fn.textcomplete.Completer(this, option); + $this.data('textComplete', completer); + } + if (typeof strategies === 'string') { + if (!completer) return; + args.shift() + completer[strategies].apply(completer, args); + if (strategies === 'destroy') { + $this.removeData('textComplete'); } - })(); - - /** - * Default template function. - */ - var identity = function (obj) { return obj; }; - - /** - * Memoize a search function. - */ - var memoize = function (func) { - var memo = {}; - return function (term, callback) { - if (memo[term]) { - callback(memo[term]); - } else { - func.call(this, term, function (data) { - memo[term] = (memo[term] || []).concat(data); - callback.apply(null, arguments); - }); + } else { + // For backward compatibility. + // TODO: Remove at v0.4 + $.each(strategies, function (obj) { + $.each(['header', 'footer', 'placement', 'maxCount'], function (name) { + if (obj[name]) { + completer.option[name] = obj[name]; + warn(name + 'as a strategy param is deprecated. Use option.'); + delete obj[name]; } - }; - }; + }); + }); + completer.register($.fn.textcomplete.Strategy.parse(strategies, { + el: self, + $el: $this + })); + } + }); + }; + +}(jQuery); + ++function ($) { + 'use strict'; + + // Exclusive execution control utility. + // + // func - The function to be locked. It is executed with a function named + // `free` as the first argument. Once it is called, additional + // execution are ignored until the free is invoked. Then the last + // ignored execution will be replayed immediately. + // + // Examples + // + // var lockedFunc = lock(function (free) { + // setTimeout(function { free(); }, 1000); // It will be free in 1 sec. + // console.log('Hello, world'); + // }); + // lockedFunc(); // => 'Hello, world' + // lockedFunc(); // none + // lockedFunc(); // none + // // 1 sec past then + // // => 'Hello, world' + // lockedFunc(); // => 'Hello, world' + // lockedFunc(); // none + // + // Returns a wrapped function. + var lock = function (func) { + var locked, queuedArgsToReplay; - /** - * Determine if the array contains a given value. - */ - var include = function (array, value) { - var i, l; - if (array.indexOf) return array.indexOf(value) != -1; - for (i = 0, l = array.length; i < l; i++) { - if (array[i] === value) return true; + return function () { + // Convert arguments into a real array. + var args = Array.prototype.slice.call(arguments); + if (locked) { + // Keep a copy of this argument list to replay later. + // OK to overwrite a previous value because we only replay + // the last one. + queuedArgsToReplay = args; + return; + } + locked = true; + var self = this; + args.unshift(function replayOrFree() { + if (queuedArgsToReplay) { + // Other request(s) arrived while we were locked. + // Now that the lock is becoming available, replay + // the latest such request, then call back here to + // unlock (or replay another request that arrived + // while this one was in flight). + var replayArgs = queuedArgsToReplay; + queuedArgsToReplay = undefined; + replayArgs.unshift(replayOrFree); + func.apply(self, replayArgs); + } else { + locked = false; } - return false; + }); + func.apply(this, args); }; + }; - /** - * Textarea manager class. - */ - var Completer = (function () { - var html, css, $baseWrapper, $baseList, _id; + var isString = function (obj) { + return Object.prototype.toString.call(obj) === '[object String]'; + }; - html = { - wrapper: '
    ', - list: '' - }; - css = { - wrapper: { - position: 'relative' - }, - list: { - position: 'absolute', - top: 0, - left: 0, - zIndex: '100', - display: 'none' - } - }; - $baseWrapper = $(html.wrapper).css(css.wrapper); - $baseList = $(html.list).css(css.list); - _id = 0; - - function Completer($el) { - var focus; - this.el = $el.get(0); // textarea element - focus = this.el === document.activeElement; - // Cannot wrap $el at initialize method lazily due to Firefox's behavior. - this.$el = wrapElement($el); // Focus is lost - this.id = 'textComplete' + _id++; - this.strategies = []; - if (focus) { - this.initialize(); - this.$el.focus(); - } else { - this.$el.one('focus.textComplete', $.proxy(this.initialize, this)); + var isFunction = function (obj) { + return Object.prototype.toString.call(obj) === '[object Function]'; + }; + + var uniqueId = 0; + + function Completer(element, option) { + this.$el = $(element); + this.id = 'textcomplete' + uniqueId++; + this.strategies = []; + this.views = []; + this.option = $.extend({}, Completer._getDefaults(), option); + + if (!this.$el.is('input[type=text]') && !this.$el.is('input[type=search]') && !this.$el.is('textarea') && !element.isContentEditable && element.contentEditable != 'true') { + throw new Error('textcomplete must be called on a Textarea or a ContentEditable.'); + } + + // use ownerDocument to fix iframe / IE issues + if (element === element.ownerDocument.activeElement) { + // element has already been focused. Initialize view objects immediately. + this.initialize() + } else { + // Initialize view objects lazily. + var self = this; + this.$el.one('focus.' + this.id, function () { self.initialize(); }); + + // Special handling for CKEditor: lazy init on instance load + if ((!this.option.adapter || this.option.adapter == 'CKEditor') && typeof CKEDITOR != 'undefined' && (this.$el.is('textarea'))) { + CKEDITOR.on("instanceReady", function(event) { + event.editor.once("focus", function(event2) { + // replace the element with the Iframe element and flag it as CKEditor + self.$el = $(event.editor.editable().$); + if (!self.option.adapter) { + self.option.adapter = $.fn.textcomplete['CKEditor']; } + self.initialize(); + }); + }); + } + } + } + + Completer._getDefaults = function () { + if (!Completer.DEFAULTS) { + Completer.DEFAULTS = { + appendTo: $('body'), + className: '', // deprecated option + dropdownClassName: 'dropdown-menu textcomplete-dropdown', + maxCount: 10, + zIndex: '100' + }; + } + + return Completer.DEFAULTS; + } + + $.extend(Completer.prototype, { + // Public properties + // ----------------- + + id: null, + option: null, + strategies: null, + adapter: null, + dropdown: null, + $el: null, + $iframe: null, + + // Public methods + // -------------- + + initialize: function () { + var element = this.$el.get(0); + + // check if we are in an iframe + // we need to alter positioning logic if using an iframe + if (this.$el.prop('ownerDocument') !== document && window.frames.length) { + for (var iframeIndex = 0; iframeIndex < window.frames.length; iframeIndex++) { + if (this.$el.prop('ownerDocument') === window.frames[iframeIndex].document) { + this.$iframe = $(window.frames[iframeIndex].frameElement); + break; + } } + } + + + // Initialize view objects. + this.dropdown = new $.fn.textcomplete.Dropdown(element, this, this.option); + var Adapter, viewName; + if (this.option.adapter) { + Adapter = this.option.adapter; + } else { + if (this.$el.is('textarea') || this.$el.is('input[type=text]') || this.$el.is('input[type=search]')) { + viewName = typeof element.selectionEnd === 'number' ? 'Textarea' : 'IETextarea'; + } else { + viewName = 'ContentEditable'; + } + Adapter = $.fn.textcomplete[viewName]; + } + this.adapter = new Adapter(element, this, this.option); + }, - /** - * Completer's public methods - */ - $.extend(Completer.prototype, { - - /** - * Prepare ListView and bind events. - */ - initialize: function () { - var $list, globalEvents; - $list = $baseList.clone(); - this.listView = new ListView($list, this); - this.$el - .before($list) - .on({ - 'keyup.textComplete': $.proxy(this.onKeyup, this), - 'keydown.textComplete': $.proxy(this.listView.onKeydown, - this.listView) - }); - globalEvents = {}; - globalEvents['click.' + this.id] = $.proxy(this.onClickDocument, this); - globalEvents['keyup.' + this.id] = $.proxy(this.onKeyupDocument, this); - $(document).on(globalEvents); - }, - - /** - * Register strategies to the completer. - */ - register: function (strategies) { - this.strategies = this.strategies.concat(strategies); - }, - - /** - * Show autocomplete list next to the caret. - */ - renderList: function (data) { - if (this.clearAtNext) { - this.listView.clear(); - this.clearAtNext = false; - } - if (data.length) { - if (!this.listView.shown) { - this.listView - .setPosition(this.getCaretPosition()) - .clear() - .activate(); - this.listView.strategy = this.strategy; - } - data = data.slice(0, this.strategy.maxCount); - this.listView.render(data); - } - - if (!this.listView.data.length && this.listView.shown) { - this.listView.deactivate(); - } - }, - - searchCallbackFactory: function (free) { - var self = this; - return function (data, keep) { - self.renderList(data); - if (!keep) { - // This is the last callback for this search. - free(); - self.clearAtNext = true; - } - }; - }, - - /** - * Keyup event handler. - */ - onKeyup: function (e) { - var searchQuery, term; - if (this.skipSearch(e)) { return; } - - searchQuery = this.extractSearchQuery(this.getTextFromHeadToCaret()); - if (searchQuery.length) { - term = searchQuery[1]; - if (this.term === term) return; // Ignore shift-key or something. - this.term = term; - this.search(searchQuery); - } else { - this.term = null; - this.listView.deactivate(); - } - }, - - /** - * Suppress searching if it returns true. - */ - skipSearch: function (e) { - if (this.skipNextKeyup) { - this.skipNextKeyup = false; - return true; - } - switch (e.keyCode) { - case 40: - case 38: - return true; - } - }, - - onSelect: function (value) { - var pre, post, newSubStr; - pre = this.getTextFromHeadToCaret(); - post = this.el.value.substring(this.el.selectionEnd); - - newSubStr = this.strategy.replace(value); - if ($.isArray(newSubStr)) { - post = newSubStr[1] + post; - newSubStr = newSubStr[0]; - } - pre = pre.replace(this.strategy.match, newSubStr); - this.$el.val(pre + post) - .trigger('change') - .trigger('textComplete:select', value); - this.el.focus(); - this.el.selectionStart = this.el.selectionEnd = pre.length; - this.skipNextKeyup = true; - }, - - /** - * Global click event handler. - */ - onClickDocument: function (e) { - if (e.originalEvent && !e.originalEvent.keepTextCompleteDropdown) { - this.listView.deactivate(); - } - }, - - /** - * Global keyup event handler. - */ - onKeyupDocument: function (e) { - if (this.listView.shown && e.keyCode === 27) { // ESC - this.listView.deactivate(); - this.$el.focus(); - } - }, - - /** - * Remove all event handlers and the wrapper element. - */ - destroy: function () { - var $wrapper; - this.$el.off('.textComplete'); - $(document).off('.' + this.id); - if (this.listView) { this.listView.destroy(); } - $wrapper = this.$el.parent(); - $wrapper.after(this.$el).remove(); - this.$el.data('textComplete', void 0); - this.$el = null; - }, - - // Helper methods - // ============== - - /** - * Returns caret's relative coordinates from textarea's left top corner. - */ - getCaretPosition: function () { - // Browser native API does not provide the way to know the position of - // caret in pixels, so that here we use a kind of hack to accomplish - // the aim. First of all it puts a div element and completely copies - // the textarea's style to the element, then it inserts the text and a - // span element into the textarea. - // Consequently, the span element's position is the thing what we want. - - if (this.el.selectionEnd === 0) return; - var properties, css, $div, $span, position, dir; - - dir = this.$el.attr('dir') || this.$el.css('direction'); - properties = ['border-width', 'font-family', 'font-size', 'font-style', - 'font-variant', 'font-weight', 'height', 'letter-spacing', - 'word-spacing', 'line-height', 'text-decoration', 'text-align', - 'width', 'padding-top', 'padding-right', 'padding-bottom', - 'padding-left', 'margin-top', 'margin-right', 'margin-bottom', - 'margin-left' - ]; - css = $.extend({ - position: 'absolute', - overflow: 'auto', - 'white-space': 'pre-wrap', - top: 0, - left: -9999, - direction: dir - }, getStyles(this.$el, properties)); - - $div = $('
    ').css(css).text(this.getTextFromHeadToCaret()); - $span = $('').text('.').appendTo($div); - this.$el.before($div); - position = $span.position(); - position.top += $span.height() - this.$el.scrollTop(); - if (dir === 'rtl') { position.left -= this.listView.$el.width(); } - $div.remove(); - return position; - }, - - getTextFromHeadToCaret: function () { - var text, selectionEnd, range; - selectionEnd = this.el.selectionEnd; - if (typeof selectionEnd === 'number') { - text = this.el.value.substring(0, selectionEnd); - } else if (document.selection) { - range = this.el.createTextRange(); - range.moveStart('character', 0); - range.moveEnd('textedit'); - text = range.text; - } - return text; - }, - - /** - * Parse the value of textarea and extract search query. - */ - extractSearchQuery: function (text) { - // If a search query found, it returns used strategy and the query - // term. If the caret is currently in a code block or search query does - // not found, it returns an empty array. - - var i, l, strategy, match; - for (i = 0, l = this.strategies.length; i < l; i++) { - strategy = this.strategies[i]; - match = text.match(strategy.match); - if (match) { return [strategy, match[strategy.index]]; } - } - return []; - }, - - search: lock(function (free, searchQuery) { - var term; - this.strategy = searchQuery[0]; - term = searchQuery[1]; - this.strategy.search(term, this.searchCallbackFactory(free)); - }) - }); + destroy: function () { + this.$el.off('.' + this.id); + if (this.adapter) { + this.adapter.destroy(); + } + if (this.dropdown) { + this.dropdown.destroy(); + } + this.$el = this.adapter = this.dropdown = null; + }, - /** - * Completer's private functions - */ - var wrapElement = function ($el) { - return $el.wrap($baseWrapper.clone().css('display', $el.css('display'))); - }; + deactivate: function () { + if (this.dropdown) { + this.dropdown.deactivate(); + } + }, + + // Invoke textcomplete. + trigger: function (text, skipUnchangedTerm) { + if (!this.dropdown) { this.initialize(); } + text != null || (text = this.adapter.getTextFromHeadToCaret()); + var searchQuery = this._extractSearchQuery(text); + if (searchQuery.length) { + var term = searchQuery[1]; + // Ignore shift-key, ctrl-key and so on. + if (skipUnchangedTerm && this._term === term && term !== "") { return; } + this._term = term; + this._search.apply(this, searchQuery); + } else { + this._term = null; + this.dropdown.deactivate(); + } + }, + + fire: function (eventName) { + var args = Array.prototype.slice.call(arguments, 1); + this.$el.trigger(eventName, args); + return this; + }, - return Completer; - })(); + register: function (strategies) { + Array.prototype.push.apply(this.strategies, strategies); + }, - /** - * Dropdown menu manager class. - */ - var ListView = (function () { + // Insert the value into adapter view. It is called when the dropdown is clicked + // or selected. + // + // value - The selected element of the array callbacked from search func. + // strategy - The Strategy object. + // e - Click or keydown event object. + select: function (value, strategy, e) { + this._term = null; + this.adapter.select(value, strategy, e); + this.fire('change').fire('textComplete:select', value, strategy); + this.adapter.focus(); + }, - function ListView($el, completer) { - this.data = []; - this.$el = $el; - this.index = 0; - this.completer = completer; + // Private properties + // ------------------ - this.$el.on('click.textComplete', 'li.textcomplete-item', - $.proxy(this.onClick, this)); + _clearAtNext: true, + _term: null, + + // Private methods + // --------------- + + // Parse the given text and extract the first matching strategy. + // + // Returns an array including the strategy, the query term and the match + // object if the text matches an strategy; otherwise returns an empty array. + _extractSearchQuery: function (text) { + for (var i = 0; i < this.strategies.length; i++) { + var strategy = this.strategies[i]; + var context = strategy.context(text); + if (context || context === '') { + var matchRegexp = isFunction(strategy.match) ? strategy.match(text) : strategy.match; + if (isString(context)) { text = context; } + var match = text.match(matchRegexp); + if (match) { return [strategy, match[strategy.index], match]; } } + } + return [] + }, - $.extend(ListView.prototype, { - shown: false, - - render: function (data) { - var html, i, l, index, val; - - html = ''; - for (i = 0, l = data.length; i < l; i++) { - val = data[i]; - if (include(this.data, val)) continue; - index = this.data.length; - this.data.push(val); - html += '
  • '; - html += this.strategy.template(val); - html += '
  • '; - if (this.data.length === this.strategy.maxCount) break; - } - this.$el.append(html); - if (!this.data.length) { - this.deactivate(); - } else { - this.activateIndexedItem(); - } - }, - - clear: function () { - this.data = []; - this.$el.html(''); - this.index = 0; - return this; - }, - - activateIndexedItem: function () { - this.$el.find('.active').removeClass('active'); - this.getActiveItem().addClass('active'); - }, - - getActiveItem: function () { - return $(this.$el.children().get(this.index)); - }, - - activate: function () { - if (!this.shown) { - this.$el.show(); - this.completer.$el.trigger('textComplete:show'); - this.shown = true; - } - return this; - }, - - deactivate: function () { - if (this.shown) { - this.$el.hide(); - this.completer.$el.trigger('textComplete:hide'); - this.shown = false; - this.data = this.index = null; - } - return this; - }, - - setPosition: function (position) { - this.$el.css(position); - return this; - }, - - select: function (index) { - var self = this; - this.completer.onSelect(this.data[index]); - // Deactive at next tick to allow other event handlers to know whether - // the dropdown has been shown or not. - setTimeout(function () { self.deactivate(); }, 0); - }, - - onKeydown: function (e) { - if (!this.shown) return; - if (e.keyCode === 38) { // UP - e.preventDefault(); - if (this.index === 0) { - this.index = this.data.length-1; - } else { - this.index -= 1; - } - this.activateIndexedItem(); - } else if (e.keyCode === 40) { // DOWN - e.preventDefault(); - if (this.index === this.data.length - 1) { - this.index = 0; - } else { - this.index += 1; - } - this.activateIndexedItem(); - } else if (e.keyCode === 13 || e.keyCode === 9) { // ENTER or TAB - e.preventDefault(); - this.select(parseInt(this.getActiveItem().data('index'), 10)); - } - }, - - onClick: function (e) { - var $e = $(e.target); - e.originalEvent.keepTextCompleteDropdown = true; - if (!$e.hasClass('textcomplete-item')) { - $e = $e.parents('li.textcomplete-item'); - } - this.select(parseInt($e.data('index'), 10)); - }, - - destroy: function () { - this.deactivate(); - this.$el.off('click.textComplete').remove(); - this.$el = null; - } - }); + // Call the search method of selected strategy.. + _search: lock(function (free, strategy, term, match) { + var self = this; + strategy.search(term, function (data, stillSearching) { + if (!self.dropdown.shown) { + self.dropdown.activate(); + } + if (self._clearAtNext) { + // The first callback in the current lock. + self.dropdown.clear(); + self._clearAtNext = false; + } + self.dropdown.setPosition(self.adapter.getCaretPosition()); + self.dropdown.render(self._zip(data, strategy, term)); + if (!stillSearching) { + // The last callback in the current lock. + free(); + self._clearAtNext = true; // Call dropdown.clear at the next time. + } + }, match); + }), - return ListView; - })(); + // Build a parameter for Dropdown#render. + // + // Examples + // + // this._zip(['a', 'b'], 's'); + // //=> [{ value: 'a', strategy: 's' }, { value: 'b', strategy: 's' }] + _zip: function (data, strategy, term) { + return $.map(data, function (value) { + return { value: value, strategy: strategy, term: term }; + }); + } + }); - $.fn.textcomplete = function (strategies) { - var i, l, strategy, dataKey; + $.fn.textcomplete.Completer = Completer; +}(jQuery); - dataKey = 'textComplete'; ++function ($) { + 'use strict'; - if (strategies === 'destroy') { - return this.each(function () { - var completer = $(this).data(dataKey); - if (completer) { completer.destroy(); } - }); + var $window = $(window); + + var include = function (zippedData, datum) { + var i, elem; + var idProperty = datum.strategy.idProperty + for (i = 0; i < zippedData.length; i++) { + elem = zippedData[i]; + if (elem.strategy !== datum.strategy) continue; + if (idProperty) { + if (elem.value[idProperty] === datum.value[idProperty]) return true; + } else { + if (elem.value === datum.value) return true; + } + } + return false; + }; + + var dropdownViews = {}; + $(document).on('click', function (e) { + var id = e.originalEvent && e.originalEvent.keepTextCompleteDropdown; + $.each(dropdownViews, function (key, view) { + if (key !== id) { view.deactivate(); } + }); + }); + + var commands = { + SKIP_DEFAULT: 0, + KEY_UP: 1, + KEY_DOWN: 2, + KEY_ENTER: 3, + KEY_PAGEUP: 4, + KEY_PAGEDOWN: 5, + KEY_ESCAPE: 6 + }; + + // Dropdown view + // ============= + + // Construct Dropdown object. + // + // element - Textarea or contenteditable element. + function Dropdown(element, completer, option) { + this.$el = Dropdown.createElement(option); + this.completer = completer; + this.id = completer.id + 'dropdown'; + this._data = []; // zipped data. + this.$inputEl = $(element); + this.option = option; + + // Override setPosition method. + if (option.listPosition) { this.setPosition = option.listPosition; } + if (option.height) { this.$el.height(option.height); } + var self = this; + $.each(['maxCount', 'placement', 'footer', 'header', 'noResultsMessage', 'className'], function (_i, name) { + if (option[name] != null) { self[name] = option[name]; } + }); + this._bindEvents(element); + dropdownViews[this.id] = this; + } + + $.extend(Dropdown, { + // Class methods + // ------------- + + createElement: function (option) { + var $parent = option.appendTo; + if (!($parent instanceof $)) { $parent = $($parent); } + var $el = $('
      ') + .addClass(option.dropdownClassName) + .attr('id', 'textcomplete-dropdown-' + option._oid) + .css({ + display: 'none', + left: 0, + position: 'absolute', + zIndex: option.zIndex + }) + .appendTo($parent); + return $el; + } + }); + + $.extend(Dropdown.prototype, { + // Public properties + // ----------------- + + $el: null, // jQuery object of ul.dropdown-menu element. + $inputEl: null, // jQuery object of target textarea. + completer: null, + footer: null, + header: null, + id: null, + maxCount: null, + placement: '', + shown: false, + data: [], // Shown zipped data. + className: '', + + // Public methods + // -------------- + + destroy: function () { + // Don't remove $el because it may be shared by several textcompletes. + this.deactivate(); + + this.$el.off('.' + this.id); + this.$inputEl.off('.' + this.id); + this.clear(); + this.$el.remove(); + this.$el = this.$inputEl = this.completer = null; + delete dropdownViews[this.id] + }, + + render: function (zippedData) { + var contentsHtml = this._buildContents(zippedData); + var unzippedData = $.map(this.data, function (d) { return d.value; }); + if (this.data.length) { + var strategy = zippedData[0].strategy; + if (strategy.id) { + this.$el.attr('data-strategy', strategy.id); + } else { + this.$el.removeAttr('data-strategy'); } + this._renderHeader(unzippedData); + this._renderFooter(unzippedData); + if (contentsHtml) { + this._renderContents(contentsHtml); + this._fitToBottom(); + this._fitToRight(); + this._activateIndexedItem(); + } + this._setScroll(); + } else if (this.noResultsMessage) { + this._renderNoResultsMessage(unzippedData); + } else if (this.shown) { + this.deactivate(); + } + }, - for (i = 0, l = strategies.length; i < l; i++) { - strategy = strategies[i]; - if (!strategy.template) { - strategy.template = identity; - } - if (strategy.index == null) { - strategy.index = 2; - } - if (strategy.cache) { - strategy.search = memoize(strategy.search); - } - strategy.maxCount || (strategy.maxCount = 10); + setPosition: function (pos) { + // Make the dropdown fixed if the input is also fixed + // This can't be done during init, as textcomplete may be used on multiple elements on the same page + // Because the same dropdown is reused behind the scenes, we need to recheck every time the dropdown is showed + var position = 'absolute'; + // Check if input or one of its parents has positioning we need to care about + this.$inputEl.add(this.$inputEl.parents()).each(function() { + if($(this).css('position') === 'absolute') // The element has absolute positioning, so it's all OK + return false; + if($(this).css('position') === 'fixed') { + pos.top -= $window.scrollTop(); + pos.left -= $window.scrollLeft(); + position = 'fixed'; + return false; } + }); + this.$el.css(this._applyPlacement(pos)); + this.$el.css({ position: position }); // Update positioning - return this.each(function () { - var $this, completer; - $this = $(this); - completer = $this.data(dataKey); - if (!completer) { - completer = new Completer($this); - $this.data(dataKey, completer); - } - completer.register(strategies); + return this; + }, + + clear: function () { + this.$el.html(''); + this.data = []; + this._index = 0; + this._$header = this._$footer = this._$noResultsMessage = null; + }, + + activate: function () { + if (!this.shown) { + this.clear(); + this.$el.show(); + if (this.className) { this.$el.addClass(this.className); } + this.completer.fire('textComplete:show'); + this.shown = true; + } + return this; + }, + + deactivate: function () { + if (this.shown) { + this.$el.hide(); + if (this.className) { this.$el.removeClass(this.className); } + this.completer.fire('textComplete:hide'); + this.shown = false; + } + return this; + }, + + isUp: function (e) { + return e.keyCode === 38 || (e.ctrlKey && e.keyCode === 80); // UP, Ctrl-P + }, + + isDown: function (e) { + return e.keyCode === 40 || (e.ctrlKey && e.keyCode === 78); // DOWN, Ctrl-N + }, + + isEnter: function (e) { + var modifiers = e.ctrlKey || e.altKey || e.metaKey || e.shiftKey; + return !modifiers && (e.keyCode === 13 || e.keyCode === 9 || (this.option.completeOnSpace === true && e.keyCode === 32)) // ENTER, TAB + }, + + isPageup: function (e) { + return e.keyCode === 33; // PAGEUP + }, + + isPagedown: function (e) { + return e.keyCode === 34; // PAGEDOWN + }, + + isEscape: function (e) { + return e.keyCode === 27; // ESCAPE + }, + + // Private properties + // ------------------ + + _data: null, // Currently shown zipped data. + _index: null, + _$header: null, + _$noResultsMessage: null, + _$footer: null, + + // Private methods + // --------------- + + _bindEvents: function () { + this.$el.on('mousedown.' + this.id, '.textcomplete-item', $.proxy(this._onClick, this)); + this.$el.on('touchstart.' + this.id, '.textcomplete-item', $.proxy(this._onClick, this)); + this.$el.on('mouseover.' + this.id, '.textcomplete-item', $.proxy(this._onMouseover, this)); + this.$inputEl.on('keydown.' + this.id, $.proxy(this._onKeydown, this)); + }, + + _onClick: function (e) { + var $el = $(e.target); + e.preventDefault(); + e.originalEvent.keepTextCompleteDropdown = this.id; + if (!$el.hasClass('textcomplete-item')) { + $el = $el.closest('.textcomplete-item'); + } + var datum = this.data[parseInt($el.data('index'), 10)]; + this.completer.select(datum.value, datum.strategy, e); + var self = this; + // Deactive at next tick to allow other event handlers to know whether + // the dropdown has been shown or not. + setTimeout(function () { + self.deactivate(); + if (e.type === 'touchstart') { + self.$inputEl.focus(); + } + }, 0); + }, + + // Activate hovered item. + _onMouseover: function (e) { + var $el = $(e.target); + e.preventDefault(); + if (!$el.hasClass('textcomplete-item')) { + $el = $el.closest('.textcomplete-item'); + } + this._index = parseInt($el.data('index'), 10); + this._activateIndexedItem(); + }, + + _onKeydown: function (e) { + if (!this.shown) { return; } + + var command; + + if ($.isFunction(this.option.onKeydown)) { + command = this.option.onKeydown(e, commands); + } + + if (command == null) { + command = this._defaultKeydown(e); + } + + switch (command) { + case commands.KEY_UP: + e.preventDefault(); + this._up(); + break; + case commands.KEY_DOWN: + e.preventDefault(); + this._down(); + break; + case commands.KEY_ENTER: + e.preventDefault(); + this._enter(e); + break; + case commands.KEY_PAGEUP: + e.preventDefault(); + this._pageup(); + break; + case commands.KEY_PAGEDOWN: + e.preventDefault(); + this._pagedown(); + break; + case commands.KEY_ESCAPE: + e.preventDefault(); + this.deactivate(); + break; + } + }, + + _defaultKeydown: function (e) { + if (this.isUp(e)) { + return commands.KEY_UP; + } else if (this.isDown(e)) { + return commands.KEY_DOWN; + } else if (this.isEnter(e)) { + return commands.KEY_ENTER; + } else if (this.isPageup(e)) { + return commands.KEY_PAGEUP; + } else if (this.isPagedown(e)) { + return commands.KEY_PAGEDOWN; + } else if (this.isEscape(e)) { + return commands.KEY_ESCAPE; + } + }, + + _up: function () { + if (this._index === 0) { + this._index = this.data.length - 1; + } else { + this._index -= 1; + } + this._activateIndexedItem(); + this._setScroll(); + }, + + _down: function () { + if (this._index === this.data.length - 1) { + this._index = 0; + } else { + this._index += 1; + } + this._activateIndexedItem(); + this._setScroll(); + }, + + _enter: function (e) { + var datum = this.data[parseInt(this._getActiveElement().data('index'), 10)]; + this.completer.select(datum.value, datum.strategy, e); + this.deactivate(); + }, + + _pageup: function () { + var target = 0; + var threshold = this._getActiveElement().position().top - this.$el.innerHeight(); + this.$el.children().each(function (i) { + if ($(this).position().top + $(this).outerHeight() > threshold) { + target = i; + return false; + } + }); + this._index = target; + this._activateIndexedItem(); + this._setScroll(); + }, + + _pagedown: function () { + var target = this.data.length - 1; + var threshold = this._getActiveElement().position().top + this.$el.innerHeight(); + this.$el.children().each(function (i) { + if ($(this).position().top > threshold) { + target = i; + return false + } + }); + this._index = target; + this._activateIndexedItem(); + this._setScroll(); + }, + + _activateIndexedItem: function () { + this.$el.find('.textcomplete-item.active').removeClass('active'); + this._getActiveElement().addClass('active'); + }, + + _getActiveElement: function () { + return this.$el.children('.textcomplete-item:nth(' + this._index + ')'); + }, + + _setScroll: function () { + var $activeEl = this._getActiveElement(); + var itemTop = $activeEl.position().top; + var itemHeight = $activeEl.outerHeight(); + var visibleHeight = this.$el.innerHeight(); + var visibleTop = this.$el.scrollTop(); + if (this._index === 0 || this._index == this.data.length - 1 || itemTop < 0) { + this.$el.scrollTop(itemTop + visibleTop); + } else if (itemTop + itemHeight > visibleHeight) { + this.$el.scrollTop(itemTop + itemHeight + visibleTop - visibleHeight); + } + }, + + _buildContents: function (zippedData) { + var datum, i, index; + var html = ''; + for (i = 0; i < zippedData.length; i++) { + if (this.data.length === this.maxCount) break; + datum = zippedData[i]; + if (include(this.data, datum)) { continue; } + index = this.data.length; + this.data.push(datum); + html += '
    • '; + html += datum.strategy.template(datum.value, datum.term); + html += '
    • '; + } + return html; + }, + + _renderHeader: function (unzippedData) { + if (this.header) { + if (!this._$header) { + this._$header = $('
    • ').prependTo(this.$el); + } + var html = $.isFunction(this.header) ? this.header(unzippedData) : this.header; + this._$header.html(html); + } + }, + + _renderFooter: function (unzippedData) { + if (this.footer) { + if (!this._$footer) { + this._$footer = $('').appendTo(this.$el); + } + var html = $.isFunction(this.footer) ? this.footer(unzippedData) : this.footer; + this._$footer.html(html); + } + }, + + _renderNoResultsMessage: function (unzippedData) { + if (this.noResultsMessage) { + if (!this._$noResultsMessage) { + this._$noResultsMessage = $('
    • ').appendTo(this.$el); + } + var html = $.isFunction(this.noResultsMessage) ? this.noResultsMessage(unzippedData) : this.noResultsMessage; + this._$noResultsMessage.html(html); + } + }, + + _renderContents: function (html) { + if (this._$footer) { + this._$footer.before(html); + } else { + this.$el.append(html); + } + }, + + _fitToBottom: function() { + var windowScrollBottom = $window.scrollTop() + $window.height(); + var height = this.$el.height(); + if ((this.$el.position().top + height) > windowScrollBottom) { + // only do this if we are not in an iframe + if (!this.completer.$iframe) { + this.$el.offset({top: windowScrollBottom - height}); + } + } + }, + + _fitToRight: function() { + // We don't know how wide our content is until the browser positions us, and at that point it clips us + // to the document width so we don't know if we would have overrun it. As a heuristic to avoid that clipping + // (which makes our elements wrap onto the next line and corrupt the next item), if we're close to the right + // edge, move left. We don't know how far to move left, so just keep nudging a bit. + var tolerance = 30; // pixels. Make wider than vertical scrollbar because we might not be able to use that space. + var lastOffset = this.$el.offset().left, offset; + var width = this.$el.width(); + var maxLeft = $window.width() - tolerance; + while (lastOffset + width > maxLeft) { + this.$el.offset({left: lastOffset - tolerance}); + offset = this.$el.offset().left; + if (offset >= lastOffset) { break; } + lastOffset = offset; + } + }, + + _applyPlacement: function (position) { + // If the 'placement' option set to 'top', move the position above the element. + if (this.placement.indexOf('top') !== -1) { + // Overwrite the position object to set the 'bottom' property instead of the top. + position = { + top: 'auto', + bottom: this.$el.parent().height() - position.top + position.lineHeight, + left: position.left + }; + } else { + position.bottom = 'auto'; + delete position.lineHeight; + } + if (this.placement.indexOf('absleft') !== -1) { + position.left = 0; + } else if (this.placement.indexOf('absright') !== -1) { + position.right = 0; + position.left = 'auto'; + } + return position; + } + }); + + $.fn.textcomplete.Dropdown = Dropdown; + $.extend($.fn.textcomplete, commands); +}(jQuery); + ++function ($) { + 'use strict'; + + // Memoize a search function. + var memoize = function (func) { + var memo = {}; + return function (term, callback) { + if (memo[term]) { + callback(memo[term]); + } else { + func.call(this, term, function (data) { + memo[term] = (memo[term] || []).concat(data); + callback.apply(null, arguments); }); + } }; + }; + + function Strategy(options) { + $.extend(this, options); + if (this.cache) { this.search = memoize(this.search); } + } + + Strategy.parse = function (strategiesArray, params) { + return $.map(strategiesArray, function (strategy) { + var strategyObj = new Strategy(strategy); + strategyObj.el = params.el; + strategyObj.$el = params.$el; + return strategyObj; + }); + }; + + $.extend(Strategy.prototype, { + // Public properties + // ----------------- + + // Required + match: null, + replace: null, + search: null, + + // Optional + id: null, + cache: false, + context: function () { return true; }, + index: 2, + template: function (obj) { return obj; }, + idProperty: null + }); + + $.fn.textcomplete.Strategy = Strategy; + +}(jQuery); + ++function ($) { + 'use strict'; + + var now = Date.now || function () { return new Date().getTime(); }; + + // Returns a function, that, as long as it continues to be invoked, will not + // be triggered. The function will be called after it stops being called for + // `wait` msec. + // + // This utility function was originally implemented at Underscore.js. + var debounce = function (func, wait) { + var timeout, args, context, timestamp, result; + var later = function () { + var last = now() - timestamp; + if (last < wait) { + timeout = setTimeout(later, wait - last); + } else { + timeout = null; + result = func.apply(context, args); + context = args = null; + } + }; + + return function () { + context = this; + args = arguments; + timestamp = now(); + if (!timeout) { + timeout = setTimeout(later, wait); + } + return result; + }; + }; + + function Adapter () {} + + $.extend(Adapter.prototype, { + // Public properties + // ----------------- + + id: null, // Identity. + completer: null, // Completer object which creates it. + el: null, // Textarea element. + $el: null, // jQuery object of the textarea. + option: null, + + // Public methods + // -------------- + + initialize: function (element, completer, option) { + this.el = element; + this.$el = $(element); + this.id = completer.id + this.constructor.name; + this.completer = completer; + this.option = option; + + if (this.option.debounce) { + this._onKeyup = debounce(this._onKeyup, this.option.debounce); + } + + this._bindEvents(); + }, + + destroy: function () { + this.$el.off('.' + this.id); // Remove all event handlers. + this.$el = this.el = this.completer = null; + }, + + // Update the element with the given value and strategy. + // + // value - The selected object. It is one of the item of the array + // which was callbacked from the search function. + // strategy - The Strategy associated with the selected value. + select: function (/* value, strategy */) { + throw new Error('Not implemented'); + }, + + // Returns the caret's relative coordinates from body's left top corner. + getCaretPosition: function () { + var position = this._getCaretRelativePosition(); + var offset = this.$el.offset(); + + // Calculate the left top corner of `this.option.appendTo` element. + var $parent = this.option.appendTo; + if ($parent) { + if (!($parent instanceof $)) { $parent = $($parent); } + var parentOffset = $parent.offsetParent().offset(); + offset.top -= parentOffset.top; + offset.left -= parentOffset.left; + } + + position.top += offset.top; + position.left += offset.left; + return position; + }, + + // Focus on the element. + focus: function () { + this.$el.focus(); + }, + + // Private methods + // --------------- + + _bindEvents: function () { + this.$el.on('keyup.' + this.id, $.proxy(this._onKeyup, this)); + }, + + _onKeyup: function (e) { + if (this._skipSearch(e)) { return; } + this.completer.trigger(this.getTextFromHeadToCaret(), true); + }, + + // Suppress searching if it returns true. + _skipSearch: function (clickEvent) { + switch (clickEvent.keyCode) { + case 9: // TAB + case 13: // ENTER + case 40: // DOWN + case 38: // UP + return true; + } + if (clickEvent.ctrlKey) switch (clickEvent.keyCode) { + case 78: // Ctrl-N + case 80: // Ctrl-P + return true; + } + } + }); + + $.fn.textcomplete.Adapter = Adapter; +}(jQuery); + ++function ($) { + 'use strict'; + + // Textarea adapter + // ================ + // + // Managing a textarea. It doesn't know a Dropdown. + function Textarea(element, completer, option) { + this.initialize(element, completer, option); + } + + $.extend(Textarea.prototype, $.fn.textcomplete.Adapter.prototype, { + // Public methods + // -------------- + + // Update the textarea with the given value and strategy. + select: function (value, strategy, e) { + var pre = this.getTextFromHeadToCaret(); + var post = this.el.value.substring(this.el.selectionEnd); + var newSubstr = strategy.replace(value, e); + if (typeof newSubstr !== 'undefined') { + if ($.isArray(newSubstr)) { + post = newSubstr[1] + post; + newSubstr = newSubstr[0]; + } + pre = pre.replace(strategy.match, newSubstr); + this.$el.val(pre + post); + this.el.selectionStart = this.el.selectionEnd = pre.length; + } + }, + + getTextFromHeadToCaret: function () { + return this.el.value.substring(0, this.el.selectionEnd); + }, + + // Private methods + // --------------- + + _getCaretRelativePosition: function () { + var p = $.fn.textcomplete.getCaretCoordinates(this.el, this.el.selectionStart); + return { + top: p.top + this._calculateLineHeight() - this.$el.scrollTop(), + left: p.left - this.$el.scrollLeft() + }; + }, + + _calculateLineHeight: function () { + var lineHeight = parseInt(this.$el.css('line-height'), 10); + if (isNaN(lineHeight)) { + // http://stackoverflow.com/a/4515470/1297336 + var parentNode = this.el.parentNode; + var temp = document.createElement(this.el.nodeName); + var style = this.el.style; + temp.setAttribute( + 'style', + 'margin:0px;padding:0px;font-family:' + style.fontFamily + ';font-size:' + style.fontSize + ); + temp.innerHTML = 'test'; + parentNode.appendChild(temp); + lineHeight = temp.clientHeight; + parentNode.removeChild(temp); + } + return lineHeight; + } + }); + + $.fn.textcomplete.Textarea = Textarea; +}(jQuery); + ++function ($) { + 'use strict'; + + var sentinelChar = '吶'; + + function IETextarea(element, completer, option) { + this.initialize(element, completer, option); + $('' + sentinelChar + '').css({ + position: 'absolute', + top: -9999, + left: -9999 + }).insertBefore(element); + } + + $.extend(IETextarea.prototype, $.fn.textcomplete.Textarea.prototype, { + // Public methods + // -------------- + + select: function (value, strategy, e) { + var pre = this.getTextFromHeadToCaret(); + var post = this.el.value.substring(pre.length); + var newSubstr = strategy.replace(value, e); + if (typeof newSubstr !== 'undefined') { + if ($.isArray(newSubstr)) { + post = newSubstr[1] + post; + newSubstr = newSubstr[0]; + } + pre = pre.replace(strategy.match, newSubstr); + this.$el.val(pre + post); + this.el.focus(); + var range = this.el.createTextRange(); + range.collapse(true); + range.moveEnd('character', pre.length); + range.moveStart('character', pre.length); + range.select(); + } + }, + + getTextFromHeadToCaret: function () { + this.el.focus(); + var range = document.selection.createRange(); + range.moveStart('character', -this.el.value.length); + var arr = range.text.split(sentinelChar) + return arr.length === 1 ? arr[0] : arr[1]; + } + }); + + $.fn.textcomplete.IETextarea = IETextarea; +}(jQuery); + +// NOTE: TextComplete plugin has contenteditable support but it does not work +// fine especially on old IEs. +// Any pull requests are REALLY welcome. + ++function ($) { + 'use strict'; + + // ContentEditable adapter + // ======================= + // + // Adapter for contenteditable elements. + function ContentEditable (element, completer, option) { + this.initialize(element, completer, option); + } + + $.extend(ContentEditable.prototype, $.fn.textcomplete.Adapter.prototype, { + // Public methods + // -------------- + + // Update the content with the given value and strategy. + // When an dropdown item is selected, it is executed. + select: function (value, strategy, e) { + var pre = this.getTextFromHeadToCaret(); + // use ownerDocument instead of window to support iframes + var sel = this.el.ownerDocument.getSelection(); + + var range = sel.getRangeAt(0); + var selection = range.cloneRange(); + selection.selectNodeContents(range.startContainer); + var content = selection.toString(); + var post = content.substring(range.startOffset); + var newSubstr = strategy.replace(value, e); + if (typeof newSubstr !== 'undefined') { + if ($.isArray(newSubstr)) { + post = newSubstr[1] + post; + newSubstr = newSubstr[0]; + } + pre = pre.replace(strategy.match, newSubstr) + .replace(/ $/, " "); //   necessary at least for CKeditor to not eat spaces + range.selectNodeContents(range.startContainer); + range.deleteContents(); + + // create temporary elements + var preWrapper = this.el.ownerDocument.createElement("div"); + preWrapper.innerHTML = pre; + var postWrapper = this.el.ownerDocument.createElement("div"); + postWrapper.innerHTML = post; + + // create the fragment thats inserted + var fragment = this.el.ownerDocument.createDocumentFragment(); + var childNode; + var lastOfPre; + while (childNode = preWrapper.firstChild) { + lastOfPre = fragment.appendChild(childNode); + } + while (childNode = postWrapper.firstChild) { + fragment.appendChild(childNode); + } + + // insert the fragment & jump behind the last node in "pre" + range.insertNode(fragment); + range.setStartAfter(lastOfPre); + + range.collapse(true); + sel.removeAllRanges(); + sel.addRange(range); + } + }, + + // Private methods + // --------------- + + // Returns the caret's relative position from the contenteditable's + // left top corner. + // + // Examples + // + // this._getCaretRelativePosition() + // //=> { top: 18, left: 200, lineHeight: 16 } + // + // Dropdown's position will be decided using the result. + _getCaretRelativePosition: function () { + var range = this.el.ownerDocument.getSelection().getRangeAt(0).cloneRange(); + var node = this.el.ownerDocument.createElement('span'); + range.insertNode(node); + range.selectNodeContents(node); + range.deleteContents(); + var $node = $(node); + var position = $node.offset(); + position.left -= this.$el.offset().left; + position.top += $node.height() - this.$el.offset().top; + position.lineHeight = $node.height(); + + // special positioning logic for iframes + // this is typically used for contenteditables such as tinymce or ckeditor + if (this.completer.$iframe) { + var iframePosition = this.completer.$iframe.offset(); + position.top += iframePosition.top; + position.left += iframePosition.left; + //subtract scrollTop from element in iframe + position.top -= this.$el.scrollTop(); + } + + $node.remove(); + return position; + }, + + // Returns the string between the first character and the caret. + // Completer will be triggered with the result for start autocompleting. + // + // Example + // + // // Suppose the html is 'hello wor|ld' and | is the caret. + // this.getTextFromHeadToCaret() + // // => ' wor' // not 'hello wor' + getTextFromHeadToCaret: function () { + var range = this.el.ownerDocument.getSelection().getRangeAt(0); + var selection = range.cloneRange(); + selection.selectNodeContents(range.startContainer); + return selection.toString().substring(0, range.startOffset); + } + }); + + $.fn.textcomplete.ContentEditable = ContentEditable; +}(jQuery); + +// NOTE: TextComplete plugin has contenteditable support but it does not work +// fine especially on old IEs. +// Any pull requests are REALLY welcome. + ++function ($) { + 'use strict'; + + // CKEditor adapter + // ======================= + // + // Adapter for CKEditor, based on contenteditable elements. + function CKEditor (element, completer, option) { + this.initialize(element, completer, option); + } + + $.extend(CKEditor.prototype, $.fn.textcomplete.ContentEditable.prototype, { + _bindEvents: function () { + var $this = this; + CKEDITOR.instances["issue_notes"].on('key', function(event) { + var domEvent = event.data; + $this._onKeyup(domEvent); + if ($this.completer.dropdown.shown && $this._skipSearch(domEvent)) { + return false; + } + }, null, null, 1); // 1 = Priority = Important! + // we actually also need the native event, as the CKEditor one is happening to late + this.$el.on('keyup.' + this.id, $.proxy(this._onKeyup, this)); + }, +}); + + $.fn.textcomplete.CKEditor = CKEditor; +}(jQuery); + +// The MIT License (MIT) +// +// Copyright (c) 2015 Jonathan Ong me@jongleberry.com +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +// associated documentation files (the "Software"), to deal in the Software without restriction, +// including without limitation the rights to use, copy, modify, merge, publish, distribute, +// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// https://github.com/component/textarea-caret-position + +(function ($) { + +// The properties that we copy into a mirrored div. +// Note that some browsers, such as Firefox, +// do not concatenate properties, i.e. padding-top, bottom etc. -> padding, +// so we have to do every single property specifically. +var properties = [ + 'direction', // RTL support + 'boxSizing', + 'width', // on Chrome and IE, exclude the scrollbar, so the mirror div wraps exactly as the textarea does + 'height', + 'overflowX', + 'overflowY', // copy the scrollbar for IE + + 'borderTopWidth', + 'borderRightWidth', + 'borderBottomWidth', + 'borderLeftWidth', + 'borderStyle', + + 'paddingTop', + 'paddingRight', + 'paddingBottom', + 'paddingLeft', + + // https://developer.mozilla.org/en-US/docs/Web/CSS/font + 'fontStyle', + 'fontVariant', + 'fontWeight', + 'fontStretch', + 'fontSize', + 'fontSizeAdjust', + 'lineHeight', + 'fontFamily', + + 'textAlign', + 'textTransform', + 'textIndent', + 'textDecoration', // might not make a difference, but better be safe + + 'letterSpacing', + 'wordSpacing', + + 'tabSize', + 'MozTabSize' + +]; + +var isBrowser = (typeof window !== 'undefined'); +var isFirefox = (isBrowser && window.mozInnerScreenX != null); + +function getCaretCoordinates(element, position, options) { + if(!isBrowser) { + throw new Error('textarea-caret-position#getCaretCoordinates should only be called in a browser'); + } + + var debug = options && options.debug || false; + if (debug) { + var el = document.querySelector('#input-textarea-caret-position-mirror-div'); + if ( el ) { el.parentNode.removeChild(el); } + } + + // mirrored div + var div = document.createElement('div'); + div.id = 'input-textarea-caret-position-mirror-div'; + document.body.appendChild(div); + + var style = div.style; + var computed = window.getComputedStyle? getComputedStyle(element) : element.currentStyle; // currentStyle for IE < 9 + + // default textarea styles + style.whiteSpace = 'pre-wrap'; + if (element.nodeName !== 'INPUT') + style.wordWrap = 'break-word'; // only for textarea-s + + // position off-screen + style.position = 'absolute'; // required to return coordinates properly + if (!debug) + style.visibility = 'hidden'; // not 'display: none' because we want rendering + + // transfer the element's properties to the div + properties.forEach(function (prop) { + style[prop] = computed[prop]; + }); + + if (isFirefox) { + // Firefox lies about the overflow property for textareas: https://bugzilla.mozilla.org/show_bug.cgi?id=984275 + if (element.scrollHeight > parseInt(computed.height)) + style.overflowY = 'scroll'; + } else { + style.overflow = 'hidden'; // for Chrome to not render a scrollbar; IE keeps overflowY = 'scroll' + } + + div.textContent = element.value.substring(0, position); + // the second special handling for input type="text" vs textarea: spaces need to be replaced with non-breaking spaces - http://stackoverflow.com/a/13402035/1269037 + if (element.nodeName === 'INPUT') + div.textContent = div.textContent.replace(/\s/g, '\u00a0'); + + var span = document.createElement('span'); + // Wrapping must be replicated *exactly*, including when a long word gets + // onto the next line, with whitespace at the end of the line before (#7). + // The *only* reliable way to do that is to copy the *entire* rest of the + // textarea's content into the created at the caret position. + // for inputs, just '.' would be enough, but why bother? + span.textContent = element.value.substring(position) || '.'; // || because a completely empty faux span doesn't render at all + div.appendChild(span); + + var coordinates = { + top: span.offsetTop + parseInt(computed['borderTopWidth']), + left: span.offsetLeft + parseInt(computed['borderLeftWidth']) + }; + + if (debug) { + span.style.backgroundColor = '#aaa'; + } else { + document.body.removeChild(div); + } + + return coordinates; +} + +$.fn.textcomplete.getCaretCoordinates = getCaretCoordinates; + +}(jQuery)); -})(window.jQuery || window.Zepto); +return jQuery; +})); diff --git a/main/inc/lib/javascript/jquery-textcomplete/jquery.textcomplete.min.js b/main/inc/lib/javascript/jquery-textcomplete/jquery.textcomplete.min.js index 3a3fbd47bd..3768d6539c 100644 --- a/main/inc/lib/javascript/jquery-textcomplete/jquery.textcomplete.min.js +++ b/main/inc/lib/javascript/jquery-textcomplete/jquery.textcomplete.min.js @@ -1,4 +1,3 @@ -/*! jquery-textcomplete - v0.3.3 - 2014-09-25 */if("undefined"==typeof jQuery)throw new Error("jQuery.textcomplete requires jQuery");+function(a){"use strict";var b=function(a){console.warn&&console.warn(a)};a.fn.textcomplete=function(c,d){var e=Array.prototype.slice.call(arguments);return this.each(function(){var f=a(this),g=f.data("textComplete");if(g||(g=new a.fn.textcomplete.Completer(this,d||{}),f.data("textComplete",g)),"string"==typeof c){if(!g)return;e.shift(),g[c].apply(g,e)}else a.each(c,function(c){a.each(["header","footer","placement","maxCount"],function(a){c[a]&&(g.option[a]=c[a],b(a+"as a strategy param is deplicated. Use option."),delete c[a])})}),g.register(a.fn.textcomplete.Strategy.parse(c))})}}(jQuery),+function(a){"use strict";function b(c,d){if(this.$el=a(c),this.id="textcomplete"+e++,this.strategies=[],this.views=[],this.option=a.extend({},b.DEFAULTS,d),!this.$el.is("textarea")&&!c.isContentEditable)throw new Error("textcomplete must be called to a Textarea or a ContentEditable.");if(c===document.activeElement)this.initialize();else{var f=this;this.$el.one("focus."+this.id,function(){f.initialize()})}}var c=function(a){var b,c;return function(){var d=Array.prototype.slice.call(arguments);if(b)return c=d,void 0;b=!0;var e=this;d.unshift(function f(){if(c){var d=c;c=void 0,d.unshift(f),a.apply(e,d)}else b=!1}),a.apply(this,d)}},d=function(a){return"[object String]"===Object.prototype.toString.call(a)},e=0;b.DEFAULTS={appendTo:a("body"),zIndex:"100"},a.extend(b.prototype,{id:null,option:null,strategies:null,adapter:null,dropdown:null,$el:null,initialize:function(){var b=this.$el.get(0);this.dropdown=new a.fn.textcomplete.Dropdown(b,this,this.option);var c,d;this.option.adapter?c=this.option.adapter:(d=this.$el.is("textarea")?"number"==typeof b.selectionEnd?"Textarea":"IETextarea":"ContentEditable",c=a.fn.textcomplete[d]),this.adapter=new c(b,this,this.option)},destroy:function(){this.$el.off("."+this.id),this.adapter.destroy(),this.dropdown.destroy(),this.$el=this.adapter=this.dropdown=null},trigger:function(a,b){this.dropdown||this.initialize(),null!=a||(a=this.adapter.getTextFromHeadToCaret());var c=this._extractSearchQuery(a);if(c.length){var d=c[1];if(b&&this._term===d)return;this._term=d,this._search.apply(this,c)}else this._term=null,this.dropdown.deactivate()},fire:function(a){return this.$el.trigger(a),this},register:function(a){Array.prototype.push.apply(this.strategies,a)},select:function(a,b){this.adapter.select(a,b),this.fire("change").fire("textComplete:select",a,b),this.adapter.focus()},_clearAtNext:!0,_term:null,_extractSearchQuery:function(a){for(var b=0;b').css({display:"none",left:0,position:"absolute",zIndex:b.zIndex}).appendTo(c)),d}}),a.extend(b.prototype,{$el:null,$inputEl:null,completer:null,footer:null,header:null,id:null,maxCount:10,placement:"",shown:!1,data:[],className:"",destroy:function(){this.deactivate(),this.$el.off("."+this.id),this.$inputEl.off("."+this.id),this.clear(),this.$el=this.$inputEl=this.completer=null,delete d[this.id]},render:function(b){var c=this._buildContents(b),d=a.map(this.data,function(a){return a.value});this.data.length?(this._renderHeader(d),this._renderFooter(d),c&&(this._renderContents(c),this._activateIndexedItem()),this._setScroll()):this.shown&&this.deactivate()},setPosition:function(a){return this.$el.css(this._applyPlacement(a)),this},clear:function(){this.$el.html(""),this.data=[],this._index=0,this._$header=this._$footer=null},activate:function(){return this.shown||(this.clear(),this.$el.show(),this.className&&this.$el.addClass(this.className),this.completer.fire("textComplete:show"),this.shown=!0),this},deactivate:function(){return this.shown&&(this.$el.hide(),this.className&&this.$el.removeClass(this.className),this.completer.fire("textComplete:hide"),this.shown=!1),this},isUp:function(a){return 38===a.keyCode||a.ctrlKey&&80===a.keyCode},isDown:function(a){return 40===a.keyCode||a.ctrlKey&&78===a.keyCode},isEnter:function(a){var b=a.ctrlKey||a.altKey||a.metaKey||a.shiftKey;return!b&&(13===a.keyCode||9===a.keyCode)},isPageup:function(a){return 33===a.keyCode},isPagedown:function(a){return 34===a.keyCode},_data:null,_index:null,_$header:null,_$footer:null,_bindEvents:function(){this.$el.on("mousedown."+this.id,".textcomplete-item",a.proxy(this._onClick,this)),this.$el.on("mouseover."+this.id,".textcomplete-item",a.proxy(this._onMouseover,this)),this.$inputEl.on("keydown."+this.id,a.proxy(this._onKeydown,this))},_onClick:function(b){var c=a(b.target);b.preventDefault(),b.originalEvent.keepTextCompleteDropdown=this.id,c.hasClass("textcomplete-item")||(c=c.closest(".textcomplete-item"));var d=this.data[parseInt(c.data("index"),10)];this.completer.select(d.value,d.strategy);var e=this;setTimeout(function(){e.deactivate()},0)},_onMouseover:function(b){var c=a(b.target);b.preventDefault(),c.hasClass("textcomplete-item")||(c=c.closest(".textcomplete-item")),this._index=parseInt(c.data("index"),10),this._activateIndexedItem()},_onKeydown:function(a){this.shown&&(this.isUp(a)?(a.preventDefault(),this._up()):this.isDown(a)?(a.preventDefault(),this._down()):this.isEnter(a)?(a.preventDefault(),this._enter()):this.isPageup(a)?(a.preventDefault(),this._pageup()):this.isPagedown(a)&&(a.preventDefault(),this._pagedown()))},_up:function(){0===this._index?this._index=this.data.length-1:this._index-=1,this._activateIndexedItem(),this._setScroll()},_down:function(){this._index===this.data.length-1?this._index=0:this._index+=1,this._activateIndexedItem(),this._setScroll()},_enter:function(){var a=this.data[parseInt(this._getActiveElement().data("index"),10)];this.completer.select(a.value,a.strategy),this._setScroll()},_pageup:function(){var b=0,c=this._getActiveElement().position().top-this.$el.innerHeight();this.$el.children().each(function(d){return a(this).position().top+a(this).outerHeight()>c?(b=d,!1):void 0}),this._index=b,this._activateIndexedItem(),this._setScroll()},_pagedown:function(){var b=this.data.length-1,c=this._getActiveElement().position().top+this.$el.innerHeight();this.$el.children().each(function(d){return a(this).position().top>c?(b=d,!1):void 0}),this._index=b,this._activateIndexedItem(),this._setScroll()},_activateIndexedItem:function(){this.$el.find(".textcomplete-item.active").removeClass("active"),this._getActiveElement().addClass("active")},_getActiveElement:function(){return this.$el.children(".textcomplete-item:nth("+this._index+")")},_setScroll:function(){var a=this._getActiveElement(),b=a.position().top,c=a.outerHeight(),d=this.$el.innerHeight(),e=this.$el.scrollTop();0===this._index||this._index==this.data.length-1||0>b?this.$el.scrollTop(b+e):b+c>d&&this.$el.scrollTop(b+c+e-d)},_buildContents:function(a){var b,d,e,f="";for(d=0;d',f+=b.strategy.template(b.value),f+="");return f},_renderHeader:function(b){if(this.header){this._$header||(this._$header=a('
    • ').prependTo(this.$el));var c=a.isFunction(this.header)?this.header(b):this.header;this._$header.html(c)}},_renderFooter:function(b){if(this.footer){this._$footer||(this._$footer=a('').appendTo(this.$el));var c=a.isFunction(this.footer)?this.footer(b):this.footer;this._$footer.html(c)}},_renderContents:function(a){this._$footer?this._$footer.before(a):this.$el.append(a)},_applyPlacement:function(a){return-1!==this.placement.indexOf("top")?a={top:"auto",bottom:this.$el.parent().height()-a.top+a.lineHeight,left:a.left}:(a.bottom="auto",delete a.lineHeight),-1!==this.placement.indexOf("absleft")?a.left=0:-1!==this.placement.indexOf("absright")&&(a.right=0,a.left="auto"),a}}),a.fn.textcomplete.Dropdown=b}(jQuery),+function(a){"use strict";function b(b){a.extend(this,b),this.cache&&(this.search=c(this.search))}var c=function(a){var b={};return function(c,d){b[c]?d(b[c]):a.call(this,c,function(a){b[c]=(b[c]||[]).concat(a),d.apply(null,arguments)})}};b.parse=function(c){return a.map(c,function(a){return new b(a)})},a.extend(b.prototype,{match:null,replace:null,search:null,cache:!1,context:function(){return!0},index:2,template:function(a){return a},idProperty:null}),a.fn.textcomplete.Strategy=b}(jQuery),+function(a){"use strict";function b(){}var c=Date.now||function(){return(new Date).getTime()},d=function(a,b){var d,e,f,g,h,i=function(){var j=c()-g;b>j?d=setTimeout(i,b-j):(d=null,h=a.apply(f,e),f=e=null)};return function(){return f=this,e=arguments,g=c(),d||(d=setTimeout(i,b)),h}};a.extend(b.prototype,{id:null,completer:null,el:null,$el:null,option:null,initialize:function(b,c,e){this.el=b,this.$el=a(b),this.id=c.id+this.constructor.name,this.completer=c,this.option=e,this.option.debounce&&(this._onKeyup=d(this._onKeyup,this.option.debounce)),this._bindEvents()},destroy:function(){this.$el.off("."+this.id),this.$el=this.el=this.completer=null},select:function(){throw new Error("Not implemented")},getCaretPosition:function(){var a=this._getCaretRelativePosition(),b=this.$el.offset();return a.top+=b.top,a.left+=b.left,a},focus:function(){this.$el.focus()},_bindEvents:function(){this.$el.on("keyup."+this.id,a.proxy(this._onKeyup,this))},_onKeyup:function(a){this._skipSearch(a)||this.completer.trigger(this.getTextFromHeadToCaret(),!0)},_skipSearch:function(a){switch(a.keyCode){case 40:case 38:return!0}if(a.ctrlKey)switch(a.keyCode){case 78:case 80:return!0}}}),a.fn.textcomplete.Adapter=b}(jQuery),+function(a){"use strict";function b(a,b,c){this.initialize(a,b,c)}b.DIV_PROPERTIES={left:-9999,position:"absolute",top:0,whiteSpace:"pre-wrap"},b.COPY_PROPERTIES=["border-width","font-family","font-size","font-style","font-variant","font-weight","height","letter-spacing","word-spacing","line-height","text-decoration","text-align","width","padding-top","padding-right","padding-bottom","padding-left","margin-top","margin-right","margin-bottom","margin-left","border-style","box-sizing","tab-size"],a.extend(b.prototype,a.fn.textcomplete.Adapter.prototype,{select:function(b,c){var d=this.getTextFromHeadToCaret(),e=this.el.value.substring(this.el.selectionEnd),f=c.replace(b);a.isArray(f)&&(e=f[1]+e,f=f[0]),d=d.replace(c.match,f),this.$el.val(d+e),this.el.selectionStart=this.el.selectionEnd=d.length},_getCaretRelativePosition:function(){var b=a("
      ").css(this._copyCss()).text(this.getTextFromHeadToCaret()),c=a("").text(".").appendTo(b);this.$el.before(b);var d=c.position();return d.top+=c.height()-this.$el.scrollTop(),d.lineHeight=c.height(),b.remove(),d},_copyCss:function(){return a.extend({overflow:this.el.scrollHeight>this.el.offsetHeight?"scroll":"auto"},b.DIV_PROPERTIES,this._getStyles())},_getStyles:function(a){var c=a("
      ").css(["color"]).color;return"undefined"!=typeof c?function(){return this.$el.css(b.COPY_PROPERTIES)}:function(){var c=this.$el,d={};return a.each(b.COPY_PROPERTIES,function(a,b){d[b]=c.css(b)}),d}}(a),getTextFromHeadToCaret:function(){return this.el.value.substring(0,this.el.selectionEnd)}}),a.fn.textcomplete.Textarea=b}(jQuery),+function(a){"use strict";function b(b,d,e){this.initialize(b,d,e),a(""+c+"").css({position:"absolute",top:-9999,left:-9999}).insertBefore(b)}var c="吶";a.extend(b.prototype,a.fn.textcomplete.Textarea.prototype,{select:function(b,c){var d=this._getTextFromHeadToCaret(),e=this.el.value.substring(d.length),f=c.replace(b);a.isArray(f)&&(e=f[1]+e,f=f[0]),d=d.replace(c.match,f),this.$el.val(d+e),this.el.focus();var g=this.el.createTextRange();g.collapse(!0),g.moveEnd("character",d.length),g.moveStart("character",d.length),g.select()},_getTextFromHeadToCaret:function(){this.el.focus();var a=document.selection.createRange();a.moveStart("character",-this.el.value.length);var b=a.text.split(c);return 1===b.length?b[0]:b[1]}}),a.fn.textcomplete.IETextarea=b}(jQuery),+function(a){"use strict";function b(a,b,c){this.initialize(a,b,c)}a.extend(b.prototype,a.fn.textcomplete.Adapter.prototype,{select:function(b,c){var d=this.getTextFromHeadToCaret(),e=window.getSelection(),f=e.getRangeAt(0),g=f.cloneRange();g.selectNodeContents(f.startContainer);var h=g.toString(),i=h.substring(f.startOffset),j=c.replace(b);a.isArray(j)&&(i=j[1]+i,j=j[0]),d=d.replace(c.match,j),f.selectNodeContents(f.startContainer),f.deleteContents();var k=document.createTextNode(d+i);f.insertNode(k),f.setStart(k,d.length),f.collapse(!0),e.removeAllRanges(),e.addRange(f)},_getCaretRelativePosition:function(){var b=window.getSelection().getRangeAt(0).cloneRange(),c=document.createElement("span");b.insertNode(c),b.selectNodeContents(c),b.deleteContents();var d=a(c),e=d.offset();e.left-=this.$el.offset().left,e.top+=d.height()-this.$el.offset().top,e.lineHeight=d.height();var f=this.$el.attr("dir")||this.$el.css("direction");return"rtl"===f&&(e.left-=this.listView.$el.width()),e},getTextFromHeadToCaret:function(){var a=window.getSelection().getRangeAt(0),b=a.cloneRange();return b.selectNodeContents(a.startContainer),b.toString().substring(0,a.startOffset)}}),a.fn.textcomplete.ContentEditable=b}(jQuery); -/* -//@ sourceMappingURL=dist/jquery.textcomplete.min.map -*/ \ No newline at end of file +/*! jquery-textcomplete - v1.5.0 - 2016-06-07 */ +!function(a){if("function"==typeof define&&define.amd)define(["jquery"],a);else if("object"==typeof module&&module.exports){var b=require("jquery");module.exports=a(b)}else a(jQuery)}(function(a){if("undefined"==typeof a)throw new Error("jQuery.textcomplete requires jQuery");return+function(a){"use strict";var b=function(a){console.warn&&console.warn(a)},c=1;a.fn.textcomplete=function(d,e){var f=Array.prototype.slice.call(arguments);return this.each(function(){var g=this,h=a(this),i=h.data("textComplete");if(i||(e||(e={}),e._oid=c++,i=new a.fn.textcomplete.Completer(this,e),h.data("textComplete",i)),"string"==typeof d){if(!i)return;f.shift(),i[d].apply(i,f),"destroy"===d&&h.removeData("textComplete")}else a.each(d,function(c){a.each(["header","footer","placement","maxCount"],function(a){c[a]&&(i.option[a]=c[a],b(a+"as a strategy param is deprecated. Use option."),delete c[a])})}),i.register(a.fn.textcomplete.Strategy.parse(d,{el:g,$el:h}))})}}(a),+function(a){"use strict";function b(c,d){if(this.$el=a(c),this.id="textcomplete"+f++,this.strategies=[],this.views=[],this.option=a.extend({},b._getDefaults(),d),!(this.$el.is("input[type=text]")||this.$el.is("input[type=search]")||this.$el.is("textarea")||c.isContentEditable||"true"==c.contentEditable))throw new Error("textcomplete must be called on a Textarea or a ContentEditable.");if(c===c.ownerDocument.activeElement)this.initialize();else{var e=this;this.$el.one("focus."+this.id,function(){e.initialize()}),this.option.adapter&&"CKEditor"!=this.option.adapter||"undefined"==typeof CKEDITOR||!this.$el.is("textarea")||CKEDITOR.on("instanceReady",function(b){b.editor.once("focus",function(c){e.$el=a(b.editor.editable().$),e.option.adapter||(e.option.adapter=a.fn.textcomplete.CKEditor),e.initialize()})})}}var c=function(a){var b,c;return function(){var d=Array.prototype.slice.call(arguments);if(b)return void(c=d);b=!0;var e=this;d.unshift(function f(){if(c){var d=c;c=void 0,d.unshift(f),a.apply(e,d)}else b=!1}),a.apply(this,d)}},d=function(a){return"[object String]"===Object.prototype.toString.call(a)},e=function(a){return"[object Function]"===Object.prototype.toString.call(a)},f=0;b._getDefaults=function(){return b.DEFAULTS||(b.DEFAULTS={appendTo:a("body"),className:"",dropdownClassName:"dropdown-menu textcomplete-dropdown",maxCount:10,zIndex:"100"}),b.DEFAULTS},a.extend(b.prototype,{id:null,option:null,strategies:null,adapter:null,dropdown:null,$el:null,$iframe:null,initialize:function(){var b=this.$el.get(0);if(this.$el.prop("ownerDocument")!==document&&window.frames.length)for(var c=0;c").addClass(b.dropdownClassName).attr("id","textcomplete-dropdown-"+b._oid).css({display:"none",left:0,position:"absolute",zIndex:b.zIndex}).appendTo(c);return d}}),a.extend(b.prototype,{$el:null,$inputEl:null,completer:null,footer:null,header:null,id:null,maxCount:null,placement:"",shown:!1,data:[],className:"",destroy:function(){this.deactivate(),this.$el.off("."+this.id),this.$inputEl.off("."+this.id),this.clear(),this.$el.remove(),this.$el=this.$inputEl=this.completer=null,delete e[this.id]},render:function(b){var c=this._buildContents(b),d=a.map(this.data,function(a){return a.value});if(this.data.length){var e=b[0].strategy;e.id?this.$el.attr("data-strategy",e.id):this.$el.removeAttr("data-strategy"),this._renderHeader(d),this._renderFooter(d),c&&(this._renderContents(c),this._fitToBottom(),this._fitToRight(),this._activateIndexedItem()),this._setScroll()}else this.noResultsMessage?this._renderNoResultsMessage(d):this.shown&&this.deactivate()},setPosition:function(b){var d="absolute";return this.$inputEl.add(this.$inputEl.parents()).each(function(){return"absolute"===a(this).css("position")?!1:"fixed"===a(this).css("position")?(b.top-=c.scrollTop(),b.left-=c.scrollLeft(),d="fixed",!1):void 0}),this.$el.css(this._applyPlacement(b)),this.$el.css({position:d}),this},clear:function(){this.$el.html(""),this.data=[],this._index=0,this._$header=this._$footer=this._$noResultsMessage=null},activate:function(){return this.shown||(this.clear(),this.$el.show(),this.className&&this.$el.addClass(this.className),this.completer.fire("textComplete:show"),this.shown=!0),this},deactivate:function(){return this.shown&&(this.$el.hide(),this.className&&this.$el.removeClass(this.className),this.completer.fire("textComplete:hide"),this.shown=!1),this},isUp:function(a){return 38===a.keyCode||a.ctrlKey&&80===a.keyCode},isDown:function(a){return 40===a.keyCode||a.ctrlKey&&78===a.keyCode},isEnter:function(a){var b=a.ctrlKey||a.altKey||a.metaKey||a.shiftKey;return!b&&(13===a.keyCode||9===a.keyCode||this.option.completeOnSpace===!0&&32===a.keyCode)},isPageup:function(a){return 33===a.keyCode},isPagedown:function(a){return 34===a.keyCode},isEscape:function(a){return 27===a.keyCode},_data:null,_index:null,_$header:null,_$noResultsMessage:null,_$footer:null,_bindEvents:function(){this.$el.on("mousedown."+this.id,".textcomplete-item",a.proxy(this._onClick,this)),this.$el.on("touchstart."+this.id,".textcomplete-item",a.proxy(this._onClick,this)),this.$el.on("mouseover."+this.id,".textcomplete-item",a.proxy(this._onMouseover,this)),this.$inputEl.on("keydown."+this.id,a.proxy(this._onKeydown,this))},_onClick:function(b){var c=a(b.target);b.preventDefault(),b.originalEvent.keepTextCompleteDropdown=this.id,c.hasClass("textcomplete-item")||(c=c.closest(".textcomplete-item"));var d=this.data[parseInt(c.data("index"),10)];this.completer.select(d.value,d.strategy,b);var e=this;setTimeout(function(){e.deactivate(),"touchstart"===b.type&&e.$inputEl.focus()},0)},_onMouseover:function(b){var c=a(b.target);b.preventDefault(),c.hasClass("textcomplete-item")||(c=c.closest(".textcomplete-item")),this._index=parseInt(c.data("index"),10),this._activateIndexedItem()},_onKeydown:function(b){if(this.shown){var c;switch(a.isFunction(this.option.onKeydown)&&(c=this.option.onKeydown(b,f)),null==c&&(c=this._defaultKeydown(b)),c){case f.KEY_UP:b.preventDefault(),this._up();break;case f.KEY_DOWN:b.preventDefault(),this._down();break;case f.KEY_ENTER:b.preventDefault(),this._enter(b);break;case f.KEY_PAGEUP:b.preventDefault(),this._pageup();break;case f.KEY_PAGEDOWN:b.preventDefault(),this._pagedown();break;case f.KEY_ESCAPE:b.preventDefault(),this.deactivate()}}},_defaultKeydown:function(a){return this.isUp(a)?f.KEY_UP:this.isDown(a)?f.KEY_DOWN:this.isEnter(a)?f.KEY_ENTER:this.isPageup(a)?f.KEY_PAGEUP:this.isPagedown(a)?f.KEY_PAGEDOWN:this.isEscape(a)?f.KEY_ESCAPE:void 0},_up:function(){0===this._index?this._index=this.data.length-1:this._index-=1,this._activateIndexedItem(),this._setScroll()},_down:function(){this._index===this.data.length-1?this._index=0:this._index+=1,this._activateIndexedItem(),this._setScroll()},_enter:function(a){var b=this.data[parseInt(this._getActiveElement().data("index"),10)];this.completer.select(b.value,b.strategy,a),this.deactivate()},_pageup:function(){var b=0,c=this._getActiveElement().position().top-this.$el.innerHeight();this.$el.children().each(function(d){return a(this).position().top+a(this).outerHeight()>c?(b=d,!1):void 0}),this._index=b,this._activateIndexedItem(),this._setScroll()},_pagedown:function(){var b=this.data.length-1,c=this._getActiveElement().position().top+this.$el.innerHeight();this.$el.children().each(function(d){return a(this).position().top>c?(b=d,!1):void 0}),this._index=b,this._activateIndexedItem(),this._setScroll()},_activateIndexedItem:function(){this.$el.find(".textcomplete-item.active").removeClass("active"),this._getActiveElement().addClass("active")},_getActiveElement:function(){return this.$el.children(".textcomplete-item:nth("+this._index+")")},_setScroll:function(){var a=this._getActiveElement(),b=a.position().top,c=a.outerHeight(),d=this.$el.innerHeight(),e=this.$el.scrollTop();0===this._index||this._index==this.data.length-1||0>b?this.$el.scrollTop(b+e):b+c>d&&this.$el.scrollTop(b+c+e-d)},_buildContents:function(a){var b,c,e,f="";for(c=0;c',f+=b.strategy.template(b.value,b.term),f+="");return f},_renderHeader:function(b){if(this.header){this._$header||(this._$header=a('
    • ').prependTo(this.$el));var c=a.isFunction(this.header)?this.header(b):this.header;this._$header.html(c)}},_renderFooter:function(b){if(this.footer){this._$footer||(this._$footer=a('').appendTo(this.$el));var c=a.isFunction(this.footer)?this.footer(b):this.footer;this._$footer.html(c)}},_renderNoResultsMessage:function(b){if(this.noResultsMessage){this._$noResultsMessage||(this._$noResultsMessage=a('
    • ').appendTo(this.$el));var c=a.isFunction(this.noResultsMessage)?this.noResultsMessage(b):this.noResultsMessage;this._$noResultsMessage.html(c)}},_renderContents:function(a){this._$footer?this._$footer.before(a):this.$el.append(a)},_fitToBottom:function(){var a=c.scrollTop()+c.height(),b=this.$el.height();this.$el.position().top+b>a&&(this.completer.$iframe||this.$el.offset({top:a-b}))},_fitToRight:function(){for(var a,b=30,d=this.$el.offset().left,e=this.$el.width(),f=c.width()-b;d+e>f&&(this.$el.offset({left:d-b}),a=this.$el.offset().left,!(a>=d));)d=a},_applyPlacement:function(a){return-1!==this.placement.indexOf("top")?a={top:"auto",bottom:this.$el.parent().height()-a.top+a.lineHeight,left:a.left}:(a.bottom="auto",delete a.lineHeight),-1!==this.placement.indexOf("absleft")?a.left=0:-1!==this.placement.indexOf("absright")&&(a.right=0,a.left="auto"),a}}),a.fn.textcomplete.Dropdown=b,a.extend(a.fn.textcomplete,f)}(a),+function(a){"use strict";function b(b){a.extend(this,b),this.cache&&(this.search=c(this.search))}var c=function(a){var b={};return function(c,d){b[c]?d(b[c]):a.call(this,c,function(a){b[c]=(b[c]||[]).concat(a),d.apply(null,arguments)})}};b.parse=function(c,d){return a.map(c,function(a){var c=new b(a);return c.el=d.el,c.$el=d.$el,c})},a.extend(b.prototype,{match:null,replace:null,search:null,id:null,cache:!1,context:function(){return!0},index:2,template:function(a){return a},idProperty:null}),a.fn.textcomplete.Strategy=b}(a),+function(a){"use strict";function b(){}var c=Date.now||function(){return(new Date).getTime()},d=function(a,b){var d,e,f,g,h,i=function(){var j=c()-g;b>j?d=setTimeout(i,b-j):(d=null,h=a.apply(f,e),f=e=null)};return function(){return f=this,e=arguments,g=c(),d||(d=setTimeout(i,b)),h}};a.extend(b.prototype,{id:null,completer:null,el:null,$el:null,option:null,initialize:function(b,c,e){this.el=b,this.$el=a(b),this.id=c.id+this.constructor.name,this.completer=c,this.option=e,this.option.debounce&&(this._onKeyup=d(this._onKeyup,this.option.debounce)),this._bindEvents()},destroy:function(){this.$el.off("."+this.id),this.$el=this.el=this.completer=null},select:function(){throw new Error("Not implemented")},getCaretPosition:function(){var b=this._getCaretRelativePosition(),c=this.$el.offset(),d=this.option.appendTo;if(d){d instanceof a||(d=a(d));var e=d.offsetParent().offset();c.top-=e.top,c.left-=e.left}return b.top+=c.top,b.left+=c.left,b},focus:function(){this.$el.focus()},_bindEvents:function(){this.$el.on("keyup."+this.id,a.proxy(this._onKeyup,this))},_onKeyup:function(a){this._skipSearch(a)||this.completer.trigger(this.getTextFromHeadToCaret(),!0)},_skipSearch:function(a){switch(a.keyCode){case 9:case 13:case 40:case 38:return!0}if(a.ctrlKey)switch(a.keyCode){case 78:case 80:return!0}}}),a.fn.textcomplete.Adapter=b}(a),+function(a){"use strict";function b(a,b,c){this.initialize(a,b,c)}a.extend(b.prototype,a.fn.textcomplete.Adapter.prototype,{select:function(b,c,d){var e=this.getTextFromHeadToCaret(),f=this.el.value.substring(this.el.selectionEnd),g=c.replace(b,d);"undefined"!=typeof g&&(a.isArray(g)&&(f=g[1]+f,g=g[0]),e=e.replace(c.match,g),this.$el.val(e+f),this.el.selectionStart=this.el.selectionEnd=e.length)},getTextFromHeadToCaret:function(){return this.el.value.substring(0,this.el.selectionEnd)},_getCaretRelativePosition:function(){var b=a.fn.textcomplete.getCaretCoordinates(this.el,this.el.selectionStart);return{top:b.top+this._calculateLineHeight()-this.$el.scrollTop(),left:b.left-this.$el.scrollLeft()}},_calculateLineHeight:function(){var a=parseInt(this.$el.css("line-height"),10);if(isNaN(a)){var b=this.el.parentNode,c=document.createElement(this.el.nodeName),d=this.el.style;c.setAttribute("style","margin:0px;padding:0px;font-family:"+d.fontFamily+";font-size:"+d.fontSize),c.innerHTML="test",b.appendChild(c),a=c.clientHeight,b.removeChild(c)}return a}}),a.fn.textcomplete.Textarea=b}(a),+function(a){"use strict";function b(b,d,e){this.initialize(b,d,e),a(""+c+"").css({position:"absolute",top:-9999,left:-9999}).insertBefore(b)}var c="吶";a.extend(b.prototype,a.fn.textcomplete.Textarea.prototype,{select:function(b,c,d){var e=this.getTextFromHeadToCaret(),f=this.el.value.substring(e.length),g=c.replace(b,d);if("undefined"!=typeof g){a.isArray(g)&&(f=g[1]+f,g=g[0]),e=e.replace(c.match,g),this.$el.val(e+f),this.el.focus();var h=this.el.createTextRange();h.collapse(!0),h.moveEnd("character",e.length),h.moveStart("character",e.length),h.select()}},getTextFromHeadToCaret:function(){this.el.focus();var a=document.selection.createRange();a.moveStart("character",-this.el.value.length);var b=a.text.split(c);return 1===b.length?b[0]:b[1]}}),a.fn.textcomplete.IETextarea=b}(a),+function(a){"use strict";function b(a,b,c){this.initialize(a,b,c)}a.extend(b.prototype,a.fn.textcomplete.Adapter.prototype,{select:function(b,c,d){var e=this.getTextFromHeadToCaret(),f=this.el.ownerDocument.getSelection(),g=f.getRangeAt(0),h=g.cloneRange();h.selectNodeContents(g.startContainer);var i=h.toString(),j=i.substring(g.startOffset),k=c.replace(b,d);if("undefined"!=typeof k){a.isArray(k)&&(j=k[1]+j,k=k[0]),e=e.replace(c.match,k).replace(/ $/," "),g.selectNodeContents(g.startContainer),g.deleteContents();var l=this.el.ownerDocument.createElement("div");l.innerHTML=e;var m=this.el.ownerDocument.createElement("div");m.innerHTML=j;for(var n,o,p=this.el.ownerDocument.createDocumentFragment();n=l.firstChild;)o=p.appendChild(n);for(;n=m.firstChild;)p.appendChild(n);g.insertNode(p),g.setStartAfter(o),g.collapse(!0),f.removeAllRanges(),f.addRange(g)}},_getCaretRelativePosition:function(){var b=this.el.ownerDocument.getSelection().getRangeAt(0).cloneRange(),c=this.el.ownerDocument.createElement("span");b.insertNode(c),b.selectNodeContents(c),b.deleteContents();var d=a(c),e=d.offset();if(e.left-=this.$el.offset().left,e.top+=d.height()-this.$el.offset().top,e.lineHeight=d.height(),this.completer.$iframe){var f=this.completer.$iframe.offset();e.top+=f.top,e.left+=f.left,e.top-=this.$el.scrollTop()}return d.remove(),e},getTextFromHeadToCaret:function(){var a=this.el.ownerDocument.getSelection().getRangeAt(0),b=a.cloneRange();return b.selectNodeContents(a.startContainer),b.toString().substring(0,a.startOffset)}}),a.fn.textcomplete.ContentEditable=b}(a),+function(a){"use strict";function b(a,b,c){this.initialize(a,b,c)}a.extend(b.prototype,a.fn.textcomplete.ContentEditable.prototype,{_bindEvents:function(){var b=this;CKEDITOR.instances.issue_notes.on("key",function(a){var c=a.data;return b._onKeyup(c),b.completer.dropdown.shown&&b._skipSearch(c)?!1:void 0},null,null,1),this.$el.on("keyup."+this.id,a.proxy(this._onKeyup,this))}}),a.fn.textcomplete.CKEditor=b}(a),function(a){function b(a,b,f){if(!d)throw new Error("textarea-caret-position#getCaretCoordinates should only be called in a browser");var g=f&&f.debug||!1;if(g){var h=document.querySelector("#input-textarea-caret-position-mirror-div");h&&h.parentNode.removeChild(h)}var i=document.createElement("div");i.id="input-textarea-caret-position-mirror-div",document.body.appendChild(i);var j=i.style,k=window.getComputedStyle?getComputedStyle(a):a.currentStyle;j.whiteSpace="pre-wrap","INPUT"!==a.nodeName&&(j.wordWrap="break-word"),j.position="absolute",g||(j.visibility="hidden"),c.forEach(function(a){j[a]=k[a]}),e?a.scrollHeight>parseInt(k.height)&&(j.overflowY="scroll"):j.overflow="hidden",i.textContent=a.value.substring(0,b),"INPUT"===a.nodeName&&(i.textContent=i.textContent.replace(/\s/g," "));var l=document.createElement("span");l.textContent=a.value.substring(b)||".",i.appendChild(l);var m={top:l.offsetTop+parseInt(k.borderTopWidth),left:l.offsetLeft+parseInt(k.borderLeftWidth)};return g?l.style.backgroundColor="#aaa":document.body.removeChild(i),m}var c=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],d="undefined"!=typeof window,e=d&&null!=window.mozInnerScreenX;a.fn.textcomplete.getCaretCoordinates=b}(a),a}); +//# sourceMappingURL=dist/jquery.textcomplete.min.map \ No newline at end of file diff --git a/main/inc/lib/javascript/jquery-textcomplete/jquery.textcomplete.min.map b/main/inc/lib/javascript/jquery-textcomplete/jquery.textcomplete.min.map index 3fbebd5213..47283a1bce 100644 --- a/main/inc/lib/javascript/jquery-textcomplete/jquery.textcomplete.min.map +++ b/main/inc/lib/javascript/jquery-textcomplete/jquery.textcomplete.min.map @@ -1 +1 @@ -{"version":3,"file":"dist/jquery.textcomplete.min.js","sources":["dist/jquery.textcomplete.js"],"names":["jQuery","Error","$","warn","message","console","fn","textcomplete","strategies","option","args","Array","prototype","slice","call","arguments","this","each","$this","completer","data","Completer","shift","apply","obj","name","register","Strategy","parse","element","$el","id","uniqueId","views","extend","DEFAULTS","is","isContentEditable","document","activeElement","initialize","self","one","lock","func","locked","queuedArgsToReplay","unshift","replayOrFree","replayArgs","undefined","isString","Object","toString","appendTo","zIndex","adapter","dropdown","get","Dropdown","Adapter","viewName","selectionEnd","destroy","off","trigger","text","skipUnchangedTerm","getTextFromHeadToCaret","searchQuery","_extractSearchQuery","length","term","_term","_search","deactivate","fire","eventName","push","select","value","strategy","focus","_clearAtNext","i","context","match","index","free","search","stillSearching","shown","activate","setPosition","getCaretPosition","clear","render","_zip","map","findOrCreateElement","_data","$inputEl","listPosition","height","_i","_bindEvents","dropdownViews","include","zippedData","datum","elem","idProperty","on","e","originalEvent","keepTextCompleteDropdown","key","view","$parent","children","css","display","left","position","footer","header","maxCount","placement","className","contentsHtml","_buildContents","unzippedData","d","_renderHeader","_renderFooter","_renderContents","_activateIndexedItem","_setScroll","_applyPlacement","html","_index","_$header","_$footer","show","addClass","hide","removeClass","isUp","keyCode","ctrlKey","isDown","isEnter","modifiers","altKey","metaKey","shiftKey","isPageup","isPagedown","proxy","_onClick","_onMouseover","_onKeydown","target","preventDefault","hasClass","closest","parseInt","setTimeout","_up","_down","_enter","_pageup","_pagedown","_getActiveElement","threshold","top","innerHeight","outerHeight","find","$activeEl","itemTop","itemHeight","visibleHeight","visibleTop","scrollTop","template","prependTo","isFunction","before","append","indexOf","bottom","parent","lineHeight","right","options","cache","memoize","memo","callback","concat","optionsArray","replace","now","Date","getTime","debounce","wait","timeout","timestamp","result","later","last","el","constructor","_onKeyup","_getCaretRelativePosition","offset","_skipSearch","clickEvent","Textarea","DIV_PROPERTIES","whiteSpace","COPY_PROPERTIES","pre","post","substring","newSubstr","isArray","val","selectionStart","dummyDiv","_copyCss","span","remove","overflow","scrollHeight","offsetHeight","_getStyles","color","styles","property","IETextarea","sentinelChar","insertBefore","_getTextFromHeadToCaret","range","createTextRange","collapse","moveEnd","moveStart","selection","createRange","arr","split","ContentEditable","sel","window","getSelection","getRangeAt","cloneRange","selectNodeContents","startContainer","content","startOffset","deleteContents","node","createTextNode","insertNode","setStart","removeAllRanges","addRange","createElement","$node","dir","attr","listView","width"],"mappings":"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"} \ No newline at end of file +{"version":3,"file":"dist/jquery.textcomplete.min.js","sources":["dist/jquery.textcomplete.js"],"names":["factory","define","amd","module","exports","$","require","jQuery","Error","warn","message","console","id","fn","textcomplete","strategies","option","args","Array","prototype","slice","call","arguments","this","each","self","$this","completer","data","_oid","Completer","shift","apply","removeData","obj","name","register","Strategy","parse","el","$el","element","uniqueId","views","extend","_getDefaults","is","isContentEditable","contentEditable","ownerDocument","activeElement","initialize","one","adapter","CKEDITOR","on","event","editor","once","event2","editable","lock","func","locked","queuedArgsToReplay","unshift","replayOrFree","replayArgs","undefined","isString","Object","toString","isFunction","DEFAULTS","appendTo","className","dropdownClassName","maxCount","zIndex","dropdown","$iframe","get","prop","document","window","frames","length","iframeIndex","frameElement","Dropdown","Adapter","viewName","selectionEnd","destroy","off","deactivate","trigger","text","skipUnchangedTerm","getTextFromHeadToCaret","searchQuery","_extractSearchQuery","term","_term","_search","fire","eventName","push","select","value","strategy","e","focus","_clearAtNext","i","context","matchRegexp","match","index","free","search","stillSearching","shown","activate","clear","setPosition","getCaretPosition","render","_zip","map","createElement","_data","$inputEl","listPosition","height","_i","_bindEvents","dropdownViews","$window","include","zippedData","datum","elem","idProperty","originalEvent","keepTextCompleteDropdown","key","view","commands","SKIP_DEFAULT","KEY_UP","KEY_DOWN","KEY_ENTER","KEY_PAGEUP","KEY_PAGEDOWN","KEY_ESCAPE","$parent","addClass","attr","css","display","left","position","footer","header","placement","remove","contentsHtml","_buildContents","unzippedData","d","removeAttr","_renderHeader","_renderFooter","_renderContents","_fitToBottom","_fitToRight","_activateIndexedItem","_setScroll","noResultsMessage","_renderNoResultsMessage","pos","add","parents","top","scrollTop","scrollLeft","_applyPlacement","html","_index","_$header","_$footer","_$noResultsMessage","show","hide","removeClass","isUp","keyCode","ctrlKey","isDown","isEnter","modifiers","altKey","metaKey","shiftKey","completeOnSpace","isPageup","isPagedown","isEscape","proxy","_onClick","_onMouseover","_onKeydown","target","preventDefault","hasClass","closest","parseInt","setTimeout","type","command","onKeydown","_defaultKeydown","_up","_down","_enter","_pageup","_pagedown","_getActiveElement","threshold","innerHeight","children","outerHeight","find","$activeEl","itemTop","itemHeight","visibleHeight","visibleTop","template","prependTo","before","append","windowScrollBottom","offset","tolerance","lastOffset","width","maxLeft","indexOf","bottom","parent","lineHeight","right","options","cache","memoize","memo","callback","concat","strategiesArray","params","strategyObj","replace","now","Date","getTime","debounce","wait","timeout","timestamp","result","later","last","constructor","_onKeyup","_getCaretRelativePosition","parentOffset","offsetParent","_skipSearch","clickEvent","Textarea","pre","post","substring","newSubstr","isArray","val","selectionStart","p","getCaretCoordinates","_calculateLineHeight","isNaN","parentNode","temp","nodeName","style","setAttribute","fontFamily","fontSize","innerHTML","appendChild","clientHeight","removeChild","IETextarea","sentinelChar","insertBefore","range","createTextRange","collapse","moveEnd","moveStart","selection","createRange","arr","split","ContentEditable","sel","getSelection","getRangeAt","cloneRange","selectNodeContents","startContainer","content","startOffset","deleteContents","preWrapper","postWrapper","childNode","lastOfPre","fragment","createDocumentFragment","firstChild","insertNode","setStartAfter","removeAllRanges","addRange","node","$node","iframePosition","CKEditor","instances","domEvent","isBrowser","debug","querySelector","div","body","computed","getComputedStyle","currentStyle","whiteSpace","wordWrap","visibility","properties","forEach","isFirefox","scrollHeight","overflowY","overflow","textContent","span","coordinates","offsetTop","offsetLeft","backgroundColor","mozInnerScreenX"],"mappings":"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"} \ No newline at end of file diff --git a/main/inc/lib/legal.lib.php b/main/inc/lib/legal.lib.php index 648e0b726b..7b5b0c0074 100755 --- a/main/inc/lib/legal.lib.php +++ b/main/inc/lib/legal.lib.php @@ -181,6 +181,9 @@ class LegalManager $preview = '
      '; } $preview .= get_lang('ByClickingRegisterYouAgreeTermsAndConditions'); + if (api_get_setting('load_term_conditions_section') === 'course') { + $preview = ''; + } break; // Page link case 1: @@ -276,4 +279,51 @@ class LegalManager return Database::result($rs,0,'type'); } + + /** + * @param int $userId + */ + public static function sendLegal($userId) + { + $subject = get_lang('SendTermsSubject'); + $content = sprintf( + get_lang('SendTermsDescriptionToUrlX'), + api_get_path(WEB_PATH) + ); + MessageManager::send_message_simple($userId, $subject, $content); + Display::addFlash(Display::return_message(get_lang('Sent'))); + + $extraFieldValue = new ExtraFieldValue('user'); + $value = $extraFieldValue->get_values_by_handler_and_field_variable($userId, 'termactivated'); + if ($value === false) { + $extraFieldInfo = $extraFieldValue->getExtraField()->get_handler_field_info_by_field_variable('termactivated'); + if ($extraFieldInfo) { + $newParams = array( + 'item_id' => $userId, + 'field_id' => $extraFieldInfo['id'], + 'value' => 1, + 'comment' => '' + ); + $extraFieldValue->save($newParams); + } + } + } + + /** + * @param int $userId + */ + public static function deleteLegal($userId) + { + $extraFieldValue = new ExtraFieldValue('user'); + $value = $extraFieldValue->get_values_by_handler_and_field_variable($userId, 'legal_accept'); + $result = $extraFieldValue->delete($value['id']); + if ($result) { + Display::addFlash(Display::return_message(get_lang('Deleted'))); + } + + $value = $extraFieldValue->get_values_by_handler_and_field_variable($userId, 'termactivated'); + if ($value) { + $extraFieldValue->delete($value['id']); + } + } } diff --git a/main/inc/lib/message.lib.php b/main/inc/lib/message.lib.php index db29bd05a0..172199068a 100755 --- a/main/inc/lib/message.lib.php +++ b/main/inc/lib/message.lib.php @@ -1025,14 +1025,6 @@ class MessageManager // get file attachments by message id $files_attachments = self::get_links_message_attachment_files($message_id, $source); - $user_con = self::users_connected_by_id(); - $band = 0; - for ($i = 0; $i < count($user_con); $i++) { - if ($user_sender_id == $user_con[$i]) { - $band = 1; - } - } - $title = Security::remove_XSS($row['title'], STUDENT, true); $content = Security::remove_XSS($row['content'], STUDENT, true); diff --git a/main/inc/lib/myspace.lib.php b/main/inc/lib/myspace.lib.php index 6f0f95b3a9..6a29ad11a1 100644 --- a/main/inc/lib/myspace.lib.php +++ b/main/inc/lib/myspace.lib.php @@ -19,13 +19,34 @@ class MySpace { $actions = array( //array('url' => api_get_path(WEB_CODE_PATH).'mySpace/index.php', 'content' => get_lang('Home')), - array('url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=coaches', 'content' => get_lang('DisplayCoaches')), - array('url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=user', 'content' => get_lang('DisplayUserOverview')), - array('url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=session', 'content' => get_lang('DisplaySessionOverview')), - array('url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=course', 'content' => get_lang('DisplayCourseOverview')), - array('url' => api_get_path(WEB_CODE_PATH).'tracking/question_course_report.php?view=admin', 'content' => get_lang('LPQuestionListResults')), - array('url' => api_get_path(WEB_CODE_PATH).'tracking/course_session_report.php?view=admin', 'content' => get_lang('LPExerciseResultsBySession')), - ['url' => api_get_path(WEB_CODE_PATH) . 'mySpace/admin_view.php?display=accessoverview', 'content' => get_lang('DisplayAccessOverview') . ' (' . get_lang('Beta') . ')'] + array( + 'url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=coaches', + 'content' => get_lang('DisplayCoaches'), + ), + array( + 'url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=user', + 'content' => get_lang('DisplayUserOverview'), + ), + array( + 'url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=session', + 'content' => get_lang('DisplaySessionOverview'), + ), + array( + 'url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=course', + 'content' => get_lang('DisplayCourseOverview'), + ), + array( + 'url' => api_get_path(WEB_CODE_PATH).'tracking/question_course_report.php?view=admin', + 'content' => get_lang('LPQuestionListResults'), + ), + array( + 'url' => api_get_path(WEB_CODE_PATH).'tracking/course_session_report.php?view=admin', + 'content' => get_lang('LPExerciseResultsBySession'), + ), + [ + 'url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=accessoverview', + 'content' => get_lang('DisplayAccessOverview').' ('.get_lang('Beta').')', + ], ); return Display :: actions($actions, null); @@ -34,10 +55,19 @@ class MySpace public static function getTopMenu() { $menu_items = array(); - $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ); - $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher'); + $menu_items[] = Display::url( + Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), + api_get_path(WEB_CODE_PATH)."auth/my_progress.php" + ); + $menu_items[] = Display::url( + Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), + api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher' + ); $menu_items[] = Display::url(Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32), '#'); - $menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH).'tracking/exams.php'); + $menu_items[] = Display::url( + Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), + api_get_path(WEB_CODE_PATH).'tracking/exams.php' + ); $menu = null; foreach ($menu_items as $item) { $menu .= $item; @@ -54,7 +84,7 @@ class MySpace * @param string $file_name The name of the file which contains exported data. * @return string mixed Returns a message (string) if an error occurred. */ - function export_csv($header, $data, $file_name = 'export.csv') + public function export_csv($header, $data, $file_name = 'export.csv') { $archive_path = api_get_path(SYS_ARCHIVE_PATH); $archive_url = api_get_path(WEB_CODE_PATH).'course_info/download.php?archive='; @@ -93,7 +123,7 @@ class MySpace * @param int Session id (optional, default = 0) * @return array Conections */ - static function get_connections_to_course($user_id, $courseId, $session_id = 0) + public static function get_connections_to_course($user_id, $courseId, $session_id = 0) { // Database table definitions $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); @@ -128,7 +158,7 @@ class MySpace * @param int $session_id * @return array|bool */ - static function get_connections_from_course_list($user_id, $course_list, $session_id = 0) + public static function get_connections_from_course_list($user_id, $course_list, $session_id = 0) { // Database table definitions $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); @@ -2332,10 +2362,10 @@ class MySpace /** * Checks whether a username has been already subscribed in a session. - * @param string a given username - * @param array the array with the course list id - * @param the session id - * @return 0 if the user is not subscribed otherwise it returns the user_id of the given username + * @param string $username a given username + * @param array $course_list the array with the course list id + * @param int $id_session the session id + * @return int 0 if the user is not subscribed otherwise it returns the user_id of the given username * @author Julio Montoya */ public static function user_available_in_session($username, $course_list, $id_session) @@ -2361,6 +2391,7 @@ class MySpace return 0; } } + return 0; } /** diff --git a/main/inc/lib/nusoap/class.nusoap_base.php b/main/inc/lib/nusoap/class.nusoap_base.php index 25995bc8d6..c36a06a809 100755 --- a/main/inc/lib/nusoap/class.nusoap_base.php +++ b/main/inc/lib/nusoap/class.nusoap_base.php @@ -222,7 +222,7 @@ class nusoap_base { * * @access public */ - function nusoap_base() { + function __construct() { $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; } @@ -557,7 +557,6 @@ class nusoap_base { $xml .= "<$name$xmlns$type_str$atts>$pXml"; } break; - break; case (is_array($val) || $type): // detect if struct or array $valueType = $this->isArraySimpleOrStruct($val); @@ -991,6 +990,3 @@ function usleepWindows($usec) } while ($timePassed < $usec); } - - -?> diff --git a/main/inc/lib/nusoap/class.soap_parser.php b/main/inc/lib/nusoap/class.soap_parser.php index 837510109d..369e7a0609 100755 --- a/main/inc/lib/nusoap/class.soap_parser.php +++ b/main/inc/lib/nusoap/class.soap_parser.php @@ -26,7 +26,7 @@ class nusoap_parser extends nusoap_base var $default_namespace = ''; var $namespaces = array(); var $message = array(); - var $parent = ''; + var $parent; var $fault = false; var $fault_code = ''; var $fault_str = ''; @@ -51,7 +51,8 @@ class nusoap_parser extends nusoap_base * @param string $xml SOAP message * @param string $encoding character encoding scheme of message * @param string $method method for which XML is parsed (unused?) - * @param string $decode_utf8 whether to decode UTF-8 to ISO-8859-1 + * @param bool $decode_utf8 whether to decode UTF-8 to ISO-8859-1 + * @return void|bool * @access public */ function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){ @@ -74,7 +75,7 @@ class nusoap_parser extends nusoap_base $this->debug($err); if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') { $this->setError($err); - return; + return false; } // when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed } else { diff --git a/main/inc/lib/online.inc.php b/main/inc/lib/online.inc.php index c233c0792c..58133ff6b5 100755 --- a/main/inc/lib/online.inc.php +++ b/main/inc/lib/online.inc.php @@ -149,8 +149,7 @@ function online_logout($user_id = null, $logout_redirect = false) } } - require_once api_get_path(SYS_PATH) . 'main/chat/chat_functions.lib.php'; - exit_of_chat($user_id); + CourseChatUtils::exitChat($user_id); session_regenerate_id(); Session::destroy(); if ($logout_redirect) { @@ -472,54 +471,3 @@ function GetFullUserName($uid) { } } } - -/** - * Gets a list of chat calls made by others to the current user (info kept in main.user table) - * @param none - taken from global space - * @return string An HTML-formatted message - */ -function chatcall() { - $_cid = api_get_course_id(); - $_user = api_get_user_info(); - - if (!$_user['user_id']) { - return (false); - } - $userId = intval($_user['user_id']); - $track_user_table = Database::get_main_table(TABLE_MAIN_USER); - $sql="SELECT chatcall_user_id, chatcall_date FROM $track_user_table - WHERE ( id = $userId )"; - $result=Database::query($sql); - $row=Database::fetch_array($result); - - $login_date=$row['chatcall_date']; - $hour = substr($login_date,11,2); - $minute = substr($login_date,14,2); - $second = substr($login_date,17,2); - $month = substr($login_date,5,2); - $day = substr($login_date,8,2); - $year = substr($login_date,0,4); - $calltime = mktime($hour,$minute,$second,$month,$day,$year); - - $time = api_get_utc_datetime(); - $minute_passed=5; //within this limit, the chat call request is valid - $limittime = mktime(date("H"),date("i")-$minute_passed,date("s"),date("m"),date("d"),date("Y")); - - if (($row['chatcall_user_id']) and ($calltime>$limittime)) { - $webpath=api_get_path(WEB_CODE_PATH); - $message=get_lang('YouWereCalled').' : '.GetFullUserName($row['chatcall_user_id'],'').'
      '.get_lang('DoYouAccept') - ."

      " - ."" - . get_lang("Yes") - ."" - ."  |  " - ."" - . get_lang("No") - ."" - ."

      "; - - return($message); - } else { - return false; - } -} diff --git a/main/inc/lib/pdf.lib.php b/main/inc/lib/pdf.lib.php index b551c683e7..ec340ebcef 100755 --- a/main/inc/lib/pdf.lib.php +++ b/main/inc/lib/pdf.lib.php @@ -766,7 +766,7 @@ class PDF } /** - * @param string $header html content + * @param array $header html content */ public function set_custom_header($header) { @@ -774,7 +774,7 @@ class PDF } /** - * @param string $footer html content + * @param array $footer html content */ public function set_custom_footer($footer) { diff --git a/main/inc/lib/pear/HTML/QuickForm/select.php b/main/inc/lib/pear/HTML/QuickForm/select.php index 93c58a3b20..cee20a88b7 100755 --- a/main/inc/lib/pear/HTML/QuickForm/select.php +++ b/main/inc/lib/pear/HTML/QuickForm/select.php @@ -49,7 +49,7 @@ class HTML_QuickForm_select extends HTML_QuickForm_element /** * Default values of the SELECT * - * @var string + * @var array * @since 1.0 * @access private */ diff --git a/main/inc/lib/pear/PEAR.php b/main/inc/lib/pear/PEAR.php index ff9208c9cb..393faba79d 100755 --- a/main/inc/lib/pear/PEAR.php +++ b/main/inc/lib/pear/PEAR.php @@ -19,10 +19,6 @@ * @since File available since Release 0.1 */ -// Added by Chamilo team, 16-MAR-2010 -if (class_exists('pear')) { return; } -// - /**#@+ * ERROR constants */ @@ -156,7 +152,7 @@ class PEAR * @access public * @return void */ - public function __construc($error_class = null) + public function __construct($error_class = null) { $classname = strtolower(get_class($this)); if ($this->_debug) { @@ -867,9 +863,13 @@ class PEAR_Error * @access public * */ - public function __construct($message = 'unknown error', $code = null, - $mode = null, $options = null, $userinfo = null) - { + public function __construct( + $message = 'unknown error', + $code = null, + $mode = null, + $options = null, + $userinfo = null + ) { if ($mode === null) { $mode = PEAR_ERROR_RETURN; } diff --git a/main/inc/lib/phpmailer/class.phpmailer.php b/main/inc/lib/phpmailer/class.phpmailer.php index 3c3487c585..3ceaf2c4a9 100755 --- a/main/inc/lib/phpmailer/class.phpmailer.php +++ b/main/inc/lib/phpmailer/class.phpmailer.php @@ -2013,7 +2013,9 @@ class PHPMailer { /** * Evaluates the message and returns modifications for inline images and backgrounds * @access public - * @return $message + * @param string $message + * @param string $basedir + * @return void */ public function MsgHTML($message, $basedir = '') { preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images); diff --git a/main/inc/lib/phpmailer/class.smtp.php b/main/inc/lib/phpmailer/class.smtp.php index c2ca1cb3b8..17c4b93729 100755 --- a/main/inc/lib/phpmailer/class.smtp.php +++ b/main/inc/lib/phpmailer/class.smtp.php @@ -89,7 +89,7 @@ class SMTP { $this->error = null; $this->helo_rply = null; - $this->do_debug = 0; + $this->do_debug = false; } ///////////////////////////////////////////////// diff --git a/main/inc/lib/plugin.lib.php b/main/inc/lib/plugin.lib.php index 56f7468120..aed7fb63c9 100755 --- a/main/inc/lib/plugin.lib.php +++ b/main/inc/lib/plugin.lib.php @@ -23,6 +23,7 @@ class AppPlugin 'footer_left', 'footer_center', 'footer_right', + 'menu_administrator', 'course_tool_plugin' ); diff --git a/main/inc/lib/search/tool_processors/learnpath_processor.class.php b/main/inc/lib/search/tool_processors/learnpath_processor.class.php index ec63cb1acc..d795fa7bb2 100755 --- a/main/inc/lib/search/tool_processors/learnpath_processor.class.php +++ b/main/inc/lib/search/tool_processors/learnpath_processor.class.php @@ -52,7 +52,7 @@ class learnpath_processor extends search_processor { $visibility = api_get_item_visibility(api_get_course_info($courseid), TOOL_LEARNPATH, $lp_id); if ($visibility) { list($thumbnail, $image, $name, $author) = $this->get_information($courseid, $lp_id, $lp['has_document_id']); - $url = api_get_path(WEB_PATH) . 'main/newscorm/lp_controller.php?cidReq=%s&action=view&lp_id=%s'; + $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?cidReq=%s&action=view&lp_id=%s'; $url = sprintf($url, $courseid, $lp_id); $result = array( 'toolid' => TOOL_LEARNPATH, diff --git a/main/inc/lib/search/tool_processors/quiz_processor.class.php b/main/inc/lib/search/tool_processors/quiz_processor.class.php index 320de4e328..2f86b36f3f 100755 --- a/main/inc/lib/search/tool_processors/quiz_processor.class.php +++ b/main/inc/lib/search/tool_processors/quiz_processor.class.php @@ -70,7 +70,7 @@ class quiz_processor extends search_processor { $visibility = api_get_item_visibility(api_get_course_info($courseid), TOOL_QUIZ, $exercise_id); if ($visibility) { list($thumbnail, $image, $name, $author) = $this->get_information($courseid, $exercise_id); - $url = api_get_path(WEB_PATH) . 'main/exercice/exercise_submit.php?cidReq=%s&exerciseId=%s'; + $url = api_get_path(WEB_CODE_PATH) . 'exercise/exercise_submit.php?cidReq=%s&exerciseId=%s'; $url = sprintf($url, $courseid, $exercise_id); $result = array( 'toolid' => TOOL_QUIZ, diff --git a/main/inc/lib/security.lib.php b/main/inc/lib/security.lib.php index c369eb9993..fef5726b9d 100755 --- a/main/inc/lib/security.lib.php +++ b/main/inc/lib/security.lib.php @@ -396,24 +396,26 @@ class Security /** * * Filter content - * @param string content to be filter + * @param string $text to be filter * @return string */ - static function filter_terms($text) + public static function filter_terms($text) { static $bad_terms = array(); if (empty($bad_terms)) { $list = api_get_setting('filter_terms'); - $list = explode("\n", $list); - $list = array_filter($list); if (!empty($list)) { - foreach ($list as $term) { - $term = str_replace(array("\r\n", "\r", "\n", "\t"), '', $term); - $html_entities_value = api_htmlentities($term, ENT_QUOTES, api_get_system_encoding()); - $bad_terms[] = $term; - if ($term != $html_entities_value) { - $bad_terms[] = $html_entities_value; + $list = explode("\n", $list); + $list = array_filter($list); + if (!empty($list)) { + foreach ($list as $term) { + $term = str_replace(array("\r\n", "\r", "\n", "\t"), '', $term); + $html_entities_value = api_htmlentities($term, ENT_QUOTES, api_get_system_encoding()); + $bad_terms[] = $term; + if ($term != $html_entities_value) { + $bad_terms[] = $html_entities_value; + } } } $bad_terms = array_filter($bad_terms); @@ -421,30 +423,12 @@ class Security } $replace = '***'; - if (!empty($bad_terms)) { - //Fast way + // Fast way $new_text = str_ireplace($bad_terms, $replace, $text, $count); - - //We need statistics - /* - if (strlen($new_text) != strlen($text)) { - $table = Database::get_main_table(TABLE_STATISTIC_TRACK_FILTERED_TERMS); - $attributes = array(); - - - $attributes['user_id'] = - $attributes['course_id'] = - $attributes['session_id'] = - $attributes['tool_id'] = - $attributes['term'] = - $attributes['created_at'] = api_get_utc_datetime(); - $sql = Database::insert($table, $attributes); - } - */ $text = $new_text; - } + return $text; } diff --git a/main/inc/lib/sessionmanager.lib.php b/main/inc/lib/sessionmanager.lib.php index a49546c97c..77181ed041 100755 --- a/main/inc/lib/sessionmanager.lib.php +++ b/main/inc/lib/sessionmanager.lib.php @@ -3170,7 +3170,7 @@ class SessionManager if (Database::num_rows($result) > 0) { $sysUploadPath = api_get_path(SYS_UPLOAD_PATH). 'sessions/'; $webUploadPath = api_get_path(WEB_UPLOAD_PATH). 'sessions/'; - $imgPath = Display::returnIconPath('session_default_small.png'); + $imgPath = Display::return_icon('session_default_small.png', null, null, null, null, true); $tableExtraFields = Database::get_main_table(TABLE_EXTRA_FIELD); $sql = "SELECT id FROM " . $tableExtraFields . " @@ -4040,7 +4040,7 @@ class SessionManager * @param array $groupBackup * @return array */ - static function importCSV( + public static function importCSV( $file, $updateSession, $defaultUserId = null, diff --git a/main/inc/lib/skill.lib.php b/main/inc/lib/skill.lib.php index 0106a062a2..776fd4a84f 100755 --- a/main/inc/lib/skill.lib.php +++ b/main/inc/lib/skill.lib.php @@ -457,7 +457,7 @@ class SkillRelUser extends Model } $courseId = intval($courseId); - $sessionId = intval($sessionId); + $sessionId = $sessionId ? intval($sessionId) : null; $whereConditions = array( 'user_id = ? ' => intval($userId) @@ -494,7 +494,7 @@ class SkillRelUser extends Model intval($userId), intval($skillId), intval($courseId), - intval($sessionId) + $sessionId ? intval($sessionId) : null ) ); @@ -813,7 +813,7 @@ class Skill extends Model 'skill_id' => $skill_gradebook['skill_id'], 'acquired_skill_at' => api_get_utc_datetime(), 'course_id' => intval($courseId), - 'session_id' => intval($sessionId) + 'session_id' => $sessionId ? intval($sessionId) : null ); $skill_rel_user->save($params); @@ -1281,7 +1281,7 @@ class Skill extends Model if ($courseId > 0) { $whereConditions['AND course_id = ? '] = $courseId; - $whereConditions['AND session_id = ? '] = $sessionId; + $whereConditions['AND session_id = ? '] = $sessionId ? $sessionId : null; } $result = Database::select( diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php index d309982b36..bc20e13b38 100755 --- a/main/inc/lib/social.lib.php +++ b/main/inc/lib/social.lib.php @@ -1047,6 +1047,10 @@ class SocialManager extends UserManager } $userPicture = $user_info['avatar']; + $officialCode = ''; + if (api_get_setting('show_official_code_whoisonline') == 'true') { + $officialCode .= '

      '.$user_info['official_code'].'

      '; + } $img = ''.$completeName.''; $url = null; @@ -1068,6 +1072,7 @@ class SocialManager extends UserManager
      '.$name.'
      + '.$officialCode.'
      '.$status_icon_chat.' '.$user_rol.'
      '; @@ -1735,6 +1740,7 @@ class SocialManager extends UserManager $template->assign('chat_enabled', $chatEnabled); $template->assign('user_relation', $userRelationType); $template->assign('user_relation_type_friend', USER_RELATION_TYPE_FRIEND); + $template->assign('show_full_profile', $show_full_profile); $templateName = $template->get_template('social/user_block.tpl'); if (in_array($groupBlock, ['groups', 'group_edit', 'member_list'])) { diff --git a/main/inc/lib/specific_fields_manager.lib.php b/main/inc/lib/specific_fields_manager.lib.php index 273f645dbc..7f5af370fc 100755 --- a/main/inc/lib/specific_fields_manager.lib.php +++ b/main/inc/lib/specific_fields_manager.lib.php @@ -115,7 +115,7 @@ function get_specific_field_values_list( //Fixing course id if (isset($conditions['c_id'])) { - $course_info = api_get_course_info_by_id($conditions['c_id']); + $course_info = api_get_course_info_by_id(intval($conditions['c_id'])); $conditions['course_code'] = " '".$course_info['code']."' "; unset($conditions['c_id']); } diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index bfcd26130e..62282acb27 100755 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -273,7 +273,7 @@ class Template if (api_get_setting('enable_help_link') == 'true') { if (!empty($help)) { $help = Security::remove_XSS($help); - $content = '
    • '; + $content = '
      '; $content .= Display::url( Display::return_icon('help.large.png', get_lang('Help')), api_get_path(WEB_CODE_PATH) . 'help/help.php?open=' . $help, @@ -282,7 +282,7 @@ class Template 'data-title' => get_lang('Help') ] ); - $content .= '
    • '; + $content .= '
      '; } } $this->assign('help_content', $content); @@ -895,7 +895,7 @@ class Template $this->assign('bug_notification', $bugLink); - $notification = return_notification_menu(); + $notification = returnNotificationMenu(); $this->assign('notification_menu', $notification); $resize = ''; @@ -923,12 +923,12 @@ class Template //Profile link if (api_get_setting('allow_social_tool') == 'true') { $profile_url = api_get_path(WEB_CODE_PATH).'social/home.php'; - $profile_link = Display::url(get_lang('Profile'), $profile_url); + } else { $profile_url = api_get_path(WEB_CODE_PATH).'auth/profile.php'; - $profile_link = Display::url(get_lang('Profile'), $profile_url); + } - $this->assign('profile_link', $profile_link); + $this->assign('profile_url', $profile_url); //Message link diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php index b77bf6eb8c..f2e0216f83 100755 --- a/main/inc/lib/tracking.lib.php +++ b/main/inc/lib/tracking.lib.php @@ -5,6 +5,9 @@ use Chamilo\CoreBundle\Entity\ExtraField as EntityExtraField; use CpChart\Classes\pCache as pCache; use CpChart\Classes\pData as pData; use CpChart\Classes\pImage as pImage; +use Chamilo\UserBundle\Entity\User; +use Chamilo\CoreBundle\Entity\Course; +use Chamilo\CoreBundle\Entity\Session; /** * Class Tracking @@ -959,7 +962,7 @@ class Tracking '; } else { $output .= '
      '; } @@ -969,7 +972,7 @@ class Tracking ' . get_lang('ShowAndQualifyAttempt') . ''; } else { $output .= ''; } } @@ -4799,7 +4802,7 @@ class Tracking ); $html .= ''; - $url = api_get_path(WEB_CODE_PATH)."exercice/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}"; + $url = api_get_path(WEB_CODE_PATH) . "exercise/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}"; if ($visible_return['value'] == true) { $exercices['title'] = Display::url( @@ -4858,7 +4861,7 @@ class Tracking $weighting = $exercise_stat['exe_weighting']; $exe_id = $exercise_stat['exe_id']; - $latest_attempt_url .= api_get_path(WEB_CODE_PATH).'exercice/result.php?id='.$exe_id.'&cidReq='.$course_info['code'].'&show_headers=1&id_session='.$session_id; + $latest_attempt_url .= api_get_path(WEB_CODE_PATH) . 'exercise/result.php?id='.$exe_id.'&cidReq='.$course_info['code'].'&show_headers=1&id_session='.$session_id; $percentage_score_result = Display::url(ExerciseLib::show_score($score, $weighting), $latest_attempt_url); $my_score = 0; if (!empty($weighting) && intval($weighting) != 0) { @@ -4951,7 +4954,7 @@ class Tracking $time_spent_in_lp = api_time_to_hms($time_spent_in_lp); $html .= ''; - $url = api_get_path(WEB_CODE_PATH)."newscorm/lp_controller.php?cidReq={$course_code}&id_session=$session_id&lp_id=$lp_id&action=view"; + $url = api_get_path(WEB_CODE_PATH) . "lp/lp_controller.php?cidReq={$course_code}&id_session=$session_id&lp_id=$lp_id&action=view"; if ($learnpath['lp_visibility'] == 0) { $html .= Display::tag('td', $learnpath['lp_name']); @@ -5769,6 +5772,41 @@ class Tracking } return $data; } + + /** + * @param User $user + * @param string $tool + * @param Course $course + * @param Session|null $session Optional. + * @return \Chamilo\CourseBundle\Entity\CStudentPublication|null + * @throws \Doctrine\ORM\NonUniqueResultException + */ + public static function getLastStudentPublication(User $user, $tool, Course $course, Session $session = null) + { + return Database::getManager() + ->createQuery(" + SELECT csp + FROM ChamiloCourseBundle:CStudentPublication csp + INNER JOIN ChamiloCourseBundle:CItemProperty cip + WITH ( + csp.iid = cip.ref AND + csp.sessionId = cip.session AND + csp.cId = cip.course AND + csp.userId = cip.lasteditUserId + ) + WHERE + cip.session = :session AND cip.course = :course AND cip.lasteditUserId = :user AND cip.tool = :tool + ORDER BY csp.iid DESC + ") + ->setMaxResults(1) + ->setParameters([ + 'tool' => $tool, + 'session' => $session, + 'course' => $course, + 'user' => $user + ]) + ->getOneOrNullResult(); + } } /** @@ -6087,12 +6125,12 @@ class TrackingCourseLog break; case 'learnpath': $table_name = TABLE_LP_MAIN; - $link_tool = 'newscorm/lp_controller.php'; + $link_tool = 'lp/lp_controller.php'; $id_tool = 'id'; break; case 'quiz': $table_name = TABLE_QUIZ_TEST; - $link_tool = 'exercice/exercice.php'; + $link_tool = 'exercise/exercise.php'; $id_tool = 'id'; break; case 'glossary': diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index 71fbd62749..b12b377901 100755 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -145,14 +145,9 @@ class UserManager */ public static function isPasswordValid($encoded, $raw, $salt) { - //$encoder = self::getEncoder($user); $encoder = new \Chamilo\UserBundle\Security\Encoder(self::getPasswordEncryption()); - /*$user->getPassword(), - $password, - $user->getSalt()*/ $validPassword = $encoder->isPasswordValid($encoded, $raw, $salt); - return $validPassword; } @@ -212,6 +207,8 @@ class UserManager * @param bool $send_mail * @param bool $isAdmin * @param string $address + * @param bool $sendEmailToAllAdmins + * @param FormValidator $form * * @return mixed new user id - if the new user creation succeeds, false otherwise * @desc The function tries to retrieve user id from the session. @@ -239,7 +236,9 @@ class UserManager $encrypt_method = '', $send_mail = false, $isAdmin = false, - $address = '' + $address = '', + $sendEmailToAllAdmins = false, + $form = null ) { $currentUserId = api_get_user_id(); $hook = HookCreateUser::create(); @@ -449,6 +448,31 @@ class UserManager $additionalParameters ); } + + if ($sendEmailToAllAdmins) { + $adminList = UserManager::get_all_administrators(); + + $tplContent = new Template(null, false, false, false, false, false); + // variables for the default template + $tplContent->assign('complete_name', stripslashes(api_get_person_name($firstName, $lastName))); + $tplContent->assign('user_added', $user); + /** @var FormValidator $form */ + $form->freeze(); + $form->removeElement('submit'); + $formData = $form->returnForm(); + $url = api_get_path(WEB_CODE_PATH).'admin/user_information.php?user_id='.$user->getId(); + $tplContent->assign('link', Display::url($url, $url)); + $tplContent->assign('form', $formData); + + $layoutContent = $tplContent->get_template('mail/content_registration_platform_to_admin.tpl'); + $emailBody = $tplContent->fetch($layoutContent); + $subject = get_lang('UserAdded'); + + foreach ($adminList as $adminId => $data) { + MessageManager::send_message_simple($adminId, $subject, $emailBody); + } + + } /* ENDS MANAGE EVENT WITH MAIL */ } Event::addEvent(LOG_USER_CREATE, LOG_USER_ID, $return); @@ -835,7 +859,8 @@ class UserManager $language = 'english', $encrypt_method = '', $send_email = false, - $reset_password = 0 + $reset_password = 0, + $address ) { $hook = HookUpdateUser::create(); if (!empty($hook)) { @@ -908,6 +933,7 @@ class UserManager ->setEmail($email) ->setOfficialCode($official_code) ->setPhone($phone) + ->setAddress($address) ->setPictureUri($picture_uri) ->setExpirationDate($expiration_date) ->setActive($active) @@ -2075,7 +2101,7 @@ class UserManager $extraField = new ExtraField('user'); $data = $extraField->get_handler_field_info_by_field_variable($variable); - return empty($data) ? true : false; + return !empty($data) ? true : false; } /** @@ -2284,28 +2310,35 @@ class UserManager } /** Get extra user data by value - * @param string $field_variable the internal variable name of the field - * @param string $field_value the internal value of the field + * @param string $variable the internal variable name of the field + * @param string $value the internal value of the field * @param bool $all_visibility * * @return array with extra data info of a user i.e array('field_variable'=>'value'); */ - public static function get_extra_user_data_by_value($field_variable, $field_value, $all_visibility = true) + public static function get_extra_user_data_by_value($variable, $value, $all_visibility = true) { - $extraField = new ExtraFieldValue('user'); + $extraFieldValue = new ExtraFieldValue('user'); + $extraField = new ExtraField('user'); + + $info = $extraField->get_handler_field_info_by_field_variable($variable); + + if (false === $info) { + return []; + } - $data = $extraField->get_values_by_handler_and_field_variable( - $field_variable, - $field_value, - null, - true, - intval($all_visibility) + $data = $extraFieldValue->get_item_id_from_field_variable_and_field_value( + $variable, + $value, + false, + false, + true ); $result = []; if (!empty($data)) { - foreach ($data as $data) { - $result[] = $data['item_id']; + foreach ($data as $item) { + $result[] = $item['item_id']; } } @@ -3125,28 +3158,27 @@ class UserManager } } - /* + /** * + * Gets the tags of a specific field_id * USER TAGS * - * Intructions to create a new user tag by Julio Montoya + * Instructions to create a new user tag by Julio Montoya * - * 1. Create a new extra field in main/admin/user_fields.php with the "TAG" field type make it available and visible. Called it "books" for example. + * 1. Create a new extra field in main/admin/user_fields.php with the "TAG" field type make it available and visible. + * Called it "books" for example. * 2. Go to profile main/auth/profile.php There you will see a special input (facebook style) that will show suggestions of tags. * 3. All the tags are registered in the user_tag table and the relationship between user and tags is in the user_rel_tag table * 4. Tags are independent this means that tags can't be shared between tags + book + hobbies. * 5. Test and enjoy. * - */ - - /** - * Gets the tags of a specific field_id + * @param string $tag + * @param int $field_id field_id + * @param string $return_format how we are going to result value in array or in a string (json) + * @param $limit * - * @param int field_id - * @param string how we are going to result value in array or in a string (json) * @return mixed - * @since Nov 2009 - * @version 1.8.6.2 + * */ public static function get_tags($tag, $field_id, $return_format = 'json', $limit = 10) { @@ -3163,18 +3195,20 @@ class UserManager $return = array(); if (Database::num_rows($result) > 0) { while ($row = Database::fetch_array($result, 'ASSOC')) { - $return[] = array('caption' => $row['tag'], 'value' => $row['tag']); + $return[] = array('key' => $row['tag'], 'value' => $row['tag']); } } - if ($return_format == 'json') { + if ($return_format === 'json') { $return = json_encode($return); } + return $return; } /** * @param int $field_id * @param int $limit + * * @return array */ public static function get_top_tags($field_id, $limit = 100) @@ -3204,8 +3238,9 @@ class UserManager /** * Get user's tags - * @param int field_id - * @param int user_id + * @param int $user_id + * @param int $field_id + * * @return array */ public static function get_user_tags($user_id, $field_id) @@ -3236,9 +3271,10 @@ class UserManager /** * Get user's tags - * @param int user_id - * @param int field_id - * @param bool show links or not + * @param int $user_id + * @param int $field_id + * @param bool $show_links show links or not + * * @return array */ public static function get_user_tags_to_string($user_id, $field_id, $show_links = true) @@ -3272,18 +3308,21 @@ class UserManager $tag_tmp[] = $tag['tag']; } } + if (is_array($user_tags) && count($user_tags) > 0) { $return = implode(', ', $tag_tmp); } else { + return ''; } + return $return; } /** * Get the tag id - * @param int tag - * @param int field_id + * @param int $tag + * @param int $field_id * @return int returns 0 if fails otherwise the tag id */ public static function get_tag_id($tag, $field_id) @@ -3297,16 +3336,19 @@ class UserManager $result = Database::query($sql); if (Database::num_rows($result) > 0) { $row = Database::fetch_array($result, 'ASSOC'); + return $row['id']; } else { + return 0; } } /** * Get the tag id - * @param int tag - * @param int field_id + * @param int $tag_id + * @param int $field_id + * * @return int 0 if fails otherwise the tag id */ public static function get_tag_id_from_id($tag_id, $field_id) @@ -3327,9 +3369,9 @@ class UserManager /** * Adds a user-tag value - * @param mixed tag - * @param int The user id - * @param int field id of the tag + * @param mixed $tag + * @param int $user_id + * @param int $field_id field id of the tag * @return bool */ public static function add_tag($tag, $user_id, $field_id) @@ -3359,8 +3401,6 @@ class UserManager $result = Database::query($sql); $last_insert_id = Database::insert_id(); } */ - } else { - } //this is a new tag @@ -3391,8 +3431,8 @@ class UserManager /** * Deletes an user tag - * @param int user id - * @param int field id + * @param int $user_id + * @param int $field_id * */ public static function delete_user_tags($user_id, $field_id) @@ -3438,7 +3478,7 @@ class UserManager /** * Returns a list of all administrators - * @author jmontoya + * * @return array */ public static function get_all_administrators() diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index 76a0211e78..725054580a 100755 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -79,7 +79,7 @@ class IndexManager if (!empty($exercise_list)) { $exercise_list = msort($exercise_list, 'tms'); $my_exercise = $exercise_list[0]; - $url = Display::url($my_exercise['title'], api_get_path(WEB_CODE_PATH).'exercice/overview.php?exerciseId='.$my_exercise['id'].'&cidReq='.$my_exercise['course_code'].'&id_session='.$my_exercise['session_id']); + $url = Display::url($my_exercise['title'], api_get_path(WEB_CODE_PATH).'exercise/overview.php?exerciseId='.$my_exercise['id'].'&cidReq='.$my_exercise['course_code'].'&id_session='.$my_exercise['session_id']); $this->tpl->assign('exercise_url', $url); $this->tpl->assign('exercise_end_date', api_convert_and_format_date($my_exercise['end_time'], DATE_FORMAT_SHORT)); } @@ -908,8 +908,16 @@ class IndexManager $editProfileUrl = Display::getProfileEditionLink($user_id); - $profile_content .= '
    • '.Display::return_icon('edit-profile.png',get_lang('EditProfile'),null,ICON_SIZE_SMALL).get_lang('EditProfile').'
    • '; + $profile_content .= '
    • '. + Display::return_icon( + 'edit-profile.png', + get_lang('EditProfile'), + null, + ICON_SIZE_SMALL + ). + get_lang('EditProfile').'
    • '; $profile_content .= ''; + $html = self::show_right_block( get_lang('Profile'), $profile_content, @@ -919,6 +927,21 @@ class IndexManager 'profileCollapse' ); + $setting = api_get_plugin_setting('bbb', 'enable_global_conference'); + $settingLink = api_get_plugin_setting('bbb', 'enable_global_conference_link'); + if ($setting === 'true' && $settingLink === 'true') { + $url = api_get_path(WEB_PLUGIN_PATH).'bbb/start.php?global=1'; + $content = Display::url(get_lang('LaunchVideoConferenceRoom'), $url); + $html .= self::show_right_block( + get_lang('VideoConference'), + $content, + 'videoconference_block', + null, + 'videoconference', + 'videoconferenceCollapse' + ); + } + return $html; } @@ -1051,7 +1074,7 @@ class IndexManager if ($load_history) { // Load sessions in category in *history* $session_categories = UserManager::get_sessions_by_category($user_id, true); - + } else { // Load sessions in category $session_categories = UserManager::get_sessions_by_category($user_id, false); @@ -1065,7 +1088,7 @@ class IndexManager $html .= get_lang('YouDoNotHaveAnySessionInItsHistory'); } } - + $sessionCount = 0; $courseCount = 0; @@ -1085,7 +1108,7 @@ class IndexManager $this->tpl->assign('special_courses', $specialCourses); $this->tpl->assign('courses', $courses); - + if (api_get_configuration_value('view_grid_courses') && ($courses || $specialCourses)) { $listCourse = $this->tpl->fetch( $this->tpl->get_template('/user_portal/grid_courses.tpl')); @@ -1093,13 +1116,11 @@ class IndexManager $listCourse = $this->tpl->fetch( $this->tpl->get_template('/user_portal/classic_courses.tpl')); } - if (!empty($specialCourses['course_count']) && !empty($courses['course_count'])) { - $courseCount = intval($specialCourses['course_count']) + intval($courses['course_count']); - } + + $courseCount = count($specialCourses) + count($courses['in_category']) + count($courses['not_category']); } $sessions_with_category = ''; - $sessions_with_no_category = ''; $coursesListSessionStyle = api_get_configuration_value('courses_list_session_title_link'); $coursesListSessionStyle = $coursesListSessionStyle === false ? 1 : $coursesListSessionStyle; @@ -1210,11 +1231,11 @@ class IndexManager if (api_is_platform_admin()) { $actions = api_get_path(WEB_CODE_PATH) .'session/resume_session.php?id_session='.$session_id; } - + $coachId = $session_box['id_coach']; $extraFieldValue = new ExtraFieldValue('session'); $imageField = $extraFieldValue->get_values_by_handler_and_field_variable($session_id, 'image'); - + $params['category_id'] = $session_box['category_id']; $params['title'] = $session_box['title']; //$params['subtitle'] = $extra_info; @@ -1227,10 +1248,10 @@ class IndexManager $params['duration'] = isset($session_box['duration']) ? ' ' . $session_box['duration'] : null; $params['edit_actions'] = $actions; $params['show_description'] = $session_box['show_description']; - $params['description'] = $session_box['description']; + $params['description'] = $session_box['description']; $params['visibility'] = $session_box['visibility']; $params['show_simple_session_info'] = false; - $params['course_list_session_style'] = $coursesListSessionStyle; + $params['course_list_session_style'] = $coursesListSessionStyle; $params['num_users'] = $session_box['num_users']; $params['num_courses'] = $session_box['num_courses']; $params['courses'] = $html_courses_session; @@ -1500,7 +1521,7 @@ class IndexManager $listCoursesInfo = array(); if (!isset($_GET['history'])) { // Display special courses - $specialCoursesResult = CourseManager::display_special_courses( + $specialCoursesResult = CourseManager::returnSpecialCourses( $user_id, $loadDirs ); diff --git a/main/install/configuration.dist.php b/main/install/configuration.dist.php index 7a898548ad..ae02e41330 100755 --- a/main/install/configuration.dist.php +++ b/main/install/configuration.dist.php @@ -246,3 +246,6 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE; // to reflect their packaging method. The default value is 'chamilo'. This will // be reflected on the https://version.chamilo.org/stats page in the future. //$_configuration['packager'] = 'chamilo'; +// If true exercises added in LP can be modified. +//$_configuration['force_edit_exercise_in_lp'] = false; + diff --git a/main/install/data.sql b/main/install/data.sql index ecfd8360ee..6ce381e5f0 100644 --- a/main/install/data.sql +++ b/main/install/data.sql @@ -743,7 +743,7 @@ INSERT INTO course_module VALUES (17,'AddedLearnpath','','scormbuilder.gif',0,0,'external'), (18,'conference','conference/index.php?type=conference','conf.gif',0,0,'external'), (19,'conference','conference/index.php?type=classroom','conf.gif',0,0,'external'), -(20,'learnpath','newscorm/lp_controller.php','scorms.gif',5,1,'basic'), +(20,'learnpath','lp/lp_controller.php','scorms.gif',5,1,'basic'), (21,'blog','blog/blog.php','blog.gif',1,2,'basic'), (22,'blog_management','blog/blog_admin.php','blog_admin.gif',1,2,'courseadmin'), (23,'course_maintenance','course_info/maintenance.php','backup.gif',2,3,'courseadmin'), @@ -1850,12 +1850,35 @@ VALUES ('enable_record_audio', 'true', 'Yes'), ('enable_record_audio', 'false', 'No'); -UPDATE settings_current SET selected_value = '1.11.0.3' WHERE variable = 'chamilo_database_version'; +-- Version 1.11.0.4 + +INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, created_at) +VALUES +(1, 1, 'skype', 'Skype', 1, 1, now()), +(1, 1, 'linkedin_url', 'LinkedInUrl', 1, 1, now()); + +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, access_url_changeable) +VALUES +('allow_show_skype_account', NULL, 'radio', 'Platform', 'true', 'AllowShowSkypeAccountTitle', 'AllowShowSkypeAccountComment', 1), +('allow_show_linkedin_url', NULL, 'radio', 'Platform', 'true', 'AllowShowLinkedInUrlTitle', 'AllowShowLinkedInUrlComment', 1); + +INSERT INTO settings_options (variable, value, display_text) +VALUES +('allow_show_skype_account', 'true', 'Yes'), +('allow_show_skype_account', 'false', 'No'), +('allow_show_linkedin_url', 'true', 'Yes'), +('allow_show_linkedin_url', 'false', 'No'); + +UPDATE settings_current SET selected_value = '1.11.0.4' WHERE variable = 'chamilo_database_version'; INSERT INTO settings_current (variable, type, category, selected_value, title, comment) VALUES ('enable_profile_user_address_geolocalization', 'radio', 'User', 'false', 'EnableProfileUsersAddressGeolocalizationTitle', 'EnableProfileUsersAddressGeolocalizationComment'); INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_profile_user_address_geolocalization', 'true', 'Yes'); INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_profile_user_address_geolocalization', 'false', 'No'); +INSERT INTO settings_current (variable, type, category, selected_value, title, comment) VALUES ('show_official_code_whoisonline', 'radio', 'User', 'false', 'ShowOfficialCodeInWhoIsOnlinePage', 'ShowOfficialCodeInWhoIsOnlinePageComment'); +INSERT INTO settings_options (variable, value, display_text) VALUES ('show_official_code_whoisonline', 'true', 'Yes'); +INSERT INTO settings_options (variable, value, display_text) VALUES ('show_official_code_whoisonline', 'false', 'No'); + INSERT INTO access_url_rel_course_category (access_url_id, course_category_id) VALUES (1, 1); INSERT INTO access_url_rel_course_category (access_url_id, course_category_id) VALUES (1, 2); INSERT INTO access_url_rel_course_category (access_url_id, course_category_id) VALUES (1, 3); diff --git a/main/install/index.php b/main/install/index.php index 97b36689e1..7ee57e3110 100755 --- a/main/install/index.php +++ b/main/install/index.php @@ -773,7 +773,32 @@ if (@$_POST['step2']) { } } - error_log('Finish upgrade process! ('.date('Y-m-d H:i:s').')'); + error_log('Upgrade process concluded! ('.date('Y-m-d H:i:s').')'); + } else { + error_log('There was an error during running migrations. Check error.log'); + } + //TODO: check if this can be used to migrate directly from 1.9 to 1.11 + break; + case '1.10.0': + // no break + case '1.10.2': + // no break + case '1.10.4': + // no break + case '1.10.6': + // Migrate using the migration files located in: + // src/Chamilo/CoreBundle/Migrations/Schema/V111 + $result = migrate( + 111, + $manager + ); + + echo ''; + + if ($result) { + error_log('Migrations files were executed.'); + include 'update-files-1.10.0-1.11.0.inc.php'; + error_log('Upgrade process concluded! ('.date('Y-m-d H:i:s').')'); } else { error_log('There was an error during running migrations. Check error.log'); } @@ -916,8 +941,10 @@ if (@$_POST['step2']) { $connection->executeQuery("ALTER TABLE faq_category_translation ADD CONSTRAINT FK_5493B0FC2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES faq_category (id) ON DELETE CASCADE;"); $connection->executeQuery("ALTER TABLE faq_question ADD CONSTRAINT FK_4A55B05912469DE2 FOREIGN KEY (category_id) REFERENCES faq_category (id);"); - // Tickets + // Add version table + $connection->executeQuery('CREATE TABLE version (version varchar(255), PRIMARY KEY(version));'); + // Tickets $table = Database::get_main_table(TABLE_TICKET_PROJECT); // Default Project Table Ticket diff --git a/main/install/install.lib.php b/main/install/install.lib.php index a59b264524..5645bce309 100755 --- a/main/install/install.lib.php +++ b/main/install/install.lib.php @@ -415,6 +415,7 @@ function & get_language_folder_list() closedir($handle); asort($result); } + return $result; } @@ -880,7 +881,7 @@ function display_requirements( if ($file_course_test_was_created == true) { break; } - $r = @touch($course_dir.'/test.php',$perm); + $r = @touch($course_dir.'/test.php', $perm); if ($r === true) { $fil_perm_verified = $perm; if (check_course_script_interpretation($course_dir, $course_attempt_name, 'test.php')) { @@ -1154,94 +1155,94 @@ function get_contact_registration_form()
      - -
      - -
      + +
      + +
      - -
      - -
      + +
      + +
      - -
      '.get_countries_list_from_array(true).'
      + +
      '.get_countries_list_from_array(true).'
      - -
      - -
      + +
      + +
      - -
      - -
      + +
      + +
      - -
      -
      - -
      -
      - -
      + +
      +
      +
      +
      + +
      +
      @@ -1252,7 +1253,7 @@ function get_contact_registration_form()
       
      *'.get_lang('FieldRequired').'
      -'; + '; return $html; } @@ -1295,9 +1296,7 @@ function displayDatabaseParameter( echo '
      ' . "
      "; echo '
      ' . $extra_notice . '
      '; } - } - } /** @@ -1473,6 +1472,7 @@ function display_database_settings_form( '.""; } $html .= ""; + return $html; } @@ -2176,6 +2178,16 @@ function finishInstallation( lockSettings(); updateDirAndFilesPermissions(); + + // Set the latest version + $path = api_get_path(SYS_PATH).'app/Migrations/Schema/V111/'; + $finder = new \Symfony\Component\Finder\Finder(); + $files = $finder->files()->in($path); + foreach ($files as $version) { + $version = str_replace(['Version', '.php' ], '', $version->getFilename()); + $sql = "INSERT INTO version VALUES ('$version')"; + Database::query($sql); + } } /** @@ -2225,3 +2237,25 @@ function installProfileSettings($installationProfile = '') return true; } + +/** + * Quick function to remove a directory with its subdirectories + * @param $dir + */ +function rrmdir($dir) +{ + if (is_dir($dir)) { + $objects = scandir($dir); + foreach ($objects as $object) { + if ($object != "." && $object != "..") { + if (filetype($dir."/".$object) == "dir") { + @rrmdir($dir."/".$object); + } else { + @unlink($dir."/".$object); + } + } + } + reset($objects); + rmdir($dir); + } +} diff --git a/main/install/update-files-1.10.0-1.11.0.inc.php b/main/install/update-files-1.10.0-1.11.0.inc.php new file mode 100644 index 0000000000..45c23d2e84 --- /dev/null +++ b/main/install/update-files-1.10.0-1.11.0.inc.php @@ -0,0 +1,43 @@ + \ No newline at end of file diff --git a/main/lang/french/trad4all.inc.php b/main/lang/french/trad4all.inc.php index 2c4a258e16..550d29c286 100644 --- a/main/lang/french/trad4all.inc.php +++ b/main/lang/french/trad4all.inc.php @@ -6969,7 +6969,7 @@ $EventType = "Type d'événement"; $WamiFlashDialog = "Cet outil va afficher un boîte de dialogue qui vous demandera de confirmer l'accès à votre microphone. Veuillez répondre \"oui\" et fermer la boîte de dialogue (si vous ne voulez pas voir réapparaître ce message veuillez sélectionner l'option \"se souvenir de mon choix\" avant de fermer)"; $WamiStartRecorder = "Commencer l'enregistrement en appuyant sur le microphone et arrêter l'enregistrement en appuyant une nouvel fois. Un nouveau ficher sera généré à chaque fois."; $WamiNeedFilename = "Avant d'activer l'enregistrement il faut donner un nom de fichier."; -$InputNameHere = "Entrer votre nom ici"; +$InputNameHere = "Introduisez le nom de l'enregistrement ici"; $Reload = "Rafraîchir"; $SelectGradeModel = "Sélectionnez un modèle de note"; $AllMustWeight100 = "La somme de toutes les valeurs doit être égale à 100"; @@ -7659,7 +7659,42 @@ $ForumEndDate = "Date de fermeture"; $ForumStartDateComment = "Le forum sera publié à cette date"; $ForumEndDateComment = "Après cette date, le forum sera automatiquement fermé"; $ModeratedForum = "Forum modéré"; +$DiagnosisFilledSubject = "Diagnostique complété"; +$DiagnosisFilledDescription = "Le diagnostique a été complété avec succès"; +$UserXHasFilledTheDiagnosis = "L'utilisateur %s a complété son diagnostique"; +$UserXHasFilledTheDiagnosisDescription = "L'utilisateur %s a complété son diagnostique sur la plateforme et celui-ci attend votre révision."; +$SendLegal = "Envoyer l'accord légal"; +$DeleteLegal = "Supprimer l'accord légal"; +$LegalAccepted = "Accord légal accepté"; +$LoadTermConditionsSectionTitle = "Charger la section de termes et conditions"; +$LoadTermConditionsSectionDescription = "L'accord légal apparaîtra au moment du login ou lorsque l'apprenant entre dans le cours."; +$SendTermsSubject = "Votre contrat d'apprentissage est déjà signé."; +$SendTermsDescriptionToUrlX = "Bonjour, +Votre tuteur vous a envoyé votre contrat d'apprentissage. Vous pouvez le signer en suivant l'URL suivante: %s"; +$UserXSignedTheAgreement = "L'utilisateur %s a signé le contrat d'apprentissage."; +$UserXSignedTheAgreementTheY = "L'utilisateur %s a signé son contrat d'apprentissage le %s."; +$ShowTermsIfProfileCompletedTitle = "Contrat d'apprentissage bloqué par la complétude du profil"; +$ShowTermsIfProfileCompletedComment = "En activant cette option, le contrat d'apprentissage sera disponible pour l'utilisateur seulement lorsqu'il aura complété les champs de profil extra préfixés par 'terms_' et marqués comme visibles."; $EnableProfileUsersAddressGeolocalizationTitle = "Activer la géolocalisation"; $EnableProfileUsersAddressGeolocalizationComment = "Activer un champ d'adresse pour l'utilisateur et situer son adresse sur une carte en utilisant la géolocalisation"; +$ProfileIsNotCompleted = "Vous devez d'abord compléter votre profil pour continuer"; $TermActivatedIsNeededDescription = "Le contrat d'apprentissage n'a pas encore été validé par votre tuteur."; +$DiagnosisManagement = "Gestion des diagnostiques"; +$TermYourProfileIsNotCompleted = "Vous devez d'abord compléter votre profil pour activer la validation du contrat d'apprentissage."; +$Diagnostic = "Diagnostique"; +$AllowShowSkypeAccountTitle = "Permettre l'affichage du compte Skype de l'utilisateur"; +$AllowShowSkypeAccountComment = "Ajouter un lien dans le block utilisateur sur le réseau social pour permettre le démarrage d'une session de chat via Skype."; +$AllowShowLinkedInUrlTitle = "Permettre l'affichage de l'URL LinkedIn"; +$AllowShowLinkedInUrlComment = "Ajouter un lien dans le bloc de l'utilisateur dans le réseay social pour permettre aux visiteurs de voir le profil LinkedIn de l'utilisateur."; +$LaunchVideoConferenceRoom = "Lancer une salle de vidéoconférence"; +$VideoConference = "Vidéoconférence"; +$TermsDuplicatedInFile = "Termes dupliqués dans le fichier"; +$GlossaryTermAlreadyExists = "Ce terme existe déjà"; +$LinkedInUrl = "URL de profil LinkedIn"; +$SaveTheCorrectAnswersForTheNextAttempt = "Garder les réponses correctes pour l'essai suivant"; +$TranslateThisTerm = "Traduire ce terme"; +$OnlyActiveSubLanguagesAreListed = "Seules les sous-langues actives sont listées ici"; +$Translation = "Traduction"; +$IfThisTranslationExistsThisWillReplaceTheTerm = "Si ce terme a déjà été traduit, cette opération remplacera la traduction existante pour ce sous-langage."; +$LastConnection = "Dernière connexion"; ?> \ No newline at end of file diff --git a/main/lang/spanish/trad4all.inc.php b/main/lang/spanish/trad4all.inc.php index 53e19fc113..97965eb3dd 100644 --- a/main/lang/spanish/trad4all.inc.php +++ b/main/lang/spanish/trad4all.inc.php @@ -7730,6 +7730,43 @@ $ForumEndDate = "Fecha de cierre"; $ForumStartDateComment = "El foro será visible a partir de esta fecha"; $ForumEndDateComment = "Pasada esta fecha, el foro será automáticamente cerrado"; $ModeratedForum = "Foro moderado"; +$DiagnosisFilledSubject = "Diagnóstico completado"; +$DiagnosisFilledDescription = "El diagnóstico ha sido exitosamente completado"; +$UserXHasFilledTheDiagnosis = "El usuario %s ha llenado su diagnóstico"; +$UserXHasFilledTheDiagnosisDescription = "El usuario %s ha llenado su diagnóstico en la plataforma. Ahora está listo para revisión."; +$SendLegal = "Enviar acuerdo legal"; +$DeleteLegal = "Borrar acuerdo legal"; +$LegalAccepted = "Acuerdo legal aceptado"; +$LoadTermConditionsSectionTitle = "Cargar la sección de términos y condiciones"; +$LoadTermConditionsSectionDescription = "El acuerdo legal aparecerá durante el login o cuando entre a un curso."; +$SendTermsSubject = "Su contrato de aprendizaje está listo para firmar."; +$SendTermsDescriptionToUrlX = "Hola, + +Su tutor le ha enviado s contrato de aprendizaje. Puede ir a firmarlo siguiendo esta URL: %s"; +$UserXSignedTheAgreement = "El usuario %s ha firmado el acuerdo."; +$UserXSignedTheAgreementTheY = "El usuario %s ha firmado el acuerdo el %s."; +$ShowTermsIfProfileCompletedTitle = "Términos y condiciones pendiente de perfil completado"; +$ShowTermsIfProfileCompletedComment = "Activando esta opción, los términos y condiciones serán disponibles únicamente una vez el usuario haya completado todos los campos de perfil que inicien con 'terms_' y estén visibles."; $EnableProfileUsersAddressGeolocalizationTitle = "Activar geolocalización"; $EnableProfileUsersAddressGeolocalizationComment = "Activar un campo de dirección en el perfil del usuario y ubicar su dirección en un mapa usando la geolocalización"; +$ProfileIsNotCompleted = "Debe llenar su perfil para seguir adelante"; +$TermActivatedIsNeededDescription = "Los términos y condiciones no han sido validados por su tutor"; +$DiagnosisManagement = "Gestión de diagnóstico"; +$TermYourProfileIsNotCompleted = "Debe completar su perfil para acceder a la validación del contrato."; +$Diagnostic = "Diagnóstico"; +$AllowShowSkypeAccountTitle = "Permitir mostrar la cuenta de usuario de Skype"; +$AllowShowSkypeAccountComment = "Añadir un enlace en el bloque social de usuario que permite iniciar una conversación por Skype"; +$AllowShowLinkedInUrlTitle = "Permitir mostrar la URL de LinkedIn del usuario"; +$AllowShowLinkedInUrlComment = "Añadir un enlace en el bloque social del usuario, lo que permite visitar el perfil del usuario en LinkedIn"; +$LaunchVideoConferenceRoom = "Lanzar una sala de video conferencia"; +$VideoConference = "Video conferencia"; +$TermsDuplicatedInFile = "Términos duplicados en el archivo"; +$GlossaryTermAlreadyExists = "El término ya existe"; +$LinkedInUrl = "URL de perfil LinkedIn"; +$SaveTheCorrectAnswersForTheNextAttempt = "Guardar la respuesta correcta para el siguiente intento"; +$TranslateThisTerm = "Traducir este término"; +$OnlyActiveSubLanguagesAreListed = "Solo los sub-idiomas activos aparecen en la lista"; +$Translation = "Traducción"; +$IfThisTranslationExistsThisWillReplaceTheTerm = "Si este término ha sido traducido anteriormente, esta operación remplazará su traducción para este sub-idioma."; +$LastConnection = "Última conexión"; ?> \ No newline at end of file diff --git a/main/newscorm/README.txt b/main/lp/README.txt similarity index 100% rename from main/newscorm/README.txt rename to main/lp/README.txt diff --git a/main/newscorm/aicc.class.php b/main/lp/aicc.class.php similarity index 100% rename from main/newscorm/aicc.class.php rename to main/lp/aicc.class.php diff --git a/main/newscorm/aiccBlock.class.php b/main/lp/aiccBlock.class.php similarity index 100% rename from main/newscorm/aiccBlock.class.php rename to main/lp/aiccBlock.class.php diff --git a/main/newscorm/aiccItem.class.php b/main/lp/aiccItem.class.php similarity index 100% rename from main/newscorm/aiccItem.class.php rename to main/lp/aiccItem.class.php diff --git a/main/newscorm/aiccObjective.class.php b/main/lp/aiccObjective.class.php similarity index 100% rename from main/newscorm/aiccObjective.class.php rename to main/lp/aiccObjective.class.php diff --git a/main/newscorm/aiccResource.class.php b/main/lp/aiccResource.class.php similarity index 100% rename from main/newscorm/aiccResource.class.php rename to main/lp/aiccResource.class.php diff --git a/main/newscorm/aicc_api.php b/main/lp/aicc_api.php similarity index 99% rename from main/newscorm/aicc_api.php rename to main/lp/aicc_api.php index 7342016663..39e74f709f 100755 --- a/main/newscorm/aicc_api.php +++ b/main/lp/aicc_api.php @@ -427,7 +427,7 @@ function load_item(item_id,url){ */ function chamilo_save_asset(){ //var linkparams = 'id='+lms_item_id+'&score='+score+'&max='+max+'&min='+min+'&lesson_status='+lesson_status+'&time='+session_time+'&suspend_data='+suspend_data; - //var url = "?action=save&" + linkparams + ""; + //var url = "?action=save&" + linkparams + ""; logit_lms('chamilo_save_asset: '+url,0); //frames["message_name"].src = url; xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score, max, min, lesson_status, session_time, suspend_data, lesson_location); diff --git a/main/newscorm/aicc_hacp.php b/main/lp/aicc_hacp.php similarity index 100% rename from main/newscorm/aicc_hacp.php rename to main/lp/aicc_hacp.php diff --git a/main/newscorm/audiorecorder.inc.php b/main/lp/audiorecorder.inc.php similarity index 100% rename from main/newscorm/audiorecorder.inc.php rename to main/lp/audiorecorder.inc.php diff --git a/main/newscorm/blank.php b/main/lp/blank.php similarity index 100% rename from main/newscorm/blank.php rename to main/lp/blank.php diff --git a/main/newscorm/content_makers.inc.php b/main/lp/content_makers.inc.php similarity index 100% rename from main/newscorm/content_makers.inc.php rename to main/lp/content_makers.inc.php diff --git a/main/newscorm/display_audiorecorder.php b/main/lp/display_audiorecorder.php similarity index 100% rename from main/newscorm/display_audiorecorder.php rename to main/lp/display_audiorecorder.php diff --git a/main/newscorm/download.php b/main/lp/download.php similarity index 100% rename from main/newscorm/download.php rename to main/lp/download.php diff --git a/main/newscorm/embed.php b/main/lp/embed.php similarity index 100% rename from main/newscorm/embed.php rename to main/lp/embed.php diff --git a/main/newscorm/final_item_template/template.html b/main/lp/final_item_template/template.html similarity index 100% rename from main/newscorm/final_item_template/template.html rename to main/lp/final_item_template/template.html diff --git a/main/newscorm/index.php b/main/lp/index.php similarity index 100% rename from main/newscorm/index.php rename to main/lp/index.php diff --git a/main/newscorm/js/HOWTO-storageapi b/main/lp/js/HOWTO-storageapi similarity index 100% rename from main/newscorm/js/HOWTO-storageapi rename to main/lp/js/HOWTO-storageapi diff --git a/main/newscorm/js/api_wrapper.js b/main/lp/js/api_wrapper.js similarity index 100% rename from main/newscorm/js/api_wrapper.js rename to main/lp/js/api_wrapper.js diff --git a/main/newscorm/js/documentapi.js b/main/lp/js/documentapi.js similarity index 100% rename from main/newscorm/js/documentapi.js rename to main/lp/js/documentapi.js diff --git a/main/newscorm/js/storageapi.js b/main/lp/js/storageapi.js similarity index 100% rename from main/newscorm/js/storageapi.js rename to main/lp/js/storageapi.js diff --git a/main/newscorm/learnpath.class.php b/main/lp/learnpath.class.php similarity index 99% rename from main/newscorm/learnpath.class.php rename to main/lp/learnpath.class.php index 79b85df75f..3bba14e1e8 100755 --- a/main/newscorm/learnpath.class.php +++ b/main/lp/learnpath.class.php @@ -1,8 +1,8 @@ lp_id; + $link = 'lp/lp_controller.php?action=view&lp_id='.$this->lp_id; // Delete tools $sql = "DELETE FROM $tbl_tool WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')"; @@ -1130,7 +1131,12 @@ class learnpath api_get_user_id() ); - $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4 , $id, api_get_session_id()); + $link_info = GradebookUtils::isResourceInCourseGradebook( + api_get_course_id(), + 4, + $id, + api_get_session_id() + ); if ($link_info !== false) { GradebookUtils::remove_resource_from_course_gradebook($link_info['id']); } @@ -3432,10 +3438,10 @@ class learnpath case 'link': if (Link::is_youtube_link($file)) { $src = Link::get_youtube_video_id($file); - $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=youtube&source='.$src; + $file = api_get_path(WEB_CODE_PATH) . 'lp/embed.php?type=youtube&source='.$src; } elseif (Link::isVimeoLink($file)) { $src = Link::getVimeoLinkId($file); - $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=vimeo&source='.$src; + $file = api_get_path(WEB_CODE_PATH) . 'lp/embed.php?type=vimeo&source='.$src; } else { // If the current site is HTTPS and the link is // HTTP, browsers will refuse opening the link @@ -3448,7 +3454,7 @@ class learnpath //this is the special intervention case $file = api_get_path( WEB_CODE_PATH - ).'newscorm/embed.php?type=nonhttps&source='.urlencode($file); + ) . 'lp/embed.php?type=nonhttps&source='.urlencode($file); } } } @@ -3589,7 +3595,7 @@ class learnpath error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0); } // Formatting AICC HACP append URL. - $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'newscorm/aicc_hacp.php') . '&'; + $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'lp/aicc_hacp.php') . '&'; if (!empty($lp_item_params)) { $aicc_append .= $lp_item_params . '&'; } @@ -4219,7 +4225,7 @@ class learnpath $session_condition = api_get_session_condition($session_id); $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST); - $link = 'newscorm/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id; + $link = 'lp/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id; $sql = "SELECT * FROM $tbl_tool WHERE c_id = ".$course_id." AND @@ -4590,7 +4596,7 @@ class learnpath $session_id = api_get_session_id(); $session_condition = api_get_session_condition($session_id); $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST); - $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id; + $link = 'lp/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id; $sql = "UPDATE $tbl_tool SET name = '$this->name' WHERE c_id = $course_id AND @@ -5538,7 +5544,7 @@ class learnpath } // We need to close the form when we are updating the mp3 files. - if ($update_audio == 'true' && count($this->arrMenu) != 0) { + if ($update_audio == 'true' && isset($this->arrMenu) && count($this->arrMenu) != 0) { $return .= ''; } @@ -5614,7 +5620,7 @@ class learnpath // Detect if type is FINAL_ITEM to set path_id to SESSION if ($arrLP[$i]['item_type'] == TOOL_LP_FINAL_ITEM) { - $_SESSION['pathItem'] = $arrLP[$i]['path']; + Session::write('pathItem', $arrLP[$i]['path']); } if (($i % 2) == 0) { @@ -6304,7 +6310,7 @@ class learnpath $return .= $exercise->description.'
      '; $return .= Display::url( get_lang('GoToExercise'), - api_get_path(WEB_CODE_PATH).'exercice/overview.php?'.api_get_cidreq().'&exerciseId='.$exercise->id, + api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?' . api_get_cidreq() . '&exerciseId=' . $exercise->id, ['class' => 'btn btn-primary'] ); } @@ -7876,13 +7882,13 @@ class learnpath } $editor_config = array( - 'ToolbarSet'=> 'LearningPathDocuments', - 'Width' => '100%', - 'Height' => '500', - 'FullPage' => true, - 'CreateDocumentDir' => $relative_prefix, - 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/', - 'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path + 'ToolbarSet' => 'LearningPathDocuments', + 'Width' => '100%', + 'Height' => '500', + 'FullPage' => true, + 'CreateDocumentDir' => $relative_prefix, + 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/', + 'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path ); if ($_GET['action'] == 'add_item') { @@ -8809,7 +8815,7 @@ class learnpath $headers = array( get_lang('Files'), get_lang('NewDocument'), - get_lang('Upload'), + get_lang('Upload') ); $form = new FormValidator( @@ -8895,7 +8901,7 @@ class learnpath $return .= '
    • '; $return .= Display::return_icon('new_test_small.gif'); - $return .= '' . + $return .= '' . get_lang('NewExercise') . ''; $return .= '
    • '; @@ -9227,7 +9233,12 @@ class learnpath $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path; $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp); mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true); - $zip_files_dist = copyr($current_course_path.'/scorm/'.$this->path, $dest_path_to_scorm_folder, array('imsmanifest'), $zip_files); + copyr( + $current_course_path.'/scorm/'.$this->path, + $dest_path_to_scorm_folder, + array('imsmanifest'), + $zip_files + ); } // Build a dummy imsmanifest structure. @@ -9290,7 +9301,7 @@ class learnpath foreach ($this->items as $index => $item) { if (!in_array($item->type, array(TOOL_QUIZ, TOOL_FORUM, TOOL_THREAD, TOOL_LINK, TOOL_STUDENTPUBLICATION))) { // Get included documents from this item. - if ($item->type == 'sco') { + if ($item->type === 'sco') { $inc_docs = $item->get_resources_from_source( null, api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path() @@ -9360,7 +9371,7 @@ class learnpath $my_resource->setAttribute('type', 'webcontent'); $my_resource->setAttribute('href', $my_xml_file_path); // adlcp:scormtype can be either 'sco' or 'asset'. - if ($item->type == 'sco') { + if ($item->type === 'sco') { $my_resource->setAttribute('adlcp:scormtype', 'sco'); } else { $my_resource->setAttribute('adlcp:scormtype', 'asset'); @@ -9375,7 +9386,9 @@ class learnpath // Dependency to other files - not yet supported. $i = 1; foreach ($inc_docs as $doc_info) { - if (count($doc_info) < 1 || empty($doc_info[0])) { continue; } + if (count($doc_info) < 1 || empty($doc_info[0])) { + continue; + } $my_dep = $xmldoc->createElement('resource'); $res_id = 'RESOURCE_'.$item->get_id().'_'.$i; $my_dep->setAttribute('identifier', $res_id); @@ -9388,7 +9401,7 @@ class learnpath // Remote file. Save url as is. $my_dep_file->setAttribute('href', $doc_info[0]); $my_dep->setAttribute('xml:base', ''); - } elseif ($doc_info[1] == 'local') { + } elseif ($doc_info[1] === 'local') { switch ($doc_info[2]) { case 'url': // Local URL - save path as url for now, don't zip file. $abs_path = api_get_path(SYS_PATH).str_replace(api_get_path(WEB_PATH), '', $doc_info[0]); @@ -9436,7 +9449,10 @@ class learnpath if ($pos === 0) { $abs_img_path_without_subdir = '/'.substr($abs_img_path_without_subdir, strlen($relp)); } - $file_path = realpath(api_get_path(SYS_PATH).$abs_img_path_without_subdir); + + //$file_path = realpath(api_get_path(SYS_PATH).$abs_img_path_without_subdir); + $file_path = realpath(api_get_path(SYS_APP_PATH).$abs_img_path_without_subdir); + $file_path = str_replace('\\', '/', $file_path); $file_path = str_replace('//', '/', $file_path); @@ -9995,13 +10011,13 @@ EOD; file_put_contents($archive_path.$temp_dir_short.'/document/non_exportable.html', $file_content); // Add the extra files that go along with a SCORM package. - $main_code_path = api_get_path(SYS_CODE_PATH).'newscorm/packaging/'; + $main_code_path = api_get_path(SYS_CODE_PATH) . 'lp/packaging/'; $extra_files = scandir($main_code_path); foreach ($extra_files as $extra_file) { - if (strpos($extra_file, '.') === 0) + if (strpos($extra_file, '.') === 0) { continue; - else { - $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file; + } else { + $dest_file = $archive_path.$temp_dir_short.'/'.$extra_file; $this->create_path($dest_file); copy($main_code_path.$extra_file, $dest_file); } @@ -10012,7 +10028,11 @@ EOD; $manifest = @$xmldoc->saveXML(); $manifest = api_utf8_decode_xml($manifest); // The manifest gets the system encoding now. file_put_contents($archive_path.'/'.$temp_dir_short.'/imsmanifest.xml', $manifest); - $zip_folder->add($archive_path.'/'.$temp_dir_short, PCLZIP_OPT_REMOVE_PATH, $archive_path.'/'.$temp_dir_short.'/'); + $zip_folder->add( + $archive_path.'/'.$temp_dir_short, + PCLZIP_OPT_REMOVE_PATH, + $archive_path.'/'.$temp_dir_short.'/' + ); // Clean possible temporary files. foreach ($files_cleanup as $file) { @@ -11019,7 +11039,7 @@ EOD; */ private function getFinalItemTemplate() { - return file_get_contents(api_get_path(SYS_CODE_PATH) . 'newscorm/final_item_template/template.html'); + return file_get_contents(api_get_path(SYS_CODE_PATH) . 'lp/final_item_template/template.html'); } /** @@ -11038,13 +11058,12 @@ EOD; /** * Get the LP Final Item form * - * @return html + * @return string */ public function getFinalItemForm() { $finalItem = $this->getFinalItem(); $title = ''; - $content = ''; if ($finalItem) { $title = $finalItem->title; @@ -11078,23 +11097,33 @@ EOD; $form = new FormValidator('final_item', 'POST', $url); $form->addText('title', get_lang('Title')); $form->addButtonSave($buttonText); - $form->addHtml('
      Variables :

      ((certificate))
      ((skill))
      '); + $form->addHtml( + Display::return_message( + 'Variables :

      ((certificate))
      ((skill))', + 'normal', + false + ) + ); + $renderer = $form->defaultRenderer(); - $renderer->setElementTemplate('
       {label}{element}
      ', 'content_lp'); - $form->addHtmlEditor('content_lp', null, null, true, $editorConfig, true); + $renderer->setElementTemplate(' {label}{element}', 'content_lp_certificate'); + + $form->addHtmlEditor('content_lp_certificate', null, true, false, $editorConfig, true); $form->addHidden('action', 'add_final_item'); - $form->addHidden('path', isset($_SESSION['pathItem']) ? $_SESSION['pathItem'] : ''); + $form->addHidden('path', Session::read('pathItem')); $form->addHidden('previous', $this->get_last()); - - $form->setDefaults(['title' => $title, 'content_lp' => $content]); + $form->setDefaults(['title' => $title, 'content_lp_certificate' => $content]); if ($form->validate()) { $values = $form->exportValues(); - $lastItemId = $this->get_last(); if (!$finalItem) { - $documentId = $this->create_document($this->course_info, $values['content_lp'], $values['title']); + $documentId = $this->create_document( + $this->course_info, + $values['content_lp_certificate'], + $values['title'] + ); $this->add_item( 0, $lastItemId, diff --git a/main/newscorm/learnpathItem.class.php b/main/lp/learnpathItem.class.php similarity index 100% rename from main/newscorm/learnpathItem.class.php rename to main/lp/learnpathItem.class.php diff --git a/main/newscorm/learnpathList.class.php b/main/lp/learnpathList.class.php similarity index 98% rename from main/newscorm/learnpathList.class.php rename to main/lp/learnpathList.class.php index ff76610188..7f51da9c96 100755 --- a/main/newscorm/learnpathList.class.php +++ b/main/lp/learnpathList.class.php @@ -110,7 +110,7 @@ class LearnpathList // it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility()) // is done using domesticate() $myname = domesticate($row['name']); - $mylink = 'newscorm/lp_controller.php?action=view&lp_id='.$row['id'].'&id_session='.$session_id; + $mylink = 'lp/lp_controller.php?action=view&lp_id='.$row['id'].'&id_session='.$session_id; $sql2 = "SELECT * FROM $tbl_tool WHERE diff --git a/main/newscorm/learnpath_functions.inc.php b/main/lp/learnpath_functions.inc.php similarity index 100% rename from main/newscorm/learnpath_functions.inc.php rename to main/lp/learnpath_functions.inc.php diff --git a/main/newscorm/lp_add.php b/main/lp/lp_add.php similarity index 96% rename from main/newscorm/lp_add.php rename to main/lp/lp_add.php index ac070400e5..fcf08164ee 100755 --- a/main/newscorm/lp_add.php +++ b/main/lp/lp_add.php @@ -68,11 +68,11 @@ if ((!$is_allowed_to_edit) || ($isStudentView)) { Course admin section - all the functions not available for students - always available in this case (page only shown to admin) */ -if (isset($_SESSION['gradebook'])){ +if (isset($_SESSION['gradebook'])) { $gradebook = $_SESSION['gradebook']; } -if (!empty($gradebook) && $gradebook=='view') { +if (!empty($gradebook) && $gradebook == 'view') { $interbreadcrumb[]= array ( 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook') @@ -85,7 +85,7 @@ Display::display_header(get_lang('LearnpathAddLearnpath'), 'Path'); echo '
      '; echo ''. - Display::return_icon('back.png', get_lang('ReturnToLearningPaths'),'',ICON_SIZE_MEDIUM).''; + Display::return_icon('back.png', get_lang('ReturnToLearningPaths'), '', ICON_SIZE_MEDIUM).''; echo '
      '; Display::display_normal_message(get_lang('AddLpIntro'), false); @@ -97,7 +97,7 @@ if ($_POST AND empty($_REQUEST['lp_name'])) { $form = new FormValidator( 'lp_add', 'post', - api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq() + api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq() ); // Form title diff --git a/main/newscorm/lp_add_audio.php b/main/lp/lp_add_audio.php similarity index 97% rename from main/newscorm/lp_add_audio.php rename to main/lp/lp_add_audio.php index ce1a7990dc..e5bd6e4eb5 100755 --- a/main/newscorm/lp_add_audio.php +++ b/main/lp/lp_add_audio.php @@ -141,7 +141,7 @@ if (!empty($file)) { Display::getMediaPlayer($file, array('url' => $urlFile)). ""; $form->addElement('label', get_lang('Listen'), $audioPlayer); - $url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?lp_id='.$_SESSION['oLP']->get_id().'&action=add_audio&id='.$lp_item_id.'&delete_file=1&'.api_get_cidreq(); + $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?lp_id='.$_SESSION['oLP']->get_id().'&action=add_audio&id='.$lp_item_id.'&delete_file=1&'.api_get_cidreq(); $form->addElement('label', null, Display::url(get_lang('RemoveAudio'), $url, array('class' => 'btn btn-danger'))); } else { $form->addElement('file', 'file'); diff --git a/main/newscorm/lp_add_category.php b/main/lp/lp_add_category.php similarity index 100% rename from main/newscorm/lp_add_category.php rename to main/lp/lp_add_category.php diff --git a/main/newscorm/lp_add_item.php b/main/lp/lp_add_item.php similarity index 100% rename from main/newscorm/lp_add_item.php rename to main/lp/lp_add_item.php diff --git a/main/newscorm/lp_admin_view.php b/main/lp/lp_admin_view.php similarity index 100% rename from main/newscorm/lp_admin_view.php rename to main/lp/lp_admin_view.php diff --git a/main/newscorm/lp_ajax_initialize.php b/main/lp/lp_ajax_initialize.php similarity index 100% rename from main/newscorm/lp_ajax_initialize.php rename to main/lp/lp_ajax_initialize.php diff --git a/main/newscorm/lp_ajax_save_item.php b/main/lp/lp_ajax_save_item.php similarity index 100% rename from main/newscorm/lp_ajax_save_item.php rename to main/lp/lp_ajax_save_item.php diff --git a/main/newscorm/lp_ajax_save_objectives.php b/main/lp/lp_ajax_save_objectives.php similarity index 100% rename from main/newscorm/lp_ajax_save_objectives.php rename to main/lp/lp_ajax_save_objectives.php diff --git a/main/newscorm/lp_ajax_start_timer.php b/main/lp/lp_ajax_start_timer.php similarity index 100% rename from main/newscorm/lp_ajax_start_timer.php rename to main/lp/lp_ajax_start_timer.php diff --git a/main/newscorm/lp_ajax_switch_item.php b/main/lp/lp_ajax_switch_item.php similarity index 100% rename from main/newscorm/lp_ajax_switch_item.php rename to main/lp/lp_ajax_switch_item.php diff --git a/main/newscorm/lp_ajax_switch_item_toc.php b/main/lp/lp_ajax_switch_item_toc.php similarity index 100% rename from main/newscorm/lp_ajax_switch_item_toc.php rename to main/lp/lp_ajax_switch_item_toc.php diff --git a/main/newscorm/lp_build.php b/main/lp/lp_build.php similarity index 100% rename from main/newscorm/lp_build.php rename to main/lp/lp_build.php diff --git a/main/newscorm/lp_content.php b/main/lp/lp_content.php similarity index 97% rename from main/newscorm/lp_content.php rename to main/lp/lp_content.php index bac4fbda43..4841218c19 100755 --- a/main/newscorm/lp_content.php +++ b/main/lp/lp_content.php @@ -106,7 +106,7 @@ if (!empty($gradebook) && $gradebook == 'view') { // Define the 'doc.inc.php' as language file. $nameTools = $_SESSION['oLP']->get_name(); $interbreadcrumb[] = array( - 'url' => api_get_path(WEB_CODE_PATH).'newscorm/lp_list.php?'.api_get_cidreq(), + 'url' => api_get_path(WEB_CODE_PATH) . 'lp/lp_list.php?'.api_get_cidreq(), 'name' => get_lang('Doc'), ); // Update global setting to avoid displaying right menu. diff --git a/main/newscorm/lp_controller.php b/main/lp/lp_controller.php similarity index 100% rename from main/newscorm/lp_controller.php rename to main/lp/lp_controller.php diff --git a/main/newscorm/lp_edit.php b/main/lp/lp_edit.php similarity index 100% rename from main/newscorm/lp_edit.php rename to main/lp/lp_edit.php diff --git a/main/newscorm/lp_edit_item.php b/main/lp/lp_edit_item.php similarity index 100% rename from main/newscorm/lp_edit_item.php rename to main/lp/lp_edit_item.php diff --git a/main/newscorm/lp_edit_item_prereq.php b/main/lp/lp_edit_item_prereq.php similarity index 100% rename from main/newscorm/lp_edit_item_prereq.php rename to main/lp/lp_edit_item_prereq.php diff --git a/main/newscorm/lp_final_item.php b/main/lp/lp_final_item.php similarity index 99% rename from main/newscorm/lp_final_item.php rename to main/lp/lp_final_item.php index ba63d0612c..ad2443afcd 100644 --- a/main/newscorm/lp_final_item.php +++ b/main/lp/lp_final_item.php @@ -107,7 +107,7 @@ if ($accessGranted == false) { } } - $finalItemTemplate = generateLPFinalItemTemplate($id, $courseCode, $downloadCertificateLink, $badgeLink); + $finalItemTemplate = generateLPFinalItemTemplate($id, $courseCode, $sessionId, $downloadCertificateLink, $badgeLink); if (!$finalItemTemplate) { Display::display_warning_message(get_lang('FileNotFound')); diff --git a/main/newscorm/lp_impress.php b/main/lp/lp_impress.php similarity index 100% rename from main/newscorm/lp_impress.php rename to main/lp/lp_impress.php diff --git a/main/newscorm/lp_list.php b/main/lp/lp_list.php similarity index 99% rename from main/newscorm/lp_list.php rename to main/lp/lp_list.php index 95bed605f5..e25926adb6 100755 --- a/main/newscorm/lp_list.php +++ b/main/lp/lp_list.php @@ -646,7 +646,7 @@ foreach ($categories as $item) { if ($details['subscribe_users'] == 1) { $subscribeUsers = Display::url( Display::return_icon('user.png', get_lang('SubscribeUsersToLp')), - api_get_path(WEB_CODE_PATH)."newscorm/lp_subscribe_users.php?lp_id=$id&".api_get_cidreq() + api_get_path(WEB_CODE_PATH) . "lp/lp_subscribe_users.php?lp_id=$id&".api_get_cidreq() ); } diff --git a/main/newscorm/lp_list_search.css b/main/lp/lp_list_search.css similarity index 100% rename from main/newscorm/lp_list_search.css rename to main/lp/lp_list_search.css diff --git a/main/newscorm/lp_list_search.php b/main/lp/lp_list_search.php similarity index 88% rename from main/newscorm/lp_list_search.php rename to main/lp/lp_list_search.php index b62338126f..5b959911ff 100755 --- a/main/newscorm/lp_list_search.php +++ b/main/lp/lp_list_search.php @@ -15,15 +15,15 @@ require api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php'; require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'; require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; -$htmlHeadXtra[] = ''; +$htmlHeadXtra[] = ''; Event::event_access_tool(TOOL_SEARCH); -if (isset($_SESSION['gradebook'])){ +if (isset($_SESSION['gradebook'])) { $gradebook = $_SESSION['gradebook']; } if (!empty($gradebook) && $gradebook == 'view') { - $interbreadcrumb[]= array ( + $interbreadcrumb[]= array( 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook') ); @@ -63,8 +63,8 @@ if (isset($_GET['mode']) && in_array($_GET['mode'], array('gallery', 'default')) $term_array = array(); $specific_fields = get_specific_field_list(); foreach ($specific_fields as $specific_field) { - if (!empty($_REQUEST[ 'sf_'. $specific_field['code'] ])) { - $values = $_REQUEST[ 'sf_'. $specific_field['code'] ]; + if (!empty($_REQUEST['sf_'. $specific_field['code']])) { + $values = $_REQUEST['sf_'. $specific_field['code']]; if (in_array('__all__', $values)) { $sf_terms_for_code = xapian_get_all_terms(1000, $specific_field['code']); foreach ($sf_terms_for_code as $term) { @@ -94,7 +94,7 @@ foreach ($specific_fields as $specific_field) { // Get right group of terms to show on multiple select. $fixed_queries = array(); $course_filter = null; -if ( ($cid=api_get_course_id()) != -1 ) { +if (($cid=api_get_course_id()) != -1 ) { // Results only from actual course. $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid); } @@ -139,19 +139,19 @@ if ($count > 0) { if (!empty($result['url'])) { $a_prefix = ''; - $a_sufix = ''; + $a_suffix = ''; } else { $a_prefix = ''; - $a_sufix = ''; + $a_suffix = ''; } if ($mode == 'gallery') { - $title = $a_prefix.str_replace('_',' ',$result['title']). $a_sufix; + $title = $a_prefix.str_replace('_', ' ', $result['title']). $a_suffix; $blocks[] = array(1 => - $a_prefix .''. $a_sufix .'
      '.$title.'
      '.$result['author'], + $a_prefix .''. $a_suffix .'
      '.$title.'
      '.$result['author'], ); } else { - $title = '
      '. $a_prefix . $result['title']. $a_sufix .(!empty($result['author']) ? ' '.$result['author'] : '').'
      '; + $title = '
      '. $a_prefix . $result['title']. $a_suffix .(!empty($result['author']) ? ' '.$result['author'] : '').'
      '; $blocks[] = array(1 => $title); } } @@ -163,15 +163,15 @@ if (count($blocks) > 0) { $s->display_mode = $mode; // default $s->display_mode_params = 3; $s->per_page = 9; - $additional_parameters = array ( + $additional_parameters = array( 'mode' => $mode, 'action' => 'search', 'query' => Security::remove_XSS($_REQUEST['query']), ); $get_params = ''; foreach ($specific_fields as $specific_field) { - if (isset($_REQUEST[ 'sf_'. $specific_field['code'] ])) { - $values = $_REQUEST[ 'sf_'. $specific_field['code'] ]; + if (isset($_REQUEST['sf_'. $specific_field['code']])) { + $values = $_REQUEST['sf_'. $specific_field['code']]; //Sortable additional_parameters doesn't accept multi dimensional arrays //$additional_parameters[ 'sf_'. $specific_field['code'] ] = $values; foreach ( $values as $value ) { diff --git a/main/newscorm/lp_move_item.php b/main/lp/lp_move_item.php similarity index 100% rename from main/newscorm/lp_move_item.php rename to main/lp/lp_move_item.php diff --git a/main/newscorm/lp_nav.php b/main/lp/lp_nav.php similarity index 100% rename from main/newscorm/lp_nav.php rename to main/lp/lp_nav.php diff --git a/main/newscorm/lp_report.php b/main/lp/lp_report.php similarity index 94% rename from main/newscorm/lp_report.php rename to main/lp/lp_report.php index f54cc625cf..8263d974db 100644 --- a/main/newscorm/lp_report.php +++ b/main/lp/lp_report.php @@ -106,7 +106,7 @@ if (!empty($users)) { // View $interbreadcrumb[] = [ - 'url' => api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php?'.api_get_cidreq(), + 'url' => api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq(), 'name' => get_lang('LearningPaths') ]; @@ -117,7 +117,7 @@ $actions = Display::url( array(), ICON_SIZE_MEDIUM ), - api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php?' . api_get_cidreq() + api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq() ); $template = new Template(get_lang('StudentScore')); diff --git a/main/newscorm/lp_save.php b/main/lp/lp_save.php similarity index 100% rename from main/newscorm/lp_save.php rename to main/lp/lp_save.php diff --git a/main/newscorm/lp_stats.php b/main/lp/lp_stats.php similarity index 100% rename from main/newscorm/lp_stats.php rename to main/lp/lp_stats.php diff --git a/main/newscorm/lp_subscribe_users.php b/main/lp/lp_subscribe_users.php similarity index 100% rename from main/newscorm/lp_subscribe_users.php rename to main/lp/lp_subscribe_users.php diff --git a/main/newscorm/lp_subscribe_users_to_category.php b/main/lp/lp_subscribe_users_to_category.php similarity index 100% rename from main/newscorm/lp_subscribe_users_to_category.php rename to main/lp/lp_subscribe_users_to_category.php diff --git a/main/newscorm/lp_upload.php b/main/lp/lp_upload.php similarity index 100% rename from main/newscorm/lp_upload.php rename to main/lp/lp_upload.php diff --git a/main/newscorm/lp_view.lib.js b/main/lp/lp_view.lib.js similarity index 100% rename from main/newscorm/lp_view.lib.js rename to main/lp/lp_view.lib.js diff --git a/main/newscorm/lp_view.php b/main/lp/lp_view.php similarity index 98% rename from main/newscorm/lp_view.php rename to main/lp/lp_view.php index 7ec6acd646..74d0d65089 100755 --- a/main/newscorm/lp_view.php +++ b/main/lp/lp_view.php @@ -118,7 +118,7 @@ if ($_SESSION['oLP']->mode == 'embedframe' || $_SESSION['oLP']->get_hide_toc_fra //Impress js if ($_SESSION['oLP']->mode == 'impress') { $lp_id = $_SESSION['oLP']->get_id(); - $url = api_get_path(WEB_CODE_PATH) . "newscorm/lp_impress.php?lp_id=$lp_id&" . api_get_cidreq(); + $url = api_get_path(WEB_CODE_PATH) . "lp/lp_impress.php?lp_id=$lp_id&" . api_get_cidreq(); header("Location: $url"); exit; } @@ -191,7 +191,7 @@ if (!isset($src)) { isset($file_info['extension']) && api_strtolower(substr($file_info['extension'], 0, 3) == 'pdf') ) { - $src = api_get_path(WEB_CODE_PATH).'newscorm/lp_view_item.php?lp_item_id='.$lp_item_id.'&'.api_get_cidreq(); + $src = api_get_path(WEB_CODE_PATH).'lp/lp_view_item.php?lp_item_id='.$lp_item_id.'&'.api_get_cidreq(); } $src = $_SESSION['oLP']->fixBlockedLinks($src); @@ -331,7 +331,7 @@ if ( if (intval($_GET['fb_type']) > 0) { $src = 'blank.php?msg=exerciseFinished'; } else { - $src = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?origin=learnpath&id=' . $safe_exe_id.'&'.api_get_cidreq(); + $src = api_get_path(WEB_CODE_PATH) . 'exercise/result.php?origin=learnpath&id=' . $safe_exe_id.'&'.api_get_cidreq(); if ($debug) { error_log('Calling URL: ' . $src); diff --git a/main/newscorm/lp_view_item.php b/main/lp/lp_view_item.php similarity index 97% rename from main/newscorm/lp_view_item.php rename to main/lp/lp_view_item.php index ce56ea335e..de1bffa13f 100755 --- a/main/newscorm/lp_view_item.php +++ b/main/lp/lp_view_item.php @@ -86,7 +86,7 @@ if (api_is_in_gradebook()) { } $interbreadcrumb[] = array( - 'url' => api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?action=list&'.api_get_cidreq(), + 'url' => api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?action=list&'.api_get_cidreq(), 'name' => get_lang('LearningPaths') ); $interbreadcrumb[] = array( diff --git a/main/newscorm/openoffice_document.class.php b/main/lp/openoffice_document.class.php similarity index 100% rename from main/newscorm/openoffice_document.class.php rename to main/lp/openoffice_document.class.php diff --git a/main/newscorm/openoffice_presentation.class.php b/main/lp/openoffice_presentation.class.php similarity index 100% rename from main/newscorm/openoffice_presentation.class.php rename to main/lp/openoffice_presentation.class.php diff --git a/main/newscorm/openoffice_text.class.php b/main/lp/openoffice_text.class.php similarity index 100% rename from main/newscorm/openoffice_text.class.php rename to main/lp/openoffice_text.class.php diff --git a/main/newscorm/openoffice_text_document.class.php b/main/lp/openoffice_text_document.class.php similarity index 100% rename from main/newscorm/openoffice_text_document.class.php rename to main/lp/openoffice_text_document.class.php diff --git a/main/newscorm/packaging/adlcp_rootv1p2.xsd b/main/lp/packaging/adlcp_rootv1p2.xsd similarity index 97% rename from main/newscorm/packaging/adlcp_rootv1p2.xsd rename to main/lp/packaging/adlcp_rootv1p2.xsd index 7bd8a43cd0..d4f829926b 100755 --- a/main/newscorm/packaging/adlcp_rootv1p2.xsd +++ b/main/lp/packaging/adlcp_rootv1p2.xsd @@ -1,110 +1,110 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main/newscorm/packaging/ims_qtiasiv1p2.xsd b/main/lp/packaging/ims_qtiasiv1p2.xsd similarity index 97% rename from main/newscorm/packaging/ims_qtiasiv1p2.xsd rename to main/lp/packaging/ims_qtiasiv1p2.xsd index f18ab8e21a..1d9752222f 100755 --- a/main/newscorm/packaging/ims_qtiasiv1p2.xsd +++ b/main/lp/packaging/ims_qtiasiv1p2.xsd @@ -1,2210 +1,2210 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/main/newscorm/packaging/ims_xml.xsd b/main/lp/packaging/ims_xml.xsd similarity index 98% rename from main/newscorm/packaging/ims_xml.xsd rename to main/lp/packaging/ims_xml.xsd index 3024a8bab4..21c060f767 100755 --- a/main/newscorm/packaging/ims_xml.xsd +++ b/main/lp/packaging/ims_xml.xsd @@ -1,24 +1,24 @@ - - - - - - In namespace-aware XML processors, the "xml" prefix is bound to the namespace name http://www.w3.org/XML/1998/namespace. - Do not reference this file in XML instances - Schawn Thropp: Changed the uriReference type to string type - - - - Refers to universal XML 1.0 lang attribute - - - - - Refers to XML Base: http://www.w3.org/TR/xmlbase - - - - + + + + + + In namespace-aware XML processors, the "xml" prefix is bound to the namespace name http://www.w3.org/XML/1998/namespace. + Do not reference this file in XML instances + Schawn Thropp: Changed the uriReference type to string type + + + + Refers to universal XML 1.0 lang attribute + + + + + Refers to XML Base: http://www.w3.org/TR/xmlbase + + + + diff --git a/main/newscorm/packaging/imscp_rootv1p1p2.xsd b/main/lp/packaging/imscp_rootv1p1p2.xsd similarity index 97% rename from main/newscorm/packaging/imscp_rootv1p1p2.xsd rename to main/lp/packaging/imscp_rootv1p1p2.xsd index f8bc5227f9..911a7f86b7 100755 --- a/main/newscorm/packaging/imscp_rootv1p1p2.xsd +++ b/main/lp/packaging/imscp_rootv1p1p2.xsd @@ -1,345 +1,345 @@ - - - - - - - - - - - - - - - DRAFT XSD for IMS Content Packaging version 1.1 DRAFT - Copyright (c) 2001 IMS GLC, Inc. - 2000-04-21, Adjustments by T.D. Wason from CP 1.0. - 2001-02-22, T.D.Wason: Modify for 2000-10-24 XML-Schema version. Modified to support extension. - 2001-03-12, T.D.Wason: Change filename, target and meta-data namespaces and meta-data fielname. Add meta-data to itemType, fileType and organizationType. - Do not define namespaces for xml in XML instances generated from this xsd. - Imports IMS meta-data xsd, lower case element names. - This XSD provides a reference to the IMS meta-data root element as imsmd:record - If the IMS meta-data is to be used in the XML instance then the instance must define an IMS meta-data prefix with a namespace. The meta-data targetNamespace should be used. - 2001-03-20, Thor Anderson: Remove manifestref, change resourceref back to identifierref, change manifest back to contained by manifest. --Tom Wason: manifest may contain _none_ or more manifests. - 2001-04-13 Tom Wason: corrected attirbute name structure. Was misnamed type. - 2001-05-14 Schawn Thropp: Made all complexType extensible with the group.any - Added the anyAttribute to all complexTypes. Changed the href attribute on the fileType and resourceType to xsd:string - Changed the maxLength of the href, identifierref, parameters, structure attributes to match the Information model. - 2001-07-25 Schawn Thropp: Changed the namespace for the Schema of Schemas to the 5/2/2001 W3C XML Schema - Recommendation. attributeGroup attr.imsmd deleted, was not used anywhere. Any attribute declarations that have - use = "default" changed to use="optional" - attr.structure.req. - Any attribute declarations that have value="somevalue" changed to default="somevalue", - attr.structure.req (hierarchical). Removed references to IMS MD Version 1.1. - Modified attribute group "attr.resourcetype.req" to change use from optional - to required to match the information model. As a result the default value also needed to be removed - Name change for XSD. Changed to match version of CP Spec - - - - Inclusions and Imports - - - - - - Attribute Declarations - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element groups - - - - - Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + DRAFT XSD for IMS Content Packaging version 1.1 DRAFT + Copyright (c) 2001 IMS GLC, Inc. + 2000-04-21, Adjustments by T.D. Wason from CP 1.0. + 2001-02-22, T.D.Wason: Modify for 2000-10-24 XML-Schema version. Modified to support extension. + 2001-03-12, T.D.Wason: Change filename, target and meta-data namespaces and meta-data fielname. Add meta-data to itemType, fileType and organizationType. + Do not define namespaces for xml in XML instances generated from this xsd. + Imports IMS meta-data xsd, lower case element names. + This XSD provides a reference to the IMS meta-data root element as imsmd:record + If the IMS meta-data is to be used in the XML instance then the instance must define an IMS meta-data prefix with a namespace. The meta-data targetNamespace should be used. + 2001-03-20, Thor Anderson: Remove manifestref, change resourceref back to identifierref, change manifest back to contained by manifest. --Tom Wason: manifest may contain _none_ or more manifests. + 2001-04-13 Tom Wason: corrected attirbute name structure. Was misnamed type. + 2001-05-14 Schawn Thropp: Made all complexType extensible with the group.any + Added the anyAttribute to all complexTypes. Changed the href attribute on the fileType and resourceType to xsd:string + Changed the maxLength of the href, identifierref, parameters, structure attributes to match the Information model. + 2001-07-25 Schawn Thropp: Changed the namespace for the Schema of Schemas to the 5/2/2001 W3C XML Schema + Recommendation. attributeGroup attr.imsmd deleted, was not used anywhere. Any attribute declarations that have + use = "default" changed to use="optional" - attr.structure.req. + Any attribute declarations that have value="somevalue" changed to default="somevalue", + attr.structure.req (hierarchical). Removed references to IMS MD Version 1.1. + Modified attribute group "attr.resourcetype.req" to change use from optional + to required to match the information model. As a result the default value also needed to be removed + Name change for XSD. Changed to match version of CP Spec + + + + Inclusions and Imports + + + + + + Attribute Declarations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + element groups + + + + + Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/main/newscorm/packaging/imsmd_rootv1p2p1.xsd b/main/lp/packaging/imsmd_rootv1p2p1.xsd similarity index 97% rename from main/newscorm/packaging/imsmd_rootv1p2p1.xsd rename to main/lp/packaging/imsmd_rootv1p2p1.xsd index d8a78695bb..99bb356c6b 100755 --- a/main/newscorm/packaging/imsmd_rootv1p2p1.xsd +++ b/main/lp/packaging/imsmd_rootv1p2p1.xsd @@ -1,573 +1,573 @@ - - - - - - - - - - - 2001-04-26 T.D.Wason. IMS meta-data 1.2 XML-Schema. - 2001-06-07 S.E.Thropp. Changed the multiplicity on all elements to match the - Final 1.2 Binding Specification. - Changed all elements that use the langstringType to a multiplicy of 1 or more - Changed centity in the contribute element to have a multiplicity of 0 or more. - Changed the requirement element to have a multiplicity of 0 or more. - 2001-07-25 Schawn Thropp. Updates to bring the XSD up to speed with the W3C - XML Schema Recommendation. The following changes were made: Change the - namespace to reference the 5/2/2001 W3C XML Schema Recommendation,the base - type for the durtimeType, simpleType, was changed from timeDuration to duration. - Any attribute declarations that have use="default" had to change to use="optional" - - attr.type. Any attribute declarations that have value ="somevalue" had to change - to default = "somevalue" - attr.type (URI) - 2001-09-04 Schawn Thropp - Changed the targetNamespace and namespace of schema to reflect version change - - - - - - - - - - - - - - - - - - - - Any namespaced element from any namespace may be used for an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + 2001-04-26 T.D.Wason. IMS meta-data 1.2 XML-Schema. + 2001-06-07 S.E.Thropp. Changed the multiplicity on all elements to match the + Final 1.2 Binding Specification. + Changed all elements that use the langstringType to a multiplicy of 1 or more + Changed centity in the contribute element to have a multiplicity of 0 or more. + Changed the requirement element to have a multiplicity of 0 or more. + 2001-07-25 Schawn Thropp. Updates to bring the XSD up to speed with the W3C + XML Schema Recommendation. The following changes were made: Change the + namespace to reference the 5/2/2001 W3C XML Schema Recommendation,the base + type for the durtimeType, simpleType, was changed from timeDuration to duration. + Any attribute declarations that have use="default" had to change to use="optional" + - attr.type. Any attribute declarations that have value ="somevalue" had to change + to default = "somevalue" - attr.type (URI) + 2001-09-04 Schawn Thropp + Changed the targetNamespace and namespace of schema to reflect version change + + + + + + + + + + + + + + + + + + + + Any namespaced element from any namespace may be used for an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/main/newscorm/packaging/xml.xsd b/main/lp/packaging/xml.xsd similarity index 100% rename from main/newscorm/packaging/xml.xsd rename to main/lp/packaging/xml.xsd diff --git a/main/newscorm/resourcelinker.inc.php b/main/lp/resourcelinker.inc.php similarity index 86% rename from main/newscorm/resourcelinker.inc.php rename to main/lp/resourcelinker.inc.php index 04617501fa..cfb814e509 100755 --- a/main/newscorm/resourcelinker.inc.php +++ b/main/lp/resourcelinker.inc.php @@ -23,7 +23,7 @@ if (!empty($_course['language'])){ require_once $resource_linker_file; } } -require_once '../exercice/hotpotatoes.lib.php'; +require_once '../exercise/hotpotatoes.lib.php'; /* FUNCTIONS */ @@ -40,11 +40,12 @@ function unset_session_resources() { function show_folder_up() { global $folder; global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; + $learningPathId = $learnpath_id; $level = get_levels($folder); if ($level == 1) { - echo "".get_lang('LevelUp').""; + echo "".get_lang('LevelUp').""; } if ($level && $level != 0 && $level != 1) { $folder_up=$folder; @@ -52,7 +53,7 @@ function show_folder_up() { $last=count($folder_temp)-1; unset($folder_temp[$last]); $folder_up=implode('/',$folder_temp); - echo "".get_lang('LevelUp').""; + echo "".get_lang('LevelUp').""; } } @@ -62,6 +63,7 @@ function show_folder_up() { */ function show_documents($folder) { global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; + $learningPathId = $learnpath_id; // Documents are a special case: The teacher can add an invisible document (it will be viewable by the user) // other tools do not have this feature. @@ -100,7 +102,7 @@ function show_documents($folder) { // Folders should be clickable. if (file_or_folder($row['path'])) { echo "".substr($row['path'], 1).'
      '; + echo "&folder=".substr($row['path'], 1)."&source_id=$source_id&source_forum=".$_GET['source_forum']."&action=$action&lp_id=$learningPathId&parent_item_id=$chapter_id&originalresource=no'>".substr($row['path'], 1).'
      '; } else { echo substr($row['path'], 1).' '; echo showorhide_addresourcelink('Document',$row['id']); @@ -113,7 +115,7 @@ function show_documents($folder) { $level = get_levels($folder) + 1; // We calculate each level of the database entry. - $file_level=get_levels($row['path'])-1; + $file_level = get_levels($row['path']) - 1; // If the level of the database entry is equal to the level we ar in, we put it into an array // as this is a potential good entry. if ($file_level == $level) { @@ -191,10 +193,10 @@ function store_resources($source_type, $source_id) $addedresourceid = $_SESSION['addedresourceid']; if ($_SESSION['addedresource']) { foreach ($addedresource as $resource_type) { - $sql="INSERT INTO $resource_table (c_id, source_type, source_id, resource_type, resource_id) VALUES + $sql = "INSERT INTO $resource_table (c_id, source_type, source_id, resource_type, resource_id) VALUES ($course_id, '$source_type', '$source_id', '$resource_type', '".$addedresourceid[key($addedresource)]."')"; Database::query($sql); - $i=key($addedresource); + $i = key($addedresource); next($addedresource); } $_SESSION['addedresource']=''; @@ -244,13 +246,13 @@ function display_addedresource_link($type, $id, $style = '') $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"); $myrow = Database::fetch_array($result); - echo ' '.$myrow['title']."
      \n"; + echo ' '.$myrow['title']."
      \n"; break; case 'Forum': $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id"); $myrow = Database::fetch_array($result); - echo ' '.$myrow['forum_name']."
      \n"; + echo ' '.$myrow['forum_name']."
      \n"; break; case 'Thread': //=topics //@deprecated bb_posts, bb_posts_text, bb_forums @@ -286,13 +288,13 @@ function display_addedresource_link($type, $id, $style = '') $ext = strtolower($ext[sizeof($ext)-1]); $myrow['path'] = rawurlencode($myrow['path']); - $array_ext=array('htm', 'html', 'gif', 'jpg', 'jpeg', 'png'); + $array_ext = array('htm', 'html', 'gif', 'jpg', 'jpeg', 'png'); - if (api_browser_support('svg')){ - $array_ext[]='svg'; + if (api_browser_support('svg')) { + $array_ext[] = 'svg'; } - if (api_browser_support('ogg')){ - $array_ext[]='ogg'; + if (api_browser_support('ogg')) { + $array_ext[] = 'ogg'; } $in_frames = in_array($ext, $array_ext); @@ -325,6 +327,7 @@ function display_addedresource_link($type, $id, $style = '') function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_path, $builder, $icon, $level = 0) { global $learnpath_id, $items; global $enableDocumentParsing, $_course, $_user, $_cid; + $learningPathId = $learnpath_id; $course_id = api_get_course_int_id(); @@ -334,7 +337,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ $length = ((($builder == 'builder') && ($icon == 'nolink')) ? 65 : 32); - if ($builder != 'builder') $origin = 'learnpath'; //origin = learnpath in student view + if ($builder != 'builder') $origin = 'learnpath'; //origin = learnpath in student view $linktype = $type; if (($type == 'Link _self') or ($type == 'Link _blank')) $type = 'Link'; @@ -342,34 +345,41 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ switch ($type) { case TOOL_CALENDAR_EVENT: case 'Agenda': - $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); + $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE c_id = $course_id AND id=$id"); $myrow = Database::fetch_array($result); $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path"; - $result = Database::query($sql); $row = Database::fetch_array($result); + $result = Database::query($sql); + $row = Database::fetch_array($result); if ($row['title'] != '') { $myrow['title'] = $row['title']; } $desc = $row['description']; $agenda_id = $row['item_id']; echo str_repeat(" >", $level); - if (($builder != 'builder') && ($icon != 'wrap')) { echo "
      "; @@ -407,12 +417,13 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon != 'nolink') { if ($completed == 'completed') { echo "on"; - } else { + } else { echo "on"; - //echo " "; } } - if (($builder != 'builder') && ($icon != 'wrap')) { echo ""; @@ -439,7 +450,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ case TOOL_LINK: case 'Link': - $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); + $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); $result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id"); $myrow = Database::fetch_array($result); @@ -454,7 +465,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon != 'nolink') { if ($completed == 'completed') { echo "on"; - } else { + } else { echo "on"; //echo " "; } @@ -468,13 +479,16 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon == 'nolink') { return(shorten($myrow['title'], $length)); } if ($icon == 'icon') { - if ($linktype == 'Link _self') { echo "links"; } - else { echo "blank links"; } + if ($linktype == 'Link _self') { + echo "links"; + } else { + echo "blank links"; + } } $thelink = $myrow['url']; if ($builder != 'builder') { - echo "".shorten($myrow['title'], ($length-3*$level)).""; - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path"; + echo "".shorten($myrow['title'], ($length-3*$level)).""; + $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path"; if ($desc != '') { if ($icon != 'wrap') { echo ""; @@ -489,7 +503,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ case TOOL_QUIZ: case 'Exercise': - $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); + $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"); $myrow = Database::fetch_array($result); @@ -509,7 +523,6 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ echo "on"; } else { echo "on"; - //echo " "; } } if (($builder != 'builder') && ($icon != 'wrap')) { echo ""; @@ -532,13 +545,13 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ } } } else { - echo "".shorten($myrow['title'], ($length-3*$level)).""; + echo "".shorten($myrow['title'], ($length-3*$level)).""; } break; case 'hotpotatoes': case 'HotPotatoes': - $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); + $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE c_id = $course_id AND id=$id"); $myrow = Database::fetch_array($result); @@ -558,7 +571,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon != 'nolink') { if ($completed == 'completed') { echo "on"; - } else { + } else { echo "on"; //echo " "; } @@ -567,14 +580,14 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($name=='') { echo "".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2').""; return(true); } - if ($icon == 'nolink') { return(shorten($name,$length)); } + if ($icon == 'nolink') { return(shorten($name, $length)); } if ($icon == 'icon') { echo "hot potatoes"; } $cid = $_course['official_code']; if ($builder != 'builder') { - echo "".shorten($name,($length-3*$level)).""; - $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path"; + echo "".shorten($name,($length-3*$level)).""; + $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=HotPotatoes&origin=$origin&id=$id#$id_in_path"; if ($desc != '') { if ($icon != 'wrap') { echo ""; @@ -583,7 +596,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ } } } else { - echo " ".shorten($name,($length-3*$level)).""; + echo " ".shorten($name,($length-3*$level)).""; } break; @@ -594,7 +607,8 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ $myrow = Database::fetch_array($result); $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path"; - $result = Database::query($sql); $row = Database::fetch_array($result); + $result = Database::query($sql); + $row = Database::fetch_array($result); if ($row['title'] != '') { $myrow["forum_name"] = $row['title']; } $desc = $row['description']; echo str_repeat(" >", $level); @@ -603,7 +617,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon != 'nolink') { if ($completed == 'completed') { echo "on"; - } else { + } else { echo "on"; //echo " "; } @@ -614,10 +628,10 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon == 'nolink') { return(shorten($myrow['forum_name'], $length)); } if ($icon == 'icon') { echo "forum"; } - $forumparameters = "forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; + $forumParameters = "forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; if ($builder != 'builder') { - echo "".shorten($myrow["forum_name"],($length-3*$level)).""; - $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path"; + echo "".shorten($myrow["forum_name"],($length-3*$level)).""; + $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Forum&origin=$origin&forumparameters=$forumParameters#$id_in_path"; if ($desc != '') { if ($icon != 'wrap') { echo ""; @@ -626,7 +640,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ } } } else { - echo "".shorten($myrow["forum_name"],($length-3*$level)).""; + echo "".shorten($myrow["forum_name"],($length-3*$level)).""; } break; @@ -647,7 +661,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon != 'nolink') { if ($completed == 'completed') { echo "on"; - } else { + } else { echo "on"; //echo " "; } @@ -659,8 +673,8 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon == 'nolink') { return(shorten($myrow['topic_title'], $length)); } if ($icon == 'icon') { echo "forum"; } if ($builder != 'builder') { - echo "".shorten($myrow["topic_title"], ($length-3*$level)).""; - $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path"; + echo "".shorten($myrow["topic_title"], ($length-3*$level)).""; + $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path"; if ($desc != '') { if ($icon != 'wrap') { echo ""; @@ -698,7 +712,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon != 'nolink') { if ($completed == 'completed') { echo "on"; - } else { + } else { echo "on"; //echo " "; } @@ -713,7 +727,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon == 'nolink') { return(shorten($myrow["post_title"],$length)); } if ($icon == 'icon') { echo "forum"; } if ($builder != 'builder') { - echo "".shorten($myrow["post_title"],($length-3*$level)).""; $items[]=api_get_self()."?action=closelesson&source_forum=".intval($_GET['source_forum'])."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path"; + echo "".shorten($myrow["post_title"],($length-3*$level)).""; $items[]=api_get_self()."?action=closelesson&source_forum=".intval($_GET['source_forum'])."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path"; if ($desc != '') { if ($icon != 'wrap') { echo ""; @@ -767,14 +781,14 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon == 'icon') { echo "$image"; } if ($builder != 'builder') { - echo "".shorten($filename,($length-3*$level)).""; + echo "".shorten($filename,($length-3*$level)).""; if ($desc != '') { if ($icon != 'wrap') { echo ""; } else { echo "
           ".shorten($desc,($length-3*$level))."
      "; } - } $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path"; + } $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path"; } else { $enableDocumentParsing=yes; if (!$enableDocumentParsing) { @@ -801,7 +815,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon != 'nolink') { if ($completed == 'completed') { echo "on"; - } else { + } else { echo "on"; //echo " "; } @@ -815,7 +829,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon == 'nolink') { return(shorten($name, $length)); } if ($icon == 'icon') { echo ""; } if ($builder != 'builder') { - echo "".shorten($name,($length-3*$level)).""; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path"; + echo "".shorten($name,($length-3*$level)).""; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Assignments&origin=$origin#$id_in_path"; if ($desc != '') { if ($icon != 'wrap') { echo ""; @@ -842,7 +856,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon != 'nolink') { if ($completed == 'completed') { echo "on"; - } else { + } else { echo "on"; //echo " "; } @@ -855,11 +869,11 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon == 'icon') { echo ""; } if ($builder != 'builder') { - echo "".shorten($name,($length-3*$level)).""; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path"; + echo "".shorten($name,($length-3*$level)).""; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Dropbox&origin=$origin#$id_in_path"; if ($desc != '') { if ($icon != 'wrap') { - echo ""; } - else { + echo ""; + } else { echo "
           ".shorten($desc, ($length-3*$level))."
      "; } } } else { @@ -893,12 +907,12 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon == 'icon') { echo "introduction"; } if ($builder != 'builder') { - echo "".shorten($name,($length-3*$level)).""; - $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path"; + echo "".shorten($name,($length-3*$level)).""; + $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Introduction_text&origin=$origin#$id_in_path"; if ($desc != '') { if ($icon != 'wrap') { - echo ""; } - else { + echo ""; + } else { echo "
           ".shorten($desc, ($length-3*$level))."
      "; } } } else { @@ -920,7 +934,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon != 'nolink') { if ($completed == 'completed') { echo "on"; - } else { + } else { echo "on"; //echo " "; } @@ -933,12 +947,13 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon == 'icon') { echo "info"; } if ($builder != 'builder') { - echo "".shorten($name,($length-3*$level)).""; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path"; + echo "".shorten($name,($length-3*$level)).""; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Course_description&origin=$origin#$id_in_path"; if ($desc != '') { if ($icon != 'wrap') { - echo ""; } - else { - echo "
           ".shorten($desc, ($length-3*$level))."
      "; } + echo ""; + } else { + echo "
           ".shorten($desc, ($length-3*$level))."
      "; + } } } else { $s=api_get_path(WEB_CODE_PATH)."course_description"; @@ -973,11 +988,11 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon == 'icon') { echo "group"; } if ($builder != 'builder') { - echo "".shorten($name,($length-3*$level)).""; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path"; + echo "".shorten($name,($length-3*$level)).""; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Groups&origin=$origin#$id_in_path"; if ($desc != '') { if ($icon != 'wrap') { - echo ""; } - else { + echo ""; + } else { echo "
           ".shorten($desc, ($length-3*$level))."
      "; } } } else { @@ -1012,11 +1027,11 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon == 'icon') { echo "members"; } if ($builder != 'builder') { - echo "".shorten($name,($length-3*$level)).""; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path"; + echo "".shorten($name,($length-3*$level)).""; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Users&origin=$origin#$id_in_path"; if ($desc != '') { if ($icon != 'wrap') { - echo ""; } - else { + echo ""; + } else { echo "
           ".shorten($desc, ($length-3*$level))."
      "; } } } else { @@ -1040,6 +1055,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) { global $_course, $learnpath_id; global $enableDocumentParsing, $_user, $_cid; + $learningPathId = $learnpath_id; $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); $course_id = api_get_course_int_id(); @@ -1065,7 +1081,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) $agenda_id = $row['item_id']; if ($builder != 'builder') { - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path"; + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path"; } else { $link .= "../calendar/agenda.php?origin=$origin&agenda_id=$agenda_id"; } @@ -1077,14 +1093,14 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) $myrow = Database::fetch_array($result); if ($builder != 'builder') { - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$id#$id_in_path"; + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Ad_Valvas&origin=$origin&ann_id=$id#$id_in_path"; } else { $link .= "../announcements/announcements.php?origin=$origin&ann_id=$id"; } break; case 'Link': - $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); + $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); $result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id"); $myrow = Database::fetch_array($result); @@ -1094,14 +1110,14 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) $thelink = $myrow['url']; if ($builder != 'builder') { - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path"; + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path"; } else { $link .= $thelink; } break; case 'Exercise': - $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); + $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"); $myrow = Database::fetch_array($result); @@ -1113,13 +1129,13 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) if ($row['title'] != '') { $myrow['title'] = $row['title']; } if ($builder != 'builder') { - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path"; + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path"; } else { - $link .= "../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]; + $link .= "../exercise/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]; } break; case 'HotPotatoes': - $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); + $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE c_id = $course_id AND id=$id"); $myrow = Database::fetch_array($result); @@ -1130,9 +1146,9 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) } $cid = $_course['official_code']; if ($builder != 'builder') { - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path"; + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=HotPotatoes&origin=$origin&id=$id#$id_in_path"; } else { - $link .= "../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id']; + $link .= "../exercise/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id']; } break; case 'Forum': @@ -1149,11 +1165,11 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) if ($myrow['forum_name'] == '') { $type = 'Forum'; } - $forumparameters = "forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; + $forumParameters = "forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; if ($builder != 'builder') { - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path"; + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Forum&origin=$origin&forumparameters=$forumParameters#$id_in_path"; } else { - $link .= "../phpbb/viewforum.php?$forumparameters"; + $link .= "../phpbb/viewforum.php?$forumParameters"; } break; @@ -1170,7 +1186,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) $result = Database::query($sql); $row = Database::fetch_array($result); if ($builder != 'builder') { - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path"; + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path"; } else { $link .= "../forum/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; } @@ -1197,7 +1213,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) $posttext = str_replace('"', "'", $posttext); if ($builder != 'builder') { - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path"; + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path"; } else { $link .= "../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; } @@ -1217,7 +1233,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) $row = Database::fetch_array($result); if ($builder != 'builder') { - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path"; + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path"; } else { $enableDocumentParsing = yes; if (!$enableDocumentParsing) { @@ -1232,21 +1248,21 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) case 'Assignments': if ($builder != 'builder') { - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path"; + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Assignments&origin=$origin#$id_in_path"; } else { $link .= "../work/work.php"; } break; case 'Dropbox': if ($builder != 'builder') { - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path"; + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Dropbox&origin=$origin#$id_in_path"; } else { $link .= "../dropbox/index.php"; } break; case 'Introduction_text': if ($builder != 'builder') { - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path"; + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Introduction_text&origin=$origin#$id_in_path"; } else { $s = api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1"; $link .= $s; @@ -1254,7 +1270,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) break; case 'Course_description': if ($builder != 'builder') { - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path"; + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Course_description&origin=$origin#$id_in_path"; } else { $s = api_get_path(WEB_CODE_PATH).'course_description'; $link .= $s; @@ -1263,14 +1279,14 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) case 'Groups': if ($builder != 'builder') { - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path"; + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Groups&origin=$origin#$id_in_path"; } else { $link .= "../group/group.php?origin=$origin"; } break; case 'Users': if ($builder != 'builder') { - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path"; + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Users&origin=$origin#$id_in_path"; } else { $link .= "../user/user.php?origin=$origin"; } @@ -1294,10 +1310,12 @@ function remove_resource($resource_key) { /** * This function is to show the button "click to add resource" on the tool page * @author Patrick Cool , Ghent University + * @param string $additionalParameters */ -function show_addresource_button($additionalparameters = '') { +function show_addresource_button($additionalParameters = '') +{ global $charset; - echo ''; + echo ''; } /** @@ -1314,6 +1332,9 @@ function delete_one_added_resource($source_type, $source_id, $resource_type, $re /** * This function is to delete the resources that were added to a specific item + * @param string $type + * @param int $id + * @return void */ function delete_added_resource($type, $id) { @@ -1327,6 +1348,7 @@ function delete_added_resource($type, $id) /** * This function is te delete all resources of a specific type (only used in announcements -- delete all) * Author : Frederik Vermeire + * @param string $type */ function delete_all_resources_type($type) { @@ -1338,6 +1360,9 @@ function delete_all_resources_type($type) /** * This function checks wether there are added resources or not + * @param string $type + * @param int $id + * @return bool */ function check_added_resources($type, $id) { $course_id = api_get_course_int_id(); @@ -1353,8 +1378,11 @@ function check_added_resources($type, $id) { } /** - * this function is to load the resources that were added to a specific item + * This function is to load the resources that were added to a specific item * into the session variables + * @param string $type + * @param int $id + * @return void */ function edit_added_resources($type, $id) { @@ -1364,8 +1392,7 @@ function edit_added_resources($type, $id) $sql = "SELECT * FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id=$id"; $result=Database::query($sql); - while ($row=Database::fetch_array($result)) - { + while ($row=Database::fetch_array($result)) { $addedresource[]=$row["resource_type"]; $addedresourceid[]=$row["resource_id"]; } @@ -1377,6 +1404,9 @@ function edit_added_resources($type, $id) * this function is store the modified resources * first we delete all the added resources in the database, * then we add all the resources from the session object. + * @param string $type + * @param int $id + * @return void */ function update_added_resources($type, $id) { @@ -1396,7 +1426,11 @@ function update_added_resources($type, $id) } /** - * this function is to display the resources that were added to a specific item + * This function is to display the resources that were added to a specific item + * @param string $type + * @param int $id + * @param string $style + * @return void */ function display_added_resources($type, $id, $style = '') { $course_id = api_get_course_int_id(); @@ -1426,6 +1460,8 @@ function display_added_resources($type, $id, $style = '') { * This function is to show the added resources when adding an item * $showdeleteimg determine if the delete image should appear or not. * deleting an added resource is only possible through the resource linker file itself + * @param int $showdeleteimg + * @return void */ function display_resources($showdeleteimg) { global $action; @@ -1433,6 +1469,7 @@ function display_resources($showdeleteimg) { global $id; global $locationkey; global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; + $learningPathId = $learnpath_id; if ($resourceaction == 'removeresource') { remove_resource($locationkey); @@ -1453,7 +1490,7 @@ function display_resources($showdeleteimg) { parse_str($test[query], $output); if ($showdeleteimg == 1) { - echo "resource ".get_lang(
      "; + echo "resource ".get_lang(
      "; } echo ''; next($addedresource); @@ -1467,15 +1504,19 @@ function display_resources($showdeleteimg) { /** -* This function checks wether the link add resource should be displayed next the item in the linker page -* So we have to check if the specific id of that tool is already in the array of the added resources -* if it is already in, the link should not be showed since it would make it possible to add -* the same resource a second time (=duplication of added resources) -*/ + * This function checks wether the link add resource should be displayed next the item in the linker page + * So we have to check if the specific id of that tool is already in the array of the added resources + * if it is already in, the link should not be showed since it would make it possible to add + * the same resource a second time (=duplication of added resources) + * @param string $type + * @param int $id + * @return void + */ function showorhide_addresourcelink($type, $id) { global $from_learnpath, $source_id, $action, $learnpath_id, $chapter_id, $originalresource, $folder, $content, $target; $addedresource = $_SESSION['addedresource']; $addedresourceid = $_SESSION['addedresourceid']; + $learningPathId = $learnpath_id; if (is_array($_SESSION['addedresource'])) { foreach ($addedresource as $toolcompare) { @@ -1487,16 +1528,16 @@ function showorhide_addresourcelink($type, $id) { if ($from_learnpath) { $lang_add_it_or_resource = get_lang('AddIt'); } else { $lang_add_it_or_resource = get_lang('AddResource'); } if ($show !== 0) { if ($type == 'Document') { - echo "".$lang_add_it_or_resource.""; + echo "".$lang_add_it_or_resource.""; } else { - echo "".$lang_add_it_or_resource.""; + echo "".$lang_add_it_or_resource.""; } } } else { // if it is not an array, it is a string if ($_SESSION['addedresource'] !== $type || $_SESSION['addedresourceid'] !== $id) { if ($from_learnpath) { $lang_add_it_or_resource = get_lang('AddIt'); } else { $lang_add_it_or_resource = get_lang('AddResource'); } - echo "".$lang_add_it_or_resource.""; + echo "".$lang_add_it_or_resource.""; } } } @@ -1511,6 +1552,7 @@ function showorhide_addresourcelink($type, $id) { * @param integer The resource ID * @param string Resource style (e.g. when a resource is hidden => the added resources should also be styled like they are hidden) * @param boolean Open in a new window (true) or in the current frame/window (false)? + * @return string * @todo use the constants for the type definitions. */ function rl_get_html_resource_link($course_code, $type, $id, $style='', $new_window = true) { @@ -1548,13 +1590,13 @@ function rl_get_html_resource_link($course_code, $type, $id, $style='', $new_win $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"); $myrow = Database::fetch_array($result); - $output = ' '.$myrow['title']."
      \n"; + $output = ' '.$myrow['title']."
      \n"; break; case TOOL_FORUM: $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id"); $myrow = Database::fetch_array($result); - $output = ' '.$myrow['forum_name']."
      \n"; + $output = ' '.$myrow['forum_name']."
      \n"; break; case TOOL_THREAD: //=topics //$tbl_forum = Database::get_course_table(TABLE_FORUM); @@ -1564,7 +1606,7 @@ function rl_get_html_resource_link($course_code, $type, $id, $style='', $new_win $sql_title = "SELECT * FROM $tbl_post WHERE c_id = $course_id AND post_id=".$id; $result_title = Database::query($sql_title); $myrow_title = Database::fetch_array($result_title); - $output = ' '.$myrow_title['post_title']."
      \n"; + $output = ' '.$myrow_title['post_title']."
      \n"; break; case TOOL_POST: $tbl_post = Database::get_course_table(TABLE_FORUM_POST); @@ -1572,7 +1614,7 @@ function rl_get_html_resource_link($course_code, $type, $id, $style='', $new_win $sql = "SELECT * FROM $tbl_post p WHERE c_id = $course_id AND p.post_id = $id"; $result = Database::query($sql); $post = Database::fetch_array($result); - $output = ' '.$post['post_title']."
      \n"; + $output = ' '.$post['post_title']."
      \n"; break; case TOOL_DOCUMENT: $tbl_doc = Database::get_course_table(TABLE_DOCUMENT); @@ -1601,18 +1643,19 @@ function rl_get_html_resource_link($course_code, $type, $id, $style='', $new_win * with that information. * @author Yannick Warnier - rebranding based on previous work (display_addedresource_link_in_learnpath()) * @param int $course_id Course code - * @param int $learnpath_id The learning path ID (in lp table) + * @param int $learningPathId The learning path ID (in lp table) * @param int $id_in_path the unique index in the items table - * @param int $lpViewId + * @param int $lpViewId + * @return string */ -function rl_get_resource_link_for_learnpath($course_id, $learnpath_id, $id_in_path, $lpViewId) +function rl_get_resource_link_for_learnpath($course_id, $learningPathId, $id_in_path, $lpViewId) { $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); $course_info = api_get_course_info_by_id($course_id); $course_id = $course_info['real_id']; $course_code = $course_info['code']; $session_id = api_get_session_id(); - $learnpath_id = intval($learnpath_id); + $learningPathId = intval($learningPathId); $id_in_path = intval($id_in_path); $lpViewId = intval($lpViewId); @@ -1621,7 +1664,7 @@ function rl_get_resource_link_for_learnpath($course_id, $learnpath_id, $id_in_pa $sql = "SELECT * FROM $tbl_lp_item WHERE c_id = $course_id AND - lp_id = $learnpath_id AND + lp_id = $learningPathId AND id = $id_in_path "; $res_item = Database::query($sql); @@ -1638,7 +1681,7 @@ function rl_get_resource_link_for_learnpath($course_id, $learnpath_id, $id_in_pa $link = ''; switch ($type) { case 'dokeos_chapter': - $link .= $main_dir_path.'newscorm/blank.php'; + $link .= $main_dir_path . 'lp/blank.php'; case TOOL_CALENDAR_EVENT: $link .= $main_dir_path.'calendar/agenda.php?origin='.$origin.'&agenda_id='.$id; break; @@ -1661,7 +1704,7 @@ function rl_get_resource_link_for_learnpath($course_id, $learnpath_id, $id_in_pa if ($row_item['title'] != '') { $myrow['title'] = $row_item['title']; } - $link .= $main_dir_path.'exercice/overview.php?cidReq='.$course_code.'&session_id='.$session_id.'&lp_init=1&origin='.$origin.'&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$id_in_path.'&exerciseId='.$id; + $link .= $main_dir_path . 'exercise/overview.php?cidReq='.$course_code.'&session_id='.$session_id.'&lp_init=1&origin='.$origin.'&learnpath_id='.$learningPathId.'&learnpath_item_id='.$id_in_path.'&exerciseId='.$id; } break; case 'hotpotatoes': //lowercase because of strtolower above @@ -1669,9 +1712,9 @@ function rl_get_resource_link_for_learnpath($course_id, $learnpath_id, $id_in_pa $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE c_id = $course_id AND id=$id"); $myrow = Database::fetch_array($result); $path = $myrow['path']; - $link .= $main_dir_path.'exercice/showinframes.php?file='.$path.'' . + $link .= $main_dir_path . 'exercise/showinframes.php?file='.$path.'' . '&origin='.$origin.'&cid='.$course_code.'&uid='.api_get_user_id().'' . - '&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$id_in_path.'&lp_view_id='.$lpViewId; + '&learnpath_id='.$learningPathId.'&learnpath_item_id='.$id_in_path.'&lp_view_id='.$lpViewId; break; case TOOL_FORUM: $link .= $main_dir_path.'forum/viewforum.php?forum='.$id.'&lp=true&origin=learnpath'; @@ -1705,7 +1748,7 @@ function rl_get_resource_link_for_learnpath($course_id, $learnpath_id, $id_in_pa case TOOL_DOCUMENT: $document = $em ->getRepository('ChamiloCourseBundle:CDocument') - ->findOneBy(['cId' => $course_id, 'id' => $id]); + ->findOneBy(['cId' => $course_id, 'id' => $id]); if (!$document) { break; @@ -1732,7 +1775,7 @@ function rl_get_resource_link_for_learnpath($course_id, $learnpath_id, $id_in_pa Session::write('officedoc',$officedoc); break; case TOOL_LP_FINAL_ITEM: - $link .= api_get_path(WEB_CODE_PATH).'newscorm/lp_final_item.php?'.api_get_cidreq().'&id='.$id.'&lp_id='.$learnpath_id; + $link .= api_get_path(WEB_CODE_PATH) . 'lp/lp_final_item.php?'.api_get_cidreq().'&id='.$id.'&lp_id='.$learningPathId; break; case 'assignments': $link .= $main_dir_path.'work/work.php?origin='.$origin; @@ -1767,16 +1810,16 @@ function rl_get_resource_link_for_learnpath($course_id, $learnpath_id, $id_in_pa * @param string The tool type (using constants declared in main_api.lib.php) * @param integer The resource ID */ -function rl_get_resource_name($course_code, $learnpath_id, $id_in_path) +function rl_get_resource_name($course_code, $learningPathId, $id_in_path) { $_course = api_get_course_info($course_code); $course_id = $_course['real_id']; $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); - $learnpath_id = intval($learnpath_id); + $learningPathId = intval($learningPathId); $id_in_path = intval($id_in_path); $sql_item = "SELECT item_type, title, ref FROM $tbl_lp_item - WHERE c_id = $course_id AND lp_id = $learnpath_id AND id = $id_in_path"; + WHERE c_id = $course_id AND lp_id = $learningPathId AND id = $id_in_path"; $res_item = Database::query($sql_item); if (Database::num_rows($res_item) < 1) { @@ -1853,11 +1896,11 @@ function rl_get_resource_name($course_code, $learnpath_id, $id_in_path) break; case 'hotpotatoes': $tbl_doc = Database::get_course_table(TABLE_DOCUMENT); - $result = Database::query("SELECT * FROM $tbl_doc WHERE c_id = $course_id AND id=$id"); + $result = Database::query("SELECT * FROM $tbl_doc WHERE c_id = $course_id AND id = $id"); $myrow = Database::fetch_array($result); $pathname = explode('/', $myrow['path']); // Making a correct name for the link. - $last = count($pathname) - 1; // Making a correct name for the link. - $filename = $pathname[$last]; // Making a correct name for the link. + $last = count($pathname) - 1; // Making a correct name for the link. + $filename = $pathname[$last]; // Making a correct name for the link. $image = choose_image($filename); $ext = explode('.', $filename); $ext = strtolower($ext[sizeof($ext) - 1]); diff --git a/main/newscorm/resourcelinker.php b/main/lp/resourcelinker.php similarity index 97% rename from main/newscorm/resourcelinker.php rename to main/lp/resourcelinker.php index edf95e6bc4..979491c011 100755 --- a/main/newscorm/resourcelinker.php +++ b/main/lp/resourcelinker.php @@ -255,7 +255,7 @@ if ($add) { //get title from tool-type table $tooltable = Database::get_course_table(TABLE_DOCUMENT); $result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i]); - $myrow=Database::fetch_array($result); + $myrow = Database::fetch_array($result); $title = $myrow['title']; break; case 'Exercise': @@ -263,7 +263,7 @@ if ($add) { //get title from tool-type table $tooltable = Database::get_course_table(TABLE_QUIZ_TEST); $result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i]); - $myrow=Database::fetch_array($result); + $myrow = Database::fetch_array($result); $title = $myrow['title']; break; case 'Forum': @@ -275,7 +275,7 @@ if ($add) { //get title from tool-type table $tooltable = Database::get_course_table(TABLE_AGENDA); $result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i]); - $myrow=Database::fetch_array($result); + $myrow = Database::fetch_array($result); $title = $myrow['title']; break; case 'Ad_Valvas': @@ -283,7 +283,7 @@ if ($add) { //get title from tool-type table $tooltable = Database::get_course_table(TABLE_ANNOUNCEMENT); $result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i]); - $myrow=Database::fetch_array($result); + $myrow = Database::fetch_array($result); $title = $myrow['title']; break; @@ -349,28 +349,28 @@ if ($_GET['source_id']) { } $originaltoolname = get_lang('Agenda'); $breadcrumbelement = array ('url' => $url, 'name' => $originaltoolname); - session_unregister('from_learnpath'); + unset($_SESSION['from_learnpath']); unset ($from_learnpath); break; case '2': // coming from forum: new topic $url = "../phpbb/newtopic.php?forum=$source_forum&md5=$md5"; $originaltoolname = get_lang('ForumAddNewTopic'); $breadcrumbelement = array ('url' => $url, 'name' => $originaltoolname); - session_unregister('from_learnpath'); + unset($_SESSION['from_learnpath']); unset ($from_learnpath); break; case '3': // coming from forum: edit topic $url = "../phpbb/editpost.php?post_id=$post_id&topic=$topic&forum=$forum&md5=$md5&originalresource=no"; $originaltoolname = get_lang('ForumEditTopic'); $breadcrumbelement = array ('url' => $url, 'name' => $originaltoolname); - session_unregister('from_learnpath'); + unset($_SESSION['from_learnpath']); unset ($from_learnpath); break; case '4': // coming from exercises: edit topic - $url = "../exercice/admin.php?modifyAnswers=$modifyAnswers"; + $url = "../exercise/admin.php?modifyAnswers=$modifyAnswers"; $originaltoolname = get_lang('ExerciseAnswers'); $breadcrumbelement = array ('url' => $url, 'name' => $originaltoolname); - session_unregister('from_learnpath'); + unset($_SESSION['from_learnpath']); unset ($from_learnpath); break; case '5': // coming from learning path @@ -409,9 +409,9 @@ if ($from_learnpath != 'yes') { $therow2 = Database::fetch_array($sql_result); $from_learnpath = 'yes'; - session_register('from_learnpath'); - $interbreadcrumb[] = array ('url' => "../newscorm/lp_controller.php?action=list", 'name' => get_lang('LearningPath')); - $interbreadcrumb[] = array ('url' => "../newscorm/lp_controller.php?action=admin_view&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}")); + $_SESSION['from_learnpath'] = $from_learnpath; + $interbreadcrumb[] = array ('url' => "../lp/lp_controller.php?action=list", 'name' => get_lang('LearningPath')); + $interbreadcrumb[] = array ('url' => "../lp/lp_controller.php?action=admin_view&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}")); $interbreadcrumb[] = array ('url' => api_get_self()."?action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no", 'name' => "{$therow2['title']}"); } @@ -439,7 +439,7 @@ $active_modules = array(); $tool_table = Database::get_course_table(TABLE_TOOL_LIST); $sql_select_active = "SELECT * FROM $tool_table WHERE visibility='1'"; $result_select_active = Database::query($sql_select_active); -while ($row=Database::fetch_array($result_select_active)) { +while ($row = Database::fetch_array($result_select_active)) { $active_modules[] = $row['name']; } ?> @@ -800,7 +800,7 @@ if ($content == 'Link') { // Showing the categories and the links in it. $sqlcategories = "SELECT * FROM ".$tbl_categories." ORDER by display_order DESC"; $resultcategories = Database::query($sqlcategories) or die; - while ($myrow = @ Database::fetch_array($resultcategories)) { + while ($myrow = @Database::fetch_array($resultcategories)) { $sql_links = "SELECT * FROM ".$link_table." l, ".$item_property_table." ip WHERE l.category_id='".$myrow['id']."' AND ip.tool = '".TOOL_LINK."' AND l.id=ip.ref AND ip.visibility='1' ORDER BY l.display_order DESC"; echo "
      ' . get_lang("Choice") . '' . get_lang("ExpectedChoice") . '' . get_lang("Answer") . '' . get_lang("Comment") . '
      - + ' . get_lang('ShowAttempt') . ' - + ' . get_lang('ShowAndQualifyAttempt') . '
      "; } + if (($builder != 'builder') && ($icon != 'wrap')) { + echo ""; + } if ($icon != 'nolink') { if ($completed == 'completed') { echo "on"; - } else { + } else { echo "on"; - //echo " "; } } - if (($builder != 'builder') && ($icon != 'wrap')) { echo ""; } + if (($builder != 'builder') && ($icon != 'wrap')) { + echo ""; + } - if ($myrow['title'] == '') { echo "".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2').""; return(true); } + if ($myrow['title'] == '') { + echo "".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2').""; + return(true); + } if ($icon == 'nolink') { return(shorten($myrow['title'], $length)); } if ($icon == 'icon') { echo "agenda"; } if ($builder != 'builder') { - echo "".shorten($myrow['title'], ($length-3*$level)).""; - $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path"; + echo "".shorten($myrow['title'], ($length-3*$level)).""; + $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path"; if ($desc != '') { if ($icon != 'wrap') { echo "
        ".shorten($desc, ($length-3*$level))."
      "; } + if (($builder != 'builder') && ($icon != 'wrap')) { + echo ""; + } if ($title == '') { $type = 'Announcement'; @@ -420,11 +431,11 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ return(true); } - if ($icon == 'nolink') { return(shorten($title,$length)); } + if ($icon == 'nolink') { return(shorten($title, $length)); } if ($icon == 'icon') { echo "ad valvas"; } if ($builder != 'builder') { - echo "".shorten($title, ($length-3*$level)).""; - $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$ann_id#$id_in_path"; + echo "".shorten($title, ($length-3*$level)).""; + $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Ad_Valvas&origin=$origin&ann_id=$ann_id#$id_in_path"; if ($desc != '') { if ($icon != 'wrap') { echo "
        ".shorten($desc, ($length-3*$level))."
        ".shorten($desc, ($length-3*$level))."
      "; } @@ -522,8 +535,8 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ if ($icon == 'nolink') { return(shorten($myrow['title'], $length)); } if ($icon == 'icon') { echo "quizz"; } if ($builder != 'builder') { - echo "".shorten($myrow['title'], ($length-3*$level)).""; - $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path"; + echo "".shorten($myrow['title'], ($length-3*$level)).""; + $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learningPathId&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path"; if ($desc != '') { if ($icon != 'wrap') { echo "
        ".shorten($desc, ($length-3*$level))."
        ".shorten($desc, ($length-3*$level))."
        ".shorten($desc,($length-3*$level))."
        ".shorten($desc,($length-3*$level))."
        ".shorten($desc,($length-3*$level))."
        ".shorten($desc,($length-3*$level))."
        ".shorten($desc, ($length-3*$level))."
        ".shorten($desc, ($length-3*$level))."
        ".shorten($desc, ($length-3*$level))."
        ".shorten($desc, ($length-3*$level))."
        ".shorten($desc, ($length-3*$level))."
        ".shorten($desc, ($length-3*$level))."
        ".shorten($desc, ($length-3*$level))."
        ".shorten($desc, ($length-3*$level))."
        ".shorten($desc, ($length-3*$level))."
        ".shorten($desc, ($length-3*$level))."
        ".shorten($desc, ($length-3*$level))."
      ".$myrow['category_title']."
      "; $result_links = Database::query($sql_links); diff --git a/main/newscorm/scorm.class.php b/main/lp/scorm.class.php similarity index 100% rename from main/newscorm/scorm.class.php rename to main/lp/scorm.class.php diff --git a/main/newscorm/scormItem.class.php b/main/lp/scormItem.class.php similarity index 100% rename from main/newscorm/scormItem.class.php rename to main/lp/scormItem.class.php diff --git a/main/newscorm/scormMetadata.class.php b/main/lp/scormMetadata.class.php similarity index 100% rename from main/newscorm/scormMetadata.class.php rename to main/lp/scormMetadata.class.php diff --git a/main/newscorm/scormOrganization.class.php b/main/lp/scormOrganization.class.php similarity index 100% rename from main/newscorm/scormOrganization.class.php rename to main/lp/scormOrganization.class.php diff --git a/main/newscorm/scormResource.class.php b/main/lp/scormResource.class.php similarity index 100% rename from main/newscorm/scormResource.class.php rename to main/lp/scormResource.class.php diff --git a/main/newscorm/scorm_api.php b/main/lp/scorm_api.php similarity index 99% rename from main/newscorm/scorm_api.php rename to main/lp/scorm_api.php index b833e41589..a44656e8af 100755 --- a/main/newscorm/scorm_api.php +++ b/main/lp/scorm_api.php @@ -217,7 +217,7 @@ addEvent(window, 'load', addListeners, false); // Initialize stuff when the page is loaded $(document).ready(function() { logit_lms('document.ready event starts'); - logit_lms('These logs are generated by the main/newscorm/scorm_api.php JS ' + logit_lms('These logs are generated by the main/lp/scorm_api.php JS ' + 'library when the admin has clicked on the debug icon in the ' + 'learning paths list: ' + 'lines prefixed with "LMS:" refer to actions taken on the LMS side, ' @@ -1622,7 +1622,7 @@ function switch_item(current_item, next_item){ break; } - var mysrc = 'newscorm/lp_controller.php?action=content&lp_id=' + olms.lms_lp_id + + var mysrc = 'lp/lp_controller.php?action=content&lp_id=' + olms.lms_lp_id + '&item_id=' + next_item + '&cidReq=' + olms.lms_course_code + '&id_session=' + olms.lms_session_id; var cont_f = $("#content_id"); @@ -1663,7 +1663,7 @@ function switch_item(current_item, next_item){ }); olms.switch_finished = 0; //only changed back once LMSInitialize() happens - loadForumThead(olms.lms_lp_id, next_item); + loadForumThread(olms.lms_lp_id, next_item); checkCurrentItemPosition(olms.lms_item_id); return true; @@ -1699,7 +1699,7 @@ var checkCurrentItemPosition = function(lpItemId) { /** * Get a forum info when the learning path item has a associated forum */ -var loadForumThead = function(lpId, lpItemId) { +var loadForumThread = function(lpId, lpItemId) { var loadForum = $.getJSON('lp.ajax.php', { a: 'get_forum_thread', lp: lpId, diff --git a/main/newscorm/storageapi.php b/main/lp/storageapi.php similarity index 100% rename from main/newscorm/storageapi.php rename to main/lp/storageapi.php diff --git a/main/messages/inbox.php b/main/messages/inbox.php index 436503a3c5..5dc1c6de33 100755 --- a/main/messages/inbox.php +++ b/main/messages/inbox.php @@ -100,7 +100,10 @@ if (isset($_GET['form_reply']) || isset($_GET['form_delete'])) { if (isset($_GET['f']) && $_GET['f'] == 'social') { $this_section = SECTION_SOCIAL; - $interbreadcrumb[] = array('url' => api_get_path(WEB_PATH).'main/social/home.php', 'name' => get_lang('SocialNetwork')); + $interbreadcrumb[] = array( + 'url' => api_get_path(WEB_PATH).'main/social/home.php', + 'name' => get_lang('SocialNetwork') + ); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Inbox')); } else { $this_section = SECTION_MYPROFILE; @@ -109,14 +112,14 @@ if (isset($_GET['f']) && $_GET['f'] == 'social') { $social_parameter = ''; -if ((isset($_GET['f']) && $_GET['f'] == 'social') || - api_get_setting('allow_social_tool') == 'true' +if ((isset($_GET['f']) && $_GET['f'] === 'social') || + api_get_setting('allow_social_tool') === 'true' ) { $social_parameter = '?f=social'; } else { $actions = null; //Comes from normal profile - if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { + if (api_get_setting('allow_social_tool') === 'true' && api_get_setting('allow_message_tool') === 'true') { $actions .= ''. Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).''; } @@ -132,7 +135,7 @@ if ((isset($_GET['f']) && $_GET['f'] == 'social') || } //LEFT CONTENT -if (api_get_setting('allow_social_tool') == 'true') { +if (api_get_setting('allow_social_tool') === 'true') { //Block Social Menu $social_menu_block = SocialManager::show_social_menu('messages'); } @@ -140,7 +143,7 @@ if (api_get_setting('allow_social_tool') == 'true') { //Right content $social_right_content = null; $keyword = ''; -if (api_get_setting('allow_social_tool') == 'true') { +if (api_get_setting('allow_social_tool') === 'true') { $actionsLeft = ''. Display::return_icon('new-message.png', get_lang('ComposeMessage'), array(), 32).''; $actionsLeft .= ''. diff --git a/main/messages/new_message.php b/main/messages/new_message.php index 256989c1cd..3234759670 100755 --- a/main/messages/new_message.php +++ b/main/messages/new_message.php @@ -107,7 +107,13 @@ function manage_form($default, $select_from_user_list = null, $sent_to = null) $message_id = isset($_GET['message_id']) ? intval($_GET['message_id']) : null; $param_f = isset($_GET['f']) && $_GET['f'] == 'social' ? 'social' : null; - $form = new FormValidator('compose_message', null, api_get_self().'?f='.$param_f, null, array('enctype'=>'multipart/form-data')); + $form = new FormValidator( + 'compose_message', + null, + api_get_self().'?f='.$param_f, + null, + array('enctype' => 'multipart/form-data') + ); if (empty($group_id)) { if (isset($select_from_user_list)) { $form->addText( @@ -140,7 +146,7 @@ function manage_form($default, $select_from_user_list = null, $sent_to = null) ] ); } else { - $form->addElement('hidden','hidden_user',$default['users'][0],array('id'=>'hidden_user')); + $form->addElement('hidden', 'hidden_user', $default['users'][0], array('id' => 'hidden_user')); } } } else { @@ -148,8 +154,8 @@ function manage_form($default, $select_from_user_list = null, $sent_to = null) $group_info = $userGroup->get($group_id); $form->addElement('label', get_lang('ToGroup'), api_xml_http_response_encode($group_info['name'])); - $form->addElement('hidden','group_id',$group_id); - $form->addElement('hidden','parent_id',$message_id); + $form->addElement('hidden', 'group_id', $group_id); + $form->addElement('hidden', 'parent_id', $message_id); } $form->addText('title', get_lang('Subject'), true); @@ -272,11 +278,11 @@ if ($group_id != 0) { if ($socialToolIsActive) { } else { $social_right_content .= ''; $social_right_content .= ''; } @@ -357,7 +363,7 @@ $tpl = new Template(get_lang('ComposeMessage')); // Block Social Avatar SocialManager::setSocialUserBlock($tpl, $user_id, 'messages'); -if (api_get_setting('allow_social_tool') == 'true') { +if (api_get_setting('allow_social_tool') === 'true') { $tpl->assign('social_menu_block', $social_menu_block); $tpl->assign('social_right_content', $social_right_content); $social_layout = $tpl->get_template('social/inbox.tpl'); diff --git a/main/messages/outbox.php b/main/messages/outbox.php index 04abc1c4d0..9b28f9ae16 100755 --- a/main/messages/outbox.php +++ b/main/messages/outbox.php @@ -21,39 +21,35 @@ if (isset($_GET['messages_page_nr'])) { } } -if (api_get_setting('allow_message_tool')!='true'){ +if (api_get_setting('allow_message_tool') != 'true') { api_not_allowed(); } //jquery thickbox already called from main/inc/header.inc.php -$htmlHeadXtra[]=''; /* MAIN CODE */ -if (isset($_GET['f']) && $_GET['f']=='social') { +if (isset($_GET['f']) && $_GET['f'] === 'social') { $this_section = SECTION_SOCIAL; $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social')); $interbreadcrumb[]= array ('url' => '#','name' => get_lang('Outbox')); @@ -66,13 +62,17 @@ if (isset($_GET['f']) && $_GET['f']=='social') { $actions = ''; if (api_get_setting('extended_profile') == 'true') { if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { - $actions .= ''.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).''; + $actions .= ''. + Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).''; } if (api_get_setting('allow_message_tool') == 'true') { //echo ''.Display::return_icon('inbox.png').' '.get_lang('Messages').''; - $actions .= ''.Display::return_icon('message_new.png',get_lang('ComposeMessage')).''; - $actions .= ''.Display::return_icon('inbox.png',get_lang('Inbox')).''; - $actions .= ''.Display::return_icon('outbox.png',get_lang('Outbox')).''; + $actions .= ''. + Display::return_icon('message_new.png',get_lang('ComposeMessage')).''; + $actions .= ''. + Display::return_icon('inbox.png',get_lang('Inbox')).''; + $actions .= ''. + Display::return_icon('outbox.png',get_lang('Outbox')).''; } } @@ -81,7 +81,7 @@ $info_delete_outbox =array(); $info_delete_outbox = isset($_GET['form_delete_outbox']) ? explode(',',$_GET['form_delete_outbox']) : ''; $count_delete_outbox = count($info_delete_outbox) - 1; -if (isset($info_delete_outbox[0]) && trim($info_delete_outbox[0])=='delete') { +if (isset($info_delete_outbox[0]) && trim($info_delete_outbox[0]) == 'delete') { for ($i = 1; $i <= $count_delete_outbox; $i++) { MessageManager::delete_message_by_user_sender(api_get_user_id(),$info_delete_outbox[$i]); } diff --git a/main/messages/view_message.php b/main/messages/view_message.php index f0d19244c7..8c0c5512c9 100755 --- a/main/messages/view_message.php +++ b/main/messages/view_message.php @@ -27,11 +27,11 @@ if (isset($_GET['f']) && $_GET['f']=='social') { if (api_get_setting('extended_profile') == 'true') { $social_right_content .= '
      '; - if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { + if (api_get_setting('allow_social_tool') === 'true' && api_get_setting('allow_message_tool') === 'true') { $social_right_content .= ''. Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).''; } - if (api_get_setting('allow_message_tool') == 'true') { + if (api_get_setting('allow_message_tool') === 'true') { $social_right_content .= ''. Display::return_icon('message_new.png',get_lang('ComposeMessage')).''; $social_right_content .= ''. @@ -56,7 +56,7 @@ if (empty($_GET['id'])) { $message = ''; // LEFT COLUMN -if (api_get_setting('allow_social_tool') == 'true') { +if (api_get_setting('allow_social_tool') === 'true') { // Block Social Menu $social_menu_block = SocialManager::show_social_menu($show_menu); } @@ -72,7 +72,7 @@ $tpl = new Template(get_lang('View')); // Block Social Avatar SocialManager::setSocialUserBlock($tpl, $user_id, $show_menu); -if (api_get_setting('allow_social_tool') == 'true') { +if (api_get_setting('allow_social_tool') === 'true') { $tpl->assign('social_menu_block', $social_menu_block); $tpl->assign('social_right_content', $social_right_content); $social_layout = $tpl->get_template('social/inbox.tpl'); diff --git a/main/mySpace/course.php b/main/mySpace/course.php index 08d3f79e88..bfc146b277 100755 --- a/main/mySpace/course.php +++ b/main/mySpace/course.php @@ -6,7 +6,6 @@ */ ob_start(); -$nameTools = 'Cours'; $cidReset = true; require_once '../inc/global.inc.php'; @@ -57,7 +56,7 @@ if (api_get_setting('add_users_by_coach') == 'true') { } } -Display :: display_header($nameTools); +Display :: display_header(get_lang('Courses')); $a_courses = array(); if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) { diff --git a/main/mySpace/current_courses.php b/main/mySpace/current_courses.php index 8f9e75566c..62c3d02349 100755 --- a/main/mySpace/current_courses.php +++ b/main/mySpace/current_courses.php @@ -76,7 +76,7 @@ if (!empty($my_courses)) { $lp_id = $learnpath['id']; $lp_items = - $array[$i]['lp'] = ''.$learnpath['name'].''; + $array[$i]['lp'] = ''.$learnpath['name'].''; $array[$i]['teachers'] = ''; if (!empty($teacher_list)) { diff --git a/main/mySpace/lp_tracking.php b/main/mySpace/lp_tracking.php index fcf6de9df3..c1f51f5ac4 100755 --- a/main/mySpace/lp_tracking.php +++ b/main/mySpace/lp_tracking.php @@ -58,7 +58,7 @@ $lp_title = Database::result($rs, 0, 0); $origin = 'tracking'; -$output = require_once api_get_path(SYS_CODE_PATH).'newscorm/lp_stats.php'; +$output = require_once api_get_path(SYS_CODE_PATH) . 'lp/lp_stats.php'; Display :: display_header($nameTools); echo '
      '; diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php index 2f1a75976a..4669da05e7 100755 --- a/main/mySpace/myStudents.php +++ b/main/mySpace/myStudents.php @@ -12,7 +12,8 @@ api_block_anonymous_users(); if (!api_is_allowed_to_create_course() && !api_is_session_admin() && !api_is_drh() && - !api_is_student_boss() + !api_is_student_boss() && + !api_is_platform_admin() ) { // Check if the user is tutor of the course $user_course_status = CourseManager::get_tutor_in_course_status( @@ -164,9 +165,9 @@ if (isset($_GET['user_id']) && $_GET['user_id'] != "") { } // Action behaviour +$action = isset($_GET['action']) ? $_GET['action'] : ''; - -switch ($_GET['action']) { +switch ($action) { case 'send_legal': $subject = get_lang('SendLegalSubject'); $content = sprintf( @@ -602,7 +603,6 @@ if (!empty($student_id)) { ['class' => 'btn btn-primary btn-xs'] ); } - echo ' '; echo get_lang('LegalAccepted').' '.$icon; @@ -1144,14 +1144,14 @@ if (!empty($student_id)) { if (Database :: num_rows($result_last_attempt) > 0) { $id_last_attempt = Database :: result($result_last_attempt, 0, 0); if ($count_attempts > 0) - echo ' + echo ' '.Display::return_icon('quiz.gif').' '; } echo ''; echo ''; - $all_attempt_url = "../exercice/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$sessionId"; + $all_attempt_url = "../exercise/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$sessionId"; echo Display::url(Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), $all_attempt_url ); echo ''; diff --git a/main/mySpace/user_edit.php b/main/mySpace/user_edit.php index e342b89363..7944a89b73 100644 --- a/main/mySpace/user_edit.php +++ b/main/mySpace/user_edit.php @@ -2,7 +2,6 @@ /* For licensing terms, see /license.txt */ // including necessary libraries -$language_file = array('admin', 'registration'); $cidReset = true; require_once '../inc/global.inc.php'; @@ -181,7 +180,7 @@ if ($form->validate()) { api_get_setting('administratorTelephone')."\n" . get_lang('Email') ." : ".api_get_setting('emailAdministrator'); $emailbody = nl2br($emailbody); - + api_mail_html( api_get_person_name($userInfo['firstname'], $userInfo['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $email, diff --git a/main/mySpace/works_in_session_report.php b/main/mySpace/works_in_session_report.php new file mode 100644 index 0000000000..18b95f3191 --- /dev/null +++ b/main/mySpace/works_in_session_report.php @@ -0,0 +1,174 @@ +addSelect('session', get_lang('Session'), [0 => get_lang('None')]); +$form->addButtonFilter(get_lang('Filter')); + +foreach ($sessionsInfo as $sessionInfo) { + $selectSession->addOption($sessionInfo['name'], $sessionInfo['id']); +} + +if (isset($_GET['session']) && intval($_GET['session'])) { + $form->setDefaults(['session' => intval($_GET['session'])]); + + $session = $em->find('ChamiloCoreBundle:Session', intval($_GET['session'])); +} + +$coursesInfo = []; +$usersInfo = []; + +if ($session) { + $sessionCourses = $session->getCourses(); + + foreach ($sessionCourses as $sessionCourse) { + $course = $sessionCourse->getCourse(); + $coursesInfo[$course->getId()] = $course->getCode(); + $criteria = Criteria::create()->where( + Criteria::expr()->eq("status", Session::STUDENT) + ); + $userCourseSubscriptions = $session + ->getUserCourseSubscriptions() + ->matching($criteria); + + foreach ($userCourseSubscriptions as $userCourseSubscription) { + $user = $userCourseSubscription->getUser(); + + if (!array_key_exists($user->getId(), $usersInfo)) { + $usersInfo[$user->getId()] = [ + 'code' => $user->getOfficialCode(), + 'complete_name' => $user->getCompleteName(), + 'time_in_platform' => api_time_to_hms( + Tracking::get_time_spent_on_the_platform($user->getId()) + ), + 'first_connection' => Tracking::get_first_connection_date($user->getId()), + 'last_connection' => Tracking::get_last_connection_date($user->getId()) + ]; + } + + $usersInfo[$user->getId()][$course->getId() . '_score'] = null; + $usersInfo[$user->getId()][$course->getId() . '_progress'] = null; + $usersInfo[$user->getId()][$course->getId() . '_last_sent_date'] = null; + + if (!$session->hasStudentInCourse($user, $course)) { + continue; + } + + $usersInfo[$user->getId()][$course->getId() . '_score'] = Tracking::get_avg_student_score( + $user->getId(), + $course->getCode(), + null, + $session->getId() + ); + $usersInfo[$user->getId()][$course->getId() . '_progress'] = Tracking::get_avg_student_progress( + $user->getId(), + $course->getCode(), + null, + $session->getId() + ); + + $lastPublication = Tracking::getLastStudentPublication($user, 'work', $course, $session); + + if (!$lastPublication) { + continue; + } + + $usersInfo[$user->getId()][$course->getId() . '_last_sent_date'] = api_format_date( + $lastPublication->getSentDate()->getTimestamp(), + DATE_TIME_FORMAT_SHORT + ); + } + } +} + +if (isset($_GET['export']) && $session && ($coursesInfo && $usersInfo)) { + $fileName = 'works_in_session_' . api_get_local_time(); + + $dataToExport = []; + $dataToExport[] = [$toolName, $session->getName()]; + $dataToExport['headers'][] = get_lang('OfficialCode'); + $dataToExport['headers'][] = get_lang('StudentName'); + $dataToExport['headers'][] = get_lang('TimeSpentOnThePlatform'); + $dataToExport['headers'][] = get_lang('FirstLoginInPlatform'); + $dataToExport['headers'][] = get_lang('LatestLoginInPlatform'); + + foreach ($coursesInfo as $courseCode) { + $dataToExport['headers'][] = $courseCode; + $dataToExport['headers'][] = get_lang('Progress'); + $dataToExport['headers'][] = get_lang('LastSentWorkDate'); + } + + foreach ($usersInfo as $user) { + $dataToExport[] = $user; + } + + switch ($_GET['export']) { + case 'xls': + Export::export_table_xls_html($dataToExport, $fileName); + break; + case 'csv': + Export::arrayToCsv($dataToExport, $fileName); + break; + } + + exit; +} + +$interbreadcrumb[] = [ + 'url' => api_get_path(WEB_CODE_PATH) . 'mySpace/index.php', + 'name' => get_lang('MySpace') +]; + +$actions = []; + +if ($session) { + $actions = [ + Display::url( + Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), [], ICON_SIZE_MEDIUM), + api_get_self() . '?' . http_build_query(['export' => 'csv', 'session' => $session->getId()]) + ), + Display::url( + Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), [], ICON_SIZE_MEDIUM), + api_get_self() . '?' . http_build_query(['export' => 'xls', 'session' => $session->getId()]) + ) + ]; +} + +$view = new Template($toolName); +$view->assign('form', $form->returnForm()); + +if ($session) { + $view->assign('session', ['name' => $session->getName()]); + $view->assign('courses', $coursesInfo); + $view->assign('users', $usersInfo); +} + +$template = $view->get_template('my_space/works_in_session_report.tpl'); +$content = $view->fetch($template); + +$view->assign('header', $toolName); +$view->assign('content', $content); +$view->assign('actions', implode(' ', $actions)); +$view->display_one_col_template(); diff --git a/main/notebook/index.php b/main/notebook/index.php index 229ff75278..c265cca06c 100755 --- a/main/notebook/index.php +++ b/main/notebook/index.php @@ -7,7 +7,6 @@ * refactoring and tighter integration */ -// Including the global initialization file require_once '../inc/global.inc.php'; $current_course_tool = TOOL_NOTEBOOK; @@ -20,12 +19,12 @@ api_protect_course_script(true); // Additional javascript $htmlHeadXtra[] = NotebookManager::javascript_notebook(); -$htmlHeadXtra[] = ''; @@ -35,12 +34,14 @@ $tool = TOOL_NOTEBOOK; // Tracking Event::event_access_tool(TOOL_NOTEBOOK); +$action = isset($_GET['action']) ? $_GET['action'] : ''; + // Tool name -if (isset($_GET['action']) && $_GET['action'] == 'addnote') { +if ($action === 'addnote') { $tool = 'NoteAddNew'; $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('ToolNotebook')); } -if (isset($_GET['action']) && $_GET['action'] == 'editnote') { +if ($action === 'editnote') { $tool = 'ModifyNote'; $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('ToolNotebook')); } @@ -52,7 +53,7 @@ Display::display_header(get_lang(ucfirst($tool))); Display::display_introduction_section(TOOL_NOTEBOOK); // Action handling: Adding a note -if (isset($_GET['action']) && $_GET['action'] == 'addnote') { +if ($action === 'addnote') { if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { api_not_allowed(); } @@ -103,7 +104,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'addnote') { $form->setConstants(array('sec_token' => $token)); $form->display(); } -} elseif (isset($_GET['action']) && $_GET['action'] == 'editnote' && is_numeric($_GET['notebook_id'])) { +} elseif ($action === 'editnote' && is_numeric($_GET['notebook_id'])) { // Action handling: Editing a note if (!empty($_GET['isStudentView'])) { @@ -112,12 +113,15 @@ if (isset($_GET['action']) && $_GET['action'] == 'addnote') { } // Initialize the object - $form = new FormValidator('note', 'post', api_get_self().'?action='.Security::remove_XSS($_GET['action']).'¬ebook_id='.Security::remove_XSS($_GET['notebook_id'])); + $form = new FormValidator( + 'note', + 'post', + api_get_self().'?action='.Security::remove_XSS($_GET['action']).'¬ebook_id='.intval($_GET['notebook_id']) + ); // Setting the form elements $form->addElement('header', '', get_lang('ModifyNote')); $form->addElement('hidden', 'notebook_id'); $form->addElement('text', 'note_title', get_lang('NoteTitle'), array('size' => '100')); - //$form->applyFilter('note_title', 'html_filter'); $form->addElement('html_editor', 'note_comment', get_lang('NoteComment'), null, api_is_allowed_to_edit() ? array('ToolbarSet' => 'Notebook', 'Width' => '100%', 'Height' => '300') : array('ToolbarSet' => 'NotebookStudent', 'Width' => '100%', 'Height' => '300', 'UserStatus' => 'student') @@ -154,7 +158,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'addnote') { $form->setConstants(array('sec_token' => $token)); $form->display(); } -} elseif (isset($_GET['action']) && $_GET['action'] == 'deletenote' && is_numeric($_GET['notebook_id'])) { +} elseif ($action === 'deletenote' && is_numeric($_GET['notebook_id'])) { // Action handling: deleting a note $res = NotebookManager::delete_note(Security::remove_XSS($_GET['notebook_id'])); @@ -164,28 +168,26 @@ if (isset($_GET['action']) && $_GET['action'] == 'addnote') { NotebookManager::display_notes(); } elseif ( - isset($_GET['action']) && $_GET['action'] == 'changeview' && - in_array($_GET['view'], array('creation_date', 'update_date', 'title')) - ) { + $action === 'changeview' && in_array($_GET['view'], array('creation_date', 'update_date', 'title')) ) { // Action handling: changing the view (sorting order) switch ($_GET['view']) { case 'creation_date': - if (!$_GET['direction'] OR $_GET['direction'] == 'ASC') { + if (!$_GET['direction'] || $_GET['direction'] == 'ASC') { Display::display_confirmation_message(get_lang('NotesSortedByCreationDateAsc')); } else { Display::display_confirmation_message(get_lang('NotesSortedByCreationDateDESC')); } break; case 'update_date': - if (!$_GET['direction'] OR $_GET['direction'] == 'ASC') { + if (!$_GET['direction'] || $_GET['direction'] == 'ASC') { Display::display_confirmation_message(get_lang('NotesSortedByUpdateDateAsc')); } else { Display::display_confirmation_message(get_lang('NotesSortedByUpdateDateDESC')); } break; case 'title': - if (!$_GET['direction'] OR $_GET['direction'] == 'ASC') { + if (!$_GET['direction'] || $_GET['direction'] == 'ASC') { Display::display_confirmation_message(get_lang('NotesSortedByTitleAsc')); } else { Display::display_confirmation_message(get_lang('NotesSortedByTitleDESC')); @@ -198,5 +200,4 @@ if (isset($_GET['action']) && $_GET['action'] == 'addnote') { NotebookManager::display_notes(); } -// Footer Display::display_footer(); diff --git a/main/resourcelinker/resourcelinker.inc.php b/main/resourcelinker/resourcelinker.inc.php index 204a9fc66e..f4fa9f4bf0 100755 --- a/main/resourcelinker/resourcelinker.inc.php +++ b/main/resourcelinker/resourcelinker.inc.php @@ -17,7 +17,7 @@ use ChamiloSession as Session; * INIT SECTION */ -include(api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php'); +include(api_get_path(SYS_CODE_PATH).'exercise/hotpotatoes.lib.php'); /** * FUNCTIONS @@ -273,13 +273,13 @@ function display_addedresource_link($type, $id, $style='') $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"); $myrow = Database::fetch_array($result); - echo ' '.$myrow['title']."
      \n"; + echo ' '.$myrow['title']."
      \n"; break; case 'Forum': $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id"); $myrow = Database::fetch_array($result); - echo ' '.$myrow['forum_name']."
      \n"; + echo ' '.$myrow['forum_name']."
      \n"; break; case 'Thread': //=topics //deprecated @@ -292,7 +292,7 @@ function display_addedresource_link($type, $id, $style='') $sql_title = "SELECT * FROM $tbl_posts_text WHERE post_id=".$myrow["post_id"]; $result_title = Database::query($sql_title); $myrow_title = Database::fetch_array($result_title); - echo ' '.$myrow_title['post_title']."
      \n"; + echo ' '.$myrow_title['post_title']."
      \n"; break; case 'Post': //deprecated @@ -572,7 +572,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ } else { - echo "".shorten($myrow["title"],($length-3*$level)).""; + echo "".shorten($myrow["title"],($length-3*$level)).""; } break; @@ -630,7 +630,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ } else { - echo " ".shorten($name,($length-3*$level)).""; + echo " ".shorten($name,($length-3*$level)).""; } break; @@ -1203,7 +1203,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) } else { - $link .= "../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]; + $link .= "../exercise/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]; } break; @@ -1225,7 +1225,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) } else { - $link .= "../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id'].""; + $link .= "../exercise/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id'].""; } break; diff --git a/main/resourcelinker/resourcelinker.php b/main/resourcelinker/resourcelinker.php index 0c7638ae53..0ec8636ded 100755 --- a/main/resourcelinker/resourcelinker.php +++ b/main/resourcelinker/resourcelinker.php @@ -295,28 +295,28 @@ if ($_GET["source_id"]) } $originaltoolname = get_lang("Agenda"); $breadcrumbelement = array ("url" => $url, "name" => $originaltoolname); - session_unregister('from_learnpath'); + unset($_SESSION['from_learnpath']); unset ($from_learnpath); break; case "2" : // coming from forum: new topic $url = "../phpbb/newtopic.php?forum=$source_forum&md5=$md5"; $originaltoolname = get_lang("ForumAddNewTopic"); $breadcrumbelement = array ("url" => $url, "name" => $originaltoolname); - session_unregister('from_learnpath'); + unset($_SESSION['from_learnpath']); unset ($from_learnpath); break; case "3" : // coming from forum: edit topic $url = "../phpbb/editpost.php?post_id=$post_id&topic=$topic&forum=$forum&md5=$md5&originalresource=no"; $originaltoolname = get_lang("ForumEditTopic"); $breadcrumbelement = array ("url" => $url, "name" => $originaltoolname); - session_unregister('from_learnpath'); + unset($_SESSION['from_learnpath']); unset ($from_learnpath); break; case "4" : // coming from exercises: edit topic - $url = "../exercice/admin.php?modifyAnswers=$modifyAnswers"; + $url = "../exercise/admin.php?modifyAnswers=$modifyAnswers"; $originaltoolname = get_lang("ExerciseAnswers"); $breadcrumbelement = array ("url" => $url, "name" => $originaltoolname); - session_unregister('from_learnpath'); + unset($_SESSION['from_learnpath']); unset ($from_learnpath); break; case "5" : // coming from learning path @@ -359,7 +359,7 @@ else $therow2 = Database::fetch_array($sql_result); $from_learnpath = 'yes'; - session_register('from_learnpath'); + $_SESSION['from_learnpath'] = $from_learnpath; $interbreadcrumb[] = array ("url" => "../scorm/scormdocument.php", "name" => get_lang('LearningPath')); $interbreadcrumb[] = array ("url" => "../learnpath/learnpath_handler.php?learnpath_id=$learnpath_id", "name" => "{$therow['learnpath_name']}"); $interbreadcrumb[] = array ("url" => api_get_self()."?action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no", "name" => "{$therow2['chapter_name']}"); diff --git a/main/search/index.php b/main/search/index.php index 5f4629d408..e5e0a87afd 100755 --- a/main/search/index.php +++ b/main/search/index.php @@ -10,7 +10,7 @@ require_once '../inc/global.inc.php'; $this_section = SECTION_COURSES; if (extension_loaded('xapian')) { - require '../newscorm/lp_list_search.php'; + require '../lp/lp_list_search.php'; } else { Display::display_header(get_lang('Search')); Display::display_error_message(get_lang('SearchXapianModuleNotInstalled')); diff --git a/main/search/search_suggestions.php b/main/search/search_suggestions.php index 5f382544b4..63c63db01b 100755 --- a/main/search/search_suggestions.php +++ b/main/search/search_suggestions.php @@ -10,11 +10,10 @@ require_once dirname(__FILE__) . '/../inc/global.inc.php'; function get_suggestions_from_search_engine($q) { -// if (strlen($q)<2) { return null;} global $charset; $json = []; - $table_sfv = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); + $table_sfv = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); $q = Database::escape_string($q); $cid = api_get_course_id(); $sql_add = ''; @@ -78,8 +77,8 @@ function get_suggestions_from_search_engine($q) // will create a copy as Yannick - Car - Speed // in $output[3] $c = count($output); - for ($i=0;$i<$c; $i++) { - $output[($c+$i)] = $current_field_val; + for ($i = 0; $i < $c; $i++) { + $output[($c + $i)] = $current_field_val; } } else { //no identical field id, continue as usual @@ -87,7 +86,7 @@ function get_suggestions_from_search_engine($q) if ($c == 0) { $output[] = $row2['value'].' - '; } else { - foreach ($output as $i=>$out) { + foreach ($output as $i => $out) { //use the latest combination of fields $output[$i] .= $row2['value'].' - '; } @@ -98,7 +97,7 @@ function get_suggestions_from_search_engine($q) foreach ($output as $i=>$out) { if (api_stristr($out,$q) === false) {continue;} $s = api_convert_encoding(substr($out, 0, -3), 'UTF-8', $charset); - if (!in_array($s,$more_sugg)) { + if (!in_array($s, $more_sugg)) { $more_sugg[] = $s; $json[] = [ 'id' => $s, @@ -115,6 +114,8 @@ function get_suggestions_from_search_engine($q) } $q = strtolower($_GET["term"]); -if (!$q) return; +if (!$q) { + return; +} //echo $q . "| value\n"; get_suggestions_from_search_engine($q); diff --git a/main/session/about.php b/main/session/about.php index 57800f9e3a..27f52d42a1 100644 --- a/main/session/about.php +++ b/main/session/about.php @@ -1,14 +1,16 @@ * @package chamilo.session */ -use Chamilo\CoreBundle\Entity\ExtraField; -use Chamilo\CourseBundle\Entity\CCourseDescription; -use \Chamilo\CoreBundle\Entity\SequenceResource; $cidReset = true; @@ -24,18 +26,12 @@ if (!$session) { api_not_allowed(true); } -$sessionCourses = $entityManager->getRepository('ChamiloCoreBundle:Session') - ->getCoursesOrderedByPosition($session); - $courses = []; - -$entityManager = Database::getManager(); +$sessionCourses = $entityManager->getRepository('ChamiloCoreBundle:Session')->getCoursesOrderedByPosition($session); $fieldsRepo = $entityManager->getRepository('ChamiloCoreBundle:ExtraField'); $fieldTagsRepo = $entityManager->getRepository('ChamiloCoreBundle:ExtraFieldRelTag'); $userRepo = $entityManager->getRepository('ChamiloUserBundle:User'); -$sequenceResourceRepo = $entityManager->getRepository( - 'ChamiloCoreBundle:SequenceResource' -); +$sequenceResourceRepo = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource'); $tagField = $fieldsRepo->findOneBy([ 'extraFieldType' => ExtraField::COURSE_FIELD_TYPE, diff --git a/main/session/add_courses_to_session.php b/main/session/add_courses_to_session.php index 025a962861..57079d83b1 100644 --- a/main/session/add_courses_to_session.php +++ b/main/session/add_courses_to_session.php @@ -5,6 +5,7 @@ * @package chamilo.admin * @todo use formvalidator */ + // resetting the course id. $cidReset = true; @@ -206,162 +207,162 @@ if (!api_is_platform_admin() && api_is_teacher()) { unset($Courses); ?> -
      > - - +> + + - -
      -
      - - - -
      - -
      - -
      - +
      +
      + + -
      -
      - -
      - : - - -
      - -
      - - -
      - -
      - -
      - -
      -
      - -
      - - +
      + -
      - -
      - - '; - if (isset($_GET['add'])) { - echo ''; - } else { - echo ''; - } - echo '
      '; +
      + +
      + +
      +
      + +
      + : + + +
      + +
      + + +
      + +
      + +
      + +
      +
      + +
      + +
      +
      -
      -
      - - + '; + if (isset($_GET['add'])) { + echo ''; + } else { + echo ''; + } + echo '
      '; + ?> +
      - - + document.forms.formulaire.submit(); + } + exercise = Display::url( $exercise_info->exercise, - api_get_path(WEB_CODE_PATH)."exercice/result.php?cidReq=$my_course_code&id={$exercise_result['exe_id']}&id_session=$session_id&show_headers=1", + api_get_path(WEB_CODE_PATH) . "exercise/result.php?cidReq=$my_course_code&id={$exercise_result['exe_id']}&id_session=$session_id&show_headers=1", array('target'=>SESSION_LINK_TARGET,'class'=>'exercise-result-link') ); @@ -358,7 +358,7 @@ foreach ($final_array as $session_data) { } $exercise_info->exercise = Display::url( $exercise_info->exercise, - api_get_path(WEB_CODE_PATH)."exercice/overview.php?cidReq=$my_course_code&exerciseId={$exercise_info->id}&id_session=$session_id", + api_get_path(WEB_CODE_PATH) . "exercise/overview.php?cidReq=$my_course_code&exerciseId={$exercise_info->id}&id_session=$session_id", array('target'=>SESSION_LINK_TARGET) ); diff --git a/main/social/friends.php b/main/social/friends.php index 7f99e1e942..10db42677d 100755 --- a/main/social/friends.php +++ b/main/social/friends.php @@ -17,7 +17,6 @@ if (api_get_setting('allow_social_tool') != 'true') { $this_section = SECTION_SOCIAL; $htmlHeadXtra[] = '
      -

      {{ 'TeacherTimeReport' | get_lang }}

      diff --git a/main/template/default/admin/teachers_time_by_session_report.tpl b/main/template/default/admin/teachers_time_by_session_report.tpl new file mode 100644 index 0000000000..0f65c04171 --- /dev/null +++ b/main/template/default/admin/teachers_time_by_session_report.tpl @@ -0,0 +1,73 @@ +{{ form }} + +{% if session %} + +
      + + + + + + + + + + {% for course_code in courses %} + + + + + {% endfor %} + + + + {% for user in users %} + + {% for data in user %} + + {% endfor %} + + {% endfor %} + +
      {{ 'OfficialCode'|get_lang }}{{ 'CoachName'|get_lang }}{{ 'TimeSpentOnThePlatform'|get_lang }}{{ 'FirstLoginInPlatform'|get_lang }}{{ 'LatestLoginInPlatform'|get_lang }}{{ course_code }}{{ 'NumberOfWorks'|get_lang }}{{ 'LastWork'|get_lang }}{{ 'TimeReportForCourseX'|get_lang|format(course_code) }}
      {{ data }}
      +
      + + {% for row in data %} +
      + + + + + + + + + + {% for course in row.courses %} + + + + + {% endfor %} + + + + + + + + + + + {% for course in row.courses %} + + + + + {% endfor %} + + +
      {{ 'OfficialCode'|get_lang }}{{ 'Name'|get_lang }}{{ 'TimeSpentOnThePlatform'|get_lang }}{{ 'FirstLoginInPlatform'|get_lang }}{{ 'LatestLoginInPlatform'|get_lang }}{{ course.code }}{{ 'NumberOfWorks'|get_lang }}{{ 'LastWork'|get_lang }}{{ 'TimeReportForCourseX'|get_lang|format(course_code) }}
      {{ row.code }}{{ row.complete_name }}{{ row.time_in_platform }}{{ row.first_connection }}{{ row.last_connection }}{{ course.number_of_students }}{{ course.number_of_works }}{{ course.last_work }}{{ course.time_spent_of_course }}
      +
      + {% endfor %} +{% endif %} diff --git a/main/template/default/auth/courses_categories.php b/main/template/default/auth/courses_categories.php index 584aaf5ee2..f364d1c8f0 100755 --- a/main/template/default/auth/courses_categories.php +++ b/main/template/default/auth/courses_categories.php @@ -15,17 +15,11 @@ if (isset($_REQUEST['action']) && Security::remove_XSS($_REQUEST['action']) !== $showCourses = CoursesAndSessionsCatalog::showCourses(); $showSessions = CoursesAndSessionsCatalog::showSessions(); -$pageCurrent = isset($pageCurrent) ? $pageCurrent : - isset($_GET['pageCurrent']) ? intval($_GET['pageCurrent']) : - 1; -$pageLength = isset($pageLength) ? $pageLength : - isset($_GET['pageLength']) ? intval($_GET['pageLength']) : - 10; +$pageCurrent = isset($pageCurrent) ? $pageCurrent : isset($_GET['pageCurrent']) ? intval($_GET['pageCurrent']) : 1; +$pageLength = isset($pageLength) ? $pageLength : isset($_GET['pageLength']) ? intval($_GET['pageLength']) : 12; $pageTotal = intval(ceil(intval($countCoursesInCategory) / $pageLength)); -$cataloguePagination = $pageTotal > 1 ? - CourseCategory::getCatalogPagination($pageCurrent, $pageLength, $pageTotal) : - ''; -$search_term = isset($search_term) ? $search_term :null; +$cataloguePagination = $pageTotal > 1 ? CourseCategory::getCatalogPagination($pageCurrent, $pageLength, $pageTotal) : ''; +$search_term = isset($search_term) ? $search_term : null; if ($showSessions && isset($_POST['date'])) { $date = $_POST['date']; @@ -123,51 +117,50 @@ $code = isset($code) ? $code : null;
      - +
      '; - $form .= ''; - $form .= ''; - $form .= ''; - $form .= '
      '; - $form .= '
      '; - $form .= ''; + $form .= ''; + $form .= ''; + $form .= '
      '; + $form .= '
      '; + $form .= ''; - $form .= '
      '; - $form .= ''; - echo $form; - ?> + } + $form .= ''; + $form .= '
      '; + $form .= ''; + echo $form; + ?>
      -
      -
      - - - -
      +
      +
      + + + +
      @@ -190,13 +183,13 @@ if ($showCourses && $action != 'display_sessions') { if (!empty($search_term)) { echo "

      ".get_lang('SearchResultsFor')." ".Security::remove_XSS($_POST['search_term'])."
      "; } - + $ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote'; $user_id = api_get_user_id(); - + if (!empty($browse_courses_in_category)) { foreach ($browse_courses_in_category as $course) { - $course_hidden = ($course['visibility'] == COURSE_VISIBILITY_HIDDEN); + $course_hidden = $course['visibility'] == COURSE_VISIBILITY_HIDDEN; if ($course_hidden) { continue; @@ -213,7 +206,7 @@ if ($showCourses && $action != 'display_sessions') { $course_subscribe_allowed = ($course['subscribe'] == 1); $course_unsubscribe_allowed = ($course['unsubscribe'] == 1); $count_connections = $course['count_connections']; - $creation_date = substr($course['creation_date'],0,10); + $creation_date = substr($course['creation_date'], 0, 10); $html = null; // display the course bloc @@ -318,9 +311,9 @@ function returnThumbnail($course) $course_medium_image = api_get_path(WEB_COURSE_PATH).$course['directory'].'/course-pic.png'; // redimensioned image 85x85 } else { // without picture - $course_medium_image = Display::returnIconPath('session_default.png'); + $course_medium_image = Display::return_icon('session_default.png', null, null, null, null, true); } - + $html .= '

      '; $html .= ''.api_htmlentities($title).''; $categoryTitle = $course['category']; diff --git a/main/template/default/auth/session_catalog.tpl b/main/template/default/auth/session_catalog.tpl index dc89fe7fef..08dea0bd51 100644 --- a/main/template/default/auth/session_catalog.tpl +++ b/main/template/default/auth/session_catalog.tpl @@ -17,7 +17,7 @@
      - + @@ -29,7 +29,7 @@
      - + @@ -55,7 +55,7 @@
      - + {% if item.category != '' %} {{ item.category }}
      diff --git a/main/template/default/chat/chat.tpl b/main/template/default/chat/chat.tpl new file mode 100644 index 0000000000..beeb5dac7e --- /dev/null +++ b/main/template/default/chat/chat.tpl @@ -0,0 +1,342 @@ +
      +
      +
      +
        +
        +
        +
        + +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        + +
        +
        +
        +
        + {{ 'Message'|get_lang }} + +
        +
        + +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        + + diff --git a/main/template/default/extrafield/translate.tpl b/main/template/default/extrafield/translate.tpl new file mode 100644 index 0000000000..640011d71a --- /dev/null +++ b/main/template/default/extrafield/translate.tpl @@ -0,0 +1,8 @@ +{{ form }} + diff --git a/main/template/default/layout/page_body.tpl b/main/template/default/layout/page_body.tpl index b680cb3b2e..781814951f 100755 --- a/main/template/default/layout/page_body.tpl +++ b/main/template/default/layout/page_body.tpl @@ -1,10 +1,13 @@ {# Actions #} {% if actions != '' %} +
        + {{ actions }} +
        +{% else %}
        {{ actions }}
        {% endif %} - {{ flash_messages }} diff --git a/main/template/default/layout/topbar.tpl b/main/template/default/layout/topbar.tpl index 0781948092..fa8647922d 100755 --- a/main/template/default/layout/topbar.tpl +++ b/main/template/default/layout/topbar.tpl @@ -61,16 +61,6 @@ {% endif %}
        diff --git a/main/template/default/learnpath/view.tpl b/main/template/default/learnpath/view.tpl index 257d9b1f6b..59c884a3c1 100644 --- a/main/template/default/learnpath/view.tpl +++ b/main/template/default/learnpath/view.tpl @@ -214,7 +214,7 @@ $('.lp-view-tabs').fadeIn(); }); - loadForumThead({{ lp_id }}, {{ lp_current_item_id }}); + loadForumThread({{ lp_id }}, {{ lp_current_item_id }}); checkCurrentItemPosition({{ lp_current_item_id }}); {% if glossary_extra_tools in glossary_tool_availables %} diff --git a/main/template/default/mail/content_registration_platform_to_admin.tpl b/main/template/default/mail/content_registration_platform_to_admin.tpl new file mode 100644 index 0000000000..492116adb1 --- /dev/null +++ b/main/template/default/mail/content_registration_platform_to_admin.tpl @@ -0,0 +1,19 @@ +

        {{ 'UserXWithLangXRegisteredTheSite'| get_lang | format(user_added.completeName, user_added.language) }}

        + +

        {{ 'HisProfileIs'| get_lang }}

        + +
        +
        +
        + {{ form }} +
        +
        +
        + +

        {{ 'YouCanAssignATutorInThisLinkX'|get_lang | format(link)}}

        + +

        {{ 'SignatureFormula'|get_lang }}

        +

        {{ _admin.name }}, {{ _admin.surname }}
        + {{ 'Manager'|get_lang }} {{ _s.site_name }}
        + {{ _admin.telephone ? 'T. ' ~ _admin.telephone }}
        + {{ _admin.email ? 'Email'|get_lang ~ ': ' ~ _admin.email }}

        diff --git a/main/template/default/my_space/works_in_session_report.tpl b/main/template/default/my_space/works_in_session_report.tpl new file mode 100644 index 0000000000..b615270939 --- /dev/null +++ b/main/template/default/my_space/works_in_session_report.tpl @@ -0,0 +1,33 @@ +{{ form }} + +{% if session %} + +
        + + + + + + + + + + {% for course_code in courses %} + + + + {% endfor %} + + + + {% for user in users %} + + {% for data in user %} + + {% endfor %} + + {% endfor %} + +
        {{ 'OfficialCode'|get_lang }}{{ 'StudentName'|get_lang }}{{ 'TimeSpentOnThePlatform'|get_lang }}{{ 'FirstLoginInPlatform'|get_lang }}{{ 'LatestLoginInPlatform'|get_lang }}{{ course_code }}{{ 'Progress'|get_lang }}{{ 'LastSentWorkDate'|get_lang }}
        {{ data }}
        +
        +{% endif %} diff --git a/main/template/default/social/user_block.tpl b/main/template/default/social/user_block.tpl index 607e74f4bb..731ff2af67 100644 --- a/main/template/default/social/user_block.tpl +++ b/main/template/default/social/user_block.tpl @@ -17,7 +17,7 @@
      • {{ user.complete_name }}
      • - {% if vcard_user_link %} + {% if show_full_profile %}
      • {{ @@ -30,6 +30,34 @@ {{ "BusinessCard" | get_lang }}
      • + + {% set skype_account = '' %} + {% set linkedin_url = '' %} + {% for extra in user.extra %} + {% if extra.value.getField().getVariable() == 'skype' %} + {% set skype_account = extra.value.getValue() %} + {% endif %} + + {% if extra.value.getField().getVariable() == 'linkedin_url' %} + {% set linkedin_url = extra.value.getValue() %} + {% endif %} + {% endfor %} + + {% if 'allow_show_skype_account'|get_setting == 'true' and not skype_account is empty %} +
      • + + {{ 'Skype'|get_lang }} + +
      • + {% endif %} + + {% if 'allow_show_linkedin_url'|get_setting == 'true' and not linkedin_url is empty %} +
      • + + {{ 'LinkedIn'|get_lang }} + +
      • + {% endif %} {% endif %} {% if chat_enabled == 1 %} {% if user.user_is_online_in_chat != 0 %} @@ -49,7 +77,7 @@ {% if not profile_edition_link is empty %}
      • - + {{ "EditProfile" | get_lang }}
      • diff --git a/main/tracking/courseLogCSV.php b/main/tracking/courseLogCSV.php index d063fd0c23..c87fbbfdae 100755 --- a/main/tracking/courseLogCSV.php +++ b/main/tracking/courseLogCSV.php @@ -355,7 +355,7 @@ if ($is_allowedToTrack) { $ar3 = Database::fetch_array($result3); $title_line .= get_lang('ScormTitleColumn') . ";" . get_lang('ScormStatusColumn') . ";" . get_lang('ScormScoreColumn') . ";" . get_lang('ScormTimeColumn'); while ($ar3['status'] != '') { - require_once '../newscorm/learnpathItem.class.php'; + require_once '../lp/learnpathItem.class.php'; $time = learnpathItem::getScormTimeFromParameter('php', $ar3['total_time']); $line .= $title . ";" . $ar3['status'] . ";" . $ar3['score'] . ";" . $time; $ar3 = Database::fetch_array($result3); diff --git a/main/tracking/course_log_tools.php b/main/tracking/course_log_tools.php index 9663564acf..cf274f4e9c 100755 --- a/main/tracking/course_log_tools.php +++ b/main/tracking/course_log_tools.php @@ -250,7 +250,7 @@ if ($exerciseReporting) { $quiz_avg_score = round(($quiz_avg_score / $studentCount), 2).'%'; $url = api_get_path( WEB_CODE_PATH - ).'exercice/overview.php?exerciseId='.$quiz['id'].$course_path_params; + ) . 'exercise/overview.php?exerciseId='.$quiz['id'].$course_path_params; echo ''.Display::url( $quiz['title'], diff --git a/main/tracking/userLog.php b/main/tracking/userLog.php index 41daf2a6f0..c6294bcf1a 100755 --- a/main/tracking/userLog.php +++ b/main/tracking/userLog.php @@ -26,7 +26,7 @@ $is_allowed = true; /* Libraries */ require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php'; -require_once api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php'; +require_once api_get_path(SYS_CODE_PATH).'exercise/hotpotatoes.lib.php'; if (isset($uInfo)) { $interbreadcrumb[]= array( @@ -323,7 +323,7 @@ if (( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse )) { "; while ($ar3['status'] != '') { - require_once '../newscorm/learnpathItem.class.php'; + require_once '../lp/learnpathItem.class.php'; $time = learnpathItem::getScormTimeFromParameter('php', $ar3['total_time']); echo "   "; echo "$title{$ar3['status']}{$ar3['score']}$time"; diff --git a/main/tracking/userlogCSV.php b/main/tracking/userlogCSV.php index a554aa6dd0..e737af5b4f 100755 --- a/main/tracking/userlogCSV.php +++ b/main/tracking/userlogCSV.php @@ -27,7 +27,7 @@ $is_allowed = true; /* Libraries */ require_once api_get_path(SYS_CODE_PATH) . 'resourcelinker/resourcelinker.inc.php'; -require_once api_get_path(SYS_CODE_PATH) . 'exercice/hotpotatoes.lib.php'; +require_once api_get_path(SYS_CODE_PATH) . 'exercise/hotpotatoes.lib.php'; /* Header */ @@ -282,7 +282,7 @@ if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) { $title_line=get_lang('ScormTitleColumn').";".get_lang('ScormStatusColumn').";".get_lang('ScormScoreColumn').";".get_lang('ScormTimeColumn')."\n"; while ($ar3['status'] != '') { - require_once('../newscorm/learnpathItem.class.php'); + require_once('../lp/learnpathItem.class.php'); $time = learnpathItem::get_scorm_time('php',$ar3['total_time']); $line .= $title.';'.$ar3['status'].';'.$ar3['score'].';'.$time."\n"; $ar3=Database::fetch_array($result3); diff --git a/main/upload/form.document.php b/main/upload/form.document.php index c7c9e6ff89..d98d6ded5f 100755 --- a/main/upload/form.document.php +++ b/main/upload/form.document.php @@ -12,7 +12,7 @@ */ $noPHP_SELF = false; $nameTools = get_lang('FileUpload'); -$interbreadcrumb[]= array ("url"=>"../newscorm/lp_controller.php?action=list", "name"=> get_lang(TOOL_DOCUMENT)); +$interbreadcrumb[]= array ("url"=>"../lp/lp_controller.php?action=list", "name"=> get_lang(TOOL_DOCUMENT)); Display::display_header($nameTools,"Doc"); //show the title api_display_tool_title($nameTools.$add_group_to_title); diff --git a/main/upload/form.scorm.php b/main/upload/form.scorm.php index d0f7565e55..ac622d303e 100755 --- a/main/upload/form.scorm.php +++ b/main/upload/form.scorm.php @@ -38,17 +38,17 @@ function get_zip_files_in_garbage() { */ $nameTools = get_lang("FileUpload"); $interbreadcrumb[] = array( - "url" => api_get_path(WEB_CODE_PATH)."newscorm/lp_controller.php?action=list?".api_get_cidreq(), + "url" => api_get_path(WEB_CODE_PATH)."lp/lp_controller.php?action=list?".api_get_cidreq(), "name" => get_lang("ToolLearnpath"), ); Display::display_header($nameTools, "Path"); -require_once '../newscorm/content_makers.inc.php'; +require_once '../lp/content_makers.inc.php'; require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; echo ''; diff --git a/main/upload/upload.scorm.php b/main/upload/upload.scorm.php index 9a1007ff45..30aacc749c 100755 --- a/main/upload/upload.scorm.php +++ b/main/upload/upload.scorm.php @@ -9,7 +9,7 @@ */ $cwdir = getcwd(); -require_once '../newscorm/lp_upload.php'; +require_once '../lp/lp_upload.php'; // Reinit current working directory as many functions in upload change it chdir($cwdir); @@ -58,5 +58,5 @@ if ($error == 'upload_file_too_big') { $dialogtype = 'confirmation'; } } -header('location: ../newscorm/lp_controller.php?action=list&dialog_box=' . $msg . '&dialogtype=' . $dialogtype); +header('location: ../lp/lp_controller.php?action=list&dialog_box=' . $msg . '&dialogtype=' . $dialogtype); exit; diff --git a/main/upload/upload_ppt.php b/main/upload/upload_ppt.php index 576f465d8a..38647014c7 100755 --- a/main/upload/upload_ppt.php +++ b/main/upload/upload_ppt.php @@ -19,7 +19,7 @@ if (isset($_POST['convert'])) { if (isset($_FILES['user_file'])) { $allowed_extensions = array('odp', 'sxi', 'ppt', 'pps', 'sxd', 'pptx'); if (in_array(strtolower(pathinfo($_FILES['user_file']['name'], PATHINFO_EXTENSION)), $allowed_extensions)) { - require_once api_get_path(SYS_CODE_PATH).'newscorm/lp_upload.php'; + require_once api_get_path(SYS_CODE_PATH) . 'lp/lp_upload.php'; if (isset($o_ppt) && $first_item_id != 0) { if (api_get_setting('search_enabled')=='true') { require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; @@ -36,7 +36,7 @@ if (isset($_POST['convert'])) { } } } - header('Location: ../newscorm/lp_controller.php?'.api_get_cidreq().'&lp_id='.$o_ppt->lp_id.'&action=view_item&id='.$first_item_id); + header('Location: ../lp/lp_controller.php?'.api_get_cidreq().'&lp_id='.$o_ppt->lp_id.'&action=view_item&id='.$first_item_id); exit; } else { if (!empty($o_ppt->error)) { @@ -60,7 +60,7 @@ if (!$is_allowed_to_edit) { api_not_allowed(true); } -$interbreadcrumb[]= array ("url"=>"../newscorm/lp_controller.php?action=list", "name"=> get_lang("Doc")); +$interbreadcrumb[]= array ("url"=>"../lp/lp_controller.php?action=list", "name"=> get_lang("Doc")); $nameTools = get_lang("OogieConversionPowerPoint"); Display :: display_header($nameTools); diff --git a/main/upload/upload_word.php b/main/upload/upload_word.php index 89569e1ada..b934747957 100755 --- a/main/upload/upload_word.php +++ b/main/upload/upload_word.php @@ -37,7 +37,7 @@ if (isset($_POST['convert'])) { if (isset($_FILES['user_file'])) { $allowed_extensions = array('doc','docx','odt','txt','sxw','rtf'); if (in_array(strtolower(pathinfo($_FILES['user_file']['name'],PATHINFO_EXTENSION)),$allowed_extensions)) { - require('../newscorm/lp_upload.php'); + require('../lp/lp_upload.php'); if (isset($o_doc) && $first_item_id != 0) { // Search-related section if (api_get_setting('search_enabled')=='true') { @@ -56,7 +56,7 @@ if (isset($_POST['convert'])) { } } } //end of search-related section - header('Location: ../newscorm/lp_controller.php?'.api_get_cidreq().'&lp_id='.$o_doc->lp_id.'&action=view_item&id='.$first_item_id); + header('Location: ../lp/lp_controller.php?'.api_get_cidreq().'&lp_id='.$o_doc->lp_id.'&action=view_item&id='.$first_item_id); } else { if (!empty($o_doc->error)) { $errorMessage = $o_doc->error; @@ -77,7 +77,7 @@ if (!$is_allowed_to_edit) { api_not_allowed(true); } -$interbreadcrumb[]= array ("url"=>"../newscorm/lp_controller.php?action=list", "name"=> get_lang("Doc")); +$interbreadcrumb[]= array ("url"=>"../lp/lp_controller.php?action=list", "name"=> get_lang("Doc")); $nameTools = get_lang("WoogieConversionPowerPoint"); Display :: display_header($nameTools); diff --git a/main/webservices/lp.php b/main/webservices/lp.php index d930227669..c81c978287 100644 --- a/main/webservices/lp.php +++ b/main/webservices/lp.php @@ -295,9 +295,9 @@ function WSGetLpList($params) return return_error(WS_ERROR_SECRET_KEY); } - require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php'; - require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php'; - require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathItem.class.php'; + require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathList.class.php'; + require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpath.class.php'; + require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathItem.class.php'; $courseIdName = $params['course_id_name']; $courseIdValue = $params['course_id_value']; @@ -390,9 +390,9 @@ function WSDeleteLp($params) return return_error(WS_ERROR_SECRET_KEY); } - require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php'; - require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php'; - require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathItem.class.php'; + require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathList.class.php'; + require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpath.class.php'; + require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathItem.class.php'; $courseIdName = $params['course_id_name']; $courseIdValue = $params['course_id_value']; diff --git a/main/webservices/soap.test.php b/main/webservices/soap.test.php index 59d71a99e9..db4f81af18 100755 --- a/main/webservices/soap.test.php +++ b/main/webservices/soap.test.php @@ -8,7 +8,7 @@ * Init */ exit; //remove to enable -// Include the necessary files, assuming this script is located in main/newscorm/ or something like that +// Include the necessary files, assuming this script is located in main/lp/ or something like that require_once '../inc/global.inc.php'; global $_configuration; diff --git a/main/wiki/wiki.inc.php b/main/wiki/wiki.inc.php index 690efa9217..f1a4b90ffb 100755 --- a/main/wiki/wiki.inc.php +++ b/main/wiki/wiki.inc.php @@ -669,31 +669,31 @@ class Wiki 'user_ip' => $_SERVER['REMOTE_ADDR'], 'session_id' => $session_id, ]; - $Id = Database::insert($tbl_wiki, $params); - if ($Id > 0) { + $id = Database::insert($tbl_wiki, $params); + if ($id > 0) { - $sql = "UPDATE $tbl_wiki SET id = iid WHERE iid = $Id"; + $sql = "UPDATE $tbl_wiki SET id = iid WHERE iid = $id"; Database::query($sql); //insert into item_property api_item_property_update( api_get_course_info(), TOOL_WIKI, - $Id, + $id, 'WikiAdded', api_get_user_id(), $groupId ); - $sql = 'UPDATE '.$tbl_wiki.' SET page_id="'.$Id.'" - WHERE c_id = '.$course_id.' AND id = "'.$Id.'"'; + $sql = 'UPDATE '.$tbl_wiki.' SET page_id="'.$id.'" + WHERE c_id = '.$course_id.' AND id = "'.$id.'"'; Database::query($sql); // insert wiki config $params = [ 'c_id' => $course_id, - 'page_id' => $Id, + 'page_id' => $id, 'task' => $_clean['task'], 'feedback1' => $_clean['feedback1'], 'feedback2' => $_clean['feedback2'], @@ -710,7 +710,7 @@ class Wiki Database::insert($tbl_wiki_conf, $params); - $this->setWikiData($Id); + $this->setWikiData($id); self::check_emailcue(0, 'A'); return get_lang('NewWikiSaved'); } @@ -926,7 +926,8 @@ class Wiki if ($row['content']=='' && $row['title']=='' && $page=='index') { if (api_is_allowed_to_edit(false, true) || api_is_platform_admin() || - GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id()) + GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id()) || + api_is_allowed_in_course() ) { //Table structure for better export to pdf $default_table_for_content_Start='
        '; @@ -961,7 +962,8 @@ class Wiki if ($KeyVisibility == "1" || api_is_allowed_to_edit(false, true) || api_is_platform_admin() || - ($row['assignment'] == 2 && $KeyVisibility=="0" && (api_get_user_id() == $row['user_id'])) + ($row['assignment'] == 2 && $KeyVisibility=="0" && (api_get_user_id() == $row['user_id'])) || + api_is_allowed_in_course() ) { $actionsLeft = ''; @@ -973,7 +975,7 @@ class Wiki $actionsLeft .= $editLink; } else { if ((api_is_allowed_in_course() || - GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id())) && $page != 'index' + GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id())) ) { $actionsLeft .= $editLink; } else { @@ -1277,7 +1279,7 @@ class Wiki $result=Database::query($sql); $row=Database::fetch_array($result); $status_editlock = $row['editlock']; - $id = $row['id']; + $id = $row['page_id']; ///change status if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { @@ -1289,7 +1291,7 @@ class Wiki } $sql = 'UPDATE '.$tbl_wiki.' SET editlock="'.Database::escape_string($status_editlock).'" - WHERE c_id = '.$course_id.' AND id="'.$id.'"'; + WHERE c_id = '.$course_id.' AND page_id="'.$id.'"'; Database::query($sql); $sql='SELECT * FROM '.$tbl_wiki.' @@ -1909,7 +1911,7 @@ class Wiki { $_course = $this->courseInfo; $groupId = api_get_group_id(); - $data = self::get_wiki_data($doc_id); + $data = self::getWikiDataFromDb($doc_id); if (empty($data)) { return false; @@ -2027,7 +2029,7 @@ class Wiki } } - $data = self::get_wiki_data($id); + $data = self::getWikiDataFromDb($id); $content_pdf = api_html_entity_decode($data['content'], ENT_QUOTES, api_get_system_encoding()); //clean wiki links @@ -2366,7 +2368,7 @@ class Wiki $obj->title.''; } - $row[] = $obj->user_id != 0 ? UserManager::getUserProfileLink($userinfo) : get_lang('Anonymous').' ('.$obj->user_ip.')'; + $row[] = ($obj->user_id != 0 && $userinfo !== false) ? UserManager::getUserProfileLink($userinfo) : get_lang('Anonymous').' ('.$obj->user_ip.')'; $row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds; if ($all_vers=='1') { @@ -2513,13 +2515,16 @@ class Wiki /** * Get wiki information - * @param int wiki id + * @param int|bool wiki id * @return array wiki data */ - public function get_wiki_data($id) + public function getWikiDataFromDb($id) { $tbl_wiki = $this->tbl_wiki; $course_id = api_get_course_int_id(); + if ($id === false) { + return array(); + } $id = intval($id); $sql = 'SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND id = '.$id.' '; @@ -3281,7 +3286,7 @@ class Wiki $userinfo = api_get_user_info($obj->user_id); $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES); $row = array(); - if ($obj->user_id <> 0) { + if ($obj->user_id != 0 && $userinfo !== false) { $row[] = UserManager::getUserProfileLink($userinfo).' '; @@ -3466,7 +3471,9 @@ class Wiki echo $icon_assignment.'   '.api_htmlentities($row['title']); - echo ' ('.get_lang('MostRecentVersionBy').' '.UserManager::getUserProfileLink($lastuserinfo).' '.$lastversiondate.$countWPost.')'.$avg_WPost_score.' '; //TODO: read average score + if ($lastuserinfo !== false) { + echo ' (' . get_lang('MostRecentVersionBy') . ' ' . UserManager::getUserProfileLink($lastuserinfo) . ' ' . $lastversiondate . $countWPost . ')' . $avg_WPost_score . ' '; //TODO: read average score + } echo ''; @@ -3616,7 +3623,11 @@ class Wiki echo '

        '; echo ''; echo ''; - echo ''; echo ''; @@ -3689,16 +3700,16 @@ class Wiki //get icon task if (!empty($obj->task)) { - $icon_task=Display::return_icon('wiki_task.png', get_lang('StandardTask'),'',ICON_SIZE_SMALL); + $icon_task = Display::return_icon('wiki_task.png', get_lang('StandardTask'), '', ICON_SIZE_SMALL); } else { - $icon_task= Display::return_icon('px_transparent.gif'); + $icon_task = Display::return_icon('px_transparent.gif'); } $row = array(); $row[] = $ShowAssignment.$icon_task; $row[] = ' '.api_htmlentities($obj->title).''; - if ($obj->user_id <>0) { + if ($userinfo !== false) { $row[] = UserManager::getUserProfileLink($userinfo); } else { @@ -3811,7 +3822,7 @@ class Wiki $row[] = ''. api_htmlentities($obj->title).''; $row[] = $obj->version>1 ? get_lang('EditedBy') : get_lang('AddedBy'); - if ($obj->user_id <> 0 ) { + if ($userinfo !== false) { $row[] = UserManager::getUserProfileLink($userinfo); } else { $row[] = get_lang('Anonymous').' ('.api_htmlentities($obj->user_ip).')'; @@ -3922,19 +3933,19 @@ class Wiki $seconds = substr($obj->dtime, 17,2); //get type assignment icon - if ($obj->assignment==1) { - $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL); - } elseif ($obj->assignment==2) { - $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL); - } elseif ($obj->assignment==0) { - $ShowAssignment=Display::return_icon('px_transparent.gif'); + if ($obj->assignment == 1) { + $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL); + } elseif ($obj->assignment == 2) { + $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL); + } elseif ($obj->assignment == 0) { + $ShowAssignment = Display::return_icon('px_transparent.gif'); } $row = array(); $row[] =$ShowAssignment; $row[] = ''. api_htmlentities($obj->title).''; - if ($obj->user_id <>0) { + if ($userinfo !== false) { $row[] = UserManager::getUserProfileLink($userinfo); } else { @@ -4037,11 +4048,12 @@ class Wiki $userId = intval($userId); $userinfo = api_get_user_info($userId); - - echo '
        '.get_lang('UserContributions').': '.UserManager::getUserProfileLink($userinfo). - ' -
        '; + if ($userinfo !== false) { + echo '
        ' . get_lang('UserContributions') . ': ' . UserManager::getUserProfileLink($userinfo) . + '' . + '
        '; + } if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden @@ -4220,7 +4232,8 @@ class Wiki //Only teacher, platform admin and group members can edit a wiki group if (api_is_allowed_to_edit(false,true) || api_is_platform_admin() || - GroupManager :: is_user_in_group($userId, $this->group_id) + GroupManager :: is_user_in_group($userId, $this->group_id) || + api_is_allowed_in_course() ) { $PassEdit = true; } else { @@ -4292,11 +4305,11 @@ class Wiki } /** - * @param string $wikiId + * @param int|bool $wikiId */ public function setWikiData($wikiId) { - $this->wikiData = self::get_wiki_data($wikiId); + $this->wikiData = self::getWikiDataFromDb($wikiId); } /** @@ -4836,8 +4849,9 @@ class Wiki // Only teachers and platform admin can edit the index page. // Only teachers and platform admin can edit an assignment teacher. // And users in groups + if (($row['reflink'] == 'index' || $row['reflink'] == '' || $row['assignment'] == 1) && - (!api_is_allowed_to_edit(false, true) && $groupId == 0) + (!api_is_allowed_to_edit(false, true) && $groupId == 0) && !api_is_allowed_in_course() ) { Display::addFlash( Display::return_message(get_lang('OnlyEditPagesCourseManager')), @@ -4893,7 +4907,7 @@ class Wiki } if ($PassEdit) { - //show editor if edit is allowed + //show editor if edit is allowed <<<<< if ($row['editlock'] == 1 && (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin()==false) ) { @@ -5047,12 +5061,16 @@ class Wiki $rest_time = $max_edit_time - $time_editing; $userinfo = api_get_user_info($row['is_editing']); - $is_being_edited = get_lang('ThisPageisBeginEditedBy').' '.UserManager::getUserProfileLink($userinfo).' - '.get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes').''; + if ($userinfo !== false) { + $is_being_edited = get_lang('ThisPageisBeginEditedBy') . ' ' . UserManager::getUserProfileLink($userinfo) . ' + ' . get_lang('ThisPageisBeginEditedTryLater') . ' ' . date("i", $rest_time) . ' ' . get_lang('MinMinutes') . ''; + } Display::addFlash( Display::return_message( - $is_being_edited + $is_being_edited, + 'normal', + false ) ); @@ -5217,7 +5235,7 @@ class Wiki echo ''; echo ' ('.get_lang('Version').' '.$row['version'].')'; echo ' '.get_lang('By').' '; - if ($row['user_id'] <> 0) { + if ($userinfo !== false) { echo UserManager::getUserProfileLink($userinfo); } else { echo get_lang('Anonymous').' ('.api_htmlentities($row['user_ip']).')'; @@ -5225,9 +5243,13 @@ class Wiki echo ' ( '.get_lang('Progress').': '.api_htmlentities($row['progress']).'%, '; $comment = $row['comment']; if (!empty($comment)) { - echo get_lang('Comments').': '.api_htmlentities(api_substr($row['comment'], 0, 100)); - if (api_strlen($row['comment'])>100) { - echo '... '; + $comment = api_substr($comment, 0, 100); + if ($comment !== false) { + $comment = api_htmlentities($comment); + echo get_lang('Comments').': ' . $comment; + if (api_strlen($row['comment'])>100) { + echo '... '; + } } } else { echo get_lang('Comments').': ---'; @@ -5461,7 +5483,8 @@ class Wiki if (self::checktitle('index')) { if (api_is_allowed_to_edit(false,true) || api_is_platform_admin() || - GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id()) + GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id()) || + api_is_allowed_in_course() ) { self::setMessage(Display::display_normal_message(get_lang('GoAndEditMainPage'), false, true)); } else { @@ -5560,7 +5583,7 @@ class Wiki */ public function exportTo($id, $format = 'doc') { - $data = self::get_wiki_data($id); + $data = self::getWikiDataFromDb($id); if (isset($data['content']) && !empty($data['content'])) { Export::htmlToOdt($data['content'], $data['reflink'], $format); diff --git a/main/work/download.php b/main/work/download.php index 2844bc55c3..55b4e4796d 100755 --- a/main/work/download.php +++ b/main/work/download.php @@ -27,7 +27,6 @@ if (empty($courseInfo)) { } $correction = isset($_REQUEST['correction']) ? true : false; - $result = downloadFile($id, $courseInfo, $correction); if ($result == false) { api_not_allowed(true); diff --git a/main/work/edit.php b/main/work/edit.php index 5906e54d7b..7a8e687edb 100755 --- a/main/work/edit.php +++ b/main/work/edit.php @@ -1,8 +1,6 @@ array('prefix' => array(year'=>2008, 'month'=>10, etc...) - * @param string - * @param string - * @param array - */ -function convert_date_to_array($date, $group) -{ - $parts = explode(' ', $date); - $date_parts = explode('-', $parts[0]); - $date_parts_tmp = array(); - foreach ($date_parts as $item) { - $date_parts_tmp[] = intval($item); - } - - $time_parts = explode(':', $parts[1]); - $time_parts_tmp = array(); - foreach ($time_parts as $item) { - $time_parts_tmp[] = intval($item); - } - list($data[$group]['year'], $data[$group]['month'], $data[$group]['day']) = $date_parts_tmp; - list($data[$group]['hour'], $data[$group]['minute']) = $time_parts_tmp; - return $data; -} - -/** - * get date from a group of date - */ -function get_date_from_group($group) -{ - return - $_POST[$group]['year'].'-'. - two_digits($_POST[$group]['month']).'-'. - two_digits($_POST[$group]['day']).' '. - two_digits($_POST[$group]['hour']).':'. - two_digits($_POST[$group]['minute']).':00'; -} - -/** - * Create a group of select from a date - * @param FormValidator $form - * @param string $prefix - * @return array - */ -function create_group_date_select($form, $prefix = '') -{ - $minute = range(10, 59); - $d_year = date('Y'); - array_unshift($minute, '00', '01', '02', '03', '04', '05', '06', '07', '08', '09'); - - $group_name = array( - $form->createElement('select', $prefix.'day', '', array_combine(range(1, 31), range(1, 31))), - $form->createElement('select', $prefix.'month', '', array_combine(range(1, 12), api_get_months_long())), - $form->createElement('select', $prefix.'year', '', array($d_year => $d_year, $d_year + 1 => $d_year + 1)), - $form->createElement('select', $prefix.'hour', '', array_combine(range(0, 23), range(0, 23))), - $form->createElement('select', $prefix.'minute', '', $minute) - ); - return $group_name; -} - /** * @param string $path * @param int $courseId @@ -331,7 +271,7 @@ function getWorkList($id, $my_folder_data, $add_in_where_query = null) $group_id = api_get_group_id(); $is_allowed_to_edit = api_is_allowed_to_edit(null, true); - $linkInfo = GradebookUtils::is_resource_in_course_gradebook( + $linkInfo = GradebookUtils::isResourceInCourseGradebook( api_get_course_id(), 3, $id, @@ -840,7 +780,7 @@ function deleteDirWork($id) WHERE c_id = $course_id AND publication_id = $id"; Database::query($sql); - $link_info = GradebookUtils::is_resource_in_course_gradebook( + $link_info = GradebookUtils::isResourceInCourseGradebook( api_get_course_id(), 3, $id, @@ -1499,6 +1439,7 @@ function getWorkListTeacher( $where_condition ORDER BY $column $direction LIMIT $start, $limit"; + $result = Database::query($sql); if ($getCount) { @@ -1997,7 +1938,6 @@ function get_work_user_list( $work['qualification_score'] = $work['qualification']; $add_string = ''; - $time_expires = ''; if (!empty($work_assignment['expires_on'])) { $time_expires = api_strtotime( @@ -2085,46 +2025,44 @@ function get_work_user_list( $correction = ' -
        +
        '.get_lang('ClickOrDropOneFileHere').' + '.Display::return_icon('upload_file.png', get_lang('Correction'), [], ICON_SIZE_TINY).'
        - - + + '; - $correction .= " - - "; + }); + "; if ($locked) { if ($qualification_exists) { $action .= Display::return_icon('rate_work_na.png', get_lang('CorrectAndRate'),array(), ICON_SIZE_SMALL); } else { - $action .= Display::return_icon('edit_na.png', get_lang('Comment'),array(), ICON_SIZE_SMALL); + $action .= Display::return_icon('edit_na.png', get_lang('Comment'), array(), ICON_SIZE_SMALL); } } else { if ($qualification_exists) { @@ -2161,22 +2099,22 @@ function get_work_user_list( } } elseif ($is_author && (empty($work['qualificator_id']) || $work['qualificator_id'] == 0)) { $action .= ''. - Display::return_icon('default.png', get_lang('View'),array(), ICON_SIZE_SMALL).''; + Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).''; if (api_get_course_setting('student_delete_own_publication') == 1) { if (api_is_allowed_to_session_edit(false, true)) { $action .= ''. - Display::return_icon('edit.png', get_lang('Comment'),array(), ICON_SIZE_SMALL).''; + Display::return_icon('edit.png', get_lang('Comment'), array(), ICON_SIZE_SMALL).''; } $action .= ' '. Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).''; } else { - $action .= Display::return_icon('edit_na.png', get_lang('Modify'),array(), ICON_SIZE_SMALL); + $action .= Display::return_icon('edit_na.png', get_lang('Modify'), array(), ICON_SIZE_SMALL); } } else { $action .= ''. - Display::return_icon('default.png', get_lang('View'),array(), ICON_SIZE_SMALL).''; - $action .= Display::return_icon('edit_na.png', get_lang('Modify'),array(), ICON_SIZE_SMALL); + Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).''; + $action .= Display::return_icon('edit_na.png', get_lang('Modify'), array(), ICON_SIZE_SMALL); } // Status. @@ -2318,77 +2256,6 @@ function is_work_exist_by_url($url) } } -/** - * @param $name - * @param $values - * @param string $checked - * @return string - */ -function make_select($name, $values, $checked = '') -{ - $output = ''; - return $output; -} - -/** - * @param $name - * @param string $checked - * @param null $label - * @return string - */ -function make_checkbox($name, $checked = '', $label = null) -{ - $check = ''; - if (!empty($label)) { - $check .=""; - } - return $check; -} - -/** - * @param $prefix - * @param string $default - * @return string - */ -function draw_date_picker($prefix, $default = '') -{ - if (empty($default)) { - $default = api_get_local_time(); - } - $parts = explode(' ', $default); - list($d_year, $d_month, $d_day) = explode('-', $parts[0]); - list($d_hour, $d_minute) = explode(':', $parts[1]); - - $minute = range(10, 59); - array_unshift($minute, '00', '01', '02', '03', '04', '05', '06', '07', '08', '09'); - $date_form = make_select($prefix.'_day', array_combine(range(1, 31), range(1, 31)), $d_day); - $date_form .= make_select($prefix.'_month', array_combine(range(1, 12), api_get_months_long()), $d_month); - $date_form .= make_select($prefix.'_year', array($d_year => $d_year, $d_year + 1 => $d_year + 1), $d_year).'    '; - $date_form .= make_select($prefix.'_hour', array_combine(range(0, 23), range(0, 23)), $d_hour).' : '; - $date_form .= make_select($prefix.'_minute', $minute, $d_minute); - return $date_form; -} - -/** - * @param string $prefix - * @param array of values - * @return string - * - */ -function get_date_from_select($prefix, $array = array()) -{ - return - $array[$prefix]['year'].'-'. - two_digits($array[$prefix]['month']).'-'. - two_digits($array[$prefix]['day']).' '. - two_digits($array[$prefix]['hour']).':'. - two_digits($array[$prefix]['minute']).':00'; -} - /** * Check if a user is the author of a work document. * @param int $itemId @@ -3105,12 +2972,7 @@ function getLastWorkStudentFromParent( $result = Database::query($sql); if (Database::num_rows($result)) { $comment = Database::fetch_array($result, 'ASSOC'); - /*if (!empty($comment)) { - $comment['assignment'] = get_work_assignment_by_id( - $comment['id'], - $courseInfo['real_id'] - ); - }*/ + return $comment; } @@ -3157,12 +3019,7 @@ function getLastWorkStudentFromParentByUser( $result = Database::query($sql); if (Database::num_rows($result)) { $work = Database::fetch_array($result, 'ASSOC'); - /*if (!empty($comment)) { - $comment['assignment'] = get_work_assignment_by_id( - $comment['id'], - $courseInfo['real_id'] - ); - }*/ + return $work; } @@ -3312,9 +3169,7 @@ function addWorkComment($courseInfo, $userId, $parentWork, $work, $data) $workParent = get_work_data_by_id($work['parent_id']); if (!empty($workParent)) { $uploadDir = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/work'.$workParent['url']; - $newFileName = 'comment_'.$commentId.'_'.php2phps( - api_replace_dangerous_char($fileData['name']) - ); + $newFileName = 'comment_'.$commentId.'_'.php2phps(api_replace_dangerous_char($fileData['name'])); $newFilePath = $uploadDir.'/'.$newFileName; $result = move_uploaded_file($fileData['tmp_name'], $newFilePath); if ($result) { @@ -3371,8 +3226,8 @@ function getWorkDateValidationStatus($homework) $time_now = time(); if (!empty($homework['expires_on'])) { - $time_expires = api_strtotime($homework['expires_on'], 'UTC'); - $difference = $time_expires - $time_now; + $time_expires = api_strtotime($homework['expires_on'], 'UTC'); + $difference = $time_expires - $time_now; if ($difference < 0) { $has_expired = true; } @@ -3490,7 +3345,7 @@ function uploadWork($my_folder_data, $_course, $isCorrection = false, $workInfo 'error' => Display:: return_message( get_lang('UplUnableToSaveFileFilteredExtension'), 'error' - ), + ) ); } @@ -4013,7 +3868,7 @@ function updatePublicationAssignment($workId, $params, $courseInfo, $groupId) if (!empty($params['category_id'])) { - $link_info = GradebookUtils::is_resource_in_course_gradebook( + $link_info = GradebookUtils::isResourceInCourseGradebook( $courseInfo['code'], LINK_STUDENTPUBLICATION, $workId, @@ -4586,6 +4441,7 @@ function getWorkUserListData( ); } } + return $results; } @@ -4769,13 +4625,11 @@ function exportAllWork($userId, $courseInfo, $format = 'pdf') foreach ($workPerUser as $work) { $work = $work['work']; foreach ($work->user_results as $userResult) { - //var_dump($userResult);exit; $content .= $userResult['title']; // No need to use api_get_local_time() $content .= $userResult['sent_date']; $content .= $userResult['qualification']; $content .= $userResult['description']; - //$content .= getWorkComments($userResult); } } diff --git a/main/work/work.php b/main/work/work.php index 14683d2b18..222aeb6ac5 100755 --- a/main/work/work.php +++ b/main/work/work.php @@ -1,12 +1,12 @@ '. Display::return_icon('exercice_uncheck.png', get_lang('ViewUsersWithoutTask'), '', ICON_SIZE_MEDIUM).""; - + $actionsLeft .= ''; $actionsLeft .= Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM).''; - + $count = get_count_work($workId); if ($count > 0) { $display_output .= ''. Display::return_icon('save_pack.png', get_lang('LowerPackageTasks'), null, ICON_SIZE_MEDIUM).' '.get_lang('LowerPackageTasks').''; } $actionsLeft .= $display_output; - - - $url = api_get_path(WEB_CODE_PATH).'work/upload_corrections.php?'.api_get_cidreq().'&id='.$workId; - $actionsLeft .= ''.Display::return_icon('upload_package.png', get_lang('UpPackageFixes'), '', ICON_SIZE_MEDIUM) . ' ' . get_lang('UpPackageFixes') . ''; - - //$actionsLeft .= Display::toolbarButton(get_lang('UploadCorrections'), $url, 'upload', 'success'); + $actionsLeft .= ''. + Display::return_icon('upload_package.png', get_lang('UpPackageFixes'), '', ICON_SIZE_MEDIUM) . ' ' . get_lang('UpPackageFixes') . ''; } echo Display::toolbarAction('toolbar-worklist', array($actionsLeft), 1); diff --git a/main/work/work_list_others.php b/main/work/work_list_others.php index 025957a892..2f9c244423 100755 --- a/main/work/work_list_others.php +++ b/main/work/work_list_others.php @@ -2,6 +2,7 @@ /* For licensing terms, see /license.txt */ require_once '../inc/global.inc.php'; + $current_course_tool = TOOL_STUDENTPUBLICATION; api_protect_course_script(true); @@ -36,7 +37,7 @@ protectWork($courseInfo, $workId); $htmlHeadXtra[] = api_get_jqgrid_js(); if (!empty($group_id)) { - $group_properties = GroupManager :: get_group_properties($group_id); + $group_properties = GroupManager :: get_group_properties($group_id); $show_work = false; if (api_is_allowed_to_edit(false, true)) { @@ -99,27 +100,100 @@ if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) get_lang('Actions') ); $column_model = array( - array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'), - array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), - array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), - array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'), - array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'), - array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'), - array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'), - array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false') + array( + 'name' => 'type', + 'index' => 'file', + 'width' => '12', + 'align' => 'left', + 'search' => 'false', + 'sortable' => 'false', + ), + array('name' => 'firstname', 'index' => 'firstname', 'width' => '35', 'align' => 'left', 'search' => 'true'), + array('name' => 'lastname', 'index' => 'lastname', 'width' => '35', 'align' => 'left', 'search' => 'true'), + array( + 'name' => 'title', + 'index' => 'title', + 'width' => '40', + 'align' => 'left', + 'search' => 'false', + 'wrap_cell' => 'true', + ), + array( + 'name' => 'qualification', + 'index' => 'qualification', + 'width' => '20', + 'align' => 'left', + 'search' => 'true', + ), + array( + 'name' => 'sent_date', + 'index' => 'sent_date', + 'width' => '50', + 'align' => 'left', + 'search' => 'true', + 'wrap_cell' => 'true', + ), + array( + 'name' => 'qualificator_id', + 'index' => 'qualificator_id', + 'width' => '30', + 'align' => 'left', + 'search' => 'true', + ), + array( + 'name' => 'actions', + 'index' => 'actions', + 'width' => '40', + 'align' => 'left', + 'search' => 'false', + 'sortable' => 'false', + ), ); } else { $type = 'complex'; - $columns = array( - get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('Title'), get_lang('Date'), get_lang('Actions') + $columns = array( + get_lang('Type'), + get_lang('FirstName'), + get_lang('LastName'), + get_lang('Title'), + get_lang('Date'), + get_lang('Actions'), ); $column_model = array( - array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'), - array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), - array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), - array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"), - array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'), - array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false') + array( + 'name' => 'type', + 'index' => 'file', + 'width' => '12', + 'align' => 'left', + 'search' => 'false', + 'sortable' => 'false', + ), + array('name' => 'firstname', 'index' => 'firstname', 'width' => '35', 'align' => 'left', 'search' => 'true'), + array('name' => 'lastname', 'index' => 'lastname', 'width' => '35', 'align' => 'left', 'search' => 'true'), + array( + 'name' => 'title', + 'index' => 'title', + 'width' => '40', + 'align' => 'left', + 'search' => 'false', + 'wrap_cell' => "true", + ), + array( + 'name' => 'sent_date', + 'index' => 'sent_date', + 'width' => '50', + 'align' => 'left', + 'search' => 'true', + 'wrap_cell' => 'true', + ), + array( + 'name' => 'actions', + 'index' => 'actions', + 'width' => '40', + 'align' => 'left', + 'search' => 'false', + 'sortable' => 'false', + ), ); } @@ -129,13 +203,13 @@ $extra_params['height'] = 'auto'; $extra_params['sortname'] = 'firstname'; $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list_others&work_id='.$workId.'&type='.$type; ?> - + groupSupport = isset($columns['group_id']) ? true : false; if ($this->groupSupport) { + // Plugin check $this->groupSupport = (bool) $plugin->get('enable_conference_in_course_groups'); if ($this->groupSupport) { - $courseInfo = api_get_course_info(); - if ($courseInfo) { - $this->groupSupport = api_get_course_setting('bbb_enable_conference_in_groups') === '1'; + + // Platform check + $bbbSetting = api_get_setting('bbb_enable_conference_in_course_groups'); + $bbbSetting = isset($bbbSetting['bbb']) ? $bbbSetting['bbb'] === 'true' : false; + + if ($bbbSetting) { + // Course check + $courseInfo = api_get_course_info(); + + if ($courseInfo) { + $this->groupSupport = api_get_course_setting('bbb_enable_conference_in_groups') === '1'; + } } } } @@ -152,7 +162,7 @@ class bbb # a user joins. If after this period, a user hasn't joined, the meeting is # removed from memory. defaultMeetingCreateJoinDuration=5 - * + * * @return mixed */ public function createMeeting($params) @@ -165,8 +175,9 @@ class bbb $params['group_id'] = api_get_group_id(); } + $courseCode = is_null($courseCode) ? '' : $courseCode; $params['attendee_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $courseCode; - $attendeePassword = $params['attendee_pw']; + $attendeePassword = $params['attendee_pw']; $params['moderator_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $this->getModMeetingPassword(); $moderatorPassword = $params['moderator_pw']; diff --git a/plugin/bbb/lib/bbb_plugin.class.php b/plugin/bbb/lib/bbb_plugin.class.php index dc83bf43f9..5adc9cb01d 100755 --- a/plugin/bbb/lib/bbb_plugin.class.php +++ b/plugin/bbb/lib/bbb_plugin.class.php @@ -42,6 +42,7 @@ class BBBPlugin extends Plugin 'salt' => 'text', 'enable_global_conference' => 'boolean', 'enable_conference_in_course_groups' => 'boolean', + 'enable_global_conference_link' => 'boolean' ] ); } @@ -52,7 +53,7 @@ class BBBPlugin extends Plugin */ public function validateCourseSetting($variable) { - if ($variable == 'bbb_enable_conference_in_groups') { + if ($variable === 'bbb_enable_conference_in_groups') { if ($this->get('enable_conference_in_course_groups') === 'true') { return true; @@ -117,6 +118,7 @@ class BBBPlugin extends Plugin 'bbb_host', 'bbb_tool_enable', 'enable_global_conference', + 'enable_global_conference_link', 'enable_conference_in_course_groups', 'bbb_plugin', 'bbb_plugin_host', diff --git a/plugin/buycourses/lang/french.php b/plugin/buycourses/lang/french.php index 74fda25424..227c189fde 100644 --- a/plugin/buycourses/lang/french.php +++ b/plugin/buycourses/lang/french.php @@ -8,7 +8,7 @@ $strings['paypal_enable'] = "Activer PayPal"; $strings['commissions_enable'] = "Activer commissions"; $strings['transfer_enable'] = "Activer les transferts bancaires"; $strings['unregistered_users_enable'] = "Permettre l'accès aux utilisateurs non enregistrés sur la plateforme"; -$strings['Free'] = "GRAIUIT"; +$strings['Free'] = "GRATUIT"; $strings['PaypalPayoutCommissions'] = "Commissions PayPal Payouts"; $strings['MyPayouts'] = "Mes paiements"; diff --git a/plugin/date/start.php b/plugin/date/start.php new file mode 100755 index 0000000000..92280c7cc7 --- /dev/null +++ b/plugin/date/start.php @@ -0,0 +1,9 @@ + - * @package chamilo.plugin.skype - */ - -require_once api_get_path(SYS_PATH) . 'main/inc/global.inc.php'; diff --git a/plugin/skype/index.php b/plugin/skype/index.php deleted file mode 100644 index a9c71a002f..0000000000 --- a/plugin/skype/index.php +++ /dev/null @@ -1,8 +0,0 @@ - - * @package chamilo.plugin.skype - */ -require_once __DIR__ . '/config.php'; diff --git a/plugin/skype/install.php b/plugin/skype/install.php deleted file mode 100644 index 23be3530f3..0000000000 --- a/plugin/skype/install.php +++ /dev/null @@ -1,10 +0,0 @@ - - * @package chamilo.plugin.skype - */ -require_once __DIR__ . '/config.php'; - -Skype::create()->install(); diff --git a/plugin/skype/lang/english.php b/plugin/skype/lang/english.php deleted file mode 100644 index 0af54a0d32..0000000000 --- a/plugin/skype/lang/english.php +++ /dev/null @@ -1,9 +0,0 @@ - - * @package chamilo.plugin.skype - */ -$strings['plugin_title'] = 'Skype'; -$strings['plugin_comment'] = 'This plugin creates a Skype user field.'; diff --git a/plugin/skype/lang/spanish.php b/plugin/skype/lang/spanish.php deleted file mode 100644 index 01bfdc4407..0000000000 --- a/plugin/skype/lang/spanish.php +++ /dev/null @@ -1,9 +0,0 @@ - - * @package chamilo.plugin.skype - */ -$strings['plugin_title'] = 'Skype'; -$strings['plugin_comment'] = 'Este plugin crea un campo de usuario Skype.'; diff --git a/plugin/skype/plugin.php b/plugin/skype/plugin.php deleted file mode 100644 index 687ba24e1f..0000000000 --- a/plugin/skype/plugin.php +++ /dev/null @@ -1,10 +0,0 @@ - - * @package chamilo.plugin.skype - */ -require_once __DIR__.'/config.php'; - -$plugin_info = Skype::create()->get_info(); diff --git a/plugin/skype/src/HookSkype.php b/plugin/skype/src/HookSkype.php deleted file mode 100644 index f5e9c7b54c..0000000000 --- a/plugin/skype/src/HookSkype.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @package chamilo.plugin.skype - */ -class HookObserverSkype extends HookObserver implements HookSkypeObserverInterface -{ - - /** - * Class constructor - */ - public function __construct() - { - parent::__construct( - 'plugin/skype/src/Skype.php', 'skype' - ); - } - - /** - * Create Skype user field when plugin is enabled - * @param HookSkypeEventInterface $hook The hook - */ - public function hookEventSkype(HookSkypeEventInterface $hook) - { - $data = $hook->getEventData(); - if ($data['type'] === HOOK_EVENT_TYPE_PRE) { - // Code - } - } -} diff --git a/plugin/skype/src/Skype.php b/plugin/skype/src/Skype.php deleted file mode 100644 index a96d7235ec..0000000000 --- a/plugin/skype/src/Skype.php +++ /dev/null @@ -1,91 +0,0 @@ - - * @package chamilo.plugin.skype - */ -class Skype extends Plugin implements HookPluginInterface -{ - - /** - * Class constructor - */ - protected function __construct() - { - parent::__construct('0.1', 'Imanol Losada Oriol'); - } - - /** - * Instance the plugin - * @staticvar null $result - * @return Skype - */ - static function create() - { - static $result = null; - - return $result ? $result : $result = new self(); - } - - /** - * Install the plugin - */ - public function install() - { - $this->installHook(); - - $result = Database::select( - 'variable', - Database::get_main_table(TABLE_EXTRA_FIELD), - array( - 'where'=> array( - 'variable = ?' => array( - 'skype' - ) - ) - ) - ); - - if (empty($result)) { - $extraField = new ExtraField('user'); - $extraField->save(array( - 'field_type' => ExtraField::FIELD_TYPE_TEXT, - 'variable' => 'skype', - 'display_text' => 'Skype', - 'visible' => 1, - 'changeable' => 1 - )); - } - } - - /** - * Uninstall the plugin - * @return void - */ - public function uninstall() - { - $this->uninstallHook(); - } - - /** - * Install the Skype hook - */ - public function installHook() - { - $hook = HookObserverSkype::create(); - HookEventSkype::create()->attach($hook); - } - - /** - * Uninstall the Skype hook - */ - public function uninstallHook() - { - $hook = HookObserverSkype::create(); - HookEventSkype::create()->detach($hook); - } - -} diff --git a/plugin/skype/uninstall.php b/plugin/skype/uninstall.php deleted file mode 100644 index 7ca4b44a8e..0000000000 --- a/plugin/skype/uninstall.php +++ /dev/null @@ -1,10 +0,0 @@ - - * @package chamilo.plugin.skype - */ -require_once __DIR__ . '/config.php'; - -Skype::create()->uninstall(); diff --git a/robots.txt b/robots.txt index 3d25b9bd2d..c9cf39d625 100755 --- a/robots.txt +++ b/robots.txt @@ -29,6 +29,5 @@ Disallow: /tests/ # Files Disallow: /license.txt Disallow: /README.txt -Disallow: /webchatdeny.php Disallow: /whoisonline.php Disallow: /whoisonlinesession.php diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php index 4ecddc9b4d..04865fab02 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php @@ -64,7 +64,7 @@ class CkEditor extends Editor } $style = ''; } - + $html = ''; diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php index 30e45c8e69..197069af89 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php @@ -10,9 +10,7 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; */ class AgendaStudent extends Basic { - - public $plugins = array( - ); + public $plugins = array(); /** * Get the toolbar config @@ -116,5 +114,4 @@ class AgendaStudent extends Basic ['Toolbarswitch'] ]; } - } diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Announcements.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Announcements.php index fe5cf4212a..c2d623147f 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Announcements.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Announcements.php @@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; */ class Announcements extends Basic { - /** * Get the toolbar config * @return array @@ -75,5 +74,4 @@ class Announcements extends Basic ['Toolbarswitch'] ]; } - } diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AssessmentsIntroduction.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AssessmentsIntroduction.php index 077f6dfa72..077163665d 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AssessmentsIntroduction.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AssessmentsIntroduction.php @@ -5,7 +5,7 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; /** * AssessmentsIntroduction toolbar configuration - * + * * @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar */ class AssessmentsIntroduction extends Basic @@ -61,5 +61,4 @@ class AssessmentsIntroduction extends Basic ['Toolbarswitch'] ]; } - } diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php index fe5f10152b..a6b58f2ef6 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php @@ -10,7 +10,7 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; */ class Documents extends Basic { - public $plugins = array(); + public $plugins = []; /** * Get the toolbar config @@ -19,7 +19,8 @@ class Documents extends Basic public function getConfig() { $config = array(); - if (api_get_setting('more_buttons_maximized_mode') != 'true') { + + if (api_get_setting('more_buttons_maximized_mode') !== 'true') { $config['toolbar'] = $this->getNormalToolbar(); } else { $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); @@ -38,7 +39,7 @@ class Documents extends Basic { $plugins = array(); - if (api_get_setting('show_glossary_in_documents') == 'ismanual') { + if (api_get_setting('show_glossary_in_documents') === 'ismanual') { $plugins[] = 'glossary'; } @@ -75,14 +76,14 @@ class Documents extends Basic 'NumberedList', 'BulletedList', '-', - api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : '', + api_get_setting('allow_spellcheck') === 'true' ? 'Scayt' : '', 'Source' ], '/', ['Styles', 'Format', 'Font', 'FontSize'], ['Bold', 'Italic', 'Underline'], ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], - api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''] + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''] ]; } @@ -119,7 +120,7 @@ class Documents extends Basic 'BGColor', 'Source', ], - api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''], ['Toolbarswitch'] ]; } diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathDocuments.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathDocuments.php index 05f17813f7..65ea34c105 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathDocuments.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathDocuments.php @@ -5,19 +5,18 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; /** * LearningPathDocuments toolbar configuration - * + * * @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar */ class LearningPathDocuments extends Basic { - /** * Get the toolbar config * @return array */ public function getConfig() { - if (api_get_setting('more_buttons_maximized_mode') != 'true') { + if (api_get_setting('more_buttons_maximized_mode') !== 'true') { $config['toolbar'] = $this->getNormalToolbar(); } else { $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); @@ -59,7 +58,7 @@ class LearningPathDocuments extends Basic ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], - [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + [api_get_setting('allow_spellcheck') === 'true' ? 'Scayt' : ''], ['Styles', 'Format', 'Font', 'FontSize'], ['PageBreak', 'ShowBlocks', 'Source'], ['Toolbarswitch'] @@ -118,9 +117,7 @@ class LearningPathDocuments extends Basic ['BulletedList', 'NumberedList', 'HorizontalRule'], ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], ['Toolbarswitch'], - ['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'], - + ['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'] ]; } - } diff --git a/src/Chamilo/CoreBundle/Component/Editor/Editor.php b/src/Chamilo/CoreBundle/Component/Editor/Editor.php index 41f17f1ce5..2d3e469bef 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/Editor.php +++ b/src/Chamilo/CoreBundle/Component/Editor/Editor.php @@ -137,7 +137,7 @@ class Editor array('\r', '\n', '\x3c', '\x3e', '\x26'), addslashes($var) ).'"'; - case 'array': + case 'array': // Arrays in JSON can't be associative. If the array is empty or if it // has sequential whole number keys starting with 0, it's not associative // so we can go ahead and convert it as an array. @@ -155,7 +155,6 @@ class Editor foreach ($var as $k => $v) { $output[] = $this->toJavascript(strval($k)).': '.$this->toJavascript($v); } - return '{ '.implode(', ', $output).' }'; default: return 'null'; diff --git a/src/Chamilo/CoreBundle/Entity/ExtraField.php b/src/Chamilo/CoreBundle/Entity/ExtraField.php index 8a8d0e3334..bdf9949495 100644 --- a/src/Chamilo/CoreBundle/Entity/ExtraField.php +++ b/src/Chamilo/CoreBundle/Entity/ExtraField.php @@ -181,10 +181,15 @@ class ExtraField extends BaseAttribute } /** + * @param bool $translated Optional. Whether translate the display text * @return string */ - public function getDisplayText() + public function getDisplayText($translated = true) { + if ($translated) { + return \ExtraField::translateDisplayName($this->variable, $this->displayText); + } + return $this->displayText; } @@ -316,5 +321,4 @@ class ExtraField extends BaseAttribute return 'text'; } } - } diff --git a/src/Chamilo/CoreBundle/Entity/ExtraFieldOptions.php b/src/Chamilo/CoreBundle/Entity/ExtraFieldOptions.php index 3e8fddfe9e..774098b72f 100644 --- a/src/Chamilo/CoreBundle/Entity/ExtraFieldOptions.php +++ b/src/Chamilo/CoreBundle/Entity/ExtraFieldOptions.php @@ -9,7 +9,7 @@ use Gedmo\Mapping\Annotation as Gedmo; /** * Class ExtraField * - * @ORM\Entity + * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Entity\Repository\ExtraFieldOptionsRepository") * @ORM\Table(name="extra_field_options") * * @ORM\MappedSuperclass @@ -135,10 +135,15 @@ class ExtraFieldOptions } /** + * @param bool $translated Optional. Whether translate the display text * @return string */ - public function getDisplayText() + public function getDisplayText($translated = true) { + if ($translated) { + return \ExtraFieldOption::translateDisplayName($this->displayText); + } + return $this->displayText; } @@ -165,7 +170,7 @@ class ExtraFieldOptions /** * @param string $priority * - * @return ExtraFieldOptions + * @return $this */ public function setPriority($priority) { @@ -185,7 +190,7 @@ class ExtraFieldOptions /** * @param string $priorityMessage * - * @return ExtraFieldOptions + * @return $this */ public function setPriorityMessage($priorityMessage) { diff --git a/src/Chamilo/CoreBundle/Entity/Language.php b/src/Chamilo/CoreBundle/Entity/Language.php index ca723d0613..d80aabeab6 100644 --- a/src/Chamilo/CoreBundle/Entity/Language.php +++ b/src/Chamilo/CoreBundle/Entity/Language.php @@ -10,7 +10,7 @@ use Doctrine\Common\Collections\ArrayCollection; * Language * * @ORM\Table(name="language", indexes={@ORM\Index(name="idx_language_dokeos_folder", columns={"dokeos_folder"})}) - * @ORM\Entity + * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Entity\Repository\LanguageRepository") */ class Language { diff --git a/src/Chamilo/CoreBundle/Entity/Repository/ExtraFieldOptionsRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/ExtraFieldOptionsRepository.php new file mode 100644 index 0000000000..9de6e86167 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/ExtraFieldOptionsRepository.php @@ -0,0 +1,36 @@ +createQueryBuilder('so'); + $qb + ->where( + $qb->expr()->eq('so.field', $option->getField()->getId()) + ) + ->andWhere( + $qb->expr()->eq('so.value', $option->getId()) + ) + ->orderBy('so.displayText', 'ASC'); + + return $qb + ->getQuery() + ->getResult(); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/LanguageRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/LanguageRepository.php new file mode 100644 index 0000000000..e05a6bebf6 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/LanguageRepository.php @@ -0,0 +1,28 @@ +createQueryBuilder('l'); + $qb->select('l') + ->where( + $qb->expr()->eq('l.available', true) + ) + ->andWhere( + $qb->expr()->isNotNull('l.parent') + ); + + return $qb->getQuery()->getResult(); + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseBuilder.php b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseBuilder.php index cc026c4d9a..392e32885d 100644 --- a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseBuilder.php +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseBuilder.php @@ -1213,9 +1213,9 @@ class CourseBuilder if ($db_result) { while ($obj = Database::fetch_object($db_result)) { $items = array(); - $sql_items = "SELECT * FROM ".$table_item." - WHERE c_id = '$courseId' AND lp_id = ".$obj->id; - $db_items = Database::query($sql_items); + $sql = "SELECT * FROM ".$table_item." + WHERE c_id = '$courseId' AND lp_id = ".$obj->id; + $db_items = Database::query($sql); while ($obj_item = Database::fetch_object($db_items)) { $item['id'] = $obj_item->id; $item['item_type'] = $obj_item->item_type; @@ -1237,12 +1237,12 @@ class CourseBuilder $items[] = $item; } - $sql_tool = "SELECT id FROM $table_tool - WHERE + $sql = "SELECT id FROM $table_tool + WHERE c_id = $courseId AND (link LIKE '%lp_controller.php%lp_id=".$obj->id."%' AND image='scormbuilder.gif') AND visibility = '1' "; - $db_tool = Database::query($sql_tool); + $db_tool = Database::query($sql); if (Database::num_rows($db_tool)) { $visibility = '1'; diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRecycler.php b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRecycler.php index 2739052168..a15acdf27a 100644 --- a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRecycler.php +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRecycler.php @@ -35,15 +35,16 @@ class CourseRecycler * Delete all items from the course. * This deletes all items in the course-object from the current Chamilo- * course - * @param string $type 'full_backup' or 'select_items' + * @param string $backupType 'full_backup' or 'select_items' * * @return bool * * @assert (null) === false */ - public function recycle($type) + public function recycle($backupType) { - if (empty($type)) { + if (empty($backupType)) { + return false; } @@ -51,7 +52,7 @@ class CourseRecycler $table_linked_resources = Database::get_course_table(TABLE_LINKED_RESOURCES); $table_item_properties = Database::get_course_table(TABLE_ITEM_PROPERTY); - $this->type = $type; + $this->type = $backupType; $this->recycle_links(); $this->recycle_link_categories(); $this->recycle_events(); @@ -99,7 +100,7 @@ class CourseRecycler $table = Database :: get_course_table(TABLE_DOCUMENT); $tableItemProperty = Database :: get_course_table(TABLE_ITEM_PROPERTY); - if ($this->type == 'full_backup') { + if ($this->type === 'full_backup') { $sql = "DELETE FROM $tableItemProperty WHERE c_id = ".$this->course_id." AND @@ -431,11 +432,13 @@ class CourseRecycler // Identifying again and deletion of the orphan questions, if it was desired. if ($delete_orphan_questions) { - + // If this query was ever too slow, there is an alternative here: + // https://github.com/beeznest/chamilo-lms-icpna/commit/a38eab725402188dffff50245ee068d79bcef779 $sql = " ( SELECT q.id, ex.c_id FROM $table_qui_que q INNER JOIN $table_rel r ON (q.c_id = r.c_id AND q.id = r.question_id) + INNER JOIN $table_qui ex ON (ex.id = r.exercice_id AND ex.c_id = r.c_id) WHERE ex.c_id = ".$this->course_id." AND (ex.active = '-1' OR ex.id = '-1') @@ -633,13 +636,12 @@ class CourseRecycler $resources = $this->course->resources; foreach ($resources[RESOURCE_THEMATIC] as $last_id => $thematic) { if (is_numeric($last_id)) { - foreach($thematic->thematic_advance_list as $thematic_advance) { $cond = array( 'id = ? AND c_id = ?' => array( $thematic_advance['id'], - $this->course_id, - ), + $this->course_id + ) ); api_item_property_update( $this->course_info, diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php index 4e2a7d7390..9d5b2221ac 100644 --- a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php @@ -300,7 +300,6 @@ class CourseRestorer $path = api_get_path(SYS_COURSE_PATH).$this->course->destination_path.'/'; foreach ($resources[RESOURCE_DOCUMENT] as $id => $document) { - if (empty($document->item_properties[0]['id_session'])) { $my_session_id = 0; } else { @@ -1035,7 +1034,6 @@ class CourseRestorer $params['c_id'] = $this->destination_course_id; $params['forum_category'] = $cat_id; $params['session_id'] = $sessionId; - $params['start_time'] = isset($params['start_time']) && $params['start_time'] === '0000-00-00 00:00:00' ? null : $params['start_time']; $params['end_time'] = isset($params['end_time']) && $params['end_time'] === '0000-00-00 00:00:00' ? null : $params['end_time']; $params['forum_id'] = 0; @@ -1099,15 +1097,6 @@ class CourseRestorer } } if ($forum_cat && !$forum_cat->is_restored()) { - /*$title = $forum_cat->obj->cat_title; - if (!empty($title)) { - if (!preg_match('/.*\((.+)\)$/', $title, $matches)) { - // This is for avoiding repetitive adding of training code after several backup/restore cycles. - if ($matches[1] != $this->course->code) { - $title = $title.' ('.$this->course->code.')'; - } - } - }*/ $params = (array) $forum_cat->obj; $params['c_id'] = $this->destination_course_id; $params['cat_comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_course( @@ -1644,13 +1633,6 @@ class CourseRestorer if ($copy_result) { $table_attachment = Database :: get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT); - /*$sql = "INSERT INTO ".$table_attachment." SET - c_id = ".$this->destination_course_id." , - path = '".self::DBUTF8escapestring($new_filename)."', - comment = '".self::DBUTF8escapestring($announcement->attachment_comment)."', - size = '".$announcement->attachment_size."', filename = '".$announcement->attachment_filename."', - announcement_id = '".$new_announcement_id."' "; - Database::query($sql);*/ $params = [ 'c_id' => $this->destination_course_id, @@ -1925,8 +1907,6 @@ class CourseRestorer $this->course->info['path'] ); - // id = '". ($index + 1)."', - $params = [ 'c_id' => $this->destination_course_id, 'question_id' => $new_id, @@ -2329,8 +2309,7 @@ class CourseRestorer { $resources = $this->course->resources; $question = $resources[RESOURCE_SURVEYQUESTION][$id]; - - $new_id=0; + $new_id = 0; if (is_object($question)) { if ($question->is_restored()) { @@ -2512,7 +2491,7 @@ class CourseRestorer $params = [ 'c_id' => $this->destination_course_id, 'name' => self::DBUTF8($lp->name), - 'link' => 'newscorm/lp_controller.php?action=view&lp_id=$new_lp_id&id_session='.$session_id, + 'link' => 'lp/lp_controller.php?action=view&lp_id=$new_lp_id&id_session='.$session_id, 'image' => 'scormbuilder.gif', 'visibility' => '0', 'admin' => '0', diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseSelectForm.php b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseSelectForm.php index 2ee490d8f5..8d8dd32ca9 100644 --- a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseSelectForm.php +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseSelectForm.php @@ -19,8 +19,9 @@ class CourseSelectForm { /** * Display the form + * @param array $course * @param array $hidden_fields Hidden fields to add to the form. - * @param boolean the document array will be serialize. This is used in the course_copy.php file + * @param boolean $avoid_serialize the document array will be serialize. This is used in the course_copy.php file */ public static function display_form($course, $hidden_fields = null, $avoid_serialize = false) { @@ -48,14 +49,11 @@ class CourseSelectForm '; echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle; @@ -204,14 +197,13 @@ class CourseSelectForm $element_count++; break; case RESOURCE_LINKCATEGORY: - case RESOURCE_FORUMPOST: - case RESOURCE_QUIZQUESTION: - case RESOURCE_SURVEYQUESTION: - case RESOURCE_SURVEYINVITATION: - case RESOURCE_SCORM: - break; - default : - //echo ' '; + case RESOURCE_FORUMPOST: + case RESOURCE_QUIZQUESTION: + case RESOURCE_SURVEYQUESTION: + case RESOURCE_SURVEYINVITATION: + case RESOURCE_SCORM: + break; + default: echo '  '; echo ''.$resource_titles[$type].'
        '; echo '
        '; @@ -256,8 +248,6 @@ class CourseSelectForm //Fixes forum order if (!empty($forum_categories)) { $type = RESOURCE_FORUMCATEGORY; - - //echo ' '; echo '  '; echo ''.$resource_titles[RESOURCE_FORUM].'
        '; echo '
        '; @@ -351,7 +341,7 @@ class CourseSelectForm /** * @param $course */ - static function display_hidden_quiz_questions($course) + public static function display_hidden_quiz_questions($course) { if(is_array($course->resources)){ foreach ($course->resources as $type => $resources) { @@ -371,7 +361,7 @@ class CourseSelectForm /** * @param $course */ - static function display_hidden_scorm_directories($course) + public static function display_hidden_scorm_directories($course) { if (is_array($course->resources)){ foreach ($course->resources as $type => $resources) { @@ -584,8 +574,9 @@ class CourseSelectForm /** * Display the form session export + * @param array $list_course * @param array $hidden_fields Hidden fields to add to the form. - * @param boolean the document array will be serialize. This is used in the course_copy.php file + * @param boolean $avoid_serialize the document array will be serialize. This is used in the course_copy.php file */ public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false) { @@ -593,14 +584,12 @@ class CourseSelectForm
        '.$author_photo.''.UserManager::getUserProfileLink($userinfo).' ('.$author_status.') '. + $userProfile = ''; + if ($userinfo !== false) { + $userProfile = UserManager::getUserProfileLink($userinfo); + } + echo '' . $userProfile . ' (' . $author_status . ') '. api_get_local_time($row['dtime'], null, date_default_timezone_get()). ' - '.get_lang('Rating').': '.$row['p_score'].' '.$imagerating.'