Skip to content
Snippets Groups Projects
Commit 01090976 authored by jaapjansma's avatar jaapjansma
Browse files

improvements for the search output

parent fdee618d
No related branches found
No related tags found
No related merge requests found
......@@ -115,6 +115,24 @@ abstract class CRM_DataprocessorSearch_Form_AbstractSearch extends CRM_Core_Form
return true;
}
/**
* Returns the url for view of the record action
*
* @param $row
*
* @return false|string
*/
abstract protected function link($row);
/**
* Returns the link text for view of the record action
*
* @param $row
*
* @return false|string
*/
abstract protected function linkText($row);
/**
* Return altered rows
*
......@@ -236,6 +254,13 @@ abstract class CRM_DataprocessorSearch_Form_AbstractSearch extends CRM_Core_Form
$row['id'] = $record[$id_field]->formattedValue;
$row['checkbox'] = CRM_Core_Form::CB_PREFIX.$row['id'];
$row['record'] = $record;
$link = $this->link($row);
if ($link) {
$row['url'] = $link;
$row['link_text'] = $this->linkText($row);
}
$this->addElement('checkbox', $row['checkbox'], NULL, NULL, ['class' => 'select-row']);
$prevnextData[] = array(
......
......@@ -8,6 +8,28 @@ use CRM_Dataprocessor_ExtensionUtil as E;
class CRM_DataprocessorSearch_Form_ActivitySearch extends CRM_DataprocessorSearch_Form_AbstractSearch {
/**
* Returns the url for view of the record action
*
* @param $row
*
* @return false|string
*/
protected function link($row) {
return CRM_Utils_System::url('civicrm/activity', 'reset=1&action=view&id='.$row['id']);
}
/**
* Returns the link text for view of the record action
*
* @param $row
*
* @return false|string
*/
protected function linkText($row) {
return E::ts('View activity');
}
/**
* Return the data processor name
*
......
......@@ -8,6 +8,28 @@ use CRM_Dataprocessor_ExtensionUtil as E;
class CRM_DataprocessorSearch_Form_ContactSearch extends CRM_DataprocessorSearch_Form_AbstractSearch {
/**
* Returns the url for view of the record action
*
* @param $row
*
* @return false|string
*/
protected function link($row) {
return CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid='.$row['id']);
}
/**
* Returns the link text for view of the record action
*
* @param $row
*
* @return false|string
*/
protected function linkText($row) {
return E::ts('View contact');
}
/**
* Checks whether the output has a valid configuration
*
......
......@@ -50,6 +50,11 @@
{/foreach}
<td>
{if ($row.url)}
<a href="{$row.url}">
{$row.link_text}
</a>
{/if}
<a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$contact_id`"}">
{ts}View contact{/ts}
</a>
......
......@@ -48,9 +48,11 @@
{/foreach}
<td>
<a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$contact_id`"}">
{ts}View contact{/ts}
{if ($row.url)}
<a href="{$row.url}">
{$row.link_text}
</a>
{/if}
</td>
</tr>
{/foreach}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment