• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP DiscussionModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了DiscussionModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: DiscussionsController_Participated_Create

 public function DiscussionsController_Participated_Create(&$Sender, $Args)
 {
     $Sender->Permission('Garden.SignIn.Allow');
     $Page = GetValue(0, $Args);
     $Limit = GetValue(1, $Args);
     list($Offset, $Limit) = OffsetLimit($Page, Gdn::Config('Vanilla.Discussions.PerPage', 30));
     // Get Discussions
     $DiscussionModel = new DiscussionModel();
     $Sender->DiscussionData = $DiscussionModel->GetParticipated(Gdn::Session()->UserID, $Offset, $Limit);
     $Sender->SetData('Discussions', $Sender->DiscussionData);
     $CountDiscussions = $DiscussionModel->GetCountParticipated(Gdn::Session()->UserID);
     $Sender->SetData('CountDiscussions', $CountDiscussions);
     // Build a pager
     $PagerFactory = new Gdn_PagerFactory();
     $Sender->EventArguments['PagerType'] = 'Pager';
     $Sender->FireEvent('BeforeBuildPager');
     $Sender->Pager = $PagerFactory->GetPager($Sender->EventArguments['PagerType'], $Sender);
     $Sender->Pager->ClientID = 'Pager';
     $Sender->Pager->Configure($Offset, $Limit, $CountDiscussions, 'discussions/participated/%1$s');
     $Sender->FireEvent('AfterBuildPager');
     // 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('NewDiscussionModule');
     $Sender->AddModule('CategoriesModule');
     $BookmarkedModule = new BookmarkedModule($Sender);
     $BookmarkedModule->GetData();
     $Sender->AddModule($BookmarkedModule);
     $Sender->Render($this->GetView('participated.php'));
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:34,代码来源:class.participated.plugin.php


示例4: pluginController_quoteMention_create

 public function pluginController_quoteMention_create($sender, $discussionID, $commentID, $username)
 {
     $sender->deliveryMethod(DELIVERY_METHOD_JSON);
     $user = Gdn::userModel()->getByUsername($username);
     $discussionModel = new DiscussionModel();
     $discussion = $discussionModel->getID($discussionID);
     if (!$user || !$discussion) {
         throw notFoundException();
     }
     // Make sure this endpoint can't be used to snoop around.
     $sender->permission('Vanilla.Discussions.View', true, 'Category', $discussion->PermissionCategoryID);
     // Find the previous comment of the mentioned user in this discussion.
     $item = Gdn::sql()->getWhere('Comment', ['DiscussionID' => $discussion->DiscussionID, 'InsertUserID' => $user->UserID, 'CommentID <' => $commentID], 'CommentID', 'desc', 1)->firstRow();
     // The items ID in the DOM used for highlighting.
     if ($item) {
         $target = '#Comment_' . $item->CommentID;
         // The mentioned user might be the discussion creator.
     } elseif ($discussion->InsertUserID == $user->UserID) {
         $item = $discussion;
         $target = '#Discussion_' . $item->DiscussionID;
     }
     if (!$item) {
         // A success response code always means that a comment was found.
         $sender->statusCode(404);
     }
     $sender->renderData($item ? ['html' => nl2br(sliceString(Gdn_Format::plainText($item->Body, $item->Format), c('QuoteMention.MaxLength', 400))), 'target' => $target] : []);
 }
开发者ID:bleistivt,项目名称:quotemention,代码行数:27,代码来源:class.quotemention.plugin.php


示例5: 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


示例6: 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


示例7: Advanced

	/**
    * Advanced settings.
    *
    * Allows setting configuration values via form elements.
    * 
    * @since 2.0.0
    * @access public
    */
	public function Advanced() {
	   // Check permission
      $this->Permission('Vanilla.Settings.Manage');
		
		// Load up config options we'll be setting
		$Validation = new Gdn_Validation();
      $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
      $ConfigurationModel->SetField(array(
         'Vanilla.Discussions.PerPage',
         'Vanilla.Comments.AutoRefresh',
         'Vanilla.Comments.PerPage',
         'Vanilla.Archive.Date',
			'Vanilla.Archive.Exclude',
			'Garden.EditContentTimeout'
      ));
      
      // Set the model on the form.
      $this->Form->SetModel($ConfigurationModel);
      
      // If seeing the form for the first time...
      if ($this->Form->AuthenticatedPostBack() === FALSE) {
         // Apply the config settings to the form.
         $this->Form->SetData($ConfigurationModel->Data);
		} else {
         // Define some validation rules for the fields being saved
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Discussions.PerPage', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Discussions.PerPage', 'Integer');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comments.AutoRefresh', 'Integer');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comments.PerPage', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comments.PerPage', 'Integer');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Archive.Date', 'Date');
			$ConfigurationModel->Validation->ApplyRule('Garden.EditContentTimeout', 'Integer');
			
			// Grab old config values to check for an update.
			$ArchiveDateBak = Gdn::Config('Vanilla.Archive.Date');
			$ArchiveExcludeBak = (bool)Gdn::Config('Vanilla.Archive.Exclude');
			
			// Save new settings
			$Saved = $this->Form->Save();
			if($Saved) {
				$ArchiveDate = Gdn::Config('Vanilla.Archive.Date');
				$ArchiveExclude = (bool)Gdn::Config('Vanilla.Archive.Exclude');
				
				if($ArchiveExclude != $ArchiveExcludeBak || ($ArchiveExclude && $ArchiveDate != $ArchiveDateBak)) {
					$DiscussionModel = new DiscussionModel();
					$DiscussionModel->UpdateDiscussionCount('All');
				}
            $this->InformMessage(T("Your changes have been saved."));
			}
		}
		
      $this->AddSideMenu('vanilla/settings/advanced');
      $this->AddJsFile('settings.js');
      $this->Title(T('Advanced Forum Settings'));
		
		// Render default view (settings/advanced.php)
		$this->Render();
	}
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:66,代码来源:class.settingscontroller.php


示例8: 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


示例9: gdn_dispatcher_notFound_handler

 /**
  * Use 404 handler to look for a SimplePage.
  */
 public function gdn_dispatcher_notFound_handler($dispatcher, $args)
 {
     $requestUri = Gdn::Request()->Path();
     $discussionModel = new DiscussionModel();
     $result = $discussionModel->GetWhere(array('Type' => 'SimplePage', 'ForeignID' => $requestUri))->FirstRow(DATASET_TYPE_ARRAY);
     // Page exists with requested slug, so dispatch; no redirect.
     if ($discussionID = val('DiscussionID', $result)) {
         SaveToConfig('SimplePage.Found', true, false);
         Gdn::Dispatcher()->Dispatch('/discussion/' . $discussionID);
         exit;
     }
 }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:15,代码来源:class.simplepages.plugin.php


示例10: CategoriesController_RefreshCounts_Create

 public function CategoriesController_RefreshCounts_Create($Sender)
 {
     $Sender->Permission('Vanilla.Categories.Manage');
     $DiscussionModel = new DiscussionModel();
     $CategoryModel = $Sender->CategoryModel;
     $Categories = $CategoryModel->GetAll();
     foreach ($Categories as $Category) {
         $CategoryID = $Category->CategoryID;
         $DiscussionModel->UpdateDiscussionCount($CategoryID);
     }
     // stash the inform message for later
     Gdn::Session()->Stash('RefreshCountsMessage', T('RefreshCounts.CatComplete'));
     Redirect('/vanilla/settings/managecategories');
 }
开发者ID:oMadMartigaNo,项目名称:readjust-forum,代码行数:14,代码来源:class.refreshcounts.plugin.php


示例11: getData

 /**
  * Get the data for the module.
  *
  * @param int|bool $limit Override the number of discussions to display.
  */
 public function getData($limit = false)
 {
     if (!$limit) {
         $limit = $this->Limit;
     }
     $discussionModel = new DiscussionModel();
     $categoryIDs = $this->getCategoryIDs();
     $where = array('Announce' => 'all');
     if ($categoryIDs) {
         $where['d.CategoryID'] = CategoryModel::filterCategoryPermissions($categoryIDs);
     } else {
         $discussionModel->Watching = true;
     }
     $this->setData('Discussions', $discussionModel->get(0, $limit, $where));
 }
开发者ID:sitexa,项目名称:vanilla,代码行数:20,代码来源:class.discussionsmodule.php


示例12: Award

 public function Award($Sender, $User, $Criteria)
 {
     $NecroDate = strtotime($Criteria->Duration . ' ' . $Criteria->Period . ' ago');
     // Get the last comment date from the parent discussion
     $Args = $Sender->EventArguments;
     $DiscussionID = $Args['FormPostValues']['DiscussionID'];
     $DiscussionModel = new DiscussionModel();
     $Discussion = $DiscussionModel->GetID($DiscussionID);
     $LastCommentDate = strtotime($Discussion->DateLastComment);
     if ($LastCommentDate < $NecroDate) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:hxii,项目名称:Application-Yaga,代码行数:15,代码来源:class.necropost.php


示例13: DiscussionController_AutoExpire_Create

 public function DiscussionController_AutoExpire_Create($Sender, $Args)
 {
     $DiscussionID = intval($Args[0]);
     $DiscussionModel = new DiscussionModel();
     $Discussion = $DiscussionModel->GetID($DiscussionID);
     if (!Gdn::Session()->CheckPermission('Vanilla.Discussions.Close', TRUE, 'Category', $Discussion->PermissionCategoryID)) {
         throw PermissionException('Vanilla.Discussions.Close');
     }
     if (strtolower($Args[1]) == 'reset') {
         Gdn::SQL()->Put('Discussion', array('AutoExpire' => 1, 'Closed' => 0, 'DateReOpened' => Gdn_Format::ToDateTime()), array('DiscussionID' => $DiscussionID));
     } else {
         $Expire = strtolower($Args[1]) == 'on' ? 1 : 0;
         Gdn::SQL()->Put('Discussion', array('AutoExpire' => $Expire), array('DiscussionID' => $DiscussionID));
     }
     Redirect('discussion/' . $DiscussionID . '/' . Gdn_Format::Url($Discussion->Name));
 }
开发者ID:x00,项目名称:AutoExpireDiscussions-Vanilla-Plugin,代码行数:16,代码来源:default.php


示例14: RefetchPageInfo

 /**
  * Re-fetch a discussion's content based on its foreign url.
  * @param type $DiscussionID
  */
 public function RefetchPageInfo($DiscussionID)
 {
     // Make sure we are posting back.
     if (!$this->Request->IsPostBack()) {
         throw PermissionException('Javascript');
     }
     // Grab the discussion.
     $Discussion = $this->DiscussionModel->GetID($DiscussionID);
     if (!$Discussion) {
         throw NotFoundException('Discussion');
     }
     // Make sure the user has permission to edit this discussion.
     $this->Permission('Vanilla.Discussions.Edit', TRUE, 'Category', $Discussion->PermissionCategoryID);
     $ForeignUrl = GetValueR('Attributes.ForeignUrl', $Discussion);
     if (!$ForeignUrl) {
         throw new Gdn_UserException(T("This discussion isn't associated with a url."));
     }
     $Stub = $this->DiscussionModel->FetchPageInfo($ForeignUrl, TRUE);
     //      decho($Stub);
     //      die();
     // Save the stub.
     $this->DiscussionModel->SetField($DiscussionID, (array) $Stub);
     // Send some of the stuff back.
     if (isset($Stub['Name'])) {
         $this->JsonTarget('.PageTitle h1', Gdn_Format::Text($Stub['Name']));
     }
     if (isset($Stub['Body'])) {
         $this->JsonTarget("#Discussion_{$DiscussionID} .Message", Gdn_Format::To($Stub['Body'], $Stub['Format']));
     }
     $this->InformMessage('The page was successfully fetched.');
     $this->Render('Blank', 'Utility', 'Dashboard');
 }
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:36,代码来源:class.discussioncontroller.php


示例15: 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:sitexa,项目名称:vanilla,代码行数:16,代码来源:class.bookmarkedmodule.php


示例16: refetchPageInfo

 /**
  * Re-fetch a discussion's content based on its foreign url.
  * @param type $DiscussionID
  */
 public function refetchPageInfo($DiscussionID)
 {
     // Make sure we are posting back.
     if (!$this->Request->isAuthenticatedPostBack(true)) {
         throw permissionException('Javascript');
     }
     // Grab the discussion.
     $Discussion = $this->DiscussionModel->getID($DiscussionID);
     if (!$Discussion) {
         throw notFoundException('Discussion');
     }
     // Make sure the user has permission to edit this discussion.
     $this->permission('Vanilla.Discussions.Edit', true, 'Category', $Discussion->PermissionCategoryID);
     $ForeignUrl = valr('Attributes.ForeignUrl', $Discussion);
     if (!$ForeignUrl) {
         throw new Gdn_UserException(t("This discussion isn't associated with a url."));
     }
     $Stub = $this->DiscussionModel->fetchPageInfo($ForeignUrl, true);
     // Save the stub.
     $this->DiscussionModel->setField($DiscussionID, (array) $Stub);
     // Send some of the stuff back.
     if (isset($Stub['Name'])) {
         $this->jsonTarget('.PageTitle h1', Gdn_Format::text($Stub['Name']));
     }
     if (isset($Stub['Body'])) {
         $this->jsonTarget("#Discussion_{$DiscussionID} .Message", Gdn_Format::to($Stub['Body'], $Stub['Format']));
     }
     $this->informMessage('The page was successfully fetched.');
     $this->render('Blank', 'Utility', 'Dashboard');
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:34,代码来源:class.discussioncontroller.php


示例17: Get

 public function Get($Begin, $End, $Offset = '0', $Limit = '')
 {
     // Validate parameters, set today as default
     $BeginDate = strtotime($Begin);
     if ($BeginDate <= 0) {
         $BeginDate = date('Y-m-d');
     } else {
         $BeginDate = date('Y-m-d', $BeginDate);
     }
     $EndDate = strtotime($End);
     if ($EndDate <= 0) {
         $EndDate = date('Y-m-d');
     } else {
         $EndDate = date('Y-m-d', $EndDate);
     }
     if (!is_numeric($Offset)) {
         $Offset = 0;
     }
     if (!is_numeric($Limit)) {
         $Limit = '';
     }
     $Sql = GDN::SQL();
     $Sql->Select('d.Name, d.Body, d.Format')->Select('d.InsertUserID', '', 'UserID')->Select('DAY FROM d.EventCalendarDate', 'EXTRACT', 'EventCalendarDay')->From('Discussion d')->Where('d.EventCalendarDate >=', $BeginDate)->Where('d.EventCalendarDate <=', $EndDate)->OrderBy('d.EventCalendarDate')->Limit($Limit, $Offset);
     // add permission restrictions if necessary
     $Perms = DiscussionModel::CategoryPermissions();
     if ($Perms !== TRUE) {
         $Sql->WhereIn('d.CategoryID', $Perms);
     }
     // return $Sql->GetSelect();
     return $Sql->Get()->ResultArray();
 }
开发者ID:shumoo,项目名称:EventCalendar,代码行数:31,代码来源:class.eventcalendarmodel.php


示例18: notifyNewDiscussion

 public function notifyNewDiscussion($DiscussionID)
 {
     if (!c('Vanilla.QueueNotifications')) {
         throw forbiddenException('NotifyNewDiscussion');
     }
     if (!$this->Request->isPostBack()) {
         throw forbiddenException('GET');
     }
     // Grab the discussion.
     $Discussion = $this->DiscussionModel->getID($DiscussionID);
     if (!$Discussion) {
         throw notFoundException('Discussion');
     }
     if (val('Notified', $Discussion) != ActivityModel::SENT_PENDING) {
         die('Not pending');
     }
     // Mark the notification as in progress.
     $this->DiscussionModel->setField($DiscussionID, 'Notified', ActivityModel::SENT_INPROGRESS);
     $discussionType = val('Type', $Discussion);
     if ($discussionType) {
         $Code = "HeadlineFormat.Discussion.{$discussionType}";
     } else {
         $Code = 'HeadlineFormat.Discussion';
     }
     $HeadlineFormat = t($Code, '{ActivityUserID,user} started a new discussion: <a href="{Url,html}">{Data.Name,text}</a>');
     $Category = CategoryModel::categories(val('CategoryID', $Discussion));
     $Activity = array('ActivityType' => 'Discussion', 'ActivityUserID' => $Discussion->InsertUserID, 'HeadlineFormat' => $HeadlineFormat, 'RecordType' => 'Discussion', 'RecordID' => $DiscussionID, 'Route' => DiscussionUrl($Discussion), 'Data' => array('Name' => $Discussion->Name, 'Category' => val('Name', $Category)));
     $ActivityModel = new ActivityModel();
     $this->DiscussionModel->NotifyNewDiscussion($Discussion, $ActivityModel, $Activity);
     $ActivityModel->SaveQueue();
     $this->DiscussionModel->setField($DiscussionID, 'Notified', ActivityModel::SENT_OK);
     die('OK');
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:33,代码来源:class.postcontroller.php


示例19: AddReplyButton

    protected function AddReplyButton($Sender)
    {
        if (!Gdn::Session()->UserID) {
            return;
        }
        if (isset($Sender->EventArguments['Comment'])) {
            $Model = new CommentModel();
            $Data = $Model->GetID($Sender->EventArguments['Comment']->CommentID);
        } else {
            $Model = new DiscussionModel();
            $Data = $Model->GetID($Sender->Data['Discussion']->DiscussionID);
        }
        $ReplyURL = "#" . "{$Data->InsertName}";
        $ReplyText = T('Reply');
        echo <<<QUOTE
      <span class="CommentReply"><a href="{$ReplyURL}">{$ReplyText}</a></span>
QUOTE;
    }
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:18,代码来源:class.reply.plugin.php


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP DiskDevice类代码示例发布时间:2022-05-23
下一篇:
PHP DiscussRouter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap