本文整理汇总了PHP中Team::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Team::create方法的具体用法?PHP Team::create怎么用?PHP Team::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Team
的用法示例。
在下文中一共展示了Team::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$file = Input::file('image');
// your file upload input field in the form should be named 'file'
$destinationPath = public_path() . '/uploads';
$filename = $file->getClientOriginalName();
//$extension =$file->getClientOriginalExtension(); //if you need extension of the file
$uploadSuccess = Input::file('image')->move($destinationPath, $filename);
$RandNumber = rand(0, 9999999999.0);
if ($uploadSuccess) {
require_once 'PHPImageWorkshop/ImageWorkshop.php';
chmod($destinationPath . "/" . $filename, 0777);
$layer = PHPImageWorkshop\ImageWorkshop::initFromPath(public_path() . '/uploads/' . $filename);
unlink(public_path() . '/uploads/' . $filename);
$layer->resizeInPixel(400, null, true);
$layer->applyFilter(IMG_FILTER_CONTRAST, -16, null, null, null, true);
$layer->applyFilter(IMG_FILTER_BRIGHTNESS, 9, null, null, null, true);
$dirPath = public_path() . '/uploads/' . "team";
$filename = "_" . $RandNumber . ".png";
$createFolders = true;
$backgroundColor = null;
// transparent, only for PNG (otherwise it will be white if set null)
$imageQuality = 100;
// useless for GIF, usefull for PNG and JPEG (0 to 100%)
$layer->save($dirPath, $filename, $createFolders, $backgroundColor, $imageQuality);
chmod($dirPath . "/" . $filename, 0777);
//connect & insert file record in database
$team = Team::create(array("name" => Input::get("name"), "image" => $filename, "title" => Input::get("title"), "phone" => Input::get("phone"), "email" => Input::get("email"), "password" => Input::get("password"), "descriptions" => Input::get("descriptions")));
}
return View::make('team.manage');
}
示例2: _ops_update
function _ops_update()
{
$OID = max(0, intval($_POST['OID']));
$CID = max(0, intval($_POST['CID']));
$msg = "";
loginRequireMgmt();
if (!loginCheckPermission(USER::MGMT_TEAM)) {
redirect("errors/401");
}
$itemName = "Team";
$urlPrefix = "mgmt_team";
$object = new Team();
if ($OID) {
$object->retrieve($OID, $CID);
if (!$object->exists()) {
$msg = "{$itemName} not found!";
} else {
transactionBegin();
$object->merge($_POST);
if ($object->update()) {
transactionCommit();
$msg = "{$itemName} updated!";
} else {
transactionRollback();
$msg = "{$itemName} update failed";
}
}
} else {
$object->merge($_POST);
for ($retry = 0; $retry < PIN_RETRY_MAX; $retry++) {
$pin = Team::generatePIN();
if (Team::getFromPin($pin) === false) {
// not a duplicate
$object->set('pin', $pin);
transactionBegin();
if ($object->create() !== false) {
transactionCommit();
$msg = "{$itemName} created!";
break;
}
}
}
if ($retry >= PIN_RETRY_MAX) {
transactionRollback();
$msg = "{$itemName} Create failed";
}
}
redirect("{$urlPrefix}/manage", $msg);
}
示例3: makeTeams
public function makeTeams() {
$teams = [];
foreach (explode("\n", file_get_contents("teams.txt")) as $line) {
$parts = explode(" - ", " $line ");
if (count($parts) != 2) continue;
list($name, $username) = $parts;
$username = trim($username);
$name = trim($name);
$team = Team::create();
$team->isadmin = false;
$team->ismember = true;
if ($username[0] == '@') {
$username = substr($username, 1);
$team->isadmin = true;
}
else if ($username[0] == '!') {
$username = substr($username, 1);
$team->ismember = false;
}
$team->name = $name;
$team->username = $username;
$team->ispublic = true;
if (!strlen($name)) {
$team->name = $team->username;
$team->ispublic = false;
}
$teams[] = $team;
}
if (count($teams) >= 1 && count($teams) != count(Team::find('1=1'))) {
Team::truncate(true);
Match::truncate(true);
Model::saveAll($teams);
?>Equipos actualizados.<br><?
}
else {
?>No hay cambios en los equipos.<br><?
}
}
示例4: _ops_loaddb
function _ops_loaddb()
{
$urlPrefix = "mgmt_team";
$item = "Team";
if (isset($_FILES['csv_file']) && is_uploaded_file($_FILES['csv_file']['tmp_name'])) {
// open the csv file for reading
$file_path = $_FILES['csv_file']['tmp_name'];
$handle = fopen($file_path, 'r');
try {
transactionBegin();
$o = new Team();
if ($o->deleteAll() === false) {
throw new Exception("delete all {$item}");
}
while (($data = fgetcsv($handle, 1000, ',')) !== FALSE) {
if (count($data) != 2) {
throw new Exception("wrong number of value of {$item}");
}
$s = School::getFromName($data[1]);
if ($s === false) {
throw new Exception("Can't find shool {$data['1']}");
}
$pin = generatePin();
if ($pin === false) {
throw new Exception("Couldn't create unique pin");
}
$o = new Team();
$o->set('name', $data[0]);
$o->set('pin', $pin);
$o->set('schoolId', $s->get('OID'));
if ($o->create() === false) {
throw new Exception("Can't create {$item} object");
}
}
transactionCommit();
$msg = "Load {$item} completed";
} catch (Exception $e) {
transactionRollback();
$msg = "caught exception " . $e->getMessage();
}
// delete csv file
unlink($file_path);
} else {
$msg = "error no file uploaded";
}
redirect("{$urlPrefix}/manage", $msg);
}
示例5: post_add
public function post_add()
{
$input = Input::get();
$rules = array('name' => 'required|unique:teams', 'alias' => 'required|max:128|unique:teams', 'description' => 'required');
$validation = Validator::make($input, $rules);
if ($validation->passes()) {
// Modify input variables
$input['alias'] = strtolower($input['alias']);
// Create the team
$team = Team::create($input);
// Make the team active for the current year
Year::current_year()->teams()->attach($team->id);
return Redirect::to('rms/teams')->with('success', 'Successfully Added New Team');
} else {
return Redirect::to('rms/teams/add')->withErrors($validation)->withInput();
}
}
示例6: run
public function run()
{
DB::table('team')->delete();
//Groupe A
Team::create(array('name' => 'Brésil', 'code' => 'BRA'));
Team::create(array('name' => 'Mexique', 'code' => 'MEX'));
Team::create(array('name' => 'Croatie', 'code' => 'CRO'));
Team::create(array('name' => 'Cameroun', 'code' => 'CMR'));
//Groupe B
Team::create(array('name' => 'Pays-Bas', 'code' => 'NED'));
Team::create(array('name' => 'Chili', 'code' => 'CHI'));
Team::create(array('name' => 'Australie', 'code' => 'AUS'));
Team::create(array('name' => 'Espagne', 'code' => 'ESP'));
//Groupe C
Team::create(array('name' => 'Colombie', 'code' => 'COL'));
Team::create(array('name' => 'Côte d\'ivoire', 'code' => 'CIV'));
Team::create(array('name' => 'Japon', 'code' => 'JPN'));
Team::create(array('name' => 'Grèce', 'code' => 'GRE'));
//Groupe D
Team::create(array('name' => 'Costa Rica', 'code' => 'CRC'));
Team::create(array('name' => 'Italie', 'code' => 'ITA'));
Team::create(array('name' => 'Uruguay', 'code' => 'URU'));
Team::create(array('name' => 'Angleterre', 'code' => 'ENG'));
//Groupe E
Team::create(array('name' => 'France', 'code' => 'FRA'));
Team::create(array('name' => 'Équateur', 'code' => 'ECU'));
Team::create(array('name' => 'Suisse', 'code' => 'SUI'));
Team::create(array('name' => 'Honduras', 'code' => 'HON'));
//Groupe F
Team::create(array('name' => 'Argentine', 'code' => 'ARG'));
Team::create(array('name' => 'Nigeria', 'code' => 'NGA'));
Team::create(array('name' => 'Iran', 'code' => 'IRN'));
Team::create(array('name' => 'Bosnie-Herzégovine', 'code' => 'BIH'));
//Groupe G
Team::create(array('name' => 'Allemagne', 'code' => 'GER'));
Team::create(array('name' => 'États-Unis', 'code' => 'USA'));
Team::create(array('name' => 'Ghana', 'code' => 'GHA'));
Team::create(array('name' => 'Portugal', 'code' => 'POR'));
//Groupe H
Team::create(array('name' => 'Belgique', 'code' => 'BEL'));
Team::create(array('name' => 'Corée du Sud', 'code' => 'KOR'));
Team::create(array('name' => 'Russie', 'code' => 'RUS'));
Team::create(array('name' => 'Algérie', 'code' => 'ALG'));
}
示例7: doAddTeam
public function doAddTeam($data, Form $form)
{
// check if the player combination for a new team already exists
$teamExists = $this->teamExists($data['PlayerOne'], $data['PlayerTwo']);
if (!$teamExists) {
// check other combination
$teamExists = $this->teamExists($data['PlayerTwo'], $data['PlayerOne']);
}
if ($teamExists) {
// team already exists
return $this->redirectBack();
} else {
// check again - opposite order
// create the new team with player ID's
$team = Team::create();
$team->PlayerOne = $data['PlayerOne'];
$team->PlayerTwo = $data['PlayerTwo'];
$team->write();
$redirectLink = $this->Link() . '?success=1';
return $this->redirect($redirectLink);
}
}
示例8: pickTeams
/**
* pickTeams
* Take all players and assign teams as necessary. This is step one.
* Players array gets shuffled to assign random players.
* Does not define matches. Only initial team assignment.
*
*
* @return void
*/
public function pickTeams($random = true)
{
$players = $this->bracket->players;
// Are there enough teams for a tournament?
if (ceil(count($players) / $this->bracket->players_per_team) < 2) {
return null;
}
// Setting the var random to true will shuffle the array of players.
// Otherwise it will be a first second, third fourth, in order.
if ($random) {
shuffle($players);
}
// put the players in a random order to assign them.
// DELETE any existing teams in the bracket. We're drawing new teams heeeaaahhhhhh
$this->bracket->teams()->delete();
for ($i = 0; $i < count($players); $i += $this->bracket->players_per_team) {
/*
CREATE the new team. You could name it if you want...
*/
$team = Team::create(array('name' => date('F j, Y, g:i a')));
/*
ATTACH players to the newly created team.
Every team has to have at least one.
*/
for ($k = 0; $k < $this->bracket->players_per_team; $k++) {
if (current($players) === false) {
continue;
}
$team->players()->attach(current($players));
next($players);
}
/*
ASSOCIATE the new team with the bracket.
This team now has all the players assigned
*/
$this->bracket->teams()->insert($team);
}
return count($this->bracket->teams);
}
示例9: sprintf
if ($_REQUEST['id'] && !($team = Team::lookup($_REQUEST['id']))) {
$errors['err'] = sprintf(__('%s: Unknown or invalid'), __('team'));
}
if ($_POST) {
switch (strtolower($_POST['do'])) {
case 'update':
if (!$team) {
$errors['err'] = sprintf(__('%s: Unknown or invalid'), __('team'));
} elseif ($team->update($_POST, $errors)) {
$msg = sprintf(__('Successfully updated %s'), __('this team'));
} elseif (!$errors['err']) {
$errors['err'] = sprintf(__('Unable to update %s. Correct any error(s) below and try again.'), __('this team'));
}
break;
case 'create':
if ($id = Team::create($_POST, $errors)) {
$msg = sprintf(__('Successfully added %s'), Format::htmlchars($_POST['team']));
$_REQUEST['a'] = null;
} elseif (!$errors['err']) {
$errors['err'] = sprintf(__('Unable to add %s. Correct error(s) below and try again.'), __('this team'));
}
break;
case 'mass_process':
if (!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
$errors['err'] = sprintf(__('You must select at least %s.'), __('one team'));
} else {
$count = count($_POST['ids']);
switch (strtolower($_POST['a'])) {
case 'enable':
$sql = 'UPDATE ' . TEAM_TABLE . ' SET isenabled=1 ' . ' WHERE team_id IN (' . implode(',', db_input($_POST['ids'])) . ')';
if (db_query($sql) && ($num = db_affected_rows())) {
示例10: run
public function run()
{
DB::table('teams')->truncate();
Team::create(array('name' => 'Real Madrid', 'type' => 'club', 'logo_image' => 'realmadrid.png', 'jersey_image' => 'madrid.png'));
Team::create(array('name' => 'Barcelona', 'type' => 'club', 'logo_image' => 'barcelona.png', 'jersey_image' => 'barca.png'));
}
示例11: _resetdb
function _resetdb()
{
if (!isset($_POST['dataOption'])) {
echo "error";
exit;
}
$dataOption = $_POST['dataOption'];
try {
$dbh = getdbh();
$list = explode(",", "v_leaderboard_main,v_ext_ranks,v_leaderboard_ext");
foreach ($list as $view) {
dropView($dbh, $view);
}
//
// rPI challenge data
//
$list = explode(",", "t_cts_data,t_fsl_data,t_hmb_data,t_cpa_data,t_ext_data");
foreach ($list as $table) {
dropTable($dbh, $table);
}
$list = explode(",", "t_event,t_user,t_rpi,t_station,t_stationtype,t_team,t_school");
foreach ($list as $table) {
dropTable($dbh, $table);
}
create_t_user($dbh);
create_t_stationtype($dbh);
create_t_station($dbh);
create_t_school($dbh);
create_t_team($dbh);
create_t_event($dbh);
create_t_rpi($dbh);
create_v_leaderboard_main($dbh);
create_v_ext_ranks($dbh);
create_v_leaderboard_ext($dbh);
//
// rPI challenge data
//
create_t_cts_data($dbh);
create_t_fsl_data($dbh);
create_t_hmb_data($dbh);
create_t_cpa_data($dbh);
create_t_ext_data($dbh);
$admin = new User();
$admin->set('username', "admin");
$admin->setPassword('pass');
$admin->set('email', "dcarreir@harris.com");
$admin->set('fullname', "administrator");
$admin->setRoll(USER::ROLL_ADMIN);
$admin->create();
$stationType = StationType::makeStationType(StationType::STATION_TYPE_REG, "Register", false, 60, "Hello! You have been successfully registered and may start the competition. Good luck!", "If you see this message there was an internal error 1", "If you see this message there was an internal error 2", "If you see this message there was an internal error 3");
if ($stationType === false) {
echo "Create StationType REG failed";
} else {
createStations(1, "reg", $stationType->get('OID'));
}
$stationType = StationType::makeStationType(StationType::STATION_TYPE_CTS, "Crack The Safe", true, 60, "Welcome, Team! Your first assignment is to break into Professor Aardvark's safe where you will find the first clue to his Secret Laboratory. Measure the interior angles and pick the three correct angles for the safe combination. Good luck! [clue=[clue]]", "Success! Go quickly to the next team queue.", "You have failed the challenge. Go quickly to the next team queue.", "No luck, better try again!");
$numStations = $dataOption == 1 ? 1 : 6;
if ($stationType === false) {
echo "Create StationType CTS failed";
} else {
createStations($numStations, "cts", $stationType->get('OID'));
}
$stationType = StationType::makeStationType(StationType::STATION_TYPE_FSL, "Find Secret Lab", false, 60, "Find and scan the [ordinal] at [waypoint-lat=[lat]] [waypoint-lon=[lng]].", "Success! Find and scan the [ordinal] marker at [waypoint-lat=[lat]] [waypoint-lon=[lng]].", "Too bad, you failed. Find and scan the [ordinal] marker at [waypoint-lat=[lat]] [waypoint-lon=[lng]].", "Wrong marker, try again!");
if ($stationType === false) {
echo "Create StationType FSL failed";
} else {
createStations(1, "fsl", $stationType->get('OID'));
}
$stationType = StationType::makeStationType(StationType::STATION_TYPE_HMB, "Defuse Hypermutation Bomb", true, 60, "The HMB has been triggered! Send the Energy Pulsator cycle time quickly!", "Success! Go quickly to the next team queue.", "Oops. Enough said. Go quickly to the next team queue.", "Nope, better try again!");
$numStations = $dataOption == 1 ? 1 : 6;
if ($stationType === false) {
echo "Create StationType HMB failed";
} else {
createStations($numStations, "hmb", $stationType->get('OID'));
}
$stationType = StationType::makeStationType(StationType::STATION_TYPE_CPA, "Catch Provessor Aardvark", true, 2000, "PA is trying to escape. Quickly measure the [fence=label] [building=[label]] and scan Start QR Code.", "Watch now as the professor attempts to escape. Get him!", "Success! Go quickly to the team finish area.", "Professor Aardvark has escaped. Oh well. Go quickly to the team finish area.", "Miss! Try again!");
$numStations = $dataOption == 1 ? 1 : 6;
if ($stationType === false) {
echo "Create StationType CPA failed";
} else {
createStations($numStations, "cpa", $stationType->get('OID'));
}
$stationType = StationType::makeStationType(StationType::STATION_TYPE_EXT, "Extra", false, 60, "You have 20 (TBR) minutes to provide the tower location and height. Good luck." . " [waypoint1-lat=[a_lat]] [waypoint1-lon=[a_lng]]" . " [waypoint2-lat=[b_lat]] [waypoint2-lon=[b_lng]]" . " [waypoint3-lat=[c_lat]] [waypoint3-lon=[c_lng]]", "Message received, return to base", "M didn't understand your message", "If you see this message there was an internal error 5");
if ($stationType === false) {
echo "Create StationType EXT failed";
} else {
createStations(1, "ext", $stationType->get('OID'));
}
if ($dataOption == 0) {
redirect('mgmt_main', 'Database Initialized without test data!');
return;
}
// generate test data
// for ($i=1;$i < 21; $i++) {
// $user = new User();
// $user->set('username','user'.$i);
// $user->setPassword('pass'.$i);
// $user->set('email','email'.$i."@harris.com");
// $user->set('fullname','User #'.$i);
// if ($user->create()===false) echo "Create user $i failed";
//.........这里部分代码省略.........
示例12: display
protected function display()
{
$this->smartyHelper->assign('activeGlobalMenuItem', 'Admin');
if (Tools::isConnectedUser()) {
if (!$this->session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
$this->smartyHelper->assign('accessDenied', TRUE);
} else {
if (isset($_POST['team_name'])) {
// Form user selections
$team_name = Tools::getSecurePOSTStringValue('team_name');
$team_desc = Tools::getSecurePOSTStringValue('team_desc', '');
$teamleader_id = Tools::getSecurePOSTStringValue('teamleader_id');
$formatedDate = date("Y-m-d", time());
$now = Tools::date2timestamp($formatedDate);
// 1) --- create new Team
$teamid = Team::create($team_name, $team_desc, $teamleader_id, $now);
if ($teamid > 0) {
$team = TeamCache::getInstance()->getTeam($teamid);
// --- add teamLeader as 'manager'
$team->addMember($teamleader_id, $now, Team::accessLevel_manager);
// 2) --- add ExternalTasksProject
$team->addExternalTasksProject();
$stproj_name = Tools::getSecurePOSTStringValue("stproj_name");
if (isset($_POST['cb_createSideTaskProj'])) {
// 3) --- add <team> SideTaskProject
$stproj_id = $team->createSideTaskProject($stproj_name);
if ($stproj_id < 0) {
self::$logger->error("SideTaskProject creation FAILED");
echo "<span style='color:red'>ERROR: SideTaskProject creation FAILED</span>";
exit;
} else {
$stproj = ProjectCache::getInstance()->getProject($stproj_id);
// --- add teamLeader as Mantis manager of the SideTaskProject
$leader = UserCache::getInstance()->getUser($teamleader_id);
$access_level = 70;
// TODO mantis manager
$leader->setProjectAccessLevel($stproj_id, $access_level);
// 4) --- add SideTaskProject Categories
$stproj->addCategoryProjManagement(T_("Project Management"));
if (isset($_POST['cb_catInactivity'])) {
$stproj->addCategoryInactivity(T_("Inactivity"));
}
if (isset($_POST['cb_catIncident'])) {
$stproj->addCategoryIncident(T_("Incident"));
}
if (isset($_POST['cb_catTools'])) {
$stproj->addCategoryTools(T_("Tools"));
}
if (isset($_POST['cb_catOther'])) {
$stproj->addCategoryWorkshop(T_("Team Workshop"));
}
// 5) --- add SideTaskProject default SideTasks
if (isset($_POST['cb_taskProjManagement'])) {
$stproj->addIssueProjManagement(Tools::getSecurePOSTStringValue('task_projManagement'));
}
if (isset($_POST['cb_taskMeeting'])) {
$stproj->addIssueProjManagement(Tools::getSecurePOSTStringValue('task_meeting'));
}
if (isset($_POST['cb_taskIncident'])) {
$stproj->addIssueIncident(Tools::getSecurePOSTStringValue('task_incident'));
}
if (isset($_POST['cb_taskTools'])) {
$stproj->addIssueTools(Tools::getSecurePOSTStringValue('task_tools'));
}
if (isset($_POST['cb_taskOther'])) {
$stproj->addIssueWorkshop(Tools::getSecurePOSTStringValue('task_other1'));
}
}
}
}
// 6) --- open EditTeam Page
header('Location: edit_team.php?teamid=' . $teamid);
} else {
$this->smartyHelper->assign('users', SmartyTools::getSmartyArray(User::getUsers(), $this->session_userid));
}
}
}
}
示例13: array_flip
global $T_INJS, $T_PMD_ACH, $T_PMD_IR, $T_PMD_INJ;
$T_INJS_REV = array_flip($T_INJS);
// Input sent?
if (isset($_FILES['xmlfile'])) {
$file = $_FILES['xmlfile']['tmp_name'];
$xml = new DOMDocument();
$xml->load($file);
$xmlteams = $xml->schemaValidate('xml/import.xsd') ? simplexml_load_file($file) : (object) array('team' => array());
$map = array('owned_by_coach_id' => 'coach_id', 'f_race_id' => 'race_id', 'f_lid' => 'league_id', 'f_did' => 'division_id', 'rerolls' => 'rr', 'ff_bought' => 'ff', 'won_0' => 'won', 'lost_0' => 'lost', 'draw_0' => 'draw', 'wt_0' => 'wt', 'gf_0' => 'gf', 'ga_0' => 'ga');
foreach ($xmlteams->team as $t) {
# Corrections
$t->played_0 = $t->won + $t->lost + $t->draw;
$t->imported = 1;
# Add team
list($exitStatus, $tid) = Team::create(array_merge(array_intersect_key((array) $t, array_fill_keys(Team::$createEXPECTED, null)), array_combine(array_keys($map), array_values(array_intersect_key((array) $t, array_fill_keys(array_values($map), null))))));
status(!$exitStatus, $exitStatus ? Team::$T_CREATE_ERROR_MSGS[$exitStatus] : "Created team '{$t->name}'");
# Add players
$ROLLBACK = false;
if (is_numeric($tid) && !$exitStatus) {
$team = new Team($tid);
foreach ($t->players->player as $p) {
$p = (object) (array) $p;
# Get rid of SimpleXML objects.
if (!$team->isPlayerPosValid($p->pos_id)) {
status(false, "Invalid race position ID '{$p->pos_id}' for '{$p->name}'");
$ROLLBACK = true;
break;
}
list($status1, $pid) = Player::create(array('nr' => $p->nr, 'f_pos_id' => $p->pos_id, 'name' => $p->name, 'team_id' => $tid), array('force' => true, 'free' => true));
if ($status1) {
示例14: sha1
<?php
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
/* vim:set noet ci pi sts=0 sw=4 ts=4: */
require "common.php";
if (!empty($_POST['process'])) {
$valid = false;
if (!empty($_POST['form_time']) && !empty($_POST['form_hash'])) {
$valid = sha1($site_key . $_POST['form_time'] . $current_user->user_id) == $_POST['form_hash'];
}
if ($valid && empty($_POST['team_id'])) {
Team::create($_POST);
} else {
if ($valid) {
$league = new Team($_POST['team_id']);
if (!$league->read()) {
die(_("No se puede encontrar el equipo"));
}
$league->name = $_POST['name'];
$league->shortname = $_POST['shortname'];
$league->store();
} else {
if (!$valid) {
die(_("El token del formulario no es correcto"));
}
}
}
$_GET['action'] = 'list';
示例15: createAdminTeam
/**
* create Admin team & add to codev_config_table
* @param string $name
* @param int $leader_id
* @return int
*/
function createAdminTeam($name, $leader_id)
{
$now = time();
$formatedDate = date("Y-m-d", $now);
$today = Tools::date2timestamp($formatedDate);
// create admin team
$teamId = Team::getIdFromName($name);
if (-1 == $teamId) {
$teamId = Team::create($name, T_("CodevTT Administrators team"), $leader_id, $today);
}
if (-1 != $teamId) {
// --- add to codev_config_table
Config::getInstance()->setQuiet(true);
Config::getInstance()->setValue(Config::id_adminTeamId, $teamId, Config::configType_int);
Config::getInstance()->setQuiet(false);
// add leader as member
$adminTeam = TeamCache::getInstance()->getTeam($teamId);
$adminTeam->addMember($leader_id, $today, Team::accessLevel_dev);
$adminTeam->setEnabled(false);
// add default ExternalTasksProject
// TODO does Admin team needs ExternalTasksProject ?
$adminTeam->addExternalTasksProject();
// NOTE: CodevTT Admin team does not need any side task project.
} else {
echo "ERROR: {$name} team creation failed</br>";
}
return $teamId;
}