예제 #1
0
파일: view.php 프로젝트: natgeo/kids-myshot
echo html::anchor(Helper_Photos::get_photo_url(Helper_Photos::get_next_link($photo, $order, FALSE)), html::image(Helper_Photos::get($photo, 'medium'), array('alt' => $photo->name)));
?>
					</div>
				</div>
			</div>
			<div class="cap">
				<div class="text">
					<p>Photo by: <?php 
echo "<a href=\"/" . Helper_Account::get_public_account_url($user) . "\">" . substr($user->display_name, 0, 7) . (strlen($user->display_name) > 7 ? "&#8230;" : "") . "</a>";
?>
</a></p>                  
				</div>
				
				<div class="controls">
					<p>Photo <?php 
echo Helper_Arr::get_count_at_value($photo, $order);
?>
 of <?php 
echo count($order);
?>
</p>
					<?php 
echo Helper_Photos::get_previous_link($photo, $order);
?>
					<?php 
echo Helper_Photos::get_next_link($photo, $order);
?>
				</div>
				<div class="slider_btn"><a href="#" data-photoid="<?php 
echo $photo->id;
?>
예제 #2
0
파일: tags.php 프로젝트: natgeo/kids-myshot
 public function action_cloud()
 {
     $this->auto_render = FALSE;
     $json = array();
     $most_used_tags = DB::select('tags.id', array('COUNT("photos_tags.tag_id")', 'num'))->from('photos_tags')->join('tags')->on('tags.id', '=', 'photos_tags.tag_id')->group_by('photos_tags.tag_id')->order_by('num', 'DESC')->limit(30);
     $result = $most_used_tags->execute();
     $tag_ids = array();
     foreach ($result as $row) {
         $tag_ids[] = $row['id'];
     }
     $tags = ORM::factory('tag')->limit(30)->where('id', 'IN', $tag_ids)->find_all();
     $total_tags = 0;
     $total_images_with_tags = 0;
     foreach ($tags as $key => $tag) {
         $count = $tag->photos->where('moderation_status_id', '=', '2')->count_all();
         if ($count > 0) {
             $total_tags += 1;
             $total_images_with_tags += $count;
             array_push($json, array('id' => $tag->id, 'tag' => $tag->name, 'count' => $count));
         }
     }
     $rnd = Helper_Arr::shuffle_assoc($json);
     $this->cloud_classes($rnd, $total_tags, $total_images_with_tags);
     echo json_encode($rnd);
 }
예제 #3
0
 public static function get_previous_link($photo, array $order_array, $link = TRUE)
 {
     if (in_array($photo->id, $order_array)) {
         Helper_Arr::set_pointer($photo->id, $order_array);
         if (!prev($order_array)) {
             end($order_array);
         }
         $prev = current($order_array);
     }
     if ($link === TRUE) {
         $previous_photo = ORM::factory('photo')->find($prev);
         $ret = html::anchor(Helper_Photos::get_photo_url($previous_photo), 'Previous', array('class' => 'previous'));
     } else {
         $ret = ORM::factory('photo')->find($prev);
     }
     return $ret;
 }