1<?php
2// This file is part of BOINC.
3// http://boinc.berkeley.edu
4// Copyright (C) 2008 University of California
5//
6// BOINC is free software; you can redistribute it and/or modify it
7// under the terms of the GNU Lesser General Public License
8// as published by the Free Software Foundation,
9// either version 3 of the License, or (at your option) any later version.
10//
11// BOINC is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14// See the GNU Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public License
17// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
18
19include_once("../inc/translation.inc");
20
21global $team_types;
22$team_types = array(
23    "",
24    tra("None"),
25    tra("Company"),
26    tra("Primary school"),
27    tra("Secondary school"),
28    tra("Junior college"),
29    tra("University or department"),
30    tra("Government agency"),
31    tra("Non-profit organization"),
32    tra("National"),
33    tra("Local/regional"),
34    tra("Computer type"),
35    tra("Social/political/religious")
36);
37
38function team_type_name($num) {
39    global $team_types;
40    if ($num>0 && $num<count($team_types)) {
41        return $team_types[$num];
42    }
43    return "None";
44}
45
46function is_valid_team_type($name) {
47    global $team_types;
48    foreach ($team_types as $type) {
49        if ($name == $type) return true;
50    }
51    return false;
52}
53
54function team_type_num($name) {
55    global $team_types;
56    for ($i=0; $i<sizeof($team_types); $i++) {
57        if ($name == $team_types[$i]) return $i;
58    }
59    return 0;
60}
61
62function team_type_select($selected_type, $allow_none=false){
63    global $team_types;
64
65    $types = $team_types;
66    if ($allow_none) {
67        $types[0] = '---';
68        $type = 0;
69    }
70    return select_from_array('type', $types, $selected_type);
71}
72
73?>
74