parent
9e876293a0
commit
32a9d730d0
@ -1,11 +1,11 @@ |
||||
{{ 'You had a new message from %url%' | trans({'%url%': url(app.request.attributes.get('_route'))} ) }} |
||||
{{ 'You had a new message from %url%' | trans({'%url%': url(app.request.attributes.get('_route'))} ) }} |
||||
|
||||
{{ 'Firstname' | trans }} : {{ firstname }} |
||||
{{ 'Lirstname' | trans }} : {{ lastname }} |
||||
{{ 'Lastname' | trans }} : {{ lastname }} |
||||
|
||||
Email: {{ email }} |
||||
IP: {{ ip }} |
||||
|
||||
{{ 'Subject' | trans }} : {{ subject }} |
||||
{{ 'Message' | trans }} : |
||||
{{ message|raw }} |
||||
{{ message|raw }} |
||||
|
||||
@ -0,0 +1,109 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Entity\Resource; |
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection; |
||||
use Symfony\Component\Validator\Constraints as Assert; |
||||
use Doctrine\ORM\Mapping as ORM; |
||||
use Gedmo\Mapping\Annotation as Gedmo; |
||||
|
||||
/** |
||||
* @ORM\MappedSuperclass |
||||
* @ORM\HasLifecycleCallbacks |
||||
*/ |
||||
abstract class AbstractResource |
||||
{ |
||||
/** |
||||
* @ORM\Id |
||||
* @ORM\Column(type="integer") |
||||
* @ORM\GeneratedValue(strategy="AUTO") |
||||
*/ |
||||
protected $id; |
||||
|
||||
/** |
||||
* @var string |
||||
* |
||||
* @ORM\Column(name="name", type="string", length=255, precision=0, scale=0, nullable=false, unique=false) |
||||
*/ |
||||
protected $name; |
||||
|
||||
/** |
||||
* @ORM\OneToOne(targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceNode", cascade={"remove"}) |
||||
* @ORM\JoinColumn(name="resource_node_id") |
||||
*/ |
||||
protected $resourceNode; |
||||
|
||||
/** |
||||
* Returns the resource id. |
||||
* |
||||
* @return integer |
||||
*/ |
||||
public function getId() |
||||
{ |
||||
return $this->id; |
||||
} |
||||
|
||||
/** |
||||
* Sets the resource id. |
||||
* |
||||
* @param integer $id |
||||
*/ |
||||
public function setId($id) |
||||
{ |
||||
$this->id = $id; |
||||
} |
||||
|
||||
/** |
||||
* Returns the resource name. |
||||
* |
||||
* @return string |
||||
*/ |
||||
public function getName() |
||||
{ |
||||
return $this->name; |
||||
} |
||||
|
||||
/** |
||||
* Returns the resource name. |
||||
* |
||||
* @return string |
||||
*/ |
||||
public function setName($name) |
||||
{ |
||||
$this->name = $name; |
||||
} |
||||
|
||||
/** |
||||
* @ORM\PrePersist() |
||||
* @ORM\PreUpdate() |
||||
*/ |
||||
public function preUpdate() |
||||
{ |
||||
|
||||
} |
||||
|
||||
/** |
||||
* @ORM\PostRemove() |
||||
*/ |
||||
public function postRemove() |
||||
{ |
||||
|
||||
} |
||||
|
||||
/** |
||||
* @param ResourceNode $resourceNode |
||||
*/ |
||||
public function setResourceNode(ResourceNode $resourceNode) |
||||
{ |
||||
$this->resourceNode = $resourceNode; |
||||
} |
||||
|
||||
/** |
||||
* @return ResourceNode |
||||
*/ |
||||
public function getResourceNode() |
||||
{ |
||||
return $this->resourceNode; |
||||
} |
||||
} |
||||
@ -0,0 +1,363 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Entity\Resource; |
||||
|
||||
use Alchemy\Zippy\Adapter\Resource\ResourceInterface; |
||||
use Chamilo\CourseBundle\Entity\CGroupInfo; |
||||
use Doctrine\Common\Collections\ArrayCollection; |
||||
use Doctrine\ORM\Mapping as ORM; |
||||
use Chamilo\CoreBundle\Entity\Usergroup; |
||||
use Gedmo\Mapping\Annotation as Gedmo; |
||||
use Chamilo\UserBundle\Entity\User; |
||||
use Chamilo\CoreBundle\Entity\Course; |
||||
use Chamilo\CoreBundle\Entity\Session; |
||||
|
||||
/** |
||||
* @ORM\Entity |
||||
* @ORM\Table(name="resource_link") |
||||
*/ |
||||
class ResourceLink implements ResourceInterface |
||||
{ |
||||
/** |
||||
* @ORM\Id |
||||
* @ORM\Column(type="integer") |
||||
* @ORM\GeneratedValue(strategy="AUTO") |
||||
*/ |
||||
protected $id; |
||||
|
||||
/** |
||||
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceNode") |
||||
* @ORM\JoinColumn(name="resource_node_id", referencedColumnName="id") |
||||
*/ |
||||
protected $resourceNode; |
||||
|
||||
/** |
||||
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") |
||||
* @ORM\JoinColumn(name="session_id", referencedColumnName="id", nullable=true) |
||||
**/ |
||||
protected $session; |
||||
|
||||
/** |
||||
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User") |
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true) |
||||
**/ |
||||
protected $user; |
||||
|
||||
/** |
||||
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") |
||||
* @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=true) |
||||
*/ |
||||
protected $course; |
||||
|
||||
/** |
||||
* @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CGroupInfo") |
||||
* @ORM\JoinColumn(name="group_id", referencedColumnName="iid", nullable=true) |
||||
*/ |
||||
protected $group; |
||||
|
||||
/** |
||||
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Usergroup") |
||||
* @ORM\JoinColumn(name="usergroup_id", referencedColumnName="id", nullable=true) |
||||
*/ |
||||
protected $userGroup; |
||||
|
||||
/** |
||||
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceRights", mappedBy="resourceLink", cascade={"persist", "remove"}) |
||||
**/ |
||||
protected $rights; |
||||
|
||||
/** |
||||
* @var boolean |
||||
* |
||||
* @ORM\Column(name="private", type="boolean", nullable=true, unique=false) |
||||
*/ |
||||
protected $private; |
||||
|
||||
/** |
||||
* @var boolean |
||||
* |
||||
* @ORM\Column(name="public", type="boolean", nullable=true, unique=false) |
||||
*/ |
||||
protected $public; |
||||
|
||||
|
||||
/** |
||||
* @ORM\Column(name="start_visibility_at", type="datetime", nullable=true) |
||||
*/ |
||||
protected $startVisibilityAt; |
||||
|
||||
/** |
||||
* @ORM\Column(name="end_visibility_at", type="datetime", nullable=true) |
||||
*/ |
||||
protected $endVisibilityAt; |
||||
|
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public function __construct() |
||||
{ |
||||
$this->rights = new ArrayCollection(); |
||||
} |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getStartVisibilityAt() |
||||
{ |
||||
return $this->startVisibilityAt; |
||||
} |
||||
|
||||
/** |
||||
* @param mixed $startVisibilityAt |
||||
* @return ResourceLink |
||||
*/ |
||||
public function setStartVisibilityAt($startVisibilityAt) |
||||
{ |
||||
$this->startVisibilityAt = $startVisibilityAt; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getEndVisibilityAt() |
||||
{ |
||||
return $this->endVisibilityAt; |
||||
} |
||||
|
||||
/** |
||||
* @param mixed $endVisibilityAt |
||||
* @return ResourceLink |
||||
*/ |
||||
public function setEndVisibilityAt($endVisibilityAt) |
||||
{ |
||||
$this->endVisibilityAt = $endVisibilityAt; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function __toString() |
||||
{ |
||||
return (string)$this->getId(); |
||||
} |
||||
|
||||
/** |
||||
* @return boolean |
||||
*/ |
||||
public function isPrivate() |
||||
{ |
||||
return $this->private; |
||||
} |
||||
|
||||
/** |
||||
* @param boolean $private |
||||
*/ |
||||
public function setPrivate($private) |
||||
{ |
||||
$this->private = $private; |
||||
} |
||||
|
||||
/** |
||||
* @return boolean |
||||
*/ |
||||
public function isPublic() |
||||
{ |
||||
return $this->public; |
||||
} |
||||
|
||||
/** |
||||
* @param boolean $public |
||||
*/ |
||||
public function setPublic($public) |
||||
{ |
||||
$this->public = $public; |
||||
} |
||||
|
||||
/** |
||||
* @return ArrayCollection |
||||
*/ |
||||
public function getRights() |
||||
{ |
||||
return $this->rights; |
||||
} |
||||
|
||||
/** |
||||
* @param ArrayCollection $rights |
||||
* @return $this |
||||
*/ |
||||
public function setRights(ArrayCollection $rights) |
||||
{ |
||||
$this->rights = new ArrayCollection(); |
||||
|
||||
foreach ($rights as $right) { |
||||
$this->addRight($right); |
||||
} |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @param ResourceRights $right |
||||
* @return $this |
||||
*/ |
||||
public function addRight(ResourceRights $right) |
||||
{ |
||||
$right->setResourceLink($this); |
||||
$this->rights[] = $right; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return int |
||||
*/ |
||||
public function getId() |
||||
{ |
||||
return $this->id; |
||||
} |
||||
|
||||
/** |
||||
* @param int $id |
||||
* @return $this |
||||
*/ |
||||
public function setId($id) |
||||
{ |
||||
$this->id = $id; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @param User $user |
||||
* @return $this |
||||
*/ |
||||
public function setUser(User $user) |
||||
{ |
||||
$this->user = $user; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @param Course $course |
||||
* @return $this |
||||
*/ |
||||
public function setCourse(Course $course) |
||||
{ |
||||
$this->course = $course; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @param Session $session |
||||
* @return $this |
||||
*/ |
||||
public function setSession(Session $session) |
||||
{ |
||||
$this->session = $session; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return CGroupInfo |
||||
*/ |
||||
public function getGroup() |
||||
{ |
||||
return $this->group; |
||||
} |
||||
|
||||
/** |
||||
* @param CGroupInfo $group |
||||
* @return $this |
||||
*/ |
||||
public function setGroup(CGroupInfo $group) |
||||
{ |
||||
$this->group = $group; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return Usergroup |
||||
*/ |
||||
public function getUserGroup() |
||||
{ |
||||
return $this->userGroup; |
||||
} |
||||
|
||||
/** |
||||
* @param Usergroup $group |
||||
* @return $this |
||||
*/ |
||||
public function setUserGroup(Usergroup $group) |
||||
{ |
||||
$this->userGroup = $group; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* Get user |
||||
* |
||||
* @return User |
||||
*/ |
||||
public function getUser() |
||||
{ |
||||
return $this->user; |
||||
} |
||||
|
||||
/** |
||||
* Get course |
||||
* |
||||
* @return Course |
||||
*/ |
||||
public function getCourse() |
||||
{ |
||||
return $this->course; |
||||
} |
||||
|
||||
/** |
||||
* Get session |
||||
* |
||||
* @return Session |
||||
*/ |
||||
public function getSession() |
||||
{ |
||||
return $this->session; |
||||
} |
||||
|
||||
/** |
||||
* @param ResourceNode $resourceNode |
||||
* @return $this |
||||
*/ |
||||
public function setResourceNode(ResourceNode $resourceNode) |
||||
{ |
||||
$this->resourceNode = $resourceNode; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return ResourceNode |
||||
*/ |
||||
public function getResourceNode() |
||||
{ |
||||
return $this->resourceNode; |
||||
} |
||||
|
||||
/** |
||||
* @return $this |
||||
*/ |
||||
public function getResource() |
||||
{ |
||||
return $this; |
||||
} |
||||
} |
||||
@ -0,0 +1,388 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Entity\Resource; |
||||
|
||||
use Chamilo\CoreBundle\Entity\Tool; |
||||
use Doctrine\Common\Collections\ArrayCollection; |
||||
use Symfony\Component\Validator\Constraints as Assert; |
||||
use Doctrine\ORM\Mapping as ORM; |
||||
use Chamilo\UserBundle\Entity\User; |
||||
use Gedmo\Mapping\Annotation as Gedmo; |
||||
|
||||
/** |
||||
* Base entity for all resources. |
||||
* @ORM\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\MaterializedPathRepository") |
||||
* @ORM\Table(name="resource_node") |
||||
* @Gedmo\Tree(type="materializedPath") |
||||
* |
||||
*/ |
||||
class ResourceNode |
||||
{ |
||||
const PATH_SEPARATOR = '`'; |
||||
|
||||
/** |
||||
* @ORM\Id |
||||
* @ORM\Column(type="integer") |
||||
* @ORM\GeneratedValue(strategy="AUTO") |
||||
*/ |
||||
protected $id; |
||||
|
||||
/** |
||||
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Tool") |
||||
* @ORM\JoinColumn(name="tool_id", referencedColumnName="id") |
||||
**/ |
||||
protected $tool; |
||||
|
||||
/** |
||||
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceLink", mappedBy="resourceNode", cascade={"remove"}) |
||||
**/ |
||||
protected $links; |
||||
|
||||
/** |
||||
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Resource\AbstractResource", inversedBy="resourceNodes", cascade={"persist", "remove"}) |
||||
* @ORM\JoinColumn(name="resource_id", referencedColumnName="id") |
||||
**/ |
||||
//protected $resource; |
||||
|
||||
/** |
||||
* @ORM\ManyToOne( |
||||
* targetEntity="Chamilo\UserBundle\Entity\User", |
||||
* inversedBy="resourceNodes", |
||||
* cascade={"persist"} |
||||
* ) |
||||
* @ORM\JoinColumn(onDelete="CASCADE", nullable=false) |
||||
*/ |
||||
protected $creator; |
||||
|
||||
/** |
||||
* @Gedmo\TreePathSource |
||||
* @ORM\Column() |
||||
* @Assert\NotBlank() |
||||
*/ |
||||
protected $name; |
||||
|
||||
/** |
||||
* @Gedmo\TreeParent |
||||
* @ORM\ManyToOne( |
||||
* targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceNode", |
||||
* inversedBy="children" |
||||
* ) |
||||
* @ORM\JoinColumns({@ORM\JoinColumn(onDelete="CASCADE")}) |
||||
*/ |
||||
protected $parent; |
||||
|
||||
/** |
||||
* @Gedmo\TreeLevel |
||||
* @ORM\Column(name="level", type="integer", nullable=true) |
||||
* |
||||
*/ |
||||
protected $level; |
||||
|
||||
/** |
||||
* @ORM\OneToMany( |
||||
* targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceNode", |
||||
* mappedBy="parent" |
||||
* ) |
||||
* @ORM\OrderBy({"id" = "ASC"}) |
||||
*/ |
||||
protected $children; |
||||
|
||||
/** |
||||
* @Gedmo\TreePath(separator="`") |
||||
* @ORM\Column(name="path", type="string", length=3000, nullable=true) |
||||
* |
||||
*/ |
||||
protected $path; |
||||
|
||||
/** |
||||
* @ORM\Column(name="created_at", type="datetime") |
||||
* @Gedmo\Timestampable(on="create") |
||||
*/ |
||||
protected $createdAt; |
||||
|
||||
/** |
||||
* @ORM\Column(name="updated_at", type="datetime") |
||||
* @Gedmo\Timestampable(on="update") |
||||
*/ |
||||
protected $updatedAt; |
||||
|
||||
//private $pathForCreationLog = ''; |
||||
|
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public function __construct() |
||||
{ |
||||
$this->rights = new ArrayCollection(); |
||||
$this->children = new ArrayCollection(); |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function __toString() |
||||
{ |
||||
return (string)$this->getPath(); |
||||
} |
||||
|
||||
/** |
||||
* Returns the resource id. |
||||
* |
||||
* @return integer |
||||
*/ |
||||
public function getId() |
||||
{ |
||||
return $this->id; |
||||
} |
||||
|
||||
/** |
||||
* @param int $id |
||||
* @return $this |
||||
*/ |
||||
public function setId($id) |
||||
{ |
||||
$this->id = $id; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public function setUpdatedAt(\DateTime $updatedAt = null) |
||||
{ |
||||
$this->updatedAt = $updatedAt; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public function getUpdatedAt() |
||||
{ |
||||
return $this->updatedAt; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public function setCreatedAt(\DateTime $createdAt = null) |
||||
{ |
||||
$this->createdAt = $createdAt; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public function getCreatedAt() |
||||
{ |
||||
return $this->createdAt; |
||||
} |
||||
|
||||
/** |
||||
* Returns the tool. |
||||
* |
||||
* @return Tool |
||||
*/ |
||||
public function getTool() |
||||
{ |
||||
return $this->tool; |
||||
} |
||||
|
||||
/** |
||||
* Returns the resource type. |
||||
* @param Tool $tool |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setTool(Tool $tool) |
||||
{ |
||||
$this->tool = $tool; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* Returns the resource creator. |
||||
* |
||||
* @return User |
||||
*/ |
||||
public function getCreator() |
||||
{ |
||||
return $this->creator; |
||||
} |
||||
|
||||
/** |
||||
* Sets the resource creator. |
||||
* |
||||
* @param User $creator |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setCreator(User $creator) |
||||
{ |
||||
$this->creator = $creator; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* Returns the children resource instances. |
||||
* |
||||
* @return ArrayCollection |
||||
*/ |
||||
public function getChildren() |
||||
{ |
||||
return $this->children; |
||||
} |
||||
|
||||
/** |
||||
* Sets the parent resource. |
||||
* |
||||
* @param ResourceNode $parent |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setParent(ResourceNode $parent = null) |
||||
{ |
||||
$this->parent = $parent; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* Returns the parent resource. |
||||
* |
||||
* @return AbstractResource |
||||
*/ |
||||
public function getParent() |
||||
{ |
||||
return $this->parent; |
||||
} |
||||
|
||||
/** |
||||
* Return the lvl value of the resource in the tree. |
||||
* |
||||
* @return integer |
||||
*/ |
||||
public function getLevel() |
||||
{ |
||||
return $this->level; |
||||
} |
||||
|
||||
/** |
||||
* Returns the "raw" path of the resource |
||||
* (the path merge names and ids of all items). |
||||
* Eg.: "Root-1/subdir-2/file.txt-3/" |
||||
* @return string |
||||
*/ |
||||
public function getPath() |
||||
{ |
||||
return $this->path; |
||||
} |
||||
|
||||
/** |
||||
* Returns the path cleaned from its ids. |
||||
* Eg.: "Root/subdir/file.txt" |
||||
* @return |
||||
*/ |
||||
public function getPathForDisplay() |
||||
{ |
||||
return self::convertPathForDisplay($this->path); |
||||
} |
||||
|
||||
/** |
||||
* Sets the resource name. |
||||
* |
||||
* @param string $name |
||||
* @throws an exception if the name contains the path separator ('/'). |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setName($name) |
||||
{ |
||||
if (strpos(self::PATH_SEPARATOR, $name) !== false) { |
||||
throw new \InvalidArgumentException( |
||||
'Invalid character "'.self::PATH_SEPARATOR.'" in resource name.' |
||||
); |
||||
} |
||||
|
||||
$this->name = $name; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* Returns the resource name. |
||||
* |
||||
* @return string |
||||
*/ |
||||
public function getName() |
||||
{ |
||||
return $this->name; |
||||
} |
||||
|
||||
/** |
||||
* Convert a path for display: remove ids. |
||||
* |
||||
* @param string $path |
||||
* |
||||
* @return string |
||||
*/ |
||||
public static function convertPathForDisplay($path) |
||||
{ |
||||
$pathForDisplay = preg_replace( |
||||
'/-\d+'.self::PATH_SEPARATOR.'/', |
||||
' / ', |
||||
$path |
||||
); |
||||
|
||||
if ($pathForDisplay !== null && strlen($pathForDisplay) > 0) { |
||||
$pathForDisplay = substr_replace($pathForDisplay, "", -3); |
||||
} |
||||
|
||||
return $pathForDisplay; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* This is required for logging the resource path at the creation. |
||||
* Do not use this function otherwise. |
||||
* |
||||
* @return type |
||||
*/ |
||||
public function setPathForCreationLog($path) |
||||
{ |
||||
$this->pathForCreationLog = $path; |
||||
} |
||||
|
||||
/** |
||||
* This is required for logging the resource path at the creation. |
||||
* Do not use this function otherwise. |
||||
* |
||||
* @return type |
||||
*/ |
||||
public function getPathForCreationLog() |
||||
{ |
||||
return $this->pathForCreationLog; |
||||
} |
||||
|
||||
/** |
||||
* @param $resource |
||||
* @return $this |
||||
*/ |
||||
public function setResource($resource) |
||||
{ |
||||
$this->resource = $resource; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return ArrayCollection |
||||
*/ |
||||
public function getLinks() |
||||
{ |
||||
return $this->links; |
||||
} |
||||
} |
||||
@ -0,0 +1,118 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Entity\Resource; |
||||
|
||||
use Chamilo\CourseBundle\Entity\CGroupInfo; |
||||
use Doctrine\ORM\Mapping as ORM; |
||||
use Gedmo\Mapping\Annotation as Gedmo; |
||||
use Chamilo\UserBundle\Entity\User; |
||||
use Chamilo\CoreBundle\Entity\Course; |
||||
use Chamilo\CoreBundle\Entity\Session; |
||||
|
||||
/** |
||||
* @ORM\Entity |
||||
* @ORM\Table(name="resource_rights") |
||||
*/ |
||||
class ResourceRights |
||||
{ |
||||
/** |
||||
* @ORM\Id |
||||
* @ORM\Column(type="integer") |
||||
* @ORM\GeneratedValue(strategy="AUTO") |
||||
*/ |
||||
protected $id; |
||||
|
||||
/** |
||||
* @ORM\OneToOne(targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceLink") |
||||
* @ORM\JoinColumn(name="resource_link_id", referencedColumnName="id") |
||||
*/ |
||||
protected $resourceLink; |
||||
|
||||
/** |
||||
* @var string |
||||
* |
||||
* @ORM\Column(name="role", type="string", length=255, nullable=false) |
||||
*/ |
||||
protected $role; |
||||
|
||||
/** |
||||
* @var string |
||||
* |
||||
* @ORM\Column(name="mask", type="integer", nullable=false) |
||||
*/ |
||||
protected $mask; |
||||
|
||||
/** |
||||
* @return int |
||||
*/ |
||||
public function getId() |
||||
{ |
||||
return $this->id; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getMask() |
||||
{ |
||||
return $this->mask; |
||||
} |
||||
|
||||
/** |
||||
* @param string $mask |
||||
* @return $this |
||||
*/ |
||||
public function setMask($mask) |
||||
{ |
||||
$this->mask = $mask; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getResourceLink() |
||||
{ |
||||
return $this->resourceLink; |
||||
} |
||||
|
||||
/** |
||||
* @param mixed $resourceLink |
||||
* @return $this |
||||
*/ |
||||
public function setResourceLink($resourceLink) |
||||
{ |
||||
$this->resourceLink = $resourceLink; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getRole() |
||||
{ |
||||
return $this->role; |
||||
} |
||||
|
||||
/** |
||||
* @param string $role |
||||
* @return $this |
||||
*/ |
||||
public function setRole($role) |
||||
{ |
||||
$this->role = $role; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @param int $id |
||||
*/ |
||||
public function setId($id) |
||||
{ |
||||
$this->id = $id; |
||||
} |
||||
} |
||||
Loading…
Reference in new issue