本文整理汇总了PHP中XDB::rawFetchAllAssoc方法的典型用法代码示例。如果您正苦于以下问题:PHP XDB::rawFetchAllAssoc方法的具体用法?PHP XDB::rawFetchAllAssoc怎么用?PHP XDB::rawFetchAllAssoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XDB
的用法示例。
在下文中一共展示了XDB::rawFetchAllAssoc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handler_issues_promo
function handler_issues_promo($page, $action = '')
{
$page->changeTpl('fusionax/promo_issues.tpl');
if ($action == 'edit') {
S::assert_xsrf_token();
$issues = XDB::rawIterRow('SELECT p.pid, pd.directory_name, pd.promo, pm.entry_year_ax, pe.entry_year, pe.grad_year
FROM profile_merge_issues AS pm
INNER JOIN profiles AS p ON (pm.pid = p.pid)
INNER JOIN profile_display AS pd ON (pd.pid = p.pid)
INNER JOIN profile_education AS pe ON (pe.pid = p.pid AND FIND_IN_SET(\'primary\', pe.flags))
WHERE FIND_IN_SET(\'promo\', pm.issues)
ORDER BY pd.directory_name');
while (list($pid, $name, $promo, $deathAX, $deathXorgEntry, $deathXorgGrad) = $issues->next()) {
$choiceXorg = Post::has('XORG_' . $pid);
if (!(Post::has('display_' . $pid) && Post::has('entry_' . $pid) && Post::has('grad_' . $pid))) {
continue;
}
$display = Post::i('display_' . $pid);
$entry = Post::i('entry_' . $pid);
$grad = Post::i('grad_' . $pid);
if (!($grad <= $entry + 5 && $grad >= $entry + 3 && ($display >= $entry && $display <= $grad - 3))) {
$page->trigError("La promotion de {$name} n'a pas été corrigée.");
continue;
}
XDB::execute('UPDATE profile_display
SET promo = {?}
WHERE pid = {?}', 'X' . $display, $pid);
XDB::execute('UPDATE profile_education
SET entry_year = {?}, grad_year = {?}
WHERE pid = {?} AND FIND_IN_SET(\'primary\', flags)', $entry, $grad, $pid);
$page->trigSuccess("La promotion de {$name} a bien été corrigée.");
}
}
$issues = XDB::rawFetchAllAssoc('SELECT p.pid, p.hrpid, pd.directory_name, pd.promo, pm.entry_year_ax, pe.entry_year, pe.grad_year
FROM profile_merge_issues AS pm
INNER JOIN profiles AS p ON (pm.pid = p.pid)
INNER JOIN profile_display AS pd ON (pd.pid = p.pid)
INNER JOIN profile_education AS pe ON (pe.pid = p.pid AND FIND_IN_SET(\'primary\', pe.flags))
WHERE FIND_IN_SET(\'promo\', pm.issues)
ORDER BY pd.directory_name');
$page->assign('issues', $issues);
$page->assign('total', count($issues));
}
示例2: assign_json_to_map
public static function assign_json_to_map(PlPage $page, $pids = null)
{
if (!is_null($pids)) {
$where = XDB::format(' AND pa.pid IN {?}', $pids);
} else {
$where = '';
}
if (!S::logged() || !S::user()->checkPerms('directory_ax')) {
$where .= " AND pa.pub = 'public'";
$name_publicity = 'public';
} else {
if (!S::user()->checkPerms('directory_private')) {
$where .= " AND pa.pub = 'ax'";
$name_publicity = 'public';
} else {
$name_publicity = 'private';
}
}
$data = XDB::rawFetchAllAssoc('SELECT pa.latitude, pa.longitude, GROUP_CONCAT(DISTINCT p.hrpid SEPARATOR \',\') AS hrpid,
GROUP_CONCAT(pd.promo SEPARATOR \',\') AS promo,
GROUP_CONCAT(DISTINCT pd.' . $name_publicity . '_name, \' (\', pd.promo, \')\' SEPARATOR \', \') AS name,
GROUP_CONCAT(DISTINCT pa.pid SEPARATOR \',\') AS pid
FROM profile_addresses AS pa
INNER JOIN profiles AS p ON (pa.pid = p.pid)
INNER JOIN profile_display AS pd ON (pd.pid = pa.pid)
WHERE pa.type = \'home\' AND p.deathdate IS NULL AND pa.latitude IS NOT NULL AND pa.longitude IS NOT NULL' . $where . '
GROUP BY pa.latitude, pa.longitude');
$page->jsonAssign('data', $data);
}
示例3: handler_geocoding
function handler_geocoding($page, $category = null, $action = null, $id = null)
{
// Warning, this handler requires the following packages:
// * pkg-isocodes
// * isoquery
static $properties = array('country' => array('name' => 'pays', 'isocode' => '3166', 'table' => 'geoloc_countries', 'id' => 'iso_3166_1_a2', 'main_fields' => array('iso_3166_1_a3', 'iso_3166_1_num', 'countryEn'), 'other_fields' => array('worldRegion', 'country', 'capital', 'nationality', 'nationalityEn', 'phonePrefix', 'phoneFormat', 'licensePlate', 'belongsTo')), 'language' => array('name' => 'langages', 'isocode' => '639', 'table' => 'profile_langskill_enum', 'id' => 'iso_639_2b', 'main_fields' => array('iso_639_2t', 'iso_639_1', 'language_en'), 'other_fields' => array('language')));
if (is_null($category) || !array_key_exists($category, $properties)) {
pl_redirect('admin');
}
$data = $properties[$category];
if ($action == 'edit' || $action == 'add') {
$main_fields = array_merge(array($data['id']), $data['main_fields']);
$all_fields = array_merge($main_fields, $data['other_fields']);
if (is_null($id)) {
if (Post::has('new_id')) {
$id = Post::v('new_id');
} else {
pl_redirect('admin/geocoding/' . $category);
}
}
$list = array();
exec('isoquery --iso=' . $data['isocode'] . ' ' . $id, $list);
if (count($list) == 1) {
$array = explode("\t", $list[0]);
foreach ($main_fields as $i => $field) {
$iso[$field] = $array[$i];
}
} else {
$iso = array();
}
if ($action == 'add') {
if (Post::has('new_id')) {
S::assert_xsrf_token();
}
if (count($iso)) {
$item = $iso;
} else {
$item = array($data['id'] => $id);
}
XDB::execute('INSERT INTO ' . $data['table'] . '(' . implode(', ', array_keys($item)) . ')
VALUES ' . XDB::formatArray($item));
$page->trigSuccess($id . ' a bien été ajouté à la base.');
} elseif ($action == 'edit') {
if (Post::has('edit')) {
S::assert_xsrf_token();
$item = array();
$set = array();
foreach ($all_fields as $field) {
$item[$field] = Post::t($field);
$set[] = $field . XDB::format(' = {?}', $item[$field] ? $item[$field] : null);
}
XDB::execute('UPDATE ' . $data['table'] . '
SET ' . implode(', ', $set) . '
WHERE ' . $data['id'] . ' = {?}', $id);
call_user_func_array(array('self', 'update' . ucfirst($category)), array($item));
$page->trigSuccess($id . ' a bien été mis à jour.');
} elseif (Post::has('del')) {
S::assert_xsrf_token();
XDB::execute('DELETE FROM ' . $data['table'] . '
WHERE ' . $data['id'] . ' = {?}', $id);
$page->trigSuccessRedirect($id . ' a bien été supprimé.', 'admin/geocoding/' . $category);
} else {
$item = XDB::fetchOneAssoc('SELECT *
FROM ' . $data['table'] . '
WHERE ' . $data['id'] . ' = {?}', $id);
}
}
$page->changeTpl('admin/geocoding_edit.tpl');
$page->setTitle('Administration - ' . ucfirst($data['name']));
$page->assign('category', $category);
$page->assign('name', $data['name']);
$page->assign('all_fields', $all_fields);
$page->assign('id', $id);
$page->assign('iso', $iso);
$page->assign('item', $item);
return;
}
$page->changeTpl('admin/geocoding.tpl');
$page->setTitle('Administration - ' . ucfirst($data['name']));
$page->assign('category', $category);
$page->assign('name', $data['name']);
$page->assign('id', $data['id']);
$page->assign('main_fields', $data['main_fields']);
$page->assign('all_fields', array_merge($data['main_fields'], $data['other_fields']));
// First build the list provided by the iso codes.
$list = array();
exec('isoquery --iso=' . $data['isocode'], $list);
foreach ($list as $key => $item) {
$array = explode("\t", $item);
unset($list[$key]);
$list[$array[0]] = array();
foreach ($data['main_fields'] as $i => $field) {
$list[$array[0]][$field] = $array[$i + 1];
}
}
ksort($list);
// Retrieve all data from the database.
$db_list = XDB::rawFetchAllAssoc('SELECT *
FROM ' . $data['table'] . '
ORDER BY ' . $data['id'], $data['id']);
//.........这里部分代码省略.........
示例4: ON
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
require '../../bin/connect.db.inc.php';
$globals->debug = 0;
// Do not store backtraces
$res = XDB::rawFetchAllAssoc("SELECT p.pid, p.ax_id, p.hrpid,\n f.Nom_patronymique, f.Nom_usuel, f.Nom_complet,\n ppn.lastname_initial, ppn.lastname_main, ppn.lastname_marital, ppn.lastname_ordinary\n FROM fusionax_anciens AS f\n INNER JOIN profiles AS p ON (f.ax_id = p.ax_id)\n INNER JOIN profile_public_names AS ppn ON (p.pid = ppn.pid)\n WHERE IF(f.partic_patro, CONCAT(f.partic_patro, CONCAT(' ', f.Nom_patronymique)), f.Nom_patronymique) NOT IN (ppn.lastname_initial, ppn.lastname_main, ppn.lastname_marital, ppn.lastname_ordinary)\n OR IF(f.partic_nom, CONCAT(f.partic_nom, CONCAT(' ', f.Nom_usuel)), f.Nom_usuel) NOT IN (ppn.lastname_initial, ppn.lastname_main, ppn.lastname_marital, ppn.lastname_ordinary)\n OR f.Nom_complet NOT IN (ppn.lastname_initial, ppn.lastname_main, ppn.lastname_marital, ppn.lastname_ordinary)");
function fix_ax_particles($ax, $xorg, $item)
{
$count = 0;
foreach ($ax as $ax_key => $ax_name) {
if (!in_array($ax_name, $xorg)) {
$new_name = '';
foreach ($xorg as $xorg_key => $xorg_name) {
if ($xorg_name && strpos($xorg_name, $ax_name) !== false) {
if ($xorg_name == 'de ' . $ax_name) {
$new_name = 'de ' . $item[$ax_key];
} elseif ($xorg_name == "d'" . $ax_name) {
$new_name = "d'" . $item[$ax_key];
} elseif ($xorg_name == 'du ' . $ax_name) {
$new_name = 'du ' . $item[$ax_key];
}
示例5: handler_admin_member
//.........这里部分代码省略.........
update_alias_user($user->forlifeEmail(), $new_email);
}
$user = User::getWithUID($user->id());
}
if (XDB::affectedRows()) {
$page->trigSuccess('Données de l\'utilisateur mises à jour.');
}
if ($user->type == 'xnet' && !$user->perms) {
if (Post::b('suggest')) {
$request = new AccountReq(S::user(), $user->hruid, Post::t('email'), $globals->asso('nom'), $globals->asso('diminutif'));
$request->submit();
$page->trigSuccess('Le compte va bientôt être activé.');
}
if (Post::b('again')) {
$this->again($user->id());
$page->trigSuccess('Relance effectuée avec succès.');
}
}
// Update group params for user
$perms = Post::v('group_perms');
$comm = Post::t('comm');
$position = Post::t('group_position') == '' ? null : Post::v('group_position');
if ($user->group_perms != $perms || $user->group_comm != $comm || $user->group_position != $position) {
XDB::query('UPDATE group_members
SET perms = {?}, comm = {?}, position = {?}
WHERE uid = {?} AND asso_id = {?}', $perms == 'admin' ? 'admin' : 'membre', $comm, $position, $user->id(), $globals->asso('id'));
if (XDB::affectedRows()) {
if ($perms != $user->group_perms) {
$page->trigSuccess('Permissions modifiées !');
}
if ($comm != $user->group_comm) {
$page->trigSuccess('Commentaire mis à jour.');
}
if ($position != $user->group_position) {
$page->trigSuccess('Poste mis à jour.');
}
}
}
// Gets user info again as they might have change
$user = User::getSilent($user->id());
// Update ML subscriptions
foreach (Env::v('ml1', array()) as $ml => $state) {
$ask = empty($_REQUEST['ml2'][$ml]) ? 0 : 2;
if ($ask == $state) {
continue;
}
if ($state == '1') {
$page->trigWarning("{$user->fullName()} a " . "actuellement une demande d'inscription en " . "cours sur <strong>{$ml}@</strong> !!!");
} elseif ($ask) {
$mmlist->mass_subscribe($ml, array($user->forlifeEmail()));
$page->trigSuccess("{$user->fullName()} a été abonné à {$ml}@.");
} else {
$mmlist->mass_unsubscribe($ml, array($user->forlifeEmail()));
$page->trigSuccess("{$user->fullName()} a été désabonné de {$ml}@.");
}
}
// Change subscriptioin to aliases
foreach (Env::v('ml3', array()) as $ml => $state) {
require_once 'emails.inc.php';
$ask = !empty($_REQUEST['ml4'][$ml]);
list($local_part, ) = explode('@', $ml);
if ($ask == $state) {
continue;
}
if ($ask) {
add_to_list_alias($user->id(), $local_part, $globals->asso('mail_domain'));
$page->trigSuccess("{$user->fullName()} a été abonné à {$ml}.");
} else {
delete_from_list_alias($user->id(), $local_part, $globals->asso('mail_domain'));
$page->trigSuccess("{$user->fullName()} a été désabonné de {$ml}.");
}
}
if ($globals->asso('has_nl')) {
$nl = NewsLetter::forGroup($globals->asso('shortname'));
// Updates group's newsletter subscription.
if (Post::i('newsletter') == 1) {
$nl->subscribe($user);
} else {
$nl->unsubscribe(null, $user->id());
}
}
}
$res = XDB::rawFetchAllAssoc('SHOW COLUMNS FROM group_members LIKE \'position\'');
$positions = str_replace(array('enum(', ')', '\''), '', $res[0]['Type']);
if ($globals->asso('has_nl')) {
$nl = NewsLetter::forGroup($globals->asso('shortname'));
$nl_registered = $nl->subscriptionState($user);
} else {
$nl_registered = false;
}
$page->assign('user', $user);
$page->assign('suggest', $this->suggest($user));
$page->assign('listes', $mmlist->get_lists($user->forlifeEmail()));
$page->assign('alias', $user->emailGroupAliases($globals->asso('mail_domain')));
$page->assign('positions', explode(',', $positions));
$page->assign('nl_registered', $nl_registered);
$page->assign('pending_xnet_account', XDB::fetchOneCell('SELECT 1
FROM register_pending_xnet
WHERE uid = {?}', $user->id()));
}