芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/public_html/cloud.pulsehost.co.uk/modules/Contacts/Classes/Group.php
Id = 0; $this->IdUser = 0; $this->UUID = ''; $this->Name = ''; $this->IsOrganization = false; $this->Email = ''; $this->Company = ''; $this->Street = ''; $this->City = ''; $this->State = ''; $this->Zip = ''; $this->Country = ''; $this->Phone = ''; $this->Fax = ''; $this->Web = ''; $this->Contacts = []; } public function populate($aGroup) { foreach ($aGroup as $key => $value) { if (property_exists($this, $key) && ($key !== 'Contacts')) { $this->$key = $value; } } if (!empty($aGroup['UUID'])) { $this->UUID = $aGroup['UUID']; } elseif (empty($this->UUID)) { $this->UUID = \Sabre\DAV\UUIDUtil::getUUID(); } if (isset($aGroup['Contacts']) && is_array($aGroup['Contacts']) && count($aGroup['Contacts']) > 0) { $contactsIds = array_map(function ($item) { return $item . '.vcf'; }, $aGroup['Contacts']); $contactsIds = Capsule::connection()->table('adav_cards') ->select('id') ->whereIn('uri', $contactsIds)->get()->all(); $contactsIds = array_map(function ($item) { return $item->id; }, $contactsIds); if ($contactsIds) { $query = Capsule::connection()->table('contacts_cards') ->join('adav_cards', 'contacts_cards.CardId', '=', 'adav_cards.id') ->join('adav_addressbooks', 'adav_cards.addressbookid', '=', 'adav_addressbooks.id') ->select('adav_cards.id as card_id'); $aArgs = [ 'UserId' => $this->IdUser, 'UUID' => array_values($contactsIds) ]; // build a query to obtain the addressbook_id and card_uri with checking access to the contact $query->where(function ($q) use (&$aArgs, $query) { $aArgs['Query'] = & $query; EventEmitter::getInstance()->emit('Contacts', 'ContactQueryBuilder', $aArgs, $q); }); $rows = $query->distinct()->get()->map(function ($value) { return $value->card_id; }); $this->Contacts = $rows->all(); } } } public function toResponseArray() { return (array) $this; } }