| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- <?php
- namespace ModulesGarden\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models;
- use ModulesGarden\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Interfaces\AbstractModel;
- /**
- *
- * Created by PhpStorm.
- * User: Tomasz Bielecki ( tomasz.bi@modulesgarden.com )
- * Date: 10.09.19
- * Time: 08:43
- * Class DistributionList
- */
- class DistributionList extends AbstractModel
- {
- const ATTR_DISPLAY_NAME = 'displayName';
- const ATTR_DESCRIPTION = 'description';
- const ATTR_SUBSCRIPTION_REQUEST = 'kerioDistributionListSubscriptionPolicy';
- const ATTR_UNSUBSCRIPTION_REQUEST = 'kerioDistributionListUnsubscriptionPolicy';
- const ATTR_NOTIFY_SHARES = 'kerioDistributionListSendShareMessageToNewMembers';
- const ATTR_HIDE_IN_GAL = 'kerioHideInGal';
- const ATTR_MAIL_STATUS = 'kerioMailStatus';
- const REPLY_TO_ENABLED = 'kerioPrefReplyToEnabled';
- const REPLY_TO_DISPLAY = 'kerioPrefReplyToDisplay';
- const REPLY_TO_ADDRESS = 'kerioPrefReplyToAddress';
- protected $name;
- protected $id;
- protected $attrs;
- protected $dynamic = false;
- protected $members = [];
- protected $owners = [];
- protected $alias = null;
- /**
- * @return mixed
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * @param $id
- * @return $this
- */
- public function setId($id)
- {
- $this->id = $id;
- return $this;
- }
- /**
- * @return mixed
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * @param $name
- * @return $this
- */
- public function setName($name)
- {
- $this->name = $name;
- return $this;
- }
- /**
- * @return bool
- */
- public function isDynamic()
- {
- return $this->dynamic;
- }
- /**
- * @param bool $dynamic
- */
- public function setDynamic($dynamic)
- {
- $this->dynamic = $dynamic;
- }
- /**
- * @return mixed
- */
- public function getAttrs()
- {
- return $this->attrs;
- }
- /**
- * @param mixed $attrs
- */
- public function setAttrs($attrs)
- {
- $this->attrs = $attrs;
- }
- /**
- * @param $key
- * @param null $value
- */
- public function setAttr($key, $value = null)
- {
- $this->attrs[$key] = $value;
- }
- /**
- * @param $member
- * @return $this
- */
- public function addMember($member)
- {
- $this->members[$member] = $member;
- return $this;
- }
- /**
- * @param array $members
- * @return $this
- */
- public function setMembers($members = [])
- {
- $this->members = $members;
- return $this;
- }
- /**
- * @return array
- */
- public function getMembers()
- {
- return $this->members;
- }
- /**
- * @param array $owners
- * @return $this
- */
- public function setOwners($owners = [])
- {
- $this->owners = $owners;
- return $this;
- }
- /**
- * @param $owner
- * @return $this
- */
- public function addOwner($owner)
- {
- $this->owners[$owner] = $owner;
- return $this;
- }
- /**
- * @return array
- */
- public function getOwners()
- {
- return $this->owners;
- }
- /**
- * @param $owner
- * @return $this
- */
- public function setAlias($alias)
- {
- $this->alias = $alias;
- return $this;
- }
- /**
- * @return array
- */
- public function getAlias()
- {
- return $this->alias;
- }
- /**
- * @return mixed
- */
- public function getResourceMembers()
- {
- if($this->resources['dlm']['DATA'])
- {
- $tmp[$this->resources['dlm']['DATA']] = $this->resources['dlm']['DATA'];
- return $tmp;
- }
- foreach($this->resources['dlm'] as $owner)
- {
- $tmp[$owner['DATA']] = $owner['DATA'];
- }
- return $tmp;
- }
- /**
- * @return mixed
- */
- public function getResourceOwners()
- {
- $owners = $this->resources['owners'] ? $this->resources['owners'] : $this->owners;
- /**
- *
- */
- if($owners['OWNER']['NAME'])
- {
- $tmp[$owners['OWNER']['NAME']] = $owners['OWNER']['NAME'];
- return $tmp;
- }
- /**
- *
- */
- foreach($owners['OWNER'] as $owner)
- {
- $tmp[$owner['NAME']] = $owner['NAME'];
- }
- return $tmp;
- }
- /**
- * @return mixed
- */
- public function getResourceAliases()
- {
- foreach($this->getDataResourceACollection('kerioMailAlias') as $alias)
- {
- if(isset($alias['DATA']) && $this->getName() !== $alias['DATA'])
- {
- $tmp[$alias['DATA']] = $alias['DATA'];
- }elseif($this->getName() !== $alias){
- $tmp[$alias] =$alias;
- }
- }
- return $tmp;
- }
- }
|