<script type="text/javascript" language="javascript">
var CID = <?php echo $CID ?>;
page1 = [
AW.all["groupParams"],
AW.all["groupReports"],
AW.all["buttonSubmit"],
AW.all["buttonCancel"],
AW.all["treeReport"]
];
<?php
include('../Engine/conf.inc.php');
$connection = mysql_pconnect($SQL_Server,$SQL_User,$SQL_PSWD);
mysql_select_db($SQL_DB);
mysql_query("SET CHARACTER SET utf8", $connection);
mysql_query("SET NAMES 'utf8'", $connection);
function combo_setup($dataset){
$result_text = '[';
$result_value = '[';
$num_rows = mysql_num_rows($dataset);
$i = 1;
while ($row = @mysql_fetch_array($dataset))
{
$result_text .= '"'.$row['param_value']." - ".$row['param_text'].'"';
$result_value .= '"'.$row['param_value'].'"';
if($i < $num_rows)
{
$result_text .= ',';
$result_value .= ',';
$i++;
}
}
echo 'comboText = '.$result_text.'];'."\n\t";
echo 'comboValue = '.$result_value.'];'."\n\t";
echo 'comboItems = '.$num_rows.';'."\n\t";
}
$query = " Select
ReportLink
From
WAIS_Reports
WHERE ID = '".$reportID."'
";
$dataset = @mysql_query($query, $connection);
while ($record = @mysql_fetch_array($dataset))
{
$ReportLink = $record['ReportLink']."?CID='+CID";
}
$query = " Select
*
From
WAIS_ReportParams
WHERE Report_ID = '".$reportID."'
";
$dataset = @mysql_query($query, $connection);
$rows = array();
$paramno = 1;
while ($record = @mysql_fetch_array($dataset))
{
echo "
var label".$record['Param_Name']." = new AW.UI.Label;
label".$record['Param_Name'].".setId('label".$record['Param_Name']."');
label".$record['Param_Name'].".setControlText('".$record['Param_Label']."');
label".$record['Param_Name'].".setPosition(31, ".((($paramno-1)*25)+81).");
label".$record['Param_Name'].".setSize(100, 16);
";
echo "page1[".(5+($paramno))."] = label".$record['Param_Name'].";\n\n";
if($record['Param_Type'] == 'date')
{
echo "DateObject".$paramno." = new Date();
".$record['Param_Name']."OnSelect = function(".$record['Param_Name']."Datepicker, date)
{
combo".$record['Param_Name'].".setControlText(date);
if (".$record['Param_Name']."Datepicker.dateClicked)
{
".$record['Param_Name']."Datepicker.callCloseHandler(); // this calls 'onClose' (see above)
}
};
".$record['Param_Name']."OnClose = function(".$record['Param_Name']."Datepicker) {
".$record['Param_Name']."Datepicker.hide();
// or calendar.destroy();
};
var ".$record['Param_Name']."Datepicker = new Calendar(1,null, ".$record['Param_Name']."OnSelect, ".$record['Param_Name']."OnClose);
".$record['Param_Name']."Datepicker.weekNumbers = false;
".$record['Param_Name']."Datepicker.showsTime = false;
".$record['Param_Name']."Datepicker.setDateFormat('%d.%m.%Y');
".$record['Param_Name']."Datepicker.create();
var combo".$record['Param_Name']." = new AW.UI.Combo;
combo".$record['Param_Name'].".setId('combo".$record['Param_Name']."');
combo".$record['Param_Name'].".setControlText(DateObject".$paramno.".print('%d.%m.%Y'));
combo".$record['Param_Name'].".setPosition(31, ".((($paramno-1)*25)+101).");
combo".$record['Param_Name'].".setSize(180, 20);
combo".$record['Param_Name'].".setItemText('');
combo".$record['Param_Name'].".setItemValue('');
combo".$record['Param_Name'].".setItemCount(0);
combo".$record['Param_Name'].".getPopupTemplate().setStyle('width',combo".$record['Param_Name'].".getStyle('width'));
combo".$record['Param_Name'].".getPopupTemplate().setStyle('height',17*(combo".$record['Param_Name'].".getItemCount()<10?combo".$record['Param_Name'].".getItemCount():10));
combo".$record['Param_Name'].".getContent('box/text').setAttribute('readonly', true);
combo".$record['Param_Name'].".onControlEditStarted = function(){
this.getContent('box/text').element().contentEditable = false;
}
combo".$record['Param_Name'].".onControlClicked = function() {
this.showPopup();
}
combo".$record['Param_Name'].".showPopup = function(){
".$record['Param_Name']."Datepicker.showAt(31, ".((($paramno-1)*25)+171).");
}
";
$ReportLink .= "+'&".$record['Param_Name']."='+AW.all['combo".$record['Param_Name']."'].getControlText().substr(0,10)";
echo "page1[".(5+($paramno+1))."] = combo".$record['Param_Name'].";\n\n";
}
if($record['Param_Type'] == 'combo')
{
$combo_dataset = mysql_query($record['Param_Value']);
combo_setup($combo_dataset);
echo "var combo".$record['Param_Name']." = new AW.UI.Combo;
combo".$record['Param_Name'].".setId('combo".$record['Param_Name']."');
combo".$record['Param_Name'].".setControlText('');
combo".$record['Param_Name'].".setPosition(31, ".((($paramno-1)*25)+101).");
combo".$record['Param_Name'].".setSize(180, 20);
combo".$record['Param_Name'].".setItemText(comboText);
combo".$record['Param_Name'].".setItemValue(comboValue);
combo".$record['Param_Name'].".setItemCount(comboItems);
combo".$record['Param_Name'].".setSelected('1')
combo".$record['Param_Name'].".getPopupTemplate().setStyle('width',combo".$record['Param_Name'].".getStyle('width'));
combo".$record['Param_Name'].".getPopupTemplate().setStyle('height',17*(combo".$record['Param_Name'].".getItemCount()<10?combo".$record['Param_Name'].".getItemCount():10));
combo".$record['Param_Name'].".getContent('box/text').setAttribute('readonly', true);
combo".$record['Param_Name'].".onControlEditStarted = function(){
this.getContent('box/text').element().contentEditable = false;
}
combo".$record['Param_Name'].".onControlClicked = function() {
this.showPopup();
}
";
$ReportLink .= "+'&".$record['Param_Name']."='+AW.all['combo".$record['Param_Name']."'].getControlText().substr(0,10)";
echo "page1[".(5+($paramno+1))."] = combo".$record['Param_Name'].";\n\n";
}
else
{
}
$paramno = $paramno+2;
}
?>
AW.all["buttonSubmit"].onClick = function(){
//alert(treeReport.getSelectedItems() +"/" + treeReport.getAttribute("NodesCount"));
if (AW.all["treeReport"].getSelectedItems() <= AW.all["treeReport"].getAttribute("NodesCount"))
{
alert("Zvolte prosím sestavu pro zobrazení");
}
else
{
reportWindow = window.open(<? echo "'".$ReportLink?>,'','resizable');
reportWindow.focus();
}
}
AW.all["reportContainer"].element().innerHTML = page1.join("");
document.WAIS_loading.src = "images/design/blank.gif";
//alert('POZOR:\n\nSystém sestav je dočasně nedostupný\n\n(vrácený kód:\t'+AW.all["treeReport"].getItemValue(AW.all["treeReport"].getSelectedItems()-1)+')\n\n/PNC/Reports/DR_visits_report.php?CID='+CID+'&date_from='+AW.all['combodate_from'].getControlText().substr(0,10)+'&date_to='+AW.all['combodate_to'].getControlText().substr(0,10));
</script>
This topic is archived.