Minor - fix course creation when using bbb plugin

pull/2650/head
Julio Montoya 7 years ago
parent 4d43e7fe01
commit 0982dfe25f
  1. 5
      main/inc/lib/plugin.class.php
  2. 8
      main/lp/learnpath.class.php
  3. 2
      plugin/ims_lti/ImsLtiPlugin.php
  4. 39
      src/CourseBundle/Entity/CTool.php
  5. 2
      src/CourseBundle/ToolChain.php

@ -963,17 +963,16 @@ class Plugin
->getRepository('ChamiloCourseBundle:CTool') ->getRepository('ChamiloCourseBundle:CTool')
->findOneBy([ ->findOneBy([
'name' => $name, 'name' => $name,
'cId' => $courseId, 'course' => $courseId,
]); ]);
if (!$tool) { if (!$tool) {
$cToolId = AddCourse::generateToolId($courseId); $cToolId = AddCourse::generateToolId($courseId);
$pluginName = $this->get_name(); $pluginName = $this->get_name();
$tool = new CTool(); $tool = new CTool();
$tool $tool
->setId($cToolId) ->setId($cToolId)
->setCId($courseId) ->setCourse(api_get_course_entity($courseId))
->setName($name.$visibilityPerStatus) ->setName($name.$visibilityPerStatus)
->setLink($link ?: "$pluginName/start.php") ->setLink($link ?: "$pluginName/start.php")
->setImage($iconName ?: "$pluginName.png") ->setImage($iconName ?: "$pluginName.png")

@ -4627,6 +4627,10 @@ class learnpath
return false; return false;
} }
if (empty($courseId)) {
return false;
}
$link = self::getCategoryLinkForTool($id); $link = self::getCategoryLinkForTool($id);
/** @var CTool $tool */ /** @var CTool $tool */
@ -4640,7 +4644,7 @@ class learnpath
$sessionCondition $sessionCondition
") ")
->setParameters([ ->setParameters([
'course' => (int) $courseId, 'course' => $courseId,
'link1' => $link, 'link1' => $link,
'link2' => "$link%", 'link2' => "$link%",
]) ])
@ -4657,7 +4661,7 @@ class learnpath
$tool = new CTool(); $tool = new CTool();
$tool $tool
->setCategory('authoring') ->setCategory('authoring')
->setCId($courseId) ->setCourse(api_get_course_entity($courseId))
->setName(strip_tags($category->getName())) ->setName(strip_tags($category->getName()))
->setLink($link) ->setLink($link)
->setImage('lp_category.gif') ->setImage('lp_category.gif')

@ -196,7 +196,7 @@ class ImsLtiPlugin extends Plugin
$em = Database::getManager(); $em = Database::getManager();
$cTool = new CTool(); $cTool = new CTool();
$cTool $cTool
->setCId($course->getId()) ->setCourse($course)
->setName($tool->getName()) ->setName($tool->getName())
->setLink($this->get_name().'/start.php?'.http_build_query(['id' => $tool->getId()])) ->setLink($this->get_name().'/start.php?'.http_build_query(['id' => $tool->getId()]))
->setImage($this->get_name().'.png') ->setImage($this->get_name().'.png')

@ -40,13 +40,6 @@ class CTool
*/ */
protected $id; protected $id;
/**
* @var int
*
* @ORM\Column(name="c_id", type="integer")
*/
protected $cId;
/** /**
* @var string * @var string
* *
@ -172,16 +165,20 @@ class CTool
/** /**
* @param Course $course * @param Course $course
*
* @return $this
*/ */
public function setCourse($course) public function setCourse(Course $course)
{ {
$this->course = $course; $this->course = $course;
return $this;
} }
/** /**
* @return Course * @return Course
*/ */
public function getCourse() public function getCourse(): Course
{ {
return $this->course; return $this->course;
} }
@ -466,30 +463,6 @@ class CTool
return $this->id; return $this->id;
} }
/**
* Set cId.
*
* @param int $cId
*
* @return CTool
*/
public function setCId($cId)
{
$this->cId = $cId;
return $this;
}
/**
* Get cId.
*
* @return int
*/
public function getCId()
{
return $this->cId;
}
/** /**
* @return string * @return string
*/ */

@ -121,7 +121,7 @@ class ToolChain
$visibility = in_array($tool->getName(), $toolVisibility) ? true : false; $visibility = in_array($tool->getName(), $toolVisibility) ? true : false;
$toolEntity $toolEntity
->setCId($course->getId()) ->setCourse($course)
->setImage($tool->getImage()) ->setImage($tool->getImage())
->setName($tool->getName()) ->setName($tool->getName())
->setVisibility($visibility) ->setVisibility($visibility)

Loading…
Cancel
Save