public function addInstanceForm()
    {
        if(!$this->isXmlHttpRequest()){
            throw new common_exception_BadRequest('wrong request mode');
        }

        $clazz = $this->getCurrentClass();
        $formContainer = new tao_actions_form_CreateInstance(array($clazz), array());
        $myForm = $formContainer->getForm();

        if ($myForm->isSubmited() && $myForm->isValid()) {
            $properties = $myForm->getValues();
            $instance = $this->createInstance(array($clazz), $properties);

            $this->setData('message', __('%s created', $instance->getLabel()));
            $this->setData('reload', true);
        }

        $this->setData('formTitle', __('Create instance of ').$clazz->getLabel());
        $this->setData('myForm', $myForm->render());

        $this->setView('form.tpl', 'tao');
    }
public function addInstanceForm()
    {
        if(!$this->isXmlHttpRequest()){
            throw new common_exception_BadRequest('wrong request mode');
        }

        $clazz = $this->getCurrentClass();
        $formContainer = new tao_actions_form_CreateInstance(array($clazz), array());
        $myForm = $formContainer->getForm();

        if ($myForm->isSubmited() && $myForm->isValid()) {
            $properties = $myForm->getValues();
            $instance = $this->createInstance(array($clazz), $properties);

            $this->setData('message', __('%s created', $instance->getLabel()));
            $this->setData('reload', true);
        }

        $this->setData('formTitle', __('Create instance of ').$clazz->getLabel());
        $this->setData('myForm', $myForm->render());

        $this->setView('form.tpl', 'tao');
    }
public function addInstanceForm ( ) { if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new common_exception_BadRequest ( 'wrong request mode' ) ; } $ clazz = $ this -> getCurrentClass ( ) ; $ formContainer = new tao_actions_form_CreateInstance ( array ( $ clazz ) , array ( ) ) ; $ myForm = $ formContainer -> getForm ( ) ; if ( $ myForm -> isSubmited ( ) && $ myForm -> isValid ( ) ) { $ properties = $ myForm -> getValues ( ) ; $ instance = $ this -> createInstance ( array ( $ clazz ) , $ properties ) ; $ this -> setData ( 'message' , __ ( '%s created' , $ instance -> getLabel ( ) ) ) ; $ this -> setData ( 'reload' , true ) ; } $ this -> setData ( 'formTitle' , __ ( 'Create instance of ' ) . $ clazz -> getLabel ( ) ) ; $ this -> setData ( 'myForm' , $ myForm -> render ( ) ) ; $ this -> setView ( 'form.tpl' , 'tao' ) ; }
Add an instance of the selected class
@throws common_exception_BadRequest
@return void
Add an instance of the selected class