protected function getCreatorConfig(core_kernel_classes_Resource $item){

        $config = new CreatorConfig();

        $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem');
        $creatorConfig = $ext->getConfig('qtiCreator');

        if (is_array($creatorConfig)) {
            foreach ($creatorConfig as $prop => $value) {
                $config->setProperty($prop, $value);
            }
        }

        $config->setProperty('uri', $item->getUri());
        $config->setProperty('label', $item->getLabel());

        //set the current data lang in the item content to keep the integrity
        //@todo : allow preview in a language other than the one in the session
        $lang = \common_session_SessionManager::getSession()->getDataLanguage();
        $config->setProperty('lang', $lang);

        //base url:
        $url = tao_helpers_Uri::url('getFile', 'QtiCreator', 'taoQtiItem', array(
            'uri' => $item->getUri(),
            'lang' => $lang,
            'relPath' => ''
        ));
        $config->setProperty('baseUrl', $url);

        //map the multi column config to the plugin
        //TODO migrate the config
        if($config->getProperty('multi-column') == true){
            $config->addPlugin('blockAdder', 'taoQtiItem/qtiCreator/plugins/content/blockAdder', 'content');
        }

        $mediaSourcesUrl = tao_helpers_Uri::url(
            'getMediaSources',
            'QtiCreator',
            'taoQtiItem'
        );

        $config->setProperty('mediaSourcesUrl', $mediaSourcesUrl);

        //initialize all registered hooks:
        $hookClasses = HookRegistry::getRegistry()->getMap();
        foreach ($hookClasses as $hookClass) {
            $hook = new $hookClass();
            $hook->init($config);
        }

        $config->init();

        return $config;
    }
protected function getCreatorConfig(core_kernel_classes_Resource $item){

        $config = new CreatorConfig();

        $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem');
        $creatorConfig = $ext->getConfig('qtiCreator');

        if (is_array($creatorConfig)) {
            foreach ($creatorConfig as $prop => $value) {
                $config->setProperty($prop, $value);
            }
        }

        $config->setProperty('uri', $item->getUri());
        $config->setProperty('label', $item->getLabel());

        //set the current data lang in the item content to keep the integrity
        //@todo : allow preview in a language other than the one in the session
        $lang = \common_session_SessionManager::getSession()->getDataLanguage();
        $config->setProperty('lang', $lang);

        //base url:
        $url = tao_helpers_Uri::url('getFile', 'QtiCreator', 'taoQtiItem', array(
            'uri' => $item->getUri(),
            'lang' => $lang,
            'relPath' => ''
        ));
        $config->setProperty('baseUrl', $url);

        //map the multi column config to the plugin
        //TODO migrate the config
        if($config->getProperty('multi-column') == true){
            $config->addPlugin('blockAdder', 'taoQtiItem/qtiCreator/plugins/content/blockAdder', 'content');
        }

        $mediaSourcesUrl = tao_helpers_Uri::url(
            'getMediaSources',
            'QtiCreator',
            'taoQtiItem'
        );

        $config->setProperty('mediaSourcesUrl', $mediaSourcesUrl);

        //initialize all registered hooks:
        $hookClasses = HookRegistry::getRegistry()->getMap();
        foreach ($hookClasses as $hookClass) {
            $hook = new $hookClass();
            $hook->init($config);
        }

        $config->init();

        return $config;
    }
protected function getCreatorConfig ( core_kernel_classes_Resource $ item ) { $ config = new CreatorConfig ( ) ; $ ext = \ common_ext_ExtensionsManager :: singleton ( ) -> getExtensionById ( 'taoQtiItem' ) ; $ creatorConfig = $ ext -> getConfig ( 'qtiCreator' ) ; if ( is_array ( $ creatorConfig ) ) { foreach ( $ creatorConfig as $ prop => $ value ) { $ config -> setProperty ( $ prop , $ value ) ; } } $ config -> setProperty ( 'uri' , $ item -> getUri ( ) ) ; $ config -> setProperty ( 'label' , $ item -> getLabel ( ) ) ; //set the current data lang in the item content to keep the integrity //@todo : allow preview in a language other than the one in the session $ lang = \ common_session_SessionManager :: getSession ( ) -> getDataLanguage ( ) ; $ config -> setProperty ( 'lang' , $ lang ) ; //base url: $ url = tao_helpers_Uri :: url ( 'getFile' , 'QtiCreator' , 'taoQtiItem' , array ( 'uri' => $ item -> getUri ( ) , 'lang' => $ lang , 'relPath' => '' ) ) ; $ config -> setProperty ( 'baseUrl' , $ url ) ; //map the multi column config to the plugin //TODO migrate the config if ( $ config -> getProperty ( 'multi-column' ) == true ) { $ config -> addPlugin ( 'blockAdder' , 'taoQtiItem/qtiCreator/plugins/content/blockAdder' , 'content' ) ; } $ mediaSourcesUrl = tao_helpers_Uri :: url ( 'getMediaSources' , 'QtiCreator' , 'taoQtiItem' ) ; $ config -> setProperty ( 'mediaSourcesUrl' , $ mediaSourcesUrl ) ; //initialize all registered hooks: $ hookClasses = HookRegistry :: getRegistry ( ) -> getMap ( ) ; foreach ( $ hookClasses as $ hookClass ) { $ hook = new $ hookClass ( ) ; $ hook -> init ( $ config ) ; } $ config -> init ( ) ; return $ config ; }
Get the configuration of the Item Creator
@param core_kernel_classes_Resource $item the selected item
@return CreatorConfig the configration
Get the configuration of the Item Creator