當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DBModel::inteam方法代碼示例

本文整理匯總了PHP中DBModel::inteam方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBModel::inteam方法的具體用法?PHP DBModel::inteam怎麽用?PHP DBModel::inteam使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DBModel的用法示例。


在下文中一共展示了DBModel::inteam方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: state

 /**
  * A handler of each state.
  * @param int state code
  */
 public function state($state)
 {
     eval(USER);
     $cm = new ContestModel();
     $contest = $cm->getCurrentContest();
     $contest = $contest[0];
     $qm = new QuizModel();
     $this->assign('contestname', $contest['name']);
     $this->assign('contest', $contest);
     $team = DBModel::getTeamDetail(DBModel::getTeamByUser(session('userid')));
     $states = DBModel::selectDB('cernet_statepage');
     $this->assign('statepage', $states[$state - 1]['html']);
     switch ($state) {
         case 1:
             // dump($qm);
             $this->assign('total', $qm->getTotalOnce());
             $this->assign('pass', $qm->getPass());
             break;
         case 2:
             $conf = array();
             $conf['user_id'] = session('userid');
             $conf['statecode'] = 0;
             $model = D('cernet_teammate');
             $invitations = $model->where($conf)->select();
             $list = array();
             foreach ($invitations as $invitation) {
                 array_push($list, DBModel::getFullInvitation($invitation));
             }
             $this->assign('list', $list);
             $this->assign('invitation', json_encode($invitations));
         case 3:
             // invitation
             $conf = array();
             $conf['user_id'] = session('userid');
             $conf['statecode'] = 0;
             $model = D('cernet_teammate');
             $invitations = $model->where($conf)->select();
             $teamsize = $cm->getTeamSize();
             $list = array();
             foreach ($invitations as $invitation) {
                 array_push($list, DBModel::getFullInvitation($invitation));
             }
             $this->assign('list', $list);
             $this->assign('invitation', json_encode($invitations));
             // inteam
             $this->assign('inteam', DBModel::inteam(session('userid')) ? 1 : '');
             // get the team
             $this->assign('teamname', $team['team']['name']);
             $this->assign('leadername', getNameById('cernet_user', $team['team']['leader']));
             $this->assign('isleader', DBModel::isLeader(session('userid')));
             $this->assign('teamsize', $teamsize);
             $contest = $cm->getCurrentContest();
             $contest = $contest[0];
             $model = D('cernet_user');
             $team_id = DBModel::getTeamByUser(session('userid'));
             $map['cernet_teammate.statecode'] = array(array('neq', 1), array('exp', 'is NULL'), 'OR');
             $map['cernet_teammate.team_id'] = array(array('neq', $team_id), array('exp', 'is NULL'), 'OR');
             $map['cernet_user.statecode'] = array(array('gt', 1), array('lt', 4));
             // $map['cernet_user.statecode'] = 3;
             $userlist = $model->join('LEFT JOIN cernet_teammate ON cernet_user.id = cernet_teammate.user_id')->where($map)->field('cernet_teammate.statecode,id,name')->select();
             $model = D('cernet_teammate');
             unset($map['cernet_teammate.statecode']);
             $map['cernet_teammate.team_id'] = $team_id;
             $map['cernet_user.id'] = array('NEQ', session('userid'));
             $candidate = $model->join('LEFT JOIN cernet_user ON cernet_user.id = cernet_teammate.user_id')->field('cernet_teammate.statecode,id,name')->where($map)->select();
             // dump($map);
             // dump($candidate);
             // die();
             $team = DBModel::getTeamDetail($team_id);
             $this->assign('banner', $cm->getBanner());
             $this->assign('team', $team);
             $this->assign('userlist', json_encode($userlist));
             $this->assign('candidate', json_encode($candidate));
             $this->assign('teamsize', $cm->getTeamSize());
             $this->assign('contest', $contest);
             $this->assign("less", "buildteam" . ".less");
             break;
         case 4:
             $this->assign('team', $team);
             $this->assign('mates', $team['teammate']);
             break;
         case 5:
             $team_id = DBModel::getTeamByUser(session('userid'));
             $teamdetail = DBModel::getTeamDetail($team_id)['team'];
             $post['post_time'] = $teamdetail['post_time'];
             $post['post_company'] = $teamdetail['post_company'];
             $post['post_id'] = $teamdetail['post_id'];
             $post['post_status'] = $teamdetail['post_status'];
             $this->assign('post', $post);
             $this->assign('team', $team['team']);
             break;
         case 6:
             break;
         case 8:
             $this->assign('prize', $team['team']['prize']);
             break;
//.........這裏部分代碼省略.........
開發者ID:sysuzjz,項目名稱:soya,代碼行數:101,代碼來源:UserAction.class.php

示例2: delete_user_

 public function delete_user_()
 {
     eval(ADMIN);
     try {
         $cond["id"] = xassert(safepost("id"), Error("get"));
         if ($cond["id"] != false && !DBModel::inteam($cond["id"])) {
             DBModel::deleteDB("cernet_user", $cond);
             DBModel::deleteDB("cernet_teammate", array("user_id" => $cond["id"]));
             echo "success";
         } else {
             throw new Exception("請先將該用戶從所在隊伍中清除後再刪除用戶。");
         }
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
開發者ID:sysuzjz,項目名稱:soya,代碼行數:16,代碼來源:AdminAction.class.php


注:本文中的DBModel::inteam方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。