public function TimelineUrl() { TimelineController::include_microblog_requirements(); Requirements::javascript('microblog/javascript/timeline-dashlet.js'); $tags = $this->ShowTaggedWith->getValues(); $extra = ''; if (count($tags)) { $extra = '?tags=' . urlencode(implode(',', $tags)); } return 'timeline' . $extra; }
public function getFilterTags() { $tags = parent::tagsFromRequest(); $setTags = $this->ShowTaggedWith->getValues(); if ($setTags && count($setTags)) { $tags = array_merge($tags, $setTags); } if ($this->data()->SelfTagPosts) { $tags[] = $this->data()->selfTag(); } return $tags; }
private function feed() { Phalanx::loadClasses('Profile', 'Lists', 'PostCategory'); $user_data = Profile::get_profile($this->session->user->login); #Correção p/ um bug com os nomes de usuários incorretos if (empty($user_data->login)) { Request::redirect(HOST); } else { #Reutilização do mesmo core para criação da timeline - F**k yeah Phalanx::loadController('TimelineController'); $Timeline = new TimelineController(); $posts = $Timeline->BuildFromList($this->cookies->active_list); #Pego os outros dados do usuário que são utilizados na página de feed $this->views = new Views(new Template("default")); $this->views->data = $user_data; $this->views->lists = Lists::from_user($this->session->user->id); $this->views->categories = PostCategory::get(); $this->views->posts = $posts; $this->views->display("feed.phtml"); } }
public function kill_random() { if (Session::has('admin')) { $fighters = DB::table('fighters')->where('idgame', '=', Input::get('game'))->where('hp', '>', 0)->orderBy(DB::raw('RAND()'))->take(Input::get('kills'))->get(); if (!$fighters) { return array('fighter' => 'no fighter'); } foreach ($fighters as &$fighter) { DB::table('fighters')->where('idfighter', '=', $fighter->idfighter)->update(array('hp' => 0)); $action = (object) array('idaction' => 0, 'idgame' => Input::get('game'), 'idround' => Input::get('round'), 'iduser' => 0, 'idfighter' => 0, 'target' => $fighter->idfighter, 'order' => 0, 'turn' => 1, 'status' => 1, 'damage' => 100, 'critical' => 0, 'effective' => 0, 'name' => 'Ice King (admin)', 'type' => 1, 'idclass' => 1, 'hp' => 100, 'color' => 1, 'killspeech' => '¿Te volviste reggaetonero?', 'gender' => 4, 'classhp' => 100, 'target_fighter' => (object) array('idfighter' => $fighter->idfighter, 'name' => $fighter->name, 'iduser' => $fighter->iduser, 'idgame' => $fighter->idgame, 'type' => $fighter->type, 'idclass' => $fighter->idclass, 'hp' => 0, 'status' => $fighter->status, 'color' => $fighter->color, 'lastwords' => $fighter->lastwords, 'gender' => $fighter->gender, 'classhp' => $fighter->classhp)); $TimelineController = new TimelineController(); $TimelineController->create($action); } $fighters = $this->get_all(Input::get('game'), 1); return Response::json(array('output' => $fighters)); } else { return Response::json(array('output' => 'not admin')); } }
public function execute_actions() { if (Session::has('admin')) { $game = Input::get('game'); $round = DB::table('rounds')->where('idgame', '=', $game)->where('status', '=', 1)->first(); if ($round) { $game = Input::get('game'); $action = DB::table('actions')->join('fighters', 'actions.idfighter', '=', 'fighters.idfighter')->where('actions.idgame', '=', $game)->where('fighters.idgame', '=', $game)->where('actions.idround', '=', $round->round)->where('actions.status', '=', 0)->orderBy('actions.turn', 'asc')->orderBy('actions.order', 'asc')->first(); while ($action) { if ($action->hp > 0) { $action->target_fighter = DB::table('fighters')->where('iduser', '=', $action->target)->where('idgame', '=', $game)->first(); $life_left = $action->target_fighter->hp - $action->damage; if ($life_left < 0) { $life_left = 0; } if ($life_left > $action->target_fighter->classhp) { $life_left = $action->target_fighter->classhp; } $action->target_fighter->hp = $life_left; $TimelineController = new TimelineController(); $TimelineController->create($action); DB::table('fighters')->where('idfighter', '=', $action->target_fighter->idfighter)->update(array('hp' => $life_left)); DB::table('actions')->where('idgame', '=', $game)->where('idaction', '=', $action->idaction)->update(array('status' => 1)); } else { DB::table('actions')->where('idgame', '=', $game)->where('idaction', '=', $action->idaction)->update(array('status' => 2)); } $action = DB::table('actions')->join('fighters', 'actions.idfighter', '=', 'fighters.idfighter')->where('actions.idgame', '=', $game)->where('fighters.idgame', '=', $game)->where('actions.idround', '=', $round->round)->where('actions.status', '=', 0)->orderBy('actions.turn', 'asc')->orderBy('actions.order', 'asc')->first(); } } } }