From 611be0d71fbb3792409e235596f1d9e3892628d3 Mon Sep 17 00:00:00 2001 From: x2000coic Date: Mon, 29 Mar 2004 12:48:50 +0000 Subject: [PATCH] =?utf8?q?Passage=20de=20fonctions=20d'affichages=20de=20p?= =?utf8?q?hp=20=E0=20smarty?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- include/fonction.emploi.inc.php | 19 +++++++++ include/profil/profil_emploi.inc.php | 51 +----------------------- include/profil/profil_mentor.inc.php | 74 ++++++---------------------------- include/profil/verif_mentor.inc.php | 2 + include/secteur.emploi.inc.php | 37 +++++++++++++++++ templates/profil/mentor.tpl | 77 +++++++++++++++++++++++++++++++++++- 6 files changed, 147 insertions(+), 113 deletions(-) create mode 100644 include/fonction.emploi.inc.php create mode 100644 include/secteur.emploi.inc.php diff --git a/include/fonction.emploi.inc.php b/include/fonction.emploi.inc.php new file mode 100644 index 0000000..ca66b46 --- /dev/null +++ b/include/fonction.emploi.inc.php @@ -0,0 +1,19 @@ + \n"; + $res = mysql_query("SELECT id, fonction_fr, FIND_IN_SET('titre', flags) from fonctions_def ORDER BY id"); + while(list($fid, $flabel, $ftitre) = mysql_fetch_row($res)){ + if($ftitre) + echo "\n"; + else + echo "\n"; + } + mysql_free_result($res); +} + +function _select_fonction_smarty($params){ + select_fonction($params['fonction']); +} +$page->register_function('select_fonction', '_select_fonction_smarty'); +?> diff --git a/include/profil/profil_emploi.inc.php b/include/profil/profil_emploi.inc.php index d57184b..268a376 100644 --- a/include/profil/profil_emploi.inc.php +++ b/include/profil/profil_emploi.inc.php @@ -1,54 +1,7 @@  \n"; - foreach($secteurs as $sid => $slabel){ - echo "\n"; - } -} -function select_fonction($fonction){ - global $fonctions, $fonctions_titre; - reset($fonctions); - echo "\n"; - foreach($fonctions as $fid => $flabel){ - if($fonctions_titre[$fid] == 1) - echo "\n"; - else - echo "\n"; - } -} -function select_ss_secteur($secteur,$ss_secteur){ - if($secteur != ''){ - echo "\n"; - $res = mysql_query("SELECT id, label FROM emploi_ss_secteur WHERE secteur = '$secteur'"); - while(list($tmp_id, $tmp_label) = mysql_fetch_row($res)){ - echo "\n"; - } - } - else{ - echo "\n"; - } -} - -//fonctions pour smarty -function _select_secteur_smarty($params){ - select_secteur($params['secteur']); -} -function _select_ss_secteur_smarty($params){ - if(!isset($params['secteur'])) return; - select_ss_secteur($params['secteur'], $params['ss_secteur']); -} -function _select_fonction_smarty($params){ - select_fonction($params['fonction']); -} -$page->register_function('select_secteur', '_select_secteur_smarty'); -$page->register_function('select_ss_secteur', '_select_ss_secteur_smarty'); -$page->register_function('select_fonction', '_select_fonction_smarty'); - +require_once('secteur.emploi.inc.php'); +require_once('fonction.emploi.inc.php'); $res = mysql_query("SELECT entrid, entreprise, secteur, ss_secteur, poste, fonction, adr1, adr2, adr3, cp, ville, pays, region, tel, fax, diff --git a/include/profil/profil_mentor.inc.php b/include/profil/profil_mentor.inc.php index fe704aa..54b3e2e 100644 --- a/include/profil/profil_mentor.inc.php +++ b/include/profil/profil_mentor.inc.php @@ -1,7 +1,7 @@  \n"; - $res = mysql_query("SELECT id, label FROM emploi_secteur"); - while(list($tmp_id, $tmp_label) = mysql_fetch_row($res)){ - echo "\n"; - } -} - -function select_ss_secteur($secteur,$ss_secteur){ - if($secteur != ''){ - echo "\n"; - $res = mysql_query("SELECT id, label FROM emploi_ss_secteur WHERE secteur = '$secteur'"); - while(list($tmp_id, $tmp_label) = mysql_fetch_row($res)){ - echo "\n"; - } - } - else{ - echo "\n"; - } -} - -function affiche_secteurs(){ - global $mentor_sid, $mentor_secteur, $mentor_ssid, $mentor_ss_secteur, $nb_mentor_secteurs, $max_mentor_secteurs; - global $mentor_secteur_id_new; - for($i = 1; $i <= $nb_mentor_secteurs ; $i++){ - if ($i%2) echo ''; else echo ''; -?> - - - - - - - - retirer - - -'; else echo ''; -?> - - - - - - - - ajouter - - - -register_function('print_pays','_print_pays_smarty'); -$page->register_function('print_secteurs_mentor','_print_secteurs_mentor_smarty'); $max_mentor_pays = 10; $max_mentor_secteurs = 10; +$page->assign('max_mentor_pays', $max_mentor_pays); +$page->assign('max_mentor_secteurs', $max_mentor_secteurs); + //suppression eventuelle d'un pays if(isset($_POST['mentor_pays_op']) && ($_POST['mentor_pays_op'] == 'retirer')) { @@ -146,6 +88,9 @@ if($nb_mentor_pays > 0){ for($i = 1; $i <= $nb_mentor_pays ; $i++) list($mentor_pid[$i], $mentor_pays[$i]) = mysql_fetch_row($res); } +$page->assign_by_ref('mentor_pid', $mentor_pid); +$page->assign_by_ref('mentor_pays', $mentor_pays); +$page->assign_by_ref('nb_mentor_pays', $nb_mentor_pays); //recuperation des secteurs $res = mysql_query("SELECT m.secteur, s.label, m.ss_secteur, ss.label @@ -160,5 +105,10 @@ if($nb_mentor_secteurs > 0){ list($mentor_sid[$i], $mentor_secteur[$i], $mentor_ssid[$i], $mentor_ss_secteur[$i]) = mysql_fetch_row($res); } +$page->assign_by_ref('mentor_sid', $mentor_sid); +$page->assign_by_ref('mentor_secteur', $mentor_secteur); +$page->assign_by_ref('mentor_ssid', $mentor_ssid); +$page->assign_by_ref('mentor_ss_secteur', $mentor_ss_secteur); +$page->assign_by_ref('nb_mentor_secteurs', $nb_mentor_secteurs); ?> diff --git a/include/profil/verif_mentor.inc.php b/include/profil/verif_mentor.inc.php index da100d0..77cb750 100644 --- a/include/profil/verif_mentor.inc.php +++ b/include/profil/verif_mentor.inc.php @@ -43,6 +43,8 @@ else if(isset($_POST['mentor_secteur_id_new'])){ else{ $mentor_secteur_id_new = ''; } +$page->assign_by_ref('mentor_secteur_id_new', $mentor_secteur_id_new); + if(isset($_POST['mentor_expertise'])){ $mentor_expertise = stripslashes($_POST['mentor_expertise']); if(!empty($mentor_expertise)){ diff --git a/include/secteur.emploi.inc.php b/include/secteur.emploi.inc.php new file mode 100644 index 0000000..102c2a6 --- /dev/null +++ b/include/secteur.emploi.inc.php @@ -0,0 +1,37 @@ + \n"; + $res = mysql_query("SELECT id, label FROM emploi_secteur"); + while(list($tmp_id, $tmp_label) = mysql_fetch_row($res)){ + echo "\n"; + } + mysql_free_result($res); +} + +function select_ss_secteur($secteur,$ss_secteur){ + if($secteur != ''){ + echo "\n"; + $res = mysql_query("SELECT id, label FROM emploi_ss_secteur WHERE secteur = '$secteur'"); + while(list($tmp_id, $tmp_label) = mysql_fetch_row($res)){ + echo "\n"; + } + mysql_free_result($res); + } + else{ + echo "\n"; + } +} + +//fonctions pour smarty +function _select_secteur_smarty($params){ + select_secteur($params['secteur']); +} +function _select_ss_secteur_smarty($params){ + if(!isset($params['secteur'])) return; + select_ss_secteur($params['secteur'], $params['ss_secteur']); +} +$page->register_function('select_secteur', '_select_secteur_smarty'); +$page->register_function('select_ss_secteur', '_select_ss_secteur_smarty'); +?> diff --git a/templates/profil/mentor.tpl b/templates/profil/mentor.tpl index 47e9ea9..8bd5b73 100644 --- a/templates/profil/mentor.tpl +++ b/templates/profil/mentor.tpl @@ -90,7 +90,42 @@   - {print_pays} + {section name=pays loop=$nb_mentor_pays+1 start=1} + {assign var='i' value=$smarty.section.pays.index} + {if $i%2} + + {else} + + {/if} + + {$mentor_pays.$i|print_html} + + +    + + + retirer + + + {/section} + {if $nb_mentor_pays < $max_mentor_pays} + {if $i%2} + + {else} + + {/if} + + + + + + + ajouter + + + {/if} @@ -132,7 +167,45 @@   - {print_secteurs_mentor} + {section name=secteur loop=$nb_mentor_secteurs+1 start=1} + {assign var='i' value=$smarty.section.secteur.index} + {if $i%2} + + {else} + + {/if} + + {$mentor_secteur.$i|print_html} + + + {$mentor_ss_secteur.$i|print_html} + + + retirer + + + {/section} + {if $nb_mentor_secteurs < $max_mentor_secteurs} + {if $i%2} + + {else} + + {/if} + + + + + + + + ajouter + + + {/if} -- 2.1.4