Created
December 25, 2015 10:13
-
-
Save NikitaObukhov/58ec29c713ad2196d25c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Entity; | |
use AppBundle\Interfaces\Activities\ActivityWithMembersInterface; | |
use AppBundle\Interfaces\Activities\ActivityWithProductsInterface; | |
use AppBundle\Interfaces\Activities\HasNextVisitTargetInterface; | |
use AppBundle\Traits\Activities\ActivityMembersTrait; | |
use AppBundle\Traits\Activities\ActivityProductsTrait; | |
use AppBundle\Traits\Activities\ActivityThemeTrait; | |
use AppBundle\Traits\Activities\CssCommonTrait; | |
use AppBundle\Traits\Activities\CssProductsTrait; | |
use AppBundle\Traits\Activities\NextVisitTargetTrait; | |
use AppBundle\Utils\TraitsEventsDispatcher; | |
use Doctrine\Common\Collections\Criteria; | |
use Doctrine\ORM\Event\LifecycleEventArgs; | |
use Doctrine\ORM\Event\PreUpdateEventArgs; | |
use Doctrine\ORM\Mapping as ORM; | |
use JMS\Serializer\Annotation as JMS; | |
use JMS\Serializer\DeserializationContext; | |
use JMS\Serializer\JsonDeserializationVisitor; | |
use Symfony\Component\Form\Tests\Extension\Validator\Type\BaseValidatorExtensionTest; | |
use Symfony\Component\Validator\Constraints as Assert; | |
/** | |
* Activities | |
* | |
* @ORM\Table(name="activities", indexes={@ORM\Index(name="user_id", columns={"user_id"}), @ORM\Index(name="persontype_id", columns={"persontype_id"}), @ORM\Index(name="activity_date", columns={"activity_date"}), @ORM\Index(name="state", columns={"state"}), @ORM\Index(name="acttype_id", columns={"acttype_id"}), @ORM\Index(name="organization_id", columns={"organization_id"}), @ORM\Index(name="person_id", columns={"person_id"}), @ORM\Index(name="plans_day", columns={"plans_day"}), @ORM\Index(name="comments", columns={"comments"}), @ORM\Index(name="usertype_id", columns={"usertype_id"}), @ORM\Index(name="orgtype_id", columns={"orgtype_id"}), @ORM\Index(name="subscriber_card", columns={"subscriber_card"})}) | |
* @ORM\Entity | |
* @ORM\HasLifecycleCallbacks() | |
* @JMS\ExclusionPolicy("all") | |
*/ | |
class Activities implements ActivityWithMembersInterface, ActivityWithProductsInterface | |
{ | |
use ActivityMembersTrait, ActivityProductsTrait; | |
const REPORTED = '1'; | |
/** | |
* @var integer | |
* | |
* @ORM\Column(name="parent_id", type="integer", nullable=true) | |
*/ | |
private $parentId; | |
/** | |
* Идентификатор типа активности. | |
* | |
* @var integer | |
* | |
* @ORM\Column(name="acttype_id", type="integer", nullable=false) | |
* @Assert\NotNull | |
* @Assert\Type("integer") | |
* @JMS\Expose | |
* @JMS\Type("integer") | |
* @JMS\SerializedName("acttypeId") | |
* @JMS\Groups({"sync", "save"}) | |
*/ | |
private $acttypeId = '0'; | |
/** | |
* Идентификатор пользователя, создавшего активность. | |
* | |
* @var integer | |
* | |
* @ORM\Column(name="user_id", type="integer", nullable=false) | |
* @Assert\NotNull | |
* @Assert\Type("integer") | |
* @JMS\Expose | |
* @JMS\SerializedName("userId") | |
* @JMS\Groups({"sync", "save"}) | |
* @JMS\ReadOnly | |
*/ | |
private $userId = '0'; | |
/** | |
* Идентификатор типа пользователя, создавшего эту активность. | |
* | |
* @var integer | |
* | |
* @ORM\Column(name="usertype_id", type="integer", nullable=false) | |
* @Assert\NotNull | |
* @Assert\Type("integer") | |
* @JMS\Expose | |
* @JMS\Type("integer") | |
* @JMS\SerializedName("usertypeId") | |
* @JMS\Groups({"sync", "save"}) | |
* @JMS\ReadOnly | |
*/ | |
private $usertypeId = '0'; | |
/** | |
* Идентификатор организации, в которую был нанесен визит. | |
* | |
* @var integer | |
* | |
* @ORM\Column(name="organization_id", type="integer", nullable=true) | |
* @Assert\NotNull | |
* @Assert\Type("integer") | |
* @JMS\Expose | |
* @JMS\SerializedName("organizationId") | |
* @JMS\Groups({"sync", "save"}) | |
*/ | |
private $organizationId = '0'; | |
/** | |
* Идентификатор типа организации, куда был нанесен (запланирован) визит. | |
* | |
* @var integer | |
* | |
* @ORM\Column(name="orgtype_id", type="integer", nullable=true) | |
* @Assert\NotNull | |
* @Assert\Type("integer") | |
* @JMS\Expose | |
* @JMS\SerializedName("orgtypeId") | |
* @JMS\Groups({"sync", "save"}) | |
* @JMS\ReadOnly | |
*/ | |
private $orgtypeId = '0'; | |
/** | |
* Идентификатор персоны, к которой был совершен (или запланирован) этот визит. | |
* | |
* @var integer | |
* | |
* @ORM\Column(name="person_id", type="integer", nullable=true) | |
* @Assert\NotNull | |
* @Assert\Type(type="integer") | |
* @JMS\Expose | |
* @JMS\SerializedName("personId") | |
* @JMS\Groups({"sync", "save"}) | |
*/ | |
private $personId = '0'; | |
/** | |
* Идентификатор типа персоны, к которой относится визит. | |
* | |
* @var integer | |
* | |
* @ORM\Column(name="persontype_id", type="integer", nullable=true) | |
* @Assert\NotNull | |
* @Assert\Type(type="integer") | |
* @JMS\Expose | |
* @JMS\SerializedName("persontypeId") | |
* @JMS\Groups({"sync", "save"}) | |
* @JMS\ReadOnly | |
*/ | |
private $persontypeId = '0'; | |
/** | |
* Дата активности. | |
* | |
* @ORM\Column(name="activity_date", type="date", nullable=false) | |
* @Assert\NotNull | |
* @Assert\Date | |
* @JMS\Expose | |
* @JMS\Type("DateTime<'Y-m-d'>") | |
* @JMS\SerializedName("activityDate") | |
* @JMS\Groups({"sync", "save"}) | |
*/ | |
private $activityDate = '0000-00-00'; | |
/** | |
* Дата контрольного визита | |
* | |
* @var \DateTime | |
* | |
* @Assert\Date | |
* @JMS\Expose | |
* @JMS\Type("DateTime<'Y-m-d'>") | |
* @JMS\SerializedName("controlDate") | |
* @JMS\AccessType("public_method") | |
* @JMS\Accessor(getter="getControlDate",setter="setControlDate") | |
* @JMS\Groups({"sync", "save"}) | |
*/ | |
private $controlDate; | |
/** | |
* @var string | |
* | |
* @ORM\Column(name="day_part", type="string", nullable=false) | |
*/ | |
private $dayPart = '1'; | |
/** | |
* @var \DateTime | |
* | |
* @ORM\Column(name="input_datetime", type="datetime", nullable=true) | |
*/ | |
private $inputDatetime; | |
/** | |
* @var integer | |
* | |
* @ORM\Column(name="persons_qty", type="integer", nullable=true) | |
*/ | |
private $personsQty; | |
/** | |
* @var integer | |
* | |
* @ORM\Column(name="costs", type="integer", nullable=true) | |
*/ | |
private $costs; | |
/** | |
* Запланирован ли этот визит? | |
* | |
* @var string | |
* | |
* @ORM\Column(name="plans_day", type="string", nullable=true) | |
* @Assert\Type(type="integer") | |
* @JMS\Expose | |
* @JMS\SerializedName("plansDay") | |
* @JMS\Groups({"sync", "save"}) | |
*/ | |
private $plansDay = '0'; | |
/** | |
* @var boolean | |
* | |
* @ORM\Column(name="duration", type="boolean", nullable=true) | |
*/ | |
private $duration; | |
/** | |
* Оборот (для организаций). | |
* | |
* @var integer | |
* | |
* @ORM\Column(name="turnover", type="integer", nullable=true) | |
* @Assert\Type(type="integer") | |
* @JMS\Expose | |
* @JMS\Groups({"sync", "save"}) | |
*/ | |
private $turnover; | |
/** | |
* @var string | |
* | |
* @ORM\Column(name="subscriber_card", type="string", nullable=true) | |
*/ | |
private $subscriberCard = '0'; | |
/** | |
* @var string | |
* | |
* @ORM\Column(name="lector_fio", type="string", length=64, nullable=true) | |
*/ | |
private $lectorFio; | |
/** | |
* Комментарий к визиту. | |
* | |
* @ORM\Column(name="comments", type="text", length=65535, nullable=true) | |
* @Assert\Type(type="string") | |
* @JMS\Expose | |
* @JMS\Groups({"sync", "save"}) | |
*/ | |
private $comments; | |
/** | |
* Статус активности. 0 - неотчитанный, 1 - отчитанный. | |
* | |
* @ORM\Column(name="state", type="string", nullable=true) | |
* @Assert\NotNull | |
* @Assert\Range(min=0, max=1) | |
* @JMS\Expose | |
* @JMS\Type("integer") | |
* @JMS\Groups({"sync", "save"}) | |
*/ | |
private $state = '0'; | |
/** | |
* Время визита. | |
* | |
* @ORM\Column(name="start_time", type="time", nullable=true) | |
* @Assert\Time | |
* @JMS\Expose | |
* @JMS\Type("DateTime<'H:i'>") | |
* @JMS\SerializedName("startTime") | |
* @JMS\Groups({"sync", "save"}) | |
*/ | |
private $startTime; | |
/** | |
* @var boolean | |
* | |
* @ORM\Column(name="offline", type="boolean", nullable=true) | |
*/ | |
private $offline = 'b\'0\''; | |
/** | |
* Идентификатор активности. | |
* | |
* @var integer | |
* | |
* @ORM\Column(name="activity_id", type="integer") | |
* @ORM\Id | |
* @ORM\GeneratedValue(strategy="IDENTITY") | |
* @JMS\Expose | |
* @JMS\SerializedName("activityId") | |
* @JMS\Groups({"sync", "save"}) | |
*/ | |
private $activityId; | |
/** | |
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Activitytypes", inversedBy="activities") | |
* @ORM\JoinColumns({ | |
* @ORM\JoinColumn(name="acttype_id", referencedColumnName="acttype_id") | |
* }) | |
*/ | |
private $activity_type; | |
/** | |
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Users", inversedBy="activities") | |
* @ORM\JoinColumns({ | |
* @ORM\JoinColumn(name="user_id", referencedColumnName="user_id") | |
* }) | |
*/ | |
private $user; | |
/** | |
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Usertypes", inversedBy="activities") | |
* @ORM\JoinColumns({ | |
* @ORM\JoinColumn(name="usertype_id", referencedColumnName="usertype_id") | |
* }) | |
* @TODO: Why here? Must be in user | |
*/ | |
private $user_type; | |
/** | |
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Organizations", inversedBy="activities") | |
* @ORM\JoinColumns({ | |
* @ORM\JoinColumn(name="organization_id", referencedColumnName="organization_id") | |
* }) | |
*/ | |
private $organization; | |
/** | |
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Organizationtypes", inversedBy="activities") | |
* @ORM\JoinColumns({ | |
* @ORM\JoinColumn(name="orgtype_id", referencedColumnName="orgtype_id") | |
* }) | |
*/ | |
private $organization_type; | |
/** | |
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Persontypes", inversedBy="activities") | |
* @ORM\JoinColumns({ | |
* @ORM\JoinColumn(name="persontype_id", referencedColumnName="persontype_id") | |
* }) | |
* @TODO: Why here? Must be in person. | |
*/ | |
private $person_type; | |
/** | |
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Persons", inversedBy="activities") | |
* @ORM\JoinColumns({ | |
* @ORM\JoinColumn(name="person_id", referencedColumnName="person_id") | |
* }) | |
*/ | |
private $person; | |
/** | |
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ActivityProductsInfo", mappedBy="activity") | |
*/ | |
private $products_info; | |
/** | |
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Activities", mappedBy="parent") | |
*/ | |
private $children; | |
/** | |
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Activities", inversedBy="children") | |
* @ORM\JoinColumn(name="parent_id", referencedColumnName="activity_id") | |
*/ | |
private $parent; | |
/** | |
* @var \AppBundle\Entity\Activities | |
*/ | |
private $prev_activity; | |
/** | |
* @var array | |
*/ | |
private $cycleSequence; | |
/** | |
* @param array $cycleSequence | |
*/ | |
public function setCycleSequence($cycleSequence) | |
{ | |
$this->cycleSequence = $cycleSequence; | |
return $this; | |
} | |
/** | |
* @return array | |
*/ | |
public function getCycleSequence() | |
{ | |
return $this->cycleSequence; | |
} | |
/** | |
* Set parentId | |
* | |
* @param integer $parentId | |
* | |
* @return Activities | |
*/ | |
public function setParentId($parentId) | |
{ | |
$this->parentId = $parentId; | |
return $this; | |
} | |
/** | |
* Get parentId | |
* | |
* @return integer | |
*/ | |
public function getParentId() | |
{ | |
return $this->parentId; | |
} | |
/** | |
* Set acttypeId | |
* | |
* @param integer $acttypeId | |
* | |
* @return Activities | |
*/ | |
public function setActtypeId($acttypeId) | |
{ | |
$this->acttypeId = $acttypeId; | |
return $this; | |
} | |
/** | |
* Get acttypeId | |
* | |
* @return integer | |
*/ | |
public function getActtypeId() | |
{ | |
return $this->acttypeId; | |
} | |
/** | |
* Set userId | |
* | |
* @param integer $userId | |
* | |
* @return Activities | |
*/ | |
public function setUserId($userId) | |
{ | |
$this->userId = $userId; | |
return $this; | |
} | |
/** | |
* Get userId | |
* | |
* @return integer | |
*/ | |
public function getUserId() | |
{ | |
return $this->userId; | |
} | |
/** | |
* Set usertypeId | |
* | |
* @param integer $usertypeId | |
* | |
* @return Activities | |
*/ | |
public function setUsertypeId($usertypeId) | |
{ | |
$this->usertypeId = $usertypeId; | |
return $this; | |
} | |
/** | |
* Get usertypeId | |
* | |
* @return integer | |
*/ | |
public function getUsertypeId() | |
{ | |
return $this->usertypeId; | |
} | |
/** | |
* Set organizationId | |
* | |
* @param integer $organizationId | |
* | |
* @return Activities | |
*/ | |
public function setOrganizationId($organizationId) | |
{ | |
$this->organizationId = $organizationId; | |
return $this; | |
} | |
/** | |
* Get organizationId | |
* | |
* @return integer | |
*/ | |
public function getOrganizationId() | |
{ | |
return $this->organizationId; | |
} | |
/** | |
* Set orgtypeId | |
* | |
* @param integer $orgtypeId | |
* | |
* @return Activities | |
*/ | |
public function setOrgtypeId($orgtypeId) | |
{ | |
$this->orgtypeId = $orgtypeId; | |
return $this; | |
} | |
/** | |
* Get orgtypeId | |
* | |
* @return integer | |
*/ | |
public function getOrgtypeId() | |
{ | |
return $this->orgtypeId; | |
} | |
/** | |
* Set personId | |
* | |
* @param integer $personId | |
* | |
* @return Activities | |
*/ | |
public function setPersonId($personId) | |
{ | |
$this->personId = $personId; | |
return $this; | |
} | |
/** | |
* Get personId | |
* | |
* @return integer | |
*/ | |
public function getPersonId() | |
{ | |
return $this->personId; | |
} | |
/** | |
* Set persontypeId | |
* | |
* @param integer $persontypeId | |
* | |
* @return Activities | |
*/ | |
public function setPersontypeId($persontypeId) | |
{ | |
$this->persontypeId = $persontypeId; | |
return $this; | |
} | |
/** | |
* Get persontypeId | |
* | |
* @return integer | |
*/ | |
public function getPersontypeId() | |
{ | |
return $this->persontypeId; | |
} | |
/** | |
* Set activityDate | |
* | |
* @param \DateTime $activityDate | |
* | |
* @return Activities | |
*/ | |
public function setActivityDate($activityDate) | |
{ | |
$this->activityDate = $activityDate; | |
return $this; | |
} | |
/** | |
* Get activityDate | |
* | |
* @return \DateTime | |
*/ | |
public function getActivityDate() | |
{ | |
return $this->activityDate; | |
} | |
/** | |
* Set dayPart | |
* | |
* @param string $dayPart | |
* | |
* @return Activities | |
*/ | |
public function setDayPart($dayPart) | |
{ | |
$this->dayPart = $dayPart; | |
return $this; | |
} | |
/** | |
* Get dayPart | |
* | |
* @return string | |
*/ | |
public function getDayPart() | |
{ | |
return $this->dayPart; | |
} | |
/** | |
* Set inputDatetime | |
* | |
* @param \DateTime $inputDatetime | |
* | |
* @return Activities | |
*/ | |
public function setInputDatetime($inputDatetime) | |
{ | |
$this->inputDatetime = $inputDatetime; | |
return $this; | |
} | |
/** | |
* Get inputDatetime | |
* | |
* @return \DateTime | |
*/ | |
public function getInputDatetime() | |
{ | |
return $this->inputDatetime; | |
} | |
/** | |
* Set personsQty | |
* | |
* @param integer $personsQty | |
* | |
* @return Activities | |
*/ | |
public function setPersonsQty($personsQty) | |
{ | |
$this->personsQty = $personsQty; | |
return $this; | |
} | |
/** | |
* Get personsQty | |
* | |
* @return integer | |
*/ | |
public function getPersonsQty() | |
{ | |
return $this->personsQty; | |
} | |
/** | |
* Set costs | |
* | |
* @param integer $costs | |
* | |
* @return Activities | |
*/ | |
public function setCosts($costs) | |
{ | |
$this->costs = $costs; | |
return $this; | |
} | |
/** | |
* Get costs | |
* | |
* @return integer | |
*/ | |
public function getCosts() | |
{ | |
return $this->costs; | |
} | |
/** | |
* Set plansDay | |
* | |
* @param string $plansDay | |
* | |
* @return Activities | |
*/ | |
public function setPlansDay($plansDay) | |
{ | |
$this->plansDay = $plansDay; | |
return $this; | |
} | |
/** | |
* Get plansDay | |
* | |
* @return string | |
*/ | |
public function getPlansDay() | |
{ | |
return $this->plansDay; | |
} | |
/** | |
* Set duration | |
* | |
* @param boolean $duration | |
* | |
* @return Activities | |
*/ | |
public function setDuration($duration) | |
{ | |
$this->duration = $duration; | |
return $this; | |
} | |
/** | |
* Get duration | |
* | |
* @return boolean | |
*/ | |
public function getDuration() | |
{ | |
return $this->duration; | |
} | |
/** | |
* Set turnover | |
* | |
* @param integer $turnover | |
* | |
* @return Activities | |
*/ | |
public function setTurnover($turnover) | |
{ | |
$this->turnover = $turnover; | |
return $this; | |
} | |
/** | |
* Get turnover | |
* | |
* @return integer | |
*/ | |
public function getTurnover() | |
{ | |
return $this->turnover; | |
} | |
/** | |
* Set subscriberCard | |
* | |
* @param string $subscriberCard | |
* | |
* @return Activities | |
*/ | |
public function setSubscriberCard($subscriberCard) | |
{ | |
$this->subscriberCard = $subscriberCard; | |
return $this; | |
} | |
/** | |
* Get subscriberCard | |
* | |
* @return string | |
*/ | |
public function getSubscriberCard() | |
{ | |
return $this->subscriberCard; | |
} | |
/** | |
* Set lectorFio | |
* | |
* @param string $lectorFio | |
* | |
* @return Activities | |
*/ | |
public function setLectorFio($lectorFio) | |
{ | |
$this->lectorFio = $lectorFio; | |
return $this; | |
} | |
/** | |
* Get lectorFio | |
* | |
* @return string | |
*/ | |
public function getLectorFio() | |
{ | |
return $this->lectorFio; | |
} | |
/** | |
* Set comments | |
* | |
* @param string $comments | |
* | |
* @return Activities | |
*/ | |
public function setComments($comments) | |
{ | |
$this->comments = $comments; | |
return $this; | |
} | |
/** | |
* Get comments | |
* | |
* @return string | |
*/ | |
public function getComments() | |
{ | |
return $this->comments; | |
} | |
/** | |
* Set state | |
* | |
* @param string $state | |
* | |
* @return Activities | |
*/ | |
public function setState($state) | |
{ | |
$this->state = $state; | |
return $this; | |
} | |
/** | |
* Get state | |
* | |
* @return string | |
*/ | |
public function getState() | |
{ | |
return $this->state; | |
} | |
/** | |
* Set startTime | |
* | |
* @param \DateTime $startTime | |
* | |
* @return Activities | |
*/ | |
public function setStartTime($startTime) | |
{ | |
$this->startTime = $startTime; | |
return $this; | |
} | |
/** | |
* Get startTime | |
* | |
* @return \DateTime | |
*/ | |
public function getStartTime() | |
{ | |
return $this->startTime; | |
} | |
/** | |
* Set offline | |
* | |
* @param boolean $offline | |
* | |
* @return Activities | |
*/ | |
public function setOffline($offline) | |
{ | |
$this->offline = $offline; | |
return $this; | |
} | |
/** | |
* Get offline | |
* | |
* @return boolean | |
*/ | |
public function getOffline() | |
{ | |
return $this->offline; | |
} | |
/** | |
* Get activityId | |
* | |
* @return integer | |
*/ | |
public function getActivityId() | |
{ | |
return $this->activityId; | |
} | |
/** | |
* @param int $activitySsid | |
*/ | |
public function setActivitySsid($activitySsid) | |
{ | |
$this->activityId = $activitySsid; | |
return $this; | |
} | |
/** | |
* @return int | |
*/ | |
public function getActivitySsid() | |
{ | |
return $this->activityId; | |
} | |
/** | |
* Set activityType | |
* | |
* @param \AppBundle\Entity\Activitytypes $activityType | |
* | |
* @return Activities | |
*/ | |
public function setActivityType(\AppBundle\Entity\Activitytypes $activityType = null) | |
{ | |
$this->activity_type = $activityType; | |
return $this; | |
} | |
/** | |
* Get activityType | |
* | |
* @return \AppBundle\Entity\Activitytypes | |
*/ | |
public function getActivityType() | |
{ | |
return $this->activity_type; | |
} | |
/** | |
* Set userType | |
* | |
* @param \AppBundle\Entity\Usertypes $userType | |
* | |
* @return Activities | |
*/ | |
public function setUserType(\AppBundle\Entity\Usertypes $userType = null) | |
{ | |
$this->user_type = $userType; | |
return $this; | |
} | |
/** | |
* Get userType | |
* | |
* @return \AppBundle\Entity\Usertypes | |
*/ | |
public function getUserType() | |
{ | |
return $this->user_type; | |
} | |
/** | |
* Set organization | |
* | |
* @param \AppBundle\Entity\Organizations $organization | |
* | |
* @return Activities | |
*/ | |
public function setOrganization(\AppBundle\Entity\Organizations $organization = null) | |
{ | |
$this->organization = $organization; | |
return $this; | |
} | |
/** | |
* Get organization | |
* | |
* @return \AppBundle\Entity\Organizations | |
*/ | |
public function getOrganization() | |
{ | |
return $this->organization; | |
} | |
/** | |
* Set personType | |
* | |
* @param \AppBundle\Entity\PersonTypes $personType | |
* | |
* @return Activities | |
*/ | |
public function setPersonType(\AppBundle\Entity\PersonTypes $personType = null) | |
{ | |
$this->person_type = $personType; | |
return $this; | |
} | |
/** | |
* Get personType | |
* | |
* @return \AppBundle\Entity\PersonTypes | |
*/ | |
public function getPersonType() | |
{ | |
return $this->person_type; | |
} | |
/** | |
* Set person | |
* | |
* @param \AppBundle\Entity\Persons $person | |
* | |
* @return Activities | |
*/ | |
public function setPerson(\AppBundle\Entity\Persons $person = null) | |
{ | |
$this->person = $person; | |
return $this; | |
} | |
/** | |
* Get person | |
* | |
* @return \AppBundle\Entity\Persons | |
*/ | |
public function getPerson() | |
{ | |
return $this->person; | |
} | |
/** | |
* Constructor | |
*/ | |
public function __construct() | |
{ | |
$this->initialize(); | |
} | |
public function __clone() | |
{ | |
$this->activityId = null; | |
} | |
/* | |
public function __wakeup() { | |
if (is_array($this->products)) { | |
$this->initialize(); | |
} | |
} | |
public function __clone() { | |
if (is_array($this->products)) { | |
$this->initialize(); | |
} | |
} | |
public function isCloneable() { | |
return true; | |
}*/ | |
protected function initialize() | |
{ | |
$this->products_info = new \Doctrine\Common\Collections\ArrayCollection(); | |
$this->activity_pos = new \Doctrine\Common\Collections\ArrayCollection(); | |
$this->products = new \Doctrine\Common\Collections\ArrayCollection(); | |
$this->photos = new \Doctrine\Common\Collections\ArrayCollection(); | |
} | |
/** | |
* Add productsInfo | |
* | |
* @param \AppBundle\Entity\ActivityProductsInfo $productsInfo | |
* | |
* @return Activities | |
*/ | |
public function addProductsInfo(\AppBundle\Entity\ActivityProductsInfo $productsInfo) | |
{ | |
$this->products_info[] = $productsInfo; | |
return $this; | |
} | |
/** | |
* Remove productsInfo | |
* | |
* @param \AppBundle\Entity\ActivityProductsInfo $productsInfo | |
*/ | |
public function removeProductsInfo(\AppBundle\Entity\ActivityProductsInfo $productsInfo) | |
{ | |
$this->products_info->removeElement($productsInfo); | |
} | |
/** | |
* Get productsInfo | |
* | |
* @return \Doctrine\Common\Collections\Collection | |
*/ | |
public function getProductsInfo() | |
{ | |
return $this->products_info; | |
} | |
/** | |
* Set user | |
* | |
* @param \AppBundle\Entity\Users $user | |
* | |
* @return Activities | |
*/ | |
public function setUser(\AppBundle\Entity\Users $user = null) | |
{ | |
$this->user = $user; | |
return $this; | |
} | |
/** | |
* Get user | |
* | |
* @return \AppBundle\Entity\Users | |
*/ | |
public function getUser() | |
{ | |
return $this->user; | |
} | |
/** | |
* Set parent | |
* | |
* @param \AppBundle\Entity\Activities $parent | |
* | |
* @return Activities | |
*/ | |
public function setParent(\AppBundle\Entity\Activities $parent = null) | |
{ | |
$this->parent = $parent; | |
return $this; | |
} | |
/** | |
* Get parent | |
* | |
* @return \AppBundle\Entity\Activities | |
*/ | |
public function getParent() | |
{ | |
return $this->parent; | |
} | |
/** | |
* Add child | |
* | |
* @param \AppBundle\Entity\Activities $child | |
* | |
* @return Activities | |
*/ | |
public function addChild(\AppBundle\Entity\Activities $child) | |
{ | |
$this->children[] = $child; | |
return $this; | |
} | |
/** | |
* Remove child | |
* | |
* @param \AppBundle\Entity\Activities $child | |
*/ | |
public function removeChild(\AppBundle\Entity\Activities $child) | |
{ | |
$this->children->removeElement($child); | |
} | |
/** | |
* Get children | |
* | |
* @return \AppBundle\Entity\Activities | |
*/ | |
public function getChildren() | |
{ | |
return $this->children; | |
} | |
public function hasChildren() | |
{ | |
return count($this->getChildren()) > 0; | |
} | |
/** | |
* @return \AppBundle\Entity\Activities | |
*/ | |
public function getChild() | |
{ | |
$children = $this->getChildren(); | |
return reset($children); | |
} | |
/** | |
* @return \AppBundle\Entity\Activities | |
*/ | |
public function getPrevActivity() | |
{ | |
return $this->prev_activity; | |
} | |
public function setPrevActivity(Activities $activity = null) | |
{ | |
$this->prev_activity = $activity; | |
return $this; | |
} | |
/** | |
* | |
* @return \DateTime | |
*/ | |
public function getControlDate(&$result = null) | |
{ | |
if (!$this->hasChildren()) { | |
return; | |
} | |
foreach ($this->getChildren() as $child) { | |
/* @var $child \AppBundle\Entity\Activities */ | |
if ($child->getUserId() == $this->getUserId()) { | |
$result = $child; | |
return $child->getActivityDate(); | |
} | |
} | |
} | |
public function setControlDate($control_date) | |
{ | |
$this->controlDate = $control_date; | |
return $this; | |
} | |
public function getStatusString() | |
{ | |
if ($this->getPlansDay() && !$this->getState()) { | |
return 'plan'; | |
} elseif ($this->getPlansDay() && $this->getState()) { | |
return 'fact'; | |
} elseif (!$this->getPlansDay() && $this->getState()) { | |
return 'outplan'; | |
} | |
} | |
/** | |
* Дополнительная информация об активности. | |
* | |
* @JMS\VirtualProperty | |
* @JMS\Type("AppBundle\Entity\ActivityViewData") | |
* @JMS\SerializedName("viewData") | |
* @JMS\Groups({"sync"}) | |
* @JMS\Until("2.0") | |
* | |
* @return float | |
*/ | |
public function getViewData() | |
{ | |
return new ActivityViewData($this); | |
} | |
/** | |
* @ORM\PostUpdate | |
*/ | |
public function postUpdate(LifecycleEventArgs $args) | |
{ | |
$em = $args->getEntityManager(); | |
$child = $old = $new = null; | |
if ($old = $this->getControlDate($child)) { | |
$old = $old->format('Y-m-d'); | |
} | |
/* $var $child \AppBundle\Entity\Activities */ | |
if ($new = $this->controlDate) { | |
$new = $this->controlDate->format('Y-m-d'); | |
} | |
if (!$new && $old && $child) { | |
$em->remove($child); | |
} elseif ($new && $old && $old !== $new) { | |
$child->setActivityDate($this->controlDate); | |
$em->merge($child); | |
$em->flush($child); | |
} elseif (!$old && $new) { | |
$next = $this->createNextActivity($this, $this->controlDate); | |
$em->detach($next); | |
$em->persist($next); | |
$em->flush($next); | |
} | |
} | |
/** | |
* @ORM\PostPersist | |
*/ | |
public function postPersist(LifecycleEventArgs $args) | |
{ | |
if ($date = $this->controlDate) { | |
$em = $args->getEntityManager(); | |
$next = $this->createNextActivity($this, $date); | |
$em->detach($next); | |
$em->persist($next); | |
$em->flush($next); | |
} | |
} | |
/** | |
* @ORM\PostLoad | |
*/ | |
public function postLoad(LifeCycleEventArgs $args) | |
{ | |
$that = $args->getEntity(); | |
/* @var $that \AppBundle\Entity\Activities */ | |
$em = $args->getEntityManager(); | |
$dql = 'select a.activityId from AppBundle:Activities a | |
where a.user = :user and a.person = :person and a.activity_type = :acttype | |
and a.activityDate > :date | |
order by a.activityDate desc'; | |
$next = $em->createQuery($dql) | |
->setParameter(':user', $that->getUser()) | |
->setParameter(':person', $that->getPerson()) | |
->setParameter(':acttype', $that->getActivityType()) | |
->setParameter(':date', $that->getActivityDate()) | |
->setMaxResults(1) | |
->getOneOrNullResult(); | |
if (null === $next) { | |
$dql = 'select a from AppBundle:Activities a | |
where a.user = :user and a.person = :person and a.activity_type = :acttype | |
and a.state = \'1\' and a.activityDate < :date | |
order by a.activityDate desc'; | |
$prev = $em->createQuery($dql) | |
->setParameter(':user', $that->getUser()) | |
->setParameter(':person', $that->getPerson()) | |
->setParameter(':acttype', $that->getActivityType()) | |
->setParameter(':date', $that->getActivityDate()) | |
->setMaxResults(1) | |
->getOneOrNullResult(); | |
if ($prev) { | |
$that->setPrevActivity($prev); | |
} | |
} | |
$dql = 'select c from AppBundle:Cycles c where c.dateBegin <= :now and c.dateEnd >= :now'; | |
$cycle = $em->createQuery($dql) | |
->setParameter(':now', new \DateTime('now')) | |
->getOneOrNullResult(); | |
if (!$cycle) { | |
// @TODO: handle | |
} | |
$dql = 'select sum(o.visitsQty) from AppBundle:LinkUsersCyclesObjectives l | |
left join AppBundle:Objectives o | |
with o.profileId = l.profileId | |
where l.cycleId = :cycle_id and l.userId = :user_id | |
and o.acttypeId = :acttype_id and o.persontypeId = :persontype_id '; | |
$total = $em->createQuery($dql) | |
->setParameter(':cycle_id', $cycle->getCycleId()) | |
->setParameter(':user_id', $that->getUserId()) | |
->setParameter(':acttype_id', $that->getActtypeId()) | |
->setParameter(':persontype_id', $that->getPersontypeId()) | |
->getSingleScalarResult(); | |
if ($total) { | |
$dql = 'select count(a.activityId) + 1 from AppBundle:Activities a | |
where a.activityDate >= :start and a.activityDate <= :end | |
and a.person = :person and a.user = :user and a.state = \'1\' and a.activityDate < :this_date'; | |
$count = $em->createQuery($dql) | |
->setParameter(':start', $cycle->getDateBegin()) | |
->setParameter(':end', $cycle->getDateEnd()) | |
->setParameter(':person', $that->getPerson()) | |
->setParameter(':user', $that->getUser()) | |
->setParameter(':this_date', $that->getActivityDate()) | |
->getSingleScalarResult(); | |
$that->setCycleSequence(array($count, $total)); | |
} | |
} | |
public function createNextActivity($prev, $date) | |
{ | |
$next = clone $prev; | |
$next->initialize(); | |
$next->setActivityDate($date); | |
$next->setParent($this); | |
$next->setControlDate(null); | |
$next->setPrevActivity($prev); | |
if (is_subclass_of($next, 'AppBundle\Interfaces\HasNextTargetInterface')) { | |
$next->setComments($this->getNextVisitTarget()); | |
$next->setNextVisitTarget(''); | |
} | |
if (is_subclass_of($next, 'AppBundle\Interfaces\GeoTrackInterface')) { | |
$next->setGeoTrack(null); | |
} | |
return $next; | |
} | |
/** | |
* Set organizationType | |
* | |
* @param \AppBundle\Entity\Organizationtypes $organizationType | |
* | |
* @return Activities | |
*/ | |
public function setOrganizationType(\AppBundle\Entity\Organizationtypes $organizationType = null) | |
{ | |
$this->organization_type = $organizationType; | |
return $this; | |
} | |
/** | |
* Get organizationType | |
* | |
* @return \AppBundle\Entity\Organizationtypes | |
*/ | |
public function getOrganizationType() | |
{ | |
return $this->organization_type; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Controller\Auth; | |
use AppBundle\Entity\AuthResult; | |
use AppBundle\Entity\Users; | |
use AppBundle\Response\APIResponse; | |
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
use Symfony\Component\HttpFoundation\Request; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; | |
use Symfony\Component\HttpFoundation\Response; | |
use Nelmio\ApiDocBundle\Annotation\ApiDoc; | |
use Symfony\Component\Security\Core\Exception\BadCredentialsException; | |
class AuthController extends Controller | |
{ | |
/** | |
* Аутентификация в АПИ. Получение токена для дальнейших операций. | |
* | |
* @Route("/logon", name="login") | |
* @Method({"POST", "GET"}) | |
* @ApiDoc( | |
* description="Аутентификация пользователя", | |
* parameters={ | |
* {"name"="login", "dataType"="string", "required"=false, "description"="Логин пользователя"}, | |
* {"name"="id", "dataType"="integer", "required"=false, "description"="Либо вместо логина идентификатор пользователя"}, | |
* {"name"="password", "dataType"="string", "required"=true, "description"="Пароль пользователя"} | |
* }, | |
* output="AppBundle\Entity\AuthResult", | |
* statusCodes={ | |
* 200="Успешная аутентификация", | |
* 403={ | |
* "Неверный пароль", | |
* "Пользователь неактивен" | |
* }, | |
* 404="Не существует пользователя с таким логином", | |
* 400="В запросе нет login или password" | |
* } | |
* ) | |
*/ | |
public function loginAction(Request $request) { | |
$username = $request->get('login'); | |
$user_id = $request->get('id'); | |
$password = $request->get('password'); | |
if ($username && $user_id) { | |
throw new BadCredentialsException('Please specify either login or user id (NOT BOTH).'); | |
} | |
if (((null !== $username && '' !== $username) || $user_id) && null !== $password && '' !== $password) | |
{ | |
$by = $user_id ? array( | |
'userId' => $user_id | |
) : array('login' => $username); | |
$user = $this->getDoctrine()->getRepository('AppBundle:Users')->findOneBy($by); | |
/* @var $user \AppBundle\Entity\Users */ | |
if (!$user) { | |
return new APIResponse(array( | |
'status' => 404, | |
'message' => '404 Not Found.', | |
'description' => sprintf('User with "%s" login does not exist.', $username), | |
), 404); | |
} | |
if (Users::ACTIVE !== $user->getState()) { | |
return new APIResponse(array( | |
'status' => 403, | |
'message' => '403 Forbidden.', | |
'description' => sprintf('User "%s" is not active.', $username), | |
), 403); | |
} | |
} | |
else { | |
return new APIResponse(array( | |
'status' => 400, | |
'message' => '400 Bad Request.', | |
'description' => 'Please provide both login and password.', | |
), 400); | |
} | |
if ($user->getPassword() === $password) { | |
$em = $this->getDoctrine()->getManager(); | |
$token = password_hash($password, \PASSWORD_DEFAULT); | |
$user->setToken($token); | |
$em->merge($user); | |
$em->flush(); | |
$json = $this->get('jms_serializer')->serialize(new AuthResult($user), 'json'); | |
return new APIResponse($json, 200); | |
} | |
else { | |
return new APIResponse(array( | |
'status' => 403, | |
'message' => '403 Forbidden.', | |
'description' => 'Please verify your token is valid.', | |
), 403); | |
} | |
} | |
/** | |
* Проверка валидности ранее полученного токена. | |
* | |
* @Route("/check", name="check") | |
* @Method({"POST", "GET"}) | |
* @ApiDoc( | |
* description="Проверка валидности токена", | |
* parameters={ | |
* {"name"="login", "dataType"="string", "required"=true, "description"="Логин пользователя"}, | |
* {"name"="token", "dataType"="string", "required"=true, "description"="Токен пользователя, полученный в методе logon"} | |
* }, | |
* statusCodes={ | |
* 200="Успешная проверка, токен валиден.", | |
* 403={ | |
* "Токен истёк", | |
* "Пользователь неактивен" | |
* }, | |
* 404="Не существует пользователя с таким логином" | |
* } | |
* ) | |
*/ | |
public function checkAction(Request $request) { | |
$username = $request->get('login'); | |
$token = $request->get('token'); | |
$user = $this->getDoctrine()->getRepository('AppBundle:Users')->findOneBy(array( | |
'login' => $username, | |
)); | |
/* @var $user \AppBundle\Entity\Users */ | |
if (!$user) { | |
return new APIResponse(array( | |
'status' => 404, | |
'message' => '404 Not Found.', | |
'description' => sprintf('User with "%s" login does not exist.', $username), | |
), 404); | |
} | |
if ($token !== $user->getToken()) { | |
return new APIResponse(array( | |
'status' => 403, | |
'message' => '403 Forbidden.', | |
'description' => 'Token has expired.', | |
), 403); | |
} | |
if (Users::ACTIVE !== $user->getState()) { | |
return new APIResponse(array( | |
'status' => 403, | |
'message' => '403 Forbidden.', | |
'description' => sprintf('User "%s" is not active.', $username), | |
), 403); | |
} | |
return new APIResponse(true); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Entity; | |
use AppBundle\Visits\VisitsCounter; | |
use Doctrine\Bundle\DoctrineBundle\Registry; | |
use Doctrine\Common\Collections\Criteria; | |
use JMS\Serializer\Annotation as JMS; | |
use Symfony\Component\Security\Core\SecurityContextInterface; | |
/** | |
* @JMS\ExclusionPolicy("all") | |
*/ | |
class Dictionaries { | |
/** | |
* @var \AppBundle\Entity\Users | |
*/ | |
private $user; | |
private $visits_counter; | |
private $doctrine; | |
/** | |
* Массив персон, относящихся к данному пользователю. | |
* | |
* @JMS\Expose | |
* @JMS\SerializedName("persons") | |
* @JMS\Accessor(getter="getPersons") | |
* @JMS\ReadOnly | |
* @JMS\Type("array<AppBundle\Entity\Persons>") | |
* | |
* @var \AppBundle\Entity\Persons[] | |
*/ | |
private $persons; | |
/** | |
* Массив организаций, относящиеся к данному пользователю. | |
* | |
* @JMS\Expose | |
* @JMS\Type("array<AppBundle\Entity\Organizations>") | |
* @JMS\Accessor(getter="getOrganizations") | |
* @JMS\ReadOnly | |
* | |
* @var \AppBundle\Entity\Organizations[] | |
*/ | |
private $organizations; | |
/** | |
* Массив товаров, относящихся к данному пользователю. | |
* | |
* @JMS\Expose | |
* @JMS\Type("array<AppBundle\Entity\ProductsDictionary>") | |
* @JMS\Accessor(getter="getProducts") | |
* @JMS\ReadOnly | |
*/ | |
private $products; | |
/** | |
* Массив типов персон, относящиеся к данному пользователю. | |
* | |
* @JMS\Expose | |
* @JMS\SerializedName("personTypes") | |
* @JMS\Accessor(getter="getPersonTypes") | |
* @JMS\ReadOnly | |
* @JMS\Type("array<AppBundle\Entity\Persontypes>") | |
* | |
* @var \AppBundle\Entity\Persontypes[] | |
*/ | |
private $personTypes; | |
/** | |
* Информация о текущем пользователе. | |
* | |
* @JMS\Expose | |
* @JMS\SerializedName("userInfo") | |
* @JMS\Accessor(getter="getUserInfo") | |
* @JMS\ReadOnly | |
* @JMS\Type("AppBundle\Entity\CityTimezone") | |
* | |
* @var \AppBundle\Entity\CityTimezone | |
*/ | |
private $userInfo; | |
/** | |
* Массив информации о CSS-визитах, где исполнителем указан данный пользователь и которые еще не сделаны и у которых указан дедлайн. | |
* | |
* @JMS\Expose | |
* @JMS\Type("array<AppBundle\Entity\ActivityCssCommon>") | |
* @JMS\SerializedName("css") | |
* @JMS\Accessor(getter="getCss") | |
* @JMS\ReadOnly | |
* | |
* @var \AppBundle\Entity\ActivityCssCommon | |
*/ | |
private $css; | |
/** | |
* Идентификаторы подчиненных данного пользователя (если таковые есть). | |
* | |
* @JMS\Expose | |
* @JMS\Type("array<integer>") | |
* @JMS\Accessor(getter="getWorkers") | |
* @JMS\ReadOnly | |
* @JMS\Until("2.0") | |
* | |
* @var integer[] | |
*/ | |
private $workers; | |
private $update = false; | |
private $security_context; | |
public function __construct(SecurityContextInterface $context, Registry $doctrine, VisitsCounter $visits_counter) { | |
$this->doctrine = $doctrine; | |
$this->visits_counter = $visits_counter; | |
$this->security_context = $context; | |
$this->user = $context->getToken()->getUser(); | |
$this->setup(); | |
} | |
/** | |
* | |
*/ | |
public function setupPersons() { | |
$expr = Criteria::expr(); | |
$persons = $this->user->getPersons()->matching( | |
Criteria::create() | |
->where($expr->eq('state', '1')) | |
); | |
$this->persons = $persons->getValues(); | |
} | |
/** | |
* | |
*/ | |
public function setupOrganizations() { | |
$expr = Criteria::expr(); | |
$criteria = Criteria::create() | |
->where($expr->eq('state', '1')) | |
->orderBy(array( | |
'organizationName' => Criteria::ASC, | |
)); | |
$this->organizations = $this->user | |
->getOrganizations() | |
->matching($criteria) | |
->getValues(); | |
} | |
/** | |
* | |
*/ | |
public function setupPersonTypes() { | |
$expr = Criteria::expr(); | |
$criteria = Criteria::create() | |
->where($expr->eq('state', '1')) | |
->orderBy(array( | |
'persontypeName' => Criteria::ASC, | |
)); | |
$this->personTypes = $this->user | |
->getUsertype() | |
->getPersonTypes() | |
->matching($criteria) | |
->getValues(); | |
} | |
/** | |
* | |
*/ | |
public function setupProducts() { | |
$result = $this->user | |
->getUsertype() | |
->getLinkProducts() | |
->getValues(); | |
$comparator = function (LinkUsertypesProducts $a,LinkUsertypesProducts $b) { | |
return strcmp($a->getProduct()->getProductName(), $b->getProduct()->getProductName()); | |
}; | |
uasort($result, $comparator); | |
$transformator = function(LinkUsertypesProducts $link) { | |
return new ProductsDictionary($link); | |
}; | |
$this->products = array_values(array_map($transformator, $result)); | |
} | |
/** | |
* | |
*/ | |
public function setupUserInfo() { | |
if (is_subclass_of($this->user, 'AppBundle\Interfaces\Users\HasCityInterface')) { | |
$this->userInfo = $this->user->getCityTimezone(); | |
} | |
} | |
/** | |
* | |
*/ | |
public function setupCss() { | |
if (false === is_subclass_of($this->user, 'AppBundle\Interfaces\Users\HasCssVisitsInterface')) { | |
return; | |
} | |
$expr = Criteria::expr(); | |
$criteria = Criteria::create() | |
->where($expr->eq('state', '1')); | |
$persons = $this->user->getPersons()->matching($criteria)->getValues(); | |
$criteria = Criteria::create() | |
->where($expr->in('person', $persons)) | |
->andWhere($expr->eq('isDone', '0')) | |
->andWhere($expr->gt('deadline', \DateTime::createFromFormat('U', 0))); // @TODO: is this correct? | |
$this->css = $this->user->getCssCommon()->matching($criteria)->getValues(); | |
} | |
/** | |
* | |
*/ | |
public function setupWorkers() { | |
$this->workers = $this->user->getChildren()->map(function(Users $user) { | |
return $user->getUserId(); | |
})->getValues(); | |
} | |
protected function getProductInfo(Products $product) { | |
return array( | |
'product_id' => $product->getProductId(), | |
'product_name' => $product->getProductName(), | |
); | |
} | |
protected function setup() { | |
$this->setupOrganizations(); | |
$this->setupPersonTypes(); | |
$this->setupCss(); | |
$this->setupUserInfo(); | |
$this->setupWorkers(); | |
$this->setupProducts(); | |
$this->setupPersons(); | |
} | |
/** | |
* @return Users | |
*/ | |
public function getUser() | |
{ | |
return $this->user; | |
} | |
public function setUser(Users $user) { | |
$this->update = true; | |
$this->user = $user; | |
$this->setup(); | |
} | |
/** | |
* @return Persons[] | |
*/ | |
public function getPersons() | |
{ | |
return $this->persons; | |
} | |
/** | |
* @return Organizations[] | |
*/ | |
public function getOrganizations() | |
{ | |
return $this->organizations; | |
} | |
/** | |
* @return mixed | |
*/ | |
public function getProducts() | |
{ | |
return $this->products; | |
} | |
/** | |
* @return Persontypes[] | |
*/ | |
public function getPersonTypes() | |
{ | |
return $this->personTypes; | |
} | |
/** | |
* @return CityTimezone | |
*/ | |
public function getUserInfo() | |
{ | |
return $this->userInfo; | |
} | |
/** | |
* @return \integer[] | |
*/ | |
public function getWorkers() | |
{ | |
return $this->workers; | |
} | |
/** | |
* @return ActivityCssCommon | |
*/ | |
public function getCss() | |
{ | |
return $this->css; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="jurist"> | |
<div class="container clearfix"> | |
{% include '_lawyer_table.html.twig' with {'lawyer': lawyer } %} | |
<div class="jurist-info"> | |
<h1>{{ lawyer.name }}</h1> | |
<span>Адвокат. г. {{ lawyer.getCity().name }}</span> | |
<p>Закажите у юриста консультацию или документы, или напишите ему сообщение</p> | |
<div> | |
<a class="btn" href="#">Бесплатный звонок</a> | |
{% if lawyer.isOnline() %} | |
<span class="online">Сейчас онлайн</span> | |
{% endif %} | |
</div> | |
</div> | |
{% include '_lawyer_rating.html.twig' with {'lawyer': lawyer} %} | |
<div class="jurist-ask"> | |
{{ drupal_render(question_form) }} | |
</div> | |
</div> | |
</div> | |
{% if answers %} | |
<div id="last-replies"> | |
<div class="container"> | |
<h2>Последние ответы</h2> | |
<div class="questions"> | |
{% for answer in answers %} | |
{% include '_question_teaser.html.twig' with {'q': answer.getQuestion()} %} | |
{% endfor %} | |
</div> | |
</div> | |
</div> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment