Advertisement
Guest User

Untitled

a guest
Jan 8th, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.88 KB | None | 0 0
  1. <h2>Jūsu mācību kartes:</h2>
  2. <style type="text/css">
  3. .hovers:hover div{
  4.     background-color:#D0DAFD;
  5. }
  6.  
  7. </style>
  8.  
  9. <?php
  10. if(isset($_POST['pievienot'])){
  11.     $db->insert("INSERT INTO csn_categories_join_kartes (id_kartes, id_categories) VALUES ('".$_POST['id_kartes']."','".$_POST['kat_nosaukums']."')");
  12.        if(isset($insert)){
  13.           echo "<script>alert('".$_POST['kat_nosaukums']."');</script>";
  14.         }
  15.    
  16. }
  17.  
  18. ?>
  19.  
  20.  
  21. <?php
  22. echo " <div style='margin-left:2px; width='100%;' class='row'><table><thead>
  23. <tr style=''>
  24. <th colspan='3' style='text-align: center;'>Aktīva</th>
  25. <th colspan='3' style='text-align: center;'>Kartes Nr.</th>
  26. <th style='text-align: center;'>Kategorija</th>
  27. <th style='text-align: center;'>Adrese</th>
  28. <th style='text-align: center;'>Sākuma datums</th>
  29. <th style='text-align: center;'>Beigu datums</th>
  30. <th style='text-align: center;'>Pilseta</th>
  31. <th style='text-align: center;'>Iespejas</th></tr>
  32. </thead><tbody>
  33. </tbody></table></div>";
  34.  
  35. foreach($db->fetch_array("SELECT * FROM csn_kartes order by datey = '' desc") as $card)
  36. {
  37.  
  38.     // ".(condition ? true : false)."
  39.     // if(condition) { true } else { false }
  40.  
  41.   echo "
  42.  <div class='hovers'>
  43.     <div  style='width:100%; margin-top:2px; background-color:#e8edff; display: block; height: 60px; clear: both;'>
  44.     <div style=' margin-left:35px; height: 100%; float: left; width:5%;'>
  45.         ".($card['datey'] == NULL ? '' : "N/A"
  46.         )."
  47.         </div>
  48.         <div style=' margin-left:35px; height: 100%; float: left; width:13%;'>
  49.         ".$card['card_nr']."
  50.         </div>
  51.         <div style=' height: 100%;  float: left; width:13%;'>";
  52.           foreach($db->fetch_array("SELECT id_categories FROM csn_categories_join_kartes where id_kartes=".$card['id']."") as $kat){
  53.        
  54.         echo $kat['id_categories']);
  55.         echo $db->error;
  56.                
  57.        
  58.  
  59.       }
  60.         echo "</div>
  61.         <div style=' height: 100%;  float: left; width:12%;'>
  62.         ".$card['address']."
  63.         </div>
  64.         <div style=' height: 100%;  float: left; width:12%;'>
  65.         &nbsp;&nbsp;&nbsp;&nbsp;".$card['datex']."
  66.         </div>
  67.         <div style=' height: 100%; text-align:right;  float: left; width:12%;'>
  68.         ".$card['datey']."
  69.         </div>
  70.         <div style=' height: 100%; text-align:right;  float: left; width:12%;'>
  71.         ".$card['city']."
  72.         </div>
  73.         <div style=' height: 100%; text-align:right; margin-right:10px;  float: right; width:4%;'>
  74.         <a href='#kategorijas' class='btn btn-mini openmodal' data-id='{$card['id']}'><i class='icon-plus'></i></a>&nbsp;&nbsp;&nbsp;&nbsp;
  75.         </div>
  76.      <div style=' height: 100%; text-align:right;  float: right; width:4%;'>
  77.      <a href='index.php?view=myschool&action=edit_card&id=".$card['id']."'   class='btn btn-mini'><i class='icon-pencil'></i></a>&nbsp;&nbsp;&nbsp;&nbsp;
  78.      </div>
  79.        
  80.     </div>
  81.     </div>";
  82.  
  83.  
  84. }
  85.  
  86. echo "<div class='display:none;'><div id='kategorijas' class='modal hide fade'>
  87.    <div class=''>
  88.        <form method='post' action=''>
  89.          <p>Kartei NR. <span class='idspace'>X</span> pievienot kategoriju:</p>
  90.  
  91.          <select name='kat_nosaukums'>";
  92.           foreach($db->fetch_array("SELECT * FROM csn_group_categories") as $cat){
  93.               echo "<option>".$cat['kat_nosaukums']."</option>";
  94.             }
  95.             echo"
  96.          </select>
  97.          <input type='hidden' name='id_kartes' value='' class='idspace2'/>
  98.          <input type='submit' name='pievienot' value='pievienot'>
  99.          </input>
  100.        </form>
  101.    </div>
  102. </div></div>";
  103.  
  104.  
  105.  ?>
  106.  <script>
  107.   $(function() {
  108.       $(".openmodal").click(function() {
  109.         var self = $(this);      
  110.         $("#kategorijas").modal("show");
  111.         $("#kategorijas").on("shown",function() {
  112.           $("#kategorijas").find(".idspace").html(self.data("id"))
  113.           $("#kategorijas").find(".idspace2").val(self.data("id"))
  114.         })        
  115.  
  116.       })
  117.    
  118.   })
  119.  
  120.  </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement