Feature #690

Ajout de la Vcard pour les users

Added by tsmr about 14 years ago. Updated about 14 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:moyo% Done:

0%

Category:Other
Target version:0.68.2

Description

user.function.php

Nouvelle fonction

function generateUserVcard($ID){

$user = new user;
$user->getfromDB($ID);
// build the Vcard
$vcard = new vCard();
if ($user->fields[[realname"] && $user->fields["firstname]])
$vcard->setName($user->fields[[realname"] $user->fields["firstname]], "", "");
elseif ($user->fields[[realname]])
$vcard->setName($user->fields[[realname]], "", "", "");
else
$vcard->setName($user->fields[[name]], "", "", "");
$vcard->setPhoneNumber($user->fields[[phone]], "PREF;WORK;VOICE");
$vcard->setPhoneNumber($user->fields[[phone2]], "HOME;VOICE");
$vcard->setPhoneNumber($user->fields[[mobile]], "WORK;CELL");
//if ($user->birthday) $vcard->setBirthday($user->birthday);
$vcard->setEmail($user->fields[[email]]);
$vcard->setNote($user->fields[[comments]]);
// send the  VCard
$output = $vcard->getVCard();
$filename =$vcard->getFileName();      // "xxx xxx.vcf"
@Header("Content-Disposition: attachment; filename=\"$filename\"");
@Header("Content-Length: ".strlen($output));
@Header("Connection: close");
@Header("content-type: text/x-vcard; charset=UTF-8");
echo $output;

}

user.class.php

Dans function showForm()

echo "<tr><th colspan='4'>".$lang[[setup"]r57" " $this->fields["name]];
echo "<a href='".$cfg_glpiroot_doc."/front/user.vcard.php?ID=$ID'>Vcard</a>";
echo "</th></tr>";

Nouveau fichier front/user.vcard.php

/*
  • @version $Id: HEADER 3795 2006-08-22 03:57:36Z moyo $
    -------------------------------------------------------------------------
    GLPI - Gestionnaire Libre de Parc Informatique
    Copyright (C) 2003-2006 by the INDEPNET Development Team.
http://indepnet.net/   http://glpi-project.org
-------------------------------------------------------------------------
LICENSE
This file is part of GLPI.
GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file: Jean-Mathieu Doléans
// Purpose of file:
// ----------------------------------------------------------------------

include ("_relpos.php");
$NEEDED_ITEMS=array("user");
include ($phproot . "/inc/includes.php");
include ($phproot . "/lib/vcardclass/classes-vcard.php");

if (empty($_GETID)) {

glpi_header($cfg_glpi[[root_doc]]."/users");

}else {

checkRight("user","r");
generateUserVcard($_GET[[ID]]);

}

?>

:)

History

#1 Updated by moyo about 14 years ago

  • Status changed from New to Closed

(In r3889) user vcard
fixed #690

Also available in: Atom PDF