public function getMaintenanceModel($detailed = false, $action = 'index')
    {
        if (isset($this->_maintenanceModels[$action])) {
            return $this->_maintenanceModels[$action];
        }

        $model = $this->tracker->createTrackClass('Model\\FieldMaintenanceModel');

        if ($detailed) {
            if (('edit' === $action) || ('create' === $action)) {
                $model->applyEditSettings();

                if ('create' === $action) {
                    $model->set('gtf_id_track', 'default', $this->_trackId);

                    // Set the default round order

                    // Load last row
                    $row = $model->loadFirst(
                            array('gtf_id_track' => $this->_trackId),
                            array('gtf_id_order' => SORT_DESC),
                            false // Make sure this does not trigger type dependency
                            );

                    if ($row && isset($row['gtf_id_order'])) {
                        $newOrder = $row['gtf_id_order'] + 10;
                        $model->set('gtf_id_order', 'default', $newOrder);
                    }
                }
            } else {
                $model->applyDetailSettings();
            }

        } else {
            $model->applyBrowseSettings();
        }

        $this->_maintenanceModels[$action] = $model;

        return $model;
    }
public function getMaintenanceModel($detailed = false, $action = 'index')
    {
        if (isset($this->_maintenanceModels[$action])) {
            return $this->_maintenanceModels[$action];
        }

        $model = $this->tracker->createTrackClass('Model\\FieldMaintenanceModel');

        if ($detailed) {
            if (('edit' === $action) || ('create' === $action)) {
                $model->applyEditSettings();

                if ('create' === $action) {
                    $model->set('gtf_id_track', 'default', $this->_trackId);

                    // Set the default round order

                    // Load last row
                    $row = $model->loadFirst(
                            array('gtf_id_track' => $this->_trackId),
                            array('gtf_id_order' => SORT_DESC),
                            false // Make sure this does not trigger type dependency
                            );

                    if ($row && isset($row['gtf_id_order'])) {
                        $newOrder = $row['gtf_id_order'] + 10;
                        $model->set('gtf_id_order', 'default', $newOrder);
                    }
                }
            } else {
                $model->applyDetailSettings();
            }

        } else {
            $model->applyBrowseSettings();
        }

        $this->_maintenanceModels[$action] = $model;

        return $model;
    }
public function getMaintenanceModel ( $ detailed = false , $ action = 'index' ) { if ( isset ( $ this -> _maintenanceModels [ $ action ] ) ) { return $ this -> _maintenanceModels [ $ action ] ; } $ model = $ this -> tracker -> createTrackClass ( 'Model\\FieldMaintenanceModel' ) ; if ( $ detailed ) { if ( ( 'edit' === $ action ) || ( 'create' === $ action ) ) { $ model -> applyEditSettings ( ) ; if ( 'create' === $ action ) { $ model -> set ( 'gtf_id_track' , 'default' , $ this -> _trackId ) ; // Set the default round order // Load last row $ row = $ model -> loadFirst ( array ( 'gtf_id_track' => $ this -> _trackId ) , array ( 'gtf_id_order' => SORT_DESC ) , false // Make sure this does not trigger type dependency ) ; if ( $ row && isset ( $ row [ 'gtf_id_order' ] ) ) { $ newOrder = $ row [ 'gtf_id_order' ] + 10 ; $ model -> set ( 'gtf_id_order' , 'default' , $ newOrder ) ; } } } else { $ model -> applyDetailSettings ( ) ; } } else { $ model -> applyBrowseSettings ( ) ; } $ this -> _maintenanceModels [ $ action ] = $ model ; return $ model ; }
Returns a model that can be used to retrieve or save the field definitions for the track editor.

@param boolean $detailed Create a model for the display of detailed item data or just a browse table
@param string $action The current action
@return \Gems\Tracker\Model\FieldMaintenanceModel
Returns a model that can be used to retrieve or save the field definitions for the track editor .