Hello, I wonder if anyone can help me please. I am new to EPESI and php, but am trying to customise a 1.6.5 installation to fit my company's requirements. I have used the HelloWorld example to create a Custom module. I am stuck on making an addon work correctly. As in HelloWorld part 6 I am trying to bring in a recordset that has the same value a text field as the string containing the companies name. It bring in the whole recordset and does not filter to the company name only. My code for the _0.php:
<?php
defined("_VALID_ACCESS") || die('Direct access forbidden'); // - security feature
class Custom_Delegates extends Module { // - notice how the class name represents its path
public function company_addon($record) {
$rs = new Custom_Delegates_Recordset();
$this->rb = $rs->create_rb_module($this);
$crits = array('delegate_company' => $record['company_name']); //set relations between fields
$cols = array('delegate_company' => true); // set false if you do not want the field to be visible in header
$show_data_params = array($crits, $cols);
$this->display_module($this->rb, $show_data_params, 'show_data');
}
public function body() { // - modules main code
print('Delegates');
// Here we call Record Browser
$rs = new Custom_Delegates_Recordset();
$this->rb = $rs->create_rb_module($this, 'Custom_Delegates');
$this->display_module($this->rb);
}
}
?>
and for the Recordset.php
<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
class Custom_Delegates_Recordset extends RBO_Recordset {
function table_name() { // - choose a name for the table that will be stored in EPESI database
return 'Delegates';
}
function fields() { // - here you choose the fields to add to the record browser
$fields = array();
$delegate_firstname = new RBO_Field_Text('Delegate First Name');
$delegate_firstname->set_length(20)->set_required()->set_visible();
$fields[] = $delegate_firstname;
$delegate_surname = new RBO_Field_Text('Delegate Surname');
$delegate_surname->set_length(20)->set_required()->set_visible();
$fields[] = $delegate_surname;
$course_date = new RBO_Field_Date('Course Date');
$course_date->set_visible();
$fields[] = $course_date;
$id_number = new RBO_Field_Integer('Certificate Number');
$id_number->set_visible();
$fields[] = $id_number;
$delegate_company = new RBO_Field_Text('Company Name');
$delegate_company->set_length(50)->set_required()->set_visible();
$fields[] = $delegate_company;
$course = new RBO_Field_CommonData('Course','courses');
$course->set_visible();
$fields[] = $course;
$dob = new RBO_Field_Date('Date of Birth');
$dob->set_visible();
$fields[] = $dob;
return array($delegate_firstname, $delegate_surname, $dob, $id_number, $course_date, $course, $delegate_company);
}
}
?>
Many thanks for any help anyone can give