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


PHP XDB::iterator方法代码示例

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


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

示例1: __construct

 public function __construct(User $_user, Profile $_profile, $_id, $_name, $_acronym, $_url, $_email, $_tel, $_fax, $_address, $_stamp = 0)
 {
     parent::__construct($_user, $_profile, false, 'entreprise', $_stamp);
     $this->id = $_id;
     $this->name = $_name;
     $this->acronym = $_acronym;
     $this->url = $_url;
     $this->email = $_email;
     $this->tel = $_tel;
     $this->fax = $_fax;
     $this->address = $_address;
     $_name = preg_replace('/[^0-9a-z]/i', ' ', strtolower(replace_accent($_name)));
     $name = explode(" ", $_name);
     $name_array = array_map("trim", $name);
     $length = count($name_array);
     $where = "";
     for ($i = 0; $i < $length; $i++) {
         if (strlen($name_array[$i]) > 2) {
             if ($where !== "") {
                 $where .= " OR ";
             }
             $where .= "name LIKE '%" . $name_array[$i] . "%'";
         }
     }
     if ($where != '') {
         $res = XDB::iterator('SELECT  name
                                 FROM  profile_job_enum
                                WHERE  ' . $where);
         $this->suggestions = "| ";
         while ($sug = $res->next()) {
             $this->suggestions .= $sug['name'] . " | ";
         }
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:34,代码来源:entreprises.inc.php

示例2: batchSelect

 public static function batchSelect(array $questions, $options = null)
 {
     if (empty($questions)) {
         return;
     }
     if (empty($options)) {
         $options = self::SELECT_BASE;
     }
     $bits = self::optionsToBits($options);
     $questions = array_combine(self::toIds($questions), $questions);
     if ($bits & self::SELECT_BASE) {
         $iter = XDB::iterator('SELECT  qid AS id, rank, label, description,
                                        mandatory, type, datas
                                  FROM  surveys_questions
                                 WHERE  qid IN {?}
                              GROUP BY  qid', self::toIds($questions));
         while ($datas = $iter->next()) {
             $questions[$datas['id']]->decodeDatas(json_decode($datas['datas']));
             unset($datas['datas']);
             $questions[$datas['id']]->fillFromArray($datas);
         }
     }
     if ($bits & self::SELECT_ANSWERS) {
         $iter = XDB::iterRow('SELECT  ssid, qid, datas
                                 FROM  surveys_answers
                                WHERE  qid IN {?}
                             GROUP BY  qid', self::toIds($questions));
         while (list($ssid, $qid, $datas) = $iter->next()) {
             $questions[$qid]->decodeAnswer($ssid, json_decode($datas));
         }
     }
 }
开发者ID:netixx,项目名称:frankiz,代码行数:32,代码来源:survey.php

示例3: fetch

 protected function fetch(PlUser $user)
 {
     global $globals;
     if (!is_null($user)) {
         return new UserFilterIterator(XDB::iterator("SELECT  id, titre AS title, texte, contacts,\n                                          create_date AS publication,\n                                          FIND_IN_SET('photo', flags) AS photo,\n                                          CONCAT({?}, '/#art', id) AS link\n                                    FROM  group_announces\n                                   WHERE  expiration >= NOW() AND asso_id = {?}", $this->link, $globals->asso('id'), $user));
     } else {
         return XDB::iterator("SELECT  id, titre AS title, texte, create_date AS publication,\n                                           CONCAT({?}, '/#art', id) AS link,\n                                           NULL AS photo, NULL AS contacts\n                                     FROM  group_announces\n                                    WHERE  FIND_IN_SET('public', flags) AND expiration >= NOW() AND asso_id = {?}", $this->link, $globals->asso('id'));
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:9,代码来源:feed.inc.php

示例4: handler_participants

 protected function handler_participants(Collection $activities, $fields)
 {
     $res = XDB::iterator('SELECT  id, participant
                             FROM  activities_participants
                            WHERE  id IN {?}', $activities->ids());
     $users = new Collection('User');
     $part = array();
     while ($datas = $res->next()) {
         $part[$datas['id']][] = $users->addget($datas['participant']);
     }
     foreach ($part as $key => $obj) {
         $activities->get($key)->participants($obj);
     }
     $users->select($this->subs['participants']);
 }
开发者ID:netixx,项目名称:frankiz,代码行数:15,代码来源:activityinstance.php

示例5: handler_ig_events

 function handler_ig_events($page)
 {
     require_once 'gadgets/gadgets.inc.php';
     init_igoogle_html('gadgets/ig-events.tpl', AUTH_COOKIE);
     $events = XDB::iterator("SELECT  SQL_CALC_FOUND_ROWS\n                                         e.id, e.titre, UNIX_TIMESTAMP(e.creation_date) AS creation_date,\n                                         ev.uid IS NULL AS nonlu, e.uid\n                                   FROM  announces     AS e\n                              LEFT JOIN  announce_read AS ev ON (e.id = ev.evt_id AND ev.uid = {?})\n                                  WHERE  FIND_IN_SET('valide', e.flags) AND expiration >= NOW()\n                               ORDER BY  e.creation_date DESC", S::i('uid'));
     $page->assign('event_count', XDB::query("SELECT FOUND_ROWS()")->fetchOneCell());
     Platal::load('events', 'feed.inc.php');
     $user = S::user();
     $data = array();
     while ($e = PlFeed::nextEvent($events, $user)) {
         $data[] = $e;
         if (count($data) == 5) {
             break;
         }
     }
     $page->assign('events', $data);
 }
开发者ID:Ekleog,项目名称:platal,代码行数:17,代码来源:gadgets.php

示例6: getSubTerms

 /** Retreives subterms of a term to display in a tree
  * @param $parent_jtid the id of the parent jobterm
  * @param $filter enable filtering on jobterms that have been used in jobs or in mentors, in
  *  that case, each row as an 'nb' field that counts all profiles that match
  * @param $token_filter a text (usually ending by %) the retreived subterms to jobterms that
  *  contains this tokens or that one of their children contains it.
  * @return an iterator over jobterms with jtid, name, full_name and nb
  */
 public static function getSubTerms($parent_jtid, $filter = self::ALL, $token_filter = null)
 {
     switch ($filter) {
         case self::ALL:
         default:
             $table = '';
             break;
         case self::ONLY_JOBS:
             $table = 'profile_job_term';
             break;
         case self::ONLY_MENTORS:
             $table = 'profile_mentor_term';
             break;
     }
     // we are in a tree looking for certain job terms:
     $countingterms = false;
     if ($table) {
         $count = ', COUNT(DISTINCT j.pid) AS nb';
         $join = ' INNER JOIN  profile_job_term_relation AS r2 ON (r2.jtid_1 = e.jtid)
                   INNER JOIN  ' . $table . ' AS j ON (j.jtid = r2.jtid_2)';
         $countingterms = 'j.jtid';
     } else {
         $count = $join = '';
     }
     if (!empty($token_filter)) {
         $join .= ' INNER JOIN  profile_job_term_relation AS rtf ON (rtf.jtid_1 = e.jtid) ' . self::token_join_query(self::tokenize($token_filter), 'rtf', 'jtid_2');
         if (!$countingterms) {
             $countingterms = 'rtf.jtid_2';
         }
     }
     if (!$countingterms) {
         $select_leaf = 'IF(r_subbranch.jtid_1 IS NULL,1,0)';
         $join .= ' LEFT JOIN  profile_job_term_relation AS r_subbranch ON (r_subbranch.jtid_1 = e.jtid AND r_subbranch.computed = "original") ';
     } else {
         // branches that have counting terms different that
         // main branch will have subbranches
         $select_leaf = 'MIN(' . $countingterms . ' = e.jtid)';
     }
     return XDB::iterator('SELECT  e.jtid, e.name, e.full_name' . $count . ', ' . $select_leaf . ' AS leaf
                             FROM  profile_job_term_enum AS e
                       INNER JOIN  profile_job_term_relation AS r ON (r.jtid_2 = e.jtid)' . $join . '
                            WHERE  r.jtid_1 = {?} AND r.computed = "original"
                         GROUP BY  e.jtid
                         ORDER BY  e.name', $parent_jtid);
 }
开发者ID:Ekleog,项目名称:platal,代码行数:53,代码来源:jobterms.php

示例7: handler_logs_sessions

 function handler_logs_sessions($page)
 {
     $iter = XDB::iterator('SELECT  id, uid, host, ip, forward_ip, forward_host,
                                    browser, suid, flags, start
                              FROM  log_sessions
                          ORDER BY  start DESC
                             LIMIT  50');
     $sessions = array();
     $users = new Collection('User');
     while ($session = $iter->next()) {
         $user = $users->addget($session['uid']);
         $sessions[$session['id']] = array('user' => $user, 'host' => $session['host'], 'ip' => uint_to_ip($session['ip']), 'forward_host' => $session['forward_host'], 'forward_ip' => uint_to_ip($session['forward_ip']), 'browser' => $session['browser'], 'suid' => $session['suid'], 'flags' => $session['flags'], 'start' => new FrankizDateTime($session['start']));
     }
     $users->select(UserSelect::base());
     $page->assign('title', "Logs des sessions");
     $page->assign('sessions', $sessions);
     $page->changeTpl('admin/logs_sessions.tpl');
 }
开发者ID:netixx,项目名称:frankiz,代码行数:18,代码来源:admin.php

示例8: education_options

function education_options($current = 0)
{
    $html = '<option value="-1">&nbsp;</option>';
    $res = XDB::iterator("SELECT  e.id AS id, gc.country,\n                                   IF(CHAR_LENGTH(e.name) > 76, e.abbreviation, e.name) AS name\n                             FROM  profile_education_enum AS e\n                        LEFT JOIN  geoloc_countries       AS gc ON (e.country = gc.iso_3166_1_a2)\n                     WHERE EXISTS  (SELECT  *\n                                      FROM  profile_education_degree AS d\n                                     WHERE  e.id = d.eduid) AND e.name != {?}\n                         ORDER BY  gc.country, e.name", Profile::EDU_X);
    $country = "";
    while ($arr_edu = $res->next()) {
        if ($arr_edu["country"] != $country) {
            if ($country) {
                $html .= '</optgroup>';
            }
            $country = $arr_edu["country"];
            $html .= '<optgroup label="' . $country . '">';
        }
        $html .= '<option value="' . $arr_edu["id"] . '"';
        if ($arr_edu["id"] == $current) {
            $html .= " selected='selected'";
        }
        $html .= '>' . htmlspecialchars($arr_edu["name"]) . "</option>\n";
    }
    if ($country) {
        $html .= '</optgroup>';
    }
    return $html;
}
开发者ID:Ekleog,项目名称:platal,代码行数:24,代码来源:education.func.inc.php

示例9: handler_skin

 function handler_skin($page)
 {
     global $globals;
     $page->changeTpl('platal/skins.tpl');
     $page->setTitle('Skins');
     if (Env::has('newskin')) {
         // formulaire soumis, traitons les données envoyées
         XDB::execute('UPDATE  accounts
                          SET  skin = {?}
                        WHERE  uid = {?}', Env::i('newskin'), S::i('uid'));
         S::kill('skin');
         Platal::session()->setSkin();
     }
     $res = XDB::query('SELECT  id
                          FROM  skins
                         WHERE  skin_tpl = {?}', S::v('skin'));
     $page->assign('skin_id', $res->fetchOneCell());
     $sql = 'SELECT  s.*, auteur, COUNT(*) AS nb
               FROM  skins AS s
          LEFT JOIN  accounts AS a ON (a.skin = s.id)
              WHERE  skin_tpl != \'\' AND ext != \'\'
           GROUP BY  id ORDER BY s.date DESC';
     $page->assign('skins', XDB::iterator($sql));
 }
开发者ID:Ekleog,项目名称:platal,代码行数:24,代码来源:platal.php

示例10: handler_relance

 function handler_relance($page)
 {
     $page->changeTpl('marketing/relance.tpl');
     if (Post::has('relancer')) {
         global $globals;
         $nbdix = $globals->core->NbIns;
         $sent = array();
         $users = User::getBulkUsersWithUIDs($_POST['relance']);
         foreach ($users as $user) {
             if ($tmp = Marketing::relance($user, $nbdix)) {
                 $sent[] = $tmp . ' a été relancé.';
             }
         }
         $page->assign('sent', $sent);
     }
     $page->assign('relance', XDB::iterator('SELECT  r.date, r.relance, r.uid
                                               FROM  register_pending AS r
                                              WHERE  hash != \'INSCRIT\'
                                           ORDER BY  date DESC'));
 }
开发者ID:Ekleog,项目名称:platal,代码行数:20,代码来源:marketing.php

示例11: COUNT

    // to add a forlife-looking nickname at some point, we'll do it manually.
    if (!preg_match('/^[-a-z]+\\.[-a-z]+\\.\\d{4}$/', $nickname['nickname'])) {
        $pending_tasks = XDB::fetchOneCell("SELECT  COUNT(*)\n               FROM  gapps_queue\n              WHERE  q_recipient_id = {?} AND p_status = 'idle' AND j_type = 'n_create' AND j_parameters = {?}", $nickname['id'], json_encode($nickname));
        if ($pending_tasks == 0) {
            XDB::execute("INSERT  INTO gapps_queue\n                    SET  q_recipient_id = {?}, p_entry_date = NOW(), p_notbefore_date = NOW(),\n                         p_priority = 'offline', j_type = 'n_create', j_parameters = {?}", $nickname['id'], json_encode($nickname));
        }
    }
}
/* Checks that all nicknames in GoogleApps are also aliases on plat/al side.
   Deletes the invalid ones. */
$res = XDB::iterator("SELECT  g.l_userid AS id, g.g_nickname AS nickname\n       FROM  gapps_nicknames AS g\n  LEFT JOIN  email_source_account AS s ON (s.uid = g.l_userid AND s.type = 'alias' AND s.email = g.g_nickname)\n      WHERE  g.l_userid IS NOT NULL AND s.email IS NULL");
while ($nickname = $res->next()) {
    $pending_tasks = XDB::fetchOneCell("SELECT  COUNT(*)\n           FROM  gapps_queue\n          WHERE  q_recipient_id = {?} AND p_status = 'idle' AND j_type = 'n_delete' AND j_parameters = {?}", $nickname['id'], json_encode($nickname));
    if ($pending_tasks == 0) {
        XDB::execute("INSERT  INTO gapps_queue\n                SET  q_recipient_id = {?}, p_entry_date = NOW(), p_notbefore_date = NOW(),\n                     p_priority = 'offline', j_type = 'n_delete', j_parameters = {?}", $nickname['id'], json_encode($nickname));
    }
}
/* Retrieves successful job queues for post-queue processing. */
$res = XDB::iterator("SELECT  q_id, q_recipient_id, j_type, j_parameters\n       FROM  gapps_queue\n      WHERE  p_status = 'success' AND q_recipient_id IS NOT NULL");
while ($job = $res->next()) {
    if ($job['j_type'] == 'u_create') {
        post_queue_u_create($job);
    } else {
        if ($job['j_type'] == 'u_update') {
            post_queue_u_update($job);
        }
    }
}
/* Removes successful jobs, and old failed jobs. */
XDB::execute("DELETE  FROM gapps_queue\n      WHERE  p_status = 'success' OR\n             (p_status = 'hardfail' AND p_end_date < DATE_SUB(NOW(), INTERVAL 15 DAY))");
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
开发者ID:Ekleog,项目名称:platal,代码行数:31,代码来源:google_apps.php

示例12: _prepare

 public function _prepare(PlPage $page, $id)
 {
     require_once 'emails.combobox.inc.php';
     fill_email_combobox($page, array('redirect', 'job', 'stripped_directory'), $this->owner);
     if (!S::user()->isMe($this->owner)) {
         $res = XDB::iterator('SELECT  id, name
                                 FROM  profile_corps_enum
                             ORDER BY  id = 1 DESC, name');
         $page->assign('original_corps', $res->fetchAllAssoc());
     }
     $res = XDB::iterator("SELECT  id, name\n                                FROM  profile_corps_enum\n                               WHERE  still_exists = 1\n                            ORDER BY  id = 1 DESC, name");
     $page->assign('current_corps', $res->fetchAllAssoc());
     $res = XDB::iterator("SELECT  id, name\n                                FROM  profile_corps_rank_enum\n                            ORDER BY  id = 1 DESC, name");
     $page->assign('corps_rank', $res->fetchAllAssoc());
 }
开发者ID:Ekleog,项目名称:platal,代码行数:15,代码来源:jobs.inc.php

示例13: array

#!/usr/bin/php5
<?php 
require_once 'connect.db.inc.php';
$globals->debug = 0;
//do not store backtraces
$terms = XDB::iterator('SELECT `jtid`, `name` FROM `profile_job_term_enum`');
while ($term = $terms->next()) {
    $tokens = array_unique(JobTerms::tokenize($term['name']));
    if (!count($tokens)) {
        continue;
    }
    $values = array();
    foreach ($tokens as $t) {
        $values[] = '(' . XDB::escape($t) . ',' . XDB::escape($term['jtid']) . ')';
    }
    XDB::execute('INSERT IGNORE INTO `profile_job_term_search` (`search`,`jtid`) VALUES ' . implode(',', $values));
}
/* vim:set et sw=4 sts=4 ts=4: */
开发者ID:Ekleog,项目名称:platal,代码行数:18,代码来源:tokenize_job_terms.php

示例14: getPendingAccounts

 public static function getPendingAccounts($login, $iterator = false)
 {
     if (strpos($login, '@') === false) {
         return null;
     }
     list($login, $domain) = explode('@', $login);
     if ($domain && !self::isMainMailDomain($domain)) {
         return null;
     }
     $sql = "SELECT  uid, full_name\n                  FROM  accounts\n                 WHERE  state = 'pending' AND REPLACE(hruid, '-', '') LIKE\n                        CONCAT('%', REPLACE(REPLACE(REPLACE({?}, ' ', ''), '-', ''), '\\'', ''), '%')\n              ORDER BY  full_name";
     if ($iterator) {
         return XDB::iterator($sql, $login);
     } else {
         $res = XDB::query($sql, $login);
         return $res->fetchAllAssoc();
     }
 }
开发者ID:pombredanne,项目名称:platal,代码行数:17,代码来源:user.php

示例15: helper_main

 protected function helper_main(Collection $metas, array $cols, array $joins)
 {
     $table = $this->schema->table();
     $as = $this->schema->tableAs();
     $id = $this->schema->id();
     $sql_fields = self::arrayToSqlCols($cols);
     $sql_joins = PlSqlJoin::formatJoins($joins, array());
     $collections = array();
     foreach ($cols as $fields) {
         foreach ($fields as $field) {
             if ($this->schema->isCollection($field)) {
                 // TODO: is this code used ?
                 //$collections[$field] = new Collection($this->schema->collectionType($field));
                 throw new Exception("Oops, there is a main handler for collections now ?");
             } elseif (!empty($this->subs) && array_key_exists($field, $this->subs)) {
                 $collections[$field] = new Collection($this->schema->objectType($field));
             }
         }
     }
     $iter = XDB::iterator("SELECT  {$as}.{$id} AS id, {$sql_fields}\n                                 FROM  {$table} AS {$as}\n                                       {$sql_joins}\n                                WHERE  {$as}.{$id} IN {?}", $metas->ids());
     while ($datas = $iter->next()) {
         foreach ($datas as $key => $value) {
             if ($this->schema->isObject($key)) {
                 $class = $this->schema->objectType($key);
                 $datas[$key] = new $class($value);
             }
             if (array_key_exists($key, $collections) && $value !== null) {
                 $datas[$key] = $collections[$key]->addget($value);
             }
             if ($value === null) {
                 /*
                  * /!\ Null in the DB means false in here.
                  * Therefore Boolean fields must *not* be nullable !
                  */
                 $datas[$key] = false;
             }
         }
         $metas->get($datas['id'])->fillFromArray($datas);
     }
     foreach ($collections as $field => $collection) {
         $collection->select($this->subs[$field]);
     }
 }
开发者ID:netixx,项目名称:frankiz,代码行数:43,代码来源:select.php


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