Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h2>Jūsu mācību kartes:</h2>
- <style type="text/css">
- .hovers:hover div{
- background-color:#D0DAFD;
- }
- </style>
- <?php
- if(isset($_POST['pievienot'])){
- $db->insert("INSERT INTO csn_categories_join_kartes (id_kartes, id_categories) VALUES ('".$_POST['id_kartes']."','".$_POST['kat_nosaukums']."')");
- if(isset($insert)){
- echo "<script>alert('".$_POST['kat_nosaukums']."');</script>";
- }
- }
- ?>
- <?php
- echo " <div style='margin-left:2px; width='100%;' class='row'><table><thead>
- <tr style=''>
- <th colspan='3' style='text-align: center;'>Aktīva</th>
- <th colspan='3' style='text-align: center;'>Kartes Nr.</th>
- <th style='text-align: center;'>Kategorija</th>
- <th style='text-align: center;'>Adrese</th>
- <th style='text-align: center;'>Sākuma datums</th>
- <th style='text-align: center;'>Beigu datums</th>
- <th style='text-align: center;'>Pilseta</th>
- <th style='text-align: center;'>Iespejas</th></tr>
- </thead><tbody>
- </tbody></table></div>";
- foreach($db->fetch_array("SELECT * FROM csn_kartes order by datey = '' desc") as $card)
- {
- // ".(condition ? true : false)."
- // if(condition) { true } else { false }
- echo "
- <div class='hovers'>
- <div style='width:100%; margin-top:2px; background-color:#e8edff; display: block; height: 60px; clear: both;'>
- <div style=' margin-left:35px; height: 100%; float: left; width:5%;'>
- ".($card['datey'] == NULL ? '' : "N/A"
- )."
- </div>
- <div style=' margin-left:35px; height: 100%; float: left; width:13%;'>
- ".$card['card_nr']."
- </div>
- <div style=' height: 100%; float: left; width:13%;'>";
- foreach($db->fetch_array("SELECT id_categories FROM csn_categories_join_kartes where id_kartes=".$card['id']."") as $kat){
- echo $kat['id_categories']);
- echo $db->error;
- }
- echo "</div>
- <div style=' height: 100%; float: left; width:12%;'>
- ".$card['address']."
- </div>
- <div style=' height: 100%; float: left; width:12%;'>
- ".$card['datex']."
- </div>
- <div style=' height: 100%; text-align:right; float: left; width:12%;'>
- ".$card['datey']."
- </div>
- <div style=' height: 100%; text-align:right; float: left; width:12%;'>
- ".$card['city']."
- </div>
- <div style=' height: 100%; text-align:right; margin-right:10px; float: right; width:4%;'>
- <a href='#kategorijas' class='btn btn-mini openmodal' data-id='{$card['id']}'><i class='icon-plus'></i></a>
- </div>
- <div style=' height: 100%; text-align:right; float: right; width:4%;'>
- <a href='index.php?view=myschool&action=edit_card&id=".$card['id']."' class='btn btn-mini'><i class='icon-pencil'></i></a>
- </div>
- </div>
- </div>";
- }
- echo "<div class='display:none;'><div id='kategorijas' class='modal hide fade'>
- <div class=''>
- <form method='post' action=''>
- <p>Kartei NR. <span class='idspace'>X</span> pievienot kategoriju:</p>
- <select name='kat_nosaukums'>";
- foreach($db->fetch_array("SELECT * FROM csn_group_categories") as $cat){
- echo "<option>".$cat['kat_nosaukums']."</option>";
- }
- echo"
- </select>
- <input type='hidden' name='id_kartes' value='' class='idspace2'/>
- <input type='submit' name='pievienot' value='pievienot'>
- </input>
- </form>
- </div>
- </div></div>";
- ?>
- <script>
- $(function() {
- $(".openmodal").click(function() {
- var self = $(this);
- $("#kategorijas").modal("show");
- $("#kategorijas").on("shown",function() {
- $("#kategorijas").find(".idspace").html(self.data("id"))
- $("#kategorijas").find(".idspace2").val(self.data("id"))
- })
- })
- })
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement