Example #1
0
 public static function buildLayoutTree(XenForo_ViewPublic_Base $view, array &$widgets, array $options = array())
 {
     $widgetPage =& $options['widgetPage'];
     $rows = 0;
     $cols = 0;
     $cssClasses = array('cols' => array(), 'rows' => array(), 'xOfY' => array());
     $widgetIds = array();
     foreach ($widgets as $widget) {
         if (empty($widget['active'])) {
             continue;
         }
         if (!empty($widget['position'])) {
             continue;
         }
         if (!isset($widget['options']['layout_row'])) {
             continue;
         }
         if (!isset($widget['options']['layout_col'])) {
             continue;
         }
         if (empty($widget['options']['layout_sizeRow'])) {
             continue;
         }
         if (empty($widget['options']['layout_sizeCol'])) {
             continue;
         }
         $rows = max($rows, $widget['options']['layout_row'] + $widget['options']['layout_sizeRow']);
         $cols = max($cols, $widget['options']['layout_col'] + $widget['options']['layout_sizeCol']);
         $widgetIds[] = $widget['widget_id'];
     }
     for ($col = 1; $col <= $cols; $col++) {
         $cssClasses['cols'][$col] = array('name' => sprintf('WF_Cols_%d_%d', $widgetPage['node_id'], $col));
         if (!empty($widgetPage['options']['column_width']) and !empty($widgetPage['options']['column_gap'])) {
             $cssClasses['cols'][$col]['width'] = $col * $widgetPage['options']['column_width'] + ($col - 1) * $widgetPage['options']['column_gap'];
         }
     }
     for ($row = 1; $row <= $rows; $row++) {
         $cssClasses['rows'][$row] = array('name' => sprintf('WF_Rows_%d_%d', $widgetPage['node_id'], $row));
     }
     $options = XenForo_Application::mapMerge(array('params' => $view->getParams(), 'templateObj' => $view->createOwnTemplateObject(), 'positionCode' => md5(implode('_', $widgetIds)), 'rows' => $rows, 'cols' => $cols, 'cssClasses' => $cssClasses, 'layoutCount' => 0), $options);
     $layout = new _Layout_Vertical($view, $widgets, $options, $widgetIds);
     $layout->prepare();
     $layout->render();
     return $layout;
 }
Example #2
0
 public function getTabs(XenForo_ViewPublic_Base $view, array $tab)
 {
     if (empty($tab['selected']) && !empty($tab['content'])) {
         $tab['link'] = XenForo_Link::buildPublicLink('resources', $tab['content']);
         $tabContent = $view->createTemplateObject('waindigo_tab_tabs', $tab);
         $viewParams = array('resource' => $tab['content'], 'resourceUpdateCount' => $tab['content']['update_count']);
         if ($tab['content']['discussion_thread_id']) {
             $threadModel = XenForo_Model::create('XenForo_Model_Thread');
             $viewParams['thread'] = $threadModel->getThreadById($tab['content']['discussion_thread_id']);
         }
         $content = $view->createTemplateObject('resource_view_tabs', $viewParams);
         preg_match('#<ul[^>]*>\\s*<li[^>]*>.*?</li>(.*)</ul>#s', $content, $matches);
         if ($matches[1]) {
             return $tabContent . $matches[1];
         }
         return $tabContent;
     }
 }
Example #3
0
 public function prepareParams()
 {
     $widgets = array();
     foreach ($this->_params['widgets'] as $widget) {
         $widgets[] = $widget;
     }
     $core = WidgetFramework_Core::getInstance();
     $core->addWidgets($widgets);
     parent::prepareParams();
 }
Example #4
0
 public function prepareParams()
 {
     parent::prepareParams();
     $visitor = XenForo_Visitor::getInstance();
     if ($visitor['language_id'] == 0) {
         $visitor['effectiveLanguageId'] = XenForo_Application::get('options')->defaultLanguageId;
     } else {
         $visitor['effectiveLanguageId'] = $visitor['language_id'];
     }
     $this->_params['visitor'] = $visitor->toArray();
 }
Example #5
0
 public function getTabs(XenForo_ViewPublic_Base $view, array $tab)
 {
     $tab['link'] = XenForo_Link::buildPublicLink('conversations', $tab['content']);
     return $view->createTemplateObject('waindigo_tab_tabs', $tab);
 }