46 lines
845 B
PHP
46 lines
845 B
PHP
|
<?php /* Copyright (c) 2024 Freya Murphy */
|
||
|
class Format_model extends Modal {
|
||
|
|
||
|
function __construct($load) {
|
||
|
parent::__construct($load);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Formats a users's name
|
||
|
* @param array $user - the $user
|
||
|
* @returns the user's formatted display name
|
||
|
*/
|
||
|
public function name($user) {
|
||
|
$name = '';
|
||
|
if ($user['first_name']) {
|
||
|
$name .= $user['first_name'];
|
||
|
}
|
||
|
if ($user['middle_name']) {
|
||
|
if ($name != '') {
|
||
|
$name .= ' ';
|
||
|
}
|
||
|
$name .= $user['middle_name'];
|
||
|
}
|
||
|
if ($user['last_name']) {
|
||
|
if ($name != '') {
|
||
|
$name .= ' ';
|
||
|
}
|
||
|
$name .= $user['last_name'];
|
||
|
}
|
||
|
if ($name == '') {
|
||
|
$name = '@' . $user['username'];
|
||
|
}
|
||
|
return $name;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Formats a date
|
||
|
* @param string $date - the data in RFC3999 format
|
||
|
* @returns the formatted date
|
||
|
*/
|
||
|
public function date($date) {
|
||
|
return $date;
|
||
|
}
|
||
|
|
||
|
}
|