public function authoring()
    {
        $this->defaultData();

        $item = $this->getResource($this->getRequestParameter('id'));

        if(!$this->isLocked($item, 'item_locked.tpl')){

            $this->setData('error', false);
            try{

                $itemModel = $this->getClassService()->getItemModel($item);
                if(!is_null($itemModel)){
                    $itemModelImpl = $this->getClassService()->getItemModelImplementation($itemModel);
                    $authoringUrl = $itemModelImpl->getAuthoringUrl($item);
                    if(!empty($authoringUrl)){
                        LockManager::getImplementation()->setLock($item, $this->getSession()->getUser()->getIdentifier());

                        return $this->forwardUrl($authoringUrl);
                    }
                }
                throw new common_exception_NoImplementation();
                $this->setData('instanceUri', tao_helpers_Uri::encode($item->getUri(), false));

            } catch (Exception $e) {
                if ($e instanceof InterruptedActionException) {
                    throw $e;
                }
                $this->setData('error', true);
                //build clear error or warning message:
                if(!empty($itemModel) && $itemModel instanceof core_kernel_classes_Resource){
                    $errorMsg = __('No item authoring tool available for the selected type of item: %s'.$itemModel->getLabel());
                }else{
                    $errorMsg = __('No item type selected for the current item.')." {$item->getLabel()} ".__('Please select first the item type!');
                }
                $this->setData('errorMsg', $errorMsg);
            }
        }
    }
public function authoring()
    {
        $this->defaultData();

        $item = $this->getResource($this->getRequestParameter('id'));

        if(!$this->isLocked($item, 'item_locked.tpl')){

            $this->setData('error', false);
            try{

                $itemModel = $this->getClassService()->getItemModel($item);
                if(!is_null($itemModel)){
                    $itemModelImpl = $this->getClassService()->getItemModelImplementation($itemModel);
                    $authoringUrl = $itemModelImpl->getAuthoringUrl($item);
                    if(!empty($authoringUrl)){
                        LockManager::getImplementation()->setLock($item, $this->getSession()->getUser()->getIdentifier());

                        return $this->forwardUrl($authoringUrl);
                    }
                }
                throw new common_exception_NoImplementation();
                $this->setData('instanceUri', tao_helpers_Uri::encode($item->getUri(), false));

            } catch (Exception $e) {
                if ($e instanceof InterruptedActionException) {
                    throw $e;
                }
                $this->setData('error', true);
                //build clear error or warning message:
                if(!empty($itemModel) && $itemModel instanceof core_kernel_classes_Resource){
                    $errorMsg = __('No item authoring tool available for the selected type of item: %s'.$itemModel->getLabel());
                }else{
                    $errorMsg = __('No item type selected for the current item.')." {$item->getLabel()} ".__('Please select first the item type!');
                }
                $this->setData('errorMsg', $errorMsg);
            }
        }
    }
public function authoring ( ) { $ this -> defaultData ( ) ; $ item = $ this -> getResource ( $ this -> getRequestParameter ( 'id' ) ) ; if ( ! $ this -> isLocked ( $ item , 'item_locked.tpl' ) ) { $ this -> setData ( 'error' , false ) ; try { $ itemModel = $ this -> getClassService ( ) -> getItemModel ( $ item ) ; if ( ! is_null ( $ itemModel ) ) { $ itemModelImpl = $ this -> getClassService ( ) -> getItemModelImplementation ( $ itemModel ) ; $ authoringUrl = $ itemModelImpl -> getAuthoringUrl ( $ item ) ; if ( ! empty ( $ authoringUrl ) ) { LockManager :: getImplementation ( ) -> setLock ( $ item , $ this -> getSession ( ) -> getUser ( ) -> getIdentifier ( ) ) ; return $ this -> forwardUrl ( $ authoringUrl ) ; } } throw new common_exception_NoImplementation ( ) ; $ this -> setData ( 'instanceUri' , tao_helpers_Uri :: encode ( $ item -> getUri ( ) , false ) ) ; } catch ( Exception $ e ) { if ( $ e instanceof InterruptedActionException ) { throw $ e ; } $ this -> setData ( 'error' , true ) ; //build clear error or warning message: if ( ! empty ( $ itemModel ) && $ itemModel instanceof core_kernel_classes_Resource ) { $ errorMsg = __ ( 'No item authoring tool available for the selected type of item: %s' . $ itemModel -> getLabel ( ) ) ; } else { $ errorMsg = __ ( 'No item type selected for the current item.' ) . " {$item->getLabel()} " . __ ( 'Please select first the item type!' ) ; } $ this -> setData ( 'errorMsg' , $ errorMsg ) ; } } }
Item Authoring tool loader action
@requiresRight id WRITE
Item Authoring tool loader action