Example #1
0
 /**
  * Formats the timecreated parameter, if present, and adds a link to view the user's ELIS profile around the idnumber parameter.
  *
  * @param array $row An array for a single result.
  * @return array The transformed result.
  */
 protected function results_row_transform(array $row)
 {
     if (isset($row['element_timecreated'])) {
         $row['element_timecreated'] = ds_process_displaytime($row['element_timecreated']);
     }
     // Add link to view profile for idnumber column.
     if (isset($row['element_idnumber'])) {
         $usermanagementpage = new userpage();
         $classid = optional_param('id', null, PARAM_INT);
         if ($classid !== null && $usermanagementpage->can_do_view()) {
             $target = $usermanagementpage->get_new_page(array('action' => 'view', 'id' => $row['element_id']));
             $idnumber = $row['element_idnumber'];
             $row['element_idnumber'] = '<a href="' . $target->url . '" alt="ELIS profile" title="ELIS profile">' . $idnumber . '</a>';
         }
     }
     return $row;
 }