本文整理汇总了PHP中Gdn_Controller::FetchView方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Controller::FetchView方法的具体用法?PHP Gdn_Controller::FetchView怎么用?PHP Gdn_Controller::FetchView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_Controller
的用法示例。
在下文中一共展示了Gdn_Controller::FetchView方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AttachButtonBar
/**
* Attach button bar in place
*
* This method is abstracted because it is called from multiple places, due
* to the way that the comment.php view is invoked both by the DiscussionController
* and the PostController.
*
* @param Gdn_Controller $Sender
*/
protected function AttachButtonBar($Sender, $Wrap = FALSE)
{
$View = $Sender->FetchView('buttonbar', '', 'plugins/ButtonBar');
if ($Wrap) {
echo Wrap($View, 'div', array('class' => 'P'));
} else {
echo $View;
}
}
示例2: ProfileController_AddProfileTabs_Handler
/**
* Handling the event fired at the end of the BuildProfile method of the Profile controller
* If a valid Steam ID is found, load the profile and add it to the profile sidebar.
* If no valid Steam ID is found, do nothing.
*
* @param Gdn_Controller $Sender
*/
public function ProfileController_AddProfileTabs_Handler(&$Sender)
{
// Instantiating our SteamProfile model and attempting to retrieve the profile data
$this->SteamProfileModel = new SteamProfileModel();
// Rustling up the SteamID64 data associated with the user, if available
$UserMetaSteamID64 = $this->GetUserMeta($Sender->User->UserID, 'SteamID64');
$SteamID64 = GetValue('Plugin.steamprofile.SteamID64', $UserMetaSteamID64, '');
// Attempting to retrieve the profile data associated with the SteamID64 field
$Sender->SetData('SteamProfile', $this->SteamProfileModel->GetByID($SteamID64));
// Did we get back a valid profile?
if ($Sender->Data('SteamProfile', FALSE)) {
// Is there a record(s) for this user's "Most Played Games"?
if (isset($Sender->Data('SteamProfile')->mostPlayedGames->mostPlayedGame)) {
// If there are several results, there will be an array of elements. Is there an array of elements?
if (is_array($Sender->Data('SteamProfile')->mostPlayedGames->mostPlayedGame)) {
// ...if so, grab the first one.
$Sender->SetData('MostPlayedGame', $Sender->Data('SteamProfile')->mostPlayedGames->mostPlayedGame[0]);
} else {
// ...if not, grab the single element.
$Sender->SetData('MostPlayedGame', $Sender->Data('SteamProfile')->mostPlayedGames->mostPlayedGame);
}
}
// Attach the style sheet, load up the view, attach it all to the panel
$Sender->AddCssFile('style.css', 'plugins/steamprofile');
$Sender->AddAsset('Panel', $Sender->FetchView($this->GetView('panel.php')), 'Steam');
}
}
示例3: Base_Render_Before
/**
*
* @param Gdn_Controller $Sender
*/
public function Base_Render_Before(&$Sender) {
$Session = Gdn::Session();
// Enable theme previewing
if ($Session->IsValid()) {
$PreviewThemeName = $Session->GetPreference('PreviewThemeName', '');
if ($PreviewThemeName != '') {
$Sender->Theme = $PreviewThemeName;
$Sender->AddAsset('Foot', $Sender->FetchView('previewtheme', 'settingscontroller', 'dashboard'));
$Sender->AddCssFile('previewtheme.css');
}
}
if ($Session->IsValid() && $EmailKey = Gdn::Session()->GetAttribute('EmailKey')) {
$NotifyEmailConfirm = TRUE;
// If this user was manually moved out of the confirmation role, get rid of their 'awaiting confirmation' flag
$ConfirmEmailRole = C('Garden.Registration.ConfirmEmailRole', FALSE);
$UserRoles = array();
$RoleData = Gdn::UserModel()->GetRoles($Session->UserID);
if ($RoleData !== FALSE && $RoleData->NumRows() > 0)
$UserRoles = ConsolidateArrayValuesByKey($RoleData->Result(DATASET_TYPE_ARRAY), 'RoleID','Name');
if ($ConfirmEmailRole !== FALSE && !array_key_exists($ConfirmEmailRole, $UserRoles)) {
Gdn::UserModel()->SaveAttribute($Session->UserID, "EmailKey", NULL);
$NotifyEmailConfirm = FALSE;
}
if ($NotifyEmailConfirm) {
$Message = FormatString(T('You need to confirm your email address.', 'You need to confirm your email address. Click <a href="{/entry/emailconfirmrequest,url}">here</a> to resend the confirmation email.'));
$Sender->InformMessage($Message, '');
}
}
// Add Message Modules (if necessary)
$MessageCache = Gdn::Config('Garden.Messages.Cache', array());
$Location = $Sender->Application.'/'.substr($Sender->ControllerName, 0, -10).'/'.$Sender->RequestMethod;
$Exceptions = array('[Base]');
if ($Sender->MasterView == 'admin')
$Exceptions[] = '[Admin]';
else if (in_array($Sender->MasterView, array('', 'default')))
$Exceptions[] = '[NonAdmin]';
if (GetValue('MessagesLoaded', $Sender) != '1' && $Sender->MasterView != 'empty' && ArrayInArray($Exceptions, $MessageCache, FALSE) || InArrayI($Location, $MessageCache)) {
$MessageModel = new MessageModel();
$MessageData = $MessageModel->GetMessagesForLocation($Location, $Exceptions);
foreach ($MessageData as $Message) {
$MessageModule = new MessageModule($Sender, $Message);
$Sender->AddModule($MessageModule);
}
$Sender->MessagesLoaded = '1'; // Fixes a bug where render gets called more than once and messages are loaded/displayed redundantly.
}
// If there are applicants, alert admins by showing in the main menu
if (in_array($Sender->MasterView, array('', 'default')) && $Sender->Menu && C('Garden.Registration.Method') == 'Approval') {
$CountApplicants = Gdn::UserModel()->GetApplicantCount();
if ($CountApplicants > 0)
$Sender->Menu->AddLink('Applicants', T('Applicants').' <span class="Alert">'.$CountApplicants.'</span>', '/dashboard/user/applicants', array('Garden.Applicants.Manage'));
}
if ($Sender->DeliveryType() == DELIVERY_TYPE_ALL) {
$Gdn_Statistics = Gdn::Factory('Statistics');
$Gdn_Statistics->Check($Sender);
}
// Allow forum embedding
$Sender->AddJsFile('js/embed_local.js');
}