mirror of https://github.com/movim/movim
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
4.0 KiB
111 lines
4.0 KiB
<?php
|
|
|
|
/**
|
|
* @package Widgets
|
|
*
|
|
* @file Roster.php
|
|
* This file is part of MOVIM.
|
|
*
|
|
* @brief The Roster widget
|
|
*
|
|
* @author Jaussoin Timothée <edhelas@gmail.com>
|
|
*
|
|
* @version 1.0
|
|
* @date 30 August 2010
|
|
*
|
|
* Copyright (C)2010 MOVIM project
|
|
*
|
|
* See COPYING for licensing information.
|
|
*/
|
|
|
|
class ContactCard extends WidgetCommon
|
|
{
|
|
|
|
function WidgetLoad()
|
|
{
|
|
$this->addcss('contactcard.css');
|
|
$this->registerEvent('vcard', 'onVcard');
|
|
}
|
|
|
|
function onVcard($contact)
|
|
{
|
|
$html = $this->prepareContactCard($contact);
|
|
RPC::call('movim_fill', 'contactcard', RPC::cdata($html));
|
|
}
|
|
|
|
function prepareContactCard($contact)
|
|
{
|
|
$gender = getGender();
|
|
$marital = getMarital();
|
|
|
|
$html .= '
|
|
<form name="vcard" id="vcardform" class="protect red"><br />
|
|
<h1>'.t('Profile').'</h1><br />
|
|
<fieldset>
|
|
<legend>'.t('General Informations').'</legend>';
|
|
|
|
if($this->testIsSet($contact->getData('fn')))
|
|
$html .= '<div class="element simple">
|
|
<label for="fn">'.t('Name').'</label>
|
|
<span>'.$contact->getData('fn').'</span>
|
|
</div>';
|
|
|
|
if($this->testIsSet($contact->getData('name')))
|
|
$html .= '<div class="element simple">
|
|
<label for="name">'.t('Nickname').'</label>
|
|
<span>'.$contact->getData('name').'</span>
|
|
</div>';
|
|
|
|
if($contact->getData('date') != '0000-00-00' && $this->testIsSet($contact->getData('date')))
|
|
$html .= '<div class="element simple">
|
|
<label for="day">'.t('Date of Birth').'</label>
|
|
<span>'.date('j M Y',strtotime($contact->getData('date'))).'</span>
|
|
</div>';
|
|
|
|
if($contact->getData('gender') != 'N' && $this->testIsSet($contact->getData('gender')))
|
|
$html .= '<div class="element simple">
|
|
<label for="gender">'.t('Gender').'</label>
|
|
<span>'.$gender[$contact->getData('gender')].'</span>
|
|
</div>';
|
|
|
|
if($contact->getData('marital') != 'none' && $this->testIsSet($contact->getData('marital')))
|
|
$html .= '<div class="element simple">
|
|
<label for="marital">'.t('Marital Status').'</label>
|
|
<span>'.$marital[$contact->getData('marital')].'</span>
|
|
</div>';
|
|
|
|
if($this->testIsSet($contact->getData('url')))
|
|
$html .= '<div class="element simple">
|
|
<label for="url">'.t('Website').'</label>
|
|
<a target="_blank" href="'.$contact->getData('url').'">'.$contact->getData('url').'</a>
|
|
</div>';
|
|
|
|
if($this->testIsSet($contact->getData('desc')) && prepareString($contact->getData('desc')) != '')
|
|
$html .= '<div class="element large simple">
|
|
<label for="desc">'.t('About Me').'</label>
|
|
<span>'.prepareString($contact->getData('desc')).'</span>
|
|
</div>';
|
|
|
|
$html .= '</fieldset>
|
|
<div class="config_button" onclick="'.$this->genCallWidget("ContactSummary","ajaxRefreshVcard", "'".$contact->getData('jid')."'").'"></div>
|
|
</form>';
|
|
|
|
return $html;
|
|
}
|
|
|
|
function build()
|
|
{
|
|
$query = Contact::query()->select()
|
|
->where(array(
|
|
'jid' => $_GET['f']));
|
|
$contact = Contact::run_query($query);
|
|
?>
|
|
<div class="tabelem" title="<?php echo t('Profile'); ?>" id="contactcard" >
|
|
<?php
|
|
if(isset($contact[0]))
|
|
echo $this->prepareContactCard($contact[0]);
|
|
?>
|
|
</div>
|
|
<?php
|
|
}
|
|
}
|