Пример #1
0
function display_page_content()
{
    $testimonials = Testimonials::FindAll();
    ?>
	
	<div id="edit-header" class="testimonialnav">
		<div class="nav-left column">
    		<h1>Choose a Testimonial to Edit</h1>
		</div>
		<div class="nav-right column">
            <a href="<?php 
    echo get_link("admin/edit_testimonial/add");
    ?>
" class="hcd_button">Add a new Testimonial</a>
		</div>
		<div class="clearleft"></div>
	</div>
	
	<p class="announce">Testimonials are stored for insertion into content throughout the site. Depending on your site, there might be a template or two that displays one at random. All testimonials are displayed using a &ldquo;blockquote&rdquo; style. </p>
	
<?php 
    if (count($testimonials) > 0) {
        ?>
			
	<div id="table-header" class="testimonials">
		<strong class="item-link">Testimonial Name</strong>
		<span class="item-path">Content snippet</span>
		<span class="item-revised">Attribution</span>
		<span>Featured?</span>
	</div>
	
	<ul id="listitems" class="managelist testimoniallist">
		<?php 
        foreach ($testimonials as $thetest) {
            $this_feature = $thetest->is_featured ? 'Yes' : '';
            echo "\t\t<li>\n\t\t\t<span class=\"item-link\"><a href=\"" . get_link("/admin/edit_testimonial/{$thetest->id}") . "\">" . $thetest->get_title() . " <small>EDIT</small></a></span>\n\t\t\t<span class=\"item-path\">" . $thetest->get_excerpt(48, " ") . "</span>\n\t\t\t<span class=\"item-revised\">" . $thetest->attribution . "</span>\n\t\t\t<span>" . $this_feature . "</span>\n\t\t</li>\n";
        }
        ?>
	
	</ul>
<?php 
    } else {
        echo "\t\t<h3 class=\"empty-list\">There are no testimonials to edit. <a class=\"short\" href=\"" . get_link("admin/edit_testimonial/add") . "\">Add one if you like</a>.</h3>";
    }
}
<!-- Insert a Testimonial -->
<div id="test_insert" class="dropslide" style="display: none; ">
	<p><span class="hint">Click the icons to insert the testimonial code for it in the edit window above. Be sure your cursor is where you want it first. </span></p>

<?php 
$testimonials = Testimonials::FindAll();
if (is_array($testimonials) and count($testimonials) > 0) {
    ?>

	<table id="images" class="dropdown" cellpadding="0" cellspacing="0" border="0" width="98%">
		<thead>
			<th>Name</th>
			<th>Content Snippet</th>
			<th colspan="3">Design Options</th>
		</thead>
		<tbody>
<?php 
    foreach ($testimonials as $test) {
        ?>
		    <tr>
				<td><strong><a href="#" onclick="insertDocument('testimonial:<?php 
        echo $test->slug;
        ?>
', '{{', '}}'); return false;"><?php 
        $test->the_title();
        ?>
</strong></a></td>
				<td><?php 
        $test->the_excerpt(72, " ");
        ?>
				<td><a href="#" onclick="insertDocument('testimonial:<?php