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


PHP XDB::changeFlag方法代码示例

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


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

示例1: handler_notifs

 public function handler_notifs($page, $action = null, $arg = null)
 {
     $page->changeTpl('carnet/notifs.tpl');
     if ($action) {
         S::assert_xsrf_token();
         switch ($action) {
             case 'add_promo':
                 $this->addPromo($page, $arg);
                 break;
             case 'del_promo':
                 $this->delPromo($page, $arg);
                 break;
             case 'add_group':
                 $this->addGroup($page, $arg);
                 break;
             case 'del_group':
                 $this->delGroup($page, $arg);
                 break;
             case 'del_nonins':
                 $user = User::get($arg);
                 if ($user) {
                     $this->delNonRegistered($page, $user);
                 }
                 break;
             case 'add_nonins':
                 $user = User::get($arg);
                 if ($user) {
                     $this->addNonRegistered($page, $user);
                 }
                 break;
         }
     }
     if (Env::has('subs')) {
         S::assert_xsrf_token();
         $flags = new PlFlagSet();
         foreach (Env::v('sub') as $key => $value) {
             $flags->addFlag($key, $value);
         }
         XDB::execute('UPDATE  watch
                          SET  actions = {?}
                        WHERE  uid = {?}', $flags, S::i('uid'));
         S::user()->invalidWatchCache();
         Platal::session()->updateNbNotifs();
     }
     if (Env::has('flags_contacts')) {
         S::assert_xsrf_token();
         XDB::execute('UPDATE  watch
                          SET  ' . XDB::changeFlag('flags', 'contacts', Env::b('contacts')) . '
                        WHERE  uid = {?}', S::i('uid'));
         S::user()->invalidWatchCache();
         Platal::session()->updateNbNotifs();
     }
     if (Env::has('flags_mail')) {
         S::assert_xsrf_token();
         XDB::execute('UPDATE  watch
                          SET  ' . XDB::changeFlag('flags', 'mail', Env::b('mail')) . '
                        WHERE  uid = {?}', S::i('uid'));
         S::user()->invalidWatchCache();
         Platal::session()->updateNbNotifs();
     }
     $user = S::user();
     $nonins = new UserFilter(new UFC_WatchRegistration($user));
     $promo = XDB::fetchColumn('SELECT  promo
                                  FROM  watch_promo
                                 WHERE  uid = {?}
                              ORDER BY  promo', S::i('uid'));
     $page->assign('promo_count', count($promo));
     $ranges = array();
     $range_start = null;
     $range_end = null;
     foreach ($promo as $p) {
         if (is_null($range_start)) {
             $range_start = $range_end = $p;
         } else {
             if ($p != $range_end + 1) {
                 $ranges[] = array($range_start, $range_end);
                 $range_start = $range_end = $p;
             } else {
                 $range_end = $p;
             }
         }
     }
     $ranges[] = array($range_start, $range_end);
     $page->assign('promo_ranges', $ranges);
     $page->assign('nonins', $nonins->getUsers());
     $groups = XDB::fetchColumn('SELECT  g.nom
                                   FROM  watch_group AS w
                             INNER JOIN  groups      AS g ON (g.id = w.groupid)
                                  WHERE  w.uid = {?}
                               ORDER BY  g.nom', S::i('uid'));
     $page->assign('groups', $groups);
     $page->assign('groups_count', count($groups));
     list($flags, $actions) = XDB::fetchOneRow('SELECT  flags, actions
                                                  FROM  watch
                                                 WHERE  uid = {?}', S::i('uid'));
     $flags = new PlFlagSet($flags);
     $actions = new PlFlagSet($actions);
     $page->assign('flags', $flags);
     $page->assign('actions', $actions);
 }
开发者ID:Ekleog,项目名称:platal,代码行数:100,代码来源:carnet.php


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