Cheers Blackdog... I sure do,
I have created a function that works out whether w the user is on the "list employer members" or "list candidate members" page. It then creates all the relevant fields to show the data from the table. The LEFT JOIN is required to filter by groupID.
What I would like is to have a CTF (or similar) at the bottom of the Popup showing what vacancies the Employer has posted, and what vacancies the candidates have applied to.
Here is my could so far:
public function EditForm() {
/*
* Call function to find which section we are on
* Employers or Candidates
*/
$section = $this->Section();
if($section == 'employers') {
$title = "<h2>Employers</h2>";
$filter = "Group_Members.GroupID = 2";
$sort = "Member.ID Desc";
}else if ($section == 'candidates'){
$title = "<h2>Candidates</h2>";
$filter = "Group_Members.GroupID = 3";
$sort = "Member.ID Desc";
}
/*
* Create table list fields
*/
$fieldList = array(
'FirstName' => 'First name',
'Surname' => 'Surname',
'Email' => 'Email',
'Company' => 'Company',
'City' => 'City',
'Country' => 'Country',
'GroupID' => "Group"
);
/*
* Create Fields for Popup
*/
$detailFields = new FieldSet();
$detailFields->push( new TextField( 'ID', 'ID'));
$detailFields->push( new TextField( 'FirstName', 'Firstname' ) );
$detailFields->push( new TextField( 'Surname', 'Surname' ) );
$detailFields->push( new TextField( 'Email', 'Position' ) );
if($section == 'employers') {
$detailFields->push( new TextField( 'Company', 'Company' ) );
}
$detailFields->push( new TextField( 'Address', 'Address Line 1' ) );
$detailFields->push( new TextField( 'Address2', 'Address Line 2' ) );
$detailFields->push( new TextField( 'City', 'City' ) );
$detailFields->push( new TextField( 'ZipCode', 'Zip / Postal Code' ) );
$detailFields->push( new TextField( 'Country', 'Country' ) );
$detailFields->push( new TextField( 'HomePhone', 'Telephone' ) );
$detailFields->push( new TextField( 'MobilePhone', 'Mobile Phone' ) );
$detailFields->push( new TextField( 'NumVisit', 'Number of Visits' ) );
$detailFields->push( new TextField( 'LastVisited', 'Last Visits' ) );
$detailFields->push( new TextField( 'GroupID', 'Group ID' ) );
/*
* Join with Group_Members table enable filter by GroupID
*/
$sourceJoin = "LEFT JOIN Group_Members ON Member.ID = Group_Members.MemberID";
/*
* Instantiate CTF
*/
$tableList = new ComplexTableField($this, 'Member', 'Member', $fieldList, $detailFields, $filter,$sort, $sourceJoin );
$tableList->setPopupCaption("Add / Edit Member");
/*
* Instantiate Fieldset for whole page with required ID for the CTF
*/
$fields = new FieldSet(
new HiddenField( 'ID' ),
$tableList
);
return new Form($this, 'EditForm', $fields);
}
Thanks for your help :-)