Adding symfony2 DI component

1.10.x
Julio Montoya 12 years ago
parent 3307f4737f
commit 05db83127c
  1. 687
      app/SymfonyRequirements.php
  2. 13
      app/autoload.php
  3. 3050
      app/bootstrap.php.cache
  4. 62
      app/check.php
  5. 3
      app/config/parameters.php
  6. 18
      app/config/routing.yml
  7. 14
      app/config/routing_dev.yml
  8. 135
      composer.json
  9. 2
      main/admin/add_users_to_usergroup.php
  10. 9
      main/admin/course_list.php
  11. 4
      main/admin/index.php
  12. 13
      main/admin/user_list.php
  13. 4
      main/auth/shibboleth/app/controller/shibboleth_controller.class.php
  14. 9
      main/course_home/activity.php
  15. 3
      main/document/document.php
  16. 97
      main/inc/lib/api.lib.php
  17. 73
      main/inc/lib/chamilo_session.class.php
  18. 2
      main/inc/lib/course.lib.php
  19. 11
      main/inc/lib/course_home.lib.php
  20. 13
      main/inc/lib/display.lib.php
  21. 4
      main/inc/lib/events.lib.inc.php
  22. 1
      main/inc/lib/formvalidator/FormValidator.class.php
  23. 7
      main/inc/lib/internationalization.lib.php
  24. 1
      main/inc/lib/security.lib.php
  25. 97
      src/ChamiloLMS/Command/Template/AsseticDumpCommand.php
  26. 613
      src/ChamiloLMS/Controller/BaseController.php
  27. 98
      src/ChamiloLMS/Controller/LegacyController.php
  28. 4
      src/ChamiloLMS/CoreBundle/Command/Translation/ExportLanguagesCommand.php
  29. 4
      src/ChamiloLMS/CoreBundle/Component/Auth/LoginListener.php
  30. 4
      src/ChamiloLMS/CoreBundle/Component/Auth/LoginSuccessHandler.php
  31. 2
      src/ChamiloLMS/CoreBundle/Component/Auth/LogoutSuccessHandler.php
  32. 6
      src/ChamiloLMS/CoreBundle/Component/Auth/Role.php
  33. 6
      src/ChamiloLMS/CoreBundle/Component/Composer/Tasks.php
  34. 4
      src/ChamiloLMS/CoreBundle/Component/Console/Output/BufferedOutput.php
  35. 10
      src/ChamiloLMS/CoreBundle/Component/DataFilesystem/DataFilesystem.php
  36. 10
      src/ChamiloLMS/CoreBundle/Component/Editor/CkEditor/CkEditor.php
  37. 6
      src/ChamiloLMS/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php
  38. 4
      src/ChamiloLMS/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php
  39. 4
      src/ChamiloLMS/CoreBundle/Component/Editor/CkEditor/Toolbar/IntroductionTool.php
  40. 4
      src/ChamiloLMS/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathDocuments.php
  41. 4
      src/ChamiloLMS/CoreBundle/Component/Editor/CkEditor/Toolbar/Message.php
  42. 4
      src/ChamiloLMS/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswer.php
  43. 4
      src/ChamiloLMS/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswerStrict.php
  44. 4
      src/ChamiloLMS/CoreBundle/Component/Editor/CkEditor/Toolbar/TestProposedAnswer.php
  45. 4
      src/ChamiloLMS/CoreBundle/Component/Editor/CkEditor/Toolbar/TestQuestionDescription.php
  46. 4
      src/ChamiloLMS/CoreBundle/Component/Editor/CkEditor/Toolbar/UniqueAnswerImage.php
  47. 14
      src/ChamiloLMS/CoreBundle/Component/Editor/Connector.php
  48. 4
      src/ChamiloLMS/CoreBundle/Component/Editor/Driver/CourseDriver.php
  49. 4
      src/ChamiloLMS/CoreBundle/Component/Editor/Driver/CourseUserDriver.php
  50. 6
      src/ChamiloLMS/CoreBundle/Component/Editor/Driver/Driver.php
  51. 14
      src/ChamiloLMS/CoreBundle/Component/Editor/Driver/DropBoxDriver.php
  52. 4
      src/ChamiloLMS/CoreBundle/Component/Editor/Driver/HomeDriver.php
  53. 6
      src/ChamiloLMS/CoreBundle/Component/Editor/Driver/InterfaceDriver.php
  54. 4
      src/ChamiloLMS/CoreBundle/Component/Editor/Driver/PersonalDriver.php
  55. 8
      src/ChamiloLMS/CoreBundle/Component/Editor/Editor.php
  56. 2
      src/ChamiloLMS/CoreBundle/Component/Editor/Finder.php
  57. 8
      src/ChamiloLMS/CoreBundle/Component/Editor/TinyMce/TinyMce.php
  58. 6
      src/ChamiloLMS/CoreBundle/Component/Editor/TinyMce/Toolbar/Basic.php
  59. 4
      src/ChamiloLMS/CoreBundle/Component/Editor/Toolbar.php
  60. 4
      src/ChamiloLMS/CoreBundle/Component/Mail/MailGenerator.php
  61. 2
      src/ChamiloLMS/CoreBundle/Component/Validator/ConstraintValidatorFactory.php
  62. 37
      src/ChamiloLMS/CoreBundle/Controller/Admin/AdminController.php
  63. 26
      src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/BranchController.php
  64. 30
      src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/JuryController.php
  65. 22
      src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/QuestionScoreController.php
  66. 15
      src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/QuestionScoreNameController.php
  67. 12
      src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/RoleController.php
  68. 8
      src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/UpgradeController.php
  69. 41
      src/ChamiloLMS/CoreBundle/Controller/Admin/Director/BranchDirectorController.php
  70. 40
      src/ChamiloLMS/CoreBundle/Controller/Admin/JuryMember/JuryMemberController.php
  71. 28
      src/ChamiloLMS/CoreBundle/Controller/Admin/JuryPresident/JuryPresidentController.php
  72. 20
      src/ChamiloLMS/CoreBundle/Controller/Admin/QuestionManager/QuestionManagerController.php
  73. 6
      src/ChamiloLMS/CoreBundle/Controller/App/Certificate/CertificateController.php
  74. 12
      src/ChamiloLMS/CoreBundle/Controller/App/Editor/EditorController.php
  75. 4
      src/ChamiloLMS/CoreBundle/Controller/App/ModelAjax/ModelAjaxController.php
  76. 6
      src/ChamiloLMS/CoreBundle/Controller/App/News/NewsController.php
  77. 16
      src/ChamiloLMS/CoreBundle/Controller/App/SessionPath/SessionPathController.php
  78. 12
      src/ChamiloLMS/CoreBundle/Controller/App/SessionPath/SessionTreeController.php
  79. 228
      src/ChamiloLMS/CoreBundle/Controller/BaseController.php
  80. 38
      src/ChamiloLMS/CoreBundle/Controller/CrudController.php
  81. 8
      src/ChamiloLMS/CoreBundle/Controller/CrudControllerInterface.php
  82. 68
      src/ChamiloLMS/CoreBundle/Controller/IndexController.php
  83. 116
      src/ChamiloLMS/CoreBundle/Controller/LegacyController.php
  84. 61
      src/ChamiloLMS/CoreBundle/Controller/Tool/CourseHome/CourseHomeController.php
  85. 18
      src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumCategoryController.php
  86. 8
      src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumController.php
  87. 18
      src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumItemController.php
  88. 38
      src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumUserController.php
  89. 4
      src/ChamiloLMS/CoreBundle/Controller/Tool/Exercise/ExerciseController.php
  90. 18
      src/ChamiloLMS/CoreBundle/Controller/Tool/Introduction/IntroductionController.php
  91. 24
      src/ChamiloLMS/CoreBundle/Controller/Tool/LearningPath/LearningPathController.php
  92. 6
      src/ChamiloLMS/CoreBundle/Controller/ToolBaseController.php
  93. 6
      src/ChamiloLMS/CoreBundle/Controller/User/ProfileController.php
  94. 6
      src/ChamiloLMS/CoreBundle/Controller/User/UserController.php
  95. 2
      src/ChamiloLMS/CoreBundle/Entity/AccessUrl.php
  96. 2
      src/ChamiloLMS/CoreBundle/Entity/AccessUrlRelCourse.php
  97. 2
      src/ChamiloLMS/CoreBundle/Entity/AccessUrlRelSession.php
  98. 2
      src/ChamiloLMS/CoreBundle/Entity/AccessUrlRelUser.php
  99. 4
      src/ChamiloLMS/CoreBundle/Entity/BranchSync.php
  100. 2
      src/ChamiloLMS/CoreBundle/Entity/CDropboxFile.php
  101. Some files were not shown because too many files have changed in this diff Show More

@ -0,0 +1,687 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Users of PHP 5.2 should be able to run the requirements checks.
* This is why the file and all classes must be compatible with PHP 5.2+
* (e.g. not using namespaces and closures).
*
* ************** CAUTION **************
*
* DO NOT EDIT THIS FILE as it will be overridden by Composer as part of
* the installation/update process. The original file resides in the
* SensioDistributionBundle.
*
* ************** CAUTION **************
*/
/**
* Represents a single PHP requirement, e.g. an installed extension.
* It can be a mandatory requirement or an optional recommendation.
* There is a special subclass, named PhpIniRequirement, to check a php.ini configuration.
*
* @author Tobias Schultze <http://tobion.de>
*/
class Requirement
{
private $fulfilled;
private $testMessage;
private $helpText;
private $helpHtml;
private $optional;
/**
* Constructor that initializes the requirement.
*
* @param Boolean $fulfilled Whether the requirement is fulfilled
* @param string $testMessage The message for testing the requirement
* @param string $helpHtml The help text formatted in HTML for resolving the problem
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
* @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement
*/
public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false)
{
$this->fulfilled = (Boolean) $fulfilled;
$this->testMessage = (string) $testMessage;
$this->helpHtml = (string) $helpHtml;
$this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText;
$this->optional = (Boolean) $optional;
}
/**
* Returns whether the requirement is fulfilled.
*
* @return Boolean true if fulfilled, otherwise false
*/
public function isFulfilled()
{
return $this->fulfilled;
}
/**
* Returns the message for testing the requirement.
*
* @return string The test message
*/
public function getTestMessage()
{
return $this->testMessage;
}
/**
* Returns the help text for resolving the problem
*
* @return string The help text
*/
public function getHelpText()
{
return $this->helpText;
}
/**
* Returns the help text formatted in HTML.
*
* @return string The HTML help
*/
public function getHelpHtml()
{
return $this->helpHtml;
}
/**
* Returns whether this is only an optional recommendation and not a mandatory requirement.
*
* @return Boolean true if optional, false if mandatory
*/
public function isOptional()
{
return $this->optional;
}
}
/**
* Represents a PHP requirement in form of a php.ini configuration.
*
* @author Tobias Schultze <http://tobion.de>
*/
class PhpIniRequirement extends Requirement
{
/**
* Constructor that initializes the requirement.
*
* @param string $cfgName The configuration name used for ini_get()
* @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
* @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
* @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement
*/
public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false)
{
$cfgValue = ini_get($cfgName);
if (is_callable($evaluation)) {
if (null === $testMessage || null === $helpHtml) {
throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.');
}
$fulfilled = call_user_func($evaluation, $cfgValue);
} else {
if (null === $testMessage) {
$testMessage = sprintf('%s %s be %s in php.ini',
$cfgName,
$optional ? 'should' : 'must',
$evaluation ? 'enabled' : 'disabled'
);
}
if (null === $helpHtml) {
$helpHtml = sprintf('Set <strong>%s</strong> to <strong>%s</strong> in php.ini<a href="#phpini">*</a>.',
$cfgName,
$evaluation ? 'on' : 'off'
);
}
$fulfilled = $evaluation == $cfgValue;
}
parent::__construct($fulfilled || ($approveCfgAbsence && false === $cfgValue), $testMessage, $helpHtml, $helpText, $optional);
}
}
/**
* A RequirementCollection represents a set of Requirement instances.
*
* @author Tobias Schultze <http://tobion.de>
*/
class RequirementCollection implements IteratorAggregate
{
private $requirements = array();
/**
* Gets the current RequirementCollection as an Iterator.
*
* @return Traversable A Traversable interface
*/
public function getIterator()
{
return new ArrayIterator($this->requirements);
}
/**
* Adds a Requirement.
*
* @param Requirement $requirement A Requirement instance
*/
public function add(Requirement $requirement)
{
$this->requirements[] = $requirement;
}
/**
* Adds a mandatory requirement.
*
* @param Boolean $fulfilled Whether the requirement is fulfilled
* @param string $testMessage The message for testing the requirement
* @param string $helpHtml The help text formatted in HTML for resolving the problem
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
*/
public function addRequirement($fulfilled, $testMessage, $helpHtml, $helpText = null)
{
$this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, false));
}
/**
* Adds an optional recommendation.
*
* @param Boolean $fulfilled Whether the recommendation is fulfilled
* @param string $testMessage The message for testing the recommendation
* @param string $helpHtml The help text formatted in HTML for resolving the problem
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
*/
public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText = null)
{
$this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, true));
}
/**
* Adds a mandatory requirement in form of a php.ini configuration.
*
* @param string $cfgName The configuration name used for ini_get()
* @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
* @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
*/
public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
{
$this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, false));
}
/**
* Adds an optional recommendation in form of a php.ini configuration.
*
* @param string $cfgName The configuration name used for ini_get()
* @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
* @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
*/
public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
{
$this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, true));
}
/**
* Adds a requirement collection to the current set of requirements.
*
* @param RequirementCollection $collection A RequirementCollection instance
*/
public function addCollection(RequirementCollection $collection)
{
$this->requirements = array_merge($this->requirements, $collection->all());
}
/**
* Returns both requirements and recommendations.
*
* @return array Array of Requirement instances
*/
public function all()
{
return $this->requirements;
}
/**
* Returns all mandatory requirements.
*
* @return array Array of Requirement instances
*/
public function getRequirements()
{
$array = array();
foreach ($this->requirements as $req) {
if (!$req->isOptional()) {
$array[] = $req;
}
}
return $array;
}
/**
* Returns the mandatory requirements that were not met.
*
* @return array Array of Requirement instances
*/
public function getFailedRequirements()
{
$array = array();
foreach ($this->requirements as $req) {
if (!$req->isFulfilled() && !$req->isOptional()) {
$array[] = $req;
}
}
return $array;
}
/**
* Returns all optional recommendations.
*
* @return array Array of Requirement instances
*/
public function getRecommendations()
{
$array = array();
foreach ($this->requirements as $req) {
if ($req->isOptional()) {
$array[] = $req;
}
}
return $array;
}
/**
* Returns the recommendations that were not met.
*
* @return array Array of Requirement instances
*/
public function getFailedRecommendations()
{
$array = array();
foreach ($this->requirements as $req) {
if (!$req->isFulfilled() && $req->isOptional()) {
$array[] = $req;
}
}
return $array;
}
/**
* Returns whether a php.ini configuration is not correct.
*
* @return Boolean php.ini configuration problem?
*/
public function hasPhpIniConfigIssue()
{
foreach ($this->requirements as $req) {
if (!$req->isFulfilled() && $req instanceof PhpIniRequirement) {
return true;
}
}
return false;
}
/**
* Returns the PHP configuration file (php.ini) path.
*
* @return string|false php.ini file path
*/
public function getPhpIniConfigPath()
{
return get_cfg_var('cfg_file_path');
}
}
/**
* This class specifies all requirements and optional recommendations that
* are necessary to run the Symfony Standard Edition.
*
* @author Tobias Schultze <http://tobion.de>
* @author Fabien Potencier <fabien@symfony.com>
*/
class SymfonyRequirements extends RequirementCollection
{
const REQUIRED_PHP_VERSION = '5.3.3';
/**
* Constructor that initializes the requirements.
*/
public function __construct()
{
/* mandatory requirements follow */
$installedPhpVersion = phpversion();
$this->addRequirement(
version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='),
sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion),
sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
$installedPhpVersion, self::REQUIRED_PHP_VERSION),
sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion)
);
$this->addRequirement(
version_compare($installedPhpVersion, '5.3.16', '!='),
'PHP version must not be 5.3.16 as Symfony won\'t work properly with it',
'Install PHP 5.3.17 or newer (or downgrade to an earlier PHP version)'
);
$this->addRequirement(
is_dir(__DIR__.'/../vendor/composer'),
'Vendor libraries must be installed',
'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. ' .
'Then run "<strong>php composer.phar install</strong>" to install them.'
);
$baseDir = basename(__DIR__);
$this->addRequirement(
is_writable(__DIR__.'/cache'),
"$baseDir/cache/ directory must be writable",
"Change the permissions of the \"<strong>$baseDir/cache/</strong>\" directory so that the web server can write into it."
);
$this->addRequirement(
is_writable(__DIR__.'/logs'),
"$baseDir/logs/ directory must be writable",
"Change the permissions of the \"<strong>$baseDir/logs/</strong>\" directory so that the web server can write into it."
);
$this->addPhpIniRequirement(
'date.timezone', true, false,
'date.timezone setting must be set',
'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
);
if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
$timezones = array();
foreach (DateTimeZone::listAbbreviations() as $abbreviations) {
foreach ($abbreviations as $abbreviation) {
$timezones[$abbreviation['timezone_id']] = true;
}
}
$this->addRequirement(
isset($timezones[date_default_timezone_get()]),
sprintf('Configured default timezone "%s" must be supported by your installation of PHP', date_default_timezone_get()),
'Your default timezone is not supported by PHP. Check for typos in your <strong>php.ini</strong> file and have a look at the list of deprecated timezones at <a href="http://php.net/manual/en/timezones.others.php">http://php.net/manual/en/timezones.others.php</a>.'
);
}
$this->addRequirement(
function_exists('json_encode'),
'json_encode() must be available',
'Install and enable the <strong>JSON</strong> extension.'
);
$this->addRequirement(
function_exists('session_start'),
'session_start() must be available',
'Install and enable the <strong>session</strong> extension.'
);
$this->addRequirement(
function_exists('ctype_alpha'),
'ctype_alpha() must be available',
'Install and enable the <strong>ctype</strong> extension.'
);
$this->addRequirement(
function_exists('token_get_all'),
'token_get_all() must be available',
'Install and enable the <strong>Tokenizer</strong> extension.'
);
$this->addRequirement(
function_exists('simplexml_import_dom'),
'simplexml_import_dom() must be available',
'Install and enable the <strong>SimpleXML</strong> extension.'
);
if (function_exists('apc_store') && ini_get('apc.enabled')) {
if (version_compare($installedPhpVersion, '5.4.0', '>=')) {
$this->addRequirement(
version_compare(phpversion('apc'), '3.1.13', '>='),
'APC version must be at least 3.1.13 when using PHP 5.4',
'Upgrade your <strong>APC</strong> extension (3.1.13+).'
);
} else {
$this->addRequirement(
version_compare(phpversion('apc'), '3.0.17', '>='),
'APC version must be at least 3.0.17',
'Upgrade your <strong>APC</strong> extension (3.0.17+).'
);
}
}
$this->addPhpIniRequirement('detect_unicode', false);
if (extension_loaded('suhosin')) {
$this->addPhpIniRequirement(
'suhosin.executor.include.whitelist',
create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'),
false,
'suhosin.executor.include.whitelist must be configured correctly in php.ini',
'Add "<strong>phar</strong>" to <strong>suhosin.executor.include.whitelist</strong> in php.ini<a href="#phpini">*</a>.'
);
}
if (extension_loaded('xdebug')) {
$this->addPhpIniRequirement(
'xdebug.show_exception_trace', false, true
);
$this->addPhpIniRequirement(
'xdebug.scream', false, true
);
$this->addPhpIniRecommendation(
'xdebug.max_nesting_level',
create_function('$cfgValue', 'return $cfgValue > 100;'),
true,
'xdebug.max_nesting_level should be above 100 in php.ini',
'Set "<strong>xdebug.max_nesting_level</strong>" to e.g. "<strong>250</strong>" in php.ini<a href="#phpini">*</a> to stop Xdebug\'s infinite recursion protection erroneously throwing a fatal error in your project.'
);
}
$pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null;
$this->addRequirement(
null !== $pcreVersion,
'PCRE extension must be available',
'Install the <strong>PCRE</strong> extension (version 8.0+).'
);
/* optional recommendations follow */
$this->addRecommendation(
file_get_contents(__FILE__) === file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'),
'Requirements file should be up-to-date',
'Your requirements file is outdated. Run composer install and re-check your configuration.'
);
$this->addRecommendation(
version_compare($installedPhpVersion, '5.3.4', '>='),
'You should use at least PHP 5.3.4 due to PHP bug #52083 in earlier versions',
'Your project might malfunction randomly due to PHP bug #52083 ("Notice: Trying to get property of non-object"). Install PHP 5.3.4 or newer.'
);
$this->addRecommendation(
version_compare($installedPhpVersion, '5.3.8', '>='),
'When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156',
'Install PHP 5.3.8 or newer if your project uses annotations.'
);
$this->addRecommendation(
version_compare($installedPhpVersion, '5.4.0', '!='),
'You should not use PHP 5.4.0 due to the PHP bug #61453',
'Your project might not work properly due to the PHP bug #61453 ("Cannot dump definitions which have method calls"). Install PHP 5.4.1 or newer.'
);
$this->addRecommendation(
version_compare($installedPhpVersion, '5.4.11', '>='),
'When using the logout handler from the Symfony Security Component, you should have at least PHP 5.4.11 due to PHP bug #63379 (as a workaround, you can also set invalidate_session to false in the security logout handler configuration)',
'Install PHP 5.4.11 or newer if your project uses the logout handler from the Symfony Security Component.'
);
$this->addRecommendation(
(version_compare($installedPhpVersion, '5.3.18', '>=') && version_compare($installedPhpVersion, '5.4.0', '<'))
||
version_compare($installedPhpVersion, '5.4.8', '>='),
'You should use PHP 5.3.18+ or PHP 5.4.8+ to always get nice error messages for fatal errors in the development environment due to PHP bug #61767/#60909',
'Install PHP 5.3.18+ or PHP 5.4.8+ if you want nice error messages for all fatal errors in the development environment.'
);
if (null !== $pcreVersion) {
$this->addRecommendation(
$pcreVersion >= 8.0,
sprintf('PCRE extension should be at least version 8.0 (%s installed)', $pcreVersion),
'<strong>PCRE 8.0+</strong> is preconfigured in PHP since 5.3.2 but you are using an outdated version of it. Symfony probably works anyway but it is recommended to upgrade your PCRE extension.'
);
}
$this->addRecommendation(
class_exists('DomDocument'),
'PHP-XML module should be installed',
'Install and enable the <strong>PHP-XML</strong> module.'
);
$this->addRecommendation(
function_exists('mb_strlen'),
'mb_strlen() should be available',
'Install and enable the <strong>mbstring</strong> extension.'
);
$this->addRecommendation(
function_exists('iconv'),
'iconv() should be available',
'Install and enable the <strong>iconv</strong> extension.'
);
$this->addRecommendation(
function_exists('utf8_decode'),
'utf8_decode() should be available',
'Install and enable the <strong>XML</strong> extension.'
);
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->addRecommendation(
function_exists('posix_isatty'),
'posix_isatty() should be available',
'Install and enable the <strong>php_posix</strong> extension (used to colorize the CLI output).'
);
}
$this->addRecommendation(
class_exists('Locale'),
'intl extension should be available',
'Install and enable the <strong>intl</strong> extension (used for validators).'
);
if (class_exists('Collator')) {
$this->addRecommendation(
null !== new Collator('fr_FR'),
'intl extension should be correctly configured',
'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.'
);
}
if (class_exists('Locale')) {
if (defined('INTL_ICU_VERSION')) {
$version = INTL_ICU_VERSION;
} else {
$reflector = new ReflectionExtension('intl');
ob_start();
$reflector->info();
$output = strip_tags(ob_get_clean());
preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
$version = $matches[1];
}
$this->addRecommendation(
version_compare($version, '4.0', '>='),
'intl ICU version should be at least 4+',
'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).'
);
}
$accelerator =
(extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'))
||
(extension_loaded('apc') && ini_get('apc.enabled'))
||
(extension_loaded('Zend OPcache') && ini_get('opcache.enable'))
||
(extension_loaded('xcache') && ini_get('xcache.cacher'))
||
(extension_loaded('wincache') && ini_get('wincache.ocenabled'))
;
$this->addRecommendation(
$accelerator,
'a PHP accelerator should be installed',
'Install and enable a <strong>PHP accelerator</strong> like APC (highly recommended).'
);
$this->addPhpIniRecommendation('short_open_tag', false);
$this->addPhpIniRecommendation('magic_quotes_gpc', false, true);
$this->addPhpIniRecommendation('register_globals', false, true);
$this->addPhpIniRecommendation('session.auto_start', false);
$this->addRecommendation(
class_exists('PDO'),
'PDO should be installed',
'Install <strong>PDO</strong> (mandatory for Doctrine).'
);
if (class_exists('PDO')) {
$drivers = PDO::getAvailableDrivers();
$this->addRecommendation(
count($drivers),
sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'),
'Install <strong>PDO drivers</strong> (mandatory for Doctrine).'
);
}
}
}

@ -0,0 +1,13 @@
<?php
use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;
/**
* @var ClassLoader $loader
*/
$loader = require __DIR__.'/../vendor/autoload.php';
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
return $loader;

File diff suppressed because it is too large Load Diff

@ -0,0 +1,62 @@
<?php
require_once dirname(__FILE__).'/SymfonyRequirements.php';
$symfonyRequirements = new SymfonyRequirements();
$iniPath = $symfonyRequirements->getPhpIniConfigPath();
echo "********************************\n";
echo "* *\n";
echo "* Symfony requirements check *\n";
echo "* *\n";
echo "********************************\n\n";
echo $iniPath ? sprintf("* Configuration file used by PHP: %s\n\n", $iniPath) : "* WARNING: No configuration file (php.ini) used by PHP!\n\n";
echo "** ATTENTION **\n";
echo "* The PHP CLI can use a different php.ini file\n";
echo "* than the one used with your web server.\n";
if ('\\' == DIRECTORY_SEPARATOR) {
echo "* (especially on the Windows platform)\n";
}
echo "* To be on the safe side, please also launch the requirements check\n";
echo "* from your web server using the web/config.php script.\n";
echo_title('Mandatory requirements');
$checkPassed = true;
foreach ($symfonyRequirements->getRequirements() as $req) {
/** @var $req Requirement */
echo_requirement($req);
if (!$req->isFulfilled()) {
$checkPassed = false;
}
}
echo_title('Optional recommendations');
foreach ($symfonyRequirements->getRecommendations() as $req) {
echo_requirement($req);
}
exit($checkPassed ? 0 : 1);
/**
* Prints a Requirement instance
*/
function echo_requirement(Requirement $requirement)
{
$result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR');
echo ' ' . str_pad($result, 9);
echo $requirement->getTestMessage() . "\n";
if (!$requirement->isFulfilled()) {
echo sprintf(" %s\n\n", $requirement->getHelpText());
}
}
function echo_title($title)
{
echo "\n** $title **\n\n";
}

@ -0,0 +1,3 @@
<?php
$_configuration = require_once __DIR__.'/../../config/configuration.php';
$container->setParameter('configuration', $_configuration);

@ -0,0 +1,18 @@
main:
resource: "@ChamiloLMSCoreBundle/Resources/config/routing.yml"
login_check:
path: /login_check
login:
path: /login
defaults: { _controller: ChamiloLMSCoreBundle:Security:login }
secured_logout:
pattern: /secured/logout
logout:
pattern: /secured/logout
root:
path: /

@ -0,0 +1,14 @@
_wdt:
resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
prefix: /_wdt
_profiler:
resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
prefix: /_profiler
_configurator:
resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
prefix: /_configurator
_main:
resource: routing.yml

@ -9,9 +9,7 @@
},
"autoload": {
"psr-0": {
"Entity" : "main/inc/",
"Gedmo": "vendor/gedmo/doctrine-extensions/lib",
"ChamiloLMS" : "src/"
"": "src/"
},
"classmap": [
"main/auth",
@ -29,89 +27,66 @@
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/jmontoyaa/phpqrcode"
},
{
"type": "vcs",
"url": "https://github.com/jmontoyaa/silex-pagerfanta-provider"
},
{
"type": "vcs",
"url": "https://github.com/jmontoyaa/XHProfServiceProvider"
"type": "package",
"package": {
"name": "jquery/jquery",
"version": "1.10.2",
"dist": {
"url": "http://code.jquery.com/jquery-1.10.2.js",
"type": "file"
}
}
}
],
"require": {
"php": ">=5.3.3",
"silex/silex": "~1.1",
"symfony/console" : "~2.3",
"symfony/twig-bridge": "~2.3",
"symfony/doctrine-bridge": "~2.3",
"symfony/security": "~2.3",
"symfony/form": "~2.3",
"symfony/property-access": "~2.3",
"symfony/validator": "~2.3",
"symfony/translation": "~2.3",
"symfony/dependency-injection": "~2.3",
"symfony/filesystem": "~2.3",
"symfony/finder": "~2.3",
"monolog/monolog" : ">=1.0.0",
"symfony/config": "~2.3",
"symfony/yaml": "~2.3",
"symfony/locale": "~2.3",
"symfony/monolog-bridge": "~2.3",
"twig/twig": ">=1.8,<2.0-dev",
"braincrafted/bootstrap-bundle": "dev-master",
"dflydev/doctrine-orm-service-provider": "1.0.*@dev",
"doctrine/migrations": "dev-master",
"symfony/symfony": "~2.4",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~3.0",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0",
"braincrafted/bootstrap-bundle": "~2.0",
"gedmo/doctrine-extensions": "~2.3",
"swiftmailer/swiftmailer": ">=4.1.2,<4.2-dev",
"pagerfanta/pagerfanta": "dev-master",
"franmomu/silex-pagerfanta-provider": "1.0.*@dev",
"igorw/config-service-provider": "1.2.*@dev",
"mpdf/mpdf": "v5.6.1",
"ezyang/htmlpurifier": "v4.6.0",
"realityking/pchart": "dev-master",
"imagine/imagine": "0.6.*@dev",
"grom/silex-service-provider": "dev-master",
"knplabs/knp-menu": "2.0.*@dev",
"knplabs/knp-snappy": "dev-master",
"knplabs/console-service-provider": "dev-master",
"jmontoyaa/phpqrcode": "dev-master",
"neutron/silex-filesystem-provider": "dev-master",
"jbroadway/urlify": "1.0.0-stable",
"sensio/framework-extra-bundle": "~2.3",
"chamilo/chash": "dev-master",
"composer/composer": "1.0.0-alpha7",
"flint/flint": "1.6.0",
"icehero/silex-opauth": "dev-master",
"opauth/openid": "0.1.0",
"opauth/facebook": "0.2.1",
"opauth/google": "0.2.2",
"media-alchemyst/media-alchemyst": "0.4.4",
"php-ffmpeg/php-ffmpeg": "0.4.4",
"sunra/php-simple-html-dom-parser": "1.5.0",
"zendframework/zend-config": "~2.3",
"zendframework/zend-feed": "~2.3",
"zendframework/zend-http": "~2.3",
"zendframework/zend-servicemanager": "~2.3",
"sabre/vobject" : "~3.1",
"patchwork/utf8": "1.1.*",
"sonata-project/exporter": "1.3.3"
},
"require-dev": {
"league/flysystem": "0.3.3",
"symfony/browser-kit": "~2.3",
"symfony/web-profiler-bundle": "~2.3",
"silex/web-profiler": "~1.0",
"natxet/CssMin": "dev-master",
"leafo/lessphp": "dev-master",
"mheap/silex-assetic": "1.0.*@dev",
"filp/whoops": "dev-master",
"jmontoyaa/xhprof-service-provider": "dev-master"
"twbs/bootstrap": "3.0.*",
"jquery/jquery": "1.10.*",
"oyejorge/less.php": "~1.5",
"sonata-project/block-bundle": "~2.2",
"knplabs/knp-menu-bundle": "~1.1",
"white-october/pagerfanta-bundle": "dev-master"
},
"scripts": {
"post-install-cmd": "ChamiloLMS\\Composer\\Tasks::postInstall",
"post-update-cmd": "ChamiloLMS\\Composer\\Tasks::postUpdate"
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.4-dev"
}
}
}

@ -11,7 +11,7 @@ $language_file = array('admin','registration');
$cidReset = true;
// including some necessary files
require_once '../inc/global.inc.php';
//require_once '../inc/global.inc.php';
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;

@ -289,9 +289,6 @@ if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
$content .= $table->return_table();
}
$app['title'] = $tool_name;
$tpl = $app['template'];
$tpl->assign('actions', $actions);
$tpl->assign('message', $message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
echo $actions;
echo $message;
echo $content;

@ -1,4 +0,0 @@
<?php
$url = api_get_path(WEB_PUBLIC_PATH).'admin';
header('Location: '.$url);
exit;

@ -5,7 +5,7 @@
@author Julio Montoya <gugli100@gmail.com> BeezNest 2011
* @package chamilo.admin
*/
use ChamiloSession as Session;
// name of the language file that needs to be included
$language_file = array ('registration','admin');
$cidReset = true;
@ -410,7 +410,7 @@ function modify_filter($user_id, $url_params, $row) {
)
) {
if (!$user_is_anonymous) {
if ($app['security']->isGranted('ROLE_GLOBAL_ADMIN')) {
if (Session::getSecurity()->isGranted('ROLE_GLOBAL_ADMIN')) {
// everything looks good, show "login as" link
if ($user_id != $userId) {
$result .= '<a href="'.api_get_path(WEB_PUBLIC_PATH).'?_switch_user='.$row[5].'">'.Display::return_icon('login_as.gif', get_lang('LoginAs')).'</a>&nbsp;&nbsp;';
@ -801,9 +801,8 @@ if ($table->get_total_number_of_items() == 0) {
}
}
$app['title'] = $tool_name;
$tpl = $app['template'];
echo $message;
echo $actions;
echo $form.$table_result.$extra_search_options;
$tpl->assign('actions', $actions);
$tpl->assign('message', $message);
$tpl->assign('content', $form.$table_result.$extra_search_options);

@ -91,8 +91,8 @@ class ShibbolethController
$message = get_lang('already_logged_in');
Shibboleth::display()->message_page($message, $title);
}
$html = PageController::displayLoginForm();
Shibboleth::display()->page($html, $title);
/*$html = PageController::displayLoginForm();
Shibboleth::display()->page($html, $title);*/
}
/**

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use \ChamiloSession as Session;
/**
* HOME PAGE FOR EACH COURSE
@ -22,17 +23,21 @@ function return_block($title, $content)
}
$session_id = api_get_session_id();
global $app;
$urlGenerator = $app['url_generator'];
$urlGenerator = Session::$urlGenerator;
$content = null;
// Start of tools for CourseAdmins (teachers/tutors)
$totalList = array();
if ($session_id == 0 && api_is_course_admin() && api_is_allowed_to_edit(null, true)) {
$list = CourseHome::get_tools_category(TOOL_AUTHORING);
$result = CourseHome::show_tools_category($urlGenerator, $list);
$content .= return_block(get_lang('Authoring'), $result['content']);
$totalList = $result['tool_list'];
$list = CourseHome::get_tools_category(TOOL_INTERACTION);

@ -40,6 +40,9 @@ $lib_path = api_get_path(LIBRARY_PATH);
api_protect_course_script(true);
$to_user_id = api_get_user_id();
$_course = api_get_course_info();
$_user = api_get_user_info();
$charset = api_get_system_encoding();
//erase temp nanogons' audio, image edit
if (isset($_SESSION['temp_audio_nanogong']) && !empty($_SESSION['temp_audio_nanogong'])) {

@ -565,7 +565,6 @@ define('TOOL_ADMIN_VISIBLE', 'tooladminvisible');
* ...
*/
function api_get_path($path_type, $path = null) {
global $app;
static $paths = array(
SYS_DATA_PATH => 'data/',
@ -575,20 +574,20 @@ function api_get_path($path_type, $path = null) {
WEB_DATA_COURSE_PATH => 'courses/',
WEB_DATA_PATH => '/',
SYS_COURSE_PATH => 'data/',
SYS_CSS_PATH => 'web/ChamiloLMS/css/',
SYS_CSS_PATH => 'ChamiloLMS/css/',
SYS_LANG_PATH => 'lang/',
WEB_IMG_PATH => 'web/ChamiloLMS/img/',
WEB_IMG_PATH => 'ChamiloLMS/img/',
SYS_IMG_PATH => 'web/ChamiloLMS/img/',
WEB_CSS_PATH => 'web/ChamiloLMS/css/',
WEB_CSS_PATH => 'ChamiloLMS/css/',
SYS_PLUGIN_PATH => 'plugin/',
WEB_PLUGIN_PATH => 'plugin/',
WEB_ARCHIVE_PATH => 'temp/',
INCLUDE_PATH => 'inc/',
LIBRARY_PATH => 'inc/lib/',
SYS_LIBRARY_JS_PATH => 'web/ChamiloLMS/js/',
SYS_LIBRARY_JS_PATH => 'ChamiloLMS/js/',
CONFIGURATION_PATH => 'inc/conf/',
WEB_LIBRARY_PATH => 'inc/lib/',
WEB_LIBRARY_JS_PATH => 'web/ChamiloLMS/js/',
WEB_LIBRARY_JS_PATH => 'ChamiloLMS/js/',
WEB_AJAX_PATH => 'inc/ajax/',
SYS_TEST_PATH => 'tests/',
WEB_TEMPLATE_PATH => 'template/',
@ -610,16 +609,17 @@ function api_get_path($path_type, $path = null) {
static $code_folder;
static $course_folder;
global $_configuration;
// Always load root_web modifications for multiple url features.
$_configuration = $app->getConfiguration();
// Default $_configuration['root_web'] configuration
//$root_web = isset($_configuration['root_web']) ? $_configuration['root_web'] : $app['url_generator'];
$root_web = $app['url_generator']->generate('root'); //$_configuration['root_web'];
$root_web = str_replace('web/', '', $root_web);
$root_web = Session::getUrlGenerator()->generate('root'); //$_configuration['root_web'];
$rootDir = Session::getRootDir();
// Configuration data for already installed system.
$root_sys = $app['path.base'];
$root_sys = $rootDir;
$load_new_config = false;
@ -657,10 +657,10 @@ function api_get_path($path_type, $path = null) {
$paths[SYS_PATH] = $root_sys;
// Update data path to get it from config file if defined
$paths[SYS_DATA_PATH] = $app['path.data'];
$paths[SYS_LOG_PATH] = $app['path.logs'];
$paths[SYS_CONFIG_PATH] = $app['path.config'];
$paths[SYS_COURSE_PATH] = $app['path.courses'];
$paths[SYS_DATA_PATH] = Session::getDataDir();
$paths[SYS_LOG_PATH] = Session::getLogDir();
$paths[SYS_CONFIG_PATH] = Session::getConfigDir();
$paths[SYS_COURSE_PATH] = Session::getCourseDir();
$paths[SYS_DEFAULT_COURSE_DOCUMENT_PATH] = $paths[SYS_DATA_PATH].'default_course_document/';
@ -687,7 +687,7 @@ function api_get_path($path_type, $path = null) {
// Now we can switch into api_get_path() "terminology".
$paths[SYS_LANG_PATH] = $paths[SYS_CODE_PATH].$paths[SYS_LANG_PATH];
$paths[SYS_PLUGIN_PATH] = $paths[SYS_PATH].$paths[SYS_PLUGIN_PATH];
$paths[SYS_ARCHIVE_PATH] = $app['path.temp'];
$paths[SYS_ARCHIVE_PATH] = Session::getTempDir();
$paths[SYS_TEST_PATH] = $paths[SYS_PATH].$paths[SYS_TEST_PATH];
$paths[SYS_TEMPLATE_PATH] = $paths[SYS_CODE_PATH].$paths[SYS_TEMPLATE_PATH];
$paths[SYS_CSS_PATH] = $paths[SYS_PATH].$paths[SYS_CSS_PATH];
@ -1365,7 +1365,6 @@ function api_get_course_int_id() {
return Session::read('_real_cid', 0);
}
/**
* Returns the current course directory
*
@ -2196,17 +2195,19 @@ function api_get_self() {
*/
function api_is_platform_admin($allow_sessions_admins = false)
{
global $app;
$token = $app['security']->getToken();
$security = Session::getSecurity();
if ($security) {
$token = $security->getToken();
if (!empty($token)) {
if ($app['security']->isGranted('ROLE_ADMIN')) {
return true;
}
if ($allow_sessions_admins) {
if ($app['security']->isGranted('ROLE_SESSION_MANAGER')) {
if (!empty($token)) {
if ($security->isGranted('ROLE_ADMIN')) {
return true;
}
if ($allow_sessions_admins) {
if ($security->isGranted('ROLE_SESSION_MANAGER')) {
return true;
}
}
}
}
return false;
@ -2217,11 +2218,10 @@ function api_is_platform_admin($allow_sessions_admins = false)
*/
function api_is_question_manager()
{
global $app;
$token = $app['security']->getToken();
$security = Session::getSecurity();
$token = $security->getToken();
if (!empty($token)) {
if ($app['security']->isGranted('ROLE_QUESTION_MANAGER')) {
if ($security->isGranted('ROLE_QUESTION_MANAGER')) {
return true;
}
}
@ -2235,11 +2235,10 @@ function api_is_question_manager()
*/
function api_is_session_admin()
{
global $app;
$token = $app['security']->getToken();
$security = Session::getSecurity();
$token = $security->getToken();
if (!empty($token)) {
if ($app['security']->isGranted('ROLE_SESSION_MANAGER')) {
if ($security->isGranted('ROLE_SESSION_MANAGER')) {
return true;
}
}
@ -2251,11 +2250,10 @@ function api_is_session_admin()
* @return boolean True if current user is a human resources manager
*/
function api_is_drh() {
global $app;
$token = $app['security']->getToken();
$security = Session::getSecurity();
$token = $security->getToken();
if (!empty($token)) {
if ($app['security']->isGranted('ROLE_RRHH')) {
if ($security->isGranted('ROLE_RRHH')) {
return true;
}
}
@ -2267,11 +2265,10 @@ function api_is_drh() {
* @return boolean True if current user is a human resources manager
*/
function api_is_student() {
global $app;
$token = $app['security']->getToken();
$security = Session::getSecurity();
$token = $security->getToken();
if (!empty($token)) {
if ($app['security']->isGranted('ROLE_STUDENT')) {
if ($security->isGranted('ROLE_STUDENT')) {
return true;
}
}
@ -2283,9 +2280,12 @@ function api_is_student() {
* @return boolean True if current user is a human resources manager
*/
function api_is_teacher() {
global $app;
if ($app['security']->isGranted('ROLE_TEACHER')) {
return true;
$security = Session::getSecurity();
$token = $security->getToken();
if (!empty($token)) {
if ($security->isGranted('ROLE_TEACHER')) {
return true;
}
}
return false;
}
@ -2973,18 +2973,9 @@ function api_is_anonymous($user_id = null, $db_check = false) {
*/
function api_not_allowed($printHeaders = false, $message = null)
{
global $app;
if (empty($message)) {
$message = 'Unauthorized';
}
if ($printHeaders == false) {
$app['template.show_footer'] = false;
$app['template.show_header'] = false;
}
return $app->abort('401', $message);
throw new Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
}
/* WHAT'S NEW
functions for the what's new icons
in the user course list */

@ -6,6 +6,79 @@
class ChamiloSession
{
public static $session;
public static $configuration;
public static $urlGenerator;
public static $security;
public static $translator;
public static $rootDir;
public static $logDir;
public static $tempDir;
public static $dataDir;
public static $courseDir;
public static $configDir;
public static function getConfigDir()
{
return self::$configDir;
}
public static function getLogDir()
{
return self::$logDir;
}
public static function getTempDir()
{
return self::$tempDir;
}
public static function getRootDir()
{
return self::$rootDir;
}
public static function getDataDir()
{
return self::$dataDir;
}
public static function getCourseDir()
{
return self::$courseDir;
}
/**
* @return Symfony\Component\Routing\Generator\UrlGeneratorInterface
*/
public static function getUrlGenerator()
{
return self::$urlGenerator;
}
/**
* @return Symfony\Component\HttpFoundation\Session\SessionInterface;
*/
public static function getSession()
{
return self::$session;
}
/**
* @return Symfony\Component\Security\Core\SecurityContextInterface
*/
public static function getSecurity()
{
return self::$security;
}
/**
* @return Symfony\Component\Security\Core\SecurityContextInterface
*/
public static function getTranslator()
{
return self::$translator;
}
/**
* @param $session

@ -3740,7 +3740,7 @@ class CourseManager
$urlId = api_get_current_access_url_id();
$limit = intval($limit);
//Getting my courses
// Getting my courses
$my_course_list = CourseManager::get_courses_list_by_user_id(api_get_user_id());
$my_course_code_list = array();

@ -431,6 +431,7 @@ class CourseHome
break;
case TOOL_AUTHORING:
$sql = "SELECT * FROM $course_tool_table WHERE category = 'authoring' AND c_id = $course_id $condition_session ORDER BY id";
$result = Database::query($sql);
$col_link ="##003399";
break;
@ -642,7 +643,8 @@ class CourseHome
if ($tool['image'] == 'scormbuilder.gif') {
// Check if the published learnpath is visible for student
$published_lp_id = self::get_published_lp_id_from_link($tool['link']);
if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($published_lp_id, api_get_user_id())) {
if (!api_is_allowed_to_edit(null, true) &&
!learnpath::is_lp_visible_for_student($published_lp_id, api_get_user_id())) {
continue;
}
}
@ -660,7 +662,9 @@ class CourseHome
unset($lnk);
$item['extra'] = null;
if ($is_allowed_to_edit && !api_is_coach()) {
if (empty($session_id)) {
if ($tool['visibility'] == '1' && $tool['admin'] != '1') {
$link['name'] = Display::return_icon(
@ -672,7 +676,7 @@ class CourseHome
);
if (!empty($tool['id'])) {
$link['cmd'] = $urlGenerator->generate(
'course_home.controller:hideIconAction',
'chamilolms_core_tool_coursehome_coursehome_hideicon',
array(
'courseCode' => api_get_course_id(),
'iconId' => $tool['id']
@ -685,7 +689,7 @@ class CourseHome
$link['name'] = Display::return_icon('invisible.gif', get_lang('Activate'), array('id' => 'linktool_'.$tool['id']), ICON_SIZE_MEDIUM, false);
if (!empty($tool['id'])) {
$link['cmd'] = $urlGenerator->generate(
'course_home.controller:showIconAction',
'chamilolms_core_tool_coursehome_coursehome_showicon',
array(
'courseCode' => api_get_course_id(),
'iconId' => $tool['id']
@ -922,6 +926,7 @@ class CourseHome
$html .= Display::div($content, array('class'=>'activity_content'));
$html .= '</div>';
if ($counter == 1) {
$html .= '</div>';
$counter = -1;

@ -39,9 +39,7 @@ class Display
*/
public static function display_header($tool_name = '', $help = null, $page_header = null)
{
global $app;
$app['classic_layout'] = true;
$app['template']->setTitle($tool_name);
//$app['template']->setTitle($tool_name);
}
/**
@ -213,7 +211,7 @@ class Display
$introduction_section .= '<div id="introduction_block_action" class="col-md-2 col-md-offset-10">';
$url = $urlGenerator->generate(
'introduction.controller:editAction',
'chamilolms_core_tool_introduction_introduction_edit',
array('tool' => $tool, 'courseCode' => api_get_course_id())
);
@ -227,7 +225,7 @@ class Display
// Displays "edit intro && delete intro" commands
$introduction_section .= '<div id="introduction_block_action" class="col-md-2 col-md-offset-10">';
$url = $urlGenerator->generate(
'introduction.controller:editAction',
'chamilolms_core_tool_introduction_introduction_edit',
array('tool' => $tool, 'courseCode' => api_get_course_id())
);
@ -792,9 +790,6 @@ class Display
$code_path = api_get_path(SYS_IMG_PATH);
$w_code_path = api_get_path(WEB_IMG_PATH);
//$code_path = self::$urlGenerator->generate('root');
//$w_code_path = self::$urlGenerator->generate('root');
$image = trim($image);
$theme = 'css/'.api_get_visual_theme().'/icons/';
$size_extra = '';
@ -807,7 +802,6 @@ class Display
}
// Checking the theme icons folder example: main/css/chamilo/icons/XXX
if (is_file($code_path.$theme.$size_extra.$image)) {
$icon = $w_code_path.$theme.$size_extra.$image;
} elseif (is_file($code_path.'icons/'.$size_extra.$image)) {
@ -822,7 +816,6 @@ class Display
if ($return_only_path) {
return $icon;
}
$img = self::img($icon, $alt_text, $additional_attributes);
if (SHOW_TEXT_NEAR_ICONS == true and !empty($alt_text)) {
if ($show_text) {

@ -11,8 +11,8 @@
*
* @package chamilo.library
*/
use ChamiloLMS\Entity\User;
use ChamiloLMS\Entity\Role;
use ChamiloLMS\CoreBundle\Entity\User;
use ChamiloLMS\CoreBundle\Entity\Role;
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com> old code

@ -673,6 +673,7 @@ EOT;
function html_filter($html, $mode = NO_HTML)
{
return $html;
//$filter = new Zend\Filter\StripTags(array('allowTags' => 'a'));
$allowed_tags = HTML_QuickForm_Rule_HTML::get_allowed_tags($mode);
$cleaned_html = kses($html, $allowed_tags);
return $cleaned_html;

@ -10,7 +10,7 @@
* @author More authors, mentioned in the correpsonding fragments of this source.
* @package chamilo.library
*/
use Patchwork\Utf8 as u;
use \ChamiloSession as Session;
use Symfony\Component\Intl\DateFormatter\IntlDateFormatter;
// Predefined date formats in Chamilo provided by the language sub-system.
@ -49,11 +49,10 @@ define('PERSON_NAME_DATA_EXPORT', PERSON_NAME_EASTERN_ORDER); // Contextual: for
*/
function get_lang($variable)
{
global $app;
$translated = $app['translator']->trans($variable);
$translated = Session::getTranslator()->trans($variable);
if ($translated == $variable) {
// Check the langVariable for BC
$translated = $app['translator']->trans("lang$variable");
$translated = Session::getTranslator()->trans("lang$variable");
if ($translated == "lang$variable") {
return $variable;
}

@ -260,6 +260,7 @@ class Security
*/
public static function remove_XSS($var, $user_status = ANONYMOUS, $filter_terms = false)
{
return $var;
// @todo improvement - HTMLpurifier eats server memory ~ 3M
// return $var;
if ($filter_terms) {

@ -1,97 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Command\Template;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;
/**
* Class AsseticDumpCommand
* @package ChamiloLMS\Command\Template
*/
class AsseticDumpCommand extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('assetic:dump')
->setDescription('Dumps all assets to the filesystem')
->addArgument('theme', InputArgument::OPTIONAL, 'The theme to dump, if none is set then all themes will be generated', null);
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return integer|null|boolean|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var \Silex\Application $app */
$app = $this->getApplication()->getSilexApplication();
$theme = $input->getArgument('theme');
// Get all themes
if ($app['assetic.enabled'] == false || !isset($app['assetic.enabled'])) {
$output->writeln("<info>Assetic is not enabled. Change this value to true:</info> <comment>assetic.enabled = true</comment>");
return false;
}
$themes = $app['template']->getStyleSheetFolderList();
//$themes = array('chamilo', 'public_admin');
if (empty($theme)) {
$dialog = $this->getHelperSet()->get('dialog');
if (!$dialog->askConfirmation(
$output,
'<question>Are you sure you want to dump css/js of all themes?</question>(y/N)',
false
)
) {
return;
}
} else {
$themes = array($theme);
}
if (!is_dir($app['assetic.path_to_web'])) {
mkdir($app['assetic.path_to_web'], api_get_permissions_for_new_directories());
$output->writeln("<info>Creating folder in: </info><comment>".$app['assetic.path_to_web']."</comment>");
}
foreach ($themes as $theme) {
if (is_dir($app['path.base'].'main/css/'.$theme) && file_exists($app['path.base'].'main/css/'.$theme.'/default.css')) {
$output->writeln("<info>Dumping theme: $theme</info>");
/** @var \SilexAssetic\Assetic\Dumper $dumper */
$dumper = $app['assetic.dumper'];
$app['assetic.output.path_to_css'] = 'css/'.$theme.'/style.css';
$params = array(
$app['path.base'].'main/css/'.$theme => $app['assetic.input.path_to_assets'].'/css/'.$theme
);
$app['chamilo.filesystem']->copyFolders($params, $output);
if (isset($app['twig'])) {
//$dumper->addTwigAssets();
}
$dumper->dumpAssets();
} else {
$output->writeln("<info>Seems that theme: <comment>$theme</comment> doesn't have a <comment>$theme/default.css</comment> file. Skipping dump.</info>");
}
}
$output->writeln('<info>Dump finished</info>');
return true;
}
}

@ -1,613 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Knp\Menu\Matcher\Matcher;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Silex\Application;
use Flint\Controller\Controller as FlintController;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\DependencyInjection\Container;
use Knp\Menu\FactoryInterface as MenuFactoryInterface;
use Knp\Menu\ItemInterface as MenuItemInterface;
use Knp\Menu\Renderer\ListRenderer;
/**
* Each entity controller must extends this class.
*
* @abstract
*/
abstract class BaseController extends FlintController
{
protected $app;
protected $pimple;
private $classParts;
protected $breadcrumbs = array();
protected $classNameLabel;
/**
* @param Application $app
*/
public function __construct(Application $app)
{
$this->app = $app;
// In order to use the Flint Controller.
$this->pimple = $app;
$className = get_class($this);
$this->classParts = explode('\\', Container::underscore($className));
//if (!$this->classnameLabel) {
$this->classNameLabel = str_replace('Controller', '', substr($className, strrpos($className, '\\') + 1));
//}
}
/**
* @return array
*/
protected function getClassParts()
{
return $this->classParts;
}
/**
* Converts string 'ChamiloLMS\Controller\Admin\QuestionManager' into
* 'admin/question_manager'
*/
public function getTemplatePath()
{
$parts = $this->classParts;
$newPath = array();
foreach ($parts as $part) {
if (in_array($part, array('chamilo_lms', 'controller'))
//strpos($part, '_controller') > 0
) {
continue;
}
$newPath[] = $part;
}
$template = implode('/', $newPath);
return str_replace('_controller', '', $template);
}
/**
* Transforms 'QuestionManagerController' to 'question_manager.controller'
* @return string
*/
public function getControllerAlias()
{
$parts = $this->classParts;
$parts = array_reverse($parts);
$alias = str_replace('_controller', '.controller', $parts[0]);
return $alias;
}
/**
* Translator shortcut
* @param string $variable
* @return string
*/
public function trans($variable)
{
return $this->get('translator')->trans($variable);
}
/**
* Returns the class name label
* @example RoleController -> Role
*
* @return string the class name label
*/
public function getClassNameLabel()
{
return $this->classNameLabel;
}
/**
* @return MenuFactoryInterface
*/
public function getMenuFactory()
{
return $this->get('knp_menu.factory');
}
/**
* @param string $action
* @return MenuItemInterface
*/
protected function getBreadcrumbs($action)
{
$breadcrumbs = $this->buildBreadcrumbs($action);
return $breadcrumbs;
}
/** Main home URL
* @return MenuItemInterface
*/
protected function getHomeBreadCrumb()
{
$menu = $this->getMenuFactory()->createItem(
'root',
array(
'childrenAttributes' => array(
'class' => 'breadcrumb',
'currentClass' => 'active'
)
)
);
$menu->addChild(
$this->trans('Home'),
array('uri' => $this->generateUrl('home'))
);
return $menu;
}
/**
* @param $action
* @param MenuItemInterface $menu
* @return MenuItemInterface
*/
public function buildBreadcrumbs($action, MenuItemInterface $menu = null)
{
if (!$menu) {
$menu = $this->getHomeBreadCrumb();
}
$menu->addChild(
$this->trans($this->getClassnameLabel().'List'),
array('uri' => $this->generateControllerUrl('listingAction'))
);
$action = str_replace(
array($this->getControllerAlias().':', 'Action'),
'',
$action
);
switch ($action) {
case 'add':
case 'edit':
$menu->addChild(
$this->trans($this->getClassnameLabel().ucfirst($action))
//array('uri' => $this->generateControllerUrl($action.'Action'))
);
break;
}
return $menu;
}
/**
* @param array $breadCrumbList
* @return string
*/
protected function parseLegacyBreadCrumb($breadCrumbList = array())
{
$menu = $this->getHomeBreadCrumb();
foreach ($breadCrumbList as $item) {
$menu->addChild(
$this->trans($item['title']),
array('uri' => $item['url'])
);
}
$renderer = new ListRenderer(new \Knp\Menu\Matcher\Matcher());
$result = $renderer->render($menu);
return $result;
}
/**
* Renders the current controller template
* @param string $name
* @param array $elements
* @return mixed
*/
public function renderTemplate($name, $elements = array())
{
$name = $this->getTemplatePath().'/'.$name;
$renderer = new ListRenderer(new \Knp\Menu\Matcher\Matcher());
$action = $this->getRequest()->get('_route');
$result = $renderer->render($this->getBreadcrumbs($action));
$elements['new_breadcrumb'] = $result;
return $this->getTemplate()->renderTemplate($name, $elements);
}
/**
* @return \ChamiloLMS\Entity\Course
*/
protected function getCourse()
{
//if (isset($this->app['course'])) {
return $this->app['course'];
//}
return false;
}
/**
* @return \ChamiloLMS\Entity\Session
*/
protected function getSession()
{
if (isset($this->app['course_session']) && !empty($this->app['course_session'])) {
return $this->app['course_session'];
}
return false;
}
/**
* @return null|\Symfony\Component\HttpFoundation\Session\SessionInterface
*/
protected function getSessionHandler()
{
return $this->getRequest()->getSession();
}
/**
* @return \ChamiloLMS\Framework\Template
*/
protected function getTemplate()
{
return $this->get('template');
}
/**
* @return \ChamiloLMS\Component\Editor\Editor
*/
protected function getHtmlEditor()
{
return $this->get('html_editor');
}
/**
* @return \ChamiloLMS\Component\Editor\Connector
*/
protected function getEditorConnector()
{
return $this->get('editor_connector');
}
/**
* @return \ChamiloLMS\Component\DataFilesystem\DataFilesystem
*/
protected function getDataFileSystem()
{
return $this->get('chamilo.filesystem');
}
/**
* @return \ChamiloLMS\Entity\User
*/
public function getUser()
{
$user = parent::getUser();
if (empty($user)) {
return $this->abort(404, $this->trans('Login required.'));
}
return $user;
}
/**
* @return \Symfony\Component\Security\Core\SecurityContext
*/
public function getSecurity()
{
return $this->get('security');
}
/**
* @return \Doctrine\ORM\EntityManager
*/
protected function getManager()
{
return $this->get('orm.em');
}
/**
* @return \Doctrine\DBAL\Connection
*/
protected function getDatabase()
{
return $this->get('db');
}
/**
* Shortcut of
* $this->getManager()->getRepository('ChamiloLMS\Entity\MyClass')
* @param string $entity
* @return \Doctrine\ORM\EntityRepository
*/
/*sprotected function getRepository($entity)
{
return $this->getManager()->getRepository('ChamiloLMS\Entity\\'.$entity);
}*/
/**
* @see \Silex\Application::sendFile
*/
public function sendFile($file, $status = 200, $headers = array(), $contentDisposition = null)
{
return $this->pimple->sendFile($file, $status, $headers, $contentDisposition);
}
/**
* Converts an array of URL to absolute URLs using the url_generator service
* @param string $label
* @param array
* @return mixed
* @deprecated
*/
protected function createUrl($label, $parameters = array())
{
$links = $this->generateLinks();
$course = $this->getCourse();
if (!empty($course)) {
$parameters['course'] = $course->getCode();
}
$session = $this->getSession();
if (!empty($session)) {
$parameters['id_session'] = $session->getId();
}
$extraParams = $this->getExtraParameters();
if (!empty($extraParams)) {
$request = $this->getRequest();
$dynamicParams = array();
foreach ($extraParams as $param) {
$value = $request->get($param);
if (!empty($value)) {
$dynamicParams[$param] = $value;
}
}
$parameters = array_merge($parameters, $dynamicParams);
}
if (isset($links) && is_array($links) && isset($links[$label])) {
$url = $this->generateUrl($links[$label], $parameters);
return $url;
}
return $url = $this->generateUrl($links['list_link']);
}
/**
* Add extra parameters when generating URLs
* @return array
*/
protected function getExtraParameters()
{
return array();
}
/**
* @see Symfony\Component\Routing\RouterInterface::generate()
*/
public function generateUrl(
$name,
array $parameters = array(),
$reference = UrlGeneratorInterface::ABSOLUTE_PATH
) {
if ($name != 'home') {
$course = $this->getCourse();
if (!empty($course)) {
$parameters['cidReq'] = $course->getCode();
}
$session = $this->getSession();
if (!empty($session)) {
$parameters['id_session'] = $session->getId();
}
}
return parent::generateUrl($name, $parameters, $reference);
}
/**
* In a controller like RoleController when calling the indexAction URL
* this function will transform to role.controller:indexAction
* @param string $name
* @param array $parameters
* @param bool $reference
* @return mixed
*/
public function generateControllerUrl(
$name,
array $parameters = array(),
$reference = UrlGeneratorInterface::ABSOLUTE_PATH
) {
$name = $this->getControllerAlias().':'.$name;
return $this->generateUrl($name, $parameters, $reference);
}
/**
* @param \Doctrine\ORM\QueryBuilder $qb
* @param string
*/
protected function setCourseParameters(\Doctrine\ORM\QueryBuilder & $qb, $prefix)
{
$course = $this->getCourse();
if ($course) {
$qb->andWhere($prefix.'.cId = :id');
$qb->setParameter('id', $course->getId());
$session = $this->getSession();
if (!empty($session)) {
$qb->andWhere($prefix.'.sessionId = :session_id');
$qb->setParameter('session_id', $session->getId());
}
}
}
/**
* Get system setting.
* @param string $variable
* @param string $key
* @return string
*/
public function getSetting($variable, $key = null)
{
$session = $this->getRequest()->getSession();
$settings = $session->get('_setting');
if (empty($key)) {
if (isset($settings[$variable])) {
return $settings[$variable];
}
} else {
if (isset($settings[$variable]) && isset($settings[$variable])) {
return $settings[$variable];
}
}
}
/**
* @return bool
*/
public function isCourseTeacher()
{
$course = $this->getCourse();
if (!$course) {
return false;
} else {
if ($this->getSecurity()->isGranted('ROLE_ADMIN')) {
return true;
}
$course->getId();
$role = "ROLE_TEACHER_COURSE_".$course->getId().'_SESSION_0';
return $this->getSecurity()->isGranted($role);
}
}
/**
* Add flash messages.
* @param string $message
* @param string $type example: info|success|warning
*/
public function addMessage($message, $type = 'info')
{
if ($type == 'confirmation') {
$type = 'info';
}
$this->get('session')->getFlashBag()->add($type, $message);
}
/**
* @param array $breadcrumbs
* @deprecated
*/
protected function setBreadcrumb($breadcrumbs)
{
$course = $this->getCourse();
//$session = $this->getSession();
// Adding course breadcrumb.
if (!empty($course)) {
$courseBreadcrumb = array(
'name' => \Display::return_icon('home.png').' '.$course->getTitle(),
'url' => array(
'route' => 'course',
'routeParameters' => array(
'cidReq' => $course->getCode(),
'id_session' => api_get_session_id()
)
)
);
array_unshift($breadcrumbs, $courseBreadcrumb);
}
$app = $this->app;
$app['main_breadcrumb'] = function ($app) use ($breadcrumbs) {
/** @var \Knp\Menu\MenuItem $menu */
$menu = $app['knp_menu.factory']->createItem(
'root',
array(
'childrenAttributes' => array(
'class' => 'breadcrumb',
'currentClass' => 'active'
)
)
);
if (!empty($breadcrumbs)) {
foreach ($breadcrumbs as $item) {
if (empty($item['url'])) {
$item['url'] = array();
}
$menu->addChild($item['name'], $item['url']);
}
}
return $menu;
};
$matcher = new Matcher();
$voter = new \Knp\Menu\Silex\Voter\RouteVoter();
$voter->setRequest($this->getRequest());
$matcher->addVoter($voter);
$renderer = new \Knp\Menu\Renderer\TwigRenderer(
$this->get('twig'),
'bread.tpl',
$matcher
);
$bread = $renderer->render(
$this->get('main_breadcrumb'),
array(
'template' => 'default/layout/bread.tpl'
)
);
$app['breadcrumbs'] = $bread;
}
/**
* @return array
*/
public function menuList()
{
return array(
'index',
'users' => array(
'list', 'add', 'edit', 'export', 'import', 'profiling', 'roles'
),
'courses' => array(
array(
'list',
'add',
'edit',
'export',
'import',
'add_users',
'import_users',
'course_categories',
'extra_fields',
'question_extra_fields'
)
),
'sessions',
'classes',
'appearance',
'plugins',
'settings',
'tools'
);
}
public function before(Request $request)
{
}
}

@ -1,98 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller;
use Silex\Application;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
/**
* Class LegacyController
* Manages the chamilo pages starting with Display::display_header and $tpl = new Template();
* @package ChamiloLMS\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class LegacyController extends BaseController
{
public $section;
/**
* Handles default Chamilo scripts handled by Display::display_header() and display_footer()
*
* @param \Silex\Application $app
* @param string $file
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response|void
*/
public function classicAction(Application $app, $file)
{
$responseHeaders = array();
$request = $this->getRequest();
// get.
$_GET = $request->query->all();
// post.
$_POST = $request->request->all();
// echo $request->getMethod();
//$_REQUEST = $request->request->all();
$mainPath = $app['paths']['sys_root'].'main/';
$fileToLoad = $mainPath.$file;
if (is_file($fileToLoad) &&
\Security::check_abs_path($fileToLoad, $mainPath)
) {
$toolNameFromFile = basename(dirname($fileToLoad));
// Default values
$_course = api_get_course_info();
$_user = api_get_user_info();
$charset = 'UTF-8';
$debug = $app['debug'];
$text_dir = api_get_text_direction();
$is_platformAdmin = api_is_platform_admin();
$_cid = api_get_course_id();
// Loading file
ob_start();
require_once $mainPath.$file;
$out = ob_get_contents();
ob_end_clean();
// No browser cache when executing an exercise.
if ($file == 'exercice/exercise_submit.php') {
$responseHeaders = array(
'cache-control' => 'no-store, no-cache, must-revalidate'
);
}
// Setting page header/footer conditions (important for LPs)
$this->getTemplate()->setFooter($app['template.show_footer']);
$this->getTemplate()->setHeader($app['template.show_header']);
if (isset($htmlHeadXtra)) {
$this->getTemplate()->addResource($htmlHeadXtra, 'string');
}
// $interbreadcrumb is loaded in the require_once file.
$interbreadcrumb = isset($interbreadcrumb) ? $interbreadcrumb : null;
$this->getTemplate()->setBreadcrumb($interbreadcrumb);
$breadCrumb = $this->getTemplate()->getBreadCrumbLegacyArray();
$menu = $this->parseLegacyBreadCrumb($breadCrumb);
$this->getTemplate()->assign('new_breadcrumb', $menu);
$this->getTemplate()->parseResources();
if (isset($tpl)) {
$response = $app['twig']->render($app['default_layout']);
} else {
$this->getTemplate()->assign('content', $out);
$response = $app['twig']->render($app['default_layout']);
}
} else {
return $app->abort(404, 'File not found');
}
return new Response($response, 200, $responseHeaders);
}
}

@ -1,7 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Command\Translation;
namespace ChamiloLMS\CoreBundle\Command\Translation;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
@ -14,7 +14,7 @@ use Symfony\Component\Console\Input\InputInterface;
/**
* Class ExportLanguagesCommand
* @package ChamiloLMS\Command\Translation
* @package ChamiloLMS\CoreBundle\Command\Translation
*/
class ExportLanguagesCommand extends Command
{

@ -1,6 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Auth;
namespace ChamiloLMS\CoreBundle\Component\Auth;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use Symfony\Component\Security\Http\Event\SwitchUserEvent;
@ -13,7 +13,7 @@ class LoginListener
*/
public function onSecuritySwitchUser(SwitchUserEvent $event)
{
/** @var \ChamiloLMS\Entity\User $user */
/** @var \ChamiloLMS\CoreBundle\Entity\User $user */
$user = $event->getTargetUser();
/*var_dump($user );
var_dump($event->getRequest()->getUser());

@ -1,6 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Auth;
namespace ChamiloLMS\CoreBundle\Component\Auth;
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
@ -9,7 +9,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Router;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use ChamiloLMS\Entity\User;
use ChamiloLMS\CoreBundle\Entity\User;
/**
* Class LoginSuccessHandler

@ -1,6 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Auth;
namespace ChamiloLMS\CoreBundle\Listener;
use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;
use Symfony\Component\Security\Core\SecurityContext;

@ -1,16 +1,16 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Auth;
namespace ChamiloLMS\CoreBundle\Component\Auth;
use Symfony\Component\Security\Core\Role\RoleInterface;
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
use Doctrine\Common\Collections\ArrayCollection;
use ChamiloLMS\Entity\CourseRelUser;
use ChamiloLMS\CoreBundle\Entity\CourseRelUser;
/**
* Class Role
* @package ChamiloLMS\Component\Auth
* @package ChamiloLMS\CoreBundle\Component\Auth
*/
class Role implements RoleInterface
{

@ -1,12 +1,12 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Composer;
namespace ChamiloLMS\CoreBundle\Composer;
/**
* Class Tasks
* Executes tasks when executing composer update/install methods
* @package ChamiloLMS\Composer
* @package ChamiloLMS\CoreBundle\Composer
*/
class Tasks
{
@ -27,4 +27,4 @@ class Tasks
{
}
}
}

@ -1,14 +1,14 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Console\Output;
namespace ChamiloLMS\CoreBundle\Component\Console\Output;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\HttpFoundation\Request;
/**
* Class BufferedOutput
* @package ChamiloLMS\Component\Console\Output
* @package ChamiloLMS\CoreBundle\Component\Console\Output
*/
class BufferedOutput extends Output
{

@ -1,16 +1,16 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\DataFilesystem;
namespace ChamiloLMS\CoreBundle\Component\DataFilesystem;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Console;
use Sunra\PhpSimple\HtmlDomParser;
use ChamiloLMS\Component\Editor\Connector;
use ChamiloLMS\Component\Editor\Driver\CourseDriver;
use ChamiloLMS\Entity\User;
use ChamiloLMS\CoreBundle\Component\Editor\Connector;
use ChamiloLMS\CoreBundle\Component\Editor\Driver\CourseDriver;
use ChamiloLMS\CoreBundle\Entity\User;
use MediaAlchemyst\Alchemyst;
use Unoconv\Unoconv;
use Symfony\Component\Console\Output\OutputInterface;
@ -19,7 +19,7 @@ use Symfony\Component\Console\Output\OutputInterface;
* @todo use Gaufrette to manage course files (some day)
* @todo add security restrictions.
* Class DataFilesystem
* @package ChamiloLMS\Component\DataFilesystem
* @package ChamiloLMS\CoreBundle\Component\DataFilesystem
*/
class DataFilesystem
{

@ -1,15 +1,15 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\CkEditor;
namespace ChamiloLMS\CoreBundle\Component\Editor\CkEditor;
use ChamiloLMS\Component\Editor\Editor;
use ChamiloLMS\Component\Editor\CkEditor\Toolbar;
use ChamiloLMS\CoreBundle\Component\Editor\Editor;
use ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar;
use Symfony\Component\Routing\Generator\UrlGenerator;
/**
* Class CkEditor
* @package ChamiloLMS\Component\Editor\CkEditor
* @package ChamiloLMS\CoreBundle\Component\Editor\CkEditor
*/
class CkEditor extends Editor
{
@ -73,7 +73,7 @@ class CkEditor extends Editor
if (empty($templates)) {
return null;
}
/** @var \ChamiloLMS\Entity\SystemTemplate $template */
/** @var \ChamiloLMS\CoreBundle\Entity\SystemTemplate $template */
$templateList = array();
$search = array('{CSS}', '{IMG_DIR}', '{REL_PATH}', '{COURSE_DIR}');

@ -1,13 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\CkEditor\Toolbar;
namespace ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar;
use ChamiloLMS\Component\Editor\Toolbar;
use ChamiloLMS\CoreBundle\Component\Editor\Toolbar;
/**
* Class Basic
* @package ChamiloLMS\Component\Editor\CkEditor\Toolbar
* @package ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class Basic extends Toolbar
{

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\CkEditor\Toolbar;
namespace ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* Class Documents
* @package ChamiloLMS\Component\Editor\CkEditor\Toolbar
* @package ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class Documents extends Basic
{

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\CkEditor\Toolbar;
namespace ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* Class IntroductionTool
* @package ChamiloLMS\Component\Editor\CkEditor\Toolbar
* @package ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class IntroductionTool extends Basic
{

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\CkEditor\Toolbar;
namespace ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* Class LearningPathDocuments
* @package ChamiloLMS\Component\Editor\CkEditor\Toolbar
* @package ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class LearningPathDocuments extends Basic
{

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\CkEditor\Toolbar;
namespace ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* Class Message
* @package ChamiloLMS\Component\Editor\CkEditor\Toolbar
* @package ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class Message extends Basic
{

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\CkEditor\Toolbar;
namespace ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* Class TestFreeAnswer
* @package ChamiloLMS\Component\Editor\CkEditor\Toolbar
* @package ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class TestFreeAnswer extends Basic
{

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\CkEditor\Toolbar;
namespace ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* Class TestFreeAnswerStrict
* @package ChamiloLMS\Component\Editor\CkEditor\Toolbar
* @package ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class TestFreeAnswerStrict extends Basic
{

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\CkEditor\Toolbar;
namespace ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* Class TestProposedAnswer
* @package ChamiloLMS\Component\Editor\CkEditor\Toolbar
* @package ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class TestProposedAnswer
{

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\CkEditor\Toolbar;
namespace ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* Class TestQuestionDescription
* @package ChamiloLMS\Component\Editor\CkEditor\Toolbar
* @package ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class TestQuestionDescription
{

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\CkEditor\Toolbar;
namespace ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* Class UniqueAnswerImage
* @package ChamiloLMS\Component\Editor\CkEditor\Toolbar
* @package ChamiloLMS\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class UniqueAnswerImage extends Basic
{

@ -1,20 +1,20 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor;
namespace ChamiloLMS\CoreBundle\Component\Editor;
use Doctrine\ORM\EntityManager;
use ChamiloLMS\Entity\User;
use ChamiloLMS\Entity\Course;
use ChamiloLMS\CoreBundle\Entity\User;
use ChamiloLMS\CoreBundle\Entity\Course;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Routing\Router;
use ChamiloLMS\Component\Editor\Driver\Driver;
use ChamiloLMS\CoreBundle\Component\Editor\Driver\Driver;
use Symfony\Component\Security\Core\SecurityContext;
/**
* Class elFinder Connector - editor + Chamilo repository
* @package ChamiloLMS\Component\Editor
* @package ChamiloLMS\CoreBundle\Component\Editor
*/
class Connector
{
@ -168,7 +168,7 @@ class Connector
$driverUpdated = array_merge($defaultDriver, $driver);
$driverUpdated['driver'] = 'ChamiloLMS\Component\Editor\Driver\\'.$driver['driver'];
$driverUpdated['driver'] = 'ChamiloLMS\CoreBundle\Component\Editor\Driver\\'.$driver['driver'];
$driverUpdated['attributes'] = $attributes;
return $driverUpdated;
}
@ -380,6 +380,6 @@ class Connector
*/
private function getDriverClass($driver)
{
return 'ChamiloLMS\Component\Editor\Driver\\'.$driver;
return 'ChamiloLMS\CoreBundle\Component\Editor\Driver\\'.$driver;
}
}

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\Driver;
namespace ChamiloLMS\CoreBundle\Component\Editor\Driver;
/**
* Class CourseDriver
* @package ChamiloLMS\Component\Editor\Driver
* @package ChamiloLMS\CoreBundle\Component\Editor\Driver
*/
class CourseDriver extends Driver
{

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\Driver;
namespace ChamiloLMS\CoreBundle\Component\Editor\Driver;
/**
* Class CourseUserDriver
* @package ChamiloLMS\Component\Editor\Driver
* @package ChamiloLMS\CoreBundle\Component\Editor\Driver
*/
class CourseUserDriver extends CourseDriver
{

@ -1,13 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\Driver;
namespace ChamiloLMS\CoreBundle\Component\Editor\Driver;
use ChamiloLMS\Component\Editor\Connector;
use ChamiloLMS\CoreBundle\Component\Editor\Connector;
/**
* Class Driver
* @package ChamiloLMS\Component\Editor\Driver
* @package ChamiloLMS\CoreBundle\Component\Editor\Driver
*/
class Driver extends \elFinderVolumeLocalFileSystem implements InterfaceDriver
{

@ -1,14 +1,14 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\Driver;
namespace ChamiloLMS\CoreBundle\Component\Editor\Driver;
use ChamiloLMS\Entity\CDropboxFile;
use ChamiloLMS\Component\Editor\Connector;
use ChamiloLMS\CoreBundle\Entity\CDropboxFile;
use ChamiloLMS\CoreBundle\Component\Editor\Connector;
/**
* Class DropBoxDriver
* @package ChamiloLMS\Component\Editor\Driver
* @package ChamiloLMS\CoreBundle\Component\Editor\Driver
*/
class DropBoxDriver extends \elFinderVolumeMySQL implements InterfaceDriver
{
@ -69,8 +69,8 @@ class DropBoxDriver extends \elFinderVolumeMySQL implements InterfaceDriver
{
if ($this->connector->security->isGranted('IS_AUTHENTICATED_FULLY')) {
/** @var \ChamiloLMS\Entity\Repository\UserRepository $repository */
/*$repository = $this->connector->entityManager->getRepository('ChamiloLMS\Entity\User');
/** @var \ChamiloLMS\CoreBundle\Entity\Repository\UserRepository $repository */
/*$repository = $this->connector->entityManager->getRepository('ChamiloLMS\CoreBundle\Entity\User');
$courses = $repository->getCourses($this->connector->user);*/
//if (!empty($courses)) {
@ -206,7 +206,7 @@ class DropBoxDriver extends \elFinderVolumeMySQL implements InterfaceDriver
return $this->returnDirectory();
}
$file = $this->connector->entityManager->getRepository('ChamiloLMS\Entity\CDropboxFile')->findOneBy($criteria);
$file = $this->connector->entityManager->getRepository('ChamiloLMS\CoreBundle\Entity\CDropboxFile')->findOneBy($criteria);
if ($file) {
$stat = $this->transformFileInStat($file);

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\Driver;
namespace ChamiloLMS\CoreBundle\Component\Editor\Driver;
/**
* Class HomeDriver
* @package ChamiloLMS\Component\Editor\Driver
* @package ChamiloLMS\CoreBundle\Component\Editor\Driver
*/
class HomeDriver extends Driver
{

@ -1,13 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\Driver;
namespace ChamiloLMS\CoreBundle\Component\Editor\Driver;
use ChamiloLMS\Component\Editor\Connector;
use ChamiloLMS\CoreBundle\Component\Editor\Connector;
/**
* Class Driver
* @package ChamiloLMS\Component\Editor\Driver
* @package ChamiloLMS\CoreBundle\Component\Editor\Driver
*/
interface interfaceDriver
{

@ -1,12 +1,12 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\Driver;
namespace ChamiloLMS\CoreBundle\Component\Editor\Driver;
/**
* Class PersonalDriver
* @todo add more checks in upload/rm
* @package ChamiloLMS\Component\Editor\Driver
* @package ChamiloLMS\CoreBundle\Component\Editor\Driver
*/
class PersonalDriver extends Driver
{

@ -1,16 +1,16 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor;
namespace ChamiloLMS\CoreBundle\Component\Editor;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Routing\Router;
use ChamiloLMS\Entity\Course;
use ChamiloLMS\Framework\Template;
use ChamiloLMS\CoreBundle\Entity\Course;
use ChamiloLMS\CoreBundle\Framework\Template;
/**
* Class Editor
* @package ChamiloLMS\Component\Editor
* @package ChamiloLMS\CoreBundle\Component\Editor
*/
class Editor
{

@ -1,7 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor;
namespace ChamiloLMS\CoreBundle\Component\Editor;
/**
* elFinder - file manager for web.

@ -1,14 +1,14 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\TinyMce;
namespace ChamiloLMS\CoreBundle\Component\Editor\TinyMce;
use ChamiloLMS\Component\Editor\Editor;
use ChamiloLMS\Component\Editor\TinyMce\Toolbar;
use ChamiloLMS\CoreBundle\Component\Editor\Editor;
use ChamiloLMS\CoreBundle\Component\Editor\TinyMce\Toolbar;
/**
* Class TinyMce
* @package ChamiloLMS\Component\Editor\TinyMce
* @package ChamiloLMS\CoreBundle\Component\Editor\TinyMce
*/
class TinyMce extends Editor
{

@ -1,13 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor\TinyMce\Toolbar;
namespace ChamiloLMS\CoreBundle\Component\Editor\TinyMce\Toolbar;
use ChamiloLMS\Component\Editor\Toolbar;
use ChamiloLMS\CoreBundle\Component\Editor\Toolbar;
/**
* Class Basic
* @package ChamiloLMS\Component\Editor\TinyMce\Toolbar\Basic
* @package ChamiloLMS\CoreBundle\Component\Editor\TinyMce\Toolbar\Basic
*/
class Basic extends Toolbar
{

@ -1,13 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Editor;
namespace ChamiloLMS\CoreBundle\Component\Editor;
use Symfony\Component\Routing\Router;
/**
* Class Toolbar
* @package ChamiloLMS\Component\Editor
* @package ChamiloLMS\CoreBundle\Component\Editor
*/
class Toolbar
{

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Mail;
namespace ChamiloLMS\CoreBundle\Component\Mail;
/**
* Class MailGenerator
* @package ChamiloLMS\Component\Mail
* @package ChamiloLMS\CoreBundle\Component\Mail
*/
class MailGenerator
{

@ -1,7 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Component\Validator;
namespace ChamiloLMS\CoreBundle\Component\Validator;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;

@ -1,10 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Admin;
namespace ChamiloLMS\CoreBundle\Controller\Admin;
use ChamiloLMS\Controller\BaseController;
use Silex\Application;
use ChamiloLMS\CoreBundle\Controller\BaseController;
use Symfony\Component\HttpFoundation\Response;
use Entity;
use Symfony\Component\Routing\Annotation\Route;
@ -12,14 +11,13 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class Administrator
* @todo @route and @method function don't work yet
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class AdminController extends BaseController
{
/**
* @Route("/")
* @Route("/", name="administration")
* @Method({"GET"})
*
* @return Response
@ -29,16 +27,13 @@ class AdminController extends BaseController
$template = $this->getTemplate();
$security = $this->getSecurity();
if (!$security->isGranted($this->app['allow_admin_toolbar'])) {
return $this->abort(403, 'Access denied');
if (!$security->isGranted('ROLE_ADMIN')) {
//return $this->abort(403, 'Access denied');
}
if ($security->isGranted('ROLE_ADMIN')) {
$this->loadAdminMenu();
return $this->loadAdminMenu();
}
$response = $template->renderTemplate('admin/index.tpl');
return new Response($response, 200, array());
}
/**
@ -58,17 +53,9 @@ class AdminController extends BaseController
*/
private function loadAdminMenu()
{
$template = $this->get('template');
// Access restrictions.
api_protect_admin_script(true);
// @todo fix register/check version
$message = null;
if (!empty($_POST['Register'])) {
register_site();
$message = \Display::return_message(get_lang('VersionCheckEnabled'), 'confirmation');
}
$adminUrl = api_get_path(WEB_CODE_PATH).'admin/';
$blocks = array();
@ -273,7 +260,13 @@ class AdminController extends BaseController
}
$admin_ajax_url = api_get_path(WEB_AJAX_PATH).'admin.ajax.php';
$template->assign('web_admin_ajax_url', $admin_ajax_url);
$template->assign('blocks', $blocks);
return $this->render(
'ChamiloLMSCoreBundle:Admin:index.html.twig',
array(
'blocks' => $blocks,
'web_admin_ajax_url' => $admin_ajax_url
)
);
}
}

@ -1,36 +1,36 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Admin\Administrator;
namespace ChamiloLMS\CoreBundle\Controller\Admin\Administrator;
use ChamiloLMS\Controller\CrudController;
use ChamiloLMS\CoreBundle\Controller\CrudController;
use Silex\Application;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Entity;
use ChamiloLMS\Form\BranchType;
use ChamiloLMS\Form\BranchUsersType;
use ChamiloLMS\Entity\BranchUsers;
use ChamiloLMS\Entity\BranchSync;
use ChamiloLMS\CoreBundle\Form\BranchType;
use ChamiloLMS\CoreBundle\Form\BranchUsersType;
use ChamiloLMS\CoreBundle\Entity\BranchUsers;
use ChamiloLMS\CoreBundle\Entity\BranchSync;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class RoleController
* @package ChamiloLMS\Controller\Admin\Administrator
* @package ChamiloLMS\CoreBundle\Controller\Admin\Administrator
* @author Julio Montoya <gugli100@gmail.com>
*/
class BranchController extends CrudController
{
public function getClass()
{
return 'ChamiloLMS\Entity\BranchSync';
return 'ChamiloLMS\CoreBundle\Entity\BranchSync';
}
public function getType()
{
return 'ChamiloLMS\Form\BranchType';
return 'ChamiloLMS\CoreBundle\Form\BranchType';
}
public function getControllerAlias()
@ -76,7 +76,7 @@ class BranchController extends CrudController
$query = $this->getManager()
->createQueryBuilder()
->select('node')
->from('ChamiloLMS\Entity\BranchSync', 'node')
->from('ChamiloLMS\CoreBundle\Entity\BranchSync', 'node')
//->where('node.cId = 0')
->orderBy('node.root, node.lft', 'ASC')
->getQuery();
@ -108,7 +108,7 @@ class BranchController extends CrudController
$userIdList = $item->getUserId();
$userId = ($userIdList[0]);
$user = $this->getManager()->getRepository('ChamiloLMS\Entity\User')->find($userId);
$user = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\User')->find($userId);
if (!$user) {
throw new \Exception('Unable to found User');
}
@ -151,7 +151,7 @@ class BranchController extends CrudController
'branchId' => $id,
'userId' => $userId
);
$branchUser = $this->getManager()->getRepository('ChamiloLMS\Entity\BranchUsers')->findOneBy($criteria);
$branchUser = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\BranchUsers')->findOneBy($criteria);
if (!$branchUser) {
$this->createNotFoundException();
@ -174,7 +174,7 @@ class BranchController extends CrudController
$template = $this->get('template');
$template->assign('links', $this->generateLinks());
/** @var \ChamiloLMS\Entity\Repository\BranchSyncRepository $repo */
/** @var \ChamiloLMS\CoreBundle\Entity\Repository\BranchSyncRepository $repo */
$repo = $this->getRepository();
$item = $this->getEntity($id);

@ -1,32 +1,32 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Admin\Administrator;
namespace ChamiloLMS\CoreBundle\Controller\Admin\Administrator;
use ChamiloLMS\Controller\CrudController;
use ChamiloLMS\CoreBundle\Controller\CrudController;
use Symfony\Component\Form\Extension\Validator\Constraints\FormValidator;
use Symfony\Component\HttpFoundation\Response;
use Entity;
use ChamiloLMS\Form\JuryType;
use ChamiloLMS\Form\JuryUserType;
use ChamiloLMS\Form\JuryMembersType;
use ChamiloLMS\CoreBundle\Form\JuryType;
use ChamiloLMS\CoreBundle\Form\JuryUserType;
use ChamiloLMS\CoreBundle\Form\JuryMembersType;
use Symfony\Component\HttpFoundation\JsonResponse;
use ChamiloLMS\Entity\JuryMembers;
use ChamiloLMS\Entity\Jury;
use ChamiloLMS\CoreBundle\Entity\JuryMembers;
use ChamiloLMS\CoreBundle\Entity\Jury;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class JuryController
* @package ChamiloLMS\Controller\Admin\Administrator
* @package ChamiloLMS\CoreBundle\Controller\Admin\Administrator
* @author Julio Montoya <gugli100@gmail.com>
*/
class JuryController extends CrudController
{
public function getClass()
{
return 'ChamiloLMS\Entity\Jury';
return 'ChamiloLMS\CoreBundle\Entity\Jury';
}
public function getControllerAlias()
@ -39,7 +39,7 @@ class JuryController extends CrudController
*/
public function getType()
{
return 'ChamiloLMS\Form\JuryType';
return 'ChamiloLMS\CoreBundle\Form\JuryType';
}
/**
@ -73,7 +73,7 @@ class JuryController extends CrudController
*/
public function removeMemberAction($id)
{
$juryMembers = $this->getManager()->getRepository('ChamiloLMS\Entity\JuryMembers')->find($id);
$juryMembers = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\JuryMembers')->find($id);
if ($juryMembers) {
$em = $this->getManager();
$em->remove($juryMembers);
@ -95,8 +95,8 @@ class JuryController extends CrudController
$keyword = $request->get('tag');
$role = $request->get('role');
/** @var \ChamiloLMS\Entity\Repository\UserRepository $repo */
$repo = $this->getManager()->getRepository('ChamiloLMS\Entity\User');
/** @var \ChamiloLMS\CoreBundle\Entity\Repository\UserRepository $repo */
$repo = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\User');
if (empty($role)) {
$entities = $repo->searchUserByKeyword($keyword);
@ -106,7 +106,7 @@ class JuryController extends CrudController
$data = array();
if ($entities) {
/** @var \ChamiloLMS\Entity\User $entity */
/** @var \ChamiloLMS\CoreBundle\Entity\User $entity */
foreach ($entities as $entity) {
$data[] = array(
'key' => (string) $entity->getUserId(),
@ -136,7 +136,7 @@ class JuryController extends CrudController
$userIdList = $item->getUserId();
$userId = ($userIdList[0]);
$user = $this->getManager()->getRepository('ChamiloLMS\Entity\User')->find($userId);
$user = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\User')->find($userId);
if (!$user) {
throw new \Exception('Unable to found User');
}

@ -1,29 +1,39 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Admin\Administrator;
namespace ChamiloLMS\CoreBundle\Controller\Admin\Administrator;
use ChamiloLMS\Controller\CrudController;
use ChamiloLMS\CoreBundle\Controller\CrudController;
use Symfony\Component\HttpFoundation\Response;
use ChamiloLMS\Entity;
use ChamiloLMS\CoreBundle\Entity;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class QuestionScoreController
* @package ChamiloLMS\Controller\Admin\Administrator
* @package ChamiloLMS\CoreBundle\Controller\Admin\Administrator
* @author Julio Montoya <gugli100@gmail.com>
* @Route("/question_score")
*/
class QuestionScoreController extends CrudController
{
/**
*
* @Route("/")
* @Method({"GET"})
*/
public function indexAction()
{
}
public function getClass()
{
return 'ChamiloLMS\Entity\BranchSync';
return 'ChamiloLMS\CoreBundle\Entity\BranchSync';
}
public function getType()
{
return 'ChamiloLMS\Form\QuestionScoreType';
return 'ChamiloLMS\CoreBundle\Form\QuestionScoreType';
}
/**

@ -1,15 +1,16 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Admin\Administrator;
namespace ChamiloLMS\CoreBundle\Controller\Admin\Administrator;
use ChamiloLMS\Controller\CrudController;
use ChamiloLMS\Entity;
use ChamiloLMS\CoreBundle\Controller\CrudController;
use ChamiloLMS\CoreBundle\Entity;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class QuestionScoreController
* @todo @route and @method function don't work yet
* @package ChamiloLMS\Controller\Admin\Administrator
* @package ChamiloLMS\CoreBundle\Controller\Admin\Administrator
* @author Julio Montoya <gugli100@gmail.com>
*/
@ -17,12 +18,12 @@ class QuestionScoreNameController extends CrudController
{
public function getClass()
{
return 'ChamiloLMS\Entity\QuestionScoreName';
return 'ChamiloLMS\CoreBundle\Entity\QuestionScoreName';
}
public function getType()
{
return 'ChamiloLMS\Form\QuestionScoreNameType';
return 'ChamiloLMS\CoreBundle\Form\QuestionScoreNameType';
}
public function getControllerAlias()

@ -1,14 +1,14 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Admin\Administrator;
namespace ChamiloLMS\CoreBundle\Controller\Admin\Administrator;
use ChamiloLMS\Controller\CrudController;
use ChamiloLMS\Entity;
use ChamiloLMS\CoreBundle\Controller\CrudController;
use ChamiloLMS\CoreBundle\Entity;
/**
* Class RoleController
* @package ChamiloLMS\Controller\Admin\Administrator
* @package ChamiloLMS\CoreBundle\Controller\Admin\Administrator
* @author Julio Montoya <gugli100@gmail.com>
*/
class RoleController extends CrudController
@ -18,7 +18,7 @@ class RoleController extends CrudController
*/
public function getClass()
{
return 'ChamiloLMS\Entity\Role';
return 'ChamiloLMS\CoreBundle\Entity\Role';
}
/**
@ -26,7 +26,7 @@ class RoleController extends CrudController
*/
public function getType()
{
return 'ChamiloLMS\Form\RoleType';
return 'ChamiloLMS\CoreBundle\Form\RoleType';
}
/**

@ -1,13 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Admin\Administrator;
namespace ChamiloLMS\CoreBundle\Controller\Admin\Administrator;
use ChamiloLMS\Controller\BaseController;
use ChamiloLMS\CoreBundle\Controller\BaseController;
use Silex\Application;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\Extension\Validator\Constraints\FormValidator;
use ChamiloLMS\Component\Console\Output\BufferedOutput;
use ChamiloLMS\CoreBundle\Component\Console\Output\BufferedOutput;
use Symfony\Component\HttpFoundation\Response;
use Entity;
use Symfony\Component\Routing\Annotation\Route;
@ -17,7 +17,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class RoleController
* @todo @route and @method function don't work yet
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class UpgradeController extends BaseController

@ -1,38 +1,39 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Admin\Director;
use ChamiloLMS\Controller\CrudController;
use ChamiloLMS\Form\DirectorJuryUserType;
use ChamiloLMS\Form\JuryType;
use ChamiloLMS\Entity;
use ChamiloLMS\Entity\BranchSync;
use ChamiloLMS\Entity\Jury;
use ChamiloLMS\Entity\User;
use ChamiloLMS\Entity\JuryMembers;
use Silex\Application;
namespace ChamiloLMS\CoreBundle\Controller\Admin\Director;
use ChamiloLMS\CoreBundle\Controller\CrudController;
use ChamiloLMS\CoreBundle\Form\DirectorJuryUserType;
use ChamiloLMS\CoreBundle\Form\JuryType;
use ChamiloLMS\CoreBundle\Entity;
use ChamiloLMS\CoreBundle\Entity\BranchSync;
use ChamiloLMS\CoreBundle\Entity\Jury;
use ChamiloLMS\CoreBundle\Entity\User;
use ChamiloLMS\CoreBundle\Entity\JuryMembers;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class RoleController
* @todo @route and @method function don't work yet
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class BranchDirectorController extends CrudController
{
public function getClass()
{
return 'ChamiloLMS\Entity\BranchSync';
return 'ChamiloLMS\CoreBundle\Entity\BranchSync';
}
public function getType()
{
return 'ChamiloLMS\Form\DirectorJuryUserType';
return 'ChamiloLMS\CoreBundle\Form\DirectorJuryUserType';
}
protected function getControllerAlias()
public function getControllerAlias()
{
return 'branch_director.controller';
}
@ -40,7 +41,7 @@ class BranchDirectorController extends CrudController
/**
* {@inheritdoc}
*/
protected function getTemplatePath()
public function getTemplatePath()
{
return 'admin/director/branches/';
}
@ -61,7 +62,7 @@ class BranchDirectorController extends CrudController
'childClose' => '</li>',
'nodeDecorator' => function ($row) {
/** @var BranchSync $branch */
$branch = $this->getManager()->getRepository('ChamiloLMS\Entity\BranchSync')->find($row['id']);
$branch = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\BranchSync')->find($row['id']);
$juries = $branch->getJuries();
/** @var Jury $jury */
$juryList = null;
@ -91,7 +92,7 @@ class BranchDirectorController extends CrudController
$query = $this->getManager()
->createQueryBuilder()
->select('node')
->from('ChamiloLMS\Entity\BranchSync', 'node')
->from('ChamiloLMS\CoreBundle\Entity\BranchSync', 'node')
->innerJoin('node.users', 'u')
->where('u.userId = :userId')
->setParameter('userId', $userId)
@ -161,7 +162,7 @@ class BranchDirectorController extends CrudController
$form->handleRequest($request);
if ($form->isValid()) {
$jury = $this->getManager()->getRepository('ChamiloLMS\Entity\Jury')->find($juryId);
$jury = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\Jury')->find($juryId);
$factory = $this->get('security.encoder_factory');
$encoder = $factory->getEncoder($user);

@ -1,14 +1,14 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Admin\JuryMember;
use ChamiloLMS\Controller\CrudController;
use ChamiloLMS\Entity\TrackExercise;
use ChamiloLMS\Entity\Jury;
use ChamiloLMS\Entity\TrackExerciseAttemptJury;
use ChamiloLMS\Entity\JuryMembers;
use ChamiloLMS\Entity;
namespace ChamiloLMS\CoreBundle\Controller\Admin\JuryMember;
use ChamiloLMS\CoreBundle\Controller\CrudController;
use ChamiloLMS\CoreBundle\Entity\TrackExercise;
use ChamiloLMS\CoreBundle\Entity\Jury;
use ChamiloLMS\CoreBundle\Entity\TrackExerciseAttemptJury;
use ChamiloLMS\CoreBundle\Entity\JuryMembers;
use ChamiloLMS\CoreBundle\Entity;
use Silex\Application;
use Symfony\Component\HttpFoundation\Response;
use Doctrine\Common\Collections\Criteria;
@ -17,7 +17,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class JuryMemberController
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class JuryMemberController extends CrudController
@ -26,7 +26,7 @@ class JuryMemberController extends CrudController
public function getClass()
{
return 'ChamiloLMS\Entity\Jury';
return 'ChamiloLMS\CoreBundle\Entity\Jury';
}
public function getControllerAlias()
@ -48,7 +48,7 @@ class JuryMemberController extends CrudController
*/
public function getType()
{
return 'ChamiloLMS\Form\JuryType';
return 'ChamiloLMS\CoreBundle\Form\JuryType';
}
/**
@ -147,7 +147,7 @@ class JuryMemberController extends CrudController
$this->createNotFoundException();
}
/** @var \ChamiloLMS\Entity\Jury $jury */
/** @var \ChamiloLMS\CoreBundle\Entity\Jury $jury */
$jury = $this->getRepository()->find($juryId);
if (empty($jury)) {
@ -190,7 +190,7 @@ class JuryMemberController extends CrudController
if ($security->isGranted('ROLE_JURY_PRESIDENT')) {
// Relating user with president
if ($member) {
$this->getManager()->getRepository('ChamiloLMS\Entity\JuryMembers')->assignUserToJuryMember(
$this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\JuryMembers')->assignUserToJuryMember(
$trackExercise['exe_user_id'],
$member->getId()
);
@ -204,7 +204,7 @@ class JuryMemberController extends CrudController
'juryUserId' => $userId
);
$trackJury = $this->getManager()->getRepository('ChamiloLMS\Entity\TrackExerciseAttemptJury')->findBy($criteria);
$trackJury = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\TrackExerciseAttemptJury')->findBy($criteria);
if ($trackJury) {
$this->get('session')->getFlashBag()->add('info', "You already review this exercise attempt.");
@ -232,11 +232,11 @@ class JuryMemberController extends CrudController
$options = array();
if ($modelType) {
/** @var \ChamiloLMS\Entity\QuestionScore $questionScoreName */
$questionScore = $this->get('orm.em')->getRepository('ChamiloLMS\Entity\QuestionScore')->find($modelType);
/** @var \ChamiloLMS\CoreBundle\Entity\QuestionScore $questionScoreName */
$questionScore = $this->get('orm.em')->getRepository('ChamiloLMS\CoreBundle\Entity\QuestionScore')->find($modelType);
if ($questionScore) {
$items = $questionScore->getItems();
/** @var \ChamiloLMS\Entity\QuestionScoreName $score */
/** @var \ChamiloLMS\CoreBundle\Entity\QuestionScoreName $score */
foreach ($items as $score) {
$options[$score->getId().':'.$score->getScore()] = $score;
}
@ -349,8 +349,8 @@ class JuryMemberController extends CrudController
public function saveScoreAction($exeId, $juryId)
{
$questionsAndScore = $this->getRequest()->get('options');
/** @var \ChamiloLMS\Entity\TrackExercise $attempt */
$attempt = $this->getManager()->getRepository('ChamiloLMS\Entity\TrackExercise')->find($exeId);
/** @var \ChamiloLMS\CoreBundle\Entity\TrackExercise $attempt */
$attempt = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\TrackExercise')->find($exeId);
$totalScore = 0;
@ -372,7 +372,7 @@ class JuryMemberController extends CrudController
$totalScore += $score;
$obj = $this->getManager()->getRepository('ChamiloLMS\Entity\TrackExerciseAttemptJury')->findOneBy($criteria);
$obj = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\TrackExerciseAttemptJury')->findOneBy($criteria);
if ($obj) {
$obj->setQuestionScoreNameId($questionScoreNameId);
$obj->setScore($score);

@ -1,15 +1,15 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Admin\JuryPresident;
namespace ChamiloLMS\CoreBundle\Controller\Admin\JuryPresident;
use ChamiloLMS\Controller\CrudController;
use ChamiloLMS\Form\JuryType;
use ChamiloLMS\Form\JuryUserType;
use ChamiloLMS\Entity\Jury;
use ChamiloLMS\Entity\JuryMembers;
use ChamiloLMS\Entity\TrackExerciseAttemptJury;
use ChamiloLMS\Entity\TrackExercise;
use ChamiloLMS\CoreBundle\Controller\CrudController;
use ChamiloLMS\CoreBundle\Form\JuryType;
use ChamiloLMS\CoreBundle\Form\JuryUserType;
use ChamiloLMS\CoreBundle\Entity\Jury;
use ChamiloLMS\CoreBundle\Entity\JuryMembers;
use ChamiloLMS\CoreBundle\Entity\TrackExerciseAttemptJury;
use ChamiloLMS\CoreBundle\Entity\TrackExercise;
use Silex\Application;
use Symfony\Component\Form\Extension\Validator\Constraints\FormValidator;
@ -23,7 +23,7 @@ use Whoops\Example\Exception;
/**
* Class RoleController
* @todo @route and @method function don't work yet
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class JuryPresidentController extends CrudController
@ -32,12 +32,12 @@ class JuryPresidentController extends CrudController
public function getClass()
{
return 'ChamiloLMS\Entity\BranchSync';
return 'ChamiloLMS\CoreBundle\Entity\BranchSync';
}
public function getType()
{
return 'ChamiloLMS\Form\JuryType';
return 'ChamiloLMS\CoreBundle\Form\JuryType';
}
public function getControllerAlias()
@ -138,7 +138,7 @@ class JuryPresidentController extends CrudController
*/
public function assignUserToJuryMemberAction($userId, $juryMemberId)
{
return $this->getManager()->getRepository('ChamiloLMS\Entity\JuryMembers')->assignUserToJuryMember($userId, $juryMemberId);
return $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\JuryMembers')->assignUserToJuryMember($userId, $juryMemberId);
}
/**
@ -147,7 +147,7 @@ class JuryPresidentController extends CrudController
*/
public function removeUserToJuryMemberAction($userId, $juryMemberId)
{
return $this->getManager()->getRepository('ChamiloLMS\Entity\JuryMembers')->removeUserToJuryMember($userId, $juryMemberId);
return $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\JuryMembers')->removeUserToJuryMember($userId, $juryMemberId);
}
/**
@ -205,7 +205,7 @@ class JuryPresidentController extends CrudController
$randomMembers = array_rand($members, $maxCount);
foreach ($randomMembers as $randomMember) {
$member = $members[$randomMember];
$this->getManager()->getRepository('ChamiloLMS\Entity\JuryMembers')->assignUserToJuryMember($userId, $member->getId());
$this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\JuryMembers')->assignUserToJuryMember($userId, $member->getId());
}
}
$this->get('session')->getFlashBag()->add('success', "Los usuarios fueron asignados al azar");

@ -1,9 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Admin\QuestionManager;
namespace ChamiloLMS\CoreBundle\Controller\Admin\QuestionManager;
use ChamiloLMS\Controller\BaseController;
use ChamiloLMS\CoreBundle\Controller\BaseController;
use Silex\Application;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
@ -12,7 +12,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class QuestionManagerController
* @todo reduce controller size
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class QuestionManagerController extends BaseController
@ -98,7 +98,7 @@ class QuestionManagerController extends BaseController
public function getCategoriesAction($id)
{
// Getting CQuizCategory repo.
$repo = $this->getManager()->getRepository('ChamiloLMS\Entity\CQuizCategory');
$repo = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\CQuizCategory');
$options = array(
'decorate' => true,
@ -143,9 +143,9 @@ class QuestionManagerController extends BaseController
// Getting CQuizCategory repo.
/** @var \Doctrine\ORM\EntityManager $em */
$em = $this->getManager();
$repo = $em->getRepository('ChamiloLMS\Entity\CQuizCategory');
$repo = $em->getRepository('ChamiloLMS\CoreBundle\Entity\CQuizCategory');
/** @var \ChamiloLMS\Entity\CQuizCategory $category */
/** @var \ChamiloLMS\CoreBundle\Entity\CQuizCategory $category */
$category = $repo->find($categoryId);
$questionColumns = \Question::getQuestionColumns();
@ -219,7 +219,7 @@ class QuestionManagerController extends BaseController
// Getting CQuizCategory repo.
/** @var \Gedmo\Tree\Entity\Repository\NestedTreeRepository $repo */
$repo = $this->getManager()->getRepository('ChamiloLMS\Entity\CQuizCategory');
$repo = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\CQuizCategory');
$categoryId = $this->getRequest()->get('categoryId');
$subtree = null;
@ -271,7 +271,7 @@ class QuestionManagerController extends BaseController
$qb = $this->getManager()->createQueryBuilder()
->select('node')
->from('ChamiloLMS\Entity\CQuizCategory', 'node')
->from('ChamiloLMS\CoreBundle\Entity\CQuizCategory', 'node')
->where('node.cId <> 0 AND node.lvl = 0')
->orderBy('node.root, node.lft', 'ASC');
@ -286,7 +286,7 @@ class QuestionManagerController extends BaseController
$query = $this->getManager()
->createQueryBuilder()
->select('node')
->from('ChamiloLMS\Entity\CQuizCategory', 'node')
->from('ChamiloLMS\CoreBundle\Entity\CQuizCategory', 'node')
->where('node.cId = 0 AND node.lvl = 0')
->orderBy('node.root, node.lft', 'ASC')
->getQuery();
@ -395,7 +395,7 @@ class QuestionManagerController extends BaseController
*/
public function deleteCategoryAction($id)
{
$repo = $this->getManager()->getRepository('ChamiloLMS\Entity\CQuizCategory');
$repo = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\CQuizCategory');
$category = $repo->find($id);
if (empty($category)) {
$this->abort(404);

@ -1,15 +1,15 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\App\Certificate;
namespace ChamiloLMS\CoreBundle\Controller\App\Certificate;
use ChamiloLMS\Controller\BaseController;
use ChamiloLMS\CoreBundle\Controller\BaseController;
use Silex\Application;
use Symfony\Component\HttpFoundation\Response;
/**
* Class CertificateController
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class CertificateController extends BaseController

@ -1,17 +1,17 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\App\Editor;
namespace ChamiloLMS\CoreBundle\Controller\App\Editor;
use ChamiloLMS\Controller\BaseController;
use ChamiloLMS\CoreBundle\Controller\BaseController;
use Silex\Application;
use Symfony\Component\HttpFoundation\Response;
use ChamiloLMS\Component\Editor\Connector;
use ChamiloLMS\Component\Editor\Finder;
use ChamiloLMS\CoreBundle\Component\Editor\Connector;
use ChamiloLMS\CoreBundle\Component\Editor\Finder;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use ChamiloLMS\Component\Editor\Driver\elFinderVolumePersonalDriver;
use ChamiloLMS\CoreBundle\Component\Editor\Driver\elFinderVolumePersonalDriver;
/**
* @package ChamiloLMS.Controller
@ -48,7 +48,7 @@ class EditorController extends BaseController
*/
public function getTemplatesAction()
{
$templates = $this->getManager()->getRepository('ChamiloLMS\Entity\SystemTemplate')->findAll();
$templates = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\SystemTemplate')->findAll();
$templates = $this->getHtmlEditor()->formatTemplates($templates);
$this->getTemplate()->assign('templates', $templates);
$response = $this->getTemplate()->renderTemplate('javascript/editor/ckeditor/templates.tpl');

@ -1,14 +1,14 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\App\ModelAjax;
namespace ChamiloLMS\CoreBundle\Controller\App\ModelAjax;
use Silex\Application;
use Symfony\Component\HttpFoundation\Response;
/**
* Class ModelAjaxController should replace the model.ajax.php file
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class ModelAjaxController

@ -1,9 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\App\News;
namespace ChamiloLMS\CoreBundle\Controller\App\News;
use ChamiloLMS\Controller\BaseController;
use ChamiloLMS\CoreBundle\Controller\BaseController;
use Silex\Application;
use Symfony\Component\HttpFoundation\Response;
@ -12,7 +12,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class NewsController
* @package ChamiloLMS\Controller\App\News
* @package ChamiloLMS\CoreBundle\Controller\App\News
* @author Julio Montoya <gugli100@gmail.com>
*/
class NewsController extends BaseController

@ -1,17 +1,17 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\App\SessionPath;
namespace ChamiloLMS\CoreBundle\Controller\App\SessionPath;
use Silex\Application;
use ChamiloLMS\Controller\CrudController;
use ChamiloLMS\CoreBundle\Controller\CrudController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use ChamiloLMS\Entity\SessionPath;
use ChamiloLMS\Form\SessionPathType;
use ChamiloLMS\CoreBundle\Entity\SessionPath;
use ChamiloLMS\CoreBundle\Form\SessionPathType;
/**
* @package ChamiloLMS.Controller
@ -21,7 +21,7 @@ class SessionPathController extends CrudController
{
public function getClass()
{
return 'ChamiloLMS\Entity\SessionPath';
return 'ChamiloLMS\CoreBundle\Entity\SessionPath';
}
public function getControllerAlias()
@ -42,7 +42,7 @@ class SessionPathController extends CrudController
*/
public function getType()
{
return 'ChamiloLMS\Form\SessionPathType';
return 'ChamiloLMS\CoreBundle\Form\SessionPathType';
}
/**
@ -71,12 +71,12 @@ class SessionPathController extends CrudController
);
// @todo put this in a function
$repo = $this->get('orm.em')->getRepository('ChamiloLMS\Entity\SessionTree');
$repo = $this->get('orm.em')->getRepository('ChamiloLMS\CoreBundle\Entity\SessionTree');
$query = $this->getManager()
->createQueryBuilder()
->select('node')
->from('ChamiloLMS\Entity\SessionTree', 'node')
->from('ChamiloLMS\CoreBundle\Entity\SessionTree', 'node')
//->where('node.cId = 0')
->orderBy('node.root, node.lft', 'ASC')
->getQuery();

@ -1,17 +1,17 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\App\SessionPath;
namespace ChamiloLMS\CoreBundle\Controller\App\SessionPath;
use Silex\Application;
use ChamiloLMS\Controller\BaseController;
use ChamiloLMS\CoreBundle\Controller\BaseController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use ChamiloLMS\Entity\SessionPath;
use ChamiloLMS\Form\SessionTreeType;
use ChamiloLMS\CoreBundle\Entity\SessionPath;
use ChamiloLMS\CoreBundle\Form\SessionTreeType;
/**
* @package ChamiloLMS.Controller
@ -21,12 +21,12 @@ class SessionTreeController extends BaseController
{
public function getClass()
{
return 'ChamiloLMS\Entity\SessionTree';
return 'ChamiloLMS\CoreBundle\Entity\SessionTree';
}
public function getType()
{
return 'ChamiloLMS\Form\SessionTreeType';
return 'ChamiloLMS\CoreBundle\Form\SessionTreeType';
}
/**

@ -0,0 +1,228 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\CoreBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Knp\Menu\Matcher\Matcher;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\DependencyInjection\Container;
use Knp\Menu\FactoryInterface as MenuFactoryInterface;
use Knp\Menu\ItemInterface as MenuItemInterface;
use Knp\Menu\Renderer\ListRenderer;
/**
* Each entity controller must extends this class.
*
* @abstract
*/
abstract class BaseController extends Controller
{
/**
* @return object
*/
public function getSecurity()
{
return $this->container->get('security.context');
}
public function getSessionHandler()
{
return $this->getRequest()->getSession();
}
/**
* @return object
*/
public function getTemplate()
{
return $this->container->get('templating');
}
/**
* @return NotFoundHttpException
*/
public function abort()
{
return new NotFoundHttpException();
}
/**
* Converts string 'ChamiloLMS\CoreBundle\Controller\Admin\QuestionManager' into
* 'admin/question_manager'
*/
public function getTemplatePath()
{
$parts = $this->classParts;
$newPath = array();
foreach ($parts as $part) {
if (in_array($part, array('chamilo_lms', 'controller'))
//strpos($part, '_controller') > 0
) {
continue;
}
$newPath[] = $part;
}
$template = implode('/', $newPath);
return str_replace('_controller', '', $template);
}
/**
* Transforms 'QuestionManagerController' to 'question_manager.controller'
* @return string
*/
public function getControllerAlias()
{
$parts = $this->classParts;
$parts = array_reverse($parts);
$alias = str_replace('_controller', '.controller', $parts[0]);
return $alias;
}
/**
* Translator shortcut
* @param string $variable
* @return string
*/
public function trans($variable)
{
return $this->container->get('translator')->trans($variable);
}
/**
* Returns the class name label
* @example RoleController -> Role
*
* @return string the class name label
*/
public function getClassNameLabel()
{
return $this->classNameLabel;
}
/**
* @return MenuFactoryInterface
*/
public function getMenuFactory()
{
return $this->container->get('knp_menu.factory');
}
/**
* @param string $action
* @return MenuItemInterface
*/
protected function getBreadcrumbs($action)
{
$breadcrumbs = $this->buildBreadcrumbs($action);
return $breadcrumbs;
}
/** Main home URL
* @return MenuItemInterface
*/
protected function getHomeBreadCrumb()
{
$menu = $this->getMenuFactory()->createItem(
'root',
array(
'childrenAttributes' => array(
'class' => 'breadcrumb',
'currentClass' => 'active'
)
)
);
$menu->addChild(
$this->trans('Home'),
array('uri' => $this->generateUrl('home'))
);
return $menu;
}
/**
* @param $action
* @param MenuItemInterface $menu
* @return MenuItemInterface
*/
public function buildBreadcrumbs($action, MenuItemInterface $menu = null)
{
if (!$menu) {
$menu = $this->getHomeBreadCrumb();
}
$menu->addChild(
$this->trans($this->getClassnameLabel().'List'),
array('uri' => $this->generateControllerUrl('listingAction'))
);
$action = str_replace(
array($this->getControllerAlias().':', 'Action'),
'',
$action
);
switch ($action) {
case 'add':
case 'edit':
$menu->addChild(
$this->trans($this->getClassnameLabel().ucfirst($action))
//array('uri' => $this->generateControllerUrl($action.'Action'))
);
break;
}
return $menu;
}
/**
* @param array $breadCrumbList
* @return string
*/
protected function parseLegacyBreadCrumb($breadCrumbList = array())
{
$menu = $this->getHomeBreadCrumb();
foreach ($breadCrumbList as $item) {
$menu->addChild(
$this->trans($item['title']),
array('uri' => $item['url'])
);
}
$renderer = new ListRenderer(new \Knp\Menu\Matcher\Matcher());
$result = $renderer->render($menu);
return $result;
}
/**
* Renders the current controller template
* @param string $name
* @param array $elements
* @return mixed
*/
public function renderTemplate($name, $elements = array())
{
$name = $this->getTemplatePath().'/'.$name;
$renderer = new ListRenderer(new \Knp\Menu\Matcher\Matcher());
$action = $this->getRequest()->get('_route');
$result = $renderer->render($this->getBreadcrumbs($action));
$elements['new_breadcrumb'] = $result;
return $this->getTemplate()->renderTemplate($name, $elements);
}
}

@ -1,7 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller;
namespace ChamiloLMS\CoreBundle\Controller;
use Doctrine\ORM\Query;
use Doctrine\ORM\NoResultException;
@ -17,7 +17,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class CrudController
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
*/
abstract class CrudController extends BaseController implements CrudControllerInterface
{
@ -244,6 +244,39 @@ abstract class CrudController extends BaseController implements CrudControllerIn
}
}
/**
* @Route("/export/{format}")
* @Method({"GET"})
*/
public function exportAction($format = 'csv')
{
$qb = $this->getRepository()->createQueryBuilder('e');
$query = $qb->getQuery();
$source = new \Exporter\Source\DoctrineORMQuerySourceIterator($query, array('id'));
// Prepare the writer
$writer = new \Exporter\Writer\CsvWriter('data2.csv');
$filename = sprintf('export_%s_%s.%s',
strtolower(substr($this->getClassNameLabel(), strripos($this->getClassNameLabel(), '\\') + 1)),
date('Y_m_d_H_i_s', strtotime('now')),
$format
);
return $this->get('exporter')->getResponse(
$format,
$filename,
$this->getDataSourceIterator()
);
}
public function getDataSourceIterator()
{
}
/**
* Base "read" action.
*
@ -288,6 +321,7 @@ abstract class CrudController extends BaseController implements CrudControllerIn
return $this->getList($format);
}
/**
* @param string $format
* @return JsonResponse

@ -1,22 +1,22 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller;
namespace ChamiloLMS\CoreBundle\Controller;
/**
* Interface CrudControllerInterface
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
*/
interface CrudControllerInterface
{
/**
* Returns the entity class example: 'ChamiloLMS\Entity\Role'
* Returns the entity class example: 'ChamiloLMS\CoreBundle\Entity\Role'
* @return string
*/
public function getClass();
/**
* Returns the form type name example: 'ChamiloLMS\Form\RoleType'
* Returns the form type name example: 'ChamiloLMS\CoreBundle\Form\RoleType'
* @return string
*/
public function getType();

@ -1,31 +1,40 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller;
namespace ChamiloLMS\CoreBundle\Controller;
use Silex\Application;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use ChamiloLMS\CoreBundle\Controller\BaseController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
/**
* @package ChamiloLMS.Controller
* @author Julio Montoya <gugli100@gmail.com>
* Class IndexController
* author Julio Montoya <gugli100@gmail.com>
* @package ChamiloLMS\CoreBundle\Controller
*/
class IndexController extends BaseController
{
/**
* @Route("/index")
* @Route("/index", name="index")
* @Route("/")
* @Method({"GET"})
* @return Response
*/
public function indexAction()
{
$template = $this->getTemplate();
return $this->render(
'ChamiloLMSCoreBundle:Index:index.html.twig',
array('content' => 'julio')
);
//$template = $this->get('templating');
// $countries = Intl::getRegionBundle()->getCountryNames('es');
//var_dump($countries);
@ -35,28 +44,21 @@ class IndexController extends BaseController
echo $formatter->format(time());*/
$extra = array();
if ($this->getSetting('use_virtual_keyboard') == 'true') {
/* if ($this->getSetting('use_virtual_keyboard') == 'true') {
$extra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH).'keyboard/keyboard.css');
$extra[] = api_get_js('keyboard/jquery.keyboard.js');
}
}*/
$template->addResource(api_get_jqgrid_js(), 'string');
//$template->addResource(api_get_jqgrid_js(), 'string');
$this->app['this_section'] = SECTION_CAMPUS;
//$this->app['this_section'] = SECTION_CAMPUS;
/** @var \PageController $pageController */
$pageController = $this->get('page_controller');
//$pageController = $this->get('page_controller');
if (api_get_setting('display_categories_on_homepage') == 'true') {
$template->assign('course_category_block', $pageController->return_courses_in_categories());
//$template->assign('course_category_block', $pageController->return_courses_in_categories());
}
// @todo Custom Facebook connection lib could be replaced with opauth
// Facebook connection, if activated
if (api_is_facebook_auth_activated() && !api_get_user_id()) {
facebook_connect();
}
$this->setLoginForm();
if (!api_is_anonymous()) {
@ -402,7 +404,7 @@ class IndexController extends BaseController
}
/**
* @Route("/userportal")
* @Route("/userportal", name="userportal")
* @Method({"GET"})
*
* @param string $type courses|sessions|mycoursecategories
@ -412,21 +414,18 @@ class IndexController extends BaseController
*/
public function userPortalAction($type = 'courses', $filter = 'current', $page = 1)
{
// @todo Use filters like "after/before|finish" to manage user access
api_block_anonymous_users();
// Abort request because the user is not allowed here - @todo use filters
if ($this->app['allowed'] == false) {
/*if ($this->app['allowed'] == false) {
return $this->abort(403, 'Not allowed');
}
}*/
// Main courses and session list
$items = null;
$type = str_replace('/', '', $type);
/** @var \PageController $pageController */
$pageController = $this->get('page_controller');
$pageController = new \ChamiloLMS\CoreBundle\Framework\PageController();
switch ($type) {
case 'sessions':
@ -459,26 +458,27 @@ class IndexController extends BaseController
return $menu;
};
$app['knp_menu.menus'] = array('main' => 'my_main_menu');*/
$template->assign('content', $items);
$pageController->setCourseSessionMenu();
/*$pageController->setCourseSessionMenu();
$pageController->setProfileBlock();
$pageController->setUserImageBlock();
$pageController->setCourseBlock($filter);
$pageController->setSessionBlock();
$pageController->return_reservation_block();
$pageController->returnNavigationLinks($template->getNavigationLinks());
$pageController->returnNavigationLinks($template->getNavigationLinks());*/
$template->assign('search_block', $pageController->return_search_block());
$template->assign('classes_block', $pageController->return_classes_block());
//$template->assign('search_block', $pageController->return_search_block());
//$template->assign('classes_block', $pageController->return_classes_block());
$pageController->returnSkillsLinks();
// Deleting the session_id.
$this->getSessionHandler()->remove('session_id');
$response = $template->renderTemplate('userportal/index.tpl');
return new Response($response, 200, array());
return $this->render(
'ChamiloLMSCoreBundle:Index:userportal.html.twig',
array('content' => $items)
);
}
/**

@ -0,0 +1,116 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\CoreBundle\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use \ChamiloSession as Session;
use Display;
/**
* Class LegacyController
* Manages the chamilo pages starting with Display::display_header and $tpl = new Template();
* @package ChamiloLMS\CoreBundle\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class LegacyController extends BaseController
{
public $section;
/**
* @param $name
* @return Response
*/
public function classicAction($name)
{
$responseHeaders = array();
$request = $this->getRequest();
// get.
$_GET = $request->query->all();
// post.
$_POST = $request->request->all();
// echo $request->getMethod();
$rootDir = $this->get('kernel')->getRealRootDir();
//$_REQUEST = $request->request->all();
$mainPath = $rootDir.'main/';
$fileToLoad = $mainPath.$name;
// Legacy inclusions
Session::setSession($this->getRequest()->getSession());
$dbConnection = $this->container->get('database_connection');
$database = new \Database($dbConnection, array());
Session::$urlGenerator = $this->container->get('router');
Session::$security = $this->container->get('security.context');
Session::$translator = $this->container->get('translator');
Session::$rootDir = $this->container->get('kernel')->getRealRootDir();
Session::$logDir = $this->container->get('kernel')->getLogDir();
Session::$dataDir = $this->container->get('kernel')->getDataDir();
Session::$tempDir = $this->container->get('kernel')->getCacheDir();
Session::$courseDir = $this->container->get('kernel')->getDataDir();
Session::$configDir = $this->container->get('kernel')->getConfigDir();
if (is_file($fileToLoad) &&
\Security::check_abs_path($fileToLoad, $mainPath)
) {
$toolNameFromFile = basename(dirname($fileToLoad));
// Default values
/*$_course = api_get_course_info();
$_user = api_get_user_info();
$charset = 'UTF-8';
$text_dir = api_get_text_direction();
$is_platformAdmin = api_is_platform_admin();
$_cid = api_get_course_id();*/
$debug = $this->container->get('kernel')->getEnvironment() == 'dev' ? true : false;
// Loading file
ob_start();
require_once $fileToLoad;
$out = ob_get_contents();
ob_end_clean();
// No browser cache when executing an exercise.
if ($name == 'exercice/exercise_submit.php') {
$responseHeaders = array(
'cache-control' => 'no-store, no-cache, must-revalidate'
);
}
// Setting page header/footer conditions (important for LPs)
//$this->getTemplate()->setFooter($app['template.show_footer']);
//$this->getTemplate()->setHeader($app['template.show_header']);
if (isset($htmlHeadXtra)) {
//$this->getTemplate()->addResource($htmlHeadXtra, 'string');
}
// $interbreadcrumb is loaded in the require_once file.
$interbreadcrumb = isset($interbreadcrumb) ? $interbreadcrumb : null;
//$this->getTemplate()->setBreadcrumb($interbreadcrumb);
//$breadCrumb = $this->getTemplate()->getBreadCrumbLegacyArray();
//$menu = $this->parseLegacyBreadCrumb($breadCrumb);
//$this->getTemplate()->assign('new_breadcrumb', $menu);
//$this->getTemplate()->parseResources();
/*if (isset($tpl)) {
$response = $app['twig']->render($app['default_layout']);
} else {
$this->getTemplate()->assign('content', $out);
$response = $app['twig']->render($app['default_layout']);
}*/
return $this->render(
'ChamiloLMSCoreBundle:Legacy:index.html.twig',
array('content' => $out)
);
} else {
throw new NotFoundHttpException();
}
}
}

@ -1,29 +1,29 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Tool\CourseHome;
namespace ChamiloLMS\CoreBundle\Controller\Tool\CourseHome;
use ChamiloLMS\Controller\ToolBaseController;
use Silex\Application;
use ChamiloLMS\CoreBundle\Controller\ToolBaseController;
use Symfony\Component\HttpFoundation\Response;
use ChamiloLMS\Controller\CrudController;
use ChamiloLMS\CoreBundle\Controller\CrudController;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use ChamiloLMS\Entity\CTool;
use ChamiloLMS\Form\CourseHomeToolType;
use ChamiloLMS\CoreBundle\Entity\CTool;
use ChamiloLMS\CoreBundle\Form\CourseHomeToolType;
use Doctrine\Common\Collections\Criteria;
use Display;
/**
* Class CourseHomeController
* @package ChamiloLMS\Controller\Tool\CourseHome
* @package ChamiloLMS\CoreBundle\Controller\Tool\CourseHome
* @author Julio Montoya <gugli100@gmail.com>
* @Route("/course_home")
*/
class CourseHomeController extends ToolBaseController
{
public function getClass()
{
return 'ChamiloLMS\Entity\CTool';
return 'ChamiloLMS\CoreBundle\Entity\CTool';
}
/**
@ -31,7 +31,7 @@ class CourseHomeController extends ToolBaseController
*/
public function getType()
{
return 'ChamiloLMS\Form\CourseHomeToolType';
return 'ChamiloLMS\CoreBundle\Form\CourseHomeToolType';
}
/**
@ -60,15 +60,18 @@ class CourseHomeController extends ToolBaseController
if ($showAutoLaunchExerciseWarning) {
$this->addMessage('TheExerciseAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificExercise', 'warning');
}
if ($this->isCourseTeacher()) {
if (true) {
//if ($this->isCourseTeacher()) {
$editIcons = Display::url(
Display::return_icon('edit.png'),
$this->generateControllerUrl('iconListAction', array('courseCode' => api_get_course_id()))
$this->generateUrl(
'chamilolms_core_tool_coursehome_coursehome_iconlist',
array('courseCode' => api_get_course_id())
)
);
$this->getTemplate()->assign('edit_icons', $editIcons);
//$this->getTemplate()->addg('edit_icons', $editIcons);
}
if (!isset($coursesAlreadyVisited[$courseCode])) {
@ -102,22 +105,28 @@ class CourseHomeController extends ToolBaseController
$result = require_once api_get_path(SYS_CODE_PATH).'course_home/'.$script;
$toolList = $result['tool_list'];
$this->getTemplate()->assign('icons', $result['content']);
$introduction = Display::return_introduction_section(
$this->get('url_generator'),
$this->get('router'),
TOOL_COURSE_HOMEPAGE,
$toolList
);
$this->getTemplate()->assign('introduction_text', $introduction);
$sessionInfo = null;
if (api_get_setting('show_session_data') == 'true' && $sessionId) {
$sessionInfo = \CourseHome::show_session_data($sessionId);
$this->getTemplate()->assign('session_info', $sessionInfo);
}
$response = $this->renderTemplate('index.tpl');
$response = $this->render(
'ChamiloLMSCoreBundle:Tool:CourseHome/index.html.twig',
array(
'session_info' => $sessionInfo,
'icons' => $result['content'],
'edit_icons' => $editIcons,
'introduction_text' => $introduction,
'exercise_warning' => null,
'lp_warning' => null
)
);
return new Response($response, 200, array());
}
@ -297,7 +306,7 @@ class CourseHomeController extends ToolBaseController
}
$entityManager = $this->getManager();
$criteria = array('cId' => api_get_course_int_id(), 'id' => $iconId);
$tool = $this->getRepository('ChamiloLMS\Entity\CTool')->findOneBy($criteria);
$tool = $this->getRepository('ChamiloLMS\CoreBundle\Entity\CTool')->findOneBy($criteria);
if ($tool) {
$tool->setVisibility(1);
}
@ -320,7 +329,7 @@ class CourseHomeController extends ToolBaseController
$entityManager = $this->getManager();
$criteria = array('cId' => api_get_course_int_id(), 'id' => $iconId);
$tool = $this->getRepository('ChamiloLMS\Entity\CTool')->findOneBy($criteria);
$tool = $this->getRepository('ChamiloLMS\CoreBundle\Entity\CTool')->findOneBy($criteria);
if ($tool) {
$tool->setVisibility(0);
}
@ -343,7 +352,7 @@ class CourseHomeController extends ToolBaseController
$entityManager = $this->getManager();
$criteria = array('cId' => api_get_course_int_id(), 'id' => $iconId, 'added_tool' => 1);
$tool = $this->getRepository('ChamiloLMS\Entity\CTool')->findOneBy($criteria);
$tool = $this->getRepository('ChamiloLMS\CoreBundle\Entity\CTool')->findOneBy($criteria);
$entityManager->remove($tool);
//$entityManager->flush();
return Display::return_message(get_lang('Deleted'), 'confirmation');
@ -364,7 +373,7 @@ class CourseHomeController extends ToolBaseController
$query = $this->getManager()->createQueryBuilder('a');
$query->select('s');
$query->from('ChamiloLMS\Entity\CTool', 's');
$query->from('ChamiloLMS\CoreBundle\Entity\CTool', 's');
$query->where('s.cId = :courseId AND s.sessionId = :sessionId')
->setParameters(
array(
@ -382,7 +391,7 @@ class CourseHomeController extends ToolBaseController
//$itemsFromSession = $this->getRepository()->findBy($criteria);
$query = $this->getManager()->createQueryBuilder('a');
$query->select('s');
$query->from('ChamiloLMS\Entity\CTool', 's');
$query->from('ChamiloLMS\CoreBundle\Entity\CTool', 's');
$query->where('s.cId = :courseId AND s.sessionId = 0')
->setParameters(
array(
@ -442,7 +451,7 @@ class CourseHomeController extends ToolBaseController
$query = $this->getManager()->createQueryBuilder('a');
$query->select('MAX(s.id) as id');
$query->from('ChamiloLMS\Entity\CTool', 's');
$query->from('ChamiloLMS\CoreBundle\Entity\CTool', 's');
$query->where('s.cId = :courseId')->setParameter('courseId', $this->getCourse()->getId());
$result = $query->getQuery()->getArrayResult();
$maxId = $result[0]['id'] + 1;

@ -1,27 +1,27 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Tool\Curriculum;
namespace ChamiloLMS\CoreBundle\Controller\Tool\Curriculum;
use ChamiloLMS\Controller\CrudController;
use ChamiloLMS\CoreBundle\Controller\CrudController;
use Silex\Application;
use Symfony\Component\Form\Extension\Validator\Constraints\FormValidator;
use Symfony\Component\HttpFoundation\Response;
use ChamiloLMS\Entity\CurriculumCategory;
use ChamiloLMS\Form\CurriculumCategoryType;
use ChamiloLMS\CoreBundle\Entity\CurriculumCategory;
use ChamiloLMS\CoreBundle\Form\CurriculumCategoryType;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class CurriculumController
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class CurriculumCategoryController extends CrudController
{
public function getClass()
{
return 'ChamiloLMS\Entity\CurriculumCategory';
return 'ChamiloLMS\CoreBundle\Entity\CurriculumCategory';
}
/**
@ -37,7 +37,7 @@ class CurriculumCategoryController extends CrudController
*/
public function getType()
{
return 'ChamiloLMS\Form\CurriculumCategoryType';
return 'ChamiloLMS\CoreBundle\Form\CurriculumCategoryType';
}
public function getControllerAlias()
@ -123,7 +123,7 @@ class CurriculumCategoryController extends CrudController
$qb = $this->getManager()
->createQueryBuilder()
->select('node, i')
->from('ChamiloLMS\Entity\CurriculumCategory', 'node')
->from('ChamiloLMS\CoreBundle\Entity\CurriculumCategory', 'node')
->leftJoin('node.items', 'i')
->innerJoin('node.course', 'c')
->orderBy('node.root, node.lft', 'ASC');
@ -362,7 +362,7 @@ class CurriculumCategoryController extends CrudController
$qb = $this->getManager()
->createQueryBuilder()
->select('node.id, u.userId, SUM(i.score) as score')
->from('ChamiloLMS\Entity\CurriculumCategory', 'node')
->from('ChamiloLMS\CoreBundle\Entity\CurriculumCategory', 'node')
->innerJoin('node.course', 'c')
->innerJoin('node.items', 'i')
->innerJoin('i.userItems', 'u')

@ -1,20 +1,20 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Tool\Curriculum;
namespace ChamiloLMS\CoreBundle\Controller\Tool\Curriculum;
use ChamiloLMS\Controller\BaseController;
use ChamiloLMS\CoreBundle\Controller\BaseController;
use Silex\Application;
use Symfony\Component\Form\Extension\Validator\Constraints\FormValidator;
use Symfony\Component\HttpFoundation\Response;
use Entity;
use ChamiloLMS\Form\CurriculumItemType;
use ChamiloLMS\CoreBundle\Form\CurriculumItemType;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class CurriculumController
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class CurriculumController extends BaseController

@ -1,21 +1,21 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Tool\Curriculum;
namespace ChamiloLMS\CoreBundle\Controller\Tool\Curriculum;
use ChamiloLMS\Controller\CrudController;
use ChamiloLMS\CoreBundle\Controller\CrudController;
use Silex\Application;
use Symfony\Component\Form\Extension\Validator\Constraints\FormValidator;
use Symfony\Component\HttpFoundation\Response;
use ChamiloLMS\Entity\CurriculumItem;
use ChamiloLMS\Entity\CurriculumCategory;
use ChamiloLMS\Form\CurriculumItemType;
use ChamiloLMS\CoreBundle\Entity\CurriculumItem;
use ChamiloLMS\CoreBundle\Entity\CurriculumCategory;
use ChamiloLMS\CoreBundle\Form\CurriculumItemType;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class CurriculumItemController
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class CurriculumItemController extends CrudController
@ -38,7 +38,7 @@ class CurriculumItemController extends CrudController
*/
public function getClass()
{
return 'ChamiloLMS\Entity\CurriculumItem';
return 'ChamiloLMS\CoreBundle\Entity\CurriculumItem';
}
/**
@ -46,7 +46,7 @@ class CurriculumItemController extends CrudController
*/
public function getType()
{
return 'ChamiloLMS\Form\CurriculumItemType';
return 'ChamiloLMS\CoreBundle\Form\CurriculumItemType';
}
/**
@ -120,7 +120,7 @@ class CurriculumItemController extends CrudController
$entity = new CurriculumItem();
$category = $this->get('orm.em')->getRepository('ChamiloLMS\Entity\CurriculumCategory')->find($id);
$category = $this->get('orm.em')->getRepository('ChamiloLMS\CoreBundle\Entity\CurriculumCategory')->find($id);
$entity->setCategory($category);
$form = $this->get('form.factory')->create($formType, $entity);

@ -1,16 +1,16 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Tool\Curriculum;
namespace ChamiloLMS\CoreBundle\Controller\Tool\Curriculum;
use ChamiloLMS\Controller\CrudController;
use ChamiloLMS\CoreBundle\Controller\CrudController;
use Silex\Application;
use Symfony\Component\Form\Extension\Validator\Constraints\FormValidator;
use Symfony\Component\HttpFoundation\Response;
use ChamiloLMS\Entity\CurriculumItemRelUser;
use ChamiloLMS\Entity\CurriculumItem;
use ChamiloLMS\Entity\Repository\CurriculumItemRelUserRepository;
use ChamiloLMS\Form\CurriculumItemRelUserCollectionType;
use ChamiloLMS\CoreBundle\Entity\CurriculumItemRelUser;
use ChamiloLMS\CoreBundle\Entity\CurriculumItem;
use ChamiloLMS\CoreBundle\Entity\Repository\CurriculumItemRelUserRepository;
use ChamiloLMS\CoreBundle\Form\CurriculumItemRelUserCollectionType;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
@ -18,7 +18,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class CurriculumUserController
* @todo @route and @method function don't work yet
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class CurriculumUserController extends CrudController
@ -42,7 +42,7 @@ class CurriculumUserController extends CrudController
*/
public function getClass()
{
return 'ChamiloLMS\Entity\CurriculumItemRelUser';
return 'ChamiloLMS\CoreBundle\Entity\CurriculumItemRelUser';
}
/**
@ -50,7 +50,7 @@ class CurriculumUserController extends CrudController
*/
public function getType()
{
return 'ChamiloLMS\Form\CurriculumItemRelUserCollectionType';
return 'ChamiloLMS\CoreBundle\Form\CurriculumItemRelUserCollectionType';
}
protected function generateDefaultCrudRoutes()
@ -95,7 +95,7 @@ class CurriculumUserController extends CrudController
$qb = $this->getManager()
->createQueryBuilder()
->select('node, i, u')
->from('ChamiloLMS\Entity\CurriculumCategory', 'node')
->from('ChamiloLMS\CoreBundle\Entity\CurriculumCategory', 'node')
->innerJoin('node.course', 'c')
->leftJoin('node.items', 'i')
->leftJoin('i.userItems', 'u', 'WITH', 'u.userId = :userId OR u.userId IS NULL')
@ -109,10 +109,10 @@ class CurriculumUserController extends CrudController
$categories = $query->getResult();
$formList = array();
/** @var \ChamiloLMS\Entity\CurriculumCategory $category */
/** @var \ChamiloLMS\CoreBundle\Entity\CurriculumCategory $category */
foreach ($categories as $category) {
/** @var \ChamiloLMS\Entity\CurriculumItem $item */
/** @var \ChamiloLMS\CoreBundle\Entity\CurriculumItem $item */
foreach ($category->getItems() as $item) {
$formType = new CurriculumItemRelUserCollectionType($item->getId());
@ -181,7 +181,7 @@ class CurriculumUserController extends CrudController
$query = $this->getManager()
->createQueryBuilder()
->select('node, i, u')
->from('ChamiloLMS\Entity\CurriculumCategory', 'node')
->from('ChamiloLMS\CoreBundle\Entity\CurriculumCategory', 'node')
->innerJoin('node.items', 'i')
->innerJoin('i.userItems', 'u')
->orderBy('node.root, node.lft', 'ASC')
@ -192,7 +192,7 @@ class CurriculumUserController extends CrudController
$categories = $query->getResult();
/** @var \ChamiloLMS\Entity\CurriculumCategory $category */
/** @var \ChamiloLMS\CoreBundle\Entity\CurriculumCategory $category */
$alreadyAdded = array();
foreach ($categories as $category) {
@ -208,7 +208,7 @@ class CurriculumUserController extends CrudController
}
// @todo check this
$user = $this->get('orm.em')->getRepository('ChamiloLMS\Entity\User')->find($user->getUserId());
$user = $this->get('orm.em')->getRepository('ChamiloLMS\CoreBundle\Entity\User')->find($user->getUserId());
$counter = 1;
$parsed = array();
@ -315,7 +315,7 @@ class CurriculumUserController extends CrudController
$qb = $this->getManager()
->createQueryBuilder()
->select('node, i, u')
->from('ChamiloLMS\Entity\CurriculumCategory', 'node')
->from('ChamiloLMS\CoreBundle\Entity\CurriculumCategory', 'node')
->innerJoin('node.course', 'c')
->leftJoin('node.items', 'i')
->leftJoin('i.userItems', 'u', 'WITH', 'u.userId = :userId OR u.userId IS NULL')
@ -325,7 +325,7 @@ class CurriculumUserController extends CrudController
$query = $qb->getQuery();
$categories = $query->getResult();
foreach ($categories as $category) {
/** @var \ChamiloLMS\Entity\CurriculumItem $item */
/** @var \ChamiloLMS\CoreBundle\Entity\CurriculumItem $item */
$score = 0;
foreach ($category->getItems() as $item) {
@ -369,12 +369,12 @@ class CurriculumUserController extends CrudController
private function getCurriculumCategoryRepository()
{
return $this->get('orm.em')->getRepository('ChamiloLMS\Entity\CurriculumCategory');
return $this->get('orm.em')->getRepository('ChamiloLMS\CoreBundle\Entity\CurriculumCategory');
}
private function getCurriculumItemRepository()
{
return $this->get('orm.em')->getRepository('ChamiloLMS\Entity\CurriculumItem');
return $this->get('orm.em')->getRepository('ChamiloLMS\CoreBundle\Entity\CurriculumItem');
}
}

@ -1,9 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Tool\Exercise;
namespace ChamiloLMS\CoreBundle\Controller\Tool\Exercise;
use ChamiloLMS\Controller\BaseController;
use ChamiloLMS\CoreBundle\Controller\BaseController;
use Silex\Application;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;

@ -1,29 +1,30 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Tool\Introduction;
namespace ChamiloLMS\CoreBundle\Controller\Tool\Introduction;
use ChamiloLMS\Entity\CToolIntro;
use ChamiloLMS\CoreBundle\Entity\CToolIntro;
use Symfony\Component\HttpFoundation\Response;
use ChamiloLMS\Controller\CrudController;
use ChamiloLMS\CoreBundle\Controller\CrudController;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class IntroductionToolController
* @package ChamiloLMS\Controller\Tool\Introduction
* @package ChamiloLMS\CoreBundle\Controller\Tool\Introduction
* @author Julio Montoya <gugli100@gmail.com>
* @Route("/introduction")
*/
class IntroductionController extends CrudController
{
public function getClass()
{
return 'ChamiloLMS\Entity\CToolIntro';
return 'ChamiloLMS\CoreBundle\Entity\CToolIntro';
}
public function getType()
{
return 'ChamiloLMS\Form\BranchType';
return 'ChamiloLMS\CoreBundle\Form\BranchType';
}
public function getControllerAlias()
@ -57,7 +58,8 @@ class IntroductionController extends CrudController
$TBL_INTRODUCTION = \Database::get_course_table(TABLE_TOOL_INTRO);
$url = $this->generateUrl(
'introduction.controller:editAction',
//'introduction.controller:editAction',
'chamilolms_core_tool_introduction_introduction_edit',
array('tool' => $tool, 'courseCode' => api_get_course_id())
);
@ -119,7 +121,7 @@ class IntroductionController extends CrudController
}
$url = $this->generateUrl(
'introduction.controller:editAction',
'chamilolms_core_tool_introduction_introduction_edit',
array('tool' => $tool, 'courseCode' => api_get_course_id())
);

@ -1,15 +1,15 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\Tool\LearningPath;
namespace ChamiloLMS\CoreBundle\Controller\Tool\LearningPath;
use ChamiloLMS\Controller\BaseController;
use ChamiloLMS\CoreBundle\Controller\BaseController;
use Silex\Application;
use Symfony\Component\HttpFoundation\Response;
/**
* Class LearningPathController
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class LearningPathController extends BaseController
@ -60,14 +60,14 @@ class LearningPathController extends BaseController
$sessionId = api_get_session_id();
$session = null;
if (!empty($sessionId)) {
$session = $app['orm.em']->getRepository('ChamiloLMS\Entity\Session')->find($sessionId);
$session = $app['orm.em']->getRepository('ChamiloLMS\CoreBundle\Entity\Session')->find($sessionId);
}
// Find course.
$course = $app['orm.em']->getRepository('ChamiloLMS\Entity\Course')->find($courseId);
$course = $app['orm.em']->getRepository('ChamiloLMS\CoreBundle\Entity\Course')->find($courseId);
// Getting subscribe users to the course.
$subscribedUsers = $app['orm.em']->getRepository('ChamiloLMS\Entity\Course')->getSubscribedStudents($course);
$subscribedUsers = $app['orm.em']->getRepository('ChamiloLMS\CoreBundle\Entity\Course')->getSubscribedStudents($course);
$subscribedUsers = $subscribedUsers->getQuery();
$subscribedUsers = $subscribedUsers->execute();
@ -78,7 +78,7 @@ class LearningPathController extends BaseController
}
// Getting subscribed users to a LP.
$subscribedUsersInLp = $app['orm.em']->getRepository('ChamiloLMS\Entity\CItemProperty')->getUsersSubscribedToItem(
$subscribedUsersInLp = $app['orm.em']->getRepository('ChamiloLMS\CoreBundle\Entity\CItemProperty')->getUsersSubscribedToItem(
'learnpath',
$lpId,
$course,
@ -124,7 +124,7 @@ class LearningPathController extends BaseController
}
//Subscribed groups to a LP
$subscribedGroupsInLp = $app['orm.em']->getRepository('ChamiloLMS\Entity\CItemProperty')->getGroupsSubscribedToItem(
$subscribedGroupsInLp = $app['orm.em']->getRepository('ChamiloLMS\CoreBundle\Entity\CItemProperty')->getGroupsSubscribedToItem(
'learnpath',
$lpId,
$course,
@ -151,7 +151,7 @@ class LearningPathController extends BaseController
'expanded' => false,
//'class' => 'Entity\Course',
//'property' => 'complete_name',
//'query_builder' => function(ChamiloLMS\Entity\Repository\CourseRepository $repo) use ($course) {
//'query_builder' => function(ChamiloLMS\CoreBundle\Entity\Repository\CourseRepository $repo) use ($course) {
$repo = $repo->getSubscribedStudents($course);
return $repo;
},
@ -164,7 +164,7 @@ class LearningPathController extends BaseController
'required' => false,
//'class' => 'Entity\Course',
//'property' => 'complete_name',
//'query_builder' => function(ChamiloLMS\Entity\Repository\CourseRepository $repo) use ($course) {
//'query_builder' => function(ChamiloLMS\CoreBundle\Entity\Repository\CourseRepository $repo) use ($course) {
// return $repo->getSubscribedStudents($course);
//},
'choices' => $selectedChoices
@ -183,7 +183,7 @@ class LearningPathController extends BaseController
$users = $request->get('users');
$userForm = $request->get('user_form');
if (!empty($userForm)) {
$app['orm.em']->getRepository('ChamiloLMS\Entity\CItemProperty')->subscribeUsersToItem(
$app['orm.em']->getRepository('ChamiloLMS\CoreBundle\Entity\CItemProperty')->subscribeUsersToItem(
'learnpath',
$course,
$session,
@ -197,7 +197,7 @@ class LearningPathController extends BaseController
$groupForm = $request->get('group_form');
if (!empty($groupForm)) {
$app['orm.em']->getRepository('ChamiloLMS\Entity\CItemProperty')->subscribeGroupsToItem(
$app['orm.em']->getRepository('ChamiloLMS\CoreBundle\Entity\CItemProperty')->subscribeGroupsToItem(
'learnpath',
$course,
$session,

@ -1,9 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller;
namespace ChamiloLMS\CoreBundle\Controller;
use ChamiloLMS\Controller\BaseController;
use ChamiloLMS\CoreBundle\Controller\BaseController;
use Knp\Menu\FactoryInterface as MenuFactoryInterface;
use Knp\Menu\ItemInterface as MenuItemInterface;
use Knp\Menu\Renderer\ListRenderer;
@ -60,7 +60,7 @@ abstract class ToolBaseController extends BaseController
}
/**
* Converts string 'ChamiloLMS\Controller\Tool\CourseHome\CourseHomeController' into
* Converts string 'ChamiloLMS\CoreBundle\Controller\Tool\CourseHome\CourseHomeController' into
* 'tool/course_home'
*/
public function getTemplatePath()

@ -1,9 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\User;
namespace ChamiloLMS\CoreBundle\Controller\User;
use ChamiloLMS\Controller\BaseController;
use ChamiloLMS\CoreBundle\Controller\BaseController;
use Silex\Application;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
@ -12,7 +12,7 @@ use Symfony\Component\HttpFoundation\Response;
/**
* Class ProfileController
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
*/
class ProfileController extends BaseController
{

@ -1,19 +1,19 @@
<?php
/* For licensing terms, see /license.txt */
namespace ChamiloLMS\Controller\User;
namespace ChamiloLMS\CoreBundle\Controller\User;
use Silex\Application;
use Symfony\Component\HttpFoundation\Response;
use ChamiloLMS\Controller\BaseController;
use ChamiloLMS\CoreBundle\Controller\BaseController;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
/**
* Class UserController
* @package ChamiloLMS\Controller
* @package ChamiloLMS\CoreBundle\Controller
* @author Julio Montoya <gugli100@gmail.com>
*/
class UserController extends BaseController

@ -1,6 +1,6 @@
<?php
namespace ChamiloLMS\Entity;
namespace ChamiloLMS\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;

@ -1,6 +1,6 @@
<?php
namespace ChamiloLMS\Entity;
namespace ChamiloLMS\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;

@ -1,6 +1,6 @@
<?php
namespace ChamiloLMS\Entity;
namespace ChamiloLMS\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;

@ -1,6 +1,6 @@
<?php
namespace ChamiloLMS\Entity;
namespace ChamiloLMS\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;

@ -1,5 +1,5 @@
<?php
namespace ChamiloLMS\Entity;
namespace ChamiloLMS\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
@ -8,7 +8,7 @@ use Gedmo\Mapping\Annotation as Gedmo;
* BranchSync
*
* @ORM\Table(name="branch_sync")
* @ORM\Entity(repositoryClass="ChamiloLMS\Entity\Repository\BranchSyncRepository")
* @ORM\Entity(repositoryClass="ChamiloLMS\CoreBundle\Entity\Repository\BranchSyncRepository")
* @Gedmo\Tree(type="nested")
*/

@ -1,6 +1,6 @@
<?php
namespace ChamiloLMS\Entity;
namespace ChamiloLMS\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save