Show all conversations for the currently authenticated user.

@since 2.0.0
@access public

@param string $Page
336894
public function All($Page = '') {
      $Session = Gdn::Session();
      $this->Title(T('Inbox'));
      Gdn_Theme::Section('ConversationList');

      list($Offset, $Limit) = OffsetLimit($Page, C('Conversations.Conversations.PerPage', 50));
      
      // Calculate offset
      $this->Offset = $Offset;
      
      $UserID = $this->Request->Get('userid', Gdn::Session()->UserID);
      if ($UserID != Gdn::Session()->UserID) {
         if (!C('Conversations.Moderation.Allow', FALSE)) {
            throw PermissionException();
         }
         $this->Permission('Conversations.Moderation.Manage');
      }
      
      $Conversations = $this->ConversationModel->Get2($UserID, $Offset, $Limit);
      $this->SetData('Conversations', $Conversations->ResultArray());
      
      // Get Conversations Count
      //$CountConversations = $this->ConversationModel->GetCount($UserID);
      //$this->SetData('CountConversations', $CountConversations);
      
      // Build the pager
      if (!$this->Data('_PagerUrl'))
         $this->SetData('_PagerUrl', 'messages/all/{Page}');
      $this->SetData('_Page', $Page);
      $this->SetData('_Limit', $Limit);
      $this->SetData('_CurrentRecords', count($Conversations->ResultArray()));
      
      // Deliver json data if necessary
      if ($this->_DeliveryType != DELIVERY_TYPE_ALL && $this->_DeliveryMethod == DELIVERY_METHOD_XHTML) {
         $this->SetJson('LessRow', $this->Pager->ToString('less'));
         $this->SetJson('MoreRow', $this->Pager->ToString('more'));
         $this->View = 'conversations';
      }
      
      // Build and display page.
      $this->Render();
   }
1003602
public function UserPage()
	{
		$this->RequirePermission(ExampleUser::$PERMISSION_USER, 
				'SecureExample.LoginForm', 
				'Login is required to access the secure user page',
				'You do not have permission to access the secure user page');
		
		$this->Assign("currentUser", $this->GetCurrentUser());
		
		$this->Assign('page','userpage');
		$this->Render("SecureExample");
	}
794505
public function listAction($page = 1)
    {
        $paginator = $this->get("knp_paginator");

        if ($paginator instanceof \Knp\Component\Pager\Paginator) ;

        $query = $this->getPaginatorQuery();

        if ($this->getRequest()->get("sort")) {
            $query->orderBy($this->getRequest()->get("sort"), strtolower($this->getRequest()->get("direction")) == "asc" ? "asc" : "desc");
        }

        $pagination = $paginator->paginate(
            $query,
            $page
        );

        $pagination->setTemplate('KnpPaginatorBundle:Pagination:twitter_bootstrap_v3_pagination.html.twig');

        return array(
            'page' => $page,
            'pagination' => $pagination,
            'sort' => $this->getRequest()->get('sort'),
            'direction' => $this->getRequest()->get('direction'),
            'route' => $this->getRouteName(),
            'routeParams' => $this->getRouteParams(),
            'template' => $this->getListTemplate()
        );
    }
1295688
public function checkForPhpNoticesOrWarnings($page = null)
	{
		if ($page)
		{
			$this->amOnPage($page);
		}

		$this->dontSeeInPageSource('Notice:');
		$this->dontSeeInPageSource('<b>Notice</b>:');
		$this->dontSeeInPageSource('Warning:');
		$this->dontSeeInPageSource('<b>Warning</b>:');
		$this->dontSeeInPageSource('Strict standards:');
		$this->dontSeeInPageSource('<b>Strict standards</b>:');
		$this->dontSeeInPageSource('The requested page can\'t be found');
	}
579690
public function index($page = null)
    {
        $url = sprintf('buckets/%d/recordings/%d/events.json', $this->bucket, $this->parent);

        $events = $this->client->get($url, [
            'query' => [
                'page' => $page,
            ],
        ]);

        return $this->indexResponse($events, Event::class);
    }
1364299
public function render_user_evidence_page(user_evidence_page $page) {
        $data = $page->export_for_template($this);
        return parent::render_from_template('tool_lp/user_evidence_page', $data);
    }
1258456
protected function setPageCurrent($page)
    {

        // need both of these?
        $page += 0;
        $page = (int) $page;

        // cant be below 1
        $page = $page ? $page : 1;

        // cant be above possible
        if ($page > $this->possiblePages) {
            $page = $this->possiblePages;
        }

        $this->pageCurrent = $page;
    }
83093
public function addressNotEquals($page)
    {
        $expected = $this->cleanUrl($page);
        $actual = $this->getCurrentUrlPath();

        $this->assert($actual !== $expected, sprintf('Current page is "%s", but should not be.', $actual));
    }
746187
public function index()
    {
        $currentUserId = Auth::user()->id;

        // All threads, ignore deleted/archived participants
        $threads = Thread::getAllLatest()->get();

        // All threads that user is participating in
        // $threads = Thread::forUser($currentUserId)->latest('updated_at')->get();

        // All threads that user is participating in, with new messages
        // $threads = Thread::forUserWithNewMessages($currentUserId)->latest('updated_at')->get();

        return view('chat.index', compact('threads', 'currentUserId'));
    }
418299
public function getList($user, $perPage = 25, $page = 1, $pageName = 'page')
    {
        return $this->getConversationsList($user, $perPage, $page, $pageName);
    }
270514
public function iShouldBeOnThePage($page)
    {
        $url = $this->generateUrl($this->routeMap[$page]);
        $this->assertSession()->addressEquals($url);
        $this->assertStatusCodeEquals(200);
    }
1188883
public function list(
        ConversationFilters $conversationFilters = null,
        ConversationRequest $conversationRequest = null
    ): PagedCollection {
        $uri = '/v2/conversations';
        if ($conversationFilters) {
            $params = $conversationFilters->getParams();
            if (!empty($params)) {
                $uri .= '?'.http_build_query($params);
            }
        }

        return $this->loadConversations(
            $uri,
            $conversationRequest ?: new ConversationRequest()
        );
    }
830271
public function render_head_html($page = null) {
        if (is_null($page)) {
            global $PAGE;
            $page = $PAGE;
        }
        // TODO go via behaviour.
        return $this->question->get_renderer($page)->head_code($this) .
                $this->behaviour->get_renderer($page)->head_code($this);
    }
206344
public function listSubAccounts($per_page,$page){

        $this->setRequestOptions();
        return $this->setHttpResponse("/subaccount/?perPage=".(int) $per_page."&page=".(int) $page,"GET")->getResponse();

    }
1241547
public function dialog()
    {
        //if session has not started
        if (!session_id()) {
            //start session
            session_start();
        }
        
        //if they never tried
        if (!isset($_SESSION[self::UNAUTHORIZED])) {
            //first try
            $_SESSION[self::UNAUTHORIZED] = 1;
        } else {
            //more than one try
            $_SESSION[self::UNAUTHORIZED]++;
        }
        
        //if it's their first few tries
        if ($_SESSION[self::UNAUTHORIZED] < 3) {
            header(sprintf(self::HTTP_AUTH, $this->realm, uniqid(), md5($this->realm)));
            exit;
        }
        
        //let them try again
        unset($_SESSION[self::UNAUTHORIZED]);
        
        //you are unauthorized
        header(self::UNAUTHORIZED);
        
        //throw
        Exception::i()
            ->setMessage(self::UNAUTHORIZED)
            ->setType(self::ERROR_TYPE)
            ->trigger();
    }
1196797
protected function changePage($page)
    {
        $this->currentPage = $page;
        $this->manialinkFactory->update($this->manialink->getUserGroup());
    }
528666
public function Index($DiscussionID = '', $DiscussionStub = '', $Page = '') {
      // Setup head
      $Session = Gdn::Session();
      $this->AddJsFile('jquery.autogrow.js');
      $this->AddJsFile('discussion.js');
      $this->AddJsFile('autosave.js');
      Gdn_Theme::Section('Discussion');
      
      // Load the discussion record
      $DiscussionID = (is_numeric($DiscussionID) && $DiscussionID > 0) ? $DiscussionID : 0;
      if (!array_key_exists('Discussion', $this->Data))
         $this->SetData('Discussion', $this->DiscussionModel->GetID($DiscussionID), TRUE);
         
      if(!is_object($this->Discussion)) {
         throw new Exception(sprintf(T('%s Not Found'), T('Discussion')), 404);
      }
      
      // Define the query offset & limit.
      $Limit = C('Vanilla.Comments.PerPage', 30);

      $OffsetProvided = $Page != '';
      list($Offset, $Limit) = OffsetLimit($Page, $Limit);
      
      // Check permissions
      $this->Permission('Vanilla.Discussions.View', TRUE, 'Category', $this->Discussion->PermissionCategoryID);
      $this->SetData('CategoryID', $this->CategoryID = $this->Discussion->CategoryID, TRUE);
      
      if (strcasecmp(GetValue('Type', $this->Discussion), 'redirect') === 0) {
         $this->RedirectDiscussion($this->Discussion);
      }
      
      $Category = CategoryModel::Categories($this->Discussion->CategoryID);
      $this->SetData('Category', $Category);
      
      if ($CategoryCssClass = GetValue('CssClass', $Category))
         Gdn_Theme::Section($CategoryCssClass);
      
      $this->SetData('Breadcrumbs', CategoryModel::GetAncestors($this->CategoryID));
      
      // Setup
      $this->Title($this->Discussion->Name);

      // Actual number of comments, excluding the discussion itself.
      $ActualResponses = $this->Discussion->CountComments;

      $this->Offset = $Offset;
      if (C('Vanilla.Comments.AutoOffset')) {
//         if ($this->Discussion->CountCommentWatch > 1 && $OffsetProvided == '')
//            $this->AddDefinition('ScrollTo', 'a[name=Item_'.$this->Discussion->CountCommentWatch.']');
         if (!is_numeric($this->Offset) || $this->Offset < 0 || !$OffsetProvided) {
            // Round down to the appropriate offset based on the user's read comments & comments per page
            $CountCommentWatch = $this->Discussion->CountCommentWatch > 0 ? $this->Discussion->CountCommentWatch : 0;
            if ($CountCommentWatch > $ActualResponses)
               $CountCommentWatch = $ActualResponses;

            // (((67 comments / 10 perpage) = 6.7) rounded down = 6) * 10 perpage = offset 60;
            $this->Offset = floor($CountCommentWatch / $Limit) * $Limit;
         }
         if ($ActualResponses <= $Limit)
            $this->Offset = 0;

         if ($this->Offset == $ActualResponses)
            $this->Offset -= $Limit;
      } else {
         if ($this->Offset == '')
            $this->Offset = 0;
      }

      if ($this->Offset < 0)
         $this->Offset = 0;
      
      
      $LatestItem = $this->Discussion->CountCommentWatch;
      if ($LatestItem === NULL) {
         $LatestItem = 0;
      } elseif ($LatestItem < $this->Discussion->CountComments) {
         $LatestItem += 1;
      }
      
      $this->SetData('_LatestItem', $LatestItem);
      
      // Set the canonical url to have the proper page title.
      $this->CanonicalUrl(DiscussionUrl($this->Discussion, PageNumber($this->Offset, $Limit, 0, FALSE)));
      
//      Url(ConcatSep('/', 'discussion/'.$this->Discussion->DiscussionID.'/'. Gdn_Format::Url($this->Discussion->Name), PageNumber($this->Offset, $Limit, TRUE, Gdn::Session()->UserID != 0)), TRUE), Gdn::Session()->UserID == 0);
      
      // Load the comments
      $this->SetData('Comments', $this->CommentModel->Get($DiscussionID, $Limit, $this->Offset));
      
      $PageNumber = PageNumber($this->Offset, $Limit);
      $this->SetData('Page', $PageNumber);
      $this->_SetOpenGraph();
      
      
      include_once(PATH_LIBRARY.'/vendors/simplehtmldom/simple_html_dom.php');
      if ($PageNumber == 1) {
         $this->Description(SliceParagraph(Gdn_Format::PlainText($this->Discussion->Body, $this->Discussion->Format), 160));
         // Add images to head for open graph
         $Dom = str_get_html(Gdn_Format::To($this->Discussion->Body, $this->Discussion->Format));
      } else {
         $this->Data['Title'] .= sprintf(T(' - Page %s'), PageNumber($this->Offset, $Limit));
         
         $FirstComment = $this->Data('Comments')->FirstRow();
         $FirstBody = GetValue('Body', $FirstComment);
         $FirstFormat = GetValue('Format', $FirstComment);
         $this->Description(SliceParagraph(Gdn_Format::PlainText($FirstBody, $FirstFormat), 160));
         // Add images to head for open graph
         $Dom = str_get_html(Gdn_Format::To($FirstBody, $FirstFormat));
      }

      if ($Dom) {
         foreach($Dom->find('img') as $img) {
            if (isset($img->src))
               $this->Image($img->src);
         }
      }
      
      // Queue notification.
      if ($this->Request->Get('new') && C('Vanilla.QueueNotifications')) {
         $this->AddDefinition('NotifyNewDiscussion', 1);
      }
         
      // Make sure to set the user's discussion watch records
      $this->CommentModel->SetWatch($this->Discussion, $Limit, $this->Offset, $this->Discussion->CountComments);

      // Build a pager
      $PagerFactory = new Gdn_PagerFactory();
		$this->EventArguments['PagerType'] = 'Pager';
		$this->FireEvent('BeforeBuildPager');
      $this->Pager = $PagerFactory->GetPager($this->EventArguments['PagerType'], $this);
      $this->Pager->ClientID = 'Pager';
         
      $this->Pager->Configure(
         $this->Offset,
         $Limit,
         $ActualResponses,
         array('DiscussionUrl')
      );
      $this->Pager->Record = $this->Discussion;
      PagerModule::Current($this->Pager);
      $this->FireEvent('AfterBuildPager');
      
      // Define the form for the comment input
      $this->Form = Gdn::Factory('Form', 'Comment');
      $this->Form->Action = Url('/vanilla/post/comment/');
      $this->DiscussionID = $this->Discussion->DiscussionID;
      $this->Form->AddHidden('DiscussionID', $this->DiscussionID);
      $this->Form->AddHidden('CommentID', '');

      // Look in the session stash for a comment
      $StashComment = $Session->Stash('CommentForDiscussionID_'.$this->Discussion->DiscussionID, '', FALSE);
      if ($StashComment)
         $this->Form->SetFormValue('Body', $StashComment);
         
      // Retrieve & apply the draft if there is one:
      if (Gdn::Session()->UserID) {
         $DraftModel = new DraftModel();
         $Draft = $DraftModel->Get($Session->UserID, 0, 1, $this->Discussion->DiscussionID)->FirstRow();
         $this->Form->AddHidden('DraftID', $Draft ? $Draft->DraftID : '');
         if ($Draft && !$this->Form->IsPostBack()) {
            $this->Form->SetValue('Body', $Draft->Body);
            $this->Form->SetValue('Format', $Draft->Format);
         }
      }
      
      // Deliver JSON data if necessary
      if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
         $this->SetJson('LessRow', $this->Pager->ToString('less'));
         $this->SetJson('MoreRow', $this->Pager->ToString('more'));
         $this->View = 'comments';
      }
      
		// Inform moderator of checked comments in this discussion
		$CheckedComments = $Session->GetAttribute('CheckedComments', array());
		if (count($CheckedComments) > 0)
			ModerationController::InformCheckedComments($this);

      // Add modules
      $this->AddModule('DiscussionFilterModule');
      $this->AddModule('NewDiscussionModule');
      $this->AddModule('CategoriesModule');
      $this->AddModule('BookmarkedModule');
      
		$this->CanEditComments = Gdn::Session()->CheckPermission('Vanilla.Comments.Edit', TRUE, 'Category', 'any') && C('Vanilla.AdminCheckboxes.Use');

      // Report the discussion id so js can use it.      
      $this->AddDefinition('DiscussionID', $DiscussionID);
      
      $this->FireEvent('BeforeDiscussionRender');
      $this->Render();
   }