Hi,
you need to create additional actions method (this method adds icons to every row) and check there if there are any attachments. Example below.
In Record Browser initialization code, before displaying RB, add something like that (replacing $your_rb_variable):
$your_rb_variable->set_additional_actions_method(array($this,'add_actions'));
Add add_actions method to main class:
public function add_actions($row,$gb,$rb) {
$attachments = Utils_AttachmentCommon::count($rb->tab.'/'.$row['id']);
if($attachments>0)
$gb->add_action('',__('There are notes'),null,Base_ThemeCommon::get_template_file('<your module>','<there are attachments icon>.png'));
else
$gb->add_action('',__('No notes'),null,Base_ThemeCommon::get_template_file('<your module>','<no attachments icon>.png'));
}
If you don't use templates in your module, you need to create theme directory in your module directory, place your png icons there, add to your install file in install method:
Base_ThemeCommon::install_default_theme($this->get_type());
and in uninstall method:
Base_ThemeCommon::uninstall_default_theme($this->get_type());
Go to
http://<your epesi url>/admin/index.php?module=ThemeUp and proceed.
The code above is just not tested draft 🙂 So there can be some literal 😉
Additionally without icons, as calculated field - column displaying number of notes.
Field definition:
array(
'name' => _M('Notes'),
'type'=>'calculated',
'visible'=>true,
'extra'=>false,
'display_callback'=>array($this->get_type(),'display_notes')
)
And callback in common class:
public static function display_notes($r) {
if(!isset($r['id'])) return '';
return Utils_AttachmentCommon::count('<your recordset name>/'.$r['id']);
}
Cheers
Paul