/** * * @param Gdn_Controller $Sender * @param array $Args */ public function SettingsController_Render_Before($Sender, $Args) { if (strcasecmp($Sender->RequestMethod, 'locales') != 0) { return; } // Add a little pointer to the settings. $Text = '<div class="Info">' . sprintf(T('Locale Developer Settings %s.'), Anchor(T('here'), '/dashboard/settings/localedeveloper')) . '</div>'; $Sender->AddAsset('Content', $Text, 'LocaleDeveloperLink'); }
/** * 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'); } }
/** * * @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'); }