<?php session_start(); if (!isset($_SESSION['sessCategory'])) { header('Location: index.php'); exit; } include_once 'inc/classes/Sound.php'; include_once 'inc/classes/SoundImage.php'; include_once 'inc/classes/SoundTest.php'; include_once 'inc/classes/Technology.php'; include_once 'inc/classes/Category.php'; $objSound = new Sound(); $oSound = $objSound->getAllSoundByCategoryId($_SESSION['sessCategory']); $objTechnology = new Technology(1); $objSoundImage = new SoundImage(); $oSoundImage = $objSoundImage->getAllSoundImageBySoundId($oSound[0]->Id); $objSoundTest = new SoundTest(); $oSoundTest = $objSoundTest->getAllSoundTest($oSound[0]->Id); $objCategory = new Category($_SESSION['sessCategory']); $bgcolor = "#F40000"; // Coke red default if ($objCategory->BackgroundColor != "") { $bgcolor = $objCategory->BackgroundColor; } $background = $bgcolor . " none repeat scroll 0% 0%"; // this is used in single-product-template.php ?> <!DOCTYPE html> <html lang="en"> <head>
header("Location:soundimage_list.php?cat=" . $_REQUEST['cat'] . "&sound=" . $_REQUEST['sound']); exit; } else { // update $obj = new SoundImage($id); $obj->update(); $obj->handleFileUploads(); $obj->handleDropFileUploads($aDropFields[0], 'ImageFile'); // redirect to listing list header("Location:soundimage_list.php?cat=" . $_REQUEST['cat'] . "&sound=" . $_REQUEST['sound']); exit; } } else { if ($_REQUEST['mode'] == 'e') { //listing $objSoundImage = new SoundImage($id); $sound_id = $objSoundImage->SoundId; $image_file = $objSoundImage->ImageFile; $path = $objSoundImage->GetPath(); } else { if ($_REQUEST['mode'] == 'a') { $sound_id = $_REQUEST["sound"]; } } } include "includes/pagetemplate.php"; function PageContent() { global $id; global $sound_id; global $image_file;
function PageContent() { ?> <div class="layout center-flex"> <?php $aLabels = array(); $aLinks = array(); $aLabels[0] = 'Home'; $aLinks[0] = 'mainpage.php'; $aLabels[1] = 'Category List'; $aLinks[1] = 'category_list.php'; $aLabels[2] = 'Sound'; $aLinks[2] = ''; echo Helpers::CreateBreadCrumbs($aLabels, $aLinks); ?> <div class="bigbotspace flex-container space-between"> <p class="larger auto heading">Sound</p> <!-- <a href="category_admin.php" class="button_link"><button class="">Add New Sound</button></a> --> </div> </div> <div class="layout"> <table class="tablestyle" id="list_table"> <thead> <tr> <th>ID</th> <th>Overview Text</th> <th>Images</th> <th>Tests</th> <th class="mid">Actions</th> </tr> </thead> <tbody> <?php $objSound = new Sound(); $oSound = $objSound->GetAllSoundByCategoryId($_REQUEST['cat']); $objSoundImage = new SoundImage(); $objSoundTest = new SoundTest(); foreach ($oSound as $sound) { echo '<tr id="img_' . $sound->Id . '">' . PHP_EOL; echo '<td>' . $sound->Id . '</td>' . PHP_EOL; echo '<td>' . substr($sound->OverviewText, 0, 200) . '</td>' . PHP_EOL; echo '<td>(<a href="soundimage_list.php?cat=' . $_REQUEST['cat'] . '&sound=' . $sound->Id . '">' . $objSoundImage->getCountSoundImageBySoundId($sound->Id) . '</a>)</td>' . PHP_EOL; echo '<td>(<a href="soundtest_list.php?cat=' . $_REQUEST['cat'] . '&sound=' . $sound->Id . '">' . $objSoundTest->getCountSoundTestBySoundId($sound->Id) . '</a>)</td>' . PHP_EOL; echo '<td class="mid"><a href="sound_admin.php?cat=' . $_REQUEST['cat'] . '&id=' . $sound->Id . '"><img src="img/edit-icon.png" /></a></td>' . PHP_EOL; echo '</tr>' . PHP_EOL; } ?> </tbody> </table> </div> <!-- layout --> <?php }
$page_title = ""; $id = $_REQUEST['id']; // id required if ($id == "") { header("Location:mainpage.php"); exit; } // if form was submitted if ($_POST['commit'] == "Cancel") { $objSoundImage = new SoundImage($id); $objSound = new Sound($objSoundImage->SoundId); header("Location:soundimage_list.php?cat=" . $_REQUEST['cat'] . "&sound=" . $objSound->Id); exit; } if ($_POST['commit'] == "Delete Sound Image") { $objSoundImage = new SoundImage($id); $objSound = new Sound($objSoundImage->SoundId); $objSoundImage->Delete($id); header("Location:soundimage_list.php?cat=" . $_REQUEST['cat'] . "&sound=" . $objSound->Id); exit; } $objSoundImage = new SoundImage($id); $objSound = new Sound($objSoundImage->SoundId); include "includes/pagetemplate.php"; function PageContent() { global $objSoundImage; global $objSound; global $id; ?>
function PageContent() { global $objSound; ?> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> <script type="text/javascript"> $(document).ready(function() { // fix to preserve width of cells var fixHelper = function(e, ui) { ui.children().each(function() { $(this).width($(this).width()); }); return ui; }; var saveIndex = function(e, ui) { //alert("New position: " + ui.item.index()); //alert("Image Id: " + ui.item.attr("id")); id = ui.item.attr("id").replace("img_", ""); $.ajax({ url: 'soundimage_list.php', data: { dragsort: 1, idx: ui.item.index(), id: id }, type: 'POST', dataType: 'html', success: function (data) { //alert("done"); }, error: function (xhr, status) { alert('Sorry, there was a problem!'); } }); }; // end saveIndex $("#list_table tbody").sortable({ helper: fixHelper, stop: saveIndex }).disableSelection(); }); // end document.ready </script> <style> .icon-resize-vertical:hover { cursor:grab; } </style> <div class="layout center-flex"> <?php $aLabels = array(); $aLinks = array(); $aLabels[0] = 'Home'; $aLinks[0] = 'mainpage.php'; $aLabels[1] = 'Category List'; $aLinks[1] = 'category_list.php'; $aLabels[2] = 'Sound'; $aLinks[2] = 'sound_list.php&cat=' . $_REQUEST['cat']; $aLabels[3] = 'Sound Image List'; $aList[3] = ''; echo Helpers::CreateBreadCrumbs($aLabels, $aLinks); ?> <div class="bigbotspace flex-container space-between"> <p class="larger auto heading">Sound Images</p> <a href="soundimage_admin.php?cat=<?php echo $_REQUEST['cat']; ?> &sound=<?php echo $objSound->Id; ?> " class="button_link"><button class="">Add New Sound Image</button></a> </div> </div> <div class="layout"> <table class="tablestyle" id="list_table"> <thead> <tr> <th>ID</th> <th>Image</th> <th class="mid">Order</th> <th class="mid">Actions</th> </tr> </thead> <tbody> <?php $objSoundImage = new SoundImage(); $oSoundImage = $objSoundImage->getAllSoundImageBySoundId($objSound->Id); foreach ($oSoundImage as $soundimage) { echo '<tr id="img_' . $soundimage->Id . '">' . PHP_EOL; echo '<td>' . $soundimage->Id . '</td>' . PHP_EOL; echo '<td><img src="/' . $objSoundImage->GetPath() . $soundimage->ImageFile . '" style="max-width: 200px;" /></td>' . PHP_EOL; echo '<td class="mid"><img src="img/arrow-up-down.png" /></td>' . PHP_EOL; echo '<td class="mid"><a href="soundimage_admin.php?cat=' . $_REQUEST['cat'] . '&sound=' . $_REQUEST['sound'] . '&id=' . $soundimage->Id . '"><img src="img/edit-icon.png" /></a> <a href="soundimage_delete.php?cat=' . $_REQUEST['cat'] . '&sound=' . $_REQUEST['sound'] . '&id=' . $soundimage->Id . '"><img src="img/delete-icon.png" /></a></td>' . PHP_EOL; echo '</tr>' . PHP_EOL; } ?> </tbody> </table> </div> <!-- layout --> <?php }