fix: [org] field in the index table fixed

- removed debug
- correct extraction of the data
- show links for the orgs to the org view
pull/38/head
iglocska 2021-01-13 14:22:15 +01:00
parent 7a195aed93
commit d6bef47ce9
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 13 additions and 7 deletions

View File

@ -1,9 +1,5 @@
<?php <?php
debug($row); $orgs = $row[$field['data_path']];
debug($row['organisation']);
debug($this->Hash->extract($row, 'organisation'));
debug($field['data_path']);
$orgs = $this->Hash->extract($row, $field['data_path']);
if (!isset($field['fields']['allow_picture'])) { if (!isset($field['fields']['allow_picture'])) {
$field['fields']['allow_picture'] = true; $field['fields']['allow_picture'] = true;
} }
@ -11,8 +7,8 @@ debug($field['data_path']);
$field['fields']['default_org'] = ''; $field['fields']['default_org'] = '';
} }
if (!empty($orgs)) { if (!empty($orgs)) {
if (!isset($orgs[0])) { if (!empty($orgs['id'])) {
$orgs = array($orgs); $orgs = [$orgs];
} }
$count = count($orgs); $count = count($orgs);
$i = 0; $i = 0;
@ -20,6 +16,11 @@ debug($field['data_path']);
$i++; $i++;
if (!empty($org['id']) || !empty($org['name'])) { if (!empty($org['id']) || !empty($org['name'])) {
if ($field['fields']['allow_picture'] && !empty($org['id'])) { if ($field['fields']['allow_picture'] && !empty($org['id'])) {
echo sprintf(
'<a href="%s">%s</a>',
$baseurl . '/organisations/view/' . h($org['id']),
h($org['name'])
);
//echo $this->OrgImg->getOrgImg(array('name' => $org['name'], 'id' => $org['id'], 'size' => 24)); //echo $this->OrgImg->getOrgImg(array('name' => $org['name'], 'id' => $org['id'], 'size' => 24));
} else { } else {
echo sprintf( echo sprintf(
@ -34,6 +35,11 @@ debug($field['data_path']);
} }
} else { } else {
if ($field['fields']['allow_picture']) { if ($field['fields']['allow_picture']) {
echo sprintf(
'<a href="%s">%s</a>',
$baseurl . '/organisations/view/' . h($org['id']),
h($org['name'])
);
//echo $this->OrgImg->getOrgImg(array('name' => $field['fields']['default_org'], 'size' => 24)); //echo $this->OrgImg->getOrgImg(array('name' => $field['fields']['default_org'], 'size' => 24));
} }
} }