コード例 #1
0
ファイル: ModernStatistic.php プロジェクト: Sywooch/forums
 public function actionEdit()
 {
     $modernStatisticModel = $this->_getModernStatisticModel();
     if ($modernStatisticId = $this->_input->filterSingle('modern_statistic_id', XenForo_Input::UINT)) {
         // if a statistic ID was specified, we should be editing, so make sure a statistic exists
         $modernStatistic = $modernStatisticModel->getModernStatisticById($modernStatisticId);
         if (!$modernStatistic) {
             return $this->responseError(new XenForo_Phrase('BRMS_requested_statistic_not_found'), 404);
         }
         $modernStatistic = $modernStatisticModel->prepareModernStatistic($modernStatistic, true);
         $tabsData = $modernStatistic['tabData'];
         $itemLimit = $modernStatistic['itemLimit'];
     } else {
         // add a new statistic
         $modernStatistic = array('title' => '', 'preview_tooltip' => 'custom_preview', 'control_position' => 'brmsLeftTabs', 'usename_marke_up' => 1, 'show_thread_prefix' => 1, 'show_resource_prefix' => 1, 'allow_change_layout' => 1, 'allow_manual_refresh' => 1, 'auto_update' => 60, 'active' => 1, 'enable_cache' => 1, 'allow_user_setting' => 1, 'cache_time' => 5);
         $tabsData = array();
         $itemLimit = array('default' => 15);
     }
     $nodeModel = $this->_getNodeModel();
     $nodeList = $nodeModel->getNodeOptionsArray($nodeModel->getAllNodes(), -1, false);
     $forumOptions = array();
     foreach ($nodeList as $key => $node) {
         if (!empty($node['node_type_id']) && $node['node_type_id'] != 'Forum') {
             $node['disabled'] = 'disabled';
         }
         unset($node['node_type_id']);
         $forumOptions[$key] = $node;
     }
     $userGroupOptions = XenForo_Option_UserGroupChooser::getUserGroupOptions(-1, false);
     $listKinds = array(array('value' => 'thread', 'label' => new XenForo_Phrase('thread')), array('value' => 'user', 'label' => new XenForo_Phrase('user')));
     $resourceVersion = $modernStatisticModel->checkXenForoResourceAddon();
     $creditVersion = $modernStatisticModel->checkBriviumCreditsAddon();
     $categoryOptions = array();
     $currencyOptions = array();
     $listTypeUsers = array(array('value' => 'user_most_messages', 'label' => new XenForo_Phrase('most_messages')), array('value' => 'user_most_likes', 'label' => new XenForo_Phrase('most_likes')), array('value' => 'user_most_points', 'label' => new XenForo_Phrase('most_points')), array('value' => 'user_staff_members', 'label' => new XenForo_Phrase('staff_members')), array('value' => 'user_latest_members', 'label' => new XenForo_Phrase('BRMS_latest_members')), array('value' => 'user_latest_banned', 'label' => new XenForo_Phrase('BRMS_latest_banned_members')));
     if ($creditVersion) {
         $listTypeUsers[] = array('value' => 'user_richest', 'label' => new XenForo_Phrase('BRC_top_richest'));
         $listTypeUsers[] = array('value' => 'user_poorest', 'label' => new XenForo_Phrase('BRC_top_poorest'));
         if ($creditVersion >= 1000000) {
             $currencyOptions = $this->_getCurrencyModel()->getCurrenciesForOptionsTag();
         }
         //prd($currencyOptions);
     }
     if ($resourceVersion) {
         $listTypeUsers[] = array('value' => 'user_most_resources', 'label' => new XenForo_Phrase('most_resources'));
         $listKinds[] = array('value' => 'resource', 'label' => new XenForo_Phrase('resource'));
         $categoryModel = $this->getModelFromCache('XenResource_Model_Category');
         $categories = $categoryModel->prepareCategories($categoryModel->getViewableCategories());
         foreach ($categories as $categoryId => $category) {
             $category['depth'] += 1;
             $categoryOptions[$categoryId] = array('value' => $categoryId, 'label' => $category['category_title'], 'depth' => $category['depth']);
         }
     }
     $listTypeThreads = array(array('value' => 'thread_latest', 'label' => new XenForo_Phrase('BRMS_latest_threads')), array('value' => 'thread_hotest', 'label' => new XenForo_Phrase('BRMS_most_viewed_threads')), array('value' => 'post_latest', 'label' => new XenForo_Phrase('BRMS_latest_replies')), array('value' => 'most_reply', 'label' => new XenForo_Phrase('BRMS_most_replied_threads')), array('value' => 'sticky_threads', 'label' => new XenForo_Phrase('BRMS_sticky_threads')), array('value' => 'my_threads', 'label' => new XenForo_Phrase('BRMS_my_threads')));
     $listTypeResources = array(array('value' => 'resource_last_update', 'label' => new XenForo_Phrase('latest_updates')), array('value' => 'resource_resource_date', 'label' => new XenForo_Phrase('newest_resources')), array('value' => 'resource_rating_weighted', 'label' => new XenForo_Phrase('top_resources')), array('value' => 'resource_download_count', 'label' => new XenForo_Phrase('most_downloaded')));
     $listThreadOrders = array(array('value' => 'title', 'label' => new XenForo_Phrase('title_alphabetical')), array('value' => 'post_date', 'label' => new XenForo_Phrase('thread_creation_time')), array('value' => 'view_count', 'label' => new XenForo_Phrase('number_of_views')), array('value' => 'reply_count', 'label' => new XenForo_Phrase('number_of_replies')), array('value' => 'first_post_likes', 'label' => new XenForo_Phrase('first_message_likes')));
     $styleModel = $this->getModelFromCache('XenForo_Model_Style');
     $styles = $styleModel->getAllStylesAsFlattenedTree();
     $viewParams = array('modernStatistic' => $modernStatistic, 'styles' => $styles, 'resourceVersion' => $resourceVersion, 'userGroupOptions' => $userGroupOptions, 'categoryList' => $categoryOptions, 'currencyOptions' => $currencyOptions, 'forumList' => $forumOptions, 'nodeList' => $nodeList, 'nextCounter' => count($tabsData), 'tabsData' => $tabsData, 'itemLimit' => $itemLimit, 'listTypeThreads' => $listTypeThreads, 'listTypeResources' => $listTypeResources, 'listTypeUsers' => $listTypeUsers, 'listThreadOrders' => $listThreadOrders, 'listKinds' => $listKinds);
     return $this->responseView('Brivium_ModernStatistic_ViewAdmin_ModernStatistic_Edit', 'BRMS_modern_statistic_edit', $viewParams);
 }
コード例 #2
0
ファイル: Listener.php プロジェクト: Sywooch/forums
 public static function renderUserOptions(XenForo_View $view, $fieldPrefix, array $preparedOption, $canEdit)
 {
     $preparedOption['formatParams'] = XenForo_Option_UserGroupChooser::getUserGroupOptions($preparedOption['option_value']);
     return XenForo_ViewAdmin_Helper_Option::renderOptionTemplateInternal('option_list_option_checkbox', $view, $fieldPrefix, $preparedOption, $canEdit);
 }
コード例 #3
0
ファイル: UserGroups.php プロジェクト: Sywooch/forums
 protected static function _render($templateName, XenForo_View $view, $fieldPrefix, array $preparedOption, $canEdit)
 {
     $preparedOption['formatParams'] = XenForo_Option_UserGroupChooser::getUserGroupOptions($preparedOption['option_value'], sprintf('(%s)', new XenForo_Phrase('unspecified')));
     return XenForo_ViewAdmin_Helper_Option::renderOptionTemplateInternal($templateName, $view, $fieldPrefix, $preparedOption, $canEdit);
 }