services.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This file includes all the services that are loaded via the ServiceProviderInterface
  5. *
  6. * @package chamilo.services
  7. */
  8. // Needed to use the "entity" option in symfony forms
  9. use Doctrine\Common\Persistence\AbstractManagerRegistry;
  10. use FranMoreno\Silex\Provider\PagerfantaServiceProvider;
  11. use Silex\Application;
  12. use Silex\ServiceProviderInterface;
  13. use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
  14. // Flint
  15. $app->register(new Flint\Provider\ConfigServiceProvider());
  16. $app['root_dir'] = $app['root_sys'];
  17. $app->register(new Flint\Provider\RoutingServiceProvider(), array(
  18. 'routing.resource' => $app['sys_config_path'].'routing.yml',
  19. 'routing.options' => array(
  20. 'cache_dir' => $app['debug'] == true ? null : $app['sys_temp_path']
  21. ),
  22. ));
  23. // Monolog.
  24. if (is_writable($app['sys_temp_path'])) {
  25. /**
  26. * Adding Monolog service provider.
  27. * Examples:
  28. * $app['monolog']->addDebug('Testing the Monolog logging.');
  29. * $app['monolog']->addInfo('Testing the Monolog logging.');
  30. * $app['monolog']->addError('Testing the Monolog logging.');
  31. */
  32. if ($app['debug']) {
  33. $app->register(
  34. new Silex\Provider\MonologServiceProvider(),
  35. array(
  36. 'monolog.logfile' => $app['chamilo.log'],
  37. 'monolog.name' => 'chamilo',
  38. )
  39. );
  40. }
  41. }
  42. //Setting HttpCacheService provider in order to use do: $app['http_cache']->run();
  43. /*
  44. $app->register(new Silex\Provider\HttpCacheServiceProvider(), array(
  45. 'http_cache.cache_dir' => $app['http_cache.cache_dir'].'/',
  46. ));*/
  47. // http://symfony.com/doc/master/reference/configuration/security.html
  48. class SecurityServiceProvider extends \Silex\Provider\SecurityServiceProvider
  49. {
  50. public function addFakeRoute($method, $pattern, $name)
  51. {
  52. // Don't do anything otherwise the closures will be dumped and that leads to fatal errors.
  53. }
  54. }
  55. $app->register(new SecurityServiceProvider, array(
  56. 'security.firewalls' => array(
  57. 'login' => array(
  58. 'pattern' => '^/login$',
  59. 'anonymous' => true
  60. ),
  61. 'admin' => array(
  62. //'http' => true,
  63. 'pattern' => '^/.*$',
  64. 'form' => array(
  65. 'login_path' => '/login',
  66. 'check_path' => '/admin/login_check',
  67. 'default_target_path' => '/userportal',
  68. 'username_parameter' => 'username',
  69. 'password_parameter' => 'password',
  70. ),
  71. 'logout' => array(
  72. 'logout_path' => '/admin/logout',
  73. 'target' => '/'
  74. ),
  75. 'users' => $app->share(function() use ($app) {
  76. return $app['orm.em']->getRepository('Entity\User');
  77. }),
  78. 'anonymous' => true
  79. )
  80. )
  81. ));
  82. // Registering Password encoder.
  83. $app['security.encoder.digest'] = $app->share(function($app) {
  84. // use the sha1 algorithm
  85. // don't base64 encode the password
  86. // use only 1 iteration
  87. return new MessageDigestPasswordEncoder($app['configuration']['password_encryption'], false, 1);
  88. });
  89. // What to do when login success?
  90. $app['security.authentication.success_handler.admin'] = $app->share(function($app) {
  91. return new ChamiloLMS\Component\Auth\LoginSuccessHandler($app['url_generator'], $app['security']);
  92. });
  93. // What to do when logout?
  94. $app['security.authentication.logout_handler.admin'] = $app->share(function($app) {
  95. return new ChamiloLMS\Component\Auth\LogoutSuccessHandler($app['url_generator'], $app['security']);
  96. });
  97. // Role hierarchy
  98. $app['security.role_hierarchy'] = array(
  99. 'ROLE_ADMIN' => array(
  100. 'ROLE_QUESTION_MANAGER',
  101. 'ROLE_SESSION_MANAGER',
  102. 'ROLE_TEACHER',
  103. 'ROLE_ALLOWED_TO_SWITCH',
  104. 'ROLE_DIRECTOR',
  105. 'ROLE_JURY_PRESIDENT'
  106. ),
  107. 'ROLE_RRHH' => array('ROLE_TEACHER'),
  108. 'ROLE_TEACHER' => array('ROLE_STUDENT'),
  109. 'ROLE_QUESTION_MANAGER' => array('ROLE_STUDENT', 'ROLE_QUESTION_MANAGER'),
  110. 'ROLE_SESSION_MANAGER' => array('ROLE_STUDENT', 'ROLE_SESSION_MANAGER'),
  111. 'ROLE_STUDENT' => array('ROLE_STUDENT'),
  112. 'ROLE_ANONYMOUS' => array('ROLE_ANONYMOUS')
  113. );
  114. // Role rules
  115. $app['security.access_rules'] = array(
  116. //array('^/admin', 'ROLE_ADMIN', 'https'),
  117. array('^/admin/administrator', 'ROLE_ADMIN'),
  118. //array('^/main/admin/extra_fields.php', 'ROLE_QUESTION_MANAGER'),
  119. //array('^/main/admin/extra_field_options.php', 'ROLE_QUESTION_MANAGER'),
  120. //array('^/main/admin/extra_field_workflow.php', 'ROLE_QUESTION_MANAGER'),
  121. array('^/main/admin/.*', 'ROLE_ADMIN'),
  122. array('^/admin/questionmanager', 'ROLE_QUESTION_MANAGER'),
  123. array('^/main/auth/inscription.php', 'IS_AUTHENTICATED_ANONYMOUSLY'),
  124. array('^/main/auth/lostPassword.php', 'IS_AUTHENTICATED_ANONYMOUSLY'),
  125. array('^/main/.*', array('ROLE_STUDENT')),
  126. array('^/courses/.*/curriculum/category', 'ROLE_TEACHER'),
  127. array('^/courses/.*/curriculum/item', 'ROLE_TEACHER'),
  128. array('^/courses/.*/curriculum/user', 'ROLE_STUDENT'),
  129. array('^/courses/.*/curriculum', 'ROLE_STUDENT'),
  130. //array('^.*$', 'ROLE_USER'),
  131. );
  132. /**
  133. $app['security.access_manager'] = $app->share(function($app) {
  134. return new AccessDecisionManager($app['security.voters'], 'unanimous');
  135. });*/
  136. // Setting Controllers as services provider.
  137. $app->register(new Silex\Provider\ServiceControllerServiceProvider());
  138. // Validator provider.
  139. $app->register(new Silex\Provider\ValidatorServiceProvider());
  140. // Implements Symfony2 translator.
  141. $app->register(new Silex\Provider\TranslationServiceProvider(), array(
  142. 'locale' => 'en',
  143. 'locale_fallback' => 'en'
  144. ));
  145. // Form provider
  146. $app->register(new Silex\Provider\FormServiceProvider());
  147. // URL generator provider
  148. //$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
  149. // Needed to use the "entity" option in symfony forms
  150. class ManagerRegistry extends AbstractManagerRegistry
  151. {
  152. protected $container;
  153. protected function getService($name)
  154. {
  155. return $this->container[$name];
  156. }
  157. protected function resetService($name)
  158. {
  159. unset($this->container[$name]);
  160. }
  161. public function getAliasNamespace($alias)
  162. {
  163. throw new \BadMethodCallException('Namespace aliases not supported.');
  164. }
  165. public function setContainer(Application $container)
  166. {
  167. $this->container = $container;
  168. }
  169. }
  170. $app['form.extensions'] = $app->share($app->extend('form.extensions', function ($extensions, $app) {
  171. $managerRegistry = new ManagerRegistry(null, array('db'), array('orm.em'), null, null, $app['orm.proxies_namespace']);
  172. $managerRegistry->setContainer($app);
  173. $extensions[] = new \Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension($managerRegistry);
  174. return $extensions;
  175. }));
  176. // Setting Doctrine service provider (DBAL)
  177. if (isset($app['configuration']['main_database'])) {
  178. /* The database connection can be overwritten if you set $_configuration['db.options']
  179. in configuration.php like this : */
  180. $dbPort = isset($app['configuration']['db_port']) ? $app['configuration']['db_port'] : 3306;
  181. $defaultDatabaseOptions = array(
  182. 'db_read' => array(
  183. 'driver' => 'pdo_mysql',
  184. 'host' => $app['configuration']['db_host'],
  185. 'port' => $dbPort,
  186. 'dbname' => $app['configuration']['main_database'],
  187. 'user' => $app['configuration']['db_user'],
  188. 'password' => $app['configuration']['db_password'],
  189. 'charset' => 'utf8',
  190. //'priority' => '1'
  191. ),
  192. 'db_write' => array(
  193. 'driver' => 'pdo_mysql',
  194. 'host' => $app['configuration']['db_host'],
  195. 'port' => $dbPort,
  196. 'dbname' => $app['configuration']['main_database'],
  197. 'user' => $app['configuration']['db_user'],
  198. 'password' => $app['configuration']['db_password'],
  199. 'charset' => 'utf8',
  200. //'priority' => '2'
  201. ),
  202. );
  203. // Could be set in the $_configuration array
  204. if (isset($app['configuration']['db.options'])) {
  205. $defaultDatabaseOptions = $app['configuration']['db.options'];
  206. }
  207. $app->register(
  208. new Silex\Provider\DoctrineServiceProvider(),
  209. array(
  210. 'dbs.options' => $defaultDatabaseOptions
  211. )
  212. );
  213. $mappings = array(
  214. array(
  215. /* If true, only simple notations like @Entity will work.
  216. If false, more advanced notations and aliasing via use will work.
  217. (Example: use Doctrine\ORM\Mapping AS ORM, @ORM\Entity)*/
  218. 'use_simple_annotation_reader' => false,
  219. 'type' => 'annotation',
  220. 'namespace' => 'Entity',
  221. 'path' => api_get_path(INCLUDE_PATH).'Entity',
  222. // 'orm.default_cache' =>
  223. ),
  224. array(
  225. 'use_simple_annotation_reader' => false,
  226. 'type' => 'annotation',
  227. 'namespace' => 'Gedmo',
  228. 'path' => api_get_path(SYS_PATH).'vendors/gedmo/doctrine-extensions/lib/Gedmo',
  229. )
  230. );
  231. // Setting Doctrine ORM.
  232. $app->register(
  233. new Dflydev\Silex\Provider\DoctrineOrm\DoctrineOrmServiceProvider,
  234. array(
  235. // Doctrine2 ORM cache
  236. /*'orm.default_cache' => 'apc', // array, apc, xcache, memcache, memcached
  237. 'metadata_cache' => 'apc',
  238. 'result_cache' => 'apc',*/
  239. // Proxies
  240. 'orm.auto_generate_proxies' => true,
  241. 'orm.proxies_dir' => $app['db.orm.proxies_dir'],
  242. 'orm.proxies_namespace' => 'Doctrine\ORM\Proxy\Proxy',
  243. 'orm.ems.default' => 'db_read',
  244. 'orm.ems.options' => array(
  245. 'db_read' => array(
  246. 'connection' => 'db_read',
  247. 'mappings' => $mappings,
  248. ),
  249. 'db_write' => array(
  250. 'connection' => 'db_write',
  251. 'mappings' => $mappings,
  252. ),
  253. ),
  254. )
  255. );
  256. }
  257. // Setting Twig as a service provider.
  258. $app->register(
  259. new Silex\Provider\TwigServiceProvider(),
  260. array(
  261. 'twig.path' => array(
  262. api_get_path(SYS_CODE_PATH).'template', //template folder
  263. api_get_path(SYS_PLUGIN_PATH) //plugin folder
  264. ),
  265. // twitter bootstrap form twig templates
  266. 'twig.form.templates' => array('form_div_layout.html.twig', 'default/form/form_custom_template.tpl'),
  267. 'twig.options' => array(
  268. 'debug' => $app['debug'],
  269. 'charset' => 'utf-8',
  270. 'strict_variables' => false,
  271. 'autoescape' => false,
  272. 'cache' => $app['debug'] ? false : $app['twig.cache.path'],
  273. 'optimizations' => -1, // turn on optimizations with -1
  274. )
  275. )
  276. );
  277. // Setting Twig options
  278. $app['twig'] = $app->share(
  279. $app->extend('twig', function ($twig) {
  280. $twig->addFilter('get_lang', new Twig_Filter_Function('get_lang'));
  281. $twig->addFilter('get_path', new Twig_Filter_Function('api_get_path'));
  282. $twig->addFilter('get_setting', new Twig_Filter_Function('api_get_setting'));
  283. $twig->addFilter('var_dump', new Twig_Filter_Function('var_dump'));
  284. $twig->addFilter('return_message', new Twig_Filter_Function('Display::return_message_and_translate'));
  285. $twig->addFilter('display_page_header', new Twig_Filter_Function('Display::page_header_and_translate'));
  286. $twig->addFilter(
  287. 'display_page_subheader',
  288. new Twig_Filter_Function('Display::page_subheader_and_translate')
  289. );
  290. $twig->addFilter('icon', new Twig_Filter_Function('Template::get_icon_path'));
  291. $twig->addFilter('format_date', new Twig_Filter_Function('Template::format_date'));
  292. return $twig;
  293. })
  294. );
  295. // Developer tools.
  296. if (is_writable($app['sys_temp_path'])) {
  297. if ($app['show_profiler']) {
  298. // Adding Symfony2 web profiler (memory, time, logs, etc)
  299. $app->register(
  300. $p = new Silex\Provider\WebProfilerServiceProvider(),
  301. array(
  302. 'profiler.cache_dir' => $app['profiler.cache_dir'],
  303. )
  304. );
  305. $app->mount('/_profiler', $p);
  306. // PHP errors for cool kids
  307. //$app->register(new Whoops\Provider\Silex\WhoopsServiceProvider);
  308. }
  309. }
  310. // Pagerfanta settings (Pagination using Doctrine2, arrays, etc)
  311. $app->register(new PagerfantaServiceProvider());
  312. // Custom route params see https://github.com/franmomu/silex-pagerfanta-provider/pull/2
  313. //$app['pagerfanta.view.router.name']
  314. //$app['pagerfanta.view.router.params']
  315. $app['pagerfanta.view.options'] = array(
  316. 'routeName' => null,
  317. 'routeParams' => array(),
  318. 'pageParameter' => '[page]',
  319. 'proximity' => 3,
  320. 'next_message' => '&raquo;',
  321. 'prev_message' => '&laquo;',
  322. 'default_view' => 'twitter_bootstrap' // the pagination style
  323. );
  324. // Registering Menu service provider (too gently creating menus with the URLgenerator provider)
  325. $app->register(new \Knp\Menu\Silex\KnpMenuServiceProvider());
  326. // @todo use a app['image_processor'] setting
  327. define('IMAGE_PROCESSOR', 'gd'); // imagick or gd strings
  328. // Setting the Imagine service provider to deal with image transformations used in social group.
  329. $app->register(new Grom\Silex\ImagineServiceProvider(), array(
  330. 'imagine.factory' => 'Gd'
  331. ));
  332. // Prompts Doctrine SQL queries using Monolog.
  333. $app['dbal_logger'] = $app->share(function() {
  334. //return new Doctrine\DBAL\Logging\DebugStack();
  335. });
  336. if ($app['debug']) {
  337. /*$logger = $app['dbal_logger'];
  338. $app['db.config']->setSQLLogger($logger);
  339. $app->after(function() use ($app, $logger) {
  340. // Log all queries as DEBUG.
  341. foreach ($logger->queries as $query) {
  342. $app['monolog']->debug(
  343. $query['sql'],
  344. array(
  345. 'params' => $query['params'],
  346. 'types' => $query['types'],
  347. 'executionMS' => $query['executionMS']
  348. )
  349. );
  350. }
  351. });*/
  352. }
  353. // Email service provider.
  354. $app->register(new Silex\Provider\SwiftmailerServiceProvider(), array(
  355. 'swiftmailer.options' => array(
  356. 'host' => isset($platform_email['SMTP_HOST']) ? $platform_email['SMTP_HOST'] : null,
  357. 'port' => isset($platform_email['SMTP_PORT']) ? $platform_email['SMTP_PORT'] : null,
  358. 'username' => isset($platform_email['SMTP_USER']) ? $platform_email['SMTP_USER'] : null,
  359. 'password' => isset($platform_email['SMTP_PASS']) ? $platform_email['SMTP_PASS'] : null,
  360. 'encryption' => null,
  361. 'auth_mode' => null
  362. )
  363. ));
  364. // Mailer
  365. $app['mailer'] = $app->share(function ($app) {
  366. return new \Swift_Mailer($app['swiftmailer.transport']);
  367. });
  368. // Assetic service provider.
  369. if ($app['assetic.enabled']) {
  370. $app->register(new SilexAssetic\AsseticServiceProvider(), array(
  371. 'assetic.options' => array(
  372. 'debug' => $app['debug'],
  373. 'auto_dump_assets' => $app['assetic.auto_dump_assets'],
  374. )
  375. ));
  376. // Less filter
  377. $app['assetic.filter_manager'] = $app->share(
  378. $app->extend('assetic.filter_manager', function($fm, $app) {
  379. $fm->set('lessphp', new Assetic\Filter\LessphpFilter());
  380. return $fm;
  381. })
  382. );
  383. $app['assetic.asset_manager'] = $app->share(
  384. $app->extend('assetic.asset_manager', function($am, $app) {
  385. $am->set('styles', new Assetic\Asset\AssetCache(
  386. new Assetic\Asset\GlobAsset(
  387. $app['assetic.input.path_to_css'],
  388. array($app['assetic.filter_manager']->get('lessphp'))
  389. ),
  390. new Assetic\Cache\FilesystemCache($app['assetic.path_to_cache'])
  391. ));
  392. $am->get('styles')->setTargetPath($app['assetic.output.path_to_css']);
  393. $am->set('scripts', new Assetic\Asset\AssetCache(
  394. new Assetic\Asset\GlobAsset($app['assetic.input.path_to_js']),
  395. new Assetic\Cache\FilesystemCache($app['assetic.path_to_cache'])
  396. ));
  397. $am->get('scripts')->setTargetPath($app['assetic.output.path_to_js']);
  398. return $am;
  399. })
  400. );
  401. }
  402. // Gaufrette service provider (to manage files/dirs) (not used yet)
  403. /*
  404. use Bt51\Silex\Provider\GaufretteServiceProvider\GaufretteServiceProvider;
  405. $app->register(new GaufretteServiceProvider(), array(
  406. 'gaufrette.adapter.class' => 'Local',
  407. 'gaufrette.options' => array(api_get_path(SYS_DATA_PATH))
  408. ));
  409. */
  410. // Use Symfony2 filesystem instead of custom scripts
  411. $app->register(new Neutron\Silex\Provider\FilesystemServiceProvider());
  412. /** Chamilo service provider. */
  413. class ChamiloServiceProvider implements ServiceProviderInterface
  414. {
  415. public function register(Application $app)
  416. {
  417. // Template class
  418. $app['template'] = $app->share(function () use ($app) {
  419. $template = new Template($app);
  420. return $template;
  421. });
  422. $app['paths'] = $app->share(function () use ($app) {
  423. return array(
  424. //'root_web' => $app['root_web'],
  425. 'root_sys' => $app['root_sys'],
  426. 'sys_root' => $app['root_sys'], // just an alias
  427. 'sys_data_path' => $app['sys_data_path'],
  428. 'sys_config_path' => $app['sys_config_path'],
  429. 'sys_temp_path' => $app['sys_temp_path'],
  430. 'sys_log_path' => $app['sys_log_path']
  431. );
  432. });
  433. // Chamilo data filesystem.
  434. $app['chamilo.filesystem'] = $app->share(function () use ($app) {
  435. $filesystem = new ChamiloLMS\Component\DataFilesystem\DataFilesystem($app['paths'], $app['filesystem']);
  436. return $filesystem;
  437. });
  438. // Page controller class.
  439. $app['page_controller'] = $app->share(function () use ($app) {
  440. $pageController = new PageController($app);
  441. return $pageController;
  442. });
  443. // Mail template generator.
  444. $app['mail_generator'] = $app->share(function () use ($app) {
  445. $mailGenerator = new ChamiloLMS\Component\Mail\MailGenerator($app['twig'], $app['mailer']);
  446. return $mailGenerator;
  447. });
  448. // Database.
  449. $app['database'] = $app->share(function () use ($app) {
  450. $db = new Database($app['db'], $app['dbs']);
  451. return $db;
  452. });
  453. }
  454. public function boot(Application $app)
  455. {
  456. }
  457. }
  458. // Registering Chamilo service provider.
  459. $app->register(new ChamiloServiceProvider(), array());
  460. // Controller as services definitions.
  461. $app['pages.controller'] = $app->share(
  462. function () use ($app) {
  463. return new PagesController($app['pages.repository']);
  464. }
  465. );
  466. $app['index.controller'] = $app->share(
  467. function () use ($app) {
  468. $controller = new ChamiloLMS\Controller\IndexController($app);
  469. return $controller;
  470. }
  471. );
  472. $app['legacy.controller'] = $app->share(
  473. function () use ($app) {
  474. return new ChamiloLMS\Controller\LegacyController($app);
  475. }
  476. );
  477. $app['userPortal.controller'] = $app->share(
  478. function () use ($app) {
  479. return new ChamiloLMS\Controller\UserPortalController($app);
  480. }
  481. );
  482. $app['learnpath.controller'] = $app->share(
  483. function () use ($app) {
  484. return new ChamiloLMS\Controller\LearnpathController();
  485. }
  486. );
  487. $app['course_home.controller'] = $app->share(
  488. function () use ($app) {
  489. return new ChamiloLMS\Controller\CourseHomeController();
  490. }
  491. );
  492. $app['course_home.controller'] = $app->share(
  493. function () use ($app) {
  494. return new ChamiloLMS\Controller\CourseHomeController();
  495. }
  496. );
  497. $app['introduction_tool.controller'] = $app->share(
  498. function () use ($app) {
  499. return new ChamiloLMS\Controller\IntroductionToolController();
  500. }
  501. );
  502. $app['certificate.controller'] = $app->share(
  503. function () use ($app) {
  504. return new ChamiloLMS\Controller\CertificateController();
  505. }
  506. );
  507. $app['user.controller'] = $app->share(
  508. function () use ($app) {
  509. return new ChamiloLMS\Controller\UserController();
  510. }
  511. );
  512. $app['news.controller'] = $app->share(
  513. function () use ($app) {
  514. return new ChamiloLMS\Controller\NewsController();
  515. }
  516. );
  517. $app['editor.controller'] = $app->share(
  518. function () use ($app) {
  519. return new ChamiloLMS\Controller\EditorController();
  520. }
  521. );
  522. $app['question_manager.controller'] = $app->share(
  523. function () use ($app) {
  524. return new ChamiloLMS\Controller\Admin\QuestionManager\QuestionManagerController();
  525. }
  526. );
  527. $app['exercise_manager.controller'] = $app->share(
  528. function () use ($app) {
  529. return new ChamiloLMS\Controller\ExerciseController($app);
  530. }
  531. );
  532. $app['admin.controller'] = $app->share(
  533. function () use ($app) {
  534. return new ChamiloLMS\Controller\Admin\AdministratorController($app);
  535. }
  536. );
  537. $app['role.controller'] = $app->share(
  538. function () use ($app) {
  539. return new ChamiloLMS\Controller\Admin\Administrator\RoleController($app);
  540. }
  541. );
  542. $app['question_score.controller'] = $app->share(
  543. function () use ($app) {
  544. return new ChamiloLMS\Controller\Admin\Administrator\QuestionScoreController($app);
  545. }
  546. );
  547. $app['question_score_name.controller'] = $app->share(
  548. function () use ($app) {
  549. return new ChamiloLMS\Controller\Admin\Administrator\QuestionScoreNameController($app);
  550. }
  551. );
  552. $app['model_ajax.controller'] = $app->share(
  553. function () use ($app) {
  554. return new ChamiloLMS\Controller\ModelAjaxController();
  555. }
  556. );
  557. // Curriculum tool
  558. $app['curriculum.controller'] = $app->share(
  559. function () use ($app) {
  560. return new ChamiloLMS\Controller\Tool\Curriculum\CurriculumController($app);
  561. }
  562. );
  563. $app['curriculum_category.controller'] = $app->share(
  564. function () use ($app) {
  565. return new ChamiloLMS\Controller\Tool\Curriculum\CurriculumCategoryController($app);
  566. }
  567. );
  568. $app['curriculum_item.controller'] = $app->share(
  569. function () use ($app) {
  570. return new ChamiloLMS\Controller\Tool\Curriculum\CurriculumItemController($app);
  571. }
  572. );
  573. $app['curriculum_user.controller'] = $app->share(
  574. function () use ($app) {
  575. return new ChamiloLMS\Controller\Tool\Curriculum\CurriculumUserController($app);
  576. }
  577. );