Advertisement
cdsatrian

keuren binnen

Sep 24th, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.43 KB | None | 0 0
  1. <?php
  2. //buat variabel $intervals sebagai suatu array
  3. $intervals=array();
  4. foreach($product as $products) :
  5.   $slangtype = explode ("-",$products['product_slangtype']);
  6. ?>
  7.   <tr class="task  Hoog" id="project-0">
  8.     <td align="center" valign="middle">
  9.       <input type="checkbox" name="projectslist[]" value="#project-0" checked="checked">
  10.     </td>
  11.     <td><?php echo $products['product_rn']; ?></td>
  12.     <td class="title">
  13.       <div class="task_title">
  14.         <a href="http://mvdb-certificaten.ebbersmediaweb.nl/index.html#project-0"
  15.            title="Bewerken" class="edit_slangtype"
  16.            rel="projects/save.php">
  17.           <?php  echo $slangtype[1] ?>
  18.         </a>
  19.         <div class="quick_options fr">
  20.           <a href="product_edit.php?idp=<?php echo $products['id_product'] ?>"
  21.              title="Bewerken" class="do_edit"></a>
  22.           <a href="" onclick="return confirm('Delete this data?')"
  23.              title="Verwijderen" class="do_delete"></a>
  24.         </div>
  25.       </div>
  26.   </td>
  27.   <td>
  28.     <?php echo date('d-m-Y',strtotime($products['product_created'])); ?>
  29.   </td>
  30. <?php
  31. $res=strtotime(date('d-m-Y',strtotime($products['product_created'])).'+'.$products['product_k_freq'].' month');
  32. $interval=ceil(abs($res-strtotime(date('d-m-Y')))/86400);
  33. //check apakah $intervals utk account sesuai $products['id_user'] sudah ada?
  34. if(isset($interval[$products['id_user']]))
  35. {
  36.   //jika sudah ada, tambahkan dengan nilai yg didapat
  37.   $intervals[$products['id_user']]['product'][]=$products['product_rn'];
  38.   $intervals[$products['id_user']]['interval']+=$interval;
  39. }
  40. else
  41. {
  42.   //jika belum ada, buat baru dan isi dengan nilai yang didapat
  43.   $intervals[$products['id_user']]=array();
  44.   $intervals[$products['id_user']]['interval']=$interval;
  45.   $intervals[$products['id_user']]['product']=array();
  46.   $intervals[$products['id_user']]['product'][]=$products['product_rn'];
  47. }
  48. ?>
  49.   <td><input type="text" value="<?php echo date('d-m-Y',$res); ?>"
  50.              class="input_clean date-pick_table"></td>
  51.   <td><?php echo $interval; ?> dagen</td>
  52.   <td><?php echo $products['product_fabrikant'] ?></td>
  53.   <td>
  54.     <a class="open_accordion"
  55.        href="keuring_add.php?idp=<?php echo $products['id_product']; ?>"
  56.        title="">Keuren</a>
  57.   </td>
  58. </tr>          
  59. <?php
  60. endforeach;
  61. foreach($intervals as $id_user => $interval)
  62. {
  63.   if($interval['interval']==60)
  64.   {
  65.     //kirim email ke account $id_user
  66.   }
  67. }
  68. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement