protected function _addPluginData( MShop_Common_Manager_Interface $pluginManager, array $data )
	{
		$this->_msg( 'Adding data for MShop plugins', 1 );

		$types = array();
		$manager = $pluginManager->getSubManager( 'type' );

		foreach( $manager->searchItems( $manager->createSearch() ) as $item ) {
			$types[ 'plugin/' . $item->getCode() ] = $item;
		}

		$num = $total = 0;
		$item = $pluginManager->createItem();

		foreach( $data as $key => $dataset )
		{
			$total++;

			if( !isset( $types[ $dataset['typeid'] ] ) ) {
				throw new Exception( sprintf( 'No plugin type "%1$s" found', $dataset['typeid'] ) );
			}

			$item->setId( null );
			$item->setTypeId( $types[ $dataset['typeid'] ]->getId() );
			$item->setProvider( $dataset['provider'] );
			$item->setLabel( $dataset['label'] );
			$item->setConfig( $dataset['config'] );
			$item->setStatus( $dataset['status'] );

			if( isset( $dataset['position'] ) ) {
				$item->setPosition( $dataset['position'] );
			}

			try {
				$pluginManager->saveItem( $item );
				$num++;
			} catch( Exception $e ) { ; } // if plugin configuration was already available
		}

		$this->_status( $num > 0 ? $num . '/' . $total : 'OK' );
	}
protected function _addPluginData( MShop_Common_Manager_Interface $pluginManager, array $data )
	{
		$this->_msg( 'Adding data for MShop plugins', 1 );

		$types = array();
		$manager = $pluginManager->getSubManager( 'type' );

		foreach( $manager->searchItems( $manager->createSearch() ) as $item ) {
			$types[ 'plugin/' . $item->getCode() ] = $item;
		}

		$num = $total = 0;
		$item = $pluginManager->createItem();

		foreach( $data as $key => $dataset )
		{
			$total++;

			if( !isset( $types[ $dataset['typeid'] ] ) ) {
				throw new Exception( sprintf( 'No plugin type "%1$s" found', $dataset['typeid'] ) );
			}

			$item->setId( null );
			$item->setTypeId( $types[ $dataset['typeid'] ]->getId() );
			$item->setProvider( $dataset['provider'] );
			$item->setLabel( $dataset['label'] );
			$item->setConfig( $dataset['config'] );
			$item->setStatus( $dataset['status'] );

			if( isset( $dataset['position'] ) ) {
				$item->setPosition( $dataset['position'] );
			}

			try {
				$pluginManager->saveItem( $item );
				$num++;
			} catch( Exception $e ) { ; } // if plugin configuration was already available
		}

		$this->_status( $num > 0 ? $num . '/' . $total : 'OK' );
	}
protected function _addPluginData ( MShop_Common_Manager_Interface $ pluginManager , array $ data ) { $ this -> _msg ( 'Adding data for MShop plugins' , 1 ) ; $ types = array ( ) ; $ manager = $ pluginManager -> getSubManager ( 'type' ) ; foreach ( $ manager -> searchItems ( $ manager -> createSearch ( ) ) as $ item ) { $ types [ 'plugin/' . $ item -> getCode ( ) ] = $ item ; } $ num = $ total = 0 ; $ item = $ pluginManager -> createItem ( ) ; foreach ( $ data as $ key => $ dataset ) { $ total ++ ; if ( ! isset ( $ types [ $ dataset [ 'typeid' ] ] ) ) { throw new Exception ( sprintf ( 'No plugin type "%1$s" found' , $ dataset [ 'typeid' ] ) ) ; } $ item -> setId ( null ) ; $ item -> setTypeId ( $ types [ $ dataset [ 'typeid' ] ] -> getId ( ) ) ; $ item -> setProvider ( $ dataset [ 'provider' ] ) ; $ item -> setLabel ( $ dataset [ 'label' ] ) ; $ item -> setConfig ( $ dataset [ 'config' ] ) ; $ item -> setStatus ( $ dataset [ 'status' ] ) ; if ( isset ( $ dataset [ 'position' ] ) ) { $ item -> setPosition ( $ dataset [ 'position' ] ) ; } try { $ pluginManager -> saveItem ( $ item ) ; $ num ++ ; } catch ( Exception $ e ) { ; } // if plugin configuration was already available } $ this -> _status ( $ num > 0 ? $ num . '/' . $ total : 'OK' ) ; }
Adds plugin data.

@param MShop_Common_Manager_Interface $pluginManager Plugin manager
@param array $data Associative list of plugin data
Adds plugin data .