public function getName($id = false) { if ($id === false) { $id = $this->id; } $rez = $id; switch (substr($id, 0, 1)) { case 'a': $rez = L\get('ActionLog'); break; case 'd': $rez = Util\formatAgoDate(substr($id, 1, 10)); break; case 'm': $rez = L\get('CurrentMonth'); break; case 'g': $rez = L\get('Users'); break; case 'q': $rez = L\get('Type'); break; case 'u': $rez = User::getDisplayName(substr($id, 1)); break; case 't': $rez = Util\coalesce(L\get('at' . substr($id, 1)), substr($id, 1)); break; default: if (!empty($id) && is_numeric($id)) { $res = DB\dbQuery('SELECT data FROM action_log WHERE id = $1', $id) or die(DB\dbQueryError()); if ($r = $res->fetch_assoc()) { $j = Util\toJSONArray($r['data']); $rez = Util\coalesce($j['name'], 'unknown'); } $res->close(); } break; } return $rez; }
public function getName($id = false) { if ($id === false) { $id = $this->id; } $rez = $id; switch (substr($id, 0, 1)) { case 'a': $rez = L\get('ActionLog'); break; case 'd': $rez = Util\formatAgoDate(substr($id, 1, 10)); break; case 'm': $rez = L\get('CurrentMonth'); break; case 'g': $rez = L\get('Users'); break; case 'q': $rez = L\get('Type'); break; case 'u': $rez = User::getDisplayName(substr($id, 1)); break; case 't': $rez = Util\coalesce(L\get('at' . substr($id, 1)), substr($id, 1)); break; default: if (!empty($id) && is_numeric($id)) { $r = DM\Log::read($id); if (!empty($r)) { $rez = Util\coalesce($r['data']['name'], 'unknown'); } } break; } return $rez; }