root/trunk/inc/_profile/professional.inc.php
| Revision 1, 3.9 KB (checked in by anonymous, 7 years ago) |
|---|
| Line | |
|---|---|
| 1 | <?php |
| 2 | /****************************************************** Open .node *** |
| 3 | * Description: |
| 4 | * Status: Stable. |
| 5 | * Author: Alexandre Dath <alexandre@dotnode.com> |
| 6 | * $Id$ |
| 7 | * |
| 8 | * Copyright (C) 2005 Alexandre Dath <alexandre@dotnode.com> |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, write to the Free Software Foundation, |
| 22 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 23 | ******************** http://opensource.ikse.net/projects/dotnode ***/ |
| 24 | |
| 25 | // Recuperation du profil general ******************* |
| 26 | $t_name = 'user_professional'; |
| 27 | $user_access['professional'] = get_access_list($url_id, $t_name); // Access List ***************************** |
| 28 | |
| 29 | $t_fields = implode(',', array_keys($table_fields[$t_name])); |
| 30 | $user_professional = $db->query('SELECT ! FROM ! WHERE id=?', array($t_fields, $t_name, $url_id) ); |
| 31 | |
| 32 | if(!DB::isError($user_professional) ) |
| 33 | { |
| 34 | $table_info = $user_professional->tableInfo(); // Recuperation des infos de la table |
| 35 | $profile = $user_professional->FetchRow(); // On recupere le profil |
| 36 | foreach($table_info as $item) // Pour chaque colonne de la table |
| 37 | { |
| 38 | if( array_key_exists($item['name'], $user_access['professional']) && (access_weight($user_access['professional'][$item['name']]) > access_weight($user['relation_type']) ) ) |
| 39 | continue; |
| 40 | elseif($profile[$item['name']] == NULL || $profile[$item['name']] == "") // Si la colonne ne contient rien, on arrete la et on passe aus suivant |
| 41 | continue; |
| 42 | elseif($item['type'] == 'date') |
| 43 | { |
| 44 | list($year, $month, $day) = explode('-', $profile[$item['name']]); |
| 45 | $date = getdate(mktime (0,0,0,$month,$day,$year)); |
| 46 | $value = $date['mday'].' '._($date['month']).' '.$date['year']; |
| 47 | } |
| 48 | elseif(ereg('set', $item['flags'])) // Si c'est un colonne de type 'SET' (liste a choix multiples) |
| 49 | { |
| 50 | $translated_thing = array(); // declaration du tableau qui va recevoir les chaines traduites |
| 51 | $things = explode(',', $profile[$item['name']]); // on separe ce qu'il y a en base dans un tableau $things |
| 52 | foreach($things as $thing) // pour chaque elements du SET |
| 53 | array_push($translated_thing, _($labels['profile'][$item['name']][$thing])); // on ajoute dans le tableau $translated_thing la traduction du label de la valeur, trouv�ans labels.inc.php |
| 54 | $value = implode(", ", $translated_thing); // on reforme un truc affichable et on le mets dans $value |
| 55 | } |
| 56 | else |
| 57 | { |
| 58 | if(array_key_exists( $profile[$item['name']], (array)$labels['profile'][$item['name']]) ) |
| 59 | $value = _($labels['profile'][$item['name']][$profile[$item['name']]]); |
| 60 | else |
| 61 | $value = $profile[$item['name']]; |
| 62 | // par defaut, on prend le champs de $profile correspondant a la colonne courante $item['name'] |
| 63 | } |
| 64 | |
| 65 | $key = $table_fields['user_professional'][$item['name']]; // on genere la cle qui sera utilis�ans le tableau export� Smarty, ca sera le label traduit a partir du nom de la colonne (trouv�ans labels.inc.php) |
| 66 | $user['professional'][$key] = _($value); // enfin, on attribue la valeur trouv�raduite... |
| 67 | } |
| 68 | } |
| 69 | else |
| 70 | error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | '.$user_professional->getUserInfo()); |
| 71 |
Note: See TracBrowser
for help on using the browser.
