|
|
|
|
<?php
|
|
|
|
|
/* For licensing terms, see /license.txt */
|
|
|
|
|
|
|
|
|
|
namespace Chamilo\CourseBundle\Entity;
|
|
|
|
|
|
|
|
|
|
use Chamilo\CoreBundle\Entity\Resource\AbstractResource;
|
|
|
|
|
use Chamilo\CoreBundle\Entity\Resource\ResourceInterface;
|
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* CDocument.
|
|
|
|
|
*
|
|
|
|
|
* @ORM\Table(
|
|
|
|
|
* name="c_document",
|
|
|
|
|
* indexes={
|
|
|
|
|
* @ORM\Index(name="course", columns={"c_id"})
|
|
|
|
|
* }
|
|
|
|
|
* )
|
|
|
|
|
* @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CDocumentRepository")
|
|
|
|
|
*/
|
|
|
|
|
class CDocument extends AbstractResource implements ResourceInterface
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @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 int
|
|
|
|
|
*
|
|
|
|
|
* @ORM\Column(name="c_id", type="integer")
|
|
|
|
|
*/
|
|
|
|
|
protected $cId;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string
|
|
|
|
|
*
|
|
|
|
|
* @ORM\Column(name="path", type="string", length=255, nullable=false)
|
|
|
|
|
*/
|
|
|
|
|
protected $path;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string
|
|
|
|
|
*
|
|
|
|
|
* @ORM\Column(name="comment", type="text", nullable=true)
|
|
|
|
|
*/
|
|
|
|
|
protected $comment;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string
|
|
|
|
|
*
|
|
|
|
|
* @ORM\Column(name="title", type="string", length=255, nullable=true)
|
|
|
|
|
*/
|
|
|
|
|
protected $title;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string
|
|
|
|
|
*
|
|
|
|
|
* @ORM\Column(name="filetype", type="string", length=10, nullable=false)
|
|
|
|
|
*/
|
|
|
|
|
protected $filetype;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var int
|
|
|
|
|
*
|
|
|
|
|
* @ORM\Column(name="size", type="integer", nullable=false)
|
|
|
|
|
*/
|
|
|
|
|
protected $size;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var bool
|
|
|
|
|
*
|
|
|
|
|
* @ORM\Column(name="readonly", type="boolean", nullable=false)
|
|
|
|
|
*/
|
|
|
|
|
protected $readonly;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var int
|
|
|
|
|
*
|
|
|
|
|
* @ORM\Column(name="session_id", type="integer", nullable=false)
|
|
|
|
|
*/
|
|
|
|
|
protected $sessionId;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* CDocument constructor.
|
|
|
|
|
*/
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set path.
|
|
|
|
|
*
|
|
|
|
|
* @param string $path
|
|
|
|
|
*
|
|
|
|
|
* @return CDocument
|
|
|
|
|
*/
|
|
|
|
|
public function setPath($path)
|
|
|
|
|
{
|
|
|
|
|
$this->path = $path;
|
|
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get path.
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getPath()
|
|
|
|
|
{
|
|
|
|
|
return $this->path;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set comment.
|
|
|
|
|
*
|
|
|
|
|
* @param string $comment
|
|
|
|
|
*
|
|
|
|
|
* @return CDocument
|
|
|
|
|
*/
|
|
|
|
|
public function setComment($comment)
|
|
|
|
|
{
|
|
|
|
|
$this->comment = $comment;
|
|
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get comment.
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getComment()
|
|
|
|
|
{
|
|
|
|
|
return $this->comment;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set title.
|
|
|
|
|
*
|
|
|
|
|
* @param string $title
|
|
|
|
|
*
|
|
|
|
|
* @return CDocument
|
|
|
|
|
*/
|
|
|
|
|
public function setTitle($title)
|
|
|
|
|
{
|
|
|
|
|
$this->title = $title;
|
|
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get title.
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getTitle()
|
|
|
|
|
{
|
|
|
|
|
return $this->title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set filetype.
|
|
|
|
|
*
|
|
|
|
|
* @param string $filetype
|
|
|
|
|
*
|
|
|
|
|
* @return CDocument
|
|
|
|
|
*/
|
|
|
|
|
public function setFiletype($filetype)
|
|
|
|
|
{
|
|
|
|
|
$this->filetype = $filetype;
|
|
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get filetype.
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getFiletype()
|
|
|
|
|
{
|
|
|
|
|
return $this->filetype;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set size.
|
|
|
|
|
*
|
|
|
|
|
* @param int $size
|
|
|
|
|
*
|
|
|
|
|
* @return CDocument
|
|
|
|
|
*/
|
|
|
|
|
public function setSize($size)
|
|
|
|
|
{
|
|
|
|
|
$this->size = $size;
|
|
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get size.
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getSize()
|
|
|
|
|
{
|
|
|
|
|
return $this->size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set readonly.
|
|
|
|
|
*
|
|
|
|
|
* @param bool $readonly
|
|
|
|
|
*
|
|
|
|
|
* @return CDocument
|
|
|
|
|
*/
|
|
|
|
|
public function setReadonly($readonly)
|
|
|
|
|
{
|
|
|
|
|
$this->readonly = $readonly;
|
|
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get readonly.
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function getReadonly()
|
|
|
|
|
{
|
|
|
|
|
return $this->readonly;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set sessionId.
|
|
|
|
|
*
|
|
|
|
|
* @param int $sessionId
|
|
|
|
|
*
|
|
|
|
|
* @return CDocument
|
|
|
|
|
*/
|
|
|
|
|
public function setSessionId($sessionId)
|
|
|
|
|
{
|
|
|
|
|
$this->sessionId = $sessionId;
|
|
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get sessionId.
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getSessionId()
|
|
|
|
|
{
|
|
|
|
|
return $this->sessionId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set id.
|
|
|
|
|
*
|
|
|
|
|
* @param int $id
|
|
|
|
|
*
|
|
|
|
|
* @return CDocument
|
|
|
|
|
*/
|
|
|
|
|
public function setId($id)
|
|
|
|
|
{
|
|
|
|
|
$this->id = $id;
|
|
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get id.
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getId()
|
|
|
|
|
{
|
|
|
|
|
return $this->id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set cId.
|
|
|
|
|
*
|
|
|
|
|
* @param int $cId
|
|
|
|
|
*
|
|
|
|
|
* @return CDocument
|
|
|
|
|
*/
|
|
|
|
|
public function setCId($cId)
|
|
|
|
|
{
|
|
|
|
|
$this->cId = $cId;
|
|
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get cId.
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getCId()
|
|
|
|
|
{
|
|
|
|
|
return $this->cId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getIid()
|
|
|
|
|
{
|
|
|
|
|
return $this->iid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Resource classes
|
|
|
|
|
|
|
|
|
|
public function getResourceIdentifier(): int
|
|
|
|
|
{
|
|
|
|
|
return $this->getIid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getResourceName(): string
|
|
|
|
|
{
|
|
|
|
|
return $this->getTitle();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getToolName(): string
|
|
|
|
|
{
|
|
|
|
|
return 'document';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getName()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function name()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
public function isName()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
public function hasName() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function __get($a) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|