public function createQtiItem()
    {
        try {
            // Check if it's post method
            if ($this->getRequestMethod()!=Request::HTTP_POST) {
                throw new \common_exception_NotImplemented('Only post method is accepted to create empty item.');
            }

            $label = $this->hasRequestParameter('label') ? $this->getRequestParameter('label') : '';
            // Call service to import package
            $item = $this->getDestinationClass()->createInstance($label);
            
            //set the QTI type
            $itemService = \taoItems_models_classes_ItemsService::singleton();
            $itemService->setItemModel($item, $this->getResource(ItemModel::MODEL_URI));

            $this->returnSuccess($item->getUri());

        } catch (\Exception $e) {
            $this->returnFailure($e);
        }
    }
public function createQtiItem()
    {
        try {
            // Check if it's post method
            if ($this->getRequestMethod()!=Request::HTTP_POST) {
                throw new \common_exception_NotImplemented('Only post method is accepted to create empty item.');
            }

            $label = $this->hasRequestParameter('label') ? $this->getRequestParameter('label') : '';
            // Call service to import package
            $item = $this->getDestinationClass()->createInstance($label);
            
            //set the QTI type
            $itemService = \taoItems_models_classes_ItemsService::singleton();
            $itemService->setItemModel($item, $this->getResource(ItemModel::MODEL_URI));

            $this->returnSuccess($item->getUri());

        } catch (\Exception $e) {
            $this->returnFailure($e);
        }
    }
public function createQtiItem ( ) { try { // Check if it's post method if ( $ this -> getRequestMethod ( ) != Request :: HTTP_POST ) { throw new \ common_exception_NotImplemented ( 'Only post method is accepted to create empty item.' ) ; } $ label = $ this -> hasRequestParameter ( 'label' ) ? $ this -> getRequestParameter ( 'label' ) : '' ; // Call service to import package $ item = $ this -> getDestinationClass ( ) -> createInstance ( $ label ) ; //set the QTI type $ itemService = \ taoItems_models_classes_ItemsService :: singleton ( ) ; $ itemService -> setItemModel ( $ item , $ this -> getResource ( ItemModel :: MODEL_URI ) ) ; $ this -> returnSuccess ( $ item -> getUri ( ) ) ; } catch ( \ Exception $ e ) { $ this -> returnFailure ( $ e ) ; } }
Create an empty item
Create an empty item