本文整理汇总了PHP中Gdn_Theme::Section方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Theme::Section方法的具体用法?PHP Gdn_Theme::Section怎么用?PHP Gdn_Theme::Section使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_Theme
的用法示例。
在下文中一共展示了Gdn_Theme::Section方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Initialize
/**
* Hightlight menu path. Automatically run on every use.
*
* @since 2.0.0
* @access public
*/
public function Initialize()
{
parent::Initialize();
Gdn_Theme::Section('Dashboard');
if ($this->Menu) {
$this->Menu->HighlightRoute('/dashboard/settings');
}
}
示例2: PluginController_FileUpload_Create
public function PluginController_FileUpload_Create($Sender)
{
$Sender->Title('FileUpload');
$Sender->AddSideMenu('plugin/fileupload');
Gdn_Theme::Section('Dashboard');
$Sender->Form = new Gdn_Form();
$this->EnableSlicing($Sender);
$this->Dispatch($Sender, $Sender->RequestArgs);
}
示例3: Initialize
public function Initialize()
{
parent::Initialize();
Gdn_Theme::Section('Dashboard');
$this->Model = new DBAModel();
$this->Form = new Gdn_Form();
$this->Form->InputPrefix = '';
$this->AddJsFile('dba.js');
}
示例4: Index
/**
* Default search functionality.
*
* @since 2.0.0
* @access public
* @param int $Page Page number.
*/
public function Index($Page = '')
{
$this->AddJsFile('search.js');
$this->Title(T('Search'));
SaveToConfig('Garden.Format.EmbedSize', '160x90', FALSE);
Gdn_Theme::Section('SearchResults');
list($Offset, $Limit) = OffsetLimit($Page, C('Garden.Search.PerPage', 20));
$this->SetData('_Limit', $Limit);
$Search = $this->Form->GetFormValue('Search');
$Mode = $this->Form->GetFormValue('Mode');
if ($Mode) {
$this->SearchModel->ForceSearchMode = $Mode;
}
try {
$ResultSet = $this->SearchModel->Search($Search, $Offset, $Limit);
} catch (Gdn_UserException $Ex) {
$this->Form->AddError($Ex);
$ResultSet = array();
} catch (Exception $Ex) {
LogException($Ex);
$this->Form->AddError($Ex);
$ResultSet = array();
}
Gdn::UserModel()->JoinUsers($ResultSet, array('UserID'));
// Fix up the summaries.
$SearchTerms = explode(' ', Gdn_Format::Text($Search));
foreach ($ResultSet as &$Row) {
$Row['Summary'] = SearchExcerpt(Gdn_Format::PlainText($Row['Summary'], $Row['Format']), $SearchTerms);
$Row['Summary'] = Emoji::instance()->translateToHtml($Row['Summary']);
$Row['Format'] = 'Html';
}
$this->SetData('SearchResults', $ResultSet, TRUE);
$this->SetData('SearchTerm', Gdn_Format::Text($Search), TRUE);
if ($ResultSet) {
$NumResults = count($ResultSet);
} else {
$NumResults = 0;
}
if ($NumResults == $Offset + $Limit) {
$NumResults++;
}
// Build a pager
$PagerFactory = new Gdn_PagerFactory();
$this->Pager = $PagerFactory->GetPager('MorePager', $this);
$this->Pager->MoreCode = 'More Results';
$this->Pager->LessCode = 'Previous Results';
$this->Pager->ClientID = 'Pager';
$this->Pager->Configure($Offset, $Limit, $NumResults, 'dashboard/search/%1$s/%2$s/?Search=' . Gdn_Format::Url($Search));
// if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
// $this->SetJson('LessRow', $this->Pager->ToString('less'));
// $this->SetJson('MoreRow', $this->Pager->ToString('more'));
// $this->View = 'results';
// }
$this->CanonicalUrl(Url('search', TRUE));
$this->Render();
}
示例5: Initialize
/**
* Make this look like a dashboard page and add the resources
*
* @since 1.0
* @access public
*/
public function Initialize()
{
parent::Initialize();
$this->Application = 'Yaga';
Gdn_Theme::Section('Dashboard');
if ($this->Menu) {
$this->Menu->HighlightRoute('/rank');
}
$this->AddJsFile('jquery-ui-1.10.0.custom.min.js');
$this->AddJsFile('admin.ranks.js');
}
示例6: Initialize
/**
* Make this look like a dashboard page and add the resources
*
* @since 1.0
* @access public
*/
public function Initialize()
{
parent::Initialize();
$this->Application = 'Yaga';
Gdn_Theme::Section('Dashboard');
if ($this->Menu) {
$this->Menu->HighlightRoute('/badge');
}
$this->AddJsFile('admin.badges.js');
$this->AddCssFile('badges.css');
}
示例7: Initialize
/**
* Make this look like a dashboard page and add the resources
*
* @since 1.0
* @access public
*/
public function Initialize()
{
parent::Initialize();
$this->Application = 'Yaga';
Gdn_Theme::Section('Dashboard');
if ($this->Menu) {
$this->Menu->HighlightRoute('/yaga');
}
$this->AddSideMenu('yaga/settings');
$this->AddCssFile('yaga.css');
}
示例8: Initialize
/**
* Include JS and CSS used by all methods.
*
* Always called by dispatcher before controller's requested method.
*
* @since 2.0.0
* @access public
*/
public function Initialize()
{
$this->Head = new HeadModule($this);
$this->Head->AddTag('meta', array('name' => 'robots', 'content' => 'noindex'));
$this->AddJsFile('jquery.js');
$this->AddJsFile('jquery.livequery.js');
$this->AddJsFile('jquery.form.js');
$this->AddJsFile('jquery.popup.js');
$this->AddJsFile('jquery.gardenhandleajaxform.js');
$this->AddJsFile('global.js');
$this->AddCssFile('style.css');
parent::Initialize();
Gdn_Theme::Section('Entry');
}
示例9: Initialize
/**
* Include JS, CSS, and modules used by all methods.
*
* Always called by dispatcher before controller's requested method.
*
* @since 2.0.0
* @access public
*/
public function Initialize()
{
$this->Head = new HeadModule($this);
$this->AddJsFile('jquery.js');
$this->AddJsFile('jquery.livequery.js');
$this->AddJsFile('jquery.form.js');
$this->AddJsFile('jquery.popup.js');
$this->AddJsFile('jquery.gardenhandleajaxform.js');
$this->AddJsFile('global.js');
$this->AddCssFile('style.css');
// Add Modules
$this->AddModule('GuestModule');
$this->AddModule('SignedInModule');
parent::Initialize();
Gdn_Theme::Section('ActivityList');
$this->SetData('Breadcrumbs', array(array('Name' => T('Activity'), 'Url' => '/activity')));
}
示例10: Initialize
/**
* Adds JS, CSS, & modules. Automatically run on every use.
*
* @since 2.0.0
* @access public
*/
public function Initialize()
{
$this->ModuleSortContainer = 'Profile';
$this->Head = new HeadModule($this);
$this->AddJsFile('jquery.js');
$this->AddJsFile('jquery.livequery.js');
$this->AddJsFile('jquery.form.js');
$this->AddJsFile('jquery.popup.js');
$this->AddJsFile('jquery.gardenhandleajaxform.js');
$this->AddJsFile('global.js');
$this->AddCssFile('style.css');
$this->AddModule('GuestModule');
parent::Initialize();
Gdn_Theme::Section('Profile');
if ($this->EditMode) {
$this->CssClass .= 'EditMode';
}
$this->SetData('Breadcrumbs', array());
}
示例11: Initialize
/**
* Highlight route and do authenticator setup.
*
* Always called by dispatcher before controller's requested method.
*
* @since 2.0.3
* @access public
*/
public function Initialize()
{
parent::Initialize();
Gdn_Theme::Section('Dashboard');
if ($this->Menu) {
$this->Menu->HighlightRoute('/dashboard/authentication');
}
$this->EnableSlicing($this);
$Authenticators = Gdn::Authenticator()->GetAvailable();
$this->ChooserList = array();
$this->ConfigureList = array();
foreach ($Authenticators as $AuthAlias => $AuthConfig) {
$this->ChooserList[$AuthAlias] = $AuthConfig['Name'];
$Authenticator = Gdn::Authenticator()->AuthenticateWith($AuthAlias);
$ConfigURL = is_a($Authenticator, "Gdn_Authenticator") && method_exists($Authenticator, 'AuthenticatorConfiguration') ? $Authenticator->AuthenticatorConfiguration($this) : FALSE;
$this->ConfigureList[$AuthAlias] = $ConfigURL;
}
$this->CurrentAuthenticationAlias = Gdn::Authenticator()->AuthenticateWith('default')->GetAuthenticationSchemeAlias();
}
示例12: Index
/**
* Default all drafts view: chronological by time saved.
*
* @since 2.0.0
* @access public
*
* @param int $Offset Number of drafts to skip.
*/
public function Index($Offset = '0')
{
Gdn_Theme::Section('DiscussionList');
// Setup head
$this->Permission('Garden.SignIn.Allow');
$this->AddCssFile('vanilla.css');
$this->AddJsFile('jquery.gardenmorepager.js');
$this->AddJsFile('discussions.js');
$this->Title(T('My Drafts'));
// Validate $Offset
if (!is_numeric($Offset) || $Offset < 0) {
$Offset = 0;
}
// Set criteria & get drafts data
$Limit = Gdn::Config('Vanilla.Discussions.PerPage', 30);
$Session = Gdn::Session();
$Wheres = array('d.InsertUserID' => $Session->UserID);
$this->DraftData = $this->DraftModel->Get($Session->UserID, $Offset, $Limit);
$CountDrafts = $this->DraftModel->GetCount($Session->UserID);
// Build a pager
$PagerFactory = new Gdn_PagerFactory();
$this->Pager = $PagerFactory->GetPager('MorePager', $this);
$this->Pager->MoreCode = 'More drafts';
$this->Pager->LessCode = 'Newer drafts';
$this->Pager->ClientID = 'Pager';
$this->Pager->Configure($Offset, $Limit, $CountDrafts, 'drafts/%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 = 'drafts';
}
// Add modules
$this->AddModule('DiscussionFilterModule');
$this->AddModule('NewDiscussionModule');
$this->AddModule('CategoriesModule');
$this->AddModule('BookmarkedModule');
// Render default view (drafts/index.php)
$this->Render();
}
示例13: Initialize
/**
* Always triggered first. Add Javascript files.
*
* @since 2.0.?
* @access public
*/
public function Initialize()
{
parent::Initialize();
Gdn_Theme::Section('Dashboard');
$this->AddJsFile('log.js');
$this->AddJsFile('jquery.expander.js');
$this->AddJsFile('jquery-ui.js');
$this->Form->InputPrefix = '';
}
示例14: 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();
}
示例15: DiscussionsController_Tagged_Create
/**
* Load discussions for a specific tag.
*/
public function DiscussionsController_Tagged_Create($Sender)
{
Gdn_Theme::Section('DiscussionList');
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, C('Vanilla.Discussions.PerPage', 30));
$Sender->SetData('Tag', $Tag, TRUE);
$Sender->Title(T('Tagged with ') . htmlspecialchars($Tag));
$Sender->Head->Title($Sender->Head->Title());
$UrlTag = rawurlencode($Tag);
if (urlencode($Tag) == $Tag) {
$Sender->CanonicalUrl(Url(ConcatSep('/', "/discussions/tagged/{$UrlTag}", PageNumber($Offset, $Limit, TRUE)), TRUE));
$FeedUrl = Url(ConcatSep('/', "/discussions/tagged/{$UrlTag}/feed.rss", PageNumber($Offset, $Limit, TRUE, FALSE)), '//');
} else {
$Sender->CanonicalUrl(Url(ConcatSep('/', 'discussions/tagged', PageNumber($Offset, $Limit, TRUE)) . '?Tag=' . $UrlTag, TRUE));
$FeedUrl = Url(ConcatSep('/', 'discussions/tagged', PageNumber($Offset, $Limit, TRUE, FALSE), 'feed.rss') . '?Tag=' . $UrlTag, '//');
}
if ($Sender->Head) {
$Sender->AddJsFile('discussions.js');
$Sender->Head->AddRss($FeedUrl, $Sender->Head->Title());
}
if (!is_numeric($Offset) || $Offset < 0) {
$Offset = 0;
}
// Add Modules
$Sender->AddModule('NewDiscussionModule');
$Sender->AddModule('DiscussionFilterModule');
$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($Offset, $Limit, array('Announce' => 'all'));
$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';
}
// Render the controller
$Sender->Render('TaggedDiscussions', '', 'plugins/Tagging');
}