Esempio n. 1
0
 public function act_browse()
 {
     global $conf;
     include_once APPROOT . 'inc/lib_form.inc';
     require_once APPROOT . 'mod/analysis/analysisModule.class.php';
     $analysisModule = new analysisModule();
     $sqlStatement = $analysisModule->generateSqlforEntity('supporting_docs_meta', null, $_GET, 'browse');
     $entity_type_form_results = generate_formarray('supporting_docs_meta', 'browse');
     $entity_type_form_results['doc_id']['type'] = 'text';
     if (isset($entity_type_form_results['format'])) {
         $entity_type_form_results['format']['type'] = 'text';
     }
     $field_list = array();
     foreach ($entity_type_form_results as $field_name => $field) {
         // Generates the view's Label list
         $field_list[$field['map']['field']] = $field['label'];
     }
     if (is_array($conf['browsefields']['supporting_docs_meta']) && in_array("eventslinks", $conf['browsefields']['supporting_docs_meta'])) {
         $field_list['eventslinks'] = _t('LINKS');
     }
     foreach ($entity_type_form_results as $fieldName => &$field) {
         $field['extra_opts']['help'] = null;
         $field['label'] = null;
         $field['extra_opts']['clari'] = null;
         $field['extra_opts']['value'] = $_GET[$fieldName];
         $field['extra_opts']['required'] = null;
         $field['extra_opts']['class'] = "input-block-level";
     }
     $entity_fields_html = shn_form_get_html_fields($entity_type_form_results);
     $htmlFields = array();
     //iterate through the search fields, checking input values
     foreach ($entity_type_form_results as $field_name => $x) {
         // Generates the view's Label list
         $htmlFields[$field_name] = $entity_fields_html[$field_name];
     }
     $this->result_pager = Browse::getExecuteSql($sqlStatement);
     $this->result_pager->setArgumentEncoder($this->argumentEncoder);
     $this->columnValues = $this->result_pager->get_page_data();
     $this->columnValues = set_links_in_recordset($this->columnValues, 'supporting_docs_meta');
     set_huriterms_in_record_array($entity_type_form_results, $this->columnValues);
     foreach ($this->columnValues as $k => $v) {
         $linksa = array();
         $links = Browse::getDocumentLinks($v['doc_id'], 'event');
         foreach ($links as $record) {
             $linksa[] = "<a href=\"" . get_record_url($record['record_number'], "event") . "\" >" . $record['record_number'] . "</a>";
         }
         $this->columnValues[$k]['eventslinks'] = implode("<br/>", $linksa);
     }
     //rendering the view
     $this->columnNames = $field_list;
     $this->htmlFields = $htmlFields;
     //var_dump($this->columnNames , $this->columnValues , $htmlFields	);
 }
 public function act_doc_list()
 {
     $sqlStatement = Browse::getEventsDocList($this->event_id, $_GET);
     include_once APPROOT . 'inc/lib_form.inc';
     $entity_type_form_results = array('doc_id' => array('type' => 'text', 'label' => 'Document ID', 'map' => array('entity' => 'supporting_docs_meta', 'field' => 'doc_id')), 'entity_type' => array('type' => 'text', 'label' => 'Entity', 'map' => array('entity' => 'supporting_docs_meta', 'field' => 'entity_type')), 'title' => array('type' => 'text', 'label' => 'Document Title', 'map' => array('entity' => 'supporting_docs_meta', 'field' => 'title')), 'type' => array('type' => 'mt_select', 'label' => 'Type', 'map' => array('entity' => 'supporting_docs_meta', 'field' => 'type', 'mt' => 16)), 'format' => array('type' => 'text', 'label' => 'Format', 'map' => array('entity' => 'supporting_docs_meta', 'field' => 'format')));
     $field_list = array();
     foreach ($entity_type_form_results as $field_name => $field) {
         // Generates the view's Label list
         $field_list[$field['map']['field']] = $field['label'];
     }
     foreach ($entity_type_form_results as $fieldName => &$field) {
         $field['extra_opts']['help'] = null;
         $field['label'] = null;
         $field['extra_opts']['clari'] = null;
         $field['extra_opts']['value'] = $_GET[$fieldName];
         $field['extra_opts']['required'] = null;
         $field['extra_opts']['class'] = "input-block-level";
     }
     $entity_fields_html = shn_form_get_html_fields($entity_type_form_results);
     $htmlFields = array();
     //iterate through the search fields, checking input values
     foreach ($entity_type_form_results as $field_name => $x) {
         // Generates the view's Label list
         $htmlFields[$field_name] = $entity_fields_html[$field_name];
     }
     $this->result_pager = Browse::getExecuteSql($sqlStatement);
     $this->columnValues = $this->result_pager->get_page_data();
     $this->columnValues = set_links_in_recordset($this->columnValues, 'supporting_docs_meta');
     $recordArray = array();
     foreach ($this->columnValues as $key => $columnValue) {
         foreach ($columnValue as $val => $value) {
             if ($val == 'entity_type') {
                 $recordArray[$key]['entity_record_url'] = get_record_url($columnValue['record_number'], $columnValue['entity_type']);
                 $recordArray[$key][$val] = ucfirst($columnValue['entity_type']);
             } else {
                 $recordArray[$key][$val] = $value;
             }
         }
     }
     $this->columnValues = $recordArray;
     set_huriterms_in_record_array($entity_type_form_results, $this->columnValues);
     //rendering the view
     $this->columnNames = $field_list;
     $this->htmlFields = $htmlFields;
 }
 public function act_facetsearchresults()
 {
     global $global, $conf;
     $searchparams = $_GET['searchparams'];
     $searchparams = json_decode($searchparams);
     $resp = array();
     if ($searchparams) {
         $domaindata = $this->getEntityFields();
         $query = new stdClass();
         $ents = array();
         $additionalFields = array();
         if (count((array) $searchparams->selected_terms)) {
             $fieldCounts = array();
             foreach ($searchparams->selected_terms as $entity => $fields) {
                 foreach ($fields as $field => $terms) {
                     if (!$terms) {
                         continue;
                     }
                     $ents[] = $entity;
                     if ($domaindata->{$entity}->ac_type) {
                         $selEntity2 = $domaindata->{$entity}->ac_type;
                     } else {
                         $selEntity2 = $entity;
                     }
                     $condition = new stdClass();
                     $condition->entity = $entity;
                     $condition->field = $field;
                     $condition->operator = "in";
                     $condition->value = implode(",", $terms);
                     $condition->link = "and";
                     if ($domaindata->{$selEntity2}->fields->{$field}->field_type == "mt_tree") {
                         $condition->operator = "subin";
                     } else {
                         $condition->operator = "in";
                     }
                     $query->conditions[] = $condition;
                 }
             }
         }
         $selEntity = $selEntityOriginal = $searchparams->entities[0];
         //var_dump($selEntity);exit;
         if ($domaindata->{$selEntity}->ac_type) {
             $selEntity = $domaindata->{$selEntity}->ac_type;
         }
         $selectFields = array();
         foreach ($query->conditions as $cond) {
             $sel = new stdClass();
             $sel->entity = $cond->entity;
             $sel->field = $cond->field;
             $selectFields[] = $sel;
         }
         if ($searchparams->facets) {
             foreach ($searchparams->facets as $facet) {
                 $sel = new stdClass();
                 $sel->entity = $facet->entity;
                 $sel->field = $facet->field;
                 $selectFields[] = $sel;
             }
         }
         foreach ($domaindata->{$selEntity}->fields as $field) {
             if ($field->select == "y") {
                 $sel = new stdClass();
                 $sel->entity = $selEntityOriginal;
                 $sel->field = $field->value;
                 $selectFields[] = $sel;
             }
         }
         $selectFields = array_unique($selectFields, SORT_REGULAR);
         foreach ($selectFields as $sfield) {
             if (!in_array($sfield->entity, $ents)) {
                 $ents[] = $sfield->entity;
                 $condition = new stdClass();
                 $entt = $sfield->entity;
                 $selEntt = $entt;
                 if ($domaindata->{$entt}->ac_type) {
                     $selEntt = $domaindata->{$entt}->ac_type;
                 }
                 $fields = (array) $domaindata->{$selEntt};
                 $f = (array) $domaindata->{$selEntt}->fields;
                 $pkey = get_primary_key($selEntt);
                 if ($f[$pkey]) {
                     $f = $f[$pkey];
                 } else {
                     $f = array_shift($f);
                 }
                 $condition->entity = $entt;
                 $condition->field = $f->value;
                 $condition->operator = "contains";
                 $condition->value = "";
                 $query->conditions[] = $condition;
             }
         }
         foreach ($ents as $ent) {
             $recField = get_primary_key($ent);
             $sel = new stdClass();
             $sel->entity = $ent;
             $sel->field = $recField;
             if (!in_array($sel, $selectFields)) {
                 $selectFields[] = $sel;
                 $additionalFields[$sel->entity][] = $recField;
             }
         }
         $selectFields = array_unique($selectFields, SORT_REGULAR);
         $query->select = $selectFields;
         function entitySort($a, $b)
         {
             $enord = array('event', 'act', 'intervention', 'arrest', 'torture', 'killing', 'destruction', 'victim', 'involvement', 'perpetrator', 'information', 'source', 'chain_of_events', 'intervening_party', 'address', 'biographic_details', 'supporting_docs_meta');
             $aorder = array_search($a->entity, $enord);
             $border = array_search($b->entity, $enord);
             return $border - $aorder;
         }
         usort($query->select, "entitySort");
         usort($query->conditions, "entitySort");
         $from = (int) $searchparams->paging->from;
         $size = (int) $searchparams->paging->size;
         if ($from < 0) {
             $from = 0;
         }
         if ($size < 1) {
             $size = 20;
         }
         $records = array();
         include_once 'searchSql.php';
         $start = $from;
         $limit = $size;
         $sidx = $_GET['sidx'];
         if (!$sidx) {
             $sidx = 1;
         }
         $sord = $_GET['sord'];
         $fields_array = array();
         $entities = analysis_get_search_entities();
         $fieldTitles = array();
         //if the query is a search put select fields to the array
         foreach ($query->select as $field) {
             if (in_array($field->field, $additionalFields[$field->entity])) {
                 continue;
             }
             $entity = isset($entities[$field->entity]['ac_type']) ? $entities[$field->entity]['ac_type'] : $field->entity;
             $mt = is_mt_field($entity, $field->field);
             array_push($fields_array, array('name' => $field->entity . '_' . $field->field, 'mt' => $mt));
             $fieldname = $field->field;
             if (isset($domaindata->{$entity}->fields->{$fieldname}->label)) {
                 $fieldTitles[] = $domaindata->{$entity}->fields->{$fieldname}->label;
             } else {
                 $fieldTitles[] = $field->field;
             }
         }
         $records[0] = $fieldTitles;
         $searchSql = new SearchResultGenerator();
         $sqlArray = $searchSql->sqlForJsonQuery(json_encode($query));
         $count_query = "SELECT COUNT(*) FROM ({$sqlArray['result']}) as results";
         try {
             $res_count = $global['db']->Execute($count_query);
         } catch (Exception $e) {
             $response->error = "error";
             //$e->getMessage();
             $res_count = null;
         }
         if ($res_count != null) {
             while (!$res_count->EOF) {
                 $count = $res_count->fields[0];
                 $res_count->MoveNext();
             }
         }
         $sql = $sqlArray['result'];
         if ($limit != -1) {
             $sql .= " LIMIT {$start} , {$limit}";
         }
         try {
             $res = $global['db']->Execute($sql);
         } catch (Exception $e) {
             $response->error = "error";
             //$e->getMessage();
         }
         $resp = array("response" => array("start" => $from, "found" => $count));
         $number_of_fields = count($fields_array);
         foreach ($res as $key => $val) {
             //$response->aaData[$i]['id'] = $val[$fields_array[0]];
             $array_values = array();
             for ($count = 0; $number_of_fields > $count; $count++) {
                 $field_name = $fields_array[$count]['name'];
                 $record_number_field = substr($field_name, strlen($field_name) - 13);
                 $confidentiality_field = substr($field_name, strlen($field_name) - 15);
                 $deceased_field = substr($field_name, strlen($field_name) - 8);
                 $doc_field = substr($field_name, strlen($field_name) - 6);
                 if ($confidentiality_field == 'confidentiality') {
                     if ($val[$field_name] == 'y') {
                         $val[$field_name] = _t('YES');
                     } elseif ($val[$field_name] == 'n') {
                         $val[$field_name] = _t('NO');
                     }
                 }
                 if ($deceased_field == 'deceased') {
                     if ($val[$field_name] == 'y') {
                         $val[$field_name] = _t('YES');
                     } else {
                         $val[$field_name] = _t('NO');
                     }
                 }
                 $string = null;
                 if ($fields_array[$count]['mt']) {
                     $list = explode(',', $val[$field_name]);
                     //var_dump($val);exit;
                     foreach ($list as $term) {
                         $string = $string . ", " . get_mt_term(trim($term));
                     }
                     $array_values[$field_name] = ltrim($string, ',');
                 } else {
                     if ($record_number_field == 'record_number' || $doc_field == 'doc_id') {
                         if (preg_match('/event/', $field_name)) {
                             $link_entity = 'event';
                         } else {
                             if (preg_match('/act/', $field_name)) {
                                 $link_entity = 'act';
                             } else {
                                 if (preg_match('/source/', $field_name)) {
                                     $link_entity = 'source';
                                 } else {
                                     if (preg_match('/perpetrator/', $field_name)) {
                                         $link_entity = 'perpetrator';
                                     } else {
                                         if (preg_match('/victim/', $field_name)) {
                                             $link_entity = 'victim';
                                         } else {
                                             if (preg_match('/involvement/', $field_name)) {
                                                 $link_entity = 'involvement';
                                             } else {
                                                 if (preg_match('/information/', $field_name)) {
                                                     $link_entity = 'information';
                                                 } else {
                                                     if (preg_match('/intervention/', $field_name)) {
                                                         $link_entity = 'intervention';
                                                     } else {
                                                         if (preg_match('/intervening_party/', $field_name)) {
                                                             $link_entity = 'intervening_party';
                                                         } else {
                                                             if (preg_match('/person/', $field_name)) {
                                                                 $link_entity = 'person';
                                                             } else {
                                                                 if (preg_match('/biographic_details/', $field_name)) {
                                                                     $link_entity = 'biographic_details';
                                                                 } else {
                                                                     if (preg_match('/supporting_docs_meta/', $field_name)) {
                                                                         $link_entity = 'supporting_docs_meta';
                                                                     } else {
                                                                         if (preg_match('/address/', $field_name)) {
                                                                             $link_entity = 'address';
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         if ($link_entity != 'address') {
                             $url = get_record_url($val[$field_name], $link_entity);
                             $array_values[$field_name] = "<a href='{$url}' target='_blank'>" . $val[$field_name] . "</a>";
                         } else {
                             if ($val[$field_name]) {
                                 $array_values[$field_name] = $val[$field_name];
                             } else {
                                 $array_values[$field_name] = "";
                             }
                         }
                     } else {
                         if ($val[$field_name]) {
                             $array_values[$field_name] = $val[$field_name];
                         } else {
                             $array_values[$field_name] = "";
                         }
                     }
                 }
             }
             $records[] = $array_values;
             $i++;
         }
         $resp["response"]["records"] = $records;
         $recField = get_primary_key($selEntity);
         // . "_record_number";
         $charts = array();
         $conditions = array();
         if (count((array) $query->conditions)) {
             foreach ($query->conditions as $condition) {
                 $condition2 = $condition;
                 $conditions[$condition->entity][$condition->field][] = $condition2;
             }
         }
         //var_dump($conditions, $sqlArray['result']);
         if ($searchparams->facets) {
             foreach ($searchparams->facets as $facet) {
                 $entity = $facet->entity;
                 $field = $facet->field;
                 if ($domaindata->{$entity}->ac_type) {
                     $en = $domaindata->{$entity}->ac_type;
                     $fields = $domaindata->{$en}->fields;
                 } else {
                     $fields = $domaindata->{$entity}->fields;
                 }
                 $fieldType = $fields->{$field}->field_type;
                 $listCode = $fields->{$field}->list_code;
                 //charts
                 $entityForm = $searchSql->getEntityArray($entity);
                 $fieldArray = $entityForm[$field];
                 $recField = get_primary_key($selEntityOriginal);
                 $selEntt = $entity;
                 if ($domaindata->{$selEntt}->ac_type) {
                     $selEntt = $domaindata->{$selEntt}->ac_type;
                 }
                 $recFieldEnt = get_primary_key($searchSql->tableOfEntity($fieldArray['map']['entity']));
                 if ($fieldArray['map']['mlt'] && $fieldArray['type'] != "user_select") {
                     $mltTable = 'mlt_' . $searchSql->tableOfEntity($fieldArray['map']['entity']) . '_' . $fieldArray['map']['field'];
                     $sqlchart = "SELECT IFNULL(l.msgstr , english) as val, COUNT(t.record_number) AS count,m.vocab_number as vocab_number\n                            FROM ({$sqlArray['result']}) d LEFT JOIN {$mltTable} t  on  t.record_number=d.{$entity}_{$recFieldEnt} left join\n                            mt_vocab m on m.vocab_number=t.vocab_number\n                            LEFT JOIN mt_vocab_l10n l ON ( l.msgid = m.vocab_number AND l.locale = '{$conf['locale']}' )  GROUP BY t.vocab_number\n                            ";
                 } elseif (is_management_field($fieldArray)) {
                     $f = $entity . "_" . $fieldArray['map']['field'];
                     $sqlchart = "SELECT IFNULL(l.msgstr , english) as val, COUNT(d.{$selEntityOriginal}_{$recField}) AS count,m.vocab_number as vocab_number\n                            FROM ({$sqlArray['result']}) d LEFT JOIN management t  on t.entity_id=d.{$entity}_{$recFieldEnt} and t.entity_type='{$entity}'\n                            left join  mt_vocab m on m.vocab_number=t.{$fieldArray['map']['field']}\n                            LEFT JOIN mt_vocab_l10n l ON ( l.msgid = m.vocab_number AND l.locale = '{$conf['locale']}' )  GROUP BY {$f}\n                            ";
                 } else {
                     $f = $entity . "_" . $fieldArray['map']['field'];
                     if ($fieldType == "mt_select" || $fieldType == "mt_tree") {
                         $sqlchart = "SELECT IFNULL(l.msgstr , english)  as val, COUNT({$selEntityOriginal}_{$recField}) AS count,m.vocab_number as vocab_number\n                            FROM ({$sqlArray['result']}) d left join  mt_vocab m on m.vocab_number=d.{$f}\n                            LEFT JOIN mt_vocab_l10n l ON ( l.msgid = m.vocab_number AND l.locale = '{$conf['locale']}' )  GROUP BY {$f}";
                     } else {
                         $sqlchart = "SELECT d.{$f} as val, COUNT({$selEntityOriginal}_{$recField}) AS count,d.{$f} as vocab_number\n                            FROM ({$sqlArray['result']}) d   GROUP BY {$f}";
                     }
                 }
                 $facetcounts = array();
                 if ($sqlchart) {
                     try {
                         $res = $global['db']->Execute($sqlchart);
                         $chart = array();
                         $chart["type"] = "editchart";
                         $chart["editcharttype"] = "BarChart";
                         $chart["title"] = $fieldArray["label"];
                         $chart2 = $chart;
                         $chart2["editcharttype"] = "PieChart";
                         foreach ($res as $val) {
                             $vall = _t("Undefined");
                             if ($val[0]) {
                                 if ($val[0] == "y") {
                                     $vall = _t('YES');
                                 } elseif ($val[0] == "n") {
                                     $vall = _t('NO');
                                 } else {
                                     $vall = $val[0];
                                 }
                             } elseif (!(int) $val[1]) {
                                 continue;
                             }
                             $chart["data"][0][0] = $chart["title"];
                             $chart["data"][1][0] = "";
                             $chart["data"][0][] = $vall;
                             $chart["data"][1][] = (int) $val[1];
                             $chart2["data"][0] = array($chart["title"], _t("COUNT"));
                             $chart2["data"][] = array($vall, (int) $val[1]);
                             $facetcounts[$val[2]] = (int) $val[1];
                         }
                         //$resp["charts"][] = array($chart, $chart2);
                         $resp["charts"][] = array($chart);
                         $resp["charts"][] = array($chart2);
                     } catch (Exception $e) {
                         $response->error = "error";
                         //$e->getMessage();
                     }
                 }
                 $terms = array();
                 switch ($fieldType) {
                     case 'radio':
                         $label = _t('YES');
                         if (isset($facetcounts["y"])) {
                             $label .= " (" . $facetcounts["y"] . ")";
                         }
                         $resp["facets"][$field]["terms"][] = array('term' => 'y', 'label' => $label);
                         $label = _t('NO');
                         if (isset($facetcounts["n"])) {
                             $label .= " (" . $facetcounts["n"] . ")";
                         }
                         $resp["facets"][$field]["terms"][] = array('term' => 'n', 'label' => $label);
                         $resp["facets"][$field]["entity"] = $entity;
                         break;
                     case 'mt_select':
                         $data_array = MtFieldWrapper::getMTList($listCode);
                         $size = count($data_array);
                         $options[''] = ' ';
                         for ($i = 0; $i < $size; $i++) {
                             $label = $data_array[$i]['label'];
                             if (isset($facetcounts[$data_array[$i]['vocab_number']])) {
                                 $label .= " (" . $facetcounts[$data_array[$i]['vocab_number']] . ")";
                             }
                             $terms[] = array('term' => $data_array[$i]['vocab_number'], 'label' => $label);
                         }
                         $resp["facets"][$field] = array("terms" => $terms, "entity" => $entity);
                         break;
                     case 'mt_tree':
                         $data_array = MtFieldWrapper::getMTList($listCode);
                         $count = count($data_array);
                         for ($i = 0; $i < $count;) {
                             $element1 = $data_array[$i];
                             $label = $element1['label'];
                             if (isset($facetcounts[$element1['vocab_number']])) {
                                 $label .= " (" . $facetcounts[$element1['vocab_number']] . ")";
                             }
                             $terms[] = array('term' => $element1['vocab_number'], 'label' => $label, 'level' => (int) $element1["term_level"]);
                             $i++;
                         }
                         $resp["facets"][$field] = array("terms" => $terms, "field_type" => "mt_tree", "entity" => $entity);
                         break;
                 }
             }
         }
         $locationFields = Browse::getEntityLocationFields($selEntity);
         $field_names = array();
         $fieldsArray = array();
         $markers = array();
         if ($locationFields) {
             $selectFields = array();
             $sel = new stdClass();
             $sel->entity = $selEntityOriginal;
             $sel->field = get_primary_key($selEntity);
             // . "_record_number";
             $selectFields[] = $sel;
             foreach ($locationFields as $locationField) {
                 $field_names[] = $locationField["field_name"];
                 /* $fieldsArray[] = $locationField["field_name"] . "_latitude";
                    $fieldsArray[] = $locationField["field_name"] . "_longitude"; */
                 $sel = new stdClass();
                 $sel->entity = $selEntityOriginal;
                 $sel->field = $locationField["field_name"] . "_latitude";
                 $selectFields[] = $sel;
                 $sel = new stdClass();
                 $sel->entity = $selEntityOriginal;
                 $sel->field = $locationField["field_name"] . "_longitude";
                 $selectFields[] = $sel;
             }
             $query->select = $selectFields;
             $searchSql = new SearchResultGenerator();
             $sqlArray = $searchSql->sqlForJsonQuery(json_encode($query));
             $sql = $sqlArray['result'];
             if ($limit != -1) {
                 // $sql .= " LIMIT $start , $limit";
             }
             //$sql = "select " . $selEntity . "_record_number," . implode(",", $fieldsArray) . " from " . $selEntity;
             try {
                 $res = $global['db']->GetAll($sql);
             } catch (Exception $e) {
                 $response->error = "error";
                 //$e->getMessage();
             }
             foreach ($res as $val) {
                 $url = get_record_url($val[0], $selEntity);
                 $i = 1;
                 foreach ($field_names as $field_name) {
                     if ($val[$i] && $val[$i + 1]) {
                         $markers[] = array("latitude" => $val[$i], "longitude" => $val[$i + 1], "title" => $val[0], "content" => "<a href='" . $url . "' target='_blank'>" . $val[0] . "</a>");
                     }
                     $i = $i + 2;
                 }
             }
         }
         $resp["markers"] = $markers;
     }
     echo json_encode($resp);
     exit;
 }
Esempio n. 4
0
    <tbody>
    <?php 
foreach ($entities as $entity => $entity_name) {
    $link_docs = $links[$entity];
    if (!is_array($link_docs)) {
        continue;
    }
    foreach ($link_docs as $record) {
        ?>
                <tr>
                    <td><?php 
        echo $entity_name;
        ?>
</td>
                    <td><a href="<?php 
        echo get_record_url($record['record_number'], $entity);
        ?>
"><?php 
        echo $record['record_number'];
        ?>
</a></td>
                    <td><?php 
        echo $record['linked_by'];
        ?>
</td>
                    <td><?php 
        echo $record['linked_date'];
        ?>
</td>
                </tr>
<?php