當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。