为PHPFox V3创建模块

时间:2014-11-04 10:39:49

标签: php phpfox

我想创建一个与论坛相同但修改为vforum的模块。但我面临的是订阅问题。当我尝试安装vforum时,会出现订阅模块并显示" Membership Packages"。我尝试为vforum创建设置但是有些不对劲。 url仍在更改为订阅。

这里我把我的index.class.php代码

<?php
/**
* [PHPFOX_HEADER]
*/

defined('PHPFOX') or exit('NO DICE!');

/**
* 
* 
* @copyright        [PHPFOX_COPYRIGHT]
* @author       Raymond Benc
* @package          Module_Vforum
* @version      $Id: index.class.php 5219 2013-01-28 12:15:53Z Miguel_Espinoza $
*/
class Vforum_Component_Controller_Index extends Phpfox_Component
{
    /**
     * Class process method wnich is used to execute this component.
     */
    public function process()
    {
        if (($sLegacyTitle = $this->request()->get('req2')) && !empty($sLegacyTitle))
        {
            if (($sLegacyThread = $this->request()->get('req3')) && !empty($sLegacyThread) && !is_numeric($sLegacyTitle))
            {
                $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array(
                        'field' => array('thread_id', 'title'),
                        'table' => 'Vforum_thread',     
                        'redirect' => 'Vforum.thread',
                        'title' => $sLegacyThread
                    )
                );              
            }
            else
            {
                $aForumParts = explode('-', $sLegacyTitle);
                if (isset($aForumParts[1]))
                {
                    $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array(
                            'field' => array('Vforum_id', 'name'),
                            'table' => 'Vforum',        
                            'redirect' => 'Vforum',
                            'search' => 'Vforum_id',
                            'title' => $aForumParts[1]
                        )
                    );
                }
            }
        }           


        Phpfox::getUserParam('vforum.can_view_vform', true);

        $aParentModule = $this->getParam('aParentModule');  

        if (Phpfox::getParam('core.phpfox_is_hosted') && empty($aParentModule))
        {
            $this->url()->send('');
        }
        else if (empty($aParentModule) && $this->request()->get('view') == 'new')
        {
            $aDo = explode('/',$this->request()->get('do'));
            if ($aDo[0] == 'mobile' || (isset($aDo[1]) && $aDo[1] == 'mobile'))
            {
            Phpfox::getLib('module')->getComponent('Vforum.Vforum', array('bNoTemplate' => true), 'controller');

            return;
            }           
        }

        if ($this->request()->get('req2') == 'topics' || $this->request()->get('req2') == 'posts')
        {
            return Phpfox::getLib('module')->setController('error.404');
        }

        $this->template()->setBreadcrumb(Phpfox::getPhrase('vforum.vforum'), $this->url()->makeUrl('Vforum'))
            ->setPhrase(array(
                    'Vforum.provide_a_reply',
                    'Vforum.adding_your_reply',
                    'Vforum.are_you_sure',
                    'Vforum.post_successfully_deleted',
                    'Vforum.reply_multi_quoting'
                )
            )           
            ->setHeader('cache', array(                 
                    'Vforum.css' => 'style_css',
                    'Vforum.js' => 'module_Vforum'
                )
            );

        if ($aParentModule !== null)
        {
            Phpfox::getLib('module')->getComponent('Vforum.Vforum', array('bNoTemplate' => true), 'controller');

            return;
        }

        if ($this->request()->getInt('req2') > 0)
        {
            return Phpfox::getLib('module')->setController('Vforum.Vforum');
        }       

        $this->setParam('bIsVforum', true);

        Phpfox::getService('Vforum')->buildMenu();

        $this->template()->setTitle(Phpfox::getPhrase('vforum.vforum'))
            ->assign(array(
                'aVforums' => Phpfox::getService('Vforum')->live()->getVforums(),
                'bHasCategory' => Phpfox::getService('Vforum')->hasCategory(),              
                'aCallback' => null
            )
        );  
    }

    /**
     * Garbage collector. Is executed after this class has completed
     * its job and the template has also been displayed.
     */
    public function clean()
    {
        (($sPlugin = Phpfox_Plugin::get('Vforum.component_controller_index_clean')) ? eval($sPlugin) : false);
    }
}

?>

请帮帮我。 谢谢。

0 个答案:

没有答案