本文整理汇总了PHP中Phone::formatFormArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Phone::formatFormArray方法的具体用法?PHP Phone::formatFormArray怎么用?PHP Phone::formatFormArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phone
的用法示例。
在下文中一共展示了Phone::formatFormArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cleanJob
private function cleanJob(ProfilePage $page, $jobid, array &$job, &$success, $job_level)
{
if ($job['w_email'] == "new@example.org") {
$job['w_email'] = $job['w_email_new'];
}
foreach ($this->checks as $obj => &$fields) {
$chk =& $this->{$obj};
foreach ($fields as $field) {
$job[$field] = $chk->value($page, $field, $job[$field], $s);
if (!$s) {
$success = false;
$job[$field . '_error'] = true;
}
}
}
if (count($job['terms'])) {
$termsid = array();
foreach ($job['terms'] as $term) {
if (!isset($term['full_name'])) {
$termsid[] = $term['jtid'];
}
}
if (count($termsid)) {
$res = XDB::query("SELECT jtid, full_name\n FROM profile_job_term_enum\n WHERE jtid IN {?}", $termsid);
$term_id_to_name = $res->fetchAllAssoc('jtid', false);
foreach ($job['terms'] as &$term) {
if (!isset($term['full_name'])) {
$term['full_name'] = $term_id_to_name[$term['jtid']];
}
}
}
}
if ($job['name']) {
$res = XDB::query("SELECT id\n FROM profile_job_enum\n WHERE name = {?}", $job['name']);
if ($res->numRows() != 1) {
$job['jobid'] = null;
} else {
$job['jobid'] = $res->fetchOneCell();
}
}
if (Visibility::isLessRestrictive($job_level, $job['w_email_pub'])) {
$job['w_email_pub'] = $job_level;
}
$job['w_phone'] = Phone::formatFormArray($job['w_phone'], $s, $job_level);
if ($job['w_entry_year'] && strlen($job['w_entry_year']) != 4) {
$job['w_entry_year_error'] = true;
$success = false;
}
unset($job['removed']);
unset($job['new']);
}
示例2: toFormArray
public function toFormArray()
{
$address = array('text' => $this->text, 'postalText' => $this->postalText, 'types' => $this->types, 'formatted_address' => $this->formatted_address, 'latitude' => $this->latitude, 'longitude' => $this->longitude, 'southwest_latitude' => $this->southwest_latitude, 'southwest_longitude' => $this->southwest_longitude, 'northeast_latitude' => $this->northeast_latitude, 'northeast_longitude' => $this->northeast_longitude, 'location_type' => $this->location_type, 'partial_match' => $this->partial_match, 'componentsIds' => $this->componentsIds, 'geocoding_date' => $this->geocoding_date, 'geocoding_calls' => $this->geocoding_calls, 'request' => $this->request);
if ($this->type == self::LINK_JOB) {
$address['pub'] = $this->pub;
$address['mail'] = $this->flags->hasFlag('mail');
}
if ($this->type == self::LINK_PROFILE) {
static $flags = array('current', 'temporary', 'secondary', 'mail', 'cedex', 'deliveryIssue');
foreach ($flags as $flag) {
$address[$flag] = $this->flags->hasFlag($flag);
}
$address['pub'] = $this->pub;
$address['comment'] = $this->comment;
$address['phones'] = Phone::formatFormArray($this->phones);
}
return $address;
}
示例3: 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;
}
}