Minor - merge with 1.11.x

pull/2487/merge
Julio Montoya 7 years ago
parent 95973606cc
commit 88bc49f75b
  1. 18
      src/CoreBundle/Entity/AccessUrl.php
  2. 19
      src/CoreBundle/Entity/AccessUrlRelCourse.php
  3. 4
      src/CoreBundle/Entity/AccessUrlRelCourseCategory.php
  4. 18
      src/CoreBundle/Entity/AccessUrlRelSession.php
  5. 64
      src/CoreBundle/Entity/Course.php
  6. 10
      src/CoreBundle/Entity/CourseCategory.php
  7. 18
      src/CoreBundle/Entity/CourseModule.php
  8. 29
      src/CoreBundle/Entity/CourseRelUser.php
  9. 19
      src/CoreBundle/Entity/CourseRelUserCatalogue.php
  10. 6
      src/CoreBundle/Entity/ExtraField.php
  11. 2
      src/CoreBundle/Entity/Legal.php
  12. 2
      src/CoreBundle/Entity/PortfolioCategory.php
  13. 62
      src/CoreBundle/Entity/Session.php
  14. 24
      src/CoreBundle/Entity/SessionRelCourseRelUser.php
  15. 5
      src/CoreBundle/Entity/SessionRelUser.php
  16. 24
      src/CoreBundle/Entity/Skill.php
  17. 19
      src/CoreBundle/Entity/SkillRelUser.php
  18. 31
      src/CourseBundle/Entity/CItemProperty.php
  19. 1
      src/CourseBundle/Entity/CTool.php

@ -13,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/
class AccessUrl
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", precision=0, scale=0, nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\OneToMany(targetEntity="AccessUrlRelCourse", mappedBy="url", cascade={"persist"}, orphanRemoval=true)
*/
@ -32,14 +41,7 @@ class AccessUrl
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SessionCategory", mappedBy="url", cascade={"persist"}, orphanRemoval=true)
*/
protected $sessionCategory;
/**
* @var int
*
* @ORM\Column(name="id", type="integer", precision=0, scale=0, nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var string

@ -13,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/
class AccessUrlRelCourse
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", precision=0, scale=0, nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue()
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="Course", inversedBy="urls", cascade={"persist"})
* @ORM\JoinColumn(name="c_id", referencedColumnName="id")
@ -24,21 +33,13 @@ class AccessUrlRelCourse
* @ORM\JoinColumn(name="access_url_id", referencedColumnName="id")
*/
protected $url;
/**
* @var int
*
* @ORM\Column(name="id", type="integer", precision=0, scale=0, nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue()
*/
protected $id;
/**
* @return string
*/
public function __toString()
{
return strval('-');
return '-';
}
/**

@ -41,7 +41,7 @@ class AccessUrlRelCourseCategory
*
* @param int $accessUrlId
*
* @return AccessUrlRelSession
* @return $this
*/
public function setAccessUrlId($accessUrlId)
{
@ -71,7 +71,7 @@ class AccessUrlRelCourseCategory
/**
* @param int $courseCategoryId
*
* @return AccessUrlRelCourseCategory
* @return $this
*/
public function setCourseCategoryId($courseCategoryId)
{

@ -13,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/
class AccessUrlRelSession
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue()
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="Session", inversedBy="urls", cascade={"persist"})
* @ORM\JoinColumn(name="session_id", referencedColumnName="id")
@ -24,14 +33,7 @@ class AccessUrlRelSession
* @ORM\JoinColumn(name="access_url_id", referencedColumnName="id")
*/
protected $url;
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue()
*/
protected $id;
/**
* Get id.

@ -38,6 +38,15 @@ class Course
const OPEN_WORLD = 3;
const HIDDEN = 4;
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* "orphanRemoval" is needed to delete the CourseRelUser relation
* in the CourseAdmin class. The setUsers, getUsers, removeUsers and
@ -137,15 +146,6 @@ class Course
*/
protected $sharedSurveys;
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var string
*
@ -365,7 +365,7 @@ class Course
*/
public function __toString()
{
return strval($this->getTitle());
return (string) $this->getTitle();
}
/**
@ -714,6 +714,14 @@ class Course
return $this->title;
}
/**
* @return string
*/
public function getTitleAndCode()
{
return $this->getTitle().' ('.$this->getCode().')';
}
/**
* Set description.
*
@ -1297,36 +1305,6 @@ class Course
return $this->issuedSkills;
}
/**
* Check if the course has a picture.
*
* @return bool
*/
public function hasPicture()
{
return file_exists(api_get_path(SYS_COURSE_PATH).$this->directory.'/course-pic85x85.png');
}
/**
* Get the course picture path.
*
* @param bool $fullSize
*
* @return null|string
*/
public function getPicturePath($fullSize = false)
{
if (!$this->hasPicture()) {
return null;
}
if ($fullSize) {
return api_get_path(WEB_COURSE_PATH).$this->directory.'/course-pic.png';
}
return api_get_path(WEB_COURSE_PATH).$this->directory.'/course-pic85x85.png';
}
/**
* @param CourseRelUser $subscription
*
@ -1336,11 +1314,11 @@ class Course
{
if ($this->getUsers()->count()) {
$criteria = Criteria::create()->where(
Criteria::expr()->eq("user", $subscription->getUser())
Criteria::expr()->eq('user', $subscription->getUser())
)->andWhere(
Criteria::expr()->eq("status", $subscription->getStatus())
Criteria::expr()->eq('status', $subscription->getStatus())
)->andWhere(
Criteria::expr()->eq("relationType", $subscription->getRelationType())
Criteria::expr()->eq('relationType', $subscription->getRelationType())
);
$relation = $this->getUsers()->matching($criteria);

@ -23,10 +23,6 @@ use Doctrine\ORM\Mapping as ORM;
*/
class CourseCategory
{
/**
* @ORM\OneToMany(targetEntity="CourseCategory", mappedBy="parent")
*/
protected $children;
/**
* @var int
*
@ -36,6 +32,12 @@ class CourseCategory
*/
protected $id;
/**
* @ORM\OneToMany(targetEntity="CourseCategory", mappedBy="parent")
*/
protected $children;
/**
* @var string
*

@ -13,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/
class CourseModule
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $id;
/**
* @var string
*
@ -55,15 +64,6 @@ class CourseModule
*/
protected $position;
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $id;
/**
* Set name.
*

@ -21,6 +21,15 @@ use Doctrine\ORM\Mapping as ORM;
*/
class CourseRelUser
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="courses", cascade={"persist"})
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
@ -32,14 +41,6 @@ class CourseRelUser
* @ORM\JoinColumn(name="c_id", referencedColumnName="id")
*/
protected $course;
/**
* @var int
*
* @ORM\Column(name="id", type="integer", precision=0, scale=0, nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue
*/
protected $id;
/**
* @var int
@ -47,14 +48,14 @@ class CourseRelUser
* @todo use status instead of this
*
* @deprecated
* @ORM\Column(name="relation_type", type="integer", precision=0, scale=0, nullable=false, unique=false)
* @ORM\Column(name="relation_type", type="integer", nullable=false, unique=false)
*/
protected $relationType;
/**
* @var bool
*
* @ORM\Column(name="status", type="integer", precision=0, scale=0, nullable=false, unique=false)
* @ORM\Column(name="status", type="integer", nullable=false, unique=false)
*/
protected $status;
@ -68,21 +69,21 @@ class CourseRelUser
/**
* @var int
*
* @ORM\Column(name="sort", type="integer", precision=0, scale=0, nullable=true, unique=false)
* @ORM\Column(name="sort", type="integer", nullable=true, unique=false)
*/
protected $sort;
/**
* @var int
*
* @ORM\Column(name="user_course_cat", type="integer", precision=0, scale=0, nullable=true, unique=false)
* @ORM\Column(name="user_course_cat", type="integer", nullable=true, unique=false)
*/
protected $userCourseCat;
/**
* @var int
*
* @ORM\Column(name="legal_agreement", type="integer", precision=0, scale=0, nullable=true, unique=false)
* @ORM\Column(name="legal_agreement", type="integer", nullable=true, unique=false)
*/
protected $legalAgreement;
@ -99,7 +100,7 @@ class CourseRelUser
*/
public function __toString()
{
return strval($this->getCourse()->getCode());
return (string) $this->getCourse()->getCode();
}
/**

@ -21,6 +21,15 @@ use Doctrine\ORM\Mapping as ORM;
*/
class CourseRelUserCatalogue
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="courses", cascade={"persist"})
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
@ -32,14 +41,6 @@ class CourseRelUserCatalogue
* @ORM\JoinColumn(name="c_id", referencedColumnName="id")
*/
protected $course;
/**
* @var int
*
* @ORM\Column(name="id", type="integer", precision=0, scale=0, nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue
*/
protected $id;
/**
* @var bool
@ -60,7 +61,7 @@ class CourseRelUserCatalogue
*/
public function __toString()
{
return strval($this->getCourse()->getCode());
return (string) $this->getCourse()->getCode();
}
/**

@ -14,8 +14,8 @@ use Gedmo\Mapping\Annotation as Gedmo;
*
* @ORM\MappedSuperclass
*/
class ExtraField // extends BaseAttribute
{
class ExtraField // extends BaseAttribute
{
const USER_FIELD_TYPE = 1;
const COURSE_FIELD_TYPE = 2;
const SESSION_FIELD_TYPE = 3;
@ -364,4 +364,4 @@ use Gedmo\Mapping\Annotation as Gedmo;
return 'text';
}
}
}
}

@ -9,7 +9,7 @@ use Doctrine\ORM\Mapping as ORM;
* Legal.
*
* @ORM\Table(name="legal")
* @ORM\Entity
* @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Entity\Repository\LegalRepository")
*/
class Legal
{

@ -51,7 +51,7 @@ class PortfolioCategory
* @var User
*
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
*/
protected $user;

@ -38,6 +38,15 @@ class Session
const DRH = 1;
const COACH = 2;
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var ArrayCollection
* @ORM\OneToMany(targetEntity="SessionRelCourse", mappedBy="session", cascade={"persist"}, orphanRemoval=true)
@ -76,15 +85,6 @@ class Session
*/
protected $currentUrl;
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var string
*
@ -382,11 +382,11 @@ class Session
{
if ($this->getUsers()->count()) {
$criteria = Criteria::create()->where(
Criteria::expr()->eq("user", $subscription->getUser())
Criteria::expr()->eq('user', $subscription->getUser())
)->andWhere(
Criteria::expr()->eq("session", $subscription->getSession())
Criteria::expr()->eq('session', $subscription->getSession())
)->andWhere(
Criteria::expr()->eq("relationType", $subscription->getRelationType())
Criteria::expr()->eq('relationType', $subscription->getRelationType())
);
$relation = $this->getUsers()->matching($criteria);
@ -435,7 +435,7 @@ class Session
{
if ($this->getCourses()->count()) {
$criteria = Criteria::create()->where(
Criteria::expr()->eq("course", $course)
Criteria::expr()->eq('course', $course)
);
$relation = $this->getCourses()->matching($criteria);
@ -551,7 +551,7 @@ class Session
*
* @param string $name
*
* @return Session
* @return $this
*/
public function setName($name)
{
@ -575,7 +575,7 @@ class Session
*
* @param string $description
*
* @return Session
* @return $this
*/
public function setDescription($description)
{
@ -1071,11 +1071,11 @@ class Session
{
if ($this->getUserCourseSubscriptions()->count()) {
$criteria = Criteria::create()->where(
Criteria::expr()->eq("user", $subscription->getUser())
Criteria::expr()->eq('user', $subscription->getUser())
)->andWhere(
Criteria::expr()->eq("course", $subscription->getCourse())
Criteria::expr()->eq('course', $subscription->getCourse())
)->andWhere(
Criteria::expr()->eq("session", $subscription->getSession())
Criteria::expr()->eq('session', $subscription->getSession())
);
$relation = $this->getUserCourseSubscriptions()->matching($criteria);
@ -1146,7 +1146,7 @@ class Session
/**
* Get user from course by status.
*
* @param \Chamilo\CoreBundle\Entity\Course $course
* @param Course $course
* @param int $status
*
* @return \Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection
@ -1155,35 +1155,15 @@ class Session
{
$criteria = Criteria::create()
->where(
Criteria::expr()->eq("course", $course)
Criteria::expr()->eq('course', $course)
)
->andWhere(
Criteria::expr()->eq("status", $status)
Criteria::expr()->eq('status', $status)
);
return $this->userCourseSubscriptions->matching($criteria);
}
public function getBuyCoursePluginPrice()
{
// start buycourse validation
// display the course price and buy button if the buycourses plugin is enabled and this course is configured
$plugin = \BuyCoursesPlugin::create();
$isThisCourseInSale = $plugin->buyCoursesForGridCatalogValidator($this->id, \BuyCoursesPlugin::PRODUCT_TYPE_SESSION);
$return = [];
if ($isThisCourseInSale) {
// set the Price label
$return['html'] = $isThisCourseInSale['html'];
// set the Buy button instead register.
if ($isThisCourseInSale['verificator']) {
$return['buy_button'] = $plugin->returnBuyCourseButton($this->id, \BuyCoursesPlugin::PRODUCT_TYPE_SESSION);
}
}
// end buycourse validation
return $return;
}
/**
* @param ArrayCollection $studentPublications
*

@ -28,6 +28,15 @@ class SessionRelCourseRelUser
2 => 'course_coach',
];
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue
*/
protected $id;
/**
* @var User
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="sessionCourseSubscriptions", cascade={"persist"})
@ -52,30 +61,21 @@ class SessionRelCourseRelUser
/**
* @var int
*
* @ORM\Column(name="id", type="integer", precision=0, scale=0, nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue
*/
protected $id;
/**
* @var int
*
* @ORM\Column(name="visibility", type="integer", precision=0, scale=0, nullable=false, unique=false)
* @ORM\Column(name="visibility", type="integer", nullable=false, unique=false)
*/
protected $visibility;
/**
* @var int
*
* @ORM\Column(name="status", type="integer", precision=0, scale=0, nullable=false, unique=false)
* @ORM\Column(name="status", type="integer", nullable=false, unique=false)
*/
protected $status;
/**
* @var int
*
* @ORM\Column(name="legal_agreement", type="integer", precision=0, scale=0, nullable=true, unique=false)
* @ORM\Column(name="legal_agreement", type="integer", nullable=true, unique=false)
*/
protected $legalAgreement;

@ -23,6 +23,7 @@ class SessionRelUser
0 => 'student',
1 => 'drh',
];
/**
* @var int
*
@ -30,7 +31,7 @@ class SessionRelUser
* @ORM\Id
* @ORM\GeneratedValue
*/
protected $iid;
protected $id;
/**
* @ORM\ManyToOne(targetEntity="Session", inversedBy="users", cascade={"persist"})
@ -90,7 +91,7 @@ class SessionRelUser
*/
public function __construct()
{
$this->moved_to = null;
$this->movedTo = null;
$this->movedStatus = null;
$this->movedAt = null;
$this->registeredAt = new \DateTime('now', new \DateTimeZone('UTC'));

@ -261,30 +261,6 @@ class Skill
return $this->icon;
}
/**
* Get the icon (badge image) URL.
*
* @param bool $getSmall Optional. Allow get the small image
*
* @return string
*/
public function getWebIconPath($getSmall = false)
{
if ($getSmall) {
if (empty($this->icon)) {
return \Display::return_icon('badges-default.png', null, null, ICON_SIZE_BIG, null, true);
}
return api_get_path(WEB_UPLOAD_PATH).'badges/'.sha1($this->name).'-small.png';
}
if (empty($this->icon)) {
return \Display::return_icon('badges-default.png', null, null, ICON_SIZE_HUGE, null, true);
}
return api_get_path(WEB_UPLOAD_PATH)."badges/{$this->icon}";
}
/**
* Set criteria.
*

@ -24,6 +24,16 @@ use Doctrine\ORM\Mapping as ORM;
*/
class SkillRelUser
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
protected $id;
/**
* @ORM\OneToMany(targetEntity="SkillRelUserComment", mappedBy="skillRelUser")
*/
@ -39,15 +49,6 @@ class SkillRelUser
*/
protected $validationStatus;
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="achievedSkills", cascade={"persist"})
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)

@ -15,6 +15,22 @@ use Doctrine\ORM\Mapping as ORM;
*/
class CItemProperty
{
/**
* @var int
*
* @ORM\Column(name="iid", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
protected $iid;
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=true)
*/
protected $id;
/** //, inversedBy="users",
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", cascade={"persist"})
* @ORM\JoinColumn(name="c_id", referencedColumnName="id")
@ -44,21 +60,6 @@ class CItemProperty
* @ORM\JoinColumn(name="session_id", referencedColumnName="id")
*/
protected $session;
/**
* @var int
*
* @ORM\Column(name="iid", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
protected $iid;
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=true)
*/
protected $id;
/**
* @var string

@ -21,6 +21,7 @@ use Doctrine\ORM\Mapping as ORM;
class CTool
{
protected $originalImage;
/**
* @var int
*

Loading…
Cancel
Save