Hello everyone. I have a question, I know how I have to do that when I add data in a table does not add inches to the other pages too, meaning that each record is displayed only in that table. Thank you very much, I leave the code:
NuevoEquipo.php
class NuevoEquipo extends NuevaZona {
static $db = array(
'Pos' => 'Int',
'PJ' => 'Int',
'PG' => 'Int',
'PE' => 'Int',
'PP' => 'Int',
'GF' => 'Int',
'GC' => 'Int',
'DG' => 'Int',
'Puntos' => 'Int',
'Nro' => '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 $has_many = array(
//'Equipo' => 'NuevoEquipo'
//);
static $has_many = array(
'MiEquipo' => 'Equipos'
);
// function getCMSFields_forPopup() {
//$fields = new FieldSet();
//$fields->push( new TextField( 'Nombre' ) );
//return $fields;
// }
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Posicion", new FieldGroup(
new NumericField('Pos'),
new NumericField('PJ'),
new NumericField('PG'),
new NumericField('PE'),
new NumericField('PP'),
new NumericField('GF'),
new NumericField('GC'),
new NumericField('DG'),
new NumericField('Puntos')
));
$playersTablefield = new HasManyComplexTableField(
$this,
'MiEquipo',
'Equipos',
array(
'Nombre' => 'Nombre'
),
'getCMSFields_forPopup'
);
$playersTablefield->setAddTitle( 'jugador' );
$fields->addFieldToTab( 'Root.Content.Estadisticas', $playersTablefield );
return $fields;
}
}
class NuevoEquipo_Controller extends NuevaZona_Controller {
public static $allowed_actions = array (
);
}
Equipo.php
<?php
class Equipos extends DataObject {
static $db = array(
'Nombre' => 'text'
);
static $has_one = array(
'Teams' => 'NuevoEquipo'
);
function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push( new TextField( 'Nombre' ) );
return $fields;
}
}
As you can see the images "Pepe" is added on every page (Equipo A, Equipo BB and the others), and what I want is to see only the page that I add, Hope your help!!!! Greetings