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> <meta charset="UTF-8"> <title>Coke Cooler</title>
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: 'soundtest_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 Test List'; $aList[3] = ''; echo Helpers::CreateBreadCrumbs($aLabels, $aLinks); ?> <div class="bigbotspace flex-container space-between"> <p class="larger auto heading">Sound Tests</p> <a href="soundtest_admin.php?cat=<?php echo $_REQUEST['cat']; ?> &sound=<?php echo $objSound->Id; ?> " class="button_link"><button class="">Add New Sound Test</button></a> </div> </div> <div class="layout"> <table class="tablestyle" id="list_table"> <thead> <tr> <th>ID</th> <th>Image 1</th> <th>Image 2</th> <th>Image 3</th> <th class="mid">Order</th> <th class="mid">Actions</th> </tr> </thead> <tbody> <?php $objSoundTest = new SoundTest(); $oSoundTest = $objSoundTest->getAllSoundTestBySoundId($objSound->Id); foreach ($oSoundTest as $soundtest) { echo '<tr id="img_' . $soundtest->Id . '">' . PHP_EOL; echo '<td>' . $soundtest->Id . '</td>' . PHP_EOL; echo '<td><img src="/' . $objSoundTest->GetPath() . $soundtest->ImageUrl1 . '" style="max-width: 200px;" /></td>' . PHP_EOL; echo '<td><img src="/' . $objSoundTest->GetPath() . $soundtest->ImageUrl2 . '" style="max-width: 200px;" /></td>' . PHP_EOL; echo '<td><img src="/' . $objSoundTest->GetPath() . $soundtest->ImageUrl3 . '" 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="soundtest_admin.php?cat=' . $_REQUEST['cat'] . '&sound=' . $_REQUEST['sound'] . '&id=' . $soundtest->Id . '"><img src="img/edit-icon.png" /></a> <a href="soundtest_delete.php?cat=' . $_REQUEST['cat'] . '&sound=' . $_REQUEST['sound'] . '&id=' . $soundtest->Id . '"><img src="img/delete-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") { $objSoundTest = new SoundTest($id); $objSound = new Sound($objSoundTest->SoundId); header("Location:soundtest_list.php?cat=" . $_REQUEST['cat'] . "&sound=" . $objSound->Id); exit; } if ($_POST['commit'] == "Delete Sound Test") { $objSoundTest = new SoundTest($id); $objSound = new Sound($objSoundTest->SoundId); $objSoundTest->Delete($id); header("Location:soundtest_list.php?cat=" . $_REQUEST['cat'] . "&sound=" . $objSound->Id); exit; } $objSoundTest = new SoundTest($id); $objSound = new Sound($objSoundTest->SoundId); include "includes/pagetemplate.php"; function PageContent() { global $objSoundTest; global $objSound; global $id; ?>
$obj->Text1 = $_REQUEST["text1"]; $obj->Text2 = $_REQUEST["text2"]; $obj->Text3 = $_REQUEST["text3"]; $obj->update(); $obj->handleFileUploads(); $obj->handleDropFileUploads($aDropFields[0], 'ImageUrl1'); $obj->handleDropFileUploads($aDropFields[1], 'ImageUrl2'); $obj->handleDropFileUploads($aDropFields[2], 'ImageUrl3'); // redirect to listing list header("Location:soundtest_list.php?cat=" . $_REQUEST['cat'] . "&sound=" . $_REQUEST['sound']); exit; } } else { if ($_REQUEST['mode'] == 'e') { //listing $objSoundTest = new SoundTest($id); $sound_id = $objSoundTest->SoundId; $sound_test_description = $objSoundTest->SoundTestDescription; $sound_url1 = $objSoundTest->SoundUrl1; $sound_url2 = $objSoundTest->SoundUrl2; $sound_url3 = $objSoundTest->SoundUrl3; $image_url1 = $objSoundTest->ImageUrl1; $image_url2 = $objSoundTest->ImageUrl2; $image_url3 = $objSoundTest->ImageUrl3; $text1 = $objSoundTest->Text1; $text2 = $objSoundTest->Text2; $text3 = $objSoundTest->Text3; $path = $objSoundTest->GetPath(); } else { if ($_REQUEST['mode'] == 'a') { $sound_id = $_REQUEST["sound"];
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 }