public function toString() { if (is_object($this->Data) && $this->Data->numRows() > 0) { return parent::toString(); } return ''; }
/** * 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 ''; }
public function toString() { if (!Gdn::session()->isValid()) { return ''; } if (!$this->data('Conversations')) { $this->getData(); } return parent::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 ''; }
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 ''; }
/** * 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(); }
public function toString() { $this->fireAs(get_called_class())->fireEvent('render'); return parent::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(); }