Updating course tool as services definition.

1.10.x
Julio Montoya 12 years ago
parent e48956aae8
commit e2a3376165
  1. 8
      app/config/security.yml
  2. 1
      app/config/sonata/sonata_page.yml
  3. 62
      main/inc/lib/course.lib.php
  4. 1
      src/Chamilo/CoreBundle/Admin/CourseAdmin.php
  5. 5
      src/Chamilo/CoreBundle/Entity/CourseManager.php
  6. 1
      src/Chamilo/CoreBundle/EventListener/LegacyListener.php
  7. 1
      src/Chamilo/CoreBundle/Resources/config/services.yml
  8. 2
      src/Chamilo/CourseBundle/DependencyInjection/Compiler/ToolCompilerClass.php
  9. 132
      src/Chamilo/CourseBundle/Resources/config/services.yml
  10. 12
      src/Chamilo/CourseBundle/Tool/Agenda.php
  11. 33
      src/Chamilo/CourseBundle/Tool/BaseTool.php
  12. 12
      src/Chamilo/NotebookBundle/Resources/config/services.yml

@ -31,11 +31,11 @@ security:
id: fos_user.user_manager
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js|admin/_(wdt|profiler)|api/_(wdt|profiler))/
security: false
pattern: ^/(_(profiler|wdt)|css|images|js|admin/_(wdt|profiler)|api/_(wdt|profiler))/
security: false
install:
pattern: ^/installer
pattern: /installer/(.*)
security: false
anonymous: true
@ -50,7 +50,7 @@ security:
failure_path: null
logout:
path: /administration/logout
anonymous: false
anonymous: true
main:
pattern: .*

@ -19,7 +19,6 @@ sonata_page:
- ^installer
- ^/installer/(.*)
- install.php
- settings/(.*)
ignore_route_patterns:
- (.*)administration(.*) # ignore admin route, ie route containing 'admin' # sonata admin

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt*/
use Chamilo\CourseBundle\ToolChain;
/**
* Class CourseManager
*
@ -24,6 +26,24 @@ class CourseManager
public $columns = array();
public static $toolList;
/**
* @param ToolChain $toolList
*/
public static function setToolList($toolList)
{
self::$toolList = $toolList;
}
/**
* @return ToolChain
*/
public static function getToolList()
{
return self::$toolList;
}
/**
* Creates a course
* @param array with the columns in the main.course table
@ -4291,37 +4311,31 @@ class CourseManager
$TABLEGRADEBOOKLINK = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
//$TABLEGRADEBOOKCERT = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
$visible_for_all = 1;
$visible_for_course_admin = 0;
$visible_for_platform_admin = 2;
$toolList = self::getToolList();
/** @var Chamilo\CourseBundle\Tool\BaseTool $tool */
foreach ($toolList as $tool) {
$params = array(
'id' => '0',
'c_id' => $course_id,
'name' => $tool->getName(),
'category' => $tool->getCategory(),
'link' => $tool->getLink(),
'image' => $tool->getImage(),
'visibility' => Text::string2binary(api_get_setting('course_create_active_tools', $tool->getName())),
'admin' => 0,
'address' => 'squaregrey.gif',
'target' => 'self',
'session_id' => 0
);
Database::insert($toolTable, $params);
}
/* Course tools */
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_COURSE_DESCRIPTION . "','course_description/','info.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'course_description')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_CALENDAR_EVENT . "','calendar/agenda.php','agenda.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'agenda')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_DOCUMENT . "','document/document.php','folder_document.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'documents')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_LEARNPATH . "','newscorm/lp_controller.php','scorms.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'learning_path')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_LINK . "','link/link.php','links.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'links')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_QUIZ . "','exercice/exercice.php','quiz.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'quiz')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_ANNOUNCEMENT . "','announcements/announcements.php','valves.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'announcements')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_FORUM . "','forum/index.php','forum.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'forums')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_DROPBOX . "','dropbox/index.php','dropbox.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'dropbox')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_USER . "','user/user.php','members.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'users')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_GROUP . "','group/group.php','group.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'groups')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_CHAT . "','chat/chat.php','chat.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'chat')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_STUDENTPUBLICATION . "','work/work.php','works.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'student_publications')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_SURVEY."','survey/survey_list.php','survey.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'survey')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_WIKI ."','wiki/index.php','wiki.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'wiki')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_GRADEBOOK."','gradebook/index.php','gradebook.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'gradebook')). "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_GLOSSARY."','glossary/index.php','glossary.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'glossary')). "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_NOTEBOOK."','notebook/index.php','notebook.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'notebook'))."','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_ATTENDANCE."','attendance/index.php','attendance.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'attendances'))."','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_COURSE_PROGRESS."','course_progress/index.php','course_progress.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'course_progress'))."','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_CURRICULUM."','curriculum','cv.png','".Text::string2binary(api_get_setting('course_create_active_tools', 'curriculum'))."','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
if (api_get_setting('service_visio', 'active') == 'true') {
$mycheck = api_get_setting('service_visio', 'visio_host');
if (!empty($mycheck)) {

@ -4,6 +4,7 @@ namespace Chamilo\CoreBundle\Admin;
use Chamilo\CoreBundle\Entity\Listener\CourseListener;
use Chamilo\CourseBundle\Entity\CTool;
use Chamilo\CoreBundle\Entity\Course;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;

@ -22,6 +22,11 @@ class CourseManager extends BaseEntityManager
return $this->getRepository()->findByTitle($name);
}
public function saveTools($courseId)
{
}
/**
* {@inheritdoc}
*/

@ -39,6 +39,7 @@ class LegacyListener
$database = new \Database($dbConnection, array());
\Database::setManager($this->container->get('doctrine')->getManager());
\CourseManager::setToolList($this->container->get('chamilo.tool_chain'));
Session::$urlGenerator = $this->container->get('router');
Session::$security = $this->container->get('security.context');
Session::$translator = $this->container->get('translator');

@ -21,7 +21,6 @@ services:
arguments: [ @chamilo.tool_chain ]
tags:
- { name: doctrine.orm.entity_listener }
# - { name: doctrine.event_listener, event: prePersist }
html_editor:

@ -23,7 +23,7 @@ class ToolCompilerClass implements CompilerPassInterface
);
$taggedServices = $container->findTaggedServiceIds(
'chamilolm.course.tool'
'chamilo.course.tool'
);
foreach ($taggedServices as $id => $attributes) {

@ -8,138 +8,202 @@ services:
chamilo.coursebundle.tool.agenda.class:
class: Chamilo\CourseBundle\Tool\Agenda
arguments:
- agenda
- calendar_event
- authoring
- calendar/agenda.php
- agenda.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.announcements.class:
class: Chamilo\CourseBundle\Tool\Announcement
arguments:
- document
- announcement
- authoring
- announcements/announcements.php
- valves.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.assignment.class:
class: Chamilo\CourseBundle\Tool\Assignment
arguments:
- document
- assignment
- interaction
- work/work.php
- works.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.attendance.class:
class: Chamilo\CourseBundle\Tool\Attendance
arguments:
- attendance
- authoring
- attendance/index.php
- attendance.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.course_description.class:
class: Chamilo\CourseBundle\Tool\CourseDescription
arguments:
- document
- course_description
- authoring
- course_description/index.php
- info.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.chat.class:
class: Chamilo\CourseBundle\Tool\Chat
arguments:
- chat
- interaction
- chat/chat.php
- chat.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.course_progress.class:
class: Chamilo\CourseBundle\Tool\CourseProgress
arguments:
- course_progress
- authoring
- course_progress/index.php
- course_progress.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.document.class:
class: Chamilo\CourseBundle\Tool\Document
arguments:
- document
- authoring
- document/document.php
- folder_document.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.dropbox.class:
class: Chamilo\CourseBundle\Tool\Dropbox
arguments:
- document
- dropbox
- interaction
- dropbox/index.php
- dropbox.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.exercise.class:
class: Chamilo\CourseBundle\Tool\Exercise
arguments:
- document
- quiz
- authoring
- exercice/exercice.php
- quiz.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.forum.class:
class: Chamilo\CourseBundle\Tool\Forum
arguments:
- document
- forum
- interaction
- forum/index.php
- forum.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.glossary.class:
class: Chamilo\CourseBundle\Tool\Glossary
arguments:
- document
- glossary
- authoring
- glossary/index.php
- glossary.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.gradebook.class:
class: Chamilo\CourseBundle\Tool\Gradebook
arguments:
- document
- gradebook
- authoring
- gradebook/index.php
- gradebook.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.group.class:
class: Chamilo\CourseBundle\Tool\Group
arguments:
- document
- group
- interaction
- group/group.php
- group.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.learning_path.class:
class: Chamilo\CourseBundle\Tool\LearningPath
arguments:
- document
- learnpath
- authoring
- newscorm/lp_controller.php
- scorms.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.link.class:
class: Chamilo\CourseBundle\Tool\Link
arguments:
- document
- link
- authoring
- link/link.php
- links.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.survey.class:
class: Chamilo\CourseBundle\Tool\Survey
arguments:
- document
- survey
- interaction
- survey/survey_list.php
- survey.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.user.class:
class: Chamilo\CourseBundle\Tool\User
arguments:
- document
- user
- interaction
- user/user.php
- members.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo.coursebundle.tool.wiki.class:
class: Chamilo\CourseBundle\Tool\Wiki
arguments:
- document
- wiki
- interaction
- wiki/index.php
- wiki.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }

@ -9,17 +9,5 @@ namespace Chamilo\CourseBundle\Tool;
*/
class Agenda extends BaseTool
{
/**
* {@inheritdoc}
*/
public function getLink()
{
return 'calendar/agenda.php';
}
public function getCategory()
{
return 'authoring';
}
}

@ -11,15 +11,22 @@ use Symfony\Component\OptionsResolver\OptionsResolverInterface;
abstract class BaseTool implements ToolInterface
{
protected $name;
protected $category;
protected $link;
protected $image;
/**
* @param string $name
* @param $name
* @param $category
* @param $link
* @param $image
*/
public function __construct($name)
public function __construct($name, $category, $link, $image)
{
$this->name = $name;
$this->category = $category;
$this->link = $link;
$this->image = $image;
}
/**
@ -30,11 +37,33 @@ abstract class BaseTool implements ToolInterface
return $this->name;
}
/**
* {@inheritdoc}
*/
public function getLink()
{
return $this->link;
}
/**
* {@inheritdoc}
*/
public function getCategory()
{
return $this->category;
}
/**
* {@inheritdoc}
*/
public function getTarget()
{
return '_self';
}
/**
* {@inheritdoc}
*/
public function getImage()
{
return $this->image;

@ -3,13 +3,17 @@ services:
class: Chamilo\CourseBundle\Tool\Notebook
arguments:
- notebook
- interaction
- notebook/index.php
- notebook.gif
tags:
- { name: chamilolm.course.tool }
- { name: chamilo.course.tool }
chamilo_notebook:
class: Chamilo\NotebookBundle\Form\Type\CNotebookType
tags:
- { name: form.type }
class: Chamilo\NotebookBundle\Form\Type\CNotebookType
tags:
- { name: form.type }
notebook.manager:
class: Chamilo\NotebookBundle\Entity\CNotebookManager

Loading…
Cancel
Save