/** * Get adapted values of particular field of Model instance for Views. Used in, for example, backend lists. * * @author Krzysztof Trzos * @access public * @param string $sFieldName * @return string * @since 1.0.0 * @version 3.4.6, 2015-02-08 */ public function getValueForView($sFieldName) { $mValue = parent::getValueForView($sFieldName); switch ($sFieldName) { // roles case 'roles': $sOutput = ''; if (count($mValue) > 0) { foreach ($mValue as $oRoles) { /* @var $oRoles User\Role */ $sOutput .= $oRoles->getName() . ', '; } $sOutput = rtrim($sOutput, ', '); } else { $sOutput = '-'; } return $sOutput; // login_date // login_date case 'login_date': $loginDate = $mValue; /* @var $loginDate \DateTime */ return empty($loginDate) ? '-' : $loginDate->format('Y-m-d H:i'); } return $mValue; }