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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
|
<?php
//quelques déclarations
$annee = date('Y');
$mois = date('m');
echo '<h2>Report by project</h2>';
//si le formulaire est soumi on va chercher les info projets
if(!empty($_POST['selectPj']))
{
//inclusion des classes pour générer le tableau
include('./classes/date.php');
include('./classes/grid.php');
include('./classes/projet.php');
include('./classes/discipline.php');
}
else
{
//on créer le formulaire
echo "<script type='text/javascript'>
/*!
* Ext JS Library 3.1.1
* Copyright(c) 2006-2010 Ext JS, LLC
* licensing@extjs.com
* http://www.extjs.com/license
*/
Ext.onReady(function()
{
/**
* Handler specified for the 'Available' column renderer
* @param {Object} value
*/
function formatDate(value)
{
return value ? value.dateFormat('M d, Y') : '';
}
// shorthand alias
var fm = Ext.form;
//create Data Store for ComboBox and create ComboBox
var storeProject = new Ext.data.Store({
// destroy the store if the grid is destroyed
autoDestroy: true,
autoLoad: true,
// load remote data using HTTP
url: './includes/project_RptPj.php',
// specify a XmlReader (coincides with the XML Ext.format of the returned data)
reader: new Ext.data.XmlReader({
// records will have a 'project' tag
record: 'project',
// use an Array of field definition objects to implicitly create a Record constructor
fields: [
{name: 'projectId'},
{name: 'projectName'}
]
}),
sortInfo: {field:'projectId', direction:'ASC'}
});
var storeDiscipline = new Ext.data.Store({
// destroy the store if the grid is destroyed
autoDestroy: true,
autoLoad: false,
// load remote data using HTTP
url: './includes/discipline_RptPj.php',
// specify a XmlReader (coincides with the XML Ext.format of the returned data)
reader: new Ext.data.XmlReader({
// records will have a 'discipline' tag
record: 'discipline',
// use an Array of field definition objects to implicitly create a Record constructor
fields: [
{name: 'disciplineId'},
{name: 'disciplineName'}
]
}),
sortInfo: {field:'disciplineId', direction:'ASC'}
});
var storeSociete = new Ext.data.Store({
// destroy the store if the grid is destroyed
autoDestroy: true,
autoLoad: false,
// load remote data using HTTP
url: './includes/societe_RptPj.php',
// specify a XmlReader (coincides with the XML Ext.format of the returned data)
reader: new Ext.data.XmlReader({
// records will have a 'societe' tag
record: 'societe',
// use an Array of field definition objects to implicitly create a Record constructor
fields: [
{name: 'societeId'},
{name: 'societeName'}
]
}),
sortInfo: {field:'societeId', direction:'ASC'}
});
var comboSociete = new Ext.form.ComboBox({
allowBlank: false,
lazyRender: true,
maxLength: 55,
width: 110,
editable: false,
emptyText: 'Select a company',
mode: 'local',
triggerAction: 'all',
store: storeSociete,
valueField: 'societeId',
displayField: 'societeId',
fieldLabel: 'Company ',
name: 'selectSte'
});
var comboDiscipline = new Ext.form.ComboBox({
allowBlank: false,
lazyRender: true,
maxLength: 55,
width: 110,
editable: false,
emptyText: 'Select a discipline',
mode: 'local',
triggerAction: 'all',
store: storeDiscipline,
valueField: 'disciplineId',
displayField: 'disciplineId',
fieldLabel: 'Discipline ',
name: 'selectDisc',
listeners: {
'select' : function(cmb, rec, idx) {
comboSociete.clearValue();
comboSociete.store.load({
params: {'project': comboProject.getValue(), 'discipline': comboDiscipline.getValue()}
});
}
}
});
var comboProject = new Ext.form.ComboBox({
allowBlank: false,
lazyRender: true,
maxLength: 55,
width: 110,
editable: false,
emptyText: 'Select a project',
mode: 'local',
triggerAction: 'all',
store: storeProject,
valueField: 'projectId',
displayField: 'projectId',
fieldLabel: 'Project ',
name: 'selectPj',
listeners: {
'select' : function(cmb, rec, idx) {
comboDiscipline.clearValue();
comboDiscipline.store.load({
params: {'project': comboProject.getValue() }
});
}
}
});
function fct_submit() {
formRptPj.form.submit({
url: './includes/rapport_projet.php',
method: 'POST'
});
};
var formRptPj = new Ext.FormPanel({
labelWidth: 75, // label settings here cascade unless overridden
url:'save-form.php',
renderTo:'formRptPj',
frame:true,
title: 'Report project Form',
bodyStyle:'padding:5px 5px 0',
width: 350,
defaults: {width: 230},
defaultType: 'textfield',
items: [comboProject,comboDiscipline,comboSociete,{
xtype:'fieldset',
title: 'Month',
collapsible: true,
autoHeight:true,
autoWidth:true,
defaultType: 'textfield',
items :[{
fieldLabel: 'Month ',
name: 'selectMois',
value: '".$annee."-".$mois."'
}]},{
xtype:'fieldset',
title: 'OR During',
collapsible: true,
autoHeight:true,
autoWidth:true,
defaultType: 'textfield',
items :[{
fieldLabel: 'Start date ',
name: 'selectDateDeb',
value: 'yyyy-mm-dd'
},{
fieldLabel: 'End date ',
name: 'selectDateFin',
value: 'yyyy-mm-dd'
}]}
],
buttons: [{
text: 'Validate',
handler : fct_submit
}]
});
});
</script>";
//maintenant on s'occupe d'affiche le tout
echo '<div id="formRptPj"></div>';
}
?> |
Partager