1. Oğuzhan Mallı

    Oğuzhan Mallı - Dec 18, 2016 New Member

    Credit
    Point
    Hi there,

    I really need help some coding help. I will just add what I added codes here.

    1- library/Brivium/ModernStatistic/ControllerAdmin/ModernStatistic.php

    Find...
    Code:
    $resourceVersion = $modernStatisticModel->checkXenForoResourceAddon();
            $categoryOptions = array();
            $resourcePrefixes = array();
    
            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']
                    );
                }
                $resourcePrefixModel = $this->_getResourcePrefixModel();
                $resourcePrefixes = $resourcePrefixModel->getPrefixOptions();
            }
    

    Add below (similar codes, just changes them all with Showcase) :

    Code:
    $showcaseVersion = $modernStatisticModel->checkNFLJ_ShowcaseAddon();
            $categoryOptions = array();
            $showcasePrefixes = array();
    
            if($showcaseVersion)
            {
                $listTypeUsers[] = array('value' => 'user_most_showcase_item',     'label' => new XenForo_Phrase('showcase'));
    
                $listKinds[] = array('value' => 'showcase', 'label' => new XenForo_Phrase('showcase'));
    
                $categoryModel = $this->getModelFromCache('NFLJ_Showcase_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']
                    );
                }
                $showcasePrefixModel = $this->_getShowcasePrefixModel();
                $showcasePrefixes = $showcasePrefixModel->getPrefixOptions();
            }
    
    Find...

    Code:
            $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')),
            );
    

    Add below...

    Code:
            $listTypeShowcase = array(
                array('value' => 'showcase_last_update',         'label' => new XenForo_Phrase('showcase_latest_updates')),
            );
    
    Find...

    Code:
            $defaultTabData = array(
                'kind'                 => '',
                'title'             => '',
                'type'                 => '',
                'order_type'         => '',
                'order_direction'     => '',
                'cut_off'             => 0,
                'prefix_id'         => array(),
                'forums'             => array(),
                'discussion_state'     => array(),
                'discussion_open'     => array(),
                'categories'         => array(),
                'user_groups'         => array(),
                'resource_prefix_id' => array(),
                'resource_state'     => array(),
                'gender'             => array(),
                'user_state'         => array(),
                'currency_id'         => 0,
                'display_order'     => $lastOrder,
            );
    

    Replace with...

    Code:
            $defaultTabData = array(
                'kind'                 => '',
                'title'             => '',
                'type'                 => '',
                'order_type'         => '',
                'order_direction'     => '',
                'cut_off'             => 0,
                'prefix_id'         => array(),
                'forums'             => array(),
                'discussion_state'     => array(),
                'discussion_open'     => array(),
                'categories'         => array(),
                'user_groups'         => array(),
                'resource_prefix_id' => array(),
                'resource_state'     => array(),
                'showcase_state'     => array(),
                'showcase_prefix_id' => array(),
                'gender'             => array(),
                'user_state'         => array(),
                'currency_id'         => 0,
                'display_order'     => $lastOrder,
            );
    
    Find...

    Code:
            $viewParams = array(
                'modernStatistic'     => $modernStatistic,
    
                'lastOrder'         => $lastOrder,
    
                'styles'             => $styles,
                'defaultTabData'     => $defaultTabData,
    
                'resourceVersion'     => $resourceVersion,
                'userGroupOptions'     => $userGroupOptions,
    
                'categoryList'         => $categoryOptions,
                'resourcePrefixes'     => $resourcePrefixes,
                'currencyOptions'     => $currencyOptions,
                'forumList'         => $forumOptions,
                'nodeList'             => $nodeList,
                'prefixes'             => $this->getModelFromCache('XenForo_Model_ThreadPrefix')->getPrefixOptions(),
    
                'nextCounter'         => count($tabsData),
                'tabsData'             => $tabsData,
                'itemLimit'         => $itemLimit,
    
                'listTypeThreads'     => $listTypeThreads,
                'listTypeResources' => $listTypeResources,
                'listTypeUsers'     => $listTypeUsers,
                'listThreadOrders'     => $listThreadOrders,
                'languages'         => $this->getModelFromCache('XenForo_Model_Language')->getLanguagesForOptionsTag(),
    
                'listKinds' => $listKinds,
            );
    

    Replace with...

    Code:
            $viewParams = array(
                'modernStatistic'     => $modernStatistic,
    
                'lastOrder'         => $lastOrder,
    
                'styles'             => $styles,
                'defaultTabData'     => $defaultTabData,
    
                'resourceVersion'     => $resourceVersion,
                'userGroupOptions'     => $userGroupOptions,
    
                'showcaseVersion'     => $showcaseVersion,
    
                'categoryList'         => $categoryOptions,
                'resourcePrefixes'     => $resourcePrefixes,
                'showcasePrefixes'     => $showcasePrefixes,
                'currencyOptions'     => $currencyOptions,
                'forumList'         => $forumOptions,
                'nodeList'             => $nodeList,
                'prefixes'             => $this->getModelFromCache('XenForo_Model_ThreadPrefix')->getPrefixOptions(),
    
                'nextCounter'         => count($tabsData),
                'tabsData'             => $tabsData,
                'itemLimit'         => $itemLimit,
    
                'listTypeThreads'     => $listTypeThreads,
                'listTypeResources' => $listTypeResources,
                'listTypeShowcase' => $listTypeShowcase,
                'listTypeUsers'     => $listTypeUsers,
                'listThreadOrders'     => $listThreadOrders,
                'languages'         => $this->getModelFromCache('XenForo_Model_Language')->getLanguagesForOptionsTag(),
    
                'listKinds' => $listKinds,
            );
    
    Find...

    Code:
            $writerData = $this->_input->filter(array(
                'title' => XenForo_Input::STRING,
                'active' => XenForo_Input::UINT,
                'usename_marke_up' => XenForo_Input::UINT,
                'show_thread_prefix' => XenForo_Input::UINT,
                'show_resource_prefix' => XenForo_Input::UINT,
                'show_showcase_prefix' => XenForo_Input::UINT,
                'load_fisrt_tab' => XenForo_Input::UINT,
                'control_position' => XenForo_Input::STRING,
                'preview_tooltip' => XenForo_Input::STRING,
                'position' => XenForo_Input::STRING,
                'style_display' => XenForo_Input::STRING,
                'thread_cutoff' => XenForo_Input::UINT,
                'enable_cache' => XenForo_Input::UINT,
                'cache_time' => XenForo_Input::UINT,
                'auto_update' => XenForo_Input::UINT,
                'allow_change_layout' => XenForo_Input::UINT,
                'allow_manual_refresh' => XenForo_Input::UINT,
                'allow_user_setting' => XenForo_Input::UINT,
                'modern_criteria' => XenForo_Input::ARRAY_SIMPLE,
                'style_settings' => XenForo_Input::ARRAY_SIMPLE,
            ));
    

    Replace with...

    Code:
            $writerData = $this->_input->filter(array(
                'title' => XenForo_Input::STRING,
                'active' => XenForo_Input::UINT,
                'usename_marke_up' => XenForo_Input::UINT,
                'show_thread_prefix' => XenForo_Input::UINT,
                'show_resource_prefix' => XenForo_Input::UINT,
                'load_fisrt_tab' => XenForo_Input::UINT,
                'control_position' => XenForo_Input::STRING,
                'preview_tooltip' => XenForo_Input::STRING,
                'position' => XenForo_Input::STRING,
                'style_display' => XenForo_Input::STRING,
                'thread_cutoff' => XenForo_Input::UINT,
                'enable_cache' => XenForo_Input::UINT,
                'cache_time' => XenForo_Input::UINT,
                'auto_update' => XenForo_Input::UINT,
                'allow_change_layout' => XenForo_Input::UINT,
                'allow_manual_refresh' => XenForo_Input::UINT,
                'allow_user_setting' => XenForo_Input::UINT,
                'modern_criteria' => XenForo_Input::ARRAY_SIMPLE,
                'style_settings' => XenForo_Input::ARRAY_SIMPLE,
            ));
    
    Product model...

    Code:
        protected function _getNFLJ_ShowcasePrefixModel()
        {
            return $this->getModelFromCache('NFLJ_Showcase_Model_Prefix');
        }
    
    Save and now add this file here: library/Brivium/ModernStatistic/Model/Showcase.php

    PHP:
    <?php

    class Addon_ModernStatistic_Model_Showcase extends XFCP_Addon_ModernStatistic_Model_Showcase
    {
        public function 
    prepareResourceConditions(array $conditions, array &$fetchOptions)
        {
            
    $result parent::prepareResourceConditions($conditions$fetchOptions);

            
    $sqlConditions = array($result);
            
    $db $this->_getDb();

            if (!empty(
    $conditions['item_state']))
            {
                if (
    is_array($conditions['item_state']))
                {
                    
    $sqlConditions[] = 'item.item_state IN (' $db->quote($conditions['item_state']) . ')';
                }
                else
                {
                    
    $sqlConditions[] = 'item.item_state = ' $db->quote($conditions['item_state']);
                }
            }
            if (
    count($sqlConditions) > 1) {
                return 
    $this->getConditionsForClause($sqlConditions);
            } else {
                return 
    $result;
            }
        }
    }
    This not working and getting following error:

    An exception occurred: Call to undefined method Brivium_ModernStatistic_Model_ModernStatistic::checkNFLJ_ShowcaseAddon() in /home/site/domains/site/public_html/library/Brivium/ModernStatistic/ControllerAdmin/ModernStatistic.php on line 139

    1. Addon_ModernStatistic_ControllerAdmin_ModernStatistic->actionEdit() in XenForo/FrontController.php at line 351
    2. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
    3. XenForo_FrontController->run() in /home/site/domains/site/public_html/admin.php at line 13

    It's possible to develop this add-on for me? I really need this feature on my forums.

    @Brivium how to we can add Showcase latest updates, latest Items, etc. for this addon? If you help me, then we don't need this feature next versions. I can edit codes, templates, etc. or this addon must support Showcase addon.
     
    Loading...