Minor - fix course creation when using bbb plugin

pull/2650/head
Julio Montoya 6 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')
->findOneBy([
'name' => $name,
'cId' => $courseId,
'course' => $courseId,
]);
if (!$tool) {
$cToolId = AddCourse::generateToolId($courseId);
$pluginName = $this->get_name();
$tool = new CTool();
$tool
->setId($cToolId)
->setCId($courseId)
->setCourse(api_get_course_entity($courseId))
->setName($name.$visibilityPerStatus)
->setLink($link ?: "$pluginName/start.php")
->setImage($iconName ?: "$pluginName.png")

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

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

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

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

Loading…
Cancel
Save