Ejemplo n.º 1
0
 *
 *  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\Model\User\Interest,
    Goteo\Model\User\Skill,
    Goteo\Library\Text;

$user = $this['user'];

$user->about = nl2br(Text::urlink($user->about));

$interests = Interest::getAll();
$skills = Skill::getAll(null,true);
?>

<div class="widget user-about">
    
    
    <?php if (!empty($user->about)): ?>    
    <div class="about">        
        <h4><?php echo Text::get('profile-about-header'); ?></h4>
        <p><?php echo $user->about ?></p>
    </div>    
    <?php endif ?>
        
    <?php if (!empty($user->interests)): ?>    
    <div class="interests">        
        <h4><?php echo Text::get('profile-interests-header'); ?></h4>
Ejemplo n.º 2
0
Archivo: user.php Proyecto: kenjs/Goteo
 /**
  * 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                        user.home\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->skills = User\Skill::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;
     }
 }