本文整理汇总了PHP中Phone::toFormArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Phone::toFormArray方法的具体用法?PHP Phone::toFormArray怎么用?PHP Phone::toFormArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phone
的用法示例。
在下文中一共展示了Phone::toFormArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: value
public function value(ProfilePage $page, $field, $value, &$success)
{
$success = true;
$phones = array();
if (is_null($value)) {
$it = Phone::iterate(array($page->pid()), array(Phone::LINK_PROFILE), array(0), Visibility::get(Visibility::VIEW_ADMIN));
while ($phone = $it->next()) {
$success = $phone->format() && $success;
$phones[] = $phone->toFormArray();
}
if (count($phones) == 0) {
$phone = new Phone();
$phones[] = $phone->toFormArray();
}
return $phones;
} else {
$phones = Phone::formatFormArray($value, $success);
if (!$success) {
Platal::page()->trigError('Numéro de téléphone invalide');
}
return $phones;
}
}
示例2: fetchJobs
private function fetchJobs(ProfilePage $page)
{
// Build the jobs tree
$jobs = XDB::fetchAllAssoc('SELECT j.id, j.jobid, je.name,
j.description, j.email AS w_email,
j.email_pub AS w_email_pub,
j.url AS w_url, j.pub, j.entry_year AS w_entry_year
FROM profile_job AS j
LEFT JOIN profile_job_enum AS je ON (j.jobid = je.id)
WHERE j.pid = {?}
ORDER BY j.id', $page->pid());
if (empty($jobs)) {
return array($this->emptyJob());
}
$compagnies = array();
$backtrack = array();
foreach ($jobs as $key => $job) {
$compagnies[] = $job['jobid'];
$backtrack[$job['id']] = $key;
}
$it = Address::iterate(array($page->pid()), array(Address::LINK_JOB), array(), Visibility::get(Visibility::VIEW_ADMIN));
while ($address = $it->next()) {
$jobs[$address->id]['w_address'] = $address->toFormArray();
}
$it = Phone::iterate(array($page->pid()), array(Phone::LINK_JOB), array(), Visibility::get(Visibility::VIEW_ADMIN));
while ($phone = $it->next()) {
$jobs[$phone->link_id]['w_phone'][$phone->id] = $phone->toFormArray();
}
$res = XDB::iterator("SELECT e.jtid, e.full_name, j.jid\n FROM profile_job_term_enum AS e\n INNER JOIN profile_job_term AS j USING(jtid)\n WHERE pid = {?}\n ORDER BY j.jid", $page->pid());
while ($term = $res->next()) {
// $jid is the ID of the job among this user's jobs
$jid = $term['jid'];
if (!isset($backtrack[$jid])) {
continue;
}
$job =& $jobs[$backtrack[$jid]];
if (!isset($job['terms'])) {
$job['terms'] = array();
}
$job['terms'][] = $term;
}
$phone = new Phone();
$address = new Address();
foreach ($jobs as $id => &$job) {
if (!isset($job['w_phone'])) {
$job['w_phone'] = array(0 => $phone->toFormArray());
}
if (!isset($job['w_address'])) {
$job['w_address'] = $address->toFormArray();
}
$job['w_email_new'] = '';
if (!isset($job['w_email_pub'])) {
$job['w_email_pub'] = 'private';
}
}
return $jobs;
}
示例3: Phone
function handler_ajax_tel($page, $prefid, $prefname, $telid, $subField, $mainField, $mainId)
{
pl_content_headers("text/html");
$page->changeTpl('profile/phone.tpl', NO_SKIN);
$page->assign('prefid', $prefid);
$page->assign('prefname', $prefname);
$page->assign('telid', $telid);
$phone = new Phone();
$page->assign('tel', $phone->toFormArray());
if ($mainField) {
$page->assign('subField', $subField);
$page->assign('mainField', $mainField);
$page->assign('mainId', $mainId);
}
}