1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
/**
* Template
*/
$tpl =& new HTML_Template_Sigma($TPL);
$tpl->loadTemplateFile('T_ListeMsg.tpl'); // false pour ne pas retirer les "{" et les "}" pour les templates
$renderer =& new HTML_QuickForm_Renderer_ITStatic($tpl);
$renderer->setRequiredTemplate('{label}<font color="red" size="1">*</font>');
$renderer->setErrorTemplate('<font color="red">{error}</font><br />{html}');
/**
* JavaScript
*/
$S_JS = "<script type='text/javascript'>
var checkflag = 'false';
function toutCocher(){
if (checkflag == 'false') {
for (i = 0; i < document.forms['Msg'].length; i++) {
document.forms['Msg'][i].checked = true;
}
checkflag = 'true';
}
}
function toutDecocher(){
if (checkflag == 'true'){
for (i = 0; i < document.forms['Msg'].length; i++) {
document.forms['Msg'][i].checked = false;
}
checkflag = 'false';
}
}
</script>";
/**
* Formumlaire
*/
$form = new HTML_QuickForm('FormListeMsg','post');
$form->addElement('header', 'titre', Trad2::getLibelle(1769));
$form->addElement('button', 'cocher','Tout cocher', array('OnClick'=>'toutCocher()'));
$form->addElement('button', 'decocher','Tout décocher', array('OnClick'=>'toutDecocher()'));
$form->addElement('submit', 'Suppr','Supprimer');
/**
* Tableau
*/
$table = new HTML_Table (array('border'=>'0','cellpadding'=>'2', 'cellspacing'=>'0', 'class'=>'border-table', 'id'=>'sortable'));
$table->setHeaderContents(0, 1, 'Id');
$table->setHeaderContents(0, 2, Trad2::getLibelle(17));
$table->setHeaderContents(0, 3, Trad2::getLibelle(1770));
/**
* Requêtes permettant de remplir le tableau
*/
global $dbwibux;
require_once 'Connection/F_connectionWibux.php';
// Liste les Libellés inutilisés
$S_sqlLib = 'SELECT numElmnt, tradMsg FROM TradLibelle2 WHERE numElmnt NOT IN (SELECT numElmnt FROM CheminLibelle) AND numLangue=1';
// Liste les Erreurs inutilisés
$S_sqlErr = 'SELECT numElmnt, tradMsg FROM TradErreur2 WHERE numElmnt NOT IN (SELECT numElmnt FROM CheminErreur) AND numLangue=1';
$qLib = $dbwibux->query($S_sqlLib);
$qErr = $dbwibux->query($S_sqlErr);
if(DB::isError($qLib)) {
trigger_error('Erreur SQL load msg erreur :<br />'.$q->getDebugInfo().'||'.CANNOT_LOAD_MSG, E_USER_ERROR);
}
if(DB::isError($qErr)) {
trigger_error('Erreur SQL load msg erreur :<br />'.$q->getDebugInfo().'||'.CANNOT_LOAD_MSG, E_USER_ERROR);
}
/**
* Remplissage du tableau
*/
$I_i = 1;
while($rowLib = $qLib->fetchRow()){
$Msg = new HTML_QuickForm_checkbox('Msg', $rowLib[0].' TradLibelle2', '', array('id'=>$I_i));
$table->setCellContents($I_i, 0, $Msg);
$table->setCellContents($I_i, 1, $rowLib[0]);
$table->setCellContents($I_i, 2, $rowLib[1]);
$table->setCellContents($I_i, 3, 'Libelle');
$I_i++;
}
while($rowErr = $qErr->fetchRow()){
$Msg = new HTML_QuickForm_checkbox('Msg', $rowErr[0].' TradError2', '', array('id'=>$I_i));
$table->setCellContents($I_i, 0, $Msg);
$table->setCellContents($I_i, 1, $rowErr[0]);
$table->setCellContents($I_i, 2, $rowErr[1]);
$table->setCellContents($I_i, 3, 'Erreur');
$I_i++;
}
print_rn($Msg);
// Effet graphique
$altRow1 = array('class'=>'row1','onmouseover'=>'this.style.background=\'#cbcbcb\'', 'onmouseout'=>'this.style.background=\'#fff\'');
$altRow2 = array('class'=>'row2','onmouseover'=>'this.style.background=\'#cbcbcb\'', 'onmouseout'=>'this.style.background=\'#f5f5f5\'');
$table->altRowAttributes(1, $altRow1, $altRow2, true);
/**
* Affichage du formulaire et du tableau
*/
// Formulaire
$form->accept($renderer);
$tpl->show();
echo $S_JS;
echo 'Total : '.$I_i.' message(s)';
// Tableau
echo $table->toHTML(); |
Partager