Vonjour à toutes et à tous,
j'ai un petit soucis avec un script que j'essais de faire pour gérer les weekend en fait chaque personne qui consulte son agenda voit les rendez vous publiés le samedi et le dimanche reportés à lundi.
du coup j'ai ajouté une cl&asse aux input contenant la date du rendez vous et ici est le script qui génère l'agenda en fonction du contenu de la base de donnée.
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
| <form action="<?php echo (isset($_POST['go'])) ? 'go2.php' : '#'; ?>"
method="post">
<input type="hidden" name="liasse" value="<?php echo $_GET['liasse']; ?>"
/>
<input type="hidden" name="n_doss" value="<?php echo $_GET['n_doss']; ?>"
/>
<table id="box-table-a">
<tr>
<th scope="col">
<input name="data[<?php echo ++$i; ?>][code_s]" type="text" value="CODE S"
size="10">
</th>
<th scope="col">
<input name="data[<?php echo $i; ?>][libelle]" type="text" value="LIBELLE"
size="30">
</th>
<th scope="col">
<input name="data[<?php echo $i; ?>][action]" type="text" value="ACTION"
size="15">
</th>
<th scope="col">
<input name="data[<?php echo $i; ?>][libelle]" type="text" value="DESCRIPTION"
size="40">
</th>
<th scope="col">
<input type="text" name="data[<?php echo $i; ?>][date]" value="DATE D'ACTION"
size="12">
</th>
<th scope="col">
<input type="text" name="data[<?php echo $i; ?>][date]" value="VALIDATION"
size="12">
</th>
<th scope="col"><strong>ETAT</strong>
</th>
</tr>
<?php while($row=m ysql_fetch_assoc($qry)): ?>
<tr>
<td>
<input name="data[<?php echo ++$i; ?>][code_s]" type="text" value="<?php echo $row['code_s'];?>"
size="10">
</td>
<td>
<input name="data[<?php echo $i; ?>][libelle]" type="text" value="<?php echo $row['libelle']; ?>"
size="30">
</td>
<td>
<input name="data[<?php echo $i; ?>][action]" type="text" value="<?php echo $row['action']; ?>"
size="15">
</td>
<td>
<input name="data[<?php echo $i; ?>][libelle]" type="text" value="<?php echo $row['description']; ?>"
size="40">
</td>
<td>
<script type="text/javascript">
//<![CDATA[
window.addEvent('domready', function () {
myCal1 = new Calendar({
'data[$i][date]': 'd-m-Y'
}, {
direction: 0,
tweak: {
x: 6,
y: 0
}
});
});
//]]>
</script>
<input type="text" name="data[<?php echo $i; ?>][date]" class="date"
id="date<?php echo $i; ?>" value="<?php
echo date('d-m-Y',strtotime($row['date_action'])) ;
?>" size="12">
</td>
<td nowrap>
<input type="text" name="data[<?php echo $i; ?>][date_validation]" id="data[<?php echo $i; ?>][date_validation]"
value="<?php if($row['date_validation']=='0000-00-00') {echo 'Non traité' ; }
else {
echo (date('d-m-Y',strtotime($row['date_validation']))); }
?>" size="12">
</td>
<td nowrap>
<?php if($row[ 'date_validation']=='0000-00-00' AND strtotime($row[
'date_action'])>strtotime(date('Y-m-d'))) {?><a href="edit-action.php?id=<?php echo $row['id'] ; ?>&n_doss=<?php echo $row['n_doss'] ; ?>&liasse=<?php echo $_GET['liasse'] ?>&qualite=<?php echo $_GET['qualite'] ?>"><img src="images/gtk-edit.png" width="24" height="24"></a>
<a
href="validate-action.php?id=<?php echo $row['id'] ; ?>&n_doss=<?php echo $row['n_doss'] ; ?>&liasse=<?php echo $_GET['liasse'] ?>&qualite=<?php echo $_GET['qualite'] ?>">
<img src="images/go.gif" width="24" height="24">
</a> <a href="delete-action.php?id=<?php echo $row['id'] ; ?>&n_doss=<?php echo $row['n_doss'] ; ?>&liasse=<?php echo $_GET['liasse'] ?>"
onClick="return confirm('voulez vous vraiment supprimer cette action ?')"><img src="images/trash-paper.png" width="24" height="24"></a>
<?php
} elseif($row[ 'date_validation']=='0000-00-00' AND strtotime($row[
'date_action'])<=strtotime(date( 'Y-m-d'))) {?><a href="#" onClick="return confirm('Vous ne pouvez pas éditer ou changer la date d\'une action appartenant à votre passif !')"><img src="images/gtk-edit.png" width="24" height="24"></a>
<a
href="validate-action.php?id=<?php echo $row['id'] ; ?>&n_doss=<?php echo $row['n_doss'] ; ?>&liasse=<?php echo $_GET['liasse'] ?>&qualite=<?php echo $_GET['qualite'] ?>">
<img src="images/go.gif" width="24" height="24">
</a> <a href="#" onClick="return confirm('Vous ne pouvez pas supprimer une action appartenant à votre passif !')"><img src="images/trash-paper.png" width="24" height="24"></a>
<?php
} else { ?>
<img src="images/tick_48.png" width="24" height="24">
<?php } ?>
</td>
</tr>
<?php endwhile; ?>
</td>
</tr>
</table> |
donc j'ai tous mis dans le header pour le code qui suit:
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
| <script type="text/javascript">
function getdate() {
var items = new Array();
var itemCount = document.getElementsByClassName("date");
for (var i = 0; i < itemCount.length; i++) {
items[i] = document.getElementById("date" + (i + 1)).value;
}
for (var i = 0; i < itemCount.length; i++) {
items[i] = document.getElementById("date" + (i + 1)).value;
var itemDtParts = items[i].split("-");
var itemDt = new Date(itemDtParts[2], itemDtParts[1] - 1, itemDtParts[0]);
if (itemDt.getDay() == 6) {
itemCount[i].value = (itemDt.getDate() < 9 ? "0" : "") + (itemDt.getDate() + 2) + "-" + (itemDt.getMonth() < 9 ? "0" : "") + (itemDt.getMonth() + 1) + "-" + itemDt.getFullYear();
}
if (itemDt.getDay() == 0) {
itemCount[i].value = (itemDt.getDate() < 9 ? "0" : "") + (itemDt.getDate() + 1) + "-" + (itemDt.getMonth() < 9 ? "0" : "") + (itemDt.getMonth() + 1) + "-" + itemDt.getFullYear();
}
return items;
}
</script> |
mais ça ne veut pas fonctionner, cela me met plein d'erreurs. Donc je bloque.
Par avance merci pour votre aide.
Voici le genre d'erreur Uncaught SyntaxError: Unexpected end of input edit_scenario.php:1 Uncaught ReferenceError: getdate is not defined edit_scenario.php:138
du coup je bloque car la fonction est bel et bien définie pourtant.
et je voudrais que les champs dates voient leur date remplacer si c'est un weekend par le lundi suivant, donc j'ai mis cela:
itemCount[i].value = (itemDt.getDate() < 9 ? "0" : "") + (itemDt.getDate() + 2) + "-" + (itemDt.getMonth() < 9 ? "0" : "") + (itemDt.getMonth() + 1) + "-" + itemDt.getFullYear();
mais ça n'a pas l'ai de fonctionner.
Par avance merci pour votre aide.
Partager