public function getClassForm(core_kernel_classes_Class $clazz)
    {
        $propMode = 'simple';
        if($this->hasSessionAttribute('property_mode')){
            $propMode = $this->getSessionAttribute('property_mode');
        }

        $options = array(
            'property_mode' => $propMode,
            'topClazz' => $this->getClass(GenerisRdf::CLASS_GENERIS_RESOURCE)
        );
        $data = $this->getRequestParameters();
        $formContainer = new tao_actions_form_Clazz($clazz, $this->extractClassData($data), $this->extractPropertyData($data), $propMode);
        $myForm = $formContainer->getForm();

        if($myForm->isSubmited()){
            if($myForm->isValid()){
                //get the data from parameters

                // get class data and save them
                if(isset($data['class'])){
                    $classValues = array();
                    foreach($data['class'] as $key => $value){
                        $classKey =  tao_helpers_Uri::decode($key);
                        $classValues[$classKey] =  tao_helpers_Uri::decode($value);
                    }

                    $this->bindProperties($clazz, $classValues);
                }

                //save all properties values
                if(isset($data['properties'])){
                    foreach($data['properties'] as $i => $propertyValues) {
                        //get index values
                        $indexes = null;
                        if(isset($propertyValues['indexes'])){
                            $indexes = $propertyValues['indexes'];
                            unset($propertyValues['indexes']);
                        }
                        if($propMode === 'simple') {
                            $this->saveSimpleProperty($propertyValues);
                        } else {
                            $this->saveAdvProperty($propertyValues);
                        }

                        //save index
                        if(!is_null($indexes)){
                            foreach($indexes as $indexValues){
                                $this->savePropertyIndex($indexValues);
                            }
                        }
                    }
                }
            }
        }
        return $myForm;
    }
public function getClassForm(core_kernel_classes_Class $clazz)
    {
        $propMode = 'simple';
        if($this->hasSessionAttribute('property_mode')){
            $propMode = $this->getSessionAttribute('property_mode');
        }

        $options = array(
            'property_mode' => $propMode,
            'topClazz' => $this->getClass(GenerisRdf::CLASS_GENERIS_RESOURCE)
        );
        $data = $this->getRequestParameters();
        $formContainer = new tao_actions_form_Clazz($clazz, $this->extractClassData($data), $this->extractPropertyData($data), $propMode);
        $myForm = $formContainer->getForm();

        if($myForm->isSubmited()){
            if($myForm->isValid()){
                //get the data from parameters

                // get class data and save them
                if(isset($data['class'])){
                    $classValues = array();
                    foreach($data['class'] as $key => $value){
                        $classKey =  tao_helpers_Uri::decode($key);
                        $classValues[$classKey] =  tao_helpers_Uri::decode($value);
                    }

                    $this->bindProperties($clazz, $classValues);
                }

                //save all properties values
                if(isset($data['properties'])){
                    foreach($data['properties'] as $i => $propertyValues) {
                        //get index values
                        $indexes = null;
                        if(isset($propertyValues['indexes'])){
                            $indexes = $propertyValues['indexes'];
                            unset($propertyValues['indexes']);
                        }
                        if($propMode === 'simple') {
                            $this->saveSimpleProperty($propertyValues);
                        } else {
                            $this->saveAdvProperty($propertyValues);
                        }

                        //save index
                        if(!is_null($indexes)){
                            foreach($indexes as $indexValues){
                                $this->savePropertyIndex($indexValues);
                            }
                        }
                    }
                }
            }
        }
        return $myForm;
    }
public function getClassForm ( core_kernel_classes_Class $ clazz ) { $ propMode = 'simple' ; if ( $ this -> hasSessionAttribute ( 'property_mode' ) ) { $ propMode = $ this -> getSessionAttribute ( 'property_mode' ) ; } $ options = array ( 'property_mode' => $ propMode , 'topClazz' => $ this -> getClass ( GenerisRdf :: CLASS_GENERIS_RESOURCE ) ) ; $ data = $ this -> getRequestParameters ( ) ; $ formContainer = new tao_actions_form_Clazz ( $ clazz , $ this -> extractClassData ( $ data ) , $ this -> extractPropertyData ( $ data ) , $ propMode ) ; $ myForm = $ formContainer -> getForm ( ) ; if ( $ myForm -> isSubmited ( ) ) { if ( $ myForm -> isValid ( ) ) { //get the data from parameters // get class data and save them if ( isset ( $ data [ 'class' ] ) ) { $ classValues = array ( ) ; foreach ( $ data [ 'class' ] as $ key => $ value ) { $ classKey = tao_helpers_Uri :: decode ( $ key ) ; $ classValues [ $ classKey ] = tao_helpers_Uri :: decode ( $ value ) ; } $ this -> bindProperties ( $ clazz , $ classValues ) ; } //save all properties values if ( isset ( $ data [ 'properties' ] ) ) { foreach ( $ data [ 'properties' ] as $ i => $ propertyValues ) { //get index values $ indexes = null ; if ( isset ( $ propertyValues [ 'indexes' ] ) ) { $ indexes = $ propertyValues [ 'indexes' ] ; unset ( $ propertyValues [ 'indexes' ] ) ; } if ( $ propMode === 'simple' ) { $ this -> saveSimpleProperty ( $ propertyValues ) ; } else { $ this -> saveAdvProperty ( $ propertyValues ) ; } //save index if ( ! is_null ( $ indexes ) ) { foreach ( $ indexes as $ indexValues ) { $ this -> savePropertyIndex ( $ indexValues ) ; } } } } } } return $ myForm ; }
Create an edit form for a class and its property
and handle the submited data on save

@param core_kernel_classes_Class    $clazz
@param core_kernel_classes_Resource $resource
@return tao_helpers_form_Form the generated form
Create an edit form for a class and its property and handle the submited data on save