コード例 #1
0
ファイル: match.php プロジェクト: errorcodexero/scouting
 public static function select($con, $id)
 {
     base::checkcon($con, __FUNCTION__);
     $sql = "select matches.*, alliances.* from alliances\n                INNER JOIN matches\n                ON (matches.ID = " . $id . " and \n                alliances.MatchID = " . $id . ")\n                order by alliances.Color";
     // print "$sql\n";
     $result = mysqli_query($con, $sql);
     if (!$result) {
         die('Error: ' . mysqli_error($con));
     }
     $row = mysqli_fetch_array($result);
     if (!$row) {
         return null;
     } else {
         $match = new match();
         $match->ID = $row['MatchID'];
         $match->Time = $row['Time'];
         $match->Number = $row['Number'];
         $match->Round = $row['Round'];
         $a1 = new alliance($row->Color == 'red');
         $a1->set($row);
         $row = mysqli_fetch_array($result);
         $a2 = new alliance($row->Color == 'red');
         $a2->set($row);
         if ($a1->Color == 'red') {
             $match->RedAlliance = $a1;
             $match->BlueAlliance = $a2;
         } else {
             $match->RedAlliance = $a2;
             $match->BlueAlliance = $a1;
         }
         mysqli_free_result($result);
         return $match;
     }
 }
コード例 #2
0
ファイル: alliance.php プロジェクト: errorcodexero/scouting
 public static function selectAlliance($con, $id)
 {
     if (!$con) {
         die('selectTeam error:  no connection.');
     }
     $query = "SELECT * FROM alliances where ID = " . $id;
     $result = mysqli_query($con, $query);
     $row = mysqli_fetch_assoc($result);
     if (!$row) {
         return null;
     } else {
         $a = new alliance();
         $a->set($alliance);
         return $a;
     }
 }
コード例 #3
0
ファイル: alliance.php プロジェクト: yunsite/devana-heroic
     break;
 case 'set':
     $nodes = node::getList($_SESSION[$shortTitle . 'User']['id']);
     $nodeList = '';
     foreach ($nodes as $node) {
         $nodeList .= '<option value="' . $node->data['id'] . '">' . $node->data['name'] . '</option>';
     }
     if ($status == 'done' && isset($_POST['nodeId'], $_POST['name'])) {
         if ($_POST['name'] != '') {
             if ($alliance->data['user'] == $_SESSION[$shortTitle . 'User']['id']) {
                 $node = new node();
                 $status = $node->get('id', $_POST['nodeId']);
                 if ($status == 'done') {
                     if ($node->data['user'] == $_SESSION[$shortTitle . 'User']['id']) {
                         $alliance->data['name'] = $_POST['name'];
                         $status = $alliance->set($node->data['id']);
                         $message = $ui[$status];
                     } else {
                         $message = $ui['accessDenied'];
                     }
                 } else {
                     $message = $ui[$status];
                 }
             } else {
                 $message = $ui['accessDenied'];
             }
         } else {
             $message = $ui['insufficientData'];
         }
     }
     break;
コード例 #4
0
 public function selectMatches($con)
 {
     base::checkcon($con, __FUNCTION__);
     $sql = "select matches.*, alliances.* from alliances\n                INNER JOIN matches\n                ON (matches.CompetitionID = " . $this->ID . " and \n                alliances.MatchID = matches.ID)\n                order by matches.Number, alliances.Color";
     // print $sql;
     $result = mysqli_query($con, $sql);
     if (!$result) {
         die('Error: ' . mysqli_error($con));
     }
     $matches = array();
     while ($row = mysqli_fetch_array($result)) {
         $match = new match();
         $match->Competition = this;
         $match->Time = $row['Time'];
         $match->Number = $row['Number'];
         $match->Round = $row['Round'];
         $match->ID = $row['MatchID'];
         $a1 = new alliance($row->Color == 'red');
         $a1->set($row);
         $row = mysqli_fetch_array($result);
         $a2 = new alliance($row->Color == 'red');
         $a2->set($row);
         if ($a1->Color == 'red') {
             $match->RedAlliance = $a1;
             $match->BlueAlliance = $a2;
         } else {
             $match->RedAlliance = $a2;
             $match->BlueAlliance = $a1;
         }
         array_push($matches, $match);
     }
     mysqli_free_result($result);
     return $matches;
 }