return $this->profile()->promo();
}
- public function yearpromo()
- {
- if (!$this->hasProfile()) {
- return 0;
- }
- return $this->profile()->yearpromo();
- }
-
public function firstName()
{
if (!$this->hasProfile()) {
// Contacts
private $contacts = null;
- public function isContact(PlUser &$user)
+ private function fetchContacts()
{
if (is_null($this->contacts)) {
$this->contacts = XDB::fetchAllAssoc('contact', 'SELECT *
WHERE uid = {?}',
$this->id());
}
+ }
+
+ public function iterContacts()
+ {
+ $this->fetchContacts();
+ return self::iterOverUIDs(array_keys($this->contacts));
+ }
+
+ public function getContacts()
+ {
+ $this->fetchContacts();
+ return self::getBulkUsersWithUIDs(array_keys($this->contacts));
+ }
+
+ public function isContact(PlUser &$user)
+ {
+ $this->fetchContacts();
return isset($this->contacts[$user->id()]);
}
$_POST['cc_contacts'] = explode(';', @$_POST['cc_contacts']);
$data = serialize($_POST);
XDB::execute("REPLACE INTO email_send_save
- VALUES ({?}, {?})", S::i('uid'), $data);
+ VALUES ({?}, {?})",
+ S::user()->id('uid'), $data);
}
exit;
} else if (Env::v('submit') == 'Envoyer') {
if (!$error) {
XDB::execute("DELETE FROM email_send_save
- WHERE uid = {?}", S::i('uid'));
+ WHERE uid = {?}",
+ S::user()->id());
$to2 = getEmails(Env::v('to_contacts'));
$cc2 = getEmails(Env::v('cc_contacts'));
}
}
- $res = XDB::query(
- "SELECT ac.full_name, a.alias as forlife
- FROM accounts AS ac
- INNER JOIN contacts AS c ON (ac.uid = c.contact)
- INNER JOIN aliases AS a ON (ac.uid = a.uid AND FIND_IN_SET('bestalias', a.flags))
- WHERE c.uid = {?}
- ORDER BY ac.full_name", S::i('uid'));
- $page->assign('contacts', $res->fetchAllAssoc());
+ $contacts = S::user()->getContacts();
+ $page->assign('contacts', $contacts);
$page->assign('maxsize', ini_get('upload_max_filesize') . 'o');
$page->assign('user', S::user());
}
<div style="float: right; width: 40%;">
<select id="to_contacts" name="to_contacts[]" multiple="multiple" style="width: 100%; height: 5em">
{foreach key=key item=contact from=$contacts}
- {if in_array($contact.forlife, $smarty.request.to_contacts)}
- <option value="{$contact.forlife}">
- {$contact.full_name}
+ {if in_array($contact->hruid,$smarty.request.to_contacts)}
+ <option value="{$contact->hruid}">
+ {$contact->full_name}
</option>
{/if}
{/foreach}
</select><br />
<select id="cc_contacts" name="cc_contacts[]" multiple="multiple" style="width: 100%; height: 5em">
{foreach key=key item=contact from=$contacts}
- {if in_array($contact.forlife, $smarty.request.cc_contacts)}
- <option value="{$contact.forlife}">
- {$contact.full_name}
+ {if in_array($contact->forlife,$smarty.request.cc_contacts)}
+ <option value="{$contact->forlife}">
+ {$contact->full_name}
</option>
{/if}
{/foreach}
<div style="float: right; width: 40%">
<select id="contacts" name="all_contacts[]" multiple="multiple" style="height: 10em; width: 100%">
{foreach item=contact from=$contacts}
- {if !in_array($contact.forlife, $smarty.request.to_contacts) && !in_array($contact.forlife, $smarty.request.cc_contacts)}
- <option value="{$contact.forlife}">
- {$contact.full_name}
+ {if !in_array($contact->hruid,$smarty.request.to_contacts) && !in_array($contact->hruid,$smarty.request.cc_contacts)}
+ <option value="{$contact->hruid}">
+ {$contact->full_name}
</option>
{/if}
{/foreach}
</select>
</div>
{foreach item=contact from=$contacts}
- <input type="hidden" name="contacts[{$contact.forlife}]" value="{$contact.prenom} {$contact.nom} <{$contact.forlife}@{#globals.mail.domain#}>" />
+ <input type="hidden" name="contacts[{$contact->hruid}]" value="{$contact->display_name} <{$contact->forlife}>" />
{/foreach}
</td>
</tr>
{$smarty.request.contenu}
{if !$smarty.request.contenu}
--
-{$smarty.session.prenom} {$smarty.session.nom}
+{$smarty.session.user->full_name}
{/if}</textarea>
<script type="text/javascript">//<![CDATA[
{literal}
copyTable('#x4dat#.contacts', 'contacts');
copyTable('#x4dat#.coupures', 'downtimes');
copyTable('#x4dat#.emails_watch', 'email_watch');
+copyTable('#x4dat#.emails_send_save', 'email_send_save');
copyTable('#x4dat#.homonymes', 'homonyms');
copyTable('#x4dat#.ip_watch', 'ip_watch');
copyTable('#x4dat#.mx_watch', 'mx_watch');