Permalink
Browse files

views that go along with the example use calls

  • Loading branch information...
1 parent 0fb9f4c commit 37c8cf3ad33f59910da43cafb49108b3e69832fb @randomecho committed Oct 18, 2012
@@ -0,0 +1 @@
+<?php echo $info;
@@ -0,0 +1,7 @@
+<h1>Petfinder via Kohana</h1>
+<p>
+This module allows an animal shelter to display their pets listed on the <a href="http://petfinder.com/" title="database of animals who need homes">Petfinder</a> database through their own website (built on Kohana 3.2).
+</p>
+<p>
+Created by <a href="http://randomecho.com/">Soon Van</a>.
+</p>
@@ -0,0 +1,15 @@
+<div class="petinfo">
+<ul>
+<?php
+
+if (isset($info))
+{
+ for ($i = 0, $n = count($info); $i < $n; $i++)
+ {
+ echo '<li>'.$info[$i].'</li>';
+ }
+}
+
+?>
+</ul>
+</div>
@@ -1,62 +0,0 @@
-<?php defined('SYSPATH') or die('No direct script access.');
-
-$output = '';
-
-$output .= '<h1>Our list of adoptable pets</h1>';
-
-$count_pets = count($pet);
-
-for ($i = 0; $i < $count_pets; $i++)
-{
- $current_pet = $pet[$i];
-
- $output .= '<div class="petinfo">';
- $output .= HTML::anchor($url_details.$current_pet->id.'-'.URL::title($current_pet->name), '<h3>'.$current_pet->name.'</h3>');
-
- if (isset($current_pet->media->photos) AND count($current_pet->media->photos) > 0)
- $thumbnail = $current_pet->media->photos->photo[1];
- else
- $thumbnail = Kohana::$config->load('petfinder.image_none');
-
- $output .= '<div class="petfinderThumb">';
- $output .= HTML::anchor($url_details.$current_pet->id.'-'.URL::title($current_pet->name), HTML::image($thumbnail));
- $output .= '</div>';
-
- $output .= '<div class="petfinderStats petfinderSnippet">';
- $output .= '<dl class="petfinderBio">';
- $output .= '<dt class="petfinderBioLabel">Age</dt><dd class="petfinderBioData">'.$current_pet->age.'</dd>';
-
- if (array_key_exists( (string) $current_pet->sex, $legend['legend_sex']))
- $output .= '<dt class="petfinderBioLabel">Sex</dt><dd class="petfinderBioData">'.$legend['legend_sex'][ (string) $current_pet->sex].'</dd>';
-
- $output .= '<dt class="petfinderBioLabel">Breed</dt><dd class="petfinderBioData">';
-
- $count_breeds = count($current_pet->breeds->breed);
-
- if ($count_breeds == 1)
- {
- $output .= $current_pet->breeds->breed;
- }
- else
- {
- $breeds = '';
-
- foreach ($current_pet->breeds->breed as $pet_breed)
- {
- $breeds .= $pet_breed.' and ';
- }
-
- $output .= substr($breeds, 0, strrpos($breeds, ' and'));
- }
-
- $output .= ($current_pet->mix == 'yes') ? ' mix' : '';
-
- $output .= '</dd>';
- $output .= '</dl>';
- $output .= '</div>';
-
- $output .= '</div>';
-}
-
-echo $output;
-
@@ -1,9 +0,0 @@
-<?php defined('SYSPATH') or die('No direct script access.');
-
-$output = '';
-
-$output .= '<h1>'.$error_heading.'</h1>';
-$output .= '<p>'.$error_message.'</p>';
-
-echo $output;
-
@@ -0,0 +1,19 @@
+<div class="petinfo">
+<h1><?php echo $info['name'] ?></h1>
+<div class="petfinderStats">
+<dl class="petfinderBio">
+<dt class="petfinderBioLabel">Petfinder Shelter ID</dt><dd class="petfinderBioData"><?php echo $info['id'] ?></dd>
+<dt class="petfinderBioLabel">Email</dt><dd class="petfinderBioData"><?php echo $info['email'] ?></dd>
+<dt class="petfinderBioLabel">Address 1</dt><dd class="petfinderBioData"><?php echo $info['address1'] ?></dd>
+<dt class="petfinderBioLabel">Address 2</dt><dd class="petfinderBioData"><?php echo $info['address2'] ?></dd>
+<dt class="petfinderBioLabel">City</dt><dd class="petfinderBioData"><?php echo $info['city'] ?></dd>
+<dt class="petfinderBioLabel">State</dt><dd class="petfinderBioData"><?php echo $info['state'] ?></dd>
+<dt class="petfinderBioLabel">Zip</dt><dd class="petfinderBioData"><?php echo $info['zip'] ?></dd>
+<dt class="petfinderBioLabel">Country</dt><dd class="petfinderBioData"><?php echo $info['country'] ?></dd>
+<dt class="petfinderBioLabel">Phone</dt><dd class="petfinderBioData"><?php echo $info['phone'] ?></dd>
+<dt class="petfinderBioLabel">Fax</dt><dd class="petfinderBioData"><?php echo $info['fax'] ?></dd>
+<dt class="petfinderBioLabel">Longitude</dt><dd class="petfinderBioData"><?php echo $info['longitude'] ?></dd>
+<dt class="petfinderBioLabel">Latitude</dt><dd class="petfinderBioData"><?php echo $info['latitude'] ?></dd>
+</dl>
+</div>
+</div>
@@ -1,85 +1,80 @@
-<?php defined('SYSPATH') or die('No direct script access.');
+<div class="petinfo">
+<h1><?php echo $info['name'] ?></h1>
+<?php
-$output = '';
-
-$current_pet = $pet;
-
-$output .= '<div class="petinfo">';
-$output .= '<h1>'.$current_pet->name.$status_heading.'</h1>';
-
-if (isset($current_pet->media->photos) AND count($current_pet->media->photos) > 0)
- $thumbnail = $current_pet->media->photos->photo[0];
-else
- $thumbnail = Kohana::$config->load('petfinder.image_none');
-
-$output .= HTML::image($thumbnail, array('title' => $current_pet->name));
-
-$output .= '<div class="petfinderStats">';
-
-$output .= '<div class="petfinderInfo">';
-$output .= $current_pet->description;
-$output .= '</div>';
-
-$output .= '<dl class="petfinderBio">';
-$output .= '<dt class="petfinderBioLabel">Petfinder ID</dt><dd class="petfinderBioData">'.$current_pet->id.'</dd>';
-$output .= '<dt class="petfinderBioLabel">Age</dt><dd class="petfinderBioData">'.$current_pet->age.'</dd>';
-$output .= '<dt class="petfinderBioLabel">Sex</dt><dd class="petfinderBioData">'.$legend_sex.'</dd>';
-
-$output .= '<dt class="petfinderBioLabel">Breed</dt><dd class="petfinderBioData">';
-
-$count_breeds = count($current_pet->breeds->breed);
+if (isset($info['media'][1]['x']))
+{
+ $thumbnail = $info['media'][1]['x'];
+ echo HTML::image($thumbnail, array('alt' => $info['name']));
+}
-if ($count_breeds == 1)
+?>
+<div class="petfinderStats">
+<div class="petfinderInfo">
+<?php echo $info['description'] ?>
+</div>
+<dl class="petfinderBio">
+<dt class="petfinderBioLabel">Petfinder ID</dt><dd class="petfinderBioData"><?php echo $info['id'] ?></dd>
+<dt class="petfinderBioLabel">Status</dt><dd class="petfinderBioData"><?php echo $info['status'] ?></dd>
+<dt class="petfinderBioLabel">Age</dt><dd class="petfinderBioData"><?php echo $info['age'] ?></dd>
+<dt class="petfinderBioLabel">Sex</dt><dd class="petfinderBioData"><?php echo $info['sex'] ?></dd>
+<dt class="petfinderBioLabel">Breed</dt><dd class="petfinderBioData">
+<?php
+
+if (Arr::is_array($info['breed']))
{
- $output .= $current_pet->breeds->breed;
+ echo implode(' and ', $info['breed']);
}
else
{
- $breeds = '';
-
- foreach ($current_pet->breeds->breed as $pet_breed)
- {
- $breeds .= $pet_breed.' and ';
- }
-
- $output .= substr($breeds, 0, strrpos($breeds, ' and'));
+ echo $info['breed'];
}
-$output .= ($current_pet->mix == 'yes') ? ' mix' : '';
-
-$output .= '</dd>';
+?>
+</dd>
+<?php
-if (isset($options))
+if (isset($info['options']))
{
- $output .= '<dt class="petfinderBioLabel">Details</dt><dd class="petfinderBioData">';
- $output .= '<ul>';
-
- foreach ($options as $pet_data)
+?>
+ <dt class="petfinderBioLabel">Details</dt><dd class="petfinderBioData">
+ <ul>
+<?php
+ $option_count = count($info['options']);
+ for ($i = 0; $i < $option_count; $i++)
{
- $output .= '<li>'.$pet_data.'</li>';
+ echo '<li>'.$info['options'][$i].'</li>';
}
-
- $output .= '</ul>';
- $output .= '</dd>';
+?>
+ </ul>
+ </dd>
+<?php
}
-if ($current_pet->status == 'A')
+if ($info['status'] == 'A')
{
- $output .= '<dt class="petfinderBioLabel">Contact</dt>';
+?>
+ <dt class="petfinderBioLabel">Contact</dt>
+<?php
+ $name_contact = ($info['contact_name'] != '') ? $info['contact_name'] : 'Contact us';
- $name_contact = ($current_pet->contact->name != '') ? $current_pet->contact->name : 'Contact us';
-
- if ($current_pet->contact->email != '')
- $output .= '<dd class="petfinderBioData">'.HTML::mailto($current_pet->contact->email.'?subject=Petfinder: '.$current_pet->name, $name_contact).'</dd>';
+ if ($info['contact_email'] != '')
+ {
+ $contact_method = HTML::mailto($info['contact_email'].'?subject=Petfinder: '.$info['name'], $name_contact);
+ }
else
- $output .= '<dd class="petfinderBioData">'.HTML::anchor('http://www.petfinder.com/petdetail/'.$current_pet->id, 'See contact details on Petfinder').'</dd>';
-}
-
-$output .= '</dl>';
-$output .= '</div>';
-$output .= '</div>';
-
-$output .= '<p>'.HTML::anchor($url_main, 'Back to main list of pets').'</p>';
-
-echo $output;
+ {
+ $contact_method = HTML::anchor('http://www.petfinder.com/petdetail/'.$info['id'], 'See contact details on Petfinder');
+ }
+ ?>
+ <dd class="petfinderBioData"><?php echo $contact_method ?></dd>
+ <?php
+}
+?>
+ <dt class="petfinderBioLabel">Shelter Contact</dt>
+ <dd class="petfinderBioData">Address: <?php echo $info['contact_address1'] ?> <?php echo $info['contact_address2'] ?> <?php echo $info['contact_city'] ?> <?php echo $info['contact_state'] ?> <?php echo $info['contact_zip'] ?></dd>
+ <dd class="petfinderBioData">Phone: <?php echo $info['contact_phone'] ?>, Fax: <?php echo $info['contact_fax'] ?></dd>
+</dl>
+</div>
+</div>

0 comments on commit 37c8cf3

Please sign in to comment.