Gestion de l'dition

This commit is contained in:
Rodolphe Quiedeville 2003-08-03 10:45:03 +00:00
parent 8b850e37e0
commit 34f687e04e
2 changed files with 44 additions and 15 deletions

View File

@ -19,14 +19,23 @@
* $Source$
*
*/
require("./pre.inc.php3");
require("./project.class.php3");
require("../propal.class.php3");
$db = new Db();
if ($HTTP_POST_VARS["action"] == 'update')
{
$projet = new Project($db);
$projet->id = $id;
$projet->ref = $HTTP_POST_VARS["ref"];
$projet->title = $HTTP_POST_VARS["title"];
$projet->update();
}
llxHeader("","../");
$db = new Db();
if ($action == 'create')
{
@ -68,21 +77,21 @@ if ($action == 'create')
$projet->fetch($id);
$projet->societe->fetch($projet->societe->id);
if ($action == 'edit')
{
print '<form method="post" action="fiche.php3?id='.$id.'">';
print '<input type="hidden" name="action" value="update">';
print '<table border="1" cellpadding="4" cellspacing="0">';
print '<tr><td>Société</td><td>'.$projet->societe->nom.'</td></tr>';
print '<tr><td>Ref</td><td>'.$projet->ref.'</td></tr>';
print '<tr><td>Titre</td><td>'.$projet->title.'</td></tr>';
print '</table>';
print '<tr><td>Société</td><td>'.$projet->societe->nom.'</td></tr>';
print '<tr><td>Ref</td><td><input name="ref" value="'.$projet->ref.'"></td></tr>';
print '<tr><td>Titre</td><td><input name="title" value="'.$projet->title.'"></td></tr>';
print '</table><input type="submit" Value="Enregistrer"></form>';
}
else
{
print '<table border="1" cellpadding="4" cellspacing="0">';
print '<tr><td>Société</td><td>'.$projet->societe->nom.'</td></tr>';
print '<tr><td>Société</td><td><a href="../fiche.php3?socid='.$projet->societe->id.'">'.$projet->societe->nom.'</a></td></tr>';
print '<tr><td>Ref</td><td>'.$projet->ref.'</td></tr>';
print '<tr><td>Titre</td><td>'.$projet->title.'</td></tr>';
@ -134,7 +143,14 @@ if ($action == 'create')
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr>";
print "<td align=\"center\" width=\"25%\"><a href=\"fiche.php3?id=$id&action=edit\">Editer</a></td>";
if ($action == "edit")
{
print "<td align=\"center\" width=\"25%\"><a href=\"fiche.php3?id=$id\">Annuler</a></td>";
}
else
{
print "<td align=\"center\" width=\"25%\"><a href=\"fiche.php3?id=$id&action=edit\">Editer</a></td>";
}
print "<td align=\"center\" width=\"25%\">-</td>";

View File

@ -42,16 +42,29 @@ class Project {
Function create($creatorid)
{
$sql = "INSERT INTO llx_projet (ref, title, fk_soc, fk_user_creat, dateo) ";
$sql .= " VALUES ('$this->ref', '$this->title', $this->socidp, $creatorid, now()) ;";
if (!$this->db->query($sql) )
{
print '<b>'.$sql.'</b><br>'.$this->db->error();
}
print '<b>'.$sql.'</b><br>'.$this->db->error();
}
}
/*
*
*
*
*/
Function update()
{
$sql = "UPDATE llx_projet ";
$sql .= " SET ref = '$this->ref', title = '$this->title'";
$sql .= " WHERE rowid = $this->id";
if (!$this->db->query($sql) )
{
print '<b>'.$sql.'</b><br>'.$this->db->error();
}
}
/*
*