Пример #1
0
 public static function canEditPortalWidgets()
 {
     $allowedPermissions = array();
     if (WidgetPortal_Helper_Permission_Carousel::canEditCarousel()) {
         $allowedPermissions[] = 'canEditCarousel';
     }
     return $allowedPermissions;
 }
Пример #2
0
 /**
  * Renders the widget.
  * Add variables to the template obj: $renderTemplateObject->setParam('users', $users);
  * @param array $widget
  * @param string $positionCode
  * @param array $params
  * @param XenForo_Template_Abstract $renderTemplateObject
  * @return string
  */
 protected function _render(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
 {
     /* Widget Info */
     $widgets = array();
     /* Carousel Info */
     if ($canEditCarousel = WidgetPortal_Helper_Permission_Carousel::canEditCarousel()) {
         $widgetModel = $this->_getWidgetModel();
         $widgets['carousel'] = $widgetModel->getAllFrontendEditableWidgets();
     }
     /* TODO add future editable widgets here */
     /* Permissions */
     $renderTemplateObject->setParam('canEditCarousel', $canEditCarousel);
     $renderTemplateObject->setParam('widgets', $widgets);
     return $renderTemplateObject->render();
 }
Пример #3
0
 /**
  * Checks the current user for the canEditCarousel permission and returns error if they don't.
  * @throws XenForo_ControllerResponse_Exception
  */
 protected function _verifyCanEditCarousel()
 {
     if (!WidgetPortal_Helper_Permission_Carousel::canEditCarousel()) {
         throw $this->getNoPermissionResponseException();
     }
 }