[cakephp] - comment intergrer un fichier datepicker dans la vue

Fermé
gisgi Messages postés 2 Date d'inscription mardi 18 août 2015 Statut Membre Dernière intervention 18 août 2015 - Modifié par jordane45 le 18/08/2015 à 16:56
gisgi Messages postés 2 Date d'inscription mardi 18 août 2015 Statut Membre Dernière intervention 18 août 2015 - 18 août 2015 à 16:40
je ne comprent pas prkoi mon calendrier ne s'affiche mem pas


<!--voici mon fichier index.ctp dans ma vue
--> <html>

 <head>
  <!--apel de mes fichiers js et css contenu dans webroot/css et webroot/css-->
  <?php  echo $this->Html->css ( 'datepicker' );?>
     <?php echo $this->Html->script('bootstrap-datepicker.js');  ?>
 
<!-- ls script qui chargera le datepicker -->
</head>



 
<FORM METHOD="GET" ACTION="[http://localhost/cake%20-%20Copie/cake/Stats/index]">
  <LI>Date_D: <input type="text"
  name="date_debut" class="datepicker"  size=30 value="<?= $date_debut ?>">

  <LI>Date_F: <input type="text"
  name="date_fin" size=30 value="<?= $date_fin ?>">

  
Who
<select name="who">
 <option <?php if($who == COUNT_REGISTRATION) echo "selected='selected'"; ?> value="<?= COUNT_REGISTRATION ?>">Inscrit</option>
 <option <?php if($who == COUNT_CONNECTIONS) echo "selected='selected'"; ?> value="<?= COUNT_CONNECTIONS ?>">Connecte</option>
</select>
Group By
<select name="group">
 <option <?php if($group == COUNT_BY_YEAR) echo "selected='selected'"; ?> value="<?= COUNT_BY_YEAR ?>">Year</option>
 <option <?php if($group == COUNT_BY_MONTH) echo "selected='selected'"; ?> value="<?= COUNT_BY_MONTH ?>">Month</option>
 <option <?php if($group == COUNT_BY_WEEK) echo "selected='selected'"; ?> value="<?= COUNT_BY_WEEK ?>">Week</option>
 <option <?php if($group == COUNT_BY_DATE) echo "selected='selected'"; ?> value="<?= COUNT_BY_DATE ?>">Date</option>
 <option <?php if($group == COUNT_BY_HOUR) echo "selected='selected'"; ?> value="<?= COUNT_BY_HOUR ?>">Hour</option>
</select>
<button type="submit">Submit</button>
</FORM>
<?php if(isset($by_year)): ?>
<div class="statistics index">
 <h2><?php echo __('Statistics par Annees'); ?></h2>
 <table cellpadding="0" cellspacing="0">
 <tr>
   <th><?php echo $this->Paginator->sort('Year'); ?></th>
   <th><?php echo $this->Paginator->sort('Number'); ?></th>
   
 </tr>
 <?php foreach ($by_year as $data): ?>
 <tr>
  <td><?php echo h($data[0]['year']); ?></td>  
  <td><?php echo h($data[0]['count']); ?> </td>
 </tr>
 <?php endforeach; ?>
 </table>
</div>
<?php endif; ?>
<?php if(isset($by_month)): ?>
<div class="statistics index">
 <h2><?php echo __('Statistics par Mois'); ?></h2>
 <table cellpadding="0" cellspacing="0">
 <tr>
   <th><?php echo $this->Paginator->sort('Year'); ?></th>
   <th><?php echo $this->Paginator->sort('Month'); ?></th>
   <th><?php echo $this->Paginator->sort('Number'); ?></th>
   
 </tr>
 <?php foreach ($by_month as $data): ?>  
 <tr>
  <td><?php echo h($data[0]['year']); ?></td>  
  <td><?php echo h($data[0]['month']); ?></td> 
  <td><?php echo h($data[0]['count']); ?> </td>
 </tr>
 <?php endforeach; ?>
 </table>
</div>
<?php endif; ?>
<?php if(isset($by_week)): ?>
<div class="statistics index">
 <h2><?php echo __('Statistics par Week'); ?></h2>
 <table cellpadding="0" cellspacing="0">
 <tr>
   <th><?php echo $this->Paginator->sort('Year'); ?></th>
   <th><?php echo $this->Paginator->sort('Month'); ?></th>
   <th><?php echo $this->Paginator->sort('Week'); ?></th>
   <th><?php echo $this->Paginator->sort('Number'); ?></th>
   
 </tr>
 <?php foreach ($by_week as $data): ?>
 <tr>
  <td><?php echo h($data[0]['year']); ?></td>  
  <td><?php echo h($data[0]['month']); ?></td>  
  <td><?php echo h($data[0]['week']); ?></td> 
  <td><?php echo h($data[0]['count']); ?> </td>
 </tr>
 <?php endforeach; ?>
 </table>
</div>
<?php endif; ?>
<?php if(isset($by_date)): ?>
<div class="statistics index">
 <h2><?php echo __('Statistics par Date'); ?></h2>
 <table cellpadding="0" cellspacing="0">
 <tr>
   <th><?php echo $this->Paginator->sort('Year'); ?></th>
   <th><?php echo $this->Paginator->sort('Month'); ?></th>
   <th><?php echo $this->Paginator->sort('Week'); ?></th>
   <th><?php echo $this->Paginator->sort('Date'); ?></th>
   <th><?php echo $this->Paginator->sort('Number'); ?></th>
   
 </tr>
 <?php foreach ($by_date as $data): ?>
 <tr>
  <td><?php echo h($data[0]['year']); ?></td>  
  <td><?php echo h($data[0]['month']); ?></td>  
  <td><?php echo h($data[0]['week']); ?></td>  
  <td><?php echo h($data[0]['date']); ?></td>  
  <td><?php echo h($data[0]['count']); ?></td>
 </tr>
 <?php endforeach; ?>
 </table>
</div>
<?php endif; ?>
<?php if(isset($by_hour)): ?><div class="statistics index">
 <h2><?php echo __('Statistics par Heure'); ?></h2>
 <table cellpadding="0" cellspacing="0">
 <tr>
   <th><?php echo $this->Paginator->sort('Year'); ?></th>
   <th><?php echo $this->Paginator->sort('Month'); ?></th>
   <th><?php echo $this->Paginator->sort('Week'); ?></th>
   <th><?php echo $this->Paginator->sort('Date'); ?></th>
   <th><?php echo $this->Paginator->sort('Hour'); ?></th>
   <th><?php echo $this->Paginator->sort('Number'); ?></th>
   
 </tr>
 <?php foreach ($by_hour as $data): ?>
 <tr>
  <td><?php echo h($data[0]['year']); ?></td>  
  <td><?php echo h($data[0]['month']); ?></td>  
  <td><?php echo h($data[0]['week']); ?></td>  
  <td><?php echo h($data[0]['date']); ?></td>  
  <td><?php echo h($data[0]['hour']); ?></td>  
  <td><?php echo h($data[0]['count']); ?> </td>
 </tr>
 <?php endforeach; ?>
 </table>
</div>
<?php endif; ?>
 <script script="javascript">
    // <![CDATA[     
   var opts = {   
   // Attach input with an id of "dp-1" and give it a "d-sl-m-sl-Y" date format (e.g. 13/03/1990)                      
   formElements:{"dp_1":"dp_1"}                
   };      
   datePickerController.createDatePicker(opts);
   // ]]>
   //alert("sonya");
 </script>
 <html>

 <head>
  
  <?php  echo $this->Html->css ( 'datepicker' );?>
     <?php echo $this->Html->script('bootstrap-datepicker.js');  ?>
 
<!-- ls script qui chargera le datepicker -->
</head>



 
<FORM METHOD="GET" ACTION="[http://localhost/cake%20-%20Copie/cake/Stats/index]">
  <LI>Date_D: <input type="text"
  name="date_debut" class="datepicker"  size=30 value="<?= $date_debut ?>">

  <LI>Date_F: <input type="text"
  name="date_fin" size=30 value="<?= $date_fin ?>">

  
Who
<select name="who">
 <option <?php if($who == COUNT_REGISTRATION) echo "selected='selected'"; ?> value="<?= COUNT_REGISTRATION ?>">Inscrit</option>
 <option <?php if($who == COUNT_CONNECTIONS) echo "selected='selected'"; ?> value="<?= COUNT_CONNECTIONS ?>">Connecte</option>
</select>
Group By
<select name="group">
 <option <?php if($group == COUNT_BY_YEAR) echo "selected='selected'"; ?> value="<?= COUNT_BY_YEAR ?>">Year</option>
 <option <?php if($group == COUNT_BY_MONTH) echo "selected='selected'"; ?> value="<?= COUNT_BY_MONTH ?>">Month</option>
 <option <?php if($group == COUNT_BY_WEEK) echo "selected='selected'"; ?> value="<?= COUNT_BY_WEEK ?>">Week</option>
 <option <?php if($group == COUNT_BY_DATE) echo "selected='selected'"; ?> value="<?= COUNT_BY_DATE ?>">Date</option>
 <option <?php if($group == COUNT_BY_HOUR) echo "selected='selected'"; ?> value="<?= COUNT_BY_HOUR ?>">Hour</option>
</select>
<button type="submit">Submit</button>
</FORM>
<?php if(isset($by_year)): ?>
<div class="statistics index">
 <h2><?php echo __('Statistics par Annees'); ?></h2>
 <table cellpadding="0" cellspacing="0">
 <tr>
   <th><?php echo $this->Paginator->sort('Year'); ?></th>
   <th><?php echo $this->Paginator->sort('Number'); ?></th>
   
 </tr>
 <?php foreach ($by_year as $data): ?>
 <tr>
  <td><?php echo h($data[0]['year']); ?></td>  
  <td><?php echo h($data[0]['count']); ?> </td>
 </tr>
 <?php endforeach; ?>
 </table>
</div>
<?php endif; ?>
<?php if(isset($by_month)): ?>
<div class="statistics index">
 <h2><?php echo __('Statistics par Mois'); ?></h2>
 <table cellpadding="0" cellspacing="0">
 <tr>
   <th><?php echo $this->Paginator->sort('Year'); ?></th>
   <th><?php echo $this->Paginator->sort('Month'); ?></th>
   <th><?php echo $this->Paginator->sort('Number'); ?></th>
   
 </tr>
 <?php foreach ($by_month as $data): ?>  
 <tr>
  <td><?php echo h($data[0]['year']); ?></td>  
  <td><?php echo h($data[0]['month']); ?></td> 
  <td><?php echo h($data[0]['count']); ?> </td>
 </tr>
 <?php endforeach; ?>
 </table>
</div>
<?php endif; ?>
<?php if(isset($by_week)): ?>
<div class="statistics index">
 <h2><?php echo __('Statistics par Week'); ?></h2>
 <table cellpadding="0" cellspacing="0">
 <tr>
   <th><?php echo $this->Paginator->sort('Year'); ?></th>
   <th><?php echo $this->Paginator->sort('Month'); ?></th>
   <th><?php echo $this->Paginator->sort('Week'); ?></th>
   <th><?php echo $this->Paginator->sort('Number'); ?></th>
   
 </tr>
 <?php foreach ($by_week as $data): ?>
 <tr>
  <td><?php echo h($data[0]['year']); ?></td>  
  <td><?php echo h($data[0]['month']); ?></td>  
  <td><?php echo h($data[0]['week']); ?></td> 
  <td><?php echo h($data[0]['count']); ?> </td>
 </tr>
 <?php endforeach; ?>
 </table>
</div>
<?php endif; ?>
<?php if(isset($by_date)): ?>
<div class="statistics index">
 <h2><?php echo __('Statistics par Date'); ?></h2>
 <table cellpadding="0" cellspacing="0">
 <tr>
   <th><?php echo $this->Paginator->sort('Year'); ?></th>
   <th><?php echo $this->Paginator->sort('Month'); ?></th>
   <th><?php echo $this->Paginator->sort('Week'); ?></th>
   <th><?php echo $this->Paginator->sort('Date'); ?></th>
   <th><?php echo $this->Paginator->sort('Number'); ?></th>
   
 </tr>
 <?php foreach ($by_date as $data): ?>
 <tr>
  <td><?php echo h($data[0]['year']); ?></td>  
  <td><?php echo h($data[0]['month']); ?></td>  
  <td><?php echo h($data[0]['week']); ?></td>  
  <td><?php echo h($data[0]['date']); ?></td>  
  <td><?php echo h($data[0]['count']); ?></td>
 </tr>
 <?php endforeach; ?>
 </table>
</div>
<?php endif; ?>
<?php if(isset($by_hour)): ?><div class="statistics index">
 <h2><?php echo __('Statistics par Heure'); ?></h2>
 <table cellpadding="0" cellspacing="0">
 <tr>
   <th><?php echo $this->Paginator->sort('Year'); ?></th>
   <th><?php echo $this->Paginator->sort('Month'); ?></th>
   <th><?php echo $this->Paginator->sort('Week'); ?></th>
   <th><?php echo $this->Paginator->sort('Date'); ?></th>
   <th><?php echo $this->Paginator->sort('Hour'); ?></th>
   <th><?php echo $this->Paginator->sort('Number'); ?></th>
   
 </tr>
 <?php foreach ($by_hour as $data): ?>
 <tr>
  <td><?php echo h($data[0]['year']); ?></td>  
  <td><?php echo h($data[0]['month']); ?></td>  
  <td><?php echo h($data[0]['week']); ?></td>  
  <td><?php echo h($data[0]['date']); ?></td>  
  <td><?php echo h($data[0]['hour']); ?></td>  
  <td><?php echo h($data[0]['count']); ?> </td>
 </tr>
 <?php endforeach; ?>
 </table>
</div>
<?php endif; ?>
 <script script="javascript">
    // <![CDATA[     
   var opts = {   
   // Attach input with an id of "dp-1" and give it a "d-sl-m-sl-Y" date format (e.g. 13/03/1990)                      
   formElements:{"dp_1":"dp_1"}                
   };      
   datePickerController.createDatePicker(opts);
   // ]]>
   alert("sonya");
 </script>


EDIT : Ajout des balises de code (la coloration syntaxique).
Explications disponibles ici :
https://codes-sources.commentcamarche.net/faq/10686-le-nouveau-codes-sources-comment-ca-marche#balises-code

Merci d'y penser dans tes prochains messages.
.

EDIT2 : Titre modifié pour faire apparaitre : cakephp
A voir également:

1 réponse

jordane45 Messages postés 38145 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 25 avril 2024 4 650
18 août 2015 à 16:35
Bonjour,

Tu parles de vue .... je suppose donc que tu utilises un framework .... lequel ??

Ensuites;.. as tu regardé dans la console de ton navigateur si tu n'aurais pas des erreurs de script qui apparaitraient ?

0
gisgi Messages postés 2 Date d'inscription mardi 18 août 2015 Statut Membre Dernière intervention 18 août 2015
18 août 2015 à 16:40
j'utilise le cakephp.biensur il n'ya aucune erreur
0