예제 #1
0
 function Render()
 {
     // Set up the pagelist
     $pl = $this->Context->ObjectFactory->NewContextObject($this->Context, "PageList");
     $pl->NextText = $this->Context->GetDefinition("Next");
     $pl->PreviousText = $this->Context->GetDefinition("Previous");
     $pl->CssClass = "PageList";
     $pl->TotalRecords = $this->DiscussionDataCount;
     $pl->CurrentPage = $this->CurrentPage;
     $pl->RecordsPerPage = agDISCUSSIONS_PER_PAGE;
     $pl->PagesToDisplay = 10;
     $pl->PageParameterName = "page";
     $pl->DefineProperties();
     $PageDetails = $pl->GetPageDetails($this->Context);
     $PageList = $pl->GetNumericList();
     $this->Context->Writer->Add($this->PageJump);
     $this->Context->Writer->Add("<div class=\"Title\">" . $this->Context->PageTitle . "</div>");
     $this->Context->Writer->Add($PageList);
     $this->Context->Writer->Add("<div class=\"PageDetails\">" . ($PageDetails == 0 ? $this->Context->GetDefinition("NoDiscussionsFound") : $PageDetails) . "</div>");
     $Discussion = $this->Context->ObjectFactory->NewObject($this->Context, "Discussion");
     $FirstRow = 1;
     while ($Row = $this->Context->Database->GetRow($this->DiscussionData)) {
         $Discussion->Clear();
         $Discussion->GetPropertiesFromDataSet($Row);
         $Discussion->FormatPropertiesForDisplay();
         $Discussion->ForceNameSpaces();
         $this->Context->Writer->Add(GetDiscussion($this->Context, $Discussion, $FirstRow));
         $FirstRow = 0;
     }
     if ($this->DiscussionDataCount > 0) {
         $this->Context->Writer->Add($PageList);
         $this->Context->Writer->Add("<div class=\"PageDetails\">" . $pl->GetPageDetails($this->Context) . "</div>");
         $this->Context->Writer->Add("<a class=\"PageJump Top\" href=\"#pgtop\">" . $this->Context->GetDefinition("TopOfPage") . "</a>");
     }
     $this->Context->Writer->Write();
 }
예제 #2
0
 function Render_NoPostBack()
 {
     $this->Render_SearchForm();
     if ($this->PostBackAction == "Search") {
         $this->PageDetails = "<div class=\"PageDetails\">" . ($this->PageDetails ? $this->Context->GetDefinition("Results") . $this->PageDetails : $this->Context->GetDefinition("NoResultsFound")) . ($this->Search->Query == "" ? "" : " " . $this->Context->GetDefinition("for") . " <strong>" . $this->Search->Query . "</strong>") . "</div>";
         // Set up the "save search" form
         $this->PostBackParams->Clear();
         $this->PostBackParams->Add("Type", $this->Search->Type);
         $this->PostBackParams->Add("Keywords", $this->Search->Keywords, 0);
         $this->PostBackParams->Add("SearchID", $this->Search->SearchID);
         $this->PostBackParams->Add("PostBackAction", "SaveSearch");
         $this->Context->Writer->Add("<div class=\"SearchLabelForm\">");
         if ($this->Context->Session->UserID > 0) {
             $this->Render_PostBackForm("frmLabelSearch", "post");
             $this->Context->Writer->Add("<input type=\"text\" name=\"Label\" class=\"SearchLabelInput\" value=\"" . $this->Search->Label . "\" maxlength=\"30\" />\r\n\t\t\t\t\t<input type=\"submit\" name=\"btnLabel\" value=\"" . $this->Context->GetDefinition("SaveSearch") . "\" class=\"SearchLabelButton\" />\r\n\t\t\t\t\t</form>");
         } else {
             $this->Context->Writer->Add("&nbsp;");
         }
         $this->Context->Writer->Add("</div>" . "<div class=\"Title\">" . $this->Context->GetDefinition($this->Search->Type) . "</div>" . $this->PageList . $this->PageDetails);
         if ($this->DataCount > 0) {
             $Switch = 0;
             $FirstRow = 1;
             $Counter = 0;
             if ($this->Search->Type == "Topics") {
                 $Discussion = $this->Context->ObjectFactory->NewObject($this->Context, "Discussion");
                 while ($Row = $this->Context->Database->GetRow($this->Data)) {
                     $Discussion->Clear();
                     $Discussion->GetPropertiesFromDataSet($Row);
                     $Discussion->FormatPropertiesForDisplay();
                     $Discussion->ForceNameSpaces();
                     if ($Counter < agSEARCH_RESULTS_PER_PAGE) {
                         $this->Context->Writer->Add(GetDiscussion($this->Context, $Discussion, $FirstRow));
                     }
                     $FirstRow = 0;
                     $Counter++;
                 }
             } elseif ($this->Search->Type == "Comments") {
                 $Comment = $this->Context->ObjectFactory->NewObject($this->Context, "Comment");
                 $HighlightWords = ParseQueryForHighlighting($this->Context, $this->Search->Query);
                 while ($Row = $this->Context->Database->GetRow($this->Data)) {
                     $Comment->Clear();
                     $Comment->GetPropertiesFromDataSet($Row, $this->Context->Session->UserID);
                     $Comment->FormatPropertiesForSafeDisplay();
                     if ($Counter < agSEARCH_RESULTS_PER_PAGE) {
                         $this->Context->Writer->Add(GetCommentResult($this->Context, $Comment, $HighlightWords, $FirstRow));
                     }
                     $FirstRow = 0;
                     $Counter++;
                 }
             } else {
                 $u = $this->Context->ObjectFactory->NewContextObject($this->Context, "User");
                 while ($Row = $this->Context->Database->GetRow($this->Data)) {
                     $Switch = $Switch == 1 ? 0 : 1;
                     $u->Clear();
                     $u->GetPropertiesFromDataSet($Row);
                     $u->FormatPropertiesForDisplay();
                     if ($Counter < agSEARCH_RESULTS_PER_PAGE) {
                         $ShowIcon = $u->DisplayIcon != "" && $this->Context->Session->User->Setting("HtmlOn", 1);
                         $this->Context->Writer->Add("<dl class=\"User" . ($Switch == 1 ? "" : "Alternate") . ($FirstRow ? " FirstUser" : "") . "\">\r\n\t\t\t\t\t\t\t\t<dt class=\"DataItemLabel SearchUserLabel\">" . $this->Context->GetDefinition("User") . "</dt>\r\n\t\t\t\t\t\t\t\t<dd class=\"DataItem SearchUser" . ($ShowIcon ? " SearchUserWithIcon" : "") . "\">");
                         if ($ShowIcon) {
                             $this->Context->Writer->Add("<span class=\"SearchIcon\" style=\"background-image:url('" . $u->DisplayIcon . "');\"></span>");
                         }
                         $this->Context->Writer->Add("<a href=\"account.php?u=" . $u->UserID . "\">" . $u->Name . "</a> (" . $u->Role . ")\r\n\t\t\t\t\t\t\t\t</dd>\r\n\t\t\t\t\t\t\t\t<dt class=\"MetaItemLabel SearchUserInformationLabel SearchUserAccountCreatedLabel\">" . $this->Context->GetDefinition("AccountCreated") . "</dt>\r\n\t\t\t\t\t\t\t\t<dd class=\"MetaItem SearchUserInformation SearchUserAccountCreated\">" . TimeDiff($u->DateFirstVisit, mktime()) . "</dd>\r\n\t\t\t\t\t\t\t\t<dt class=\"MetaItemLabel SearchUserInformationLabel SearchUserLastActiveLabel\">" . $this->Context->GetDefinition("LastActive") . "</dt>\r\n\t\t\t\t\t\t\t\t<dd class=\"MetaItem SearchUserInformation SearchUserLastActive\">" . TimeDiff($u->DateLastActive, mktime()) . "</dd>\r\n\t\t\t\t\t\t\t\t<dt class=\"MetaItemLabel SearchUserInformationLabel SearchUserVisitCountLabel\">" . $this->Context->GetDefinition("VisitCount") . "</dt>\r\n\t\t\t\t\t\t\t\t<dd class=\"MetaItem SearchUserInformation SearchUserVisitCount\">" . $u->CountVisit . "</dd>\r\n\t\t\t\t\t\t\t\t<dt class=\"MetaItemLabel SearchUserInformationLabel SearchUserDiscussionsCreatedLabel\">" . $this->Context->GetDefinition("DiscussionsCreated") . "</dt>\r\n\t\t\t\t\t\t\t\t<dd class=\"MetaItem SearchUserInformation SearchUserDiscussionsCreated\">" . $u->CountDiscussions . "</dd>\r\n\t\t\t\t\t\t\t\t<dt class=\"MetaItemLabel SearchUserInformationLabel SearchUserCommentsAddedLabel\">" . $this->Context->GetDefinition("CommentsAdded") . "</dt>\r\n\t\t\t\t\t\t\t\t<dd class=\"MetaItem SearchUserInformation SearchUserCommentsAdded\">" . $u->CountComments . "</dd>\r\n\t\t\t\t\t\t\t</dl>");
                     }
                     $FirstRow = 0;
                     $Counter++;
                 }
             }
         }
         if ($this->DataCount > 0) {
             $this->Context->Writer->Add($this->PageList . $this->PageDetails . "<a class=\"PageJump Top\" href=\"#pgtop\">" . $this->Context->GetDefinition("TopOfPage") . "</a>");
         }
     }
     $this->Context->Writer->Write();
 }