Document_State : rewriting

This commit is contained in:
Dany wm De Bontridder 2020-11-01 13:03:55 +01:00 committed by sparkyx
parent 0ca583f629
commit c4d8630c5c
5 changed files with 195 additions and 42 deletions

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
// Copyright Author Dany De Bontridder danydb@noalyss.eu
/**
* @file
@ -26,47 +26,13 @@
*
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
global $cn;
if ( isset($_POST['add']))
{
if (trim ($_POST['s_value'])!="")
{
if ( isset($_POST['s_state']))
{
$cn->exec_sql('insert into document_state(s_value,s_status) values ($1,$2)',array($_POST['s_value'],'C'));
}
else
{
$cn->exec_sql('insert into document_state(s_value) values ($1)',array($_POST['s_value']));
}
}
}
$a_stat=$cn->get_array("select s_value,s_status from document_state order by 1");
?>
require_once NOALYSS_INCLUDE."/class/document_state_mtable.php";
<table>
<?php for ($i=0;$i<count($a_stat);$i++):?>
$document_state_sql=new Document_State_SQL($cn);
$mtable=new Document_State_MTable($document_state_sql);
<tr>
<td>
<?php echo h($a_stat[$i]['s_value'])?>
</td>
$mtable->build();
$mtable->create_js_script();
echo $mtable->display_table();
<td>
<?php if ($a_stat[$i]['s_status']=='C') { echo _("Ferme l'action"); } ?>
</td>
</tr>
<?php endfor;?>
</table>
<h2>Ajout d'un état</h2>
<form method="post" id='etat_add_frm' onsubmit="return confirm_box(this,'Vous confirmez ?'); ">
<p>
Nom de l'état <?php $value=new IText("s_value",""); echo $value->input()?>
</p>
<p>
Cochez la case si cet état ferme une action <?php $state=new ICheckBox("s_state",""); echo $state->input()?>
<input type='hidden' name='add' value='1'>
<?php echo HtmlInput::submit("addbt", "Ajouter")?>
</p>
</form>