ruạṛ
<?php /** * Management of testimonials * @version 0.10 * @author Robert Urquhart <programmer@activatedesign.co.nz> * @package WEP-CMS * @since braziers.co.nz */ session_start(); require_once $_SERVER['DOCUMENT_ROOT'].'/admin/scripts-includes/universal.php'; require_once $_SERVER['DOCUMENT_ROOT'].'/admin/scripts-includes/display.php'; $connID = connect_to_db(); /** * define variables to be passed to header function * @var string $current section of site for navigation menu highlighting * @var string $title page title for browser * @var string $keywords meta keywords * @var string $keywords meta description */ $current = 'testimonials'; $title = 'Administration Panel'; $keywords = ''; $description = ''; /** * buffer then output page */ ob_start(); head($current,$title,$keywords,$description); this_page(); footer(); ob_end_flush(); /** * clean up and exit script */ exit; /** * function to display content specific to this page */ function this_page() { $error = isset($_SESSION['passback']); $testimonials = mysql_query("select * from testimonials order by position "); echo mysql_error(); $types = new options_list(TESTIMONIALS_LIST); $maxpos = select_one('testimonials','max(position)') + 10; ?> <h1>Testimonials</h1> <?php //* ?> <form name="add_testimonial" id="add_testimonial" action="processes/process-testimonial-new.php" method="post" enctype="multipart/form-data" class="add"> <p class="center"> <?php if(TESTIMONIALS_LIST): ?> <label for="type_id">New</label> <select name="type_id" id="type_id"> <?php echo $types->html_select_options($_SESSION['passback']['type_id'],false); ?> </select> <label for="position"> testimonial at position </label> <?php else: ?> <label for="position">New testimonial at position </label> <?php endif; ?> <input name="position" id="position" type="text" size="3" placeholder="<?php echo $maxpos; ?>" value="<?php echo ($error) ? $_SESSION['passback']['position'] : ''; ?>" /> <input type="submit" name="add" value="Add testimonial" /> </p> </form> <?php // */ ?> <?php if($error){unset($_SESSION['passback']);} if(!$testimonials || mysql_num_rows($testimonials) < 1) { ?> <p class="center">No testimonials found.</p> <p> </p> <?php return; } //end if !testimonialss ?> <form action="processes/process-testimonial-ordering-bulk.php" method="post" enctype="multipart/form-data"> <table class="control_panel"> <thead> <tr> <th class="pad"> </th> <?php if(TESTIMONIALS_LIST): ?> <th class="username">Type</th> <?php endif; ?> <th class="left">From</th> <th class="control">Active</th> <th class="control">Position<br /><input type="submit" value="Update" class="update" /></th> <th class="control">Edit</th> <th class="control">Delete</th> <th class="pad"> </th> </tr> </thead> <tfoot><tr><td> </td><td colspan="<?php echo (TESTIMONIALS_LIST) ? '6' : '5'; ?>" class="left">Click positions to edit then click Update button to save.<br /> Click Active icon to toggle testimonial visibility in pages.<br /> Click Delete icon then confirm to delete a testimonial permanently.</td><td> </td></tfoot> <?php while($row = mysql_fetch_assoc($testimonials)) { $t = new testimonial(); $t->load_from_data($row); $id = $row['testimonial_id']; ?> <tr> <td> </td> <?php if(TESTIMONIALS_LIST): ?> <td valign="top"><?php echo $t->type(); ?></td> <?php endif; ?> <td class="left" valign="top"><?php echo $t->witness; ?></td> <td valign="top"><a class="toggle" href="processes/process-switch.php?f=active&testimonial=<?php echo $id; ?>"><?php echo onOrOff($t->active); ?></a></td> <td valign="top"><input name="positions[<?php echo $id; ?>]" type="text" size="2" maxlength="3" class="ordering inline-editing" value="<?php echo $t->position; ?>" /></td> <td valign="top"><a href="edit-testimonial.php?testimonial=<?php echo $id; ?>">Edit</a></td> <td valign="top"><a href="processes/process-testimonial-delete.php?testimonial=<?php echo $id; ?>" onClick="if(confirm(\'Delete testimonial from <?php echo $t->witness; ?>?\')){return true}else{return false}" class="delete"><img src="images/img-del.png" alt="Delete" /></a></td> <td> </td> </tr> <?php } ?> </tbody> </table> </form> <p> </p> <?php } ?>
cải xoăn