#690: Ajout de la Vcard pour les users
-------------------------+--------------------------------------------------
Reporter: Tsmr | Owner: anonymous
Type: enhancement | Status: new
Priority: normal | Milestone: 0.70
Component: Autre | Version: 0.68
Severity: minor | Keywords:
-------------------------+--------------------------------------------------
== 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"][57]." :
" .$this->fields["name"];
echo "<a
href='".$cfg_glpi["root_doc"]."/front/user.vcard.php?ID=$ID'>Vcard</a>";
echo "</th></tr>";
== Nouveau fichier front/user.vcard.php ==
<?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($_GET["ID"])) {
glpi_header($cfg_glpi["root_doc"]."/users");
}else {
checkRight("user","r");
generateUserVcard($_GET["ID"]);
}
?>
:)
--
Ticket URL: <https://dev.indepnet.net:8080/glpi/ticket/690>
GLPI <https://dev.indepnet.net:8080/glpi/>
Gestion Libre de Parc Informatique_______________________________________________
Glpi-bugtrack mailing list
[email protected]
https://mail.gna.org/listinfo/glpi-bugtrack