Beispiel #1
0
 public function delete($id = null)
 {
     if (!$this->loaded()) {
         $this->find($id);
     }
     //remove all comment logs for this comment type: comment, comment approved, comment received
     $site = Helper_Game::getSite();
     $gameCommentId = $site->getEvent(Helper_Game::COMMENT)->id;
     $gameCommentApprovedId = $site->getEvent(Helper_Game::COMMENT_APPROVED)->id;
     $gameCommentReceivedId = $site->getEvent(Helper_Game::COMMENT_RECEIVED)->id;
     $infos = ORM::factory("Game_LogInfo")->and_where_open()->where("name", "like", "comment")->or_where("name", "like", "comment_id")->and_where_close()->and_where_open()->where("data", "=", $this->id)->or_where("data", "like", $this->comment)->and_where_close()->find_all();
     foreach ($infos as $info) {
         $log = $info->_eventLog;
         switch ($log->event_id) {
             case $gameCommentId:
             case $gameCommentReceivedId:
                 if ($log->data->comment == $this->id) {
                     $log->delete();
                 }
                 break;
             case $gameCommentApprovedId:
                 if (empty($log->data->comment_id) && $log->item->item_id == $this->photo->id) {
                     $log->delete();
                 }
                 if (!empty($log->data->comment_id) && $log->data->comment_id == $this->id) {
                     $log->delete();
                 }
                 break;
             default:
                 //do nothing
                 break;
         }
     }
     parent::delete($id);
 }
Beispiel #2
0
 public function action_index()
 {
     $site = Helper_Game::getSite();
     $this->template->content = View::factory("trophy/index");
     $this->template->content->awards = Helper_Game::alphebetizeHonors($site->awards);
     $this->template->content->badges = Helper_Game::alphebetizeHonors($site->badges);
     $this->template->sidebar = Widget::factory()->add(Helper_Default::sidebar());
 }
Beispiel #3
0
 public function action_preview($id)
 {
     $id = filter_var($id, FILTER_SANITIZE_NUMBER_INT);
     $homeSpot = ORM::factory("homespot", $id);
     if (!$homeSpot->loaded()) {
         Message::set(Message::ERROR, "Sorry, that could not be found.");
         $this->request->redirect("admin/home/create");
         return;
     }
     $this->template->title = 'Share Your Photos - National Geographic Kids My Shot Community';
     $this->template->scripts = array('public/js/vendor/jquery.jcarousel.js', 'public/js/categories/slideshow.js', 'public/js/home/home.js');
     $awards = array();
     $badges = array();
     $events = ORM::factory('game_EventLog')->where('event_id', '=', Helper_Game::getSite()->getEvent(Model_Game_Site::HONOR_GIVEN))->order_by('time_stamp', 'DESC')->limit($this->sampleSize)->find_all();
     foreach ($events as $event) {
         $eventUser = ORM::factory('user', $event->user->user_id);
         if ($eventUser->id) {
             if ($event->data->type == "game_Badge") {
                 $obj = new stdClass();
                 $obj->data = $event->data;
                 $obj->honor = ORM::factory($event->data->type, $event->data->honor_id);
                 $obj->user = ORM::factory('user', $event->user->user_id);
                 $badges[] = $obj;
             }
         }
         if (count($badges) >= $this->maxBadges) {
             break;
         }
     }
     if (count($awards) < $this->maxAwards) {
         $aevents = ORM::factory('game_EventLog')->where('event_id', '=', Helper_Game::getSite()->getEvent(Helper_Game::AWARD_GIVEN)->id)->order_by('time_stamp', 'DESC')->limit($this->sampleSize)->find_all();
         foreach ($aevents as $event) {
             $obj = new stdClass();
             $obj->data = $event->data;
             $obj->honor = ORM::factory($event->data->type, $event->data->honor_id);
             $obj->user = ORM::factory('user', $event->user->user_id);
             $obj->photo = ORM::factory('photo', $event->item->item_id);
             $awards[] = $obj;
             if (count($awards) >= $this->maxAwards) {
                 break;
             }
         }
     }
     $honors = array_merge($awards, $badges);
     if (count($honors) == 0) {
         $honors = false;
     }
     $slider = Model_DLSliderGroup::getCurrentSlider();
     if ($slider) {
         $this->template->top = View::factory("home/slider");
         $this->template->top->slider = $slider;
     }
     $this->template->content = View::factory('home/index');
     $this->template->content->set(array('user' => $this->user, 'recently_added' => Reel_More::factory(ORM::factory('photo')->order_by('created', 'desc')), 'top_rated' => Reel_More::factory(Helper_Photos::get_top_rated()), 'honors' => $honors, 'potd' => Model_DailyPhoto::todaysPhoto(), 'homeSpot' => $homeSpot, 'homeSpotEditLink' => HTML::anchor("admin/home/edit/{$homeSpot->id}", "Edit")));
     $this->template->sidebar = Widget::factory()->add(Helper_Default::sidebar());
 }
Beispiel #4
0
 public function action_feed()
 {
     if ($this->user->id) {
         $feed = Helper_Game::getLiveFeed($this->user->id);
         $views = Controller_Profile::feedViews($feed);
         foreach ($views as $view) {
             echo new Element("div", $view->render(), array("class" => "live-item"));
         }
         $this->user->lastlive = Date('Y-m-d H:i:s');
         $this->user->save();
     } else {
         echo new Element("div");
     }
 }
Beispiel #5
0
 /**
  * View the homepage.
  *
  * @return void
  * @author Merrick Christensen
  */
 public function action_index()
 {
     $this->template->title = 'Share Your Photos - National Geographic Kids My Shot Community';
     $this->template->scripts = array('public/js/vendor/jquery.jcarousel.js', 'public/js/categories/slideshow.js', 'public/js/home/home.js');
     $awards = array();
     $badges = array();
     $events = ORM::factory('game_EventLog')->where('event_id', '=', Helper_Game::getSite()->getEvent(Model_Game_Site::HONOR_GIVEN))->order_by('time_stamp', 'DESC')->limit($this->sampleSize)->find_all();
     foreach ($events as $event) {
         $eventUser = ORM::factory('user', $event->user->user_id);
         if ($eventUser->id) {
             if ($event->data->type == "game_Badge") {
                 $obj = new stdClass();
                 $obj->data = $event->data;
                 $obj->honor = ORM::factory($event->data->type, $event->data->honor_id);
                 $obj->user = ORM::factory('user', $event->user->user_id);
                 $badges[] = $obj;
             }
         }
         if (count($badges) >= $this->maxBadges) {
             break;
         }
     }
     if (count($awards) < $this->maxAwards) {
         $aevents = ORM::factory('game_EventLog')->where('event_id', '=', Helper_Game::getSite()->getEvent(Helper_Game::AWARD_GIVEN)->id)->order_by('time_stamp', 'DESC')->limit($this->sampleSize)->find_all();
         foreach ($aevents as $event) {
             $obj = new stdClass();
             $obj->data = $event->data;
             $obj->honor = ORM::factory($event->data->type, $event->data->honor_id);
             $obj->user = ORM::factory('user', $event->user->user_id);
             $obj->photo = ORM::factory('photo', $event->item->item_id);
             $awards[] = $obj;
             if (count($awards) >= $this->maxAwards) {
                 break;
             }
         }
     }
     $honors = array_merge($awards, $badges);
     if (count($honors) == 0) {
         $honors = false;
     }
     $slider = Model_DLSliderGroup::getCurrentSlider();
     if ($slider) {
         $this->template->top = View::factory("home/slider");
         $this->template->top->slider = $slider;
     }
     $this->template->content = View::factory('home/index');
     $this->template->content->set(array('user' => $this->user, 'recently_added' => Reel_More::factory(ORM::factory('photo')->order_by('created', 'desc')), 'top_rated' => Reel_More::factory(Helper_Photos::get_top_rated()), 'honors' => $honors, 'potd' => Model_DailyPhoto::todaysPhoto(), 'homeSpot' => Model_Homespot::getCurrent()));
     $this->template->sidebar = Widget::factory()->add(Helper_Default::sidebar());
 }
Beispiel #6
0
 public function __construct()
 {
     parent::__construct();
     $user = Helper_Widget::getBestUser();
     $loggedInUser = Auth::instance()->get_user();
     if ($user->loaded()) {
         $gameUser = Helper_Game::getUser($user->id);
         $this->template->following = $gameUser->following;
         if ($user->id === $loggedInUser->id) {
             $this->template->matchingUsers = true;
             $this->template->loggedInUser = new stdClass();
             $this->template->loggedInUser->id = $loggedInUser->id;
         }
     }
 }
Beispiel #7
0
 public function action_approve($avatar_id)
 {
     $avatar = ORM::factory('avatar')->where('id', '=', $avatar_id)->find();
     // Approve it
     $avatar->moderation_status_id = 2;
     $avatar->save();
     // Upload to the CDN
     $this->upload_all($avatar);
     // Alert the user
     $this->send_approval_email($avatar->user);
     Helper_Game::logEvent(Helper_Game::AVATAR_APPROVED, $avatar->user->id, $avatar->id);
     // Display thank you
     Message::set(Message::SUCCESS, 'Avatar successfully approved.');
     Request::instance()->redirect('admin/avatars');
 }
Beispiel #8
0
 /**
  * Add comment on photo.
  *
  * @param string $photo_id 
  * @return void
  * @author Merrick Christensen
  */
 public function action_on($photo_id)
 {
     if (Helper_Account::is_approved()) {
         $comment = ORM::factory('comment');
         $comment->user_id = $this->user->id;
         $comment->comment = Arr::get($_POST, 'comment');
         $comment->photo_id = $photo_id;
         $comment->created = Date('Y-m-d H:i:s');
         if ($comment->check()) {
             $comment->save();
             Message::set(Message::SUCCESS, 'You have successfully commented on this photo! It is currently waiting approval.');
             Helper_Game::logEvent(Helper_Game::COMMENT, $this->user->id, array("comment" => $comment->id, "photo" => $photo_id));
             Request::instance()->redirect('photos/view/' . $photo_id);
         } else {
             Message::set(Message::ERROR, $comment->validate()->errors('comment'));
         }
     }
 }
Beispiel #9
0
 public function action_delete()
 {
     $this->auto_render = false;
     $send_email = $_POST['sendEmail'];
     $photo_id = $_POST['photoID'];
     $photo = ORM::factory('photo')->where('id', '=', $photo_id)->find();
     $user = ORM::factory('user')->where('id', '=', $photo->user_id)->find();
     if (Helper_Account::is_admin()) {
         $photo = ORM::factory('photo')->where('id', '=', $photo_id)->find();
     } else {
         $photo = ORM::factory('photo')->where('id', '=', $photo_id)->where('user_id', '=', $this->user->id)->find();
     }
     if ($photo->loaded()) {
         if (Helper_Account::is_admin()) {
             if ($send_email != 'undefined' && $send_email == 'true') {
                 $reason = $_POST['emailComment'];
                 $additional_text = $_POST['otherText'];
                 if ($reason == 'other') {
                     $additional_text = $_POST['otherText'];
                 } else {
                     $additional_text = $reason;
                 }
                 $email_text = Helper_SendEmail::generate_email($photo->user_id, 'photo', $additional_text);
                 //creative variable naming ftw!
                 $post_office = Library_Notification::factory();
                 $letter_body = $email_text;
                 $letter = Library_Notification::new_message()->setSubject('NG Kids My Shot - Photo removed!')->setFrom(Kohana::config('email.from'))->setTo(array($user->email => 'Guardian of ' . $user->display_name))->setBody($letter_body, 'text/html');
                 $post_office->add_message($letter);
                 $post_office->send_messages();
             }
         } else {
             $email_text = View::factory("email/userremoved")->set("user", $user)->set("photo", $photo);
             $post_office = Library_Notification::factory();
             $letter_body = $email_text->render();
             $letter = Library_Notification::new_message()->setSubject('NG Kids My Shot - Photo removed by user')->setFrom(Kohana::config('email.from'))->setTo(Kohana::config('email.ng_staff'))->setBody($letter_body, 'text/html');
             $post_office->add_message($letter);
             $post_office->send_messages();
         }
         $photo_owner_id = $photo->user_id;
         //remove photo approval action here
         //-------------------
         $gameUser = Helper_Game::getUser($photo->user_id);
         $gameUser->removeItem($photo->id);
         $photo->delete();
         echo $photo_owner_id;
     }
 }
Beispiel #10
0
<?php 
if (count($awards) > 0) {
    ?>
	<h2>Awards</h2>
	<div class="thumb_container awards">
		<div class="previous_container_award">
			<div><a href="#">Previous</a></div>
		</div>
		<div id="award_carousel" class="awards">
		<ul class="thumbs">
			<?php 
    foreach ($awards as $award) {
        ?>
				<li><?php 
        Helper_Game::outputHonorImageWithToolTip($award, Helper_Game::IMAGE_75);
        ?>
</li>
			<?php 
    }
    ?>
		</ul>
		</div>
		<div class="next_container_award">
			<a href="#">Next</a>
		</div>
	</div>
	
	<?php 
}
?>
Beispiel #11
0
 public function action_approveall()
 {
     $comments = ORM::factory('comment')->where('moderation_status_id', '=', 1)->find_all();
     foreach ($comments as $comment) {
         $comment->moderation_status_id = 2;
         Helper_Game::logEvent(Helper_Game::COMMENT_APPROVED, $comment->user_id, $comment->photo_id, array("comment" => $comment->comment));
         Helper_Game::logEvent(Helper_Game::COMMENT_RECEIVED, $comment->photo->user->id, $comment->photo_id, array("comment" => $comment->id, "photo" => $comment->photo_id));
         $comment->save();
     }
     // Display thank you
     Message::set(Message::SUCCESS, 'Comments successfully approved.');
     Request::instance()->redirect('admin/comments');
 }
Beispiel #12
0
 public function delete($id = null)
 {
     //delete all comments
     foreach ($this->comments->find_all() as $comment) {
         $comment->delete();
     }
     //delete all photos
     foreach ($this->photos->find_all() as $photo) {
         $photo->delete();
     }
     //delete avatar
     if ($this->avatar->loaded()) {
         $this->avatar->delete();
     }
     //delete all logs that refer to this user
     $logInfos = ORM::factory("Game_LogInfo")->or_where_open()->where("name", "=", "user")->or_where("name", "=", "user_id")->or_where_close()->where("data", "=", $this->id)->find_all();
     foreach ($logInfos as $logInfo) {
         $logInfo->_eventLog->delete();
     }
     //delete the user in gamification DB
     $site = Helper_Game::getSite();
     $gUser = $site->getUser($this->id);
     $gUser->delete();
     parent::delete($id);
 }
Beispiel #13
0
 public function action_awardBadges($start = 0)
 {
     if ($this->active) {
         $users = ORM::factory("user")->find_all();
         $this->template->content = "";
         $completed = 0;
         $numUsers = $users->count();
         for ($i = $start; $i < $numUsers; ++$i) {
             $user = $users[$i];
             $gmUser = Helper_Game::getUser($user->id);
             $gmUser->awardBadges();
             $completed++;
             $this->template->content .= "<p>{$completed} complete. Started at {$start}</p>";
         }
     } else {
         $this->template->content = 'Initialized.';
         //$this->template->content =  View::factory('profiler/stats');
     }
 }
Beispiel #14
0
 public static function feedViews($feed)
 {
     $feeds = array();
     $lastPhoto = null;
     $lastPhotoView = null;
     $numPhotos = 0;
     foreach ($feed as $feedItem) {
         switch ($feedItem->event->name) {
             case Helper_Game::IMG_APPROVED:
             case Helper_Game::IMG_UPLOAD:
                 $siteItem = $feedItem->item;
                 if ($siteItem->id) {
                     $currentPhoto = ORM::factory('photo', $siteItem->item_id);
                 } else {
                     $currentPhoto = ORM::factory('photo', $feedItem->data->photo);
                 }
                 if ($currentPhoto->moderation_status_id == 2) {
                     if ($lastPhoto != null && $numPhotos < 3 && $lastPhoto->user->id == $currentPhoto->user->id && Helper_Game::displayTime(strtotime($lastPhoto->created)) == Helper_Game::displayTime(strtotime($currentPhoto->created))) {
                         $lastPhotoView->photos[] = $currentPhoto;
                         $photoView = $lastPhotoView;
                     } else {
                         $numPhotos = 0;
                         $photoView = View::factory("profile/activity/uploaded")->set(array('activity' => $feedItem, 'user' => ORM::factory("user", $feedItem->user->user_id), 'photos' => array($currentPhoto)));
                         $feeds[] = $photoView;
                     }
                     $numPhotos++;
                     $lastPhoto = $currentPhoto;
                     $lastPhotoView = $photoView;
                 }
                 break;
             case Helper_Game::COMMENT:
                 $comment = ORM::factory("comment", $feedItem->data->comment);
                 if ($comment->moderation_status_id == 2) {
                     $feeds[] = View::factory("profile/activity/comment")->set(array('activity' => $feedItem, 'item' => $feedItem, 'user' => ORM::factory("user", $feedItem->user->user_id), 'comment' => $comment, 'photo' => ORM::factory("photo", $feedItem->data->photo)));
                 }
                 break;
             case Helper_Game::COMMENT_RECEIVED:
                 $comment = ORM::factory("comment", $feedItem->data->comment);
                 if ($comment->moderation_status_id == 2) {
                     $feeds[] = View::factory("profile/activity/receivedcomment")->set(array('activity' => $feedItem, 'item' => $feedItem, 'user' => $comment->user, 'comment' => $comment, 'photo' => ORM::factory("photo", $feedItem->data->photo)));
                 }
                 break;
             case Helper_Game::FAVORITE:
                 $favPhoto = ORM::factory("photo", $feedItem->data->photo_id);
                 $user = ORM::factory("user", $feedItem->user->user_id);
                 if ($favPhoto->loaded() && $user->loaded()) {
                     $feeds[] = View::factory("profile/activity/fav")->set(array('activity' => $feedItem, 'user' => $user, 'photo' => $favPhoto));
                 }
                 break;
             case Helper_Game::FAVORITED:
                 $favPhoto = ORM::factory("photo", $feedItem->data->photo_id);
                 $user = ORM::factory("user", $feedItem->data->user_id);
                 if ($favPhoto->loaded() && $user->loaded()) {
                     $feeds[] = View::factory("profile/activity/fav")->set(array('activity' => $feedItem, 'user' => $user, 'photo' => $favPhoto));
                 }
                 break;
             case Helper_Game::FOLLOW_YOU:
                 $user = ORM::factory("user", $feedItem->user->user_id);
                 $fanned = ORM::factory("user", $feedItem->data->fanned);
                 if ($user->loaded() && $fanned->loaded()) {
                     $feeds[] = View::factory("profile/activity/follow")->set(array('activity' => $feedItem, 'user' => $user, 'fanned' => $fanned));
                 }
                 break;
             case Helper_Game::FOLLOW_ME:
                 $user = ORM::factory("user", $feedItem->data->fanned_by);
                 $fanned = ORM::factory("user", $feedItem->user->user_id);
                 if ($user->loaded() && $fanned->loaded()) {
                     $feeds[] = View::factory("profile/activity/follow")->set(array('activity' => $feedItem, 'user' => $user, 'fanned' => $fanned));
                 }
                 break;
             case Model_Game_Site::HONOR_GIVEN:
                 $user = ORM::factory("user", $feedItem->user->user_id);
                 if ($user->loaded()) {
                     $feeds[] = View::factory("profile/activity/honor")->set(array('activity' => $feedItem, 'honor' => ORM::factory($feedItem->data->type, $feedItem->data->honor_id), 'user' => $user, 'item' => $feedItem->item ? ORM::factory("photo", $feedItem->item->item_id) : false));
                 }
                 break;
             default:
                 //output nothing
                 break;
         }
     }
     return $feeds;
 }
Beispiel #15
0
 public function action_removefan($id = null)
 {
     if ($id != null && $this->user->id != null) {
         $gameUser = Helper_Game::getUser($this->user->id);
         $toFollow = Helper_Game::getUser($id);
         $gameUser->stopFollowing($toFollow);
         $gotoUser = ORM::factory("user", $id);
         Message::set(Message::NOTICE, 'You are no longer following ' . $gotoUser->display_name);
         $myEvents = ORM::factory("game_EventLog")->where("site_user_id", '=', $gameUser->id)->find_all();
         foreach ($myEvents as $log) {
             if ($log->event->name == Helper_Game::FOLLOW_YOU && $log->data->fanned == $id) {
                 $log->delete();
                 //break;
             }
         }
         $yourEvents = ORM::factory("game_EventLog")->where("site_user_id", '=', $toFollow->id)->find_all();
         foreach ($yourEvents as $log) {
             if ($log->event->name == Helper_Game::FOLLOW_ME && $log->data->fanned_by == $this->user->id) {
                 $log->delete();
                 //break;
             }
         }
         if ($gotoUser->vanity_url) {
             Request::instance()->redirect('/profile/' . $gotoUser->vanity_url);
         } else {
             Request::instance()->redirect('/profile/' . $gotoUser->id);
         }
     } else {
         Request::instance()->redirect('/profile/');
     }
 }
Beispiel #16
0
 public function action_index()
 {
     $this->template->content = View::factory('admin/awards/index');
     $this->template->content->set(array('awards' => Helper_Game::alphebetizeHonors($this->site->awards)));
     $this->template->sidebar = Widget::factory()->add(Helper_Default::admin_sidebar());
 }
Beispiel #17
0
<h1><?php 
/* echo $user->display_name; */
?>
Awards</h1>
	<p>Awards are given to members by NG Kids staff for specific accomplishments. We're always on the prowl for great shots! Be sure to check back for new awards!</p>
	<div class="section_container2 trophies">
		<?php 
foreach ($awards as $award) {
    Helper_Game::outputHonorImageWithToolTip($award, Helper_Game::IMAGE_75);
}
?>
	</div>

<h1><?php 
/* echo $user->display_name; */
?>
Badges</h1>
	<p>You can earn these badges by simply uploading photos and interacting with other members. Some badges are special, limited editions that can only be earned during a certain time period, so upload often and check back for new badges! (Hint: make sure to tag your photos with descriptive words!)</p>
	<div class="section_container2 trophies">
		<?php 
foreach ($badges as $badge) {
    Helper_Game::outputHonorImageWithToolTip($badge, Helper_Game::IMAGE_75);
}
?>
	</div>
Beispiel #18
0
 public function action_approve($uid)
 {
     $approved_role = new Model_Role(array('name' => 'approved'));
     $user = ORM::factory("user", $uid);
     if ($user->loaded()) {
         try {
             if ($user->add('roles', $approved_role)) {
                 $this->send_confirmation_email($user);
                 Message::set(Message::SUCCESS, 'Account was successfully approved!');
                 Helper_Game::logEvent(Helper_Game::REGISTER, $user->id);
                 Request::instance()->redirect('/admin/users/edit/' . $user->id);
                 return;
             }
         } catch (Exception $e) {
             Message::set(Message::ERROR, 'Account approval failed.');
             Request::instance()->redirect('/admin/users/edit/' . $uid);
         }
     }
     Message::set(Message::ERROR, 'Account approval failed.');
     Request::instance()->redirect('/admin/users/edit/' . $uid);
 }
Beispiel #19
0
<div class="activity">
	<div class="activity_left">
		<div class="avatar_thumb_container">
			<div class="activity_thumb">
				<?php 
$avatarImg = html::image(Helper_Account::get_avatar($user, "thumb"));
echo html::anchor(Helper_Account::get_public_account_url($user), $avatarImg);
?>
			</div>
		</div>
	</div>
	<div class="activity_right">
		<div class="activity_title"><span class="user"><?php 
echo html::anchor(Helper_Account::get_public_account_url($user), $user->display_name);
?>
</span>
			left a comment on <span class="user"><?php 
echo html::anchor(Helper_Photos::get_photo_url($photo), $photo->user->display_name . "'s");
?>
</span> photo</div>
		<div class="activity_comment"><?php 
echo $comment->comment;
?>
</div>
		<div class="timestamp"><?php 
echo Helper_Game::displayTime(strtotime($activity->time_stamp));
?>
</div>
	</div>
	<div class="clear"></div>
</div>
Beispiel #20
0
<div id="trophytitle" class="straight_title orange clickable">Trophy Case
	<div class="more"><?php 
    echo html::anchor('trophies', 'See All Trophies');
    ?>
</div>
</div>
<div id="trophy_container" class=" achievements">
	<div class="previous_container orange">
		<a href="#">Previous</a>
	</div>
	<div id="trophy_carousel">
		<ul class="thumbs">
	<?php 
    foreach ($achievements as $achievement) {
        echo "<li>";
        Helper_Game::outputHonorImageWithToolTip($achievement, Helper_Game::IMAGE_105);
        echo "</li>";
    }
    ?>
		</ul>

	</div>
	<div class="next_container orange">
		<a href="#">Next</a>
	</div>
</div>
<?php 
}
if ($user_owns_page and $is_approved or !$user_owns_page) {
    ?>
	<div id="photos" class="straight_title green clickable">Photos <?php 
Beispiel #21
0
 public function before()
 {
     parent::before();
     $this->site = Helper_Game::getSite();
 }
Beispiel #22
0
 public function action_approve($photo_id)
 {
     $photo = ORM::factory('photo')->where('id', '=', $photo_id)->find();
     // Approve it
     $photo->moderation_status_id = 2;
     $photo->set_order();
     $photo->save();
     // Upload to the CDN
     $this->upload_all($photo);
     // Alert the user
     $this->send_approval_email($photo, $photo->user);
     $tagstr = "";
     foreach ($photo->tags->find_all() as $tag) {
         $tagstr .= $tag->name . ",";
     }
     //Log event
     Helper_Game::logEvent(Helper_Game::IMG_APPROVED, $photo->user->id, $photo->id, array('photo' => $photo->id, 'tags' => $tagstr, 'category' => $photo->category->name));
     // Display thank you
     Message::set(Message::SUCCESS, 'Photo successfully approved.');
     Request::instance()->redirect('admin');
 }
Beispiel #23
0
<div class="more"><?php 
    echo html::anchor('trophies', 'See All Trophies');
    ?>
</div>
Trophy Case</div>
<div id="trophy_container">
    <div class="previous_container">
        <a href="#">Previous</a>
    </div>
    <div id="trophy_carousel">
        <ul class="thumbs">
            <?php 
    foreach ($honors as $honor) {
        ?>
            <li><?php 
        $honor->honor->type == "award" ? Helper_Game::outputHonorImageWithToolTip($honor->honor, Helper_Game::IMAGE_105, Helper_Photos::get_photo_url($honor->photo)) : Helper_Game::outputHonorImageWithToolTip($honor->honor, Helper_Game::IMAGE_105, Helper_Account::get_public_account_url($honor->user));
        ?>
</li>
            <?php 
    }
    ?>
        </ul>

    </div>
    <div class="next_container">
        <a href="#">Next</a>
    </div>
</div>
<?php 
}
if ($homeSpot) {
Beispiel #24
0
 public static function outputHonorToolTip($honor)
 {
     if ($honor->showable) {
         echo "<div class='tooltip'>";
         echo "<h4>";
         echo html::anchor('/trophies/' . $honor->type . '/' . $honor->id, $honor->title);
         echo "</h4>";
         echo "<p>";
         echo Helper_Game::shortenString($honor->desc, 165);
         echo "</p>";
         echo "</div>";
     }
 }