コード例 #1
0
ファイル: partnersharing.inc.php プロジェクト: Ekleog/platal
 public function __construct(array $data)
 {
     foreach ($data as $key => $val) {
         $this->{$key} = $val;
     }
     $this->partner = PartnerSharing::fetchById($this->partner_id);
     $this->sharing_visibility = Visibility::get($this->sharing_level);
 }
コード例 #2
0
ファイル: sharingapi.php プロジェクト: Ekleog/platal
 function handler_bulkmail(PlPage $page, PlUser $authUser, $payload)
 {
     require_once 'partnersharing.inc.php';
     $partner = PartnerSharing::fetchByAPIUser($authUser);
     if ($partner == null || !$partner->has_bulkmail) {
         return PL_FORBIDDEN;
     }
     if (!isset($payload['uids'])) {
         $page->trigError('Malformed query.');
         return PL_BAD_REQUEST;
     }
     $uids = $payload['uids'];
     $pf = new UserFilter(new PFC_And(new UFC_PartnerSharingID($partner->id, $uids), new UFC_HasValidEmail(), new UFC_PartnerSharingEmail($partner->id)));
     $contexts = array();
     foreach ($pf->iterUsers() as $user) {
         $contexts[] = array('name' => $user->fullName(), 'email' => $user->bestEmail(), 'gender' => $user->isFemale() ? 'woman' : 'man');
     }
     $page->jsonAssign('contexts', $contexts);
     return PL_JSON;
 }