Fix personal data, remove unused properties in entities

pull/2650/head^2
Julio Montoya 7 years ago
parent 01c32e7d94
commit c4f890bef8
  1. 4
      main/social/personal_data.php
  2. 20
      src/CoreBundle/Entity/Course.php
  3. 24
      src/CoreBundle/Entity/SessionCategory.php
  4. 2
      src/CoreBundle/Entity/SessionRelCourseRelUser.php
  5. 27
      src/CourseBundle/Entity/CGroupInfo.php
  6. 102
      src/UserBundle/Entity/User.php
  7. 15
      src/UserBundle/Repository/UserRepository.php

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Repository\LegalRepository;
/**
* @package chamilo.messages
*/
@ -10,6 +8,8 @@ $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
api_set_more_memory_and_time_limits();
api_block_anonymous_users();
if (api_get_configuration_value('disable_gdpr')) {

@ -326,10 +326,6 @@ class Course
*/
protected $courseTypeId;
/**
* @ORM\OneToMany(targetEntity="Chamilo\NotebookBundle\Entity\CNotebook", mappedBy="course")
*/
//protected $notebooks;
/**
* ORM\OneToMany(targetEntity="CurriculumCategory", mappedBy="course").
@ -382,22 +378,6 @@ class Course
return $this->sessions;
}
/**
* @return ArrayCollection
*/
public function getNotebooks()
{
return $this->notebooks;
}
/**
* @return ArrayCollection
*/
public function getItems()
{
return $this->items;
}
/**
* @return ArrayCollection
*/

@ -165,28 +165,4 @@ class SessionCategory
{
return $this->dateEnd;
}
/**
* Set accessUrlId.
*
* @param int $accessUrlId
*
* @return SessionCategory
*/
public function setAccessUrlId($accessUrlId)
{
$this->accessUrlId = $accessUrlId;
return $this;
}
/**
* Get accessUrlId.
*
* @return int
*/
public function getAccessUrlId()
{
return $this->accessUrlId;
}
}

@ -227,7 +227,7 @@ class SessionRelCourseRelUser
*
* @return int
*/
public function getLegalAgreement(): int
public function getLegalAgreement()
{
return $this->legalAgreement;
}

@ -4,6 +4,7 @@
namespace Chamilo\CourseBundle\Entity;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Traits\CourseTrait;
use Doctrine\ORM\Mapping as ORM;
/**
@ -20,6 +21,8 @@ use Doctrine\ORM\Mapping as ORM;
*/
class CGroupInfo
{
use CourseTrait;
/**
* @var int
*
@ -578,30 +581,6 @@ class CGroupInfo
return $this->id;
}
/**
* Set cId.
*
* @param int $cId
*
* @return CGroupInfo
*/
public function setCId($cId)
{
$this->cId = $cId;
return $this;
}
/**
* Get cId.
*
* @return int
*/
public function getCId()
{
return $this->cId;
}
/**
* @return int
*/

@ -1484,108 +1484,6 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement
return $this->lastLogin;
}
/**
* {@inheritdoc}
*/
public function getExtraFields()
{
return $this->extraFields;
}
/**
* {@inheritdoc}
*/
public function setExtraFieldList($extraFields)
{
$this->extraFields = new ArrayCollection();
foreach ($extraFields as $extraField) {
$this->addExtraFields($extraField);
}
return $this;
}
public function setExtraFields($extraFields)
{
$this->extraFields = $extraFields;
}
/**
* {@inheritdoc}
*/
/*public function addExtraFields(ExtraFieldValues $extraFieldValue)
{
$extraFieldValue->setUser($this);
$this->extraFields[] = $extraFieldValue;
return $this;
}*/
/**
* {@inheritdoc}
*/
public function addExtraFields(ExtraFieldValues $extraFieldValue)
{
//if (!$this->hasExtraField($attribute)) {
$extraFieldValue->setUser($this);
$this->extraFields[] = $extraFieldValue;
//}
return $this;
}
/**
* {@inheritdoc}
*/
public function removeExtraField(ExtraFieldValues $attribute)
{
//if ($this->hasExtraField($attribute)) {
//$this->extraFields->removeElement($attribute);
//$attribute->setUser($this);
//}
return $this;
}
/**
* {@inheritdoc}
*/
/*public function hasExtraField($attribute)
{
if (!$this->extraFields) {
return false;
}
return $this->extraFields->contains($attribute);
}*/
/**
* {@inheritdoc}
*/
public function hasExtraFieldByName($attributeName)
{
foreach ($this->extraFields as $attribute) {
if ($attribute->getName() === $attributeName) {
return true;
}
}
return false;
}
/**
* {@inheritdoc}
*/
public function getExtraFieldByName($attributeName)
{
foreach ($this->extraFields as $attribute) {
if ($attribute->getName() === $attributeName) {
return $attribute;
}
}
return null;
}
/**
* Get sessionCourseSubscription.
*

@ -626,7 +626,7 @@ class UserRepository extends EntityRepository
$date = $item->getTms() ? $item->getTms()->format($dateFormat) : '';
$list = [
'Attempt #'.$item->getExeId(),
'Course # '.$item->getCId(),
'Course # '.$item->getCourse()->getCode(),
//'Answer: '.$item->getAnswer(),
'Session #'.$item->getSessionId(),
//'Marks: '.$item->getMarks(),
@ -926,17 +926,21 @@ class UserRepository extends EntityRepository
// Message
$criteria = [
'userSenderId' => $userId,
'userSender' => $userId,
];
$result = $em->getRepository('ChamiloCoreBundle:Message')->findBy($criteria);
$messageList = [];
/** @var Message $item */
foreach ($result as $item) {
$date = $item->getSendDate() ? $item->getSendDate()->format($dateFormat) : '';
$userName = '';
if ($item->getUserReceiver()) {
$userName = $item->getUserReceiver()->getUsername();
}
$list = [
'Title: '.$item->getTitle(),
'Sent date: '.$date,
'To user # '.$item->getUserReceiverId(),
'To user: '.$userName,
'Status'.$item->getMsgStatus(),
];
$messageList[] = implode(', ', $list);
@ -1237,7 +1241,7 @@ class UserRepository extends EntityRepository
$list = [];
/** @var AccessUrlRelUser $portal */
foreach ($portals as $portal) {
$portalInfo = \UrlManager::get_url_data_from_id($portal->getAccessUrlId());
$portalInfo = \UrlManager::get_url_data_from_id($portal->getUrl()->getId());
$list[] = $portalInfo['url'];
}
}
@ -1262,7 +1266,8 @@ class UserRepository extends EntityRepository
$extraFieldValues = new \ExtraFieldValue('user');
$items = $extraFieldValues->getAllValuesByItem($userId);
$user->setExtraFields($items);
//$user->setExtraFields($items);
//$user->setExtraFields([]);
$lastLogin = $user->getLastLogin();
if (empty($lastLogin)) {

Loading…
Cancel
Save