Example #1
0
 function vcard_action($group = null)
 {
     // Set constants for export
     $charset = 'utf-8';
     $filename = _('Kontakte');
     // Set layout
     $this->set_layout(null);
     // If we got an array of user
     if (Request::submitted('user')) {
         $user = User::findManyByUsername(Request::getArray('user'));
     }
     // If we got a group
     if ($group) {
         $user = User::findMany(Statusgruppen::find($group)->members->pluck('user_id'));
     }
     // Fallback to all contacts if we got nothing
     if (!$user) {
         $user = User::findCurrent()->contacts;
     }
     header("Content-type: text/x-vCard;charset=" . $charset);
     //application/octet-stream MIME
     header("Content-disposition: attachment; filename=" . $filename . ".vcf");
     header("Pragma: private");
     $this->vCard = vCard::export($user);
 }