public function action_confirm($category_id) { $category = ORM::factory('category')->where('id', '=', $category_id)->find(); $this->template->content = View::factory('admin/categories/confirm'); $this->template->sidebar = Widget::factory()->add(Helper_Default::admin_sidebar()); $this->template->content->category = $category; }
public function action_index() { $results = ORM::factory('caption')->where('moderation_status_id', '!=', '2')->find_all(); $this->template->content = View::factory('admin/captions/index'); $this->template->content->set(array('captions' => $results)); $this->template->scripts = array('public/js/admin/moderation.js'); $this->template->sidebar = Widget::factory()->add(Helper_Default::admin_sidebar()); }
public function action_index($photo_id = NULL) { /* * load all of the Caption This photos that haven't expired */ $caption_photos = ORM::factory('captionthisphoto')->where('to', '>=', date('Y-m-d'))->find_all(); if ($photo_id != NULL) { $photo = ORM::factory('photo')->where('id', '=', $photo_id)->find(); /* * try to load the photo provided via the url */ if ($photo->loaded()) { /* * check to see if from date is before to date */ if (strtotime($_POST['to']) < strtotime($_POST['from'])) { Message::set(Message::ERROR, "From date must be before to date."); Request::instance()->redirect(Helper_Photos::get_photo_url($photo)); return; } /* * check to see if form was posted and has both of the dates */ if (!empty($_POST['from']) && !empty($_POST['to'])) { $from_date = date('Y-m-d', strtotime($_POST['from'])); $to_date = date('Y-m-d', strtotime($_POST['to'])); $check_dates = DB::select('*')->from('caption_this_photos')->where('from', 'BETWEEN', array($from_date, $to_date))->or_where('to', 'BETWEEN', array($from_date, $to_date))->order_by('from', 'ASC')->execute(); if ($check_dates->count() > 0) { Message::set(Message::ERROR, "There is already a Caption This photo in the period you selected."); } else { $caption_this_photo = ORM::factory('captionthisphoto'); $caption_this_photo->from = date("Y-m-d", strtotime($_POST['from'])); $caption_this_photo->to = date("Y-m-d", strtotime($_POST['to'])); $caption_this_photo->photo_id = $photo_id; $caption_this_photo->save(); /* * if the photo was saved, show a success message */ if ($caption_this_photo->saved()) { Message::set(Message::SUCCESS, "Photo successfully set as Caption This photo from " . $_POST['from'] . " to " . $_POST['to'] . "."); Request::instance()->redirect('admin/backtalk'); } else { Message::set(Message::ERROR, "A problem occured while trying to set photo as Caption This photo."); } } } else { Message::set(Message::ERROR, "You must select the date range for Caption This photo."); } } else { Message::set(Message::ERROR, "This photo doesn't exist."); } } $this->template->content = View::factory('admin/photos/caption'); $this->template->content->set(array('caption_photos' => $caption_photos)); $this->template->styles = array('public/js/vendor/datepicker/jquery-ui-1.8.5.custom.css' => 'screen'); $this->template->scripts = array('public/js/vendor/jquery-ui-1.8.5.custom.min.js'); $this->template->sidebar = Widget::factory()->add(Helper_Default::admin_sidebar()); }
public function action_view($avatar_id) { $avatar = ORM::factory('avatar')->where('id', '=', $avatar_id)->find(); $avatar->lock(); $this->template->content = View::factory('admin/avatars/view'); $this->template->content->set(array('avatar' => $avatar)); $this->template->scripts = array('public/js/admin/moderation.js'); $this->template->sidebar = Widget::factory()->add(Helper_Default::admin_sidebar()); }
public function before() { parent::before(); $this->template->sidebar = Widget::factory()->add(Helper_Default::admin_sidebar()); }
public function action_confirm($id) { $this->template->content = View::factory('admin/awards/confirm'); $this->template->sidebar = Widget::factory()->add(Helper_Default::admin_sidebar()); $this->template->content->award = ORM::factory("game_Award", $id); }
public function action_flag($user_id = null) { $user = ORM::factory('user')->where('id', '=', $user_id)->find(); $content = $this->template->content = View::factory('admin/users/flag'); $this->template->sidebar = Widget::factory()->add(Helper_Default::admin_sidebar()); if ($user->loaded()) { $this->template->content->set(array('user' => $user)); } else { Message::set(Message::NOTICE, "This user does not exist."); Request::instance()->redirect('admin/users'); } if ($_POST) { /* How long do they want to suspend this user for? */ $flag_timeout = Arr::get($_POST, 'flag'); $user->flag = time() + $flag_timeout; /* Create the account. */ $user->save(); Request::instance()->redirect('admin/users'); /* Load the validation rules, filters etc.*/ //$post = $user->validate_update($_POST); /* If the post data validates using the rules setup in the user model. */ //if ($post->check()) //{ //$user->flag = time() + $flag_timeout; /* Create the account. */ //$user->save(); /* Redirect to users edit page. */ //Request::instance()->redirect('admin/users'); //} //else //{ /* Get errors for display in view. */ //Message::set(Message::ERROR, $post->errors("user")); //} } }