public function recalculateTable() { $teamList = team::getAllTeams(); foreach ($teamList as $team) { $this->teams[$team->id]['name'] = $team->name; $this->teams[$team->id]['point'] = 0; $this->teams[$team->id]['played'] = 0; $this->teams[$team->id]['win'] = 0; $this->teams[$team->id]['draw'] = 0; $this->teams[$team->id]['loose'] = 0; $this->teams[$team->id]['average'] = 0; } $matches = match::getAllMatchs(); foreach ($matches as $match) { if ($match->score->firstTeam == null || $match->score->secondTeam == null) { continue; } $this->teams[$match->team1]['played']++; $this->teams[$match->team2]['played']++; if ($match->score->winner === 1) { $this->teams[$match->team1]['win']++; $this->teams[$match->team2]['loose']++; $this->teams[$match->team1]['point'] += 3; } else { if ($match->score->winner === 2) { $this->teams[$match->team1]['loose']++; $this->teams[$match->team2]['win']++; $this->teams[$match->team2]['point'] += 3; } else { $this->teams[$match->team1]['draw']++; $this->teams[$match->team2]['draw']++; $this->teams[$match->team1]['point']++; $this->teams[$match->team2]['point']++; } } $average = $match->score->firstTeam - $match->score->secondTeam; $this->teams[$match->team1]['average'] += $average; $this->teams[$match->team2]['average'] -= $average; } }
$topic_ids = trim(urldecode($this->input['topic_ids'])); $topics = $this->topic->topic_by_id($topic_ids, 1); $this->setXmlNode('topic_info', 'topic'); $this->addItem($topics); $this->output(); } /** * 获取单个话题的信息 */ public function detail() { if (isset($this->input['id'])) { $topic_id = intval($this->input['id']); } elseif (isset($this->input['topic_id'])) { $topic_id = intval($this->input['topic_id']); } else { $topic_id = -1; } if ($topic_id < 0) { $this->errorOutput(PARAM_WRONG); } $topic = $this->topic->detail($topic_id, 1); if ($topic['topic_id']) { //获取附件信息 $condition = 'topic_id = ' . $topic_id; $topic['material'] = $this->topic->get_material_info($condition, '');
/** * @return array */ public function load() { $request = new request(self::teams_steam_url, array('start_at_team_id' => $this->get_team_id(), 'teams_requested' => $this->get_teams_requested())); $teams_info = $request->send(); if (is_null($teams_info)) { return null; } $teams = array(); if (isset($teams_info->teams)) { $teams_info = (array) $teams_info->teams; $teams_info = $teams_info['team']; foreach ($teams_info as $team_info) { $team_info = (array) $team_info; $team = new team(); $fields = array_keys($team_info); foreach ($fields as $field) { // I hope, that API-response will be changed and players_ids, leagues_ids will become arrays if (preg_match('/^player_\\d+_account_id$/', $field)) { $team->add_player_id($team_info[$field]); continue; } if (preg_match('/^league_id_\\d+$/', $field)) { $team->add_league_id($team_info[$field]); continue; } $team->set($field, (string) $team_info[$field]); } $teams[$team->get('team_id')] = $team; } return $teams; } }
public function saveNewTeam() { Flight::auth()->check(20); $response = Flight::util()->validate('team', Flight::request()->data); if (is_array($response)) { Flight::util()->render('newTeam', array("error" => $response)); return; } $team = new team(Flight::request()->data); $last_id = $team->store(); Flight::redirect('/team/' . $last_id); }
function transfere_autores() { $tm = new team(); $proto_submit = $this->protocolo_submission; $protocol = $this->protocolo_cep; $sql = "select * from cep_submit_team where ct_protocol='" . $proto_submit . "' "; $rlt = db_query($sql); while ($line = db_read($rlt)) { $author = trim($line['ct_author']); $type = trim($line['ct_type']); $table = "cep_team"; $tm->team_insert_author($author, $protocol, $table, $type); } }
protected function showForm() { global $site; global $tmpl; // protected against cross site injection attempts $randomKeyName = 'teamReactivate_' . microtime(); // convert some special chars to underscores $randomKeyName = strtr($randomKeyName, array(' ' => '_', '.' => '_')); $randomkeyValue = $site->setKey($randomKeyName); $tmpl->assign('keyName', $randomKeyName); $tmpl->assign('keyValue', htmlent($randomkeyValue)); // display teams that can be reactivated $teamids = \team::getDeletedTeamIds(); $teamData = array(); foreach ($teamids as $teamid) { $teamData[] = array('id' => $teamid, 'name' => (new team($teamid))->getName()); } $tmpl->assign('teams', $teamData); // a team must always have a leader // display user choice to admin // get all teamless users $users = \user::getTeamlessUsers(); $userData = array(); foreach ($users as $user) { // a team should only be reactivated so it can play...no point of inactive, disabled or banned user if ($user->getStatus() === 'active') { $userData[] = array('id' => $user->getID(), 'name' => $user->getName()); } } $tmpl->assign('users', $userData); }
function displayMatches($offset = 0, $numRows = 200) { global $tmpl; global $db; $tmpl->setTemplate('MatchServicesMatchList'); // type specifications settype($offset, 'int'); settype($numRows, 'int'); // build match data query $query = 'SELECT * FROM `matches` ORDER BY `timestamp` DESC LIMIT '; $query .= (string) $offset; $query .= ', '; $query .= (string) $numRows; $matchData = $db->SQL($query); // log error if something went wrong if (!$matchData) { $db->logError(realpath(__FILE__) . ': displayMatches(): query failed (' . $query . ')'); die; } // FIXME: implement generic class loader somewhere else require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/classes/team.php'; $teamClass = new team(); // collect data to display from query result in database $tmplMatchData = array(array()); while ($row = $db->fetchRow($matchData)) { $id = (int) $row['id']; $tmplMatchData[$id]['id'] = $row['id']; $tmplMatchData[$id]['dateAndTime'] = $row['timestamp']; $tmplMatchData[$id]['team1Name'] = $teamClass->getName((int) $row['team1_id']); $tmplMatchData[$id]['team2Name'] = $teamClass->getName((int) $row['team2_id']); $tmplMatchData[$id]['team1ID'] = $row['team1_id']; $tmplMatchData[$id]['team2ID'] = $row['team2_id']; $tmplMatchData[$id]['team1Score'] = $row['team1_points']; $tmplMatchData[$id]['team2Score'] = $row['team2_points']; $tmplMatchData[$id]['lastModUserID'] = (int) $row['userid']; $tmplMatchData[$id]['lastModUserName'] = (new \user((int) $row['userid']))->getName(); } unset($tmplMatchData[0]); unset($id); // we are done here :) $tmpl->assign('matchData', $tmplMatchData); return; }
/** * Удаление фотографии. * * @param integer $id ID пользователя */ function DeletePhoto($id) { session_start(); $objResponse = new xajaxResponse(); if (hasPermissions('users')) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/team.php'; team::DeletePhoto($id); $objResponse->assign('peoplephoto_' . $id, 'src', '/images/team_no_foto.gif'); $objResponse->assign('pt_photo_file', 'style.display', 'none'); } return $objResponse; }
/** * test grabbing a TeamStatistic that does not exist **/ public function testGetInvalidTeamStatistic() { // count the number of rows and save it for later $numRows = $this->getConnection()->getRowCount("teamStatistic"); // create a new TeamStatistics and insert to into mySQL $teamStatistic = new TeamStatistic($this->game->getGameId(), $this->team->getTeamId(), $this->statistic->getStatisticId(), $this->VALID_TEAMSTATISTICVALUE); $teamStatistic->insert($this->getPDO()); // grab the data from mySQL and enforce the fields match our expectations $results = TeamStatistic::getAllTeamStatistics($this->getPDO()); $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("teamStatistic")); $this->assertCount(1, $results); $this->assertContainsOnlyInstancesOf("Edu\\Cnm\\Sprots\\TeamStatistic", $results); // grab the result from the array and validate it $pdoTeamStatistic = $results[0]; $this->assertEquals($pdoTeamStatistic->getTeamStatisticGameId(), $this->game->getGameId()); $this->assertEquals($pdoTeamStatistic->getTeamStatisticTeamId(), $this->team->getTeamId()); $this->assertEquals($pdoTeamStatistic->getTeamStatisticStatisticId(), $this->statistic->getStatisticId()); $this->assertEquals($pdoTeamStatistic->getTeamStatisticValue(), $this->VALID_TEAMSTATISTICVALUE); }
function addTeams($con, $comp, $teams) { $current = array(); foreach ($comp->selectTeams($con) as $team) { array_push($current, $team->Number); // printf("%s %s %s %s %s\n", // $team->Number, $team->Name, $team->City, $team->State, $team->Country); } foreach ($teams as $team) { if (!in_array($team->Number, $current)) { printf("Adding %s to %s\n", $team->Number, $comp->Name); $st = team::selectTeam($con, $team->Number); if (!$st) { printf("New team: {$team->Number}, {$team->Name}, {$team->City}, {$team->State}, {$team->Country}\n"); team::insertTeam($con, (array) $team); } $comp->insertTeam($con, $team->Number); } else { printf("Team %s to already added.\n", $team->Number); } } }
/** * Обработчик событий страницы /about/team/ (Команда) * */ function teamAction() { $DB = new DB('master'); require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/team.php"; $action = $_POST['action']; switch ($action) { case 'updatecategory': if (!get_uid(false)) { header("Location: /fbd.php"); exit; } if (!hasPermissions('about')) { header("Location: /about/team"); exit; } $id = front::$_req['ecf_id']; $name = stripslashes(front::$_req['ecf_name']); $position = front::$_req['ecf_number']; $error = 0; if (empty($name)) { $error = 1; $error_msgs[1] = 'Поле "Название" заполнено некорректно'; } if (!is_numeric($position)) { $error = 1; $error_msgs[2] = 'Поле "Порядок" заполнено некорректно'; } else { $position = (int) $position; if ($position <= 0) { $error = 1; $error_msgs[2] = 'Поле "Порядок" заполнено некорректно'; } } $name = change_q($name); if ($error) { front::og("tpl")->error_msgs_ecf = $error_msgs; front::og("tpl")->ecf_name = $name; front::og("tpl")->ecf_position = $position; front::og("tpl")->ecf_id = $id; } else { team::EditGroup($id, $name, $position); header('Location: /about/team/'); exit; } break; case 'addpeople': if (!get_uid(false)) { header("Location: /fbd.php"); exit; } if (!hasPermissions('about')) { header("Location: /about/team"); exit; } $p_name = stripslashes(front::$_req['pt_name']); $p_login = stripslashes(front::$_req['pt_login']); $p_occupation = stripslashes(front::$_req['pt_occupation']); $p_position = stripslashes(front::$_req['pt_position']); $p_group = stripslashes(front::$_req['pt_group']); $p_info = stripslashes(front::$_req['pt_info']); $p_foto = $_FILES['pt_photo']; $error = 0; if (empty($p_name)) { $error = 1; $error_msgs[1] = 'Поле "Имя, фамилия" заполнено некорректно'; } if (empty($p_occupation)) { $error = 1; $error_msgs[2] = 'Поле "Должность" заполнено некорректно'; } if (!is_numeric($p_position) && $p_position != '') { $error = 1; $error_msgs[3] = 'Поле "Порядок" заполнено некорректно'; } else { $p_position = (int) $p_position; } if (!empty($p_login)) { require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php"; $u = new users(); if (!$u->GetUid($ee, $p_login)) { $error = 1; $error_msgs[4] = 'Поле "Логин" заполнено некорректно'; } } $p_name = change_q($p_name); $p_login = change_q($p_login); $p_occupation = change_q($p_occupation); $p_info = change_q($p_info); $p_name = addslashes($p_name); $p_occupation = addslashes($p_occupation); $p_info = addslashes($p_info); $p_foto = ''; if (!empty($_FILES['pt_photo']['tmp_name'])) { list($i_width, $i_height, $i_type) = @getimagesize($_FILES['pt_photo']['tmp_name']); if (in_array($i_type, array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)) && $i_width == 150 && $i_height == 200) { $p_userpic = new CFile($_FILES['pt_photo']); if ($p_userpic->name) { $e = team::UpdateFoto($p_userpic); if ($e['error'] == '1') { $error = 1; $error_msgs[5] = 'Файл не удовлетворяет условиям загрузки'; $p_foto = $e['foto']; } else { $p_foto = $e['foto']; $error_msgs[5] = 'Файл не удовлетворяет условиям загрузки'; } } } else { $error = 1; $error_msgs[5] = 'Файл не удовлетворяет условиям загрузки'; } } if ($error) { if ($p_foto != '') { $p_userpic->Delete(0, 'team/' . $p_foto); } front::og("tpl")->error_msgs_apf = $error_msgs; front::og("tpl")->p_name = $p_name; front::og("tpl")->p_login = $p_login; front::og("tpl")->p_occupation = $p_occupation; front::og("tpl")->p_group = $p_group; front::og("tpl")->p_position = $p_position; front::og("tpl")->p_info = $p_info; } else { if ($p_position <= 0) { $max_position = front::og("db")->select("SELECT MAX(position) as position FROM team_people WHERE groupid = ?;", $p_group)->fetchOne(); $p_position = $max_position['position'] + 1; } team::AddUser($p_name, $p_login, $p_occupation, $p_foto, $p_group, $p_position, $p_info); header('Location: /about/team/'); exit; } break; case 'updatepeople': if (!get_uid(false)) { header("Location: /fbd.php"); exit; } if (!hasPermissions('about')) { header("Location: /about/team"); exit; } $p_id = stripslashes(front::$_req['pt_id']); $p_name = stripslashes(front::$_req['pt_name']); $p_login = stripslashes(front::$_req['pt_login']); $p_occupation = stripslashes(front::$_req['pt_occupation']); $p_position = stripslashes(front::$_req['pt_position']); $p_group = stripslashes(front::$_req['pt_group']); $p_info = stripslashes(front::$_req['pt_info']); $p_foto = $_FILES['pt_photo']; $error = 0; if (empty($p_name)) { $error = 1; $error_msgs[1] = 'Поле "Имя, фамилия" заполнено некорректно'; } if (empty($p_occupation)) { $error = 1; $error_msgs[2] = 'Поле "Должность" заполнено некорректно'; } if (!is_numeric($p_position)) { $error = 1; $error_msgs[3] = 'Поле "Порядок" заполнено некорректно'; } else { $p_position = (int) $p_position; if ($p_position <= 0) { $error = 1; $error_msgs[3] = 'Поле "Порядок" заполнено некорректно'; } } if (!empty($p_login)) { require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php"; $u = new users(); if (!$u->GetUid($ee, $p_login)) { $error = 1; $error_msgs[4] = 'Поле "Логин" заполнено некорректно'; } } $p_name = change_q($p_name); $p_login = change_q($p_login); $p_occupation = change_q($p_occupation); $p_info = change_q($p_info); $p_name = addslashes($p_name); $p_occupation = addslashes($p_occupation); $p_info = addslashes($p_info); $p_foto = ''; if (!empty($_FILES['pt_photo']['tmp_name'])) { list($i_width, $i_height, $i_type) = @getimagesize($_FILES['pt_photo']['tmp_name']); if (in_array($i_type, array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)) && $i_width == 150 && $i_height == 200) { $p_userpic = new CFile($_FILES['pt_photo']); if ($p_userpic->name) { $e = team::UpdateFoto($p_userpic); if ($e['error'] == '1') { $error = 1; $error_msgs[5] = 'Файл не удовлетворяет условиям загрузки'; $p_foto = $e['foto']; } else { $p_foto = $e['foto']; $error_msgs[5] = 'Файл не удовлетворяет условиям загрузки'; } } } else { $error = 1; $error_msgs[5] = 'Файл не удовлетворяет условиям загрузки'; } } if ($error) { if ($p_foto != '') { $p_userpic->Delete(0, 'team/' . $p_foto); } front::og("tpl")->error_msgs_apf = $error_msgs; front::og("tpl")->p_name = $p_name; front::og("tpl")->p_login = $p_login; front::og("tpl")->p_occupation = $p_occupation; front::og("tpl")->p_group = $p_group; front::og("tpl")->p_position = $p_position; front::og("tpl")->p_info = $p_info; front::og("tpl")->p_id = $p_id; front::og("tpl")->p_action = 'updatepeople'; } else { team::EditUser($p_id, $p_name, $p_login, $p_occupation, $p_foto, $p_group, $p_position, $p_info); header('Location: /about/team/'); exit; } break; case 'insertcategory': if (!get_uid(false)) { header("Location: /fbd.php"); exit; } if (!hasPermissions('about')) { header("Location: /about/team"); exit; } $name = stripslashes(front::$_req['acf_name']); $position = front::$_req['acf_number']; $error = 0; if (empty($name)) { $error = 1; $error_msgs[1] = 'Поле "Название" заполнено некорректно'; } if (!is_numeric($position)) { $error = 1; $error_msgs[2] = 'Поле "Порядок" заполнено некорректно'; } else { $position = (int) $position; if ($position <= 0) { $error = 1; $error_msgs[2] = 'Поле "Порядок" заполнено некорректно'; } } $name = change_q($name); if ($error) { front::og("tpl")->error_msgs_acf = $error_msgs; front::og("tpl")->acf_name = $name; front::og("tpl")->acf_position = $position; front::og("tpl")->acf_id = $id; } else { team::CreateGroup($name, $position); header('Location: /about/team/'); exit; } break; case 'deletecategory': if (hasPermissions('about')) { team::DeleteGroup(front::$_req['dcf_id']); } header('Location: /about/team/'); exit; break; case 'deleteteampeople': if (hasPermissions('about')) { team::DeleteUser(front::$_req['dtf_id']); } header('Location: /about/team/'); exit; break; } // Берем команду для вывода front::og("tpl")->groups = team::GetAllGroups(); foreach (front::og("tpl")->groups as $group) { $sql = "SELECT team_people.*, team_groups.id as groups_id,team_groups.title as groups_title, team_groups.position as groups_position FROM team_people LEFT JOIN team_groups ON team_groups.id = team_people.groupid WHERE team_people.groupid=?i ORDER BY team_groups.position, team_people.position, team_people.id ASC"; $team = $DB->rows($sql, $group['id']); front::og("tpl")->team_people[$group['id']] = array(); if ($team) { foreach ($team as $t) { array_push(front::og("tpl")->team_people[$group['id']], $t); } } } front::og("tpl")->text = static_pages::get("about_team"); front::og("tpl")->script = array('team.js'); front::og("tpl")->display("about/about_team.tpl"); }
public static function getTeamJSON($gameId, $round, $roundServer) { $list = []; $req = SPDO::getInstance()->prepare('SELECT teamId, profileStr, lifePoint, roundDead FROM teamingame WHERE gameId = :gameId'); $req->execute(array('gameId' => $gameId)); while ($team = $req->fetch()) { $list['teamIdToLifePoint'][$team['teamId']] = intval($team['lifePoint']); $list['teamIdToRoundDead'][$team['teamId']] = intval($team['roundDead']); $list['teamIdToActions'][$team['teamId']] = team::getTeamActionsJSON($gameId, $team['teamId'], $round, $roundServer); } return $list; }
<?php include "modules/tournament2/class_team.php"; $tteam = new team(); $tournamentid = $_GET["tournamentid"]; $tournament = $db->qry_first("SELECT name, teamplayer, over18, status, groupid, coins, wwcl_gameid, ngl_gamename, lgz_gamename, maxteams FROM %prefix%tournament_tournaments WHERE tournamentid = %int%", $tournamentid); if ($auth["userid"] == "") { $auth["userid"] = 0; } $user = $db->qry_first("SELECT wwclid, wwclclanid, nglid, nglclanid, lgzid, lgzclanid FROM %prefix%user WHERE userid = %int%", $auth["userid"]); if ($tteam->SignonCheck($tournamentid)) { switch ($_GET["step"]) { case 3: if (!$sec->locked("t_join")) { $error = array(); // If joining an existing team if ($_POST['existing_team_name'] != "" and $tournament['teamplayer'] > 1) { $success = $tteam->join($_POST["existing_team_name"], $auth["userid"], $_POST["password"]); // If creating a new team } else { if ($tournament['teamplayer'] == 1) { $_POST['team_name'] = ""; } if ($_POST["set_password"] and $_POST["set_password"] != $_POST["set_password2"]) { $error["set_password2"] = t('Die Passworteingaben stimmen nicht überein'); } if ($_POST['team_name'] == "" and $tournament['teamplayer'] > 1) { $error["team_name"] = t('Bitte gib einen Teamnamen ein, oder wähle ein vorhandenes Team aus'); } if (count($error) == 0) { $success = $tteam->create($_GET["tournamentid"], $auth["userid"], $_POST['team_name'], $_POST["set_password"], $_POST['team_comment'], "team_banner");
<?php require_once "inc/initialize.php"; include 'inc/admin_validate.php'; include "inc/header.php"; include 'inc/admin_validate.php'; $user_id = $_GET['user_id']; $user = user::find_by_id($user_id); $sql = "select * from users as us inner join team_user as ut on us.user_id = ut.user_id inner join team te on ut.team_id=te.team_id where us.user_id='{$user_id}'"; $teams = team::find_by_sql($sql); ?> <div class="well"> <h2><?php echo $user->full_name(); ?> is a member of the following teams:</h2> <?php foreach ($teams as $team) { echo "<h3>" . $team->team_name . "</h3>"; // count how many teams the user is a member of, if @++$i; } ?> <button type='button' onclick='deactivate_user(<?php echo $user_id; ?> , <?php echo $team->team_type; ?> )'>Deactivate User</button> </div>
public function showTeam($teamid) { global $tmpl; global $db; $team = new team($teamid); if (!$team->exists()) { $tmpl->setTemplate('NoPerm'); return; } if (!$tmpl->setTemplate('teamSystemProfile')) { $tmpl->noTemplateFound(); die; } // FIXME: implement something to avoid hardcoded paths $tmpl->assign('pmLink', '../PM/?add&teamid=' . $teamid); $tmpl->assign('status', $team->getStatus()); $tmpl->assign('title', 'Team ' . htmlent($team->getName())); // the team's leader $teamLeader = $team->getLeaderId(); $teamData = array(); $teamData['profileLink'] = './?profile=' . $team->getID(); $teamData['name'] = $team->getName(); $teamData['score'] = $team->getScore(); $teamData['scoreClass'] = $this->rankScore($teamData['score']); $teamData['matchSearchLink'] = '../Matches/?search_string=' . $teamData['name'] . '&search_type=team+name' . '&search_result_amount=200' . '&search=Search'; $teamData['matchCount'] = $team->getMatchCount(); $teamData['memberCount'] = $team->getMemberCount(); $teamData['leaderLink'] = '../Players/?profile=' . $team->getLeaderId(); $teamData['leaderName'] = (new \user($team->getLeaderId()))->getName(); $teamData['activityNew'] = $team->getActivityNew(); $teamData['activityOld'] = $team->getActivityOld(); $teamData['created'] = $team->getCreationTimestampStr(); $teamData['wins'] = $team->getMatchCount('won'); $teamData['draws'] = $team->getMatchCount('draw'); $teamData['losses'] = $team->getMatchCount('lost'); $teamData['logo'] = $team->getAvatarURI(); $tmpl->assign('teamDescription', $team->getDescription()); $tmpl->assign('team', $teamData); $tmpl->assign('teamid', $teamid); $tmpl->assign('canPMTeam', \user::getCurrentUserLoggedIn() && \user::getCurrentUserId() > 0 ? true : false); // tell template if user can edit this team $tmpl->assign('canEditTeam', \user::getCurrentUserLoggedIn() && \user::getCurrentUserId() === $teamLeader || \user::getCurrentUser()->getPermission('allow_edit_any_team_profile')); // tell template if user can delete this team // either user has deletion permission for team // or user is leader of team and there are one or less members in team $tmpl->assign('canDeleteTeam', $team->getStatus() !== 'deleted' && (\user::getCurrentUser()->getPermission('team.allowDelete ' . $team->getID()) || \user::getCurrentUser()->getPermission('allow_delete_any_team') || \user::getCurrentUserId() === $team->getLeaderId())); $showMemberActionOptions = false; if (\user::getCurrentUserId() === $teamLeader || \user::getCurrentUser()->getPermission('allow_kick_any_team_members')) { $showMemberActionOptions = true; } $members = array(); $memberids = $team->getUserIds(); foreach ($memberids as $memberid) { $user = new \user($memberid); $member = array(); // rename db result fields and assemble some additional informations // use a temporary array for better readable (but slower) code if (!$showMemberActionOptions && \user::getCurrentUserId() === $memberid) { $showMemberActionOptions = true; } $member['profileLink'] = '../Players/?profile=' . $user->getID(); $member['userName'] = $user->getName(); $member['permissions'] = $teamLeader === $memberid ? 'Leader' : 'Standard'; if ($country = $user->getCountry()) { $member['countryName'] = $country->getName(); if (strlen($country->getFlag()) > 0) { $member['countryFlag'] = $country->getFlag(); } } $member['joined'] = $user->getJoinTimestampStr(); $member['last_login'] = $user->getLastLoginTimestampStr(); // show leave/kick links if permission is given // a team leader can neither leave or be kicked // a leader must first give someone else leadership to leave if ((\user::getCurrentUserId() === $teamLeader || \user::getCurrentUser()->getPermission('allow_kick_any_team_members') || \user::getCurrentUserId() === $user->getID()) && $user->getID() !== $teamLeader) { $member['removeLink'] = './?remove=' . $user->getID() . '&team=' . $teamid; if (\user::getCurrentUserId() === $user->getID()) { $member['removeDescription'] = 'Leave team'; } else { $member['removeDescription'] = 'Kick member from team'; } } // append current member data $members[] = $member; unset($user); } $tmpl->assign('members', $members); $tmpl->assign('showMemberActionOptions', $showMemberActionOptions); // show last entered matches $matches = array(); // show available options if any available $allowEdit = \user::getCurrentUser()->getPermission('allow_edit_match'); $allowDelete = \user::getCurrentUser()->getPermission('allow_delete_match'); $tmpl->assign('showMatchActionOptions', $allowEdit || $allowDelete); $tmpl->assign('allowEdit', $allowEdit); $tmpl->assign('allowDelete', $allowDelete); // get match data // sort the data by id to find out if abusers entered a match at a long time in the past $query = $db->prepare('SELECT `timestamp`,`team1_id`,`team2_id`,' . '(SELECT `name` FROM `teams` WHERE `id`=`team1_id`) AS `team1_name`' . ',(SELECT `name` FROM `teams` WHERE `id`=`team2_id`) AS `team2_name`' . ',`team1_points`,`team2_points`,`userid`' . ',(SELECT `users`.`name` FROM `users`' . ' WHERE `users`.`id`=`matches`.`userid`)' . ' AS `username`' . ',`matches`.`id`' . ' FROM `matches` WHERE `matches`.`team1_id`=?' . ' OR `matches`.`team2_id`=?' . ' ORDER BY `id` DESC LIMIT 0,10'); $db->execute($query, array($teamid, $teamid)); while ($row = $db->fetchRow($query)) { // rename db result fields and assemble some additional informations // use a temporary array for better readable (but slower) code $prepared = array(); $prepared['time'] = $row['timestamp']; $prepared['team1Link'] = '../Teams/?profile=' . $row['team1_id']; $prepared['team2Link'] = '../Teams/?profile=' . $row['team2_id']; $prepared['team1Name'] = $row['team1_name']; $prepared['team2Name'] = $row['team2_name']; $prepared['score1'] = $row['team1_points']; $prepared['score2'] = $row['team2_points']; $prepared['lastModById'] = $row['userid']; $prepared['lastModByName'] = $row['username']; $prepared['lastModByLink'] = '../Players/?profile=' . $prepared['lastModById']; if ($allowEdit) { $prepared['editLink'] = '../Matches/?edit=' . $row['id']; } if ($allowDelete) { $prepared['deleteLink'] = '../Matches/?delete=' . $row['id']; } $matches[] = $prepared; } $tmpl->assign('matches', $matches); // invitation data visible // for team members // for users who can issue any invitation if (\user::getCurrentUser()->getMemberOfTeam($teamid) || \user::getCurrentUser()->getPermission('allow_invite_in_any_team')) { $invitationData = array(); $invitations = invitation::getInvitationsForTeam($teamid); foreach ($invitations as $invitation) { $invitationUser = $invitation->getUsers()[0]; $invitationData[] = array('userName' => $invitationUser->getName(), 'profileLink' => '../Players/?profile=' . $invitationUser->getID(), 'expiration' => $invitation->getExpiration()); } $tmpl->assign('invitations', $invitationData); } }
class team { public $arr = array(); public function add($arr) { if (in_array($arr, $this->arr)) { return true; } $this->arr[] = $arr; } public function remove($arr) { $this->arr = array_diff($this->arr, array($arr)); } } $team = new team(); $team->add('c'); $team->add('b'); $team->add('a'); $team->remove('b'); //var_dump($team->arr); //装饰者 abstract class Beverage { public $_name; public abstract function cost(); } //被装饰者 class Coffee extends Beverage { public function __construct()
echo $assessment->slo_text; ?> </a></td> </tr> <?php } } ?> </table> </div> <div class="well"> <h2>Administrative Units</h2> <table border="1"> <?php $teams = team::find_by_sql($inst_team_sql); foreach ($teams as $team) { $i = 0; echo "<tr><th colspan='4'><h3>" . $team->team_name . "</h3></th></tr>"; ?> <tr><td width="200"><h4>Creator</h4></td><td width="700"><h4>Expected Outcome</h4></td></tr> <?php $team_id = $team->team_id; $assessments = assessment::find_by_sql("select * from assessment, team_user join users on team_user.user_id=users.user_id where assessment.user_id=users.user_id AND assessment_period='2015' AND submitted='1' AND team_user.team_id='{$team_id}'"); foreach ($assessments as $assessment) { ?> <tr> <td><?php echo $assessment->user_fname . " " . $assessment->user_lname; ?>
public function delete($cid, $source) { $info = array('cid' => $cid, 'source' => $source); if (empty($info['cid']) && $info['source']) { return false; } $sql = "DELETE FROM " . DB_PREFIX . "visit WHERE cid IN(" . $info['cid'] . ") AND source='" . $info['source'] . "'"; $this->db->query($sql); $sql = "DELETE FROM " . DB_PREFIX . "visit_queue WHERE cid IN(" . $info['cid'] . ") AND source='" . $info['source'] . "'"; $this->db->query($sql); switch ($info['source']) { case 'user': include_once ROOT_PATH . 'lib/class/member.class.php'; $obj_member = new member(); $obj_member->add_visit($info['cid'], -1); break; case 'action': include_once ROOT_PATH . 'lib/class/activity.class.php'; $obj_activity = new activityCLass(); $obj_activity->updateAddData(array('scan_num' => -1, 'action_id' => $info['cid'])); break; case 'team': include_once ROOT_PATH . 'lib/class/team.class.php'; $obj_team = new team(); $obj_team->update_total(array('visit_num' => -1, 'team_id' => $info['cid'])); break; case 'topic': include_once ROOT_PATH . 'lib/class/team.class.php'; $obj_team = new team(); $obj_team->update_topic_views(array('view_num' => -1, 'topic_id' => $info['cid'])); break; default: break; } return true; }
protected function maintainReactivatedTeams() { // permanently delete new teams which did not match in last 2 months $two_months_in_past = strtotime('-2 months'); $two_months_in_past = strftime('%Y-%m-%d %H:%M:%S', $two_months_in_past); $teamIds = team::getNewTeamIds(); foreach ($teamIds as $teamid) { $team = new team($teamid); if (($lastMatch = $team->getNewestMatchTimestamp()) && $lastMatch < $two_months_in_past) { $uids = $team->getUserIds(); foreach ($uids as $userid) { $user = new user($userid); $user->removeTeamMembership($teamid); $user->update(); } $team->delete(); } } }
<?php // to get the name of team include "classes/team.class.php"; $oTeam = new team(); $oTeam->teamid = $_GET['teamid']; ?> <div style="margin-left:10px;" class="page-title"><?php $oTeam->teamName(); ?> </div> <?php // to get the league name include "classes/league.class.php"; $oLeague = new league(); $oLeague->leagueid = $_GET['leagueid']; ?> <div style="margin-left:10px;" class="small-page-title"><?php $oLeague->leagueName(); ?> </div> <div class="container-fluid"> <ul class="nav nav-tabs"> <li class="active"><a href="#squad">Squad Info</a></li> <li><a href="#league">League Info</a></li> </ul> <div class="tab-content"> <div id="squad" class="tab-pane fade in active"> <div class="col-xs-8">
<?php require_once "inc/initialize.php"; include "inc/header.php"; include 'inc/validate.php'; $assessment_id = $_GET['id']; $assessment = assessment::find_by_id($assessment_id); $team = team::find_by_id($assessment->team_id); $goal = goal::find_by_id($assessment->goals_id); $user = user::find_by_id($assessment->user_id); $team_type = $team->team_type; if ($team_type == 0) { $slo = slo::find_by_id($assessment->slo_id); } ?> <div class="well"> <h1>Submitted Assessment : Date <?php echo $assessment->submit_date; ?> </h1> <h3 style="color: #004990;"> Unit: <?php echo $team->team_name; ?> </h3> <h3 style="color: #004990;">Name : <?php echo $user->full_name(); ?> </h3> <br> <button type="button" onclick="location.href='print_form.php?id=<?php echo $assessment_id;
public function show($cond) { $sql = "SELECT * FROM " . DB_PREFIX . "recommend WHERE 1 " . $cond; $q = $this->db->query($sql); $info = array(); $id_array = array(); while ($row = $this->db->fetch_array($q)) { $id_array[$row['source']][] = $row['cid']; $info[] = $row; } // hg_pre($id_array); $user = array(); if (!empty($id_array['user'])) { include_once ROOT_PATH . 'lib/class/member.class.php'; $obj_member = new member(); $data = $obj_member->getMemberById(implode(',', $id_array['user'])); $user = $data[0]; // hg_pre($user); } $action = array(); if (!empty($id_array['action'])) { include_once ROOT_PATH . 'lib/class/activity.class.php'; $obj_activity = new activityCLass(); $data = $obj_activity->show(implode(',', $id_array['action'])); $action = $data['data']; $team_id = $space = ''; foreach ($action as $k => $v) { $team_id .= $space . $v['team_id']; $space = ','; } if ($team_id) { include_once ROOT_PATH . 'lib/class/team.class.php'; $obj_team = new team(); $team_tmp = $obj_team->get_team_by_id($team_id); $team_tmp = $team_tmp[0]; foreach ($action as $k => $v) { $action[$k]['team_name'] = $team_tmp[$v['team_id']]['team_name']; } } } $team = array(); if (!empty($id_array['team'])) { include_once ROOT_PATH . 'lib/class/team.class.php'; $obj_team = new team(); $data = $obj_team->get_team_by_id(implode(',', $id_array['team'])); $team = $data[0]; } $topic = array(); if (!empty($id_array['topic'])) { include_once ROOT_PATH . 'lib/class/team.class.php'; $obj_team = new team(); $data = $obj_team->get_topic_by_id(implode(',', $id_array['topic'])); $topic = $data[0]; } $sql = "SELECT * FROM " . DB_PREFIX . "column WHERE 1"; $q = $this->db->query($sql); $column = array(); while ($row = $this->db->fetch_array($q)) { $column[$row['id']] = $row['name']; } $ret = array(); foreach ($info as $k => $v) { $tmp = ${$v}['source']; $ret[$k] = array('id' => $v['id'], 'cid' => $v['cid'], 'title' => $v['title'], 'source' => $v['source'], 'column_id' => $column[$v['column_id']], 'pubtime' => $v['pubtime'], 'data' => $tmp[$v['cid']]); } return $ret; }
public function import() { $source = $this->input["source"] ? trim($this->input["source"]) : 'user'; switch ($source) { case 'user': require_once ROOT_PATH . 'lib/class/member.class.php'; $obj_member = new member(); $ret = $obj_member->show(-1); if (!empty($ret)) { $sql = "DELETE FROM " . DB_PREFIX . "search_queue WHERE source='" . $source . "'"; $this->db->query($sql); $sql = "INSERT IGNORE INTO " . DB_PREFIX . "search_queue(cid,source,state) VALUES"; $space = ""; foreach ($ret as $v) { $sql .= $space . "(" . $v['id'] . ",'" . $source . "',0)"; $space = ','; } $this->db->query($sql); echo "用户完成插入队列"; } else { echo "暂无用户数据"; } break; case 'team': require_once ROOT_PATH . 'lib/class/team.class.php'; $obj_team = new team(); $ret = $obj_team->show(-1); if (!empty($ret)) { $sql = "DELETE FROM " . DB_PREFIX . "search_queue WHERE source='" . $source . "'"; $this->db->query($sql); $sql = "INSERT IGNORE INTO " . DB_PREFIX . "search_queue(cid,source,state) VALUES"; $space = ""; foreach ($ret as $v) { $sql .= $space . "(" . $v['team_id'] . ",'" . $source . "',0)"; $space = ','; } $this->db->query($sql); echo "小组完成插入队列"; } else { echo "暂无小组数据"; } break; case 'action': require_once ROOT_PATH . 'lib/class/activity.class.php'; $obj_activity = new activityCLass(); $ret_tmp = $obj_activity->show_all(); $ret = $ret_tmp['data']; if (!empty($ret)) { $sql = "DELETE FROM " . DB_PREFIX . "search_queue WHERE source='" . $source . "'"; $this->db->query($sql); $sql = "INSERT IGNORE INTO " . DB_PREFIX . "search_queue(cid,source,state) VALUES"; $space = ""; foreach ($ret as $v) { $sql .= $space . "(" . $v['action_id'] . ",'" . $source . "',0)"; $space = ','; } $this->db->query($sql); echo "行动完成插入队列"; } else { echo "暂无行动数据"; } break; case 'topic': require_once ROOT_PATH . 'lib/class/team.class.php'; $obj_team = new team(); $ret = $obj_team->show_topic(-1); if (!empty($ret)) { $sql = "DELETE FROM " . DB_PREFIX . "search_queue WHERE source='" . $source . "'"; $this->db->query($sql); $sql = "INSERT IGNORE INTO " . DB_PREFIX . "search_queue(cid,source,state) VALUES"; $space = ""; foreach ($ret as $v) { $sql .= $space . "(" . $v['topic_id'] . ",'" . $source . "',0)"; $space = ','; } $this->db->query($sql); echo "讨论完成插入队列"; } else { echo "暂无讨论数据"; } break; default: break; } }
require "db.php"; require $include . 'sisdoc_colunas.php'; require $include . 'sisdoc_email.php'; require "_class/_class_message.php"; $file = 'messages/msg_' . $LANG . '.php'; if (file_exists($file)) { require $file; } else { echo 'message not found ' . $file; } $LANG = $lg->language_read(); $edit_mode = round($_SESSION['editmode']); $tabela = 'cep_team'; $pag_id = $dd[11]; require "_class/_class_team.php"; $tm = new team(); $tm->protocol = $pag_id; if ($dd[10] == 'con') { $id = $dd[12]; $tm->team_contact($id, $tm->protocol, 'cep_team'); } if ($dd[10] == 'del') { $id = $dd[12]; $tm->team_delete_member($id, $tm->protocol, 'cep_team'); } if ($dd[10] == 'add') { $email = $dd[12]; if (checaemail($email)) { $author = $tm->author_exist($email); if ($author != -1 and strlen($author) == 7) { $et = $tm->team_insert_author($author, $tm->protocol, 'cep_team', $type = 'N');
<?php // to get the league name include "classes/league.class.php"; $oLeague = new league(); $oLeague->leagueid = $_GET['leagueid']; ?> <div style="margin-left:20px;" class="page-title"><?php $oLeague->leagueName(); ?> </div> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <?php include "classes/team.class.php"; $oTeam = new team(); $oTeam->leagueid = $_GET['leagueid']; $oTeam->season = date("Y"); $oTeam->teamStandingFull(); ?> </div> </div><!-- end col-md-12 --> </div><!--end row --> </div><!-- end container -->
<label for="new_password">New Password: *</label> <input type="password" id="new_password" name="new_password" /> </p> <p> <label for="confirm">Confirm Password: *</label> <input type="password" id="confirm" name="confirm" /> </p> </form> <form id="add_team_form" class="dialog_form" style="display:none;"> <?php $connection = new db_connection(); $team_list = team::loadList($connection); $connection->close(); ?> <label for="team">Team: *</label> <select id="team" name="team"> <?php if ($team_list === -1) { ?> <option value="-1">Data base connection error</option> <?php } else { foreach ($team_list as $t) { ?> <option value="<?php echo $t->getId(); ?>
<?php require_once "inc/initialize.php"; include "inc/header.php"; include 'inc/validate.php'; //Assign the team_id from the pickteam url parameter $team_id = $_GET['team_id']; $user_id = $_GET['user_id']; $my_date = date("Y-m-d"); $my_year = date("Y"); $goal_sql = "select * from goals where inactive='0'"; $slo_sql = "select * from slo where team_id={$team_id}"; $intended_outcome_sql = "SELECT * from intended_outcome where team_id={$team_id}"; $IO_count = count($intended_outcomes = intended_outcome::find_by_sql($intended_outcome_sql)); $team = team::find_by_id($team_id); $team_id = $team->team_id; $user = user::find_by_id($user_id); $username = $user->user_username; $goals = goal::find_by_sql($goal_sql); $slos = slo::find_by_sql($slo_sql); $poption = "1"; $home = ""; /*echo "<pre>"; print_r($_POST); echo "</pre>";*/ if ($_POST) { $poptions = $_POST; foreach ($poptions as $poption => $poption_value) { $home = empty($poption_value) ? $poption : "empty"; if ($home == $poption) { break;
<?php set_include_path(__DIR__); require_once 'lib/db.php'; require_once 'lib/team.php'; include 'header.php'; $con = DB::connect(); if ($_SERVER['REQUEST_METHOD'] == 'GET') { $team = null; $btn = "Create"; if (isset($_GET["number"])) { // edit an existing team $number = $_GET["number"]; $team = team::selectTeam($con, $number); $btn = "Update"; // echo "number " . $team['Number'] . " name " . $team['Name']; } else { $team = new team(); // make an empty } $form = "\n<form action='team-form.php' method='post'>\n<table>\n <tr>\n <td>Number</td>\n <td><input type='text' name='Number' value='" . $team->Number . "'></td>\n </tr>\n <tr>\n <td>Name</td>\n <td><input type='text' name='Name' value='" . $team->Name . "'></td>\n </tr>\n <tr>\n <td>City</td>\n <td><input type='text' name='City' value='" . $team->City . "'></td>\n </tr>\n <tr>\n <td>State</td>\n <td><input type='text' name='State' value='" . $team->State . "'></td>\n </tr>\n <tr>\n <td>Country</td>\n <td><input type='text' name='Country' value='" . $team->Country . "'></td>\n </tr>\n</table>\n<br>"; echo "<h2>" . $btn . " Team</h2>"; echo $form; echo "<input value='" . $btn . "' type='Submit'>\n </form>"; } else { // create a new team echo "POST"; } include 'footer.php';
?> </a></td> </tr> <?php } } ?> </table> <!-- </div>--> <h2>Administrative Final</h2> <!--<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#final_admin">Show Assessments</button> <div id="final_admin" class="collapse">--> <table border="1" class="table table-striped table-condensed"> <tr><td width="200"><h4>Creator</h4></td><td width="700"><h4>Expected Outcome</h4></td></tr> <?php $teams = team::find_by_sql($final_inst_team_sql); foreach ($teams as $team) { echo "<tr><th colspan='4'><div='column_header>" . $team->team_name . "</div></th></tr>"; ?> <?php $team_id = $team->team_id; $assessments = assessment::find_by_sql("select * from assessment, team, users where assessment.team_id='{$team_id}' and team.team_id=assessment.team_id AND assessment.user_id=users.user_id AND submitted='1'"); foreach ($assessments as $assessment) { ?> <tr> <td><?php echo $assessment->full_name(); ?> </td>
<?php include "modules/tournament2/class_team.php"; $tteam = new team(); $_GET['tournamentid'] ? $tournamentid = $_GET['tournamentid'] : ($tournamentid = $_POST['tournamentid']); $_GET['userid'] ? $userid = $_GET['userid'] : ($userid = $_POST['userid']); switch ($_GET['step']) { // Team verlassen case 10: if ($tteam->kick($_GET["teamid"], $auth["userid"])) { $func->confirmation(t('Du wurdest aus dem Team entfernt'), "index.php?mod=tournament2&action=teammgr"); } break; // Spieler aus Team entfernen // Spieler aus Team entfernen case 20: if ($tteam->kick($_GET["teamid"], $userid)) { $func->confirmation(t('Der Spieler wurde aus deinem Team entfernt'), "index.php?mod=tournament2&action=teammgr"); } break; // Team abmelden (löschen) / Mich abmelden // Team abmelden (löschen) / Mich abmelden case 30: if ($tteam->delete($_GET["teamid"])) { $func->confirmation(t('Dein Team wurde vom Turnier abgemeldet'), "index.php?mod=tournament2&action=teammgr"); } break; // Spieler zum eigenen Team hinzufügen - Suchen // Spieler zum eigenen Team hinzufügen - Suchen case 40: include_once 'modules/usrmgr/search_main.inc.php';