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. 698
      src/CoreBundle/Entity/ExtraField.php
  11. 2
      src/CoreBundle/Entity/Legal.php
  12. 2
      src/CoreBundle/Entity/PortfolioCategory.php
  13. 64
      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 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) * @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) * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SessionCategory", mappedBy="url", cascade={"persist"}, orphanRemoval=true)
*/ */
protected $sessionCategory; 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 * @var string

@ -13,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class AccessUrlRelCourse 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\ManyToOne(targetEntity="Course", inversedBy="urls", cascade={"persist"})
* @ORM\JoinColumn(name="c_id", referencedColumnName="id") * @ORM\JoinColumn(name="c_id", referencedColumnName="id")
@ -24,21 +33,13 @@ class AccessUrlRelCourse
* @ORM\JoinColumn(name="access_url_id", referencedColumnName="id") * @ORM\JoinColumn(name="access_url_id", referencedColumnName="id")
*/ */
protected $url; 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 * @return string
*/ */
public function __toString() public function __toString()
{ {
return strval('-'); return '-';
} }
/** /**

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

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

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

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

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

@ -21,6 +21,15 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class CourseRelUser 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\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="courses", cascade={"persist"})
* @ORM\JoinColumn(name="user_id", referencedColumnName="id") * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
@ -32,14 +41,6 @@ class CourseRelUser
* @ORM\JoinColumn(name="c_id", referencedColumnName="id") * @ORM\JoinColumn(name="c_id", referencedColumnName="id")
*/ */
protected $course; 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 * @var int
@ -47,14 +48,14 @@ class CourseRelUser
* @todo use status instead of this * @todo use status instead of this
* *
* @deprecated * @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; protected $relationType;
/** /**
* @var bool * @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; protected $status;
@ -68,21 +69,21 @@ class CourseRelUser
/** /**
* @var int * @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; protected $sort;
/** /**
* @var int * @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; protected $userCourseCat;
/** /**
* @var int * @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; protected $legalAgreement;
@ -99,7 +100,7 @@ class CourseRelUser
*/ */
public function __toString() 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 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\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="courses", cascade={"persist"})
* @ORM\JoinColumn(name="user_id", referencedColumnName="id") * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
@ -32,14 +41,6 @@ class CourseRelUserCatalogue
* @ORM\JoinColumn(name="c_id", referencedColumnName="id") * @ORM\JoinColumn(name="c_id", referencedColumnName="id")
*/ */
protected $course; 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 * @var bool
@ -60,7 +61,7 @@ class CourseRelUserCatalogue
*/ */
public function __toString() public function __toString()
{ {
return strval($this->getCourse()->getCode()); return (string) $this->getCourse()->getCode();
} }
/** /**

@ -7,353 +7,353 @@ use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo; use Gedmo\Mapping\Annotation as Gedmo;
/** /**
* Class ExtraField. * Class ExtraField.
* *
* @ORM\Entity * @ORM\Entity
* @ORM\Table(name="extra_field") * @ORM\Table(name="extra_field")
* *
* @ORM\MappedSuperclass * @ORM\MappedSuperclass
*/ */
class ExtraField // extends BaseAttribute class ExtraField // extends BaseAttribute
{ {
const USER_FIELD_TYPE = 1; const USER_FIELD_TYPE = 1;
const COURSE_FIELD_TYPE = 2; const COURSE_FIELD_TYPE = 2;
const SESSION_FIELD_TYPE = 3; const SESSION_FIELD_TYPE = 3;
const QUESTION_FIELD_TYPE = 4; const QUESTION_FIELD_TYPE = 4;
const CALENDAR_FIELD_TYPE = 5; const CALENDAR_FIELD_TYPE = 5;
const LP_FIELD_TYPE = 6; const LP_FIELD_TYPE = 6;
const LP_ITEM_FIELD_TYPE = 7; const LP_ITEM_FIELD_TYPE = 7;
const SKILL_FIELD_TYPE = 8; const SKILL_FIELD_TYPE = 8;
const WORK_FIELD_TYPE = 9; const WORK_FIELD_TYPE = 9;
const CAREER_FIELD_TYPE = 10; const CAREER_FIELD_TYPE = 10;
const USER_CERTIFICATE = 11; const USER_CERTIFICATE = 11;
const SURVEY_FIELD_TYPE = 12; const SURVEY_FIELD_TYPE = 12;
const SCHEDULED_ANNOUNCEMENT = 13; const SCHEDULED_ANNOUNCEMENT = 13;
/** /**
* @var int * @var int
* *
* @ORM\Column(name="id", type="integer", nullable=false, unique=false) * @ORM\Column(name="id", type="integer", nullable=false, unique=false)
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue * @ORM\GeneratedValue
*/ */
protected $id; protected $id;
/** /**
* @var int * @var int
* *
* @ORM\Column(name="extra_field_type", type="integer", nullable=false, unique=false) * @ORM\Column(name="extra_field_type", type="integer", nullable=false, unique=false)
*/ */
protected $extraFieldType; protected $extraFieldType;
/** /**
* @var int * @var int
* *
* @ORM\Column(name="field_type", type="integer", nullable=false, unique=false) * @ORM\Column(name="field_type", type="integer", nullable=false, unique=false)
*/ */
protected $fieldType; protected $fieldType;
/** /**
* @var string * @var string
* *
* @ORM\Column(name="variable", type="string", length=255, nullable=false, unique=false) * @ORM\Column(name="variable", type="string", length=255, nullable=false, unique=false)
*/ */
protected $variable; protected $variable;
/** /**
* @var string * @var string
* *
* @ORM\Column(name="display_text", type="string", length=255, nullable=true, unique=false) * @ORM\Column(name="display_text", type="string", length=255, nullable=true, unique=false)
*/ */
protected $displayText; protected $displayText;
/** /**
* @var string * @var string
* *
* @ORM\Column(name="default_value", type="text", nullable=true, unique=false) * @ORM\Column(name="default_value", type="text", nullable=true, unique=false)
*/ */
protected $defaultValue; protected $defaultValue;
/** /**
* @var int * @var int
* *
* @ORM\Column(name="field_order", type="integer", nullable=true, unique=false) * @ORM\Column(name="field_order", type="integer", nullable=true, unique=false)
*/ */
protected $fieldOrder; protected $fieldOrder;
/** /**
* @var bool * @var bool
* *
* @ORM\Column(name="visible_to_self", type="boolean", nullable=true, unique=false) * @ORM\Column(name="visible_to_self", type="boolean", nullable=true, unique=false)
*/ */
protected $visibleToSelf; protected $visibleToSelf;
/** /**
* @var bool * @var bool
* *
* @ORM\Column(name="visible_to_others", type="boolean", nullable=true, unique=false) * @ORM\Column(name="visible_to_others", type="boolean", nullable=true, unique=false)
*/ */
protected $visibleToOthers; protected $visibleToOthers;
/** /**
* @var bool * @var bool
* *
* @ORM\Column(name="changeable", type="boolean", nullable=true, unique=false) * @ORM\Column(name="changeable", type="boolean", nullable=true, unique=false)
*/ */
protected $changeable; protected $changeable;
/** /**
* @var bool * @var bool
* *
* @ORM\Column(name="filter", type="boolean", nullable=true, unique=false) * @ORM\Column(name="filter", type="boolean", nullable=true, unique=false)
*/ */
protected $filter; protected $filter;
/** /**
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\ExtraFieldOptions", mappedBy="field") * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\ExtraFieldOptions", mappedBy="field")
*/ */
protected $options; protected $options;
/** /**
* @var \DateTime * @var \DateTime
* *
* @Gedmo\Timestampable(on="create") * @Gedmo\Timestampable(on="create")
* @ORM\Column(name="created_at", type="datetime") * @ORM\Column(name="created_at", type="datetime")
*/ */
protected $createdAt; protected $createdAt;
/** /**
* ExtraField constructor. * ExtraField constructor.
*/ */
public function __construct() public function __construct()
{ {
//parent::__construct(); //parent::__construct();
$this->visibleToOthers = false; $this->visibleToOthers = false;
$this->visibleToSelf = false; $this->visibleToSelf = false;
} }
/** /**
* Get id. * Get id.
* *
* @return int * @return int
*/ */
public function getId() public function getId()
{ {
return $this->id; return $this->id;
} }
/** /**
* @return int * @return int
*/ */
public function getExtraFieldType() public function getExtraFieldType()
{ {
return $this->extraFieldType; return $this->extraFieldType;
} }
/** /**
* @param int $extraFieldType * @param int $extraFieldType
* *
* @return $this * @return $this
*/ */
public function setExtraFieldType($extraFieldType) public function setExtraFieldType($extraFieldType)
{ {
$this->extraFieldType = $extraFieldType; $this->extraFieldType = $extraFieldType;
return $this; return $this;
} }
/** /**
* @return int * @return int
*/ */
public function getFieldType() public function getFieldType()
{ {
return $this->fieldType; return $this->fieldType;
} }
/** /**
* @param int $fieldType * @param int $fieldType
* *
* @return $this * @return $this
*/ */
public function setFieldType($fieldType) public function setFieldType($fieldType)
{ {
$this->fieldType = $fieldType; $this->fieldType = $fieldType;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
public function getVariable() public function getVariable()
{ {
return $this->variable; return $this->variable;
} }
/** /**
* @param string $variable * @param string $variable
* *
* @return $this * @return $this
*/ */
public function setVariable($variable) public function setVariable($variable)
{ {
$this->variable = $variable; $this->variable = $variable;
return $this; return $this;
} }
/** /**
* @param bool $translated Optional. Whether translate the display text * @param bool $translated Optional. Whether translate the display text
* *
* @return string * @return string
*/ */
public function getDisplayText($translated = true) public function getDisplayText($translated = true)
{ {
if ($translated) { if ($translated) {
return \ExtraField::translateDisplayName($this->variable, $this->displayText); return \ExtraField::translateDisplayName($this->variable, $this->displayText);
} }
return $this->displayText; return $this->displayText;
} }
/** /**
* @param string $displayText * @param string $displayText
* *
* @return $this * @return $this
*/ */
public function setDisplayText($displayText) public function setDisplayText($displayText)
{ {
$this->displayText = $displayText; $this->displayText = $displayText;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
public function getDefaultValue() public function getDefaultValue()
{ {
return $this->defaultValue; return $this->defaultValue;
} }
/** /**
* @param string $defaultValue * @param string $defaultValue
* *
* @return $this * @return $this
*/ */
public function setDefaultValue($defaultValue) public function setDefaultValue($defaultValue)
{ {
$this->defaultValue = $defaultValue; $this->defaultValue = $defaultValue;
return $this; return $this;
} }
/** /**
* @return int * @return int
*/ */
public function getFieldOrder() public function getFieldOrder()
{ {
return $this->fieldOrder; return $this->fieldOrder;
} }
/** /**
* @param int $fieldOrder * @param int $fieldOrder
* *
* @return $this * @return $this
*/ */
public function setFieldOrder($fieldOrder) public function setFieldOrder($fieldOrder)
{ {
$this->fieldOrder = $fieldOrder; $this->fieldOrder = $fieldOrder;
return $this; return $this;
} }
/** /**
* @return bool * @return bool
*/ */
public function isChangeable() public function isChangeable()
{ {
return $this->changeable; return $this->changeable;
} }
/** /**
* @param bool $changeable * @param bool $changeable
* *
* @return $this * @return $this
*/ */
public function setChangeable($changeable) public function setChangeable($changeable)
{ {
$this->changeable = $changeable; $this->changeable = $changeable;
return $this; return $this;
} }
/** /**
* @return bool * @return bool
*/ */
public function isFilter() public function isFilter()
{ {
return $this->filter; return $this->filter;
} }
/** /**
* @param bool $filter * @param bool $filter
* *
* @return $this * @return $this
*/ */
public function setFilter($filter) public function setFilter($filter)
{ {
$this->filter = $filter; $this->filter = $filter;
return $this; return $this;
} }
/** /**
* @return bool * @return bool
*/ */
public function isVisibleToSelf() public function isVisibleToSelf()
{ {
return $this->visibleToSelf; return $this->visibleToSelf;
} }
/** /**
* @param bool $visibleToSelf * @param bool $visibleToSelf
* *
* @return ExtraField * @return ExtraField
*/ */
public function setVisibleToSelf($visibleToSelf) public function setVisibleToSelf($visibleToSelf)
{ {
$this->visibleToSelf = $visibleToSelf; $this->visibleToSelf = $visibleToSelf;
return $this; return $this;
} }
/** /**
* @return bool * @return bool
*/ */
public function isVisibleToOthers() public function isVisibleToOthers()
{ {
return $this->visibleToOthers; return $this->visibleToOthers;
} }
/** /**
* @param bool $visibleToOthers * @param bool $visibleToOthers
* *
* @return ExtraField * @return ExtraField
*/ */
public function setVisibleToOthers($visibleToOthers) public function setVisibleToOthers($visibleToOthers)
{ {
$this->visibleToOthers = $visibleToOthers; $this->visibleToOthers = $visibleToOthers;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
public function getTypeToString() public function getTypeToString()
{ {
switch ($this->type) { switch ($this->type) {
case \ExtraField::FIELD_TYPE_TEXT: case \ExtraField::FIELD_TYPE_TEXT:
case \ExtraField::FIELD_TYPE_TEXTAREA: case \ExtraField::FIELD_TYPE_TEXTAREA:
return 'text'; return 'text';
@ -363,5 +363,5 @@ use Gedmo\Mapping\Annotation as Gedmo;
default: default:
return 'text'; return 'text';
} }
} }
} }

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

@ -51,7 +51,7 @@ class PortfolioCategory
* @var User * @var User
* *
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\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; protected $user;

@ -38,6 +38,15 @@ class Session
const DRH = 1; const DRH = 1;
const COACH = 2; 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 * @var ArrayCollection
* @ORM\OneToMany(targetEntity="SessionRelCourse", mappedBy="session", cascade={"persist"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="SessionRelCourse", mappedBy="session", cascade={"persist"}, orphanRemoval=true)
@ -76,15 +85,6 @@ class Session
*/ */
protected $currentUrl; protected $currentUrl;
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/** /**
* @var string * @var string
* *
@ -382,11 +382,11 @@ class Session
{ {
if ($this->getUsers()->count()) { if ($this->getUsers()->count()) {
$criteria = Criteria::create()->where( $criteria = Criteria::create()->where(
Criteria::expr()->eq("user", $subscription->getUser()) Criteria::expr()->eq('user', $subscription->getUser())
)->andWhere( )->andWhere(
Criteria::expr()->eq("session", $subscription->getSession()) Criteria::expr()->eq('session', $subscription->getSession())
)->andWhere( )->andWhere(
Criteria::expr()->eq("relationType", $subscription->getRelationType()) Criteria::expr()->eq('relationType', $subscription->getRelationType())
); );
$relation = $this->getUsers()->matching($criteria); $relation = $this->getUsers()->matching($criteria);
@ -435,7 +435,7 @@ class Session
{ {
if ($this->getCourses()->count()) { if ($this->getCourses()->count()) {
$criteria = Criteria::create()->where( $criteria = Criteria::create()->where(
Criteria::expr()->eq("course", $course) Criteria::expr()->eq('course', $course)
); );
$relation = $this->getCourses()->matching($criteria); $relation = $this->getCourses()->matching($criteria);
@ -551,7 +551,7 @@ class Session
* *
* @param string $name * @param string $name
* *
* @return Session * @return $this
*/ */
public function setName($name) public function setName($name)
{ {
@ -575,7 +575,7 @@ class Session
* *
* @param string $description * @param string $description
* *
* @return Session * @return $this
*/ */
public function setDescription($description) public function setDescription($description)
{ {
@ -1071,11 +1071,11 @@ class Session
{ {
if ($this->getUserCourseSubscriptions()->count()) { if ($this->getUserCourseSubscriptions()->count()) {
$criteria = Criteria::create()->where( $criteria = Criteria::create()->where(
Criteria::expr()->eq("user", $subscription->getUser()) Criteria::expr()->eq('user', $subscription->getUser())
)->andWhere( )->andWhere(
Criteria::expr()->eq("course", $subscription->getCourse()) Criteria::expr()->eq('course', $subscription->getCourse())
)->andWhere( )->andWhere(
Criteria::expr()->eq("session", $subscription->getSession()) Criteria::expr()->eq('session', $subscription->getSession())
); );
$relation = $this->getUserCourseSubscriptions()->matching($criteria); $relation = $this->getUserCourseSubscriptions()->matching($criteria);
@ -1146,8 +1146,8 @@ class Session
/** /**
* Get user from course by status. * Get user from course by status.
* *
* @param \Chamilo\CoreBundle\Entity\Course $course * @param Course $course
* @param int $status * @param int $status
* *
* @return \Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection * @return \Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection
*/ */
@ -1155,35 +1155,15 @@ class Session
{ {
$criteria = Criteria::create() $criteria = Criteria::create()
->where( ->where(
Criteria::expr()->eq("course", $course) Criteria::expr()->eq('course', $course)
) )
->andWhere( ->andWhere(
Criteria::expr()->eq("status", $status) Criteria::expr()->eq('status', $status)
); );
return $this->userCourseSubscriptions->matching($criteria); 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 * @param ArrayCollection $studentPublications
* *

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

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

@ -261,30 +261,6 @@ class Skill
return $this->icon; 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. * Set criteria.
* *

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

@ -15,6 +15,22 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class CItemProperty 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", /** //, inversedBy="users",
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", cascade={"persist"}) * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", cascade={"persist"})
* @ORM\JoinColumn(name="c_id", referencedColumnName="id") * @ORM\JoinColumn(name="c_id", referencedColumnName="id")
@ -44,21 +60,6 @@ class CItemProperty
* @ORM\JoinColumn(name="session_id", referencedColumnName="id") * @ORM\JoinColumn(name="session_id", referencedColumnName="id")
*/ */
protected $session; 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 * @var string

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

Loading…
Cancel
Save