Minor - merge from 1.11.x

pull/3006/head
Julio Montoya 5 years ago
parent 6447ad8d91
commit 361acb67b3
  1. 1
      main/course_home/course_home.php
  2. 6
      main/course_info/infocours.php
  3. 2
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/Minimal.php
  4. 44
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/TitleAsHtml.php
  5. 27
      src/CoreBundle/Component/Editor/Editor.php
  6. 89
      src/CourseBundle/Component/CourseCopy/Course.php
  7. 219
      src/CourseBundle/Entity/CExerciseCategory.php
  8. 7
      src/CourseBundle/Entity/CQuiz.php

@ -325,6 +325,7 @@ if ($documentAutoLaunch == 1) {
}
}
$tool_table = Database::get_course_table(TABLE_TOOL_LIST);
/* Introduction section (editable by course admins) */

@ -836,9 +836,15 @@ $groupNotification = [
$form->createElement('radio', 'hide_forum_notifications', null, get_lang('No'), 2),
];
$addUsers = [
$form->createElement('radio', 'subscribe_users_to_forum_notifications', null, get_lang('Yes'), 1),
$form->createElement('radio', 'subscribe_users_to_forum_notifications', null, get_lang('No'), 2),
];
$globalGroup = [
get_lang('EnableForumAutoLaunch') => $group,
get_lang('HideForumNotifications') => $groupNotification,
get_lang('SubscribeUsersToAllForumNotifications') => $addUsers,
'' => $myButton,
];

@ -24,7 +24,7 @@ class Minimal extends Basic
[
'name' => 'basicstyles',
'groups' => ['basicstyles', 'cleanup'],
'items' => ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript'],
'items' => ['Bold', 'Italic', 'Underline', 'Strike', 'TextColor'],
],
[
'name' => 'paragraph',

@ -0,0 +1,44 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* Toolbar used to allow titles to have an HTML format.
*
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class TitleAsHtml extends Basic
{
/**
* @return mixed
*/
public function getConfig()
{
$config['toolbar'] = [
[
'name' => 'clipboard',
'groups' => ['clipboard', 'undo'],
'items' => ['Cut', 'Copy', 'Paste', '-', 'Undo', 'Redo'],
],
[
'name' => 'basicstyles',
'groups' => ['basicstyles', 'cleanup'],
'items' => ['Bold', 'Italic', 'Underline', 'Strike', 'TextColor', 'BGColor'],
],
// [
// 'name' => 'paragraph',
// 'groups' => ['list', 'indent', 'blocks', 'align', 'bidi'],
// 'items' => ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'],
// ],
[
'name' => 'links',
'items' => ['Link', 'Unlink', 'Source'],
],
];
$config['height'] = '100';
return $config;
}
}

@ -13,6 +13,11 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
class Editor
{
/**
* @var string
*/
public $textareaId;
/**
* Name of the instance.
*
@ -85,6 +90,26 @@ class Editor
$this->name = $name;
}
/**
* @return string
*/
public function getTextareaId()
{
return $this->textareaId;
}
/**
* @param string $textareaId
*
* @return Editor
*/
public function setTextareaId($textareaId)
{
$this->textareaId = $textareaId;
return $this;
}
/**
* Return the HTML code required to run editor.
*
@ -94,7 +119,7 @@ class Editor
*/
public function createHtml($value)
{
$html = '<textarea id="'.$this->getName().'" name="'.$this->getName().'">'.$value.'</textarea>';
$html = '<textarea id="'.$this->getTextareaId().'" name="'.$this->getName().'">'.$value.'</textarea>';
return $html;
}

@ -70,18 +70,18 @@ class Course
/**
* Does this course has resources?
*
* @param int $resource_type Check if this course has resources of the
* @param int $type Check if this course has resources of the
* given type. If no type is given, check if course has resources of any
* type.
*
* @return bool
*/
public function has_resources($resource_type = null)
public function has_resources($type = null)
{
if ($resource_type != null) {
if ($type != null) {
return
isset($this->resources[$resource_type]) && is_array($this->resources[$resource_type]) && (
count($this->resources[$resource_type]) > 0
isset($this->resources[$type]) && is_array($this->resources[$type]) && (
count($this->resources[$type]) > 0
);
}
@ -109,6 +109,9 @@ class Course
$description = '';
switch ($type) {
case RESOURCE_ANNOUNCEMENT:
case RESOURCE_EVENT:
case RESOURCE_THEMATIC:
case RESOURCE_WIKI:
$title = $resource->title;
$description = $resource->content;
break;
@ -116,16 +119,13 @@ class Course
$title = $resource->title;
$description = $resource->comment;
break;
case RESOURCE_EVENT:
$title = $resource->title;
$description = $resource->content;
break;
case RESOURCE_FORUM:
$title = $resource->title;
$description = $resource->description;
break;
case RESOURCE_FORUMCATEGORY:
case RESOURCE_LINK:
case RESOURCE_LINKCATEGORY:
case RESOURCE_QUIZ:
case RESOURCE_TEST_CATEGORY:
case RESOURCE_WORK:
$title = $resource->title;
$description = $resource->description;
break;
@ -133,13 +133,11 @@ class Course
$title = $resource->title;
$description = $resource->text;
break;
case RESOURCE_SCORM:
case RESOURCE_FORUMTOPIC:
$title = $resource->title;
break;
case RESOURCE_GLOSSARY:
$title = $resource->name;
$description = $resource->description;
break;
case RESOURCE_LEARNPATH:
$title = $resource->name;
$description = $resource->description;
@ -147,29 +145,10 @@ class Course
case RESOURCE_LEARNPATH_CATEGORY:
$title = $resource->name;
break;
case RESOURCE_LINK:
$title = $resource->title;
$description = $resource->description;
break;
case RESOURCE_LINKCATEGORY:
$title = $resource->title;
$description = $resource->description;
break;
case RESOURCE_QUIZ:
$title = $resource->title;
$description = $resource->description;
break;
case RESOURCE_TEST_CATEGORY:
$title = $resource->title;
$description = $resource->description;
break;
case RESOURCE_QUIZQUESTION:
$title = $resource->question;
$description = $resource->description;
break;
case RESOURCE_SCORM:
$title = $resource->title;
break;
case RESOURCE_SURVEY:
$title = $resource->title;
$description = $resource->subtitle;
@ -181,22 +160,10 @@ class Course
case RESOURCE_TOOL_INTRO:
$description = $resource->intro_text;
break;
case RESOURCE_WIKI:
$title = $resource->title;
$description = $resource->content;
break;
case RESOURCE_THEMATIC:
$title = $resource->title;
$description = $resource->content;
break;
case RESOURCE_ATTENDANCE:
$title = $resource->params['name'];
$description = $resource->params['description'];
break;
case RESOURCE_WORK:
$title = $resource->title;
$description = $resource->description;
break;
default:
break;
}
@ -234,6 +201,7 @@ class Course
foreach ($resources as &$resource) {
switch ($type) {
case RESOURCE_ANNOUNCEMENT:
case RESOURCE_EVENT:
$resource->title = api_to_system_encoding($resource->title, $this->encoding);
$resource->content = api_to_system_encoding($resource->content, $this->encoding);
break;
@ -241,15 +209,12 @@ class Course
$resource->title = api_to_system_encoding($resource->title, $this->encoding);
$resource->comment = api_to_system_encoding($resource->comment, $this->encoding);
break;
case RESOURCE_EVENT:
$resource->title = api_to_system_encoding($resource->title, $this->encoding);
$resource->content = api_to_system_encoding($resource->content, $this->encoding);
break;
case RESOURCE_FORUM:
$resource->title = api_to_system_encoding($resource->title, $this->encoding);
$resource->description = api_to_system_encoding($resource->description, $this->encoding);
break;
case RESOURCE_QUIZ:
case RESOURCE_FORUMCATEGORY:
case RESOURCE_LINK:
case RESOURCE_LINKCATEGORY:
case RESOURCE_TEST_CATEGORY:
$resource->title = api_to_system_encoding($resource->title, $this->encoding);
$resource->description = api_to_system_encoding($resource->description, $this->encoding);
break;
@ -273,18 +238,6 @@ class Course
$resource->content_maker = api_to_system_encoding($resource->content_maker, $this->encoding);
$resource->content_license = api_to_system_encoding($resource->content_license, $this->encoding);
break;
case RESOURCE_LINK:
$resource->title = api_to_system_encoding($resource->title, $this->encoding);
$resource->description = api_to_system_encoding($resource->description, $this->encoding);
break;
case RESOURCE_LINKCATEGORY:
$resource->title = api_to_system_encoding($resource->title, $this->encoding);
$resource->description = api_to_system_encoding($resource->description, $this->encoding);
break;
case RESOURCE_QUIZ:
$resource->title = api_to_system_encoding($resource->title, $this->encoding);
$resource->description = api_to_system_encoding($resource->description, $this->encoding);
break;
case RESOURCE_QUIZQUESTION:
$resource->question = api_to_system_encoding($resource->question, $this->encoding);
$resource->description = api_to_system_encoding($resource->description, $this->encoding);
@ -295,10 +248,6 @@ class Course
}
}
break;
case RESOURCE_TEST_CATEGORY:
$resource->title = api_to_system_encoding($resource->title, $this->encoding);
$resource->description = api_to_system_encoding($resource->description, $this->encoding);
break;
case RESOURCE_SCORM:
$resource->title = api_to_system_encoding($resource->title, $this->encoding);
break;

@ -0,0 +1,219 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* CExerciseCategory.
*
* @ORM\Table(name="c_exercise_category")
* @ORM\Entity(repositoryClass="Gedmo\Sortable\Entity\Repository\SortableRepository")
*/
class CExerciseCategory
{
/**
* @var int
*
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue
*/
protected $id;
/**
* @var int
*
* @Gedmo\SortableGroup
* @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CExerciseCategory", inversedBy="children")
* @ORM\JoinColumn(referencedColumnName="id", onDelete="SET NULL")
*
* @ORM\Column(name="c_id", type="integer")
*/
protected $cId;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255, nullable=false)
*/
protected $name;
/**
* @var string
*
* @ORM\Column(name="description", type="text", nullable=true)
*/
protected $description;
/**
* @Gedmo\SortablePosition
* @ORM\Column(name="position", type="integer")
*/
protected $position;
/**
* @var \DateTime
*
* @ORM\Column(name="created_at", type="datetime", nullable=false)
*/
protected $createdAt;
/**
* @var \DateTime
*
* @ORM\Column(name="updated_at", type="datetime", nullable=false)
*/
protected $updatedAt;
/**
* Project constructor.
*/
public function __construct()
{
$this->createdAt = new \DateTime();
$this->updatedAt = new \DateTime();
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
*
* @return CExerciseCategory
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* @return int
*/
public function getCId()
{
return $this->cId;
}
/**
* @param int $cId
*
* @return CExerciseCategory
*/
public function setCId($cId)
{
$this->cId = $cId;
return $this;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*
* @return CExerciseCategory
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @param string $description
*
* @return CExerciseCategory
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @param \DateTime $createdAt
*
* @return CExerciseCategory
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* @param \DateTime $updatedAt
*
* @return CExerciseCategory
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @return mixed
*/
public function getPosition()
{
return $this->position;
}
/**
* @param mixed $position
*
* @return CExerciseCategory
*/
public function setPosition($position)
{
$this->position = $position;
return $this;
}
}

@ -210,6 +210,13 @@ class CQuiz
*/
protected $hideQuestionTitle;
/**
* @var int
*
* @ORM\Column(name="exercise_category_id", type="integer", nullable=true)
*/
protected $exerciseCategoryId;
/**
* @var bool
*

Loading…
Cancel
Save