本文整理汇总了PHP中Phone::savePhones方法的典型用法代码示例。如果您正苦于以下问题:PHP Phone::savePhones方法的具体用法?PHP Phone::savePhones怎么用?PHP Phone::savePhones使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phone
的用法示例。
在下文中一共展示了Phone::savePhones方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save(ProfilePage $page, $field, $value)
{
$deletePrivate = S::user()->isMe($page->owner) || S::admin();
XDB::execute('DELETE FROM pj, pjt
USING profile_job AS pj
LEFT JOIN profile_job_term AS pjt ON (pj.pid = pjt.pid AND pj.id = pjt.jid)
WHERE pj.pid = {?}' . ($deletePrivate ? '' : ' AND pj.pub IN (\'public\', \'ax\')'), $page->pid());
Address::deleteAddresses($page->pid(), Address::LINK_JOB, null, null, $deletePrivate);
Phone::deletePhones($page->pid(), Phone::LINK_JOB, null, $deletePrivate);
$previous_requests = EntrReq::get_typed_requests($page->pid(), 'entreprise');
foreach ($previous_requests as $request) {
$request->clean();
}
$terms_values = array();
foreach ($value as $id => &$job) {
if (($job['pub'] != 'private' || $deletePrivate) && (isset($job['name']) && $job['name'])) {
if (isset($job['jobid']) && $job['jobid']) {
XDB::execute('INSERT INTO profile_job (pid, id, description, email, entry_year,
url, pub, email_pub, jobid)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})', $page->pid(), $id, $job['description'], $job['w_email'], $job['w_entry_year'], $job['w_url'], $job['pub'], $job['w_email_pub'], $job['jobid']);
} else {
XDB::execute('INSERT INTO profile_job (pid, id, description, email, entry_year,
url, pub, email_pub)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})', $page->pid(), $id, $job['description'], $job['w_email'], $job['w_entry_year'], $job['w_url'], $job['pub'], $job['w_email_pub']);
$request = new EntrReq(S::user(), $page->profile, $id, $job['name'], $job['hq_acronym'], $job['hq_url'], $job['hq_email'], $job['hq_fixed'], $job['hq_fax'], $job['hq_address']);
$request->submit();
sleep(1);
}
$address = new Address(array_merge($job['w_address'], array('pid' => $page->pid(), 'id' => $id, 'type' => Address::LINK_JOB)));
$address->save();
Phone::savePhones($job['w_phone'], $page->pid(), Phone::LINK_JOB, $id);
if (isset($job['terms'])) {
foreach ($job['terms'] as $term) {
$terms_values[] = XDB::format('({?}, {?}, {?}, {?})', $page->pid(), $id, $term['jtid'], "original");
}
}
}
}
if (count($terms_values) > 0) {
XDB::rawExecute('INSERT INTO profile_job_term (pid, jid, jtid, computed)
VALUES ' . implode(', ', $terms_values) . '
ON DUPLICATE KEY UPDATE computed = VALUES(computed)');
}
if (S::user()->isMe($page->owner) && count($value) > 1) {
Platal::page()->trigWarning('Attention, tu as plusieurs emplois sur ton profil. Pense à supprimer ceux qui sont obsolètes.');
}
}
示例2: save
public function save($notify_ungeocoded = true)
{
if (!$this->isEmpty()) {
XDB::execute('INSERT IGNORE INTO profile_addresses (pid, jobid, groupid, type, id, flags, text, postalText, pub, comment,
types, formatted_address, location_type, partial_match, latitude, longitude,
southwest_latitude, southwest_longitude, northeast_latitude, northeast_longitude,
geocoding_date, geocoding_calls, postal_code_fr)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?},
{?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, NOW(), {?}, {?})', $this->pid, $this->jobid, $this->groupid, $this->type, $this->id, $this->flags, $this->text, $this->postalText, $this->pub, $this->comment, $this->types, $this->formatted_address, $this->location_type, $this->partial_match, $this->latitude, $this->longitude, $this->southwest_latitude, $this->southwest_longitude, $this->northeast_latitude, $this->northeast_longitude, $this->geocoding_calls, $this->postal_code_fr);
// In an ideal world there would not be any components to clean up before insertion.
// In real world, it happens that some addresses are badly removed and this query removes the leaked trash.
XDB::execute('DELETE FROM profile_addresses_components
WHERE pid = {?} AND jobid = {?} AND groupid = {?} AND type = {?} AND id = {?}', $this->pid, $this->jobid, $this->groupid, $this->type, $this->id);
if ($this->componentsIds) {
foreach (explode(',', $this->componentsIds) as $component_id) {
XDB::execute('INSERT IGNORE INTO profile_addresses_components (pid, jobid, groupid, type, id, component_id)
VALUES ({?}, {?}, {?}, {?}, {?}, {?})', $this->pid, $this->jobid, $this->groupid, $this->type, $this->id, $component_id);
}
} elseif ($notify_ungeocoded) {
// If the address was not geocoded, notifies it to the appropriate ML.
$mailer = new PlMailer('profile/no_geocoding.mail.tpl');
$mailer->assign('text', $this->text);
$mailer->assign('primary_key', $this->pid . '-' . $this->jobid . '-' . $this->groupid . '-' . $this->type . '-' . $this->id);
$mailer->send();
}
if ($this->type == self::LINK_PROFILE) {
Phone::savePhones($this->phones, $this->pid, Phone::LINK_ADDRESS, $this->id);
}
if ($this->request) {
$req = new AddressReq(S::user(), $this->toFormArray(), $this->pid, $this->jobid, $this->groupid, $this->type, $this->id);
$req->submit();
}
if ($this->pid != 0) {
self::updateBestMail($this->pid);
}
}
}
示例3: save
public function save(ProfilePage $page, $field, $value)
{
Phone::deletePhones($page->pid(), Phone::LINK_PROFILE, null, S::user()->isMe($page->owner) || S::admin());
Phone::savePhones($value, $page->pid(), Phone::LINK_PROFILE);
}