look at the code
NuevoEquipo.php
class NuevoEquipo extends NuevaZona {
static $has_many = array(
'MiEquipo' => 'Equipos'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$playersTablefield = new DataObjectManager(
$this,
'MiEquipo',
'Equipos',
array(
'Nro_jugad' => 'Nro',
'Nombre' => 'Apellido y Nombre',
'PJ_jugad' => 'PJ',
'PG_jugad' => 'PG',
'PE_jugad' => 'PE',
'PP_jugad' => 'PP',
'Goles' => 'Goles',
'Prom' => 'Prom. G/P',
'Tarj_a' => 'Tarj. Amarillas',
'Tarj_r' => 'Tarj. Rojas'
),
'getCMSFields_forPopup'
);
$playersTablefield->setAddTitle( 'jugador' );
$fields->addFieldToTab( 'Root.Content.Jugadores', $playersTablefield );
return $fields;
}
}
..............................................................................................................................................................................................................
Equipos.php
class Equipos extends DataObject {
static $db = array(
'Nro_jugad' => 'Int',
'Nombre' => 'text',
'PJ_jugad' => 'Int',
'PG_jugad' => 'Int',
'PE_jugad' => 'Int',
'PP_jugad' => 'Int',
'Goles' => 'Int',
'Prom' => 'Int',
'Tarj_a' => 'Int',
'Tarj_r' => 'Int'
);
static $default_sort = "Nro_jugad ASC";
static $has_one = array(
'Teams' => 'NuevoEquipo'
);
function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push( new NumericField( 'Nro_jugad','Nro' ) );
$fields->push( new TextField( 'Nombre','Apellido y Nombre' ) );
$fields->push( new NumericField( 'PJ_jugad','PJ' ) );
$fields->push( new NumericField( 'PG_jugad','PG' ) );
$fields->push( new NumericField( 'PE_jugad','PE' ) );
$fields->push( new NumericField( 'PP_jugad','PP' ) );
$fields->push( new NumericField( 'Goles' ) );
$fields->push( new NumericField( 'Prom','Prom. G/P' ) );
$fields->push( new NumericField( 'Tarj_a','Tarj. Amarillas' ) );
$fields->push( new NumericField( 'Tarj_r','Tarj. Rojas' ) );
return $fields;
}
}
As you can see in the picture "team" is a table with the names of players and other data, what I want is that this table only shows what I select (using checkboxfields ) in the table of the cms (see picture cms ).
Implement dataobjectmanager because otherwise the data will also create in the other teams and I do not want this to happen.
I'm sorry if I sound so good in English.