本文整理汇总了PHP中Gdn_Module::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Module::toString方法的具体用法?PHP Gdn_Module::toString怎么用?PHP Gdn_Module::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_Module
的用法示例。
在下文中一共展示了Gdn_Module::toString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toString
public function toString()
{
if (is_object($this->Data) && $this->Data->numRows() > 0) {
return parent::toString();
}
return '';
}
示例2: toString
/**
* Render the module.
*
* @return string HTML.
*/
public function toString()
{
// Verify any participants exist before outputting anything.
if (count($this->data('Participants'))) {
return parent::toString();
}
return '';
}
示例3: toString
public function toString()
{
if (!Gdn::session()->isValid()) {
return '';
}
if (!$this->data('Conversations')) {
$this->getData();
}
return parent::toString();
}
示例4: toString
/**
* Render the module.
*
* @return string Rendered HTML.
*/
public function toString()
{
// Simplify our permission logic
$ConversationExists = is_object($this->Conversation) && $this->Conversation->ConversationID > 0;
$CanAddUsers = $this->AddUserAllowed && checkPermission('Conversations.Conversations.Add');
if ($ConversationExists && $CanAddUsers) {
return parent::toString();
}
return '';
}
示例5: toString
public function toString()
{
if (!Gdn::session()->checkPermission('Garden.Activity.View')) {
return '';
}
if (stringIsNullOrEmpty($this->ActivityModuleTitle)) {
$this->ActivityModuleTitle = t('Recent Activity');
}
if (!$this->ActivityData) {
$this->getData();
}
$Data = $this->ActivityData;
if (is_object($Data) && $Data->numRows() > 0) {
return parent::toString();
}
return '';
}
示例6: toString
/**
* Render the module.
*
* @return string
*/
public function toString()
{
// Set CategoryID if we have one.
if ($this->CategoryID === null) {
$this->CategoryID = Gdn::controller()->data('Category.CategoryID', false);
}
// Allow plugins and themes to modify parameters.
Gdn::controller()->EventArguments['NewDiscussionModule'] =& $this;
Gdn::controller()->fireEvent('BeforeNewDiscussionButton');
// Make sure the user has the most basic of permissions first.
$PermissionCategory = CategoryModel::permissionCategory($this->CategoryID);
if ($this->CategoryID) {
$Category = CategoryModel::categories($this->CategoryID);
$HasPermission = Gdn::session()->checkPermission('Vanilla.Discussions.Add', true, 'Category', val('CategoryID', $PermissionCategory));
} else {
$HasPermission = Gdn::session()->checkPermission('Vanilla.Discussions.Add', true, 'Category', 'any');
}
// Determine if this is a guest & we're using "New Discussion" button as call to action.
$PrivilegedGuest = $this->ShowGuests && !Gdn::session()->isValid();
// No module for you!
if (!$HasPermission && !$PrivilegedGuest) {
return '';
}
// Grab the allowed discussion types.
$DiscussionTypes = CategoryModel::allowedDiscussionTypes($PermissionCategory);
foreach ($DiscussionTypes as $Key => $Type) {
if (isset($Type['AddPermission']) && !Gdn::session()->checkPermission($Type['AddPermission'])) {
unset($DiscussionTypes[$Key]);
continue;
}
$Url = val('AddUrl', $Type);
if (!$Url) {
continue;
}
if (isset($Category)) {
$Url .= '/' . rawurlencode(val('UrlCode', $Category));
}
// Present a signin redirect for a $PrivilegedGuest.
if (!$HasPermission) {
$Url = $this->GuestUrl . '?Target=' . $Url;
}
$this->addButton(t(val('AddText', $Type)), $Url);
}
// Add QueryString to URL if one is defined.
if ($this->QueryString && $HasPermission) {
foreach ($this->Buttons as &$Row) {
$Row['Url'] .= (strpos($Row['Url'], '?') !== false ? '&' : '?') . $this->QueryString;
}
}
return parent::toString();
}
示例7: toString
public function toString()
{
$this->fireAs(get_called_class())->fireEvent('render');
return parent::toString();
}
示例8: toString
/**
* Returns the component as a string to be rendered to the screen.
*
* @return string
*/
public function toString()
{
// Setup
$this->setData('Categories', $this->getChildren());
$this->setData('Layout', c('Vanilla.Categories.Layout', 'modern'));
$this->setData('ParentCategory', $this->getCategory());
// If our category isn't valid, or we have no child categories to display, then display nothing.
if (!$this->data('ParentCategory') || !$this->data('Categories')) {
return '';
}
// Vanilla's category helper functions are beneficial in creating markdown in the views.
require_once Gdn::controller()->fetchViewLocation('helper_functions', 'categories', 'vanilla');
return parent::toString();
}