本文整理汇总了PHP中Gdn_Controller::Render方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Controller::Render方法的具体用法?PHP Gdn_Controller::Render怎么用?PHP Gdn_Controller::Render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_Controller
的用法示例。
在下文中一共展示了Gdn_Controller::Render方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UtilityController_SiteMapIndex_Create
/**
* @param Gdn_Controller $Sender
* @param type $Args
*/
public function UtilityController_SiteMapIndex_Create($Sender)
{
// Clear the session to mimic a crawler.
Gdn::Session()->Start(0, FALSE, FALSE);
$Sender->DeliveryMethod(DELIVERY_METHOD_XHTML);
$Sender->DeliveryType(DELIVERY_TYPE_VIEW);
$Sender->SetHeader('Content-Type', 'text/xml');
$SiteMaps = array();
if (class_exists('CategoryModel')) {
$Categories = CategoryModel::Categories();
foreach ($Categories as $Category) {
if (!$Category['PermsDiscussionsView'] || $Category['CategoryID'] < 0 || $Category['CountDiscussions'] == 0) {
continue;
}
$SiteMap = array('Loc' => Url('/sitemap-category-' . rawurlencode($Category['UrlCode'] ? $Category['UrlCode'] : $Category['CategoryID']) . '.xml', TRUE), 'LastMod' => $Category['DateLastComment'], 'ChangeFreq' => '', 'Priority' => '');
$SiteMaps[] = $SiteMap;
}
}
$Sender->SetData('SiteMaps', $SiteMaps);
$Sender->Render('SiteMapIndex', '', 'plugins/Sitemaps');
}
示例2: Controller_Delete
/**
* Delete a Tag
*
* @param Gdn_Controller $Sender
*/
public function Controller_Delete($Sender)
{
$Sender->Permission('Garden.Settings.Manage');
$TagID = GetValue(1, $Sender->RequestArgs);
$TagModel = new TagModel();
$Tag = $TagModel->GetID($TagID, DATASET_TYPE_ARRAY);
if ($Sender->Form->AuthenticatedPostBack()) {
// Delete tag & tag relations.
$SQL = Gdn::SQL();
$SQL->Delete('TagDiscussion', array('TagID' => $TagID));
$SQL->Delete('Tag', array('TagID' => $TagID));
$Sender->InformMessage(FormatString(T('<b>{Name}</b> deleted.'), $Tag));
$Sender->JsonTarget("#Tag_{$Tag['TagID']}", NULL, 'Remove');
}
$Sender->SetData('Title', T('Delete Tag'));
$Sender->Render('delete', '', 'plugins/Tagging');
}
示例3: SettingsController_AnalyticsTick_Create
/**
*
* @param Gdn_Controller $Sender
*/
public function SettingsController_AnalyticsTick_Create($Sender)
{
$Sender->DeliveryMethod(DELIVERY_METHOD_JSON);
$Sender->DeliveryType(DELIVERY_TYPE_DATA);
Gdn::Statistics()->Tick();
$this->FireEvent("AnalyticsTick");
$Sender->DeliveryType(DELIVERY_TYPE_VIEW);
$Sender->Render('tick', 'statistics', 'dashboard');
}
示例4: Settings_AddEdit
/**
* @param Gdn_Controller $Sender
* @param array $Args
*/
protected function Settings_AddEdit($Sender, $Args)
{
$client_id = $Sender->Request->Get('client_id');
Gdn::Locale()->SetTranslation('AuthenticationKey', 'Client ID');
Gdn::Locale()->SetTranslation('AssociationSecret', 'Secret');
Gdn::Locale()->SetTranslation('AuthenticateUrl', 'Authentication Url');
$Form = new Gdn_Form();
$Sender->Form = $Form;
if ($Form->AuthenticatedPostBack()) {
if ($Form->GetFormValue('Generate') || $Sender->Request->Post('Generate')) {
$Form->SetFormValue('AuthenticationKey', mt_rand());
$Form->SetFormValue('AssociationSecret', md5(mt_rand()));
$Sender->SetFormSaved(FALSE);
} else {
$Form->ValidateRule('AuthenticationKey', 'ValidateRequired');
// $Form->ValidateRule('AuthenticationKey', 'regex:`^[a-z0-9_-]+$`i', T('The client id must contain only letters, numbers and dashes.'));
$Form->ValidateRule('AssociationSecret', 'ValidateRequired');
$Form->ValidateRule('AuthenticateUrl', 'ValidateRequired');
$Values = $Form->FormValues();
// $Values = ArrayTranslate($Values, array('Name', 'AuthenticationKey', 'URL', 'AssociationSecret', 'AuthenticateUrl', 'SignInUrl', 'RegisterUrl', 'SignOutUrl', 'IsDefault'));
$Values['AuthenticationSchemeAlias'] = 'jsconnect';
$Values['AssociationHashMethod'] = 'md5';
$Values['Attributes'] = serialize(array('HashType' => $Form->GetFormValue('HashType'), 'TestMode' => $Form->GetFormValue('TestMode'), 'Trusted' => $Form->GetFormValue('Trusted', 0)));
if ($Form->ErrorCount() == 0) {
if ($client_id) {
Gdn::SQL()->Put('UserAuthenticationProvider', $Values, array('AuthenticationKey' => $client_id));
} else {
Gdn::SQL()->Options('Ignore', TRUE)->Insert('UserAuthenticationProvider', $Values);
}
$Sender->RedirectUrl = Url('/settings/jsconnect');
}
}
} else {
if ($client_id) {
$Provider = self::GetProvider($client_id);
TouchValue('Trusted', $Provider, 1);
} else {
$Provider = array();
}
$Form->SetData($Provider);
}
$Sender->SetData('Title', sprintf(T($client_id ? 'Edit %s' : 'Add %s'), T('Connection')));
$Sender->Render('Settings_AddEdit', '', 'plugins/jsconnect');
}
示例5: SettingsController_CustomizeText_Create
/**
* Add the customize text page to the dashboard.
*
* @param Gdn_Controller $Sender
*/
public function SettingsController_CustomizeText_Create($Sender)
{
$Sender->Permission('Garden.Settings.Manage');
$Sender->AddSideMenu('settings/customizetext');
$Sender->AddJsFile('jquery.autogrow.js');
$Sender->Title('Customize Text');
$Directive = GetValue(0, $Sender->RequestArgs, '');
$View = 'customizetext';
if ($Directive == 'rebuild') {
$View = 'rebuild';
} elseif ($Directive == 'rebuildcomplete') {
$View = 'rebuildcomplete';
}
$Method = 'none';
if ($Sender->Form->IsPostback()) {
$Method = 'search';
if ($Sender->Form->GetValue('Save_All')) {
$Method = 'save';
}
}
$Matches = array();
$Keywords = NULL;
switch ($Method) {
case 'none':
break;
case 'search':
case 'save':
$Keywords = strtolower($Sender->Form->GetValue('Keywords'));
if ($Method == 'search') {
$Sender->Form->ClearInputs();
$Sender->Form->SetFormValue('Keywords', $Keywords);
}
$Definitions = Gdn::Locale()->GetDeveloperDefinitions();
$CountDefinitions = sizeof($Definitions);
$Sender->SetData('CountDefinitions', $CountDefinitions);
$Changed = FALSE;
foreach ($Definitions as $Key => $BaseDefinition) {
$KeyHash = md5($Key);
$ElementName = "def_{$KeyHash}";
// Look for matches
$k = strtolower($Key);
$d = strtolower($BaseDefinition);
// If this key doesn't match, skip it
if ($Keywords != '*' && !(strlen($Keywords) > 0 && (strpos($k, $Keywords) !== FALSE || strpos($d, $Keywords) !== FALSE))) {
continue;
}
$Modified = FALSE;
// Found a definition, look it up in the real locale first, to see if it has been overridden
$CurrentDefinition = Gdn::Locale()->Translate($Key, FALSE);
if ($CurrentDefinition !== FALSE && $CurrentDefinition != $BaseDefinition) {
$Modified = TRUE;
} else {
$CurrentDefinition = $BaseDefinition;
}
$Matches[$Key] = array('def' => $CurrentDefinition, 'mod' => $Modified);
if ($CurrentDefinition[0] == "\r\n") {
$CurrentDefinition = "\r\n{$CurrentDefinition}";
} else {
if ($CurrentDefinition[0] == "\r") {
$CurrentDefinition = "\r{$CurrentDefinition}";
} else {
if ($CurrentDefinition[0] == "\n") {
$CurrentDefinition = "\n{$CurrentDefinition}";
}
}
}
if ($Method == 'save') {
$SuppliedDefinition = $Sender->Form->GetValue($ElementName);
// Has this field been changed?
if ($SuppliedDefinition != FALSE && $SuppliedDefinition != $CurrentDefinition) {
// Changed from what it was, but is it a change from the *base* value?
$SaveDefinition = $SuppliedDefinition != $BaseDefinition ? $SuppliedDefinition : NULL;
if (!is_null($SaveDefinition)) {
$CurrentDefinition = $SaveDefinition;
$SaveDefinition = str_replace("\r\n", "\n", $SaveDefinition);
}
Gdn::Locale()->SetTranslation($Key, $SaveDefinition, array('Save' => TRUE, 'RemoveEmpty' => TRUE));
$Matches[$Key] = array('def' => $SuppliedDefinition, 'mod' => !is_null($SaveDefinition));
$Changed = TRUE;
}
}
$Sender->Form->SetFormValue($ElementName, $CurrentDefinition);
}
if ($Changed) {
$Sender->InformMessage("Locale changes have been saved!");
}
break;
}
$Sender->SetData('Matches', $Matches);
$CountMatches = sizeof($Matches);
$Sender->SetData('CountMatches', $CountMatches);
$Sender->Render($View, '', 'plugins/CustomizeText');
}
示例6: SettingsController_Tagging_Create
/**
* Tag management (let admins rename tags, remove tags, etc).
* TODO: manage the Plugins.Tagging.Required boolean setting that makes tagging required or not.
* @param Gdn_Controller $Sender
*/
public function SettingsController_Tagging_Create($Sender, $Args) {
$Sender->Permission('Garden.Settings.Manage');
$Sender->Title('Tagging');
$Sender->AddSideMenu('settings/tagging');
$Sender->AddCSSFile('plugins/Tagging/design/tagadmin.css');
$Sender->AddJSFile('plugins/Tagging/admin.js');
$SQL = Gdn::SQL();
list($Offset, $Limit) = OffsetLimit($Sender->Request->Get('Page'), 100);
$Sender->SetData('_Limit', $Limit);
$Sender->SetData('Tags', $SQL
->Select('t.*')
->From('Tag t')
->OrderBy('t.Name', 'asc')
->OrderBy('t.CountDiscussions', 'desc')
->Limit($Limit, $Offset)
->Get()->ResultArray());
$Sender->SetData('RecordCount', $SQL->GetCount('Tag'));
$Sender->Render('Tagging', '', 'plugins/Tagging');
}