'.$domain->getName().'', XSD_ANYXML), ); $this->connection->cleanResponse(); $result = $this->connection ->cleanResponse() ->request("GetAllDistributionListsRequest", $params); return $result; } /** * @param \ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list * @return bool|\ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList */ public function read(\ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapVar(''.$list->getId().'', XSD_ANYXML), ); $result = $result = $this->connection ->cleanResponse() ->request("GetDistributionListRequest",$params); if($data = $result->getResponseBody()['GETDISTRIBUTIONLISTRESPONSE']['DL']) { $list->fill($data); return $list; } $this->setError($result->getLastError()); return false; } /** * @param \ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list * @return bool|\ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList */ public function create(\ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapParam($list->getName(), "name"), ); $attrs = $list->getAttrs(); if($list->isDynamic()) { $params[] = new SoapParam(1, "dynamic"); unset($attrs['zimbraDistributionListSendShareMessageToNewMembers']); } foreach($attrs as $key => $value) { $params[] = new SoapVar('' . $value . '', XSD_ANYXML); } $result = $result = $this->connection ->cleanResponse() ->request("CreateDistributionListRequest",$params); /** * load response to model */ if($accountData = $result->getResponseBody()['CREATEDISTRIBUTIONLISTRESPONSE']['DL']) { $list->fill($accountData); return $list; } $this->setError($result->getLastError()); return false; } /** * @param \ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list * @return bool|\ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList */ public function update(\ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list) { $params = [ new SoapParam($list->getId(), 'id') ]; $attrs = $list->getAttrs(); if($list->isDynamic()) { $params[] = new SoapParam(1, "dynamic"); unset($attrs['zimbraDistributionListSendShareMessageToNewMembers']); } foreach($attrs as $key => $value) { $params[] = new SoapVar('' . $value . '', XSD_ANYXML); } $result = $result = $this->connection ->cleanResponse() ->request("ModifyDistributionListRequest",$params); if($data = $result->getResponseBody()['MODIFYDISTRIBUTIONLISTRESPONSE']['DL']) { $list->fill($data); return $list; } $this->setError($result->getLastError()); return false; } /** * @param \ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list * @return bool */ public function delete(\ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapParam($list->getId(), "id"), ); $result = $result = $this->connection ->cleanResponse() ->request("DeleteDistributionListRequest",$params); if($result->getResponseBody()['DELETEDISTRIBUTIONLISTRESPONSE']) { return true; } $this->setError($result->getLastError()); return false; } /** * @param \ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list * @return bool */ public function addMembers(\ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapParam($list->getId(), "id"), ); foreach($list->getMembers() as $val) { $params[] = new SoapVar(''.$val.'', XSD_ANYXML); } $result = $result = $this->connection ->cleanResponse() ->request("AddDistributionListMemberRequest",$params); if($result->getResponseBody()['ADDDISTRIBUTIONLISTMEMBERRESPONSE']) { return true; } $this->setError($result->getLastError()); return false; } public function deleteMembers(\ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapParam($list->getId(), "id"), ); foreach($list->getMembers() as $val) { $params[] = new SoapVar(''.$val.'', XSD_ANYXML); } $result = $result = $this->connection ->cleanResponse() ->request("RemoveDistributionListMemberRequest",$params); return $result; } public function addOwners(\ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapVar(''.$list->getId().'', XSD_ANYXML), new SoapVar('', XSD_ANYXML), ); foreach($list->getOwners() as $owner) { $params[] = new SoapVar(''.$owner.'', XSD_ANYXML); } $params[] = new SoapVar('', XSD_ANYXML); $result = $this->connection ->cleanResponse() ->request("DistributionListActionRequest",$params); if($result->getResponseBody()['DISTRIBUTIONLISTACTIONRESPONSE']) { return true; } $this->setError($result->getLastError()); return false; } public function deleteOwners(\ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapVar(''.$id.'', XSD_ANYXML), new SoapVar('', XSD_ANYXML), ); foreach($list->getOwners() as $owner) { $params[] = new SoapVar(''.$owner.'', XSD_ANYXML); } $params[] = new SoapVar('', XSD_ANYXML); $result = $result = $this->connection ->cleanResponse() ->request("DistributionListActionRequest",$params); //todo } /** * @param \ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list * @return bool */ public function addAlias(\ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapParam($list->getId(), 'id'), new SoapParam($list->getAlias(), 'alias'), ); $result = $result = $this->connection ->cleanResponse() ->request("AddDistributionListAliasRequest",$params); if($result->getResponseBody()['ADDDISTRIBUTIONLISTALIASRESPONSE']) { return true; } $this->setError($result->getLastError()); return false; } /** * @param \ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list * @return bool */ public function deleteAlias(\ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapParam($list->getId(), 'id'), new SoapParam($list->getAlias(), 'alias'), ); $result = $result = $this->connection ->cleanResponse() ->request("RemoveDistributionListAliasRequest",$params); if($result->getResponseBody()['REMOVEDISTRIBUTIONLISTALIASRESPONSE']) { return true; } $this->setError($result->getLastError()); return false; } }