Jump to content

jane3von

Approved members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by jane3von

  1. Hi, everyone !

    I have installed Revive Adserver-3.2.3 in my IDE used Eclipse and the server is wampserver in windows. As I did not learned the php before, so recently I have learned the grammar about the php and the template about smarty. What's more, I found this project has also used PEAR to expand the php function.

    I can understand most of the meaning about the code,but I still have some confused about this entire program, especially the entire structure. I saw there was lib folder and it contains java-xmlrpc ,junit,Zend,xmlrpc and some other folders,but I could not understand these folders's function.

    I want to modify this project in my demand, but I don't know how to modify especially the UI style. I konw the basic using about smarty,such as templates files are stored in lib/templates/admin, the cache files are generated in var/cache and the grammar about assign() , display(),but I don't understand how to work about the hook, listener,register function?

    For example: the template advertiser-index.htm the content is below:

    {view_before_content}
    {include file=advertiser-index-list.html from=$aAdvertisers aCount=$aCount}
    {view_after_content}

    I found ViewHook.php has defined the 'view_before_content' and 'view_after_content' like below:

      protected function register(OA_Admin_Template $oTpl)
        {
            $oTpl->register_function('view_before_content', array($this, 'beforeContent'));
            $oTpl->register_function('view_after_content', array($this, 'afterContent'));
        }
        
        
        public function beforeContent($aParams, &$oTpl)
        {
            return OX_Admin_UI_Hooks::beforePageContent($this->pageId, $this->pageData, $oTpl);
        }

     public function afterContent($aParams, &$oTpl)
        {
            return OX_Admin_UI_Hooks::afterPageContent($this->pageId, $this->pageData, $oTpl);
        }

    but the function OX_Admin_UI_Hooks::beforePageContent in Hooks.php is 

     

    public static function beforePageContent($pageId, $pageData, &$oTpl)
        {
            self::init();
            $result = '';
            $oContext = new OX_Admin_UI_Event_EventContext(array(
                'pageId' => $pageId,
                'pageData' => $pageData,
                'oTpl'     => $oTpl
            )); 
            
            $aStrings = self::getDispatcher()->triggerEvent('beforePageContent', $oContext);
            if (!empty($aStrings)) {
                $result = join('\n', $aStrings); 
            }

            return $result; 
        }

    The self::getDispatcher()->triggerEvent() function is in EventDispatcher.php and the function is below:

     public function triggerEvent($eventName, OX_Admin_UI_Event_EventContext $context)
        {
            $aCallbacks = $this->getRegisteredListeners($eventName);
            
            //enhance context with event name
            $context->eventName = $eventName;  
            
            $result = array();
            //invoke event on listener and collect results 
            foreach ($aCallbacks as $callback) {
                $result[] = call_user_func($callback, $context);
            }
            
            return $result;
        }

    According to my understanding, the call_user_func() finally execute the function is 'beforePageContent' but the function 'beforePageContent' seems has nothing connected with the html and css files, so I do not know where to call these UI file(htm,css,js) ?

    Thanks to anyone can help me about this question!

×
×
  • Create New...