*/ /** * patTemplate modifier Userdata * * Load user data and select column * * Parameter: * - column, which column to display * * @package patTemplate * @package Modifiers * @author gERD Schaufelberger */ class patTemplate_Modifier_Userdata extends patTemplate_Modifier { /** * shared table object * @var WBDatasource_Table */ static protected $us = null; /** * modify the value * * @access public * @param string value * @return string modified value */ public function modify($value, $params = array()) { if (!isset($params['column'])) { return $value; } if (0 == intval($value)) { return ''; } $this->startUserStorage(); if (!self::$us->load($value)) { return ''; } $data = self::$us->get(); if (empty($data[$params['column']])) { return ''; } return $data[$params['column']]; } private function startUserStorage() { if (self::$us) { return; } /** @var WBUser */ $user = WBClass::create('WBUser'); self::$us = $user->getStorageModule(); } }