From 917c4d112628836500785b42deceb5d03a822ab0 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Mon, 23 Oct 2006 07:56:13 +0000 Subject: [PATCH] Add link to download the vcards without the photos Also fix validation page git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1018 839d8a87-29fc-0310-9880-83ba4fa771e5 --- include/validations.inc.php | 2 +- include/validations/listes.inc.php | 2 +- include/vcard.inc.php | 20 ++++++++++++-------- modules/carnet.php | 5 +++-- modules/xnetgrp.php | 4 ++-- templates/carnet/mescontacts.tpl | 5 ++--- templates/xnet/groupe/annuaire.tpl | 3 ++- 7 files changed, 23 insertions(+), 18 deletions(-) diff --git a/include/validations.inc.php b/include/validations.inc.php index b7b0f66..6af52e8 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -32,7 +32,7 @@ class ValidateIterator extends XOrgDBIterator function ValidateIterator () { - parent::XOrgDBIterator('SELECT data,stamp FROM requests ORDER BY stamp', MYSQL_NUM); + parent::__construct('SELECT data,stamp FROM requests ORDER BY stamp', MYSQL_NUM); } // }}} diff --git a/include/validations/listes.inc.php b/include/validations/listes.inc.php index 1152185..6171a24 100644 --- a/include/validations/listes.inc.php +++ b/include/validations/listes.inc.php @@ -104,7 +104,7 @@ class ListeReq extends Validate function commit() { - $list = new List(S::v('uid'), S::v('password')); + $list = new MMList(S::v('uid'), S::v('password')); $ret = $list->create_list($this->liste, $this->desc, $this->advertise, $this->modlevel, $this->inslevel, $this->owners, $this->members); diff --git a/include/vcard.inc.php b/include/vcard.inc.php index 749af3d..f876f4d 100644 --- a/include/vcard.inc.php +++ b/include/vcard.inc.php @@ -25,9 +25,11 @@ require_once('user.func.inc.php'); class VCard { var $users = array(); + var $photos; - function VCard($users, $freetext = null) + function VCard($users, $photos = true, $freetext = null) { + $this->photos = $photos; if (is_array($users)) { foreach ($users as $user) { $this->add_user($user, $freetext); @@ -98,13 +100,15 @@ class VCard $user['virtualalias'] = $res->fetchOneCell(); // get photo - $res = XDB::query( - "SELECT attach, attachmime - FROM photo AS p - INNER JOIN aliases AS a ON (a.id = p.uid AND a.type = 'a_vie') - WHERE a.alias = {?}", $login); - if ($res->numRows()) { - $user['photo'] = $res->fetchOneAssoc(); + if ($this->photos) { + $res = XDB::query( + "SELECT attach, attachmime + FROM photo AS p + INNER JOIN aliases AS a ON (a.id = p.uid AND a.type = 'a_vie') + WHERE a.alias = {?}", $login); + if ($res->numRows()) { + $user['photo'] = $res->fetchOneAssoc(); + } } $this->users[] = $user; } diff --git a/modules/carnet.php b/modules/carnet.php index 4cafae1..91a145a 100644 --- a/modules/carnet.php +++ b/modules/carnet.php @@ -372,13 +372,14 @@ class CarnetModule extends PLModule header('Content-Type: text/calendar; charset=utf-8'); } - function handler_vcard(&$page) + function handler_vcard(&$page, $photos = null) { $res = XDB::query('SELECT contact FROM contacts WHERE uid = {?}', S::v('uid')); + require_once('vcard.inc.php'); - $vcard = new VCard($res->fetchColumn()); + $vcard = new VCard($res->fetchColumn(), $photos == 'photos'); $vcard->do_page(&$page); } } diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index a287dc5..2378958 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -324,7 +324,7 @@ class XnetGrpModule extends PLModule $page->assign('ann', $ann); } - function handler_vcard(&$page) + function handler_vcard(&$page, $photos = null) { global $globals; @@ -333,7 +333,7 @@ class XnetGrpModule extends PLModule FROM groupex.membres WHERE asso_id = {?}', $globals->asso('id')); require_once('vcard.inc.php'); - $vcard = new VCard($res->fetchColumn(), 'Membre du groupe ' . $globals->asso('nom')); + $vcard = new VCard($res->fetchColumn(), $photos == 'photos', 'Membre du groupe ' . $globals->asso('nom')); $vcard->do_page($page); } else { return PL_NOTALLOWED; diff --git a/templates/carnet/mescontacts.tpl b/templates/carnet/mescontacts.tpl index d72736c..a92d111 100644 --- a/templates/carnet/mescontacts.tpl +++ b/templates/carnet/mescontacts.tpl @@ -67,9 +67,8 @@ Pour r
  • {icon name=vcard title='Carte de visite'} - - La carte de visite permettant de les insérer dans ton carnet d'adresse - + La carte de visite électronique + (sans les photos)
  • diff --git a/templates/xnet/groupe/annuaire.tpl b/templates/xnet/groupe/annuaire.tpl index 83279bd..c95f304 100644 --- a/templates/xnet/groupe/annuaire.tpl +++ b/templates/xnet/groupe/annuaire.tpl @@ -35,10 +35,11 @@ Tu peux