<td><strong><?php echo $this->t('user_wiki_edits'); ?> </strong></td> <td><?php echo $this->linkTo(WikiPageVersion::where(['user_id' => $this->user->id])->count(), array('wiki#recent_changes', 'user_id' => $this->user->id)); ?> </td> </tr> <tr> <td><strong><?php echo $this->t('user_forum_post'); ?> </strong></td> <td><?php echo ForumPost::where(['creator_id' => $this->user->id])->count(); ?> </td> </tr> <?php if ($this->user->invited_by) { ?> <tr> <td><strong><?php echo $this->t('user_invited_by'); ?> </strong></td> <td><?php echo $this->linkTo($this->h(User::find($this->user->invited_by)->name), array('action' => 'show', 'id' => $this->user->invited_by)); ?> </td>
Fields with checkmarks have already been awarded. To view a character's backstory, press the book icon.<br> <b>Awarding character biography experience cannot be undone.</b> </p> <table class="journal-grid responsive"> <thead> <th>Character</th> <th></th> <th></th> <th>Question XP</th> <th>Backstory XP</th> </thead> <tbody> @foreach(Character::activeCharacters()->orderBy('name')->get() as $c) <?php //Find the relevant thread $topic = ForumPost::where('body', "[[questionnaire/{$c->id}]]")->first(); ?> <tr> <td> @if($topic) <a href="/forums/topic/{{$topic->topic->id}}">{{$c->name}}</a> @else {{$c->name}} @endif </td> <?php $biographies = CharacterQuestionnaire::where('character_id', $c->id)->where('response', '!=', '')->get(); $experience = CharacterBiographyExperience::where('character_id', $c->id)->first(); ?> <td> {{$biographies->count()}}
protected function init_cookies() { if ($this->request()->format() == "xml" || $this->request()->format() == "json") { return; } $forum_posts = ForumPost::where("parent_id IS NULL")->order("updated_at DESC")->limit(10)->take(); $this->cookies()->current_forum_posts = json_encode(array_map(function ($fp) { if (current_user()->is_anonymous()) { $updated = false; } else { $updated = $fp->updated_at > current_user()->last_forum_topic_read_at; } return [$fp->title, $fp->id, $updated, ceil($fp->response_count / 30.0)]; }, $forum_posts->members())); $this->cookies()->country = current_user()->country; if (!current_user()->is_anonymous()) { $this->cookies()->user_id = (string) current_user()->id; $this->cookies()->user_info = current_user()->user_info_cookie(); $this->cookies()->has_mail = current_user()->has_mail ? "1" : "0"; $this->cookies()->forum_updated = current_user()->is_privileged_or_higher() && ForumPost::updated(current_user()) ? "1" : "0"; $this->cookies()->comments_updated = current_user()->is_privileged_or_higher() && Comment::updated(current_user()) ? "1" : "0"; if (current_user()->is_janitor_or_higher()) { $mod_pending = Post::where("status = 'flagged' OR status = 'pending'")->count(); $this->cookies()->mod_pending = (string) $mod_pending; } if (current_user()->is_blocked()) { if (current_user()->ban) { $this->cookies()->block_reason = "You have been blocked. Reason: " . current_user()->ban->reason . ". Expires: " . substr(current_user()->ban->expires_at, 0, 10); } else { $this->cookies()->block_reason = "You have been blocked."; } } else { $this->cookies()->block_reason = ""; } $this->cookies()->resize_image = current_user()->always_resize_images ? "1" : "0"; $this->cookies()->show_advanced_editing = current_user()->show_advanced_editing ? "1" : "0"; $this->cookies()->my_tags = current_user()->my_tags; $this->cookies()->blacklisted_tags = json_encode(current_user()->blacklisted_tags_array()); $this->cookies()->held_post_count = (string) current_user()->held_post_count(); } else { $this->cookies()->delete('user_info'); $this->cookies()->delete('login'); $this->cookies()->blacklisted_tags = json_encode(CONFIG()->default_blacklists); } if ($this->session()->notice) { $this->cookies()->notice = $this->session()->notice; $this->session()->delete('notice'); } }
public function getLastUpdatedPostAttribute() { return ForumPost::where('topic_id', $this->id)->orderBy('created_at', 'desc')->first(); }
public function saveBiography($character) { $question_ids = Input::get('ids'); $replies = Input::get('replies'); if ($character) { foreach ($question_ids as $index => $q) { $response = CharacterQuestionnaire::firstOrNew(['character_id' => $character->id, 'questionnaire_id' => $q]); $response->response = $replies[$index]; $response->save(); } if (Input::hasFile('backstory')) { $file = Input::file('backstory'); $fileName = preg_replace("([^\\w\\d\\-_~,;:\\[\\]\\(\\).])", '', $character->name . "Backstory." . $file->getClientOriginalExtension()); $file->move(public_path() . '/content/backstories/', $fileName); $character->backstory_file = $fileName; $character->save(); } if ($character->active || $character->in_review) { //Find the relevant forum post and bump it (or create it if it doesn't exist) $post = ForumPost::where('body', "[[questionnaire/{$character->id}]]")->first(); if ($post) { $topic = $post->topic; $topic->postReply($character->owner->id, "Questionnaire responses updated. (Automatic system post)"); } else { //42 = Character Backgrounds $topic = Forum::find(42)->post("Character Biography for " . $character->name, "[[questionnaire/{$character->id}]]"); $topic->markAsRead(Auth::user()); } return Redirect::to("/forums/topic/" . $topic->id); } else { return Redirect::to("/dashboard/characters"); } } else { return Response::json(["success" => false, "message" => "Character could not be found."]); } }
public function countPosts() { return ForumPost::where('posted_by', $this->id)->count(); }
public function search() { if ($this->params()->query) { $query = '%' . str_replace(' ', '%', $this->params()->query) . '%'; $this->forum_posts = ForumPost::where('title LIKE ? OR body LIKE ?', $query, $query)->order("id desc")->paginate($this->page_number(), 30); } else { $this->forum_posts = ForumPost::order("id desc")->paginate($this->page_number(), 30); } $this->respond_to_list("forum_posts"); }