Prochaines Sessions
Les prochaines formations et démonstrations sont ouvertes, inscrivez-vous rapidement !
Démonstration de ProjeQtOr(gratuit, sur inscription)
13 mai 2025 (10h30-12h) 5 juin 2025 (16h-17h30) |
Les prochaines formations et démonstrations sont ouvertes, inscrivez-vous rapidement !
Démonstration de ProjeQtOr(gratuit, sur inscription)
13 mai 2025 (10h30-12h) 5 juin 2025 (16h-17h30) |
Please Connexion or Create an account to join the conversation.
Please Connexion or Create an account to join the conversation.
Please Connexion or Create an account to join the conversation.
Please Connexion or Create an account to join the conversation.
Please Connexion or Create an account to join the conversation.
var ReportPrintType ='';
//open the dialog with checkboxes
function openReportPrint (Type) {
ReportPrintType =Type;
if (formChangeInProgress) {
showAlert(i18n('alertOngoingChange'));
return;
}
top.dijit.byId("dialogReportPrint").show();
}
//close the dialog with checkboxes
function closeReportPrint (obj,idUser) {
top.dijit.byId("dialogReportPrint").hide();
saveCheckboxReportPrint(obj,idUser);
}
//save current state of checkboxes
function saveCheckboxReportPrint(obj,idUser){
var val = dojo.byId('column0').value;
var toStore=obj+";"+idUser;
val = eval(val);
for(i=1; i<val+1;i++){
var checkbox=dojo.byId('column'+i);
if(checkbox) {
if(checkbox.checked) {
var field=checkbox.value.split(';');
toStore=toStore + ";" + field[4];
}
}
}
var xhr = getXMLHttpRequest();
var toSend = encodeURIComponent(toStore);
xhr.open("GET", "../tool/saveCheckboxes.php?toStore=" + toSend , true);
xhr.send(null);
}
//pretty sure you're familiar with this
function getXMLHttpRequest() {
var xhr = null;
if (window.XMLHttpRequest || window.ActiveXObject) {
if (window.ActiveXObject) {
try {
xhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
} else {
xhr = new XMLHttpRequest();
}
} else {
alert("Votre navigateur ne supporte pas l'objet XMLHTTPRequest...");
return null;
}
return xhr;
}
//computes witch so pdf export takes all page.
function egalizeWidth(width){
var SumWidth=0;
for (var i in width){
SumWidth = parseInt(SumWidth)+parseInt(width[i]);
}
for (var i in width){
width[i]=100*width[i]/SumWidth;
}
return width;
}
var layoutPrint ='';
//Executes the report (shows the print/pdf/csv)
function executeReportPrint(obj,idUser) {
layoutPrint ='';
var verif=0;
var val = dojo.byId('column0').value;
val = eval(val);
var width = {};
for(i=1; i<val+1;i++){
var checkbox=dojo.byId('column'+i);
if(checkbox) {
if(checkbox.checked) {
var field=checkbox.value.split(';');
width[field[0]]=field[2];
}
}
}
width = egalizeWidth(width);
for(i=1; i<val+1;i++){
var checkbox=dojo.byId('column'+i);
if(checkbox) {
if(checkbox.checked) {
var field=checkbox.value.split(';');
layoutPrint+='<th field="'+field[0]+'" formatter="'+field[3]+'" width="'+width[field[0]]+'%">'+field[1]+'</th> ';
verif=1;
}
}
}
if(verif==1){
var grid = dijit.byId("objectGrid");
if(grid.rowCount > 200) {
actionYes=function() {
if(ReportPrintType=='print') {
showPrint("../tool/jsonQuery.php", 'list');
} else if(ReportPrintType=='csv') {
showPrint("../tool/jsonQuery.php", 'list', null, 'csv');
} else if(ReportPrintType=='pdf') {
showPrint("../tool/jsonQuery.php", 'list', null, 'pdf');
} else {
showPrint("../tool/jsonQuery.php", 'list');
}
closeReportPrint (obj,idUser);
};
actionNo=function() { closeReportPrint (obj,idUser); };
showQuestion("<b>" + i18n('extracting') + " " + grid.rowCount + " " + i18n('lines')+".</b><br>" + i18n('longTraitment') + ".<br>" + i18n('wantToExtract'),actionYes,actionNo);
} else {
if(ReportPrintType=='print') {
showPrint("../tool/jsonQuery.php", 'list');
} else if(ReportPrintType=='csv') {
showPrint("../tool/jsonQuery.php", 'list', null, 'csv');
} else if(ReportPrintType=='pdf') {
showPrint("../tool/jsonQuery.php", 'list', null, 'pdf');
} else {
showPrint("../tool/jsonQuery.php", 'list');
}
closeReportPrint (obj,idUser);
}
} else {
showAlert(i18n('alertChooseOneAtLeast'));
}
}
//Check or uncheck all boxes
function checkReportPrint () {
var check = dojo.byId('checkUncheck').checked;
var val = dojo.byId('column0').value;
val = eval(val);
for(i=1; i<val+1;i++){
var checkbox=dijit.byId('column'+i);
if(checkbox) {
dijit.byId(checkbox).setValue(check);
}
}
}
<div id="dialogReportPrint" dojoType="dijit.Dialog" title="<?php echo i18n("dialogReportPrint");?>"
style=";margin-left: 0px;margin-top: 0px;">
<table style="width:100%;">
<?php
$idUser = $_SESSION['user']->id;
$query='SELECT checkboxes FROM printcheckbox WHERE `objclass`="'.$objectClass.'" AND `idUser`="'.$idUser.'";';
$result=Sql::query($query);
$line = Sql::fetchLine($result);
$checkboxDB=array();
while($line) {
$checkboxDB[]=$line;
$line = Sql::fetchLine($result);
}
if(count($checkboxDB)>0){
$checkboxDB=$checkboxDB[0]['checkboxes'];
$checkboxDB=explode(";",$checkboxDB);
}
$htmlresult="<br>";
$htmlresult.="<b>".i18n("chooseColumnPrint").' :</b><br><br>';
$htmlresult.='<tr>';
$htmlresult.='<form id="dialogPrintForm" name="dialogPrintForm">';
$FieldsArray=$obj->getFieldsArray();
foreach($FieldsArray as $key => $val) {
$FieldsArray[$key]=$obj->getColCaption($val);
if (substr($val,0,5)=='_col_') {
if (strlen($val)>8) {
$section=substr($val,9);
$FieldsArray[$key]=i18n('section' . ucfirst($section));
}
}
if(substr($FieldsArray[$key],0,1)=="["){
unset($FieldsArray[$key]);
continue;
}
}
$countFields=count($FieldsArray);
$htmlresult.='<input type="hidden" dojoType="dijit.form.TextBox" id="column0" name="column0" value="'.$countFields.'">';
$index=1;
$last_key = end($FieldsArray);
foreach($FieldsArray as $key => $val){
if(substr($key,0,5)=="_col_"){
if($val!=$last_key) {
$htmlresult.='<b>'.$val.'</b><br>';
}
} else if(substr($key,0,5)=="input"){
}else {
$checked='';
foreach($checkboxDB as $valchecked){
if($valchecked==$key){
$checked='checked';
}
}
$dataType = $obj->getDataType($key);
$dataLength = $obj->getDataLength($key);
$width=5;
$formatter='';
if ($key=='id') { // id
$formatter="numericFormatter";
$htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
} else if ($key=='password') { // PassWord
// nothing
} else if ($dataType=='date' and $val!=null and $val != '') { // Date
$formatter="dateFormatter";
$htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
} else if ($dataType=='datetime' and $val!=null and $val != '') { // Date and Time
$formatter="dateFormatter";
$htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
} else if ($dataType=='time' and $val!=null and $val != '') { // Time
$formatter="dateFormatter";
$htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
} else if ($key=='color' and $dataLength == 7 ) { // color
$formatter="colorFormatter";
$htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
} else if ($dataType=='int' and $dataLength==1) { // boolean
$formatter="booleanFormatter";
$htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
} else if ($dataLength > 100) { // Text Area (must reproduce BR, spaces, ...
$width=20;
$htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
} else if (substr($key,0,2)=='id' and $dataType=='int' and strlen($key)>2 and substr($key,2,1)==strtoupper(substr($key,2,1)) ) { // Idxxx
if(substr($key,2,strlen($key))=='Status') {
$formatter="colorNameFormatter";
$htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.'colorName'.substr($key,2,strlen($key)).';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
} else if(substr($key,2,strlen($key))=='Profile') {
$formatter="translateFormatter";
$htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.'name'.substr($key,2,strlen($key)).';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
} else {
$htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.'name'.substr($key,2,strlen($key)).';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
}
} else {
$htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
}
$index++;
}
}
$htmlresult.="<br>";
$htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="checkUncheck" name="checkUncheck" value="Check" onclick="checkReportPrint();" '.$checked.'><b>'.i18n("checkUncheckAll").'</b><br><br>';
echo $htmlresult;
?>
<tr>
<td>
<button align="left" dojoType="dijit.form.Button" id="dialogePrintSubmit" onclick="executeReportPrint('<?php echo $objectClass;?>','<?php echo $idUser;?>');">
<?php echo i18n("buttonOK");?>
</button>
</td><td>
<button align="right" dojoType="dijit.form.Button" onclick="closeReportPrint('<?php echo $objectClass;?>','<?php echo $idUser;?>');">
<?php echo i18n("buttonCancel");?>
</button>
<td>
</tr>
</form>
</tr>
</table>
</div>
<?php
/** ===========================================================================
* This script stores checkboxes' states
*/
require_once "../tool/projector.php";
scriptLog(' ->/tool/jsonQuery.php');
header("Content-Type: text/plain"); // Utilisation d'un header pour spécifier le type de contenu de la page. Ici, il s'agit juste de texte brut (text/plain).
$toStore = (isset($_GET["toStore"])) ? $_GET["toStore"] : NULL;
$toStore=explode(";",$toStore);
if(count($toStore)>1){
$objClass = $toStore[0];
$idUser = $toStore[1];
unset($toStore[0]);
unset($toStore[1]);
if(count($toStore)==0) {
$toStore='';
} else {
$toStore=implode(";",$toStore);
}
$query='SELECT objclass FROM printcheckbox WHERE `objclass`="'.$objClass.'" AND idUser="'.$idUser.'";';
$result=Sql::query($query);
$line = Sql::fetchLine($result);
$checkboxDB=array();
while($line) {
$checkboxDB[]=$line;
$line = Sql::fetchLine($result);
}
if(count($checkboxDB)>0){
$query ="UPDATE printcheckbox set checkboxes='".$toStore."' WHERE objclass='".$objClass."' AND idUser='".$idUser."';";
} else {
$query ="INSERT INTO printcheckbox (`objclass`,`checkboxes`,`idUser`) VALUES('".$objClass."','".$toStore."','".$idUser."')";
}
$result=Sql::query($query);
}
?>
CREATE TABLE `${prefix}printcheckbox` (
`id` int(12) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
`objclass` varchar(50) DEFAULT NULL,
`idUser` int(12) unsigned DEFAULT NULL,
`checkboxes` varchar(500) DEFAULt NULL,
`idle` int(1) unsigned DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
Please Connexion or Create an account to join the conversation.
En poursuivant votre navigation, vous acceptez le dépôt de cookies tiers destinés au bon fonctionnement et à la sécurisation du site (gestion de session, reCaptcha) et à une analyse statistique anonymisée des accès sur notre site (Google Analytics). Si vous vous inscrivez, les informations que vous fournirez ne seront jamais divulguées à un tiers sous quelque forme que ce soit. En savoir plus
Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.
Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.