passage pour les emplois.
authorx2000habouzit <x2000habouzit>
Sat, 7 Feb 2004 17:18:15 +0000 (17:18 +0000)
committerx2000habouzit <x2000habouzit>
Sat, 7 Feb 2004 17:18:15 +0000 (17:18 +0000)
mettre le nom du template dans un champs n'est pas malin, ca le stocke dans la bd, et rend les objets de l'ancien site incompatibles.
d'ou l'utilsiation d'une fonction pour ca ...

include/valid_aliases.inc.php
include/valid_emploi.inc.php
include/validations.inc.php
templates/admin/valider.tpl
templates/include/form.valid.aliases.tpl
templates/include/form.valid.emploi.tpl [new file with mode: 0644]

index e6296a6..35481b2 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 class AliasReq extends Validate {
-    var $tpl_form='include/form.valid.aliases.tpl';
     var $alias;
     var $raison;
 
@@ -25,6 +24,8 @@ class AliasReq extends Validate {
         return parent::get_unique_request($uid,'alias');
     }
 
+    function formu() { return 'include/form.valid.aliases.tpl'; }
+
     function handle_formu () {
         global $no_update_bd;
         if($no_update_bd) return false;
index dc255d6..da6e7e4 100644 (file)
@@ -18,46 +18,6 @@ class EmploiReq extends Validate {
         return false; // non unique
     }
 
-    function formu() {
-        $ent = htmlentities($this->entreprise);
-        $mail = htmlentities($this->mail);
-        $titre = htmlentities($this->titre);
-        $texte = wordwrap($this->text, 80);
-        return <<<________EOF
-        <form action="{$_SERVER['PHP_SELF']}" method="POST">
-        <input type="hidden" name="uid" value="{$this->uid}" />
-        <input type="hidden" name="type" value="{$this->type}" />
-        <input type="hidden" name="stamp" value="{$this->stamp}" />
-        <table class="bicol" cellpadding="4" summary="Annonce emploi">
-          <thead>
-          <tr>
-            <th colspan="2">Offre d'emploi</th>
-          </tr>
-          </thead>
-          <tbody>
-            <tr>
-              <td>Demandeur</td>
-              <td>$ent ($mail)</td>
-            </tr>
-            <tr>
-              <td>Titre du post</td>
-              <td>$titre</td>
-            </tr>
-            <tr>
-              <td colspan="2"><pre>{$texte}</pre></td>
-            </tr>
-            <tr>
-              <td class="center" colspan="2">
-                <input type="submit" name="submit" value="Accepter" />
-                <input type="submit" name="submit" value="Refuser" />
-              </td>
-            </tr>
-          </tbody>
-        </table>
-        </form>
-________EOF;
-    }
-
     function handle_formu() {
         if (isset($_POST['submit'])) {
             require("tpl.mailer.inc.php");
@@ -92,6 +52,8 @@ ________EOF;
         }
     }
 
+    function formu() { return 'include/form.valid.emploi.tpl'; }
+
     function commit() {
     }
 }
index 075a000..d1e4a1f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /* vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100:
- * $Id: validations.inc.php,v 1.5 2004-02-07 16:57:58 x2000habouzit Exp $
+ * $Id: validations.inc.php,v 1.6 2004-02-07 17:18:15 x2000habouzit Exp $
  *
  */
 
@@ -36,8 +36,6 @@ class ValidateIterator {
  * Par contre, à la sortie de toute fonction il faut que le stamp soit valide !!! XXX
  */
 class Validate {
-    /** nom du template qui contient le formulaire */
-    var $tpl_form = null;
     /** l'uid de la personne faisant la requête */
     var $uid;
     /** le time stamp de la requête */
@@ -141,6 +139,8 @@ class Validate {
                 .($this->unique ? "" : " AND stamp='".$this->stamp."'"));
     }
     
+    /** nom du template qui contient le formulaire */
+    function formu() { return null; }
     /** fonction à réaliser en cas de valistion du formulaire
      * XXX la fonction est "virtuelle" XXX
      */
index 0eb9511..8a4d2b9 100644 (file)
@@ -1,10 +1,10 @@
-{* $Id: valider.tpl,v 1.2 2004-02-07 16:57:58 x2000habouzit Exp $ *}
+{* $Id: valider.tpl,v 1.3 2004-02-07 17:18:15 x2000habouzit Exp $ *}
 
 {dynamic}
 {$mail}
 {foreach item=valid from=$valids}
 <br />
-{include file=$valid->tpl_form valid=$valid}
+{include file=$valid->formu() valid=$valid}
 {/foreach}
 {/dynamic}
 
index 3e7e429..de46392 100644 (file)
@@ -1,5 +1,5 @@
-{* $Id: form.valid.aliases.tpl,v 1.1 2004-02-07 16:57:59 x2000habouzit Exp $ *}
-{assign var="newAlias" value=""}
+{* $Id: form.valid.aliases.tpl,v 1.2 2004-02-07 17:18:16 x2000habouzit Exp $ *}
+
 <form action="{$smarty.server.PHP_SELF}" method="POST">
 <input type="hidden" name="uid" value="{$valid->uid}" />
 <input type="hidden" name="type" value="{$valid->type}" />
diff --git a/templates/include/form.valid.emploi.tpl b/templates/include/form.valid.emploi.tpl
new file mode 100644 (file)
index 0000000..1ff0b12
--- /dev/null
@@ -0,0 +1,35 @@
+{* $Id: form.valid.emploi.tpl,v 1.1 2004-02-07 17:18:16 x2000habouzit Exp $ *}
+
+<form action="{$smarty.server.PHP_SELF}" method="POST">
+<input type="hidden" name="uid" value="{$valid->uid}" />
+<input type="hidden" name="type" value="{$valid->type}" />
+<input type="hidden" name="stamp" value="{$valid->stamp}" />
+<table class="bicol" cellpadding="4" summary="Annonce emploi">
+  <thead>
+  <tr>
+    <th colspan="2">Offre d'emploi</th>
+  </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Demandeur</td>
+      <td>{$valid->entreprise|escape:"html"} ({$valid->mail|escape:"html"})</td>
+    </tr>
+    <tr>
+      <td>Titre du post</td>
+      <td>{$valid->titre|escape:"html"}</td>
+    </tr>
+    <tr>
+      <td colspan="2"><pre>{$valid->text|escape:"html"}</pre></td>
+    </tr>
+    <tr>
+      <td class="center" colspan="2">
+        <input type="submit" name="submit" value="Accepter" />
+        <input type="submit" name="submit" value="Refuser" />
+      </td>
+    </tr>
+  </tbody>
+</table>
+</form>
+
+{* vim:set et sw=2 sts=2 sws=2: *}