当前位置: 首页>>代码示例>>PHP>>正文


PHP DiscussionModel::Get方法代码示例

本文整理汇总了PHP中DiscussionModel::Get方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussionModel::Get方法的具体用法?PHP DiscussionModel::Get怎么用?PHP DiscussionModel::Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DiscussionModel的用法示例。


在下文中一共展示了DiscussionModel::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Build

 protected function Build()
 {
     $DiscussionModel = new DiscussionModel();
     $Offset = 0;
     $Limit = 1000;
     while ($Discussions = $DiscussionModel->Get($Offset, $Limit)) {
         if (!$Discussions->NumRows()) {
             break;
         }
         $Offset += $Discussions->NumRows();
         $Day = 24 * 3600;
         $Week = 7 * $Day;
         $Month = 4 * $Week;
         $Year = 12 * $Month;
         $PriorityMatrix = array('hourly' => 1, 'daily' => 0.8, 'weekly' => 0.6, 'monthly' => 0.4, 'yearly' => 0.2);
         while ($Discussion = $Discussions->NextRow()) {
             $ChangeFreq = 'hourly';
             $DiffDate = time() - strtotime($Discussion->DateLastComment);
             $Priority = 1;
             if ($DiffDate < $Day) {
                 $ChangeFreq = 'hourly';
             } elseif ($DiffDate < $Week) {
                 $ChangeFreq = 'daily';
             } elseif ($DiffDate < $Month) {
                 $ChangeFreq = 'weekly';
             } elseif ($DiffDate < $Year) {
                 $ChangeFreq = 'monthly';
             } else {
                 $ChangeFreq = 'yearly';
             }
             $this->MapItem(DiscussionLink($Discussion, FALSE), date('Y-m-d', strtotime($Discussion->DateLastComment)), $ChangeFreq, $PriorityMatrix[$ChangeFreq]);
         }
     }
     $this->WriteIndex();
 }
开发者ID:ru4,项目名称:arabbnota,代码行数:35,代码来源:class.sitemaps.plugin.php

示例2: GetData

   public function GetData($Limit = 10) {
      $this->Data = FALSE;
      if (Gdn::Session()->IsValid() && C('Vanilla.Modules.ShowBookmarkedModule', TRUE)) {
         $BookmarkIDs = Gdn::SQL()
            ->Select('DiscussionID')
            ->From('UserDiscussion')
            ->Where('UserID', Gdn::Session()->UserID)
            ->Where('Bookmarked', 1)
            ->Get()->ResultArray();
         $BookmarkIDs = ConsolidateArrayValuesByKey($BookmarkIDs, 'DiscussionID');

         if (count($BookmarkIDs)) {
            $DiscussionModel = new DiscussionModel();
            DiscussionModel::CategoryPermissions();

            $DiscussionModel->SQL->WhereIn('d.DiscussionID', $BookmarkIDs);
            
            $this->Data = $DiscussionModel->Get(
               0,
               $Limit
            );
         } else {
            $this->Data = FALSE;
         }
      }
   }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:26,代码来源:class.bookmarkedmodule.php

示例3: GetData

 public function GetData($Limit = 10)
 {
     $Session = Gdn::Session();
     if ($Session->IsValid()) {
         $DiscussionModel = new DiscussionModel();
         $this->_DiscussionData = $DiscussionModel->Get(0, $Limit, array('w.Bookmarked' => '1', 'w.UserID' => $Session->UserID));
     }
 }
开发者ID:kidmax,项目名称:Garden,代码行数:8,代码来源:class.bookmarkedmodule.php

示例4: GetData

 public function GetData($Limit = FALSE)
 {
     if (!$Limit) {
         $Limit = $this->Limit;
     }
     $DiscussionModel = new DiscussionModel();
     $this->SetData('Discussions', $DiscussionModel->Get(0, $Limit, array('Announce' => 'all')));
 }
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:8,代码来源:class.discussionsmodule.php

示例5: DiscussionsController_Tagged_Create

 /**
  * Load discussions for a specific tag.
  */
 public function DiscussionsController_Tagged_Create($Sender)
 {
     $Offset = GetValue('1', $Sender->RequestArgs, 'p1');
     list($Offset, $Limit) = OffsetLimit($Offset, Gdn::Config('Vanilla.Discussions.PerPage', 30));
     $Sender->Tag = GetValue('0', $Sender->RequestArgs, '');
     $Sender->Title(T('Tagged with ') . $Sender->Tag);
     $Sender->Head->Title($Sender->Head->Title());
     $Sender->CanonicalUrl(Url(ConcatSep('/', 'discussions/tagged/' . $Sender->Tag, PageNumber($Offset, $Limit, TRUE)), TRUE));
     if ($Sender->Head) {
         $Sender->AddJsFile('discussions.js');
         $Sender->AddJsFile('bookmark.js');
         $Sender->AddJsFile('js/library/jquery.menu.js');
         $Sender->AddJsFile('options.js');
         $Sender->Head->AddRss($Sender->SelfUrl . '/feed.rss', $Sender->Head->Title());
     }
     if (!is_numeric($Offset) || $Offset < 0) {
         $Offset = 0;
     }
     // Add Modules
     $Sender->AddModule('NewDiscussionModule');
     $BookmarkedModule = new BookmarkedModule($Sender);
     $BookmarkedModule->GetData();
     $Sender->AddModule($BookmarkedModule);
     $Sender->SetData('Category', FALSE, TRUE);
     $DiscussionModel = new DiscussionModel();
     $Tag = $DiscussionModel->SQL->Select()->From('Tag')->Where('Name', $Sender->Tag)->Get()->FirstRow();
     $TagID = $Tag ? $Tag->TagID : 0;
     $CountDiscussions = $Tag ? $Tag->CountDiscussions : 0;
     $Sender->SetData('CountDiscussions', $CountDiscussions);
     $Sender->AnnounceData = FALSE;
     $Sender->SetData('Announcements', array(), TRUE);
     $DiscussionModel->FilterToTagID = $TagID;
     $Sender->DiscussionData = $DiscussionModel->Get($Offset, $Limit);
     $Sender->SetData('Discussions', $Sender->DiscussionData, TRUE);
     $Sender->SetJson('Loading', $Offset . ' to ' . $Limit);
     // Build a pager.
     $PagerFactory = new Gdn_PagerFactory();
     $Sender->Pager = $PagerFactory->GetPager('Pager', $Sender);
     $Sender->Pager->ClientID = 'Pager';
     $Sender->Pager->Configure($Offset, $Limit, $CountDiscussions, 'discussions/tagged/' . $Sender->Tag . '/%1$s');
     // Deliver json data if necessary
     if ($Sender->DeliveryType() != DELIVERY_TYPE_ALL) {
         $Sender->SetJson('LessRow', $Sender->Pager->ToString('less'));
         $Sender->SetJson('MoreRow', $Sender->Pager->ToString('more'));
         $Sender->View = 'discussions';
     }
     // Set a definition of the user's current timezone from the db. jQuery
     // will pick this up, compare to the browser, and update the user's
     // timezone if necessary.
     $CurrentUser = Gdn::Session()->User;
     if (is_object($CurrentUser)) {
         $ClientHour = $CurrentUser->HourOffset + date('G', time());
         $Sender->AddDefinition('SetClientHour', $ClientHour);
     }
     // Render the controller
     $Sender->Render(PATH_PLUGINS . '/Tagging/views/taggeddiscussions.php');
 }
开发者ID:nickhx,项目名称:Garden,代码行数:60,代码来源:class.tagging.plugin.php

示例6: GetData

 public function GetData()
 {
     if (Gdn::Session()->IsValid()) {
         $BookmarkIDs = Gdn::SQL()->Select('DiscussionID')->From('UserDiscussion')->Where('UserID', Gdn::Session()->UserID)->Where('Bookmarked', 1)->Get()->ResultArray();
         $BookmarkIDs = ConsolidateArrayValuesByKey($BookmarkIDs, 'DiscussionID');
         if (count($BookmarkIDs)) {
             $DiscussionModel = new DiscussionModel();
             DiscussionModel::CategoryPermissions();
             $DiscussionModel->SQL->WhereIn('d.DiscussionID', $BookmarkIDs);
             $Bookmarks = $DiscussionModel->Get(0, $this->Limit, array('w.Bookmarked' => '1'));
             $this->SetData('Bookmarks', $Bookmarks);
         } else {
             $this->SetData('Bookmarks', new Gdn_DataSet());
         }
     }
 }
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:16,代码来源:class.bookmarkedmodule.php

示例7: Index

 public function Index()
 {
     $Session = Gdn::Session();
     $categories = array();
     $discussionsPerCategory = 4;
     $DiscussionModel = new DiscussionModel();
     $this->CategoryData = $this->CategoryModel->GetFull();
     $this->CategoryDiscussionData = array();
     foreach ($this->CategoryData->Result() as $Category) {
         $this->Category = $Category;
         if ($Session->CheckPermission('Vanilla.Discussions.View', $this->Category->CategoryID)) {
             //TODO be nice if options could be passed to filter
             // discussions that are closed, sunk, etc etc...
             $this->DiscussionData = $DiscussionModel->Get(0, $discussionsPerCategory, array('d.CategoryID' => $Category->CategoryID));
             $category = array();
             foreach ($Category as $key => $value) {
                 $category[$key] = $value;
             }
             #$category["CategoryURL"] = Gdn::Config('Garden.Domain')."/categories/".$Category->UrlCode;
             $category["CategoryURL"] = Gdn::Request()->Domain() . "/categories/" . $Category->UrlCode;
             if ($this->DiscussionData->NumRows() > 0) {
                 $count = 0;
                 $discussion = array();
                 $category["discussions"] = array();
                 foreach ($this->DiscussionData->Result() as $Discussion) {
                     foreach ($Discussion as $key => $value) {
                         $discussion[$key] = $value;
                     }
                     //$discussion["DiscussionURL"] = Gdn::Config('Garden.Domain').'/discussion/'.$Discussion->DiscussionID.'/'.Gdn_Format::Url($Discussion->Name);
                     $discussion["DiscussionURL"] = Gdn::Request()->Domain() . '/discussion/' . $Discussion->DiscussionID . '/' . Gdn_Format::Url($Discussion->Name);
                     if ($count++ < $discussionsPerCategory) {
                         $category["discussions"][] = $discussion;
                     } else {
                         break;
                     }
                 }
             }
             $categories[] = $category;
         }
     }
     $this->SetJSON("categories", $categories);
     $this->Render();
 }
开发者ID:gregroiusairlangga,项目名称:vanilla-api-addon,代码行数:43,代码来源:class.categorycontroller.php

示例8: ProfileController_Discussions_Create

 public function ProfileController_Discussions_Create(&$Sender)
 {
     $UserReference = ArrayValue(0, $Sender->EventArguments, '');
     $Offset = ArrayValue(1, $Sender->EventArguments, 0);
     // Tell the ProfileController what tab to load
     $Sender->SetTabView($UserReference, 'Discussions', 'Profile', 'Discussions', 'Vanilla');
     // Load the data for the requested tab.
     if (!is_numeric($Offset) || $Offset < 0) {
         $Offset = 0;
     }
     $Limit = Gdn::Config('Vanilla.Discussions.PerPage', 30);
     $DiscussionModel = new DiscussionModel();
     $Sender->DiscussionData = $DiscussionModel->Get($Offset, $Limit, array('d.InsertUserID' => $Sender->User->UserID));
     $CountDiscussions = $Offset + $Sender->DiscussionData->NumRows();
     if ($Sender->DiscussionData->NumRows() == $Limit) {
         $CountDiscussions = $Offset + $Limit + 1;
     }
     // Build a pager
     $PagerFactory = new PagerFactory();
     $Sender->Pager = $PagerFactory->GetPager('MorePager', $Sender);
     $Sender->Pager->MoreCode = 'More Discussions';
     $Sender->Pager->LessCode = 'Newer Discussions';
     $Sender->Pager->ClientID = 'Pager';
     $Sender->Pager->Configure($Offset, $Limit, $CountDiscussions, 'profile/discussions/' . urlencode($Sender->User->Name) . '/%1$s/');
     // Deliver json data if necessary
     if ($Sender->DeliveryType() != DELIVERY_TYPE_ALL && $Offset > 0) {
         $Sender->SetJson('LessRow', $Sender->Pager->ToString('less'));
         $Sender->SetJson('MoreRow', $Sender->Pager->ToString('more'));
         $Sender->View = 'discussions';
     }
     // Set the handlertype back to normal on the profilecontroller so that it fetches it's own views
     $Sender->HandlerType = HANDLER_TYPE_NORMAL;
     // Do not show discussion options
     $Sender->ShowOptions = FALSE;
     // Render the ProfileController
     $Sender->Render();
 }
开发者ID:kidmax,项目名称:Garden,代码行数:37,代码来源:hooks.php

示例9: DiscussionsController_Tagged_Create

 /**
  * Load discussions for a specific tag.
  */
 public function DiscussionsController_Tagged_Create($Sender)
 {
     if ($Sender->Request->Get('Tag')) {
         $Tag = $Sender->Request->Get('Tag');
         $Page = GetValue('0', $Sender->RequestArgs, 'p1');
     } else {
         $Tag = urldecode(GetValue('0', $Sender->RequestArgs, ''));
         $Page = GetValue('1', $Sender->RequestArgs, 'p1');
     }
     if ($Sender->Request->Get('Page')) {
         $Page = $Sender->Request->Get('Page');
     }
     $Tag = StringEndsWith($Tag, '.rss', TRUE, TRUE);
     list($Offset, $Limit) = OffsetLimit($Page, Gdn::Config('Vanilla.Discussions.PerPage', 30));
     $Sender->SetData('Tag', $Tag, TRUE);
     $Sender->Title(T('Tagged with ') . htmlspecialchars($Tag));
     $Sender->Head->Title($Sender->Head->Title());
     if (urlencode($Tag) == $Tag) {
         $Sender->CanonicalUrl(Url(ConcatSep('/', 'discussions/tagged/' . urlencode($Tag), PageNumber($Offset, $Limit, TRUE)), TRUE));
     } else {
         $Sender->CanonicalUrl(Url(ConcatSep('/', 'discussions/tagged', PageNumber($Offset, $Limit, TRUE)) . '?Tag=' . urlencode($Tag), TRUE));
     }
     if ($Sender->Head) {
         $Sender->AddJsFile('discussions.js');
         $Sender->AddJsFile('bookmark.js');
         $Sender->AddJsFile('js/library/jquery.menu.js');
         $Sender->AddJsFile('options.js');
         $Sender->Head->AddRss($Sender->SelfUrl . '/feed.rss', $Sender->Head->Title());
     }
     if (!is_numeric($Offset) || $Offset < 0) {
         $Offset = 0;
     }
     // Add Modules
     $Sender->AddModule('NewDiscussionModule');
     $BookmarkedModule = new BookmarkedModule($Sender);
     $BookmarkedModule->GetData();
     $Sender->AddModule($BookmarkedModule);
     $Sender->SetData('Category', FALSE, TRUE);
     $Sender->SetData('CountDiscussions', FALSE);
     $Sender->AnnounceData = FALSE;
     $Sender->SetData('Announcements', array(), TRUE);
     $DiscussionModel = new DiscussionModel();
     $this->_SetTagSql($DiscussionModel->SQL, $Tag, $Limit, $Offset, $Sender->Request->Get('op', 'or'));
     $Sender->DiscussionData = $DiscussionModel->Get(FALSE);
     $Sender->SetData('Discussions', $Sender->DiscussionData, TRUE);
     $Sender->SetJson('Loading', $Offset . ' to ' . $Limit);
     // Build a pager.
     $PagerFactory = new Gdn_PagerFactory();
     $Sender->Pager = $PagerFactory->GetPager('Pager', $Sender);
     $Sender->Pager->ClientID = 'Pager';
     if (urlencode($Sender->Tag) == $Sender->Tag) {
         $PageUrlFormat = "discussions/tagged/{$Sender->Tag}/{Page}";
     } else {
         $PageUrlFormat = 'discussions/tagged/{Page}?Tag=' . urlencode($Sender->Tag);
     }
     $Sender->Pager->Configure($Offset, $Limit, FALSE, $PageUrlFormat);
     // Deliver json data if necessary.
     if ($Sender->DeliveryType() != DELIVERY_TYPE_ALL) {
         $Sender->SetJson('LessRow', $Sender->Pager->ToString('less'));
         $Sender->SetJson('MoreRow', $Sender->Pager->ToString('more'));
         $Sender->View = 'discussions';
     }
     // Set a definition of the user's current timezone from the db. jQuery
     // will pick this up, compare to the browser, and update the user's
     // timezone if necessary.
     $CurrentUser = Gdn::Session()->User;
     if (is_object($CurrentUser)) {
         $ClientHour = $CurrentUser->HourOffset + date('G', time());
         $Sender->AddDefinition('SetClientHour', $ClientHour);
     }
     // Render the controller
     $Sender->Render('TaggedDiscussions', '', 'plugins/Tagging');
 }
开发者ID:ru4,项目名称:arabbnota,代码行数:76,代码来源:class.tagging.plugin.php

示例10: Mine

 public function Mine($Offset = '0')
 {
     $this->Permission('Garden.SignIn.Allow');
     if (!is_numeric($Offset) || $Offset < 0) {
         $Offset = 0;
     }
     $Limit = Gdn::Config('Vanilla.Discussions.PerPage', 30);
     $Session = Gdn::Session();
     $Wheres = array('d.InsertUserID' => $Session->UserID);
     $DiscussionModel = new DiscussionModel();
     $this->DiscussionData = $DiscussionModel->Get($Offset, $Limit, $Wheres);
     $this->SetData('Discussions', $this->DiscussionData);
     $CountDiscussions = $this->SetData('CountDiscussions', $DiscussionModel->GetCount($Wheres));
     // Build a pager
     $PagerFactory = new Gdn_PagerFactory();
     $this->Pager = $PagerFactory->GetPager('MorePager', $this);
     $this->Pager->MoreCode = 'More Discussions';
     $this->Pager->LessCode = 'Newer Discussions';
     $this->Pager->ClientID = 'Pager';
     $this->Pager->Configure($Offset, $Limit, $CountDiscussions, 'discussions/mine/%1$s');
     // 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 = 'discussions';
     }
     // Add Modules
     $this->AddModule('NewDiscussionModule');
     $this->AddModule('CategoriesModule');
     $BookmarkedModule = new BookmarkedModule($this);
     $BookmarkedModule->GetData();
     $this->AddModule($BookmarkedModule);
     // Render the controller
     $this->Render();
 }
开发者ID:kerphi,项目名称:Garden,代码行数:35,代码来源:class.discussionscontroller.php

示例11: DiscussionsController_Unanswered_Create

 /**
  * Unanswered discussions list.
  */
 public function DiscussionsController_Unanswered_Create($Sender, $Args)
 {
     $Sender->Permission('Garden.Moderation.Manage');
     $Page = ArrayValue(0, $Args, 0);
     // Determine offset from $Page
     list($Page, $Limit) = OffsetLimit($Page, C('Vanilla.Discussions.PerPage', 30));
     // Validate $Page
     if (!is_numeric($Page) || $Page < 0) {
         $Page = 0;
     }
     $DiscussionModel = new DiscussionModel();
     $Wheres = array('d.Answered' => '0');
     $Sender->DiscussionData = $DiscussionModel->Get($Page, $Limit, $Wheres);
     $Sender->SetData('Discussions', $Sender->DiscussionData);
     $CountDiscussions = $DiscussionModel->GetCount($Wheres);
     $Sender->SetData('CountDiscussions', $CountDiscussions);
     $Sender->Category = FALSE;
     $Sender->SetJson('Loading', $Page . ' to ' . $Limit);
     // Build a pager
     $PagerFactory = new Gdn_PagerFactory();
     $Sender->EventArguments['PagerType'] = 'Pager';
     $Sender->FireEvent('BeforeBuildBookmarkedPager');
     $Sender->Pager = $PagerFactory->GetPager($Sender->EventArguments['PagerType'], $Sender);
     $Sender->Pager->ClientID = 'Pager';
     $Sender->Pager->Configure($Page, $Limit, $CountDiscussions, 'discussions/unanswered/%1$s');
     if (!$Sender->Data('_PagerUrl')) {
         $Sender->SetData('_PagerUrl', 'discussions/unanswered/{Page}');
     }
     $Sender->SetData('_Page', $Page);
     $Sender->SetData('_Limit', $Limit);
     $Sender->FireEvent('AfterBuildBookmarkedPager');
     // Deliver JSON data if necessary
     if ($Sender->DeliveryType() != DELIVERY_TYPE_ALL) {
         $Sender->SetJson('LessRow', $Sender->Pager->ToString('less'));
         $Sender->SetJson('MoreRow', $Sender->Pager->ToString('more'));
         $Sender->View = 'discussions';
     }
     // Add modules
     $Sender->AddModule('DiscussionFilterModule');
     $Sender->AddModule('NewDiscussionModule');
     $Sender->AddModule('CategoriesModule');
     // Render default view (discussions/bookmarked.php)
     $Sender->SetData('Title', T('Unanswered'));
     $Sender->SetData('Breadcrumbs', array(array('Name' => T('Unanswered'), 'Url' => '/discussions/unanswered')));
     $Sender->Render('index');
 }
开发者ID:nilsen,项目名称:addons,代码行数:49,代码来源:class.supporttracker.plugin.php

示例12: Mine

 /**
  * Display discussions started by the user.
  *
  * @since 2.0.0
  * @access public
  *
  * @param int $Offset Number of discussions to skip.
  */
 public function Mine($Page = 'p1')
 {
     $this->Permission('Garden.SignIn.Allow');
     Gdn_Theme::Section('DiscussionList');
     // Set criteria & get discussions data
     list($Offset, $Limit) = OffsetLimit($Page, C('Vanilla.Discussions.PerPage', 30));
     $Session = Gdn::Session();
     $Wheres = array('d.InsertUserID' => $Session->UserID);
     $DiscussionModel = new DiscussionModel();
     $this->DiscussionData = $DiscussionModel->Get($Offset, $Limit, $Wheres);
     $this->SetData('Discussions', $this->DiscussionData);
     $CountDiscussions = $this->SetData('CountDiscussions', $DiscussionModel->GetCount($Wheres));
     $this->View = 'index';
     if (C('Vanilla.Discussions.Layout') === 'table') {
         $this->View = 'table';
     }
     // Build a pager
     $PagerFactory = new Gdn_PagerFactory();
     $this->EventArguments['PagerType'] = 'MorePager';
     $this->FireEvent('BeforeBuildMinePager');
     $this->Pager = $PagerFactory->GetPager($this->EventArguments['PagerType'], $this);
     $this->Pager->MoreCode = 'More Discussions';
     $this->Pager->LessCode = 'Newer Discussions';
     $this->Pager->ClientID = 'Pager';
     $this->Pager->Configure($Offset, $Limit, $CountDiscussions, 'discussions/mine/%1$s');
     $this->SetData('_PagerUrl', 'discussions/mine/{Page}');
     $this->SetData('_Page', $Page);
     $this->SetData('_Limit', $Limit);
     $this->FireEvent('AfterBuildMinePager');
     // 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 = 'discussions';
     }
     // Add modules
     $this->AddModule('DiscussionFilterModule');
     $this->AddModule('NewDiscussionModule');
     $this->AddModule('CategoriesModule');
     $this->AddModule('BookmarkedModule');
     // Render view
     $this->SetData('Title', T('My Discussions'));
     $this->SetData('Breadcrumbs', array(array('Name' => T('My Discussions'), 'Url' => '/discussions/mine')));
     $this->Render();
 }
开发者ID:3marproof,项目名称:vanilla,代码行数:53,代码来源:class.discussionscontroller.php

示例13: Mine

 public function Mine($Offset = '0')
 {
     $this->Permission('Garden.SignIn.Allow');
     if ($this->Head) {
         $this->Head->AddScript('/js/library/jquery.resizable.js');
         $this->Head->AddScript('/js/library/jquery.ui.packed.js');
         $this->Head->AddScript('/applications/vanilla/js/bookmark.js');
         $this->Head->AddScript('/applications/vanilla/js/discussions.js');
         $this->Head->AddScript('/applications/vanilla/js/options.js');
     }
     if (!is_numeric($Offset) || $Offset < 0) {
         $Offset = 0;
     }
     $Limit = Gdn::Config('Vanilla.Discussions.PerPage', 30);
     $Session = Gdn::Session();
     $Wheres = array('d.InsertUserID' => $Session->UserID);
     $DiscussionModel = new DiscussionModel();
     $this->SetData('DiscussionData', $DiscussionModel->Get($Offset, $Limit, $Wheres), TRUE);
     $CountDiscussions = $this->SetData('CountDiscussions', $DiscussionModel->GetCount($Wheres));
     // Build a pager
     $PagerFactory = new PagerFactory();
     $this->Pager = $PagerFactory->GetPager('MorePager', $this);
     $this->Pager->MoreCode = 'More Discussions';
     $this->Pager->LessCode = 'Newer Discussions';
     $this->Pager->Wrapper = '<li %1$s>%2$s</li>';
     $this->Pager->ClientID = 'Pager';
     $this->Pager->Configure($Offset, $Limit, $CountDiscussions, 'discussions/mine/%1$s');
     // 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 = 'discussions';
     }
     // Add Modules
     $this->AddModule('NewDiscussionModule');
     $this->AddModule('CategoriesModule');
     $BookmarkedModule = new BookmarkedModule($this);
     $BookmarkedModule->GetData();
     $this->AddModule($BookmarkedModule);
     $DraftsModule = new DraftsModule($this);
     $DraftsModule->GetData();
     $this->AddModule($DraftsModule);
     // Render the controller
     $this->Render();
 }
开发者ID:kidmax,项目名称:Garden,代码行数:45,代码来源:discussions.php

示例14: Discussions

 /**
  * Show all categories and few discussions from each.
  * 
  * @since 2.0.0
  * @access public
  */
 public function Discussions()
 {
     // Setup head
     $this->AddCssFile('vanilla.css');
     $this->Menu->HighlightRoute('/discussions');
     $this->AddJsFile('bookmark.js');
     $this->AddJsFile('discussions.js');
     $this->AddJsFile('options.js');
     $Title = C('Garden.HomepageTitle');
     if ($Title) {
         $this->Title($Title, '');
     } else {
         $this->Title(T('All Categories'));
     }
     $this->Description(C('Garden.Description', NULL));
     Gdn_Theme::Section('CategoryDiscussionList');
     // Set the category follow toggle before we load category data so that it affects the category query appropriately.
     $CategoryFollowToggleModule = new CategoryFollowToggleModule($this);
     $CategoryFollowToggleModule->SetToggle();
     // Get category data and discussions
     $this->DiscussionsPerCategory = C('Vanilla.Discussions.PerCategory', 5);
     $DiscussionModel = new DiscussionModel();
     $this->CategoryModel->Watching = !Gdn::Session()->GetPreference('ShowAllCategories');
     $this->CategoryData = $this->CategoryModel->GetFull();
     $this->SetData('Categories', $this->CategoryData);
     $this->CategoryDiscussionData = array();
     foreach ($this->CategoryData->Result() as $Category) {
         if ($Category->CategoryID > 0) {
             $this->CategoryDiscussionData[$Category->CategoryID] = $DiscussionModel->Get(0, $this->DiscussionsPerCategory, array('d.CategoryID' => $Category->CategoryID, 'Announce' => 'all'));
         }
     }
     // Add modules
     $this->AddModule('NewDiscussionModule');
     $this->AddModule('DiscussionFilterModule');
     $this->AddModule('CategoriesModule');
     $this->AddModule('BookmarkedModule');
     $this->AddModule($CategoryFollowToggleModule);
     // Set view and render
     $this->View = 'discussions';
     $this->CanonicalUrl(Url('/categories', TRUE));
     include_once $this->FetchViewLocation('helper_functions', 'discussions');
     $this->Render();
 }
开发者ID:remobjects,项目名称:Garden,代码行数:49,代码来源:class.categoriescontroller.php

示例15: GetDiscussions

 public function GetDiscussions($Tag, $Limit, $Offset, $Op = 'or')
 {
     $DiscussionModel = new DiscussionModel();
     $this->SetTagSql($DiscussionModel->SQL, $Tag, $Limit, $Offset, $Op);
     $Result = $DiscussionModel->Get($Offset, $Limit, array('Announce' => 'all'));
     return $Result;
 }
开发者ID:3marproof,项目名称:vanilla,代码行数:7,代码来源:class.tagmodel.php


注:本文中的DiscussionModel::Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。