* GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Goteo. If not, see <http://www.gnu.org/licenses/agpl.txt>. * */ use Goteo\Library\Text; $user = $this['user']; $level = (int) $this['level'] ?: 3; // @todo Esto ya debería venirme en $user if (!isset($user->webs)) { $user->webs = \Goteo\Model\User\Web::get($user->id); } $user->about = nl2br(Text::urlink($user->about)); ?> <div class="widget user collapsable"> <h<?php echo $level ?> class="supertitle"><?php echo Text::get('profile-widget-user-header'); ?></h<?php echo $level ?>> <div class="project-widget-box"> <h<?php echo $level + 1 ?> class="title"> <?php echo htmlspecialchars($user->name) ?></h<?php echo $level + 1 ?>> <div class="image">
/** * Usuario. * * @param string $id Nombre de usuario * @return obj|false Objeto de usuario, en caso contrario devolverá 'false'. */ public static function get($id, $lang = null) { try { $sql = "\r\n SELECT\r\n user.id as id,\r\n user.email as email,\r\n user.name as name,\r\n user.location as location,\r\n user.avatar as avatar,\r\n IFNULL(user_lang.about, user.about) as about,\r\n IFNULL(user_lang.contribution, user.contribution) as contribution,\r\n IFNULL(user_lang.keywords, user.keywords) as keywords,\r\n user.facebook as facebook,\r\n user.google as google,\r\n user.twitter as twitter,\r\n user.identica as identica,\r\n user.linkedin as linkedin,\r\n user.active as active,\r\n user.confirmed as confirmed,\r\n user.hide as hide,\r\n user.created as created,\r\n user.modified as modified\r\n FROM user\r\n LEFT JOIN user_lang\r\n ON user_lang.id = user.id\r\n AND user_lang.lang = :lang\r\n WHERE user.id = :id\r\n "; $query = static::query($sql, array(':id' => $id, ':lang' => $lang)); $user = $query->fetchObject(__CLASS__); if (!$user instanceof \Goteo\Model\User) { return false; } $user->roles = $user->getRoles(); $user->avatar = Image::get($user->avatar); if (empty($user->avatar->id) || !$user->avatar instanceof Image) { $user->avatar = Image::get(1); } $user->interests = User\Interest::get($id); $user->webs = User\Web::get($id); // si es traductor cargamos sus idiomas if (isset($user->roles['translator'])) { $user->translangs = User\Translate::getLangs($user->id); } return $user; } catch (\PDOException $e) { return false; } }