public function index(){

        $test = new \core_kernel_classes_Resource($this->getRequestParameter('uri'));
        
        $model = $this->getServiceManager()->get(TestModel::SERVICE_ID);

        $itemSequence = array();
        $itemUris = array();
        $counter = 1;
        foreach($model->getItems($test) as $item){
            $itemUris[] = $item->getUri();
            $itemSequence[$counter] = array(
                'uri' 	=> tao_helpers_Uri::encode($item->getUri()),
                'label' => $item->getLabel()
            );
            $counter++;
        }
        
		// data for item sequence, terrible solution
		// @todo implement an ajax request for labels or pass from tree to sequence
		$allItems = array();
		foreach(\taoTests_models_classes_TestsService::singleton()->getAllItems() as $itemUri => $itemLabel){
			$allItems['item_'.tao_helpers_Uri::encode($itemUri)] = $itemLabel;
		}


        $config = $model->getConfig($test);
        $checked = (isset($config['previous']))? $config['previous'] : false;
        $testConfig['previous'] = array('label' => __('Allow test-taker to go back in test'), 'checked' => $checked);

		$this->setData('uri', $test->getUri());
    	$this->setData('allItems', json_encode($allItems));
		$this->setData('itemSequence', $itemSequence);
		$this->setData('testConfig', $testConfig);

		// data for generis tree form
		$this->setData('relatedItems', json_encode(tao_helpers_Uri::encodeArray($itemUris)));

		$openNodes = TreeHelper::getNodesToOpen($itemUris, new core_kernel_classes_Class(TaoOntology::ITEM_CLASS_URI));
		$this->setData('itemRootNode', TaoOntology::ITEM_CLASS_URI);
		$this->setData('itemOpenNodes', $openNodes);
		$this->setData('saveUrl', _url('saveItems', 'Authoring', 'taoTestLinear'));
        $this->setView('Authoring/index.tpl');
    }
public function index(){

        $test = new \core_kernel_classes_Resource($this->getRequestParameter('uri'));
        
        $model = $this->getServiceManager()->get(TestModel::SERVICE_ID);

        $itemSequence = array();
        $itemUris = array();
        $counter = 1;
        foreach($model->getItems($test) as $item){
            $itemUris[] = $item->getUri();
            $itemSequence[$counter] = array(
                'uri' 	=> tao_helpers_Uri::encode($item->getUri()),
                'label' => $item->getLabel()
            );
            $counter++;
        }
        
		// data for item sequence, terrible solution
		// @todo implement an ajax request for labels or pass from tree to sequence
		$allItems = array();
		foreach(\taoTests_models_classes_TestsService::singleton()->getAllItems() as $itemUri => $itemLabel){
			$allItems['item_'.tao_helpers_Uri::encode($itemUri)] = $itemLabel;
		}


        $config = $model->getConfig($test);
        $checked = (isset($config['previous']))? $config['previous'] : false;
        $testConfig['previous'] = array('label' => __('Allow test-taker to go back in test'), 'checked' => $checked);

		$this->setData('uri', $test->getUri());
    	$this->setData('allItems', json_encode($allItems));
		$this->setData('itemSequence', $itemSequence);
		$this->setData('testConfig', $testConfig);

		// data for generis tree form
		$this->setData('relatedItems', json_encode(tao_helpers_Uri::encodeArray($itemUris)));

		$openNodes = TreeHelper::getNodesToOpen($itemUris, new core_kernel_classes_Class(TaoOntology::ITEM_CLASS_URI));
		$this->setData('itemRootNode', TaoOntology::ITEM_CLASS_URI);
		$this->setData('itemOpenNodes', $openNodes);
		$this->setData('saveUrl', _url('saveItems', 'Authoring', 'taoTestLinear'));
        $this->setView('Authoring/index.tpl');
    }
public function index ( ) { $ test = new \ core_kernel_classes_Resource ( $ this -> getRequestParameter ( 'uri' ) ) ; $ model = $ this -> getServiceManager ( ) -> get ( TestModel :: SERVICE_ID ) ; $ itemSequence = array ( ) ; $ itemUris = array ( ) ; $ counter = 1 ; foreach ( $ model -> getItems ( $ test ) as $ item ) { $ itemUris [ ] = $ item -> getUri ( ) ; $ itemSequence [ $ counter ] = array ( 'uri' => tao_helpers_Uri :: encode ( $ item -> getUri ( ) ) , 'label' => $ item -> getLabel ( ) ) ; $ counter ++ ; } // data for item sequence, terrible solution // @todo implement an ajax request for labels or pass from tree to sequence $ allItems = array ( ) ; foreach ( \ taoTests_models_classes_TestsService :: singleton ( ) -> getAllItems ( ) as $ itemUri => $ itemLabel ) { $ allItems [ 'item_' . tao_helpers_Uri :: encode ( $ itemUri ) ] = $ itemLabel ; } $ config = $ model -> getConfig ( $ test ) ; $ checked = ( isset ( $ config [ 'previous' ] ) ) ? $ config [ 'previous' ] : false ; $ testConfig [ 'previous' ] = array ( 'label' => __ ( 'Allow test-taker to go back in test' ) , 'checked' => $ checked ) ; $ this -> setData ( 'uri' , $ test -> getUri ( ) ) ; $ this -> setData ( 'allItems' , json_encode ( $ allItems ) ) ; $ this -> setData ( 'itemSequence' , $ itemSequence ) ; $ this -> setData ( 'testConfig' , $ testConfig ) ; // data for generis tree form $ this -> setData ( 'relatedItems' , json_encode ( tao_helpers_Uri :: encodeArray ( $ itemUris ) ) ) ; $ openNodes = TreeHelper :: getNodesToOpen ( $ itemUris , new core_kernel_classes_Class ( TaoOntology :: ITEM_CLASS_URI ) ) ; $ this -> setData ( 'itemRootNode' , TaoOntology :: ITEM_CLASS_URI ) ; $ this -> setData ( 'itemOpenNodes' , $ openNodes ) ; $ this -> setData ( 'saveUrl' , _url ( 'saveItems' , 'Authoring' , 'taoTestLinear' ) ) ; $ this -> setView ( 'Authoring/index.tpl' ) ; }
Renders the auhtoring for simple tests
Renders the auhtoring for simple tests