当前位置: 首页>>代码示例>>PHP>>正文


PHP Phone::iterate方法代码示例

本文整理汇总了PHP中Phone::iterate方法的典型用法代码示例。如果您正苦于以下问题:PHP Phone::iterate方法的具体用法?PHP Phone::iterate怎么用?PHP Phone::iterate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phone的用法示例。


在下文中一共展示了Phone::iterate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:57,代码来源:jobs.inc.php

示例2: printf

        printf("\r%u / %u", $i, $total);
    }
}
printf("\r%u / %u", $i, $total);
print "\nFormating done.\n\n";
print "Deletes duplicated phones. (4/4)\n";
$pids = XDB::rawFetchColumn("SELECT  DISTINCT(pid)\n                               FROM  profile_phones AS p1\n                              WHERE  link_type = 'user' AND EXISTS (SELECT  *\n                                                                      FROM  profile_phones AS p2\n                                                                     WHERE  p2.link_type = 'user' AND p2.pid = p1.pid AND p2.tel_id != p1.tel_id)\n                           ORDER BY  pid");
$total = count($pids);
$done = 0;
$aux = 0;
$deleted = 0;
$phones = array();
$duplicates = array();
foreach ($pids as $pid) {
    $count = 0;
    $it = Phone::iterate(array($pid), array(Phone::LINK_PROFILE), array(0), Visibility::get(Visibility::VIEW_PRIVATE));
    while ($item = $it->next()) {
        $phones[] = $item;
        ++$count;
    }
    for ($i = 0; $i < $count; ++$i) {
        for ($j = $i + 1; $j < $count; ++$j) {
            if ($phones[$i]->search == $phones[$j]->search) {
                $duplicates[$j] = true;
                if (Visibility::isLessRestrictive($phones[$i]->pub, $phones[$j]->pub)) {
                    $phones[$i]->pub = $phones[$j]->pub;
                }
            }
        }
    }
    if (count($duplicates)) {
开发者ID:Ekleog,项目名称:platal,代码行数:31,代码来源:merge_issues.php

示例3: next

 public function next()
 {
     if (is_null($this->dbiter)) {
         return null;
     }
     $data = $this->dbiter->next();
     if (is_null($data)) {
         return null;
     }
     // Adds phones to addresses.
     $it = Phone::iterate(array($data['pid']), array(Phone::LINK_ADDRESS), array($data['id']), $this->visibility);
     while ($phone = $it->next()) {
         $data['phones'][$phone->id] = $phone->toFormArray();
     }
     return new Address($data);
 }
开发者ID:Ekleog,项目名称:platal,代码行数:16,代码来源:address.php

示例4: 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;
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:23,代码来源:page.inc.php

示例5: preload

 public static function preload($pids = array())
 {
     if (self::$fullload) {
         return;
     }
     // Load raw data
     if (count($pids)) {
         $join = 'LEFT JOIN profile_job ON (profile_job.jobid = pje.id)';
         $where = 'WHERE profile_job.pid IN ' . XDB::formatArray($pids);
     } else {
         $join = '';
         $where = '';
     }
     $it = XDB::iterator('SELECT  pje.id, pje.name, pje.acronym, pje.url,
                                  pa.flags, pa.text, pa.type, pa.pub
                            FROM  profile_job_enum AS pje
                       LEFT JOIN  profile_addresses AS pa ON (pje.id = pa.jobid AND pa.type = \'hq\')
                               ' . $join . '
                               ' . $where);
     $newcompanies = array();
     while ($row = $it->next()) {
         $cp = new Company($row);
         $addr = new Address($row);
         $cp->setAddress($addr);
         if (!array_key_exists($row['id'], self::$companies)) {
             $newcompanies[] = $row['id'];
         }
         self::$companies[$row['id']] = $cp;
     }
     // Add phones to hq
     if (count($newcompanies)) {
         $it = Phone::iterate(array(), array(Phone::LINK_COMPANY), $newcompanies, Visibility::defaultForRead());
         while ($phone = $it->next()) {
             self::$companies[$phone->link_id]->setPhone($phone);
         }
     }
     if (count($pids) == 0) {
         self::$fullload = true;
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:40,代码来源:profilefields.inc.php


注:本文中的Phone::iterate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。