Hi,

Current module handler does not support multiple inheritance of same class. So 
what you are using now is hack and does not officially supported by oxid so it 
is normal that something is not working as expected . Some time ago there was 
already discussion that there should be possibility to extend same class more 
than one time and we decided that will implement this in one of the next shop 
version. So when we will implement this, this feature will be supported and 
activation/deactivation will work fine .


Rimvydas

rimvydas.paskevic...@oxid-esales.com
Phone +370 37 333053
Fax +370 37 333054
www.oxid-esales.com

From: Stefan Moises 
Sent: Tuesday, August 21, 2012 12:55 PM
To: dev-general@lists.oxidforge.org 
Subject: Re: [oxid-dev-general] Metadata: Problems on registering 
multipleentries for one class [T-P86G0139EG-98]

Hi list,

I have found the problem - oxmodule::isActive() does not check for module 
arrays defined in metadata.php, below is a fixed version... until OXID fixes 
the bug, you can use this module to overwrite the oxmodule class so that your 
module is displayed correctly as being "active" :)
(added code in BOLD) - you can add this module to metadata.php like this:

'extend'       => array(
        // here is a "problematic" entry with two classes in an array
        'search'                => 
array('shoptimax/shoptifind/shoptifind_view_base', 
'shoptimax/shoptifind/shoptifind_search'),
        ...
       'oxmodule'                => 'shoptimax/shoptifind/smx_oxmodule',
}

And here is the module code which checks for module arrays for one extended 
class, too:

class smx_oxmodule extends smx_oxmodule_parent {

    /**
    * Check if extension is active
    *
    * @return bool
    */
    public function isActive()
    {
        $blActive = false;
        $sId = $this->getId();
        if (isset($sId)) {
            if ( is_array($this->_aModule['extend']) && 
!empty($this->_aModule['extend']) ) {
                $aAddModules = $this->_aModule['extend'];
                $aInstalledModules = $this->getAllModules();
                $iClCount = count($aAddModules);
                $iActive  = 0;
    
                foreach ($aAddModules as $sClass => $sModule) {
                    // smx_sm: also check for module arrays defined for one 
extended class!
                    if(is_array($sModule)) {
                        if(count(array_diff($aInstalledModules[$sClass], 
$sModule)) == 0) {
                            $iActive ++;
                        }
                    }
                    else {
                        if ( (isset($aInstalledModules[$sClass]) && 
in_array($sModule, $aInstalledModules[$sClass])) ) {
                            $iActive ++;
                        }
                    }
                }
                $blActive = $iClCount > 0 && $iActive == $iClCount;
    
                $aDisabledModules = $this->getDisabledModules();
                if ( $blActive && ( is_array($aDisabledModules) && 
in_array($sId, $aDisabledModules) ) ) {
                    $blActive = false;
                }
            } else {
                //handling modules that does not extend any class
                $aDisabledModules = $this->getDisabledModules();
                if ( is_array($aDisabledModules) && !in_array($sId, 
$aDisabledModules) ) {
                    $blActive = true;
                }
            }
        }
    
        return $blActive;
    }
    
}


Cheers,
Stefan


Am 16.08.2012 16:05, schrieb Stefan Moises:

  Hi,

  thanks, this seems to kinda work and the modules are loaded!
  But for some strange reason, if I do this, the module is always displayed as 
inactive (although it IS "active" and working)... and there is always the 
"Activate" button, so there is no change to de-activate it any more :P

  But at least the module seems to be working now...
  So, OXID-Devs, you only have to fix the activation if arrays are used in the 
"extend" section.... :)

  Thanks,
  Stefan


  Am 16.08.2012 15:55, schrieb Kundenservice | digidesk - media solutions:

    Hey,

    just try it with an array, this works ( at least its displayed correct in 
the admin-section ):

    'extend' => array(
       'search' => array( 'shoptimax/shoptifind/shoptifind_view_base', 
'shoptimax/shoptifind/shoptifind_search' ),


          Mit freundlichen Grüßen aus Verl 
          Patrick Nussbaum
          Technik 
         

          ------------------------------------------------- 
         
          ------------------------------------------------- 

          digidesk – media solutions
          Inh. Marco Müller
          Kapellenweg 76
          D-33415 Verl 
          ------------------------------------------------- 
          Telefon: +4952469099110 
          Telefax: +4952469099120 
          E-Mail: tech...@digidesk.de 
          Web: www.digidesk.de 



    -----Ursprüngliche Daten-----
    Datum: 16.08.2012 15:48:21
    Von: Stefan Moises mailto:moi...@shoptimax.de
    An: mailto:dev-general@lists.oxidforge.org
    Betreff: Re: [oxid-dev-general] Metadata: Problems on registering 
multipleentries for one class
    Vorgang: T-P86G0139EG-98



      Hi OXID devs,

      any news on this? We have a problem now updating the latest modules to 
OXID 4.6.x because of "multiple" inheritance reasons we need to do something 
like this in the metadata.php (which doesn't work):

          'extend'       => array(
              'search'                => 
'shoptimax/shoptifind/shoptifind_view_base',
              'search'                => 
'shoptimax/shoptifind/shoptifind_search',
      ...

      This doesn't work either:
          'extend'       => array(
              'search'                => 
'shoptimax/shoptifind/shoptifind_view_base&shoptimax/shoptifind/shoptifind_search',
      ...

      Background: to avoid code duplication we need a common base class for 
different views (but can't extend from it because of the "extends xy_parent" 
logic in OXID... and as you know PHP doesn't support multiple inheritance 
unfortunately (and don't tell me to use PHP 5.4's "traits" instead :P)

      Thanks,
      Stefan



      Am 29.06.2012 17:02, schrieb Rimvydas Paskevicius:

        Hi all,

        Its nice to see discussing about modules handling, so after some 
internal discussion we decided to add multiple modules entries for one class 
support in one of the next releases. Hope this will make life easier for 
modules writers.



        Rimvydas


        rimvydas.paskevic...@oxid-esales.com
        Phone +370 37 333053
        Fax +370 37 333054
        www.oxid-esales.com 

         

_______________________________________________
dev-general mailing list
dev-general@lists.oxidforge.org
http://dir.gmane.org/gmane.comp.php.oxid.general

-- 
Mit den besten Grüßen aus Nürnberg,
Stefan Moises
*******************************************
Stefan Moises
Senior Softwareentwickler
Leiter Modulentwicklung
shoptimax GmbH 
Guntherstraße 45 a
90461 Nürnberg
Amtsgericht Nürnberg HRB 21703
GF Friedrich Schreieck
Tel.: 0911/25566-0
Fax:  0911/25566-29
moi...@shoptimax.de
http://www.shoptimax.de
*******************************************



--------------------------------------------------------------------------



_______________________________________________
dev-general mailing list
dev-general@lists.oxidforge.org
http://dir.gmane.org/gmane.comp.php.oxid.general 


     

_______________________________________________
dev-general mailing list
dev-general@lists.oxidforge.org
http://dir.gmane.org/gmane.comp.php.oxid.general

-- 
Mit den besten Grüßen aus Nürnberg,
Stefan Moises

*******************************************
Stefan Moises
Senior Softwareentwickler
Leiter Modulentwicklung

shoptimax GmbH 
Guntherstraße 45 a
90461 Nürnberg
Amtsgericht Nürnberg HRB 21703
GF Friedrich Schreieck

Tel.: 0911/25566-0
Fax:  0911/25566-29
moi...@shoptimax.de
http://www.shoptimax.de
*******************************************

   

_______________________________________________
dev-general mailing list
dev-general@lists.oxidforge.org
http://dir.gmane.org/gmane.comp.php.oxid.general

-- 
Mit den besten Grüßen aus Nürnberg,
Stefan Moises

*******************************************
Stefan Moises
Senior Softwareentwickler
Leiter Modulentwicklung

shoptimax GmbH 
Guntherstraße 45 a
90461 Nürnberg
Amtsgericht Nürnberg HRB 21703
GF Friedrich Schreieck

Tel.: 0911/25566-0
Fax:  0911/25566-29
moi...@shoptimax.de
http://www.shoptimax.de
*******************************************


--------------------------------------------------------------------------------
_______________________________________________
dev-general mailing list
dev-general@lists.oxidforge.org
http://dir.gmane.org/gmane.comp.php.oxid.general

<<wlEmoticon-smile[1].png>>

<<image/png>>

_______________________________________________
dev-general mailing list
dev-general@lists.oxidforge.org
http://dir.gmane.org/gmane.comp.php.oxid.general

Reply via email to