Exemplo n.º 1
0
 public static function starHireHistory($obj, $obj_id, $node, $node_id, $star_id = false, $opts = array())
 {
     global $lng;
     /* 
         If $star_id is false, then the HH from all stars of $obj = $obj_id will be displayed, instead of only the HH of star = $star_id 
     */
     if (!array_key_exists('GET_SS', $opts)) {
         $opts['GET_SS'] = '';
     } else {
         $extra['GETsuffix'] = $opts['GET_SS'];
     }
     # GET Sorting Suffix
     $extra['doNr'] = false;
     $extra['noHelp'] = true;
     if ($ANC = array_key_exists('anchor', $opts)) {
         $extra['anchor'] = $opts['anchor'];
     }
     $mdat = array();
     foreach ($star_id ? array(new Star($star_id)) : Star::getStars($obj, $obj_id, $node, $node_id) as $s) {
         foreach ($s->getHireHistory($obj, $obj_id, $node, $node_id) as $m) {
             $o = (object) array();
             foreach (array('match_id', 'date_played', 'hiredBy', 'hiredAgainst', 'hiredByName', 'hiredAgainstName') as $k) {
                 $o->{$k} = $m->{$k};
             }
             foreach ($s->getStats(T_NODE_MATCH, $m->match_id) as $k => $v) {
                 $o->{$k} = $v;
             }
             $o->match = $lng->getTrn('common/view');
             $o->tour = get_alt_col('tours', 'tour_id', $m->f_tour_id, 'name');
             $o->score = "{$m->team1_score} - {$m->team2_score}";
             $o->result = matchresult_icon($m->team1_id == $m->hiredBy && $m->team1_score > $m->team2_score || $m->team2_id == $m->hiredBy && $m->team1_score < $m->team2_score ? 'W' : ($m->team1_score == $m->team2_score ? 'D' : 'L'));
             $o->star_id = $s->star_id;
             $o->name = $s->name;
             array_push($mdat, $o);
         }
     }
     $fields = array('date_played' => array('desc' => $lng->getTrn('common/dateplayed')), 'name' => array('desc' => $lng->getTrn('common/star'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_STAR, false, false, false), 'field' => 'obj_id', 'value' => 'star_id')), 'tour' => array('desc' => $lng->getTrn('common/tournament')), 'hiredByName' => array('desc' => $lng->getTrn('profile/star/hiredby'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, false, false, false), 'field' => 'obj_id', 'value' => 'hiredBy')), 'hiredAgainstName' => array('desc' => $lng->getTrn('common/opponent'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, false, false, false), 'field' => 'obj_id', 'value' => 'hiredAgainst')), 'cp' => array('desc' => 'Cp'), 'td' => array('desc' => 'Td'), 'intcpt' => array('desc' => 'Int'), 'cas' => array('desc' => 'Cas'), 'bh' => array('desc' => 'BH'), 'si' => array('desc' => 'Si'), 'ki' => array('desc' => 'Ki'), 'mvp' => array('desc' => 'MVP'), 'score' => array('desc' => $lng->getTrn('common/score'), 'nosort' => true), 'result' => array('desc' => $lng->getTrn('common/result'), 'nosort' => true), 'match' => array('desc' => $lng->getTrn('common/match'), 'href' => array('link' => 'index.php?section=matches&amp;type=report', 'field' => 'mid', 'value' => 'match_id'), 'nosort' => true));
     if ($star_id) {
         unset($fields['name']);
     }
     if ($obj && $obj_id) {
         unset($fields['hiredByName']);
     }
     $title = $lng->getTrn('common/starhh');
     if ($ANC) {
         $title = "<a name='{$opts['anchor']}'>" . $title . '<a>';
     }
     HTMLOUT::sort_table($title, $opts['url'], $mdat, $fields, sort_rule('star_HH'), isset($_GET["sort{$opts['GET_SS']}"]) ? array(($_GET["dir{$opts['GET_SS']}"] == 'a' ? '+' : '-') . $_GET["sort{$opts['GET_SS']}"]) : array(), $extra);
 }
Exemplo n.º 2
0
 public function getPath($rid = false)
 {
     foreach (self::$supportedExtensions as $exts) {
         foreach ($exts as $ext) {
             if (file_exists($filePath = self::$typeToPathMappings[$this->obj] . '/' . $this->obj_id . '.' . $ext)) {
                 return $filePath;
             }
         }
     }
     // Else return default image.
     if ($this->obj == IMGTYPE_TEAMLOGO) {
         global $DEA, $raceididx;
         $race = $raceididx[$rid ? $rid : get_alt_col('teams', 'team_id', $this->obj_id, 'f_race_id')];
         return file_exists($path = RACE_ICONS . '/' . $DEA[$race]['other']['icon']) ? $path : NO_PIC;
     } else {
         return NO_PIC;
     }
 }
Exemplo n.º 3
0
        <select name="ring">
            <?php 
foreach ($T_GLOBAL_RINGS as $r => $desc) {
    if ($r <= $coach->ring) {
        echo "<option value='{$r}' " . ($r == Coach::T_RING_GLOBAL_NONE ? 'SELECTED' : '') . ">{$desc}</option>\n";
    }
}
?>
        </select>
        <br><br>
        Local (league) access<br>
        <SELECT NAME="def_leagues[]" MULTIPLE>
        <?php 
foreach ($settings['default_leagues'] as $lid) {
    if (get_alt_col('leagues', 'lid', $lid, 'lid')) {
        echo "<OPTION DISABLED VALUE='{$lid}'>" . get_alt_col('leagues', 'lid', $lid, 'name') . " (added to automatically)</OPTION>\n";
    }
}
foreach ($leagues as $lid => $desc) {
    if ($desc['ring'] == Coach::T_RING_LOCAL_ADMIN && !in_array($lid, $settings['default_leagues'])) {
        echo "<OPTION VALUE='{$lid}'>{$desc['lname']}</OPTION>\n";
    }
}
?>
        </SELECT>
        <br><br>
        <input type="hidden" name="type" value="mk_coach">
        <input type="submit" name="button" value="Create coach">
        </form>
    </div>
</div>
Exemplo n.º 4
0
    private function _CCprofile($ALLOW_EDIT)
    {
        global $lng, $coach, $leagues;
        // Was new password/email request made?
        if (isset($_POST['type']) && $ALLOW_EDIT) {
            if (get_magic_quotes_gpc()) {
                $_POST['new_passwd'] = isset($_POST['new_passwd']) ? stripslashes($_POST['new_passwd']) : '';
                $_POST['new_phone'] = isset($_POST['new_phone']) ? stripslashes($_POST['new_phone']) : '';
                $_POST['new_email'] = isset($_POST['new_email']) ? stripslashes($_POST['new_email']) : '';
                $_POST['new_name'] = isset($_POST['new_name']) ? stripslashes($_POST['new_name']) : '';
                $_POST['new_realname'] = isset($_POST['new_realname']) ? stripslashes($_POST['new_realname']) : '';
            }
            switch ($_POST['type']) {
                case 'chpasswd':
                    status(Coach::checkPasswd($this->coach_id, $_POST['old_passwd']) && $this->setPasswd($_POST['new_passwd']));
                    break;
                case 'chphone':
                    status($this->setPhone($_POST['new_phone']));
                    break;
                case 'chmail':
                    status($this->setMail($_POST['new_email']));
                    break;
                case 'chlogin':
                    status($this->setName($_POST['new_name']));
                    break;
                case 'chname':
                    status($this->setRealName($_POST['new_realname']));
                    break;
                case 'chlang':
                    status($this->setSetting('lang', $_POST['new_lang']));
                    break;
                case 'chhomelid':
                    status(isset($_POST['new_homelid']) && get_alt_col('leagues', 'lid', (int) $_POST['new_homelid'], 'lid') && $this->setSetting('home_lid', $_POST['new_homelid']));
                    break;
                case 'pic':
                    status($_POST['add_del'] == 'add' ? $this->savePic(false) : $this->deletePic());
                    break;
                case 'coachtext':
                    if (get_magic_quotes_gpc()) {
                        $_POST['coachtext'] = stripslashes($_POST['coachtext']);
                    }
                    status($this->saveText($_POST['coachtext']));
                    break;
            }
        }
        // New team and change coach settings.
        echo "<br><br>";
        ?>
    <table class="common"><tr class="commonhead"><td><b><?php 
        echo $lng->getTrn('cc/coach_info');
        ?>
</b></td></tr></table>
    <br>
    <?php 
        echo $lng->getTrn('cc/note_persinfo');
        echo "<br><br>";
        if (is_object($coach) && !$ALLOW_EDIT) {
            # Logged in but not viewing own coach page.
            ?>
        <table>
            <tr>
                <td>ID:</td>
                <td><?php 
            echo $this->coach_id;
            ?>
</td>
            </tr>
            <tr>
                <td>Name (login):</td>
                <td><?php 
            echo $this->name;
            ?>
</td>
            </tr>
            <tr>
                <td>Full name:</td>
                <td><?php 
            echo empty($this->realname) ? '<i>' . $lng->getTrn('common/none') . '</i>' : $this->realname;
            ?>
</td>
            </tr>
            <tr>
                <td>Phone:</td>
                <td><?php 
            echo empty($this->phone) ? '<i>' . $lng->getTrn('common/none') . '</i>' : $this->phone;
            ?>
</td>
            </tr>
            <tr>
                <td>Mail:</td>
                <td><?php 
            echo empty($this->mail) ? '<i>' . $lng->getTrn('common/none') . '</i>' : $this->mail;
            ?>
</td>
            </tr>
        </table>
        <br>
        <?php 
        }
        if ($ALLOW_EDIT) {
            ?>
        <table class="common" style="border-spacing:5px; padding:20px;">
            <tr><td colspan='4'>ID: <?php 
            echo $this->coach_id;
            ?>
</td></tr>
            <tr>
                <form method="POST">
                <td><?php 
            echo $lng->getTrn('cc/chpasswd');
            ?>
:</td>
                <td><?php 
            echo $lng->getTrn('cc/old');
            ?>
:<input type='password' name='old_passwd' size="20" maxlength="50"></td>
                <td><?php 
            echo $lng->getTrn('cc/new');
            ?>
:<input type='password' name='new_passwd' size="20" maxlength="50"></td>
                <td><input type="submit" name="button" value="<?php 
            echo $lng->getTrn('cc/chpasswd');
            ?>
"></td>
                <input type='hidden' name='type' value='chpasswd'>
                </form>
            </tr>
            <tr>
                <form method="POST">
                <td><?php 
            echo $lng->getTrn('cc/chphone');
            ?>
:</td>
                <td><?php 
            echo $lng->getTrn('cc/old');
            ?>
:<input type='text' name='old_phone' readonly value="<?php 
            echo $this->phone;
            ?>
" size="20" maxlength="129"></td>
                <td><?php 
            echo $lng->getTrn('cc/new');
            ?>
:<input type='text' name='new_phone' size="20" maxlength="25"></td>
                <td><input type="submit" name="button" value="<?php 
            echo $lng->getTrn('cc/chphone');
            ?>
"></td>
                <input type='hidden' name='type' value='chphone'>
                </form>
            </tr>
            <tr>
                <form method="POST">
                <td><?php 
            echo $lng->getTrn('cc/chmail');
            ?>
:</td>
                <td><?php 
            echo $lng->getTrn('cc/old');
            ?>
:<input type='text' name='old_email' readonly value="<?php 
            echo $this->mail;
            ?>
" size="20" maxlength="129"></td>
                <td><?php 
            echo $lng->getTrn('cc/new');
            ?>
:<input type='text' name='new_email' size="20" maxlength="129"></td>
                <td><input type="submit" name="button" value="<?php 
            echo $lng->getTrn('cc/chmail');
            ?>
"></td>
                <input type='hidden' name='type' value='chmail'>
                </form>
            </tr>
            <tr>
                <form method="POST">
                <td><?php 
            echo $lng->getTrn('cc/chlogin');
            ?>
:</td>
                <td><?php 
            echo $lng->getTrn('cc/old');
            ?>
:<input type='text' name='old_name' readonly value="<?php 
            echo $this->name;
            ?>
" size="20" maxlength="50"></td>
                <td><?php 
            echo $lng->getTrn('cc/new');
            ?>
:<input type='text' name='new_name' size="20" maxlength="50"></td>
                <td><input type="submit" name="button" value="<?php 
            echo $lng->getTrn('cc/chlogin');
            ?>
"></td>
                <input type='hidden' name='type' value='chlogin'>
                </form>
            </tr>
            <tr>
                <form method="POST">
                <td><?php 
            echo $lng->getTrn('cc/chname');
            ?>
:</td>
                <td><?php 
            echo $lng->getTrn('cc/old');
            ?>
:<input type='text' name='old_realname' readonly value="<?php 
            echo $this->realname;
            ?>
" size="20" maxlength="50"></td>
                <td><?php 
            echo $lng->getTrn('cc/new');
            ?>
:<input type='text' name='new_realname' size="20" maxlength="50"></td>
                <td><input type="submit" name="button" value="<?php 
            echo $lng->getTrn('cc/chname');
            ?>
"></td>
                <input type='hidden' name='type' value='chname'>
                </form>
            </tr>
            <tr>
                <form method="POST">
                <td><?php 
            echo $lng->getTrn('cc/chlang');
            ?>
:</td>
                <td><?php 
            echo $lng->getTrn('cc/current');
            ?>
: <?php 
            echo $this->settings['lang'];
            ?>
</td>
                <td>
                    <?php 
            echo $lng->getTrn('cc/new');
            ?>
:
                    <select name='new_lang'>
                        <?php 
            foreach (Translations::$registeredLanguages as $lang) {
                echo "<option value='{$lang}'>{$lang}</option>\n";
            }
            ?>
                    </select>
                </td>
                <td><input type="submit" name="button" value="<?php 
            echo $lng->getTrn('cc/chlang');
            ?>
"></td>
                <input type='hidden' name='type' value='chlang'>
                </form>
            </tr>
            <tr>
                <form method="POST">
                <td><?php 
            echo $lng->getTrn('cc/chhomelid');
            ?>
:</td>
                <td><?php 
            echo $lng->getTrn('cc/current');
            ?>
: <?php 
            echo isset($leagues[$this->settings['home_lid']]) ? $leagues[$this->settings['home_lid']]['lname'] : '<i>' . $lng->getTrn('common/none') . '</i>';
            ?>
</td>
                <td>
                    <?php 
            echo $lng->getTrn('cc/new');
            ?>
:
                    <select name='new_homelid'>
                        <?php 
            foreach ($leagues as $lid => $desc) {
                echo "<option value='{$lid}'>{$desc['lname']}</option>\n";
            }
            ?>
                    </select>
                </td>
                <td><input type="submit" name="button" value="<?php 
            echo $lng->getTrn('cc/chhomelid');
            ?>
" <?php 
            echo count($leagues) == 0 ? 'DISABLED' : '';
            ?>
></td>
                <input type='hidden' name='type' value='chhomelid'>
                </form>
            </tr>
        </table>
        <?php 
        }
        ?>

    <table class='common'>
        <tr class='commonhead'>
            <td><b><?php 
        echo $lng->getTrn('cc/photo');
        ?>
</b></td>
            <td><b><?php 
        echo $lng->getTrn('common/about');
        ?>
</b></td>
        </tr>
        <tr>
            <td>
                <?php 
        ImageSubSys::makeBox(IMGTYPE_COACH, $this->coach_id, $ALLOW_EDIT, false);
        ?>
            </td>
            <td valign='top'>
                <?php 
        $txt = $this->getText();
        if (empty($txt)) {
            $txt = $lng->getTrn('common/nobody');
        }
        if ($ALLOW_EDIT) {
            ?>
                    <form method='POST'>
                        <textarea name='coachtext' rows='15' cols='70'><?php 
            echo $txt;
            ?>
</textarea>
                        <br><br>
                        <input type="hidden" name="type" value="coachtext">
                        <input type="submit" name='Save' value="<?php 
            echo $lng->getTrn('common/save');
            ?>
">
                    </form>
                    <?php 
        } else {
            echo '<p>' . fmtprint($txt) . "</p>\n";
        }
        ?>
            </td>
        </tr>
    </table>
    <?php 
    }
Exemplo n.º 5
0
    public static function makeList($ALLOW_EDIT)
    {
        global $lng, $coach, $settings;
        HTMLOUT::frame_begin(is_object($coach) ? $coach->settings['theme'] : $settings['stylesheet']);
        # Make page frame, banner and menu.
        /* A new entry was sent. Add it to system */
        if (isset($_POST['tid']) && $ALLOW_EDIT) {
            if (get_magic_quotes_gpc()) {
                $_POST['title'] = stripslashes($_POST['title']);
                $_POST['about'] = stripslashes($_POST['about']);
            }
            switch ($_GET['action']) {
                case 'edit':
                    $e = new self($_GET['ft_id']);
                    status($e->edit($_POST['title'], $_POST['about']));
                    break;
                case 'new':
                    status(self::create($_POST['tid'], $_POST['title'], $_POST['about']));
                    break;
            }
        }
        title($lng->getTrn('name', __CLASS__));
        /* Was a request for a new entry made? */
        if (isset($_GET['action']) && $ALLOW_EDIT) {
            // Default schema values. These are empty unless "edit" is chosen.
            $tid = false;
            $title = '';
            $about = '';
            switch ($_GET['action']) {
                case 'delete':
                    if (isset($_GET['ft_id']) && is_numeric($_GET['ft_id'])) {
                        $e = new self($_GET['ft_id']);
                        status($e->delete());
                        unset($e);
                    } else {
                        fatal('Sorry. You did not specify which FT-id you wish to delete.');
                    }
                    break;
                case 'edit':
                    if (isset($_GET['ft_id']) && is_numeric($_GET['ft_id'])) {
                        $e = new self($_GET['ft_id']);
                        $tid = $e->tid;
                        $title = $e->title;
                        $about = $e->about;
                        $_POST['lid'] = get_alt_col('mv_teams', 'f_tid', $tid, 'f_lid');
                    } else {
                        fatal('Sorry. You did not specify which FT-id you wish to edit.');
                    }
                    // Fall-through to "new" !!!
                // Fall-through to "new" !!!
                case 'new':
                    echo "<a href='handler.php?type=famousteams'><-- " . $lng->getTrn('common/back') . "</a><br><br>";
                    $_DISABLED = !isset($_POST['lid']) ? 'DISABLED' : '';
                    $node_id = isset($_POST['lid']) ? $_POST['lid'] : null;
                    ?>
                <form name="STS" method="POST" enctype="multipart/form-data">
                <b><?php 
                    echo $lng->getTrn('common/league');
                    ?>
</b><br>
                <?php 
                    echo HTMLOUT::nodeList(T_NODE_LEAGUE, 'lid', array(), array(), array('sel_id' => $node_id));
                    ?>
                <input type='submit' value='<?php 
                    echo $lng->getTrn('common/select');
                    ?>
'>
                </form>
                <br>
                <form method="POST">
                <b><?php 
                    echo $lng->getTrn('team', __CLASS__) . '</b>';
                    ?>
<br>
                <?php 
                    $query = "SELECT team_id, name FROM teams WHERE f_lid = {$node_id} ORDER by name ASC";
                    $result = mysql_query($query);
                    if ($result && mysql_num_rows($result) == 0) {
                        $_DISABLED = 'DISABLED';
                    }
                    ?>
                <select name="tid" id="teams" <?php 
                    echo $_DISABLED;
                    ?>
>
                    <?php 
                    while ($row = mysql_fetch_assoc($result)) {
                        echo "<option value='{$row['team_id']}' " . ($tid == $row['team_id'] ? 'SELECTED' : '') . ">{$row['name']}</option>\n";
                    }
                    ?>
                </select>
                <br><br>
                <b><?php 
                    echo $lng->getTrn('g_title', __CLASS__) . '</b>&nbsp;&mdash;&nbsp;' . $lng->getTrn('title', __CLASS__);
                    ?>
<br>
                <input type="text" name="title" size="60" maxlength="100" value="<?php 
                    echo $title;
                    ?>
" <?php 
                    echo $_DISABLED;
                    ?>
>
                <br><br>
                <b><?php 
                    echo $lng->getTrn('g_about', __CLASS__) . '</b>&nbsp;&mdash;&nbsp;' . $lng->getTrn('about', __CLASS__);
                    ?>
<br>
                <textarea name="about" rows="15" cols="100" <?php 
                    echo $_DISABLED;
                    ?>
><?php 
                    echo $about;
                    ?>
</textarea>
                <br><br>
                <input type="submit" value="<?php 
                    echo $lng->getTrn('submit', __CLASS__);
                    ?>
" name="Submit" <?php 
                    echo $_DISABLED;
                    ?>
>
                </form>
                <?php 
                    return;
                    break;
            }
        }
        /* Print the hall of fame */
        echo $lng->getTrn('desc', __CLASS__) . "<br><br>\n";
        list($sel_node, $sel_node_id) = HTMLOUT::nodeSelector(array());
        if ($ALLOW_EDIT) {
            echo "<br><a href='handler.php?type=famousteams&amp;action=new'>" . $lng->getTrn('new', __CLASS__) . "</a><br>\n";
        }
        self::printList($sel_node, $sel_node_id, $ALLOW_EDIT);
        HTMLOUT::frame_end();
    }
Exemplo n.º 6
0
 private static function form()
 {
     /**
      * Creates an upload form.
      *
      * 
      **/
     global $coach;
     if (is_object($coach)) {
         # Tours the logged in coach can "see".
         list(, , $tours) = Coach::allowedNodeAccess(Coach::NODE_STRUCT__FLAT, $coach->coach_id, array(T_NODE_TOURNAMENT => array('type' => 'type', 'locked' => 'locked', 'f_did' => 'f_did')));
         $tourlist = "";
         $coach_lid = isset($_SESSION['NS_node_id']) && $_SESSION['NS_node_id'] > 0 ? $_SESSION['NS_node_id'] : 1;
         foreach ($tours as $trid => $t) {
             $lid = get_alt_col('divisions', 'did', $t['f_did'], 'f_lid');
             if ($t['type'] == TT_FFA && !$t['locked'] && $coach_lid == $lid && $t['tname'] != "Pandora's Box") {
                 $tourlist .= "<option value='{$trid}'>{$t['tname']}</option>\n";
             }
         }
         #            $tourlist = HTMLOUT::nodeList(T_NODE_TOURNAMENT, 'ffatours', array(T_NODE_TOURNAMENT => array('type' => TT_FFA, 'locked' => 0)), array(), array('hide_empty'=>array(T_NODE_DIVISION,T_NODE_LEAGUE)));
         global $settings;
         $cy_reroll = "";
         if ($settings['leegmgr_cyanide']) {
             $cy_reroll = "\r\n                    Reroll winnings if roll is less than: \r\n                    <select name='reroll'>\r\n                        <option value='2'>2</option>\r\n                        <option value='3'>3</option>\r\n                        <option value='4'>4</option>\r\n                        <option value='5'>5</option>\r\n                        <option value='6'>6</option>\r\n                    </select><br>";
         }
         $form = "\r\n                <!-- The data encoding type, enctype, MUST be specified as below -->\r\n                <form enctype='multipart/form-data' action='handler.php?type=leegmgr' method='POST'>\r\n                    <!-- MAX_FILE_SIZE must precede the file input field -->\r\n                    <input type='hidden' name='MAX_FILE_SIZE' value='256000' />\r\n                    <!-- Name of input element determines name in {$_FILES} array -->\r\n                    Send this file <input name='userfile' type='file' /><br>\r\n                    Save in tournament\r\n                    <select name='ffatours'>\r\n                        <optgroup label='Existing FFA'>\r\n\r\n                            {$tourlist}\r\n\r\n                        </optgroup>\r\n                    </select>\r\n\r\n                    <br>{$cy_reroll}<br>\r\n                    <input type='submit' value='Send File' />\r\n                </form>\r\n            ";
         return "\r\n            <div class='boxCommon'>\r\n            <h3 class='boxTitle" . T_HTMLBOX_MATCH . "'>Upload match</h3>\r\n            <div class='boxBody'>\r\n            " . $form . "\r\n            </div>\r\n            </div>\r\n            ";
     } else {
         return 'You must login in order to upload a match report.';
     }
 }
Exemplo n.º 7
0
 function activateUser()
 {
     $coach_id = get_alt_col(USERTABLE, USERNAME, $this->username, USERID);
     $c = new Coach($coach_id);
     if ($c->retired == 2) {
         mysql_query("UPDATE coaches SET retired = 0 WHERE coach_id = {$coach_id}");
     } else {
         $this->error = ACTIVATION_NOT_NEEDED;
         return false;
     }
     return true;
 }
Exemplo n.º 8
0
    private function _matchBest()
    {
        global $lng;
        $p = $this;
        // Copy. Used instead of $this for readability.
        ?>
   
    <div class="row">
        <div class="boxWide">
            <div class="boxTitle<?php 
        echo T_HTMLBOX_STATS;
        ?>
"><a href='javascript:void(0);' onClick="slideToggleFast('mbest');"><b>[+/-]</b></a> &nbsp;<?php 
        echo $lng->getTrn('profile/player/best');
        ?>
</div>
            <div class="boxBody" id="mbest">
                <table class="common">
                    <tr>
                        <td><b><?php 
        echo $lng->getTrn('common/type');
        ?>
</b></td>
                        <td><b><?php 
        echo $lng->getTrn('common/tournament');
        ?>
</b></td>
                        <td><b><?php 
        echo $lng->getTrn('common/opponent');
        ?>
</b></td>
                        <td><b>Td</b></td>
                        <td><b>Ki</b></td>
                        <td><b><?php 
        echo $lng->getTrn('common/score');
        ?>
</b></td>
                        <td><b><?php 
        echo $lng->getTrn('common/result');
        ?>
</b></td>
                        <td><b><?php 
        echo $lng->getTrn('common/match');
        ?>
</b></td>
                    </tr>
                    <?php 
        foreach (array('td' => 'scorer', 'ki' => 'killer') as $s => $desc) {
            $been_there = false;
            $matches = $p->getMatchMost($s);
            foreach ($matches as $entry) {
                if (!$been_there) {
                    echo "<tr><td colspan='8'><hr></td></tr>";
                }
                ?>
                            <tr>
                                <?php 
                $m = $entry['match_obj'];
                if ($been_there) {
                    echo '<td></td>';
                } else {
                    echo "<td><i>Top {$desc}: " . count($matches) . " times</i></td>";
                    $been_there = true;
                }
                ?>
                                <td><?php 
                echo get_alt_col('tours', 'tour_id', $m->f_tour_id, 'name');
                ?>
</td>
                                <td><?php 
                echo $p->owned_by_team_id == $m->team1_id ? $m->team2_name : $m->team1_name;
                ?>
</td>
                                <td><?php 
                echo $entry['td'];
                ?>
</td>
                                <td><?php 
                echo $entry['ki'];
                ?>
</td>
                                <td><?php 
                echo $m->team1_score . ' - ' . $m->team2_score;
                ?>
</td>
                                <td><?php 
                echo matchresult_icon($m->is_draw ? 'D' : ($m->winner == $p->owned_by_team_id ? 'W' : 'L'));
                ?>
</td>
                                <td><a href='javascript:void(0)' onClick="window.open('index.php?section=matches&amp;type=report&amp;mid=<?php 
                echo $m->match_id;
                ?>
');"><?php 
                echo $lng->getTrn('common/view');
                ?>
</a></td>
                            </tr>
                            <?php 
            }
        }
        ?>
                </table>
            </div>
        </div>
    </div>
    <?php 
    }
Exemplo n.º 9
0
function get_parent_name($type, $id, $parent_type)
{
    global $relations_node, $relations_obj;
    $relations = in_array($type, array_keys($relations_node)) ? $relations_node : $relations_obj;
    return get_alt_col($relations[$parent_type]['tbl'], $relations[$parent_type]['id'], get_parent_id($type, $id, $parent_type), 'name');
}
Exemplo n.º 10
0
    public static function main($argv)
    {
        // Check if teamid is provided, else show error mess
        $team_id = $_GET['team_id'];
        if (!get_alt_col('teams', 'team_id', $team_id, 'team_id')) {
            fatal("Invalid team ID.");
        }
        global $stars, $DEA, $rules, $skillarray, $inducements, $racesNoApothecary;
        // Move these constants to header.php?
        define('MAX_STARS', 2);
        define('MERC_EXTRA_COST', 30000);
        define('MERC_EXTRA_SKILL_COST', 50000);
        $ind_cost = 0;
        $redirectlink = 'handler.php?type=roster&detailed=0&team_id=' . $team_id;
        $t = new Team($team_id);
        $star_list[0] = '      <option value="0">-No Induced Stars-</option>' . "\n";
        foreach ($stars as $s => $d) {
            $star_list[0] .= "      <option " . (in_array($t->f_race_id, $d['races']) ? 'style="background-color: ' . COLOR_HTML_READY . ';" ' : '') . "value=\"{$d['id']}\">{$s}</option>\n";
        }
        ?>
<!--
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link type="text/css" href="css/stylesheet1.css" rel="stylesheet">
-->
<style type="text/css">
td { background-color: #EEEEEE; color: #000000; font: 13px Tahoma; }
td.indtitle { background-color: #EEEEEE; color: #000000; font: bold 12px Tahoma; }
td.boxie { background-color: #EEEEEE; color: #000000; }
td.cent { text-align: center; }
td.cent2 { text-align: center; background-color: #EEEEEE; color: #000000; }
td.right { text-align: right; background-color: #EEEEEE; color: #000000; }
</style>
<script language="javascript">
<!--
function SendToPDF()
{
    document.InduceForm.action = "<?php 
        print $redirectlink;
        ?>
"    // Redirect to pdf_roster
    document.InduceForm.submit();        // Submit the page
    return true;
}
-->
</script>
<!--
</head>
<body>
<div class="everything">
<div class="section">
-->
<?php 
        title('Inducements try-out');
        ?>
<form action="" method="post" name="InduceForm">

<table>
    <tr>
        <td class="indtitle">Star Name</td>
        <td class="indtitle">Cost</td>
        <td class="indtitle">MA</td>
        <td class="indtitle">ST</td>
        <td class="indtitle">AG</td>
        <td class="indtitle">AV</td>
        <td class="indtitle">Skills</td> <!-- <td>Cp</td><td>Td</td><td>Int</td><td>Cas</td><td>BH</td><td>Si</td><td>Ki</td><td>MVP</td><td>SPP</td> -->
    </tr>
<?php 
        $brick_n_grotty = false;
        $i = 1;
        while ($i <= MAX_STARS) {
            print "  <tr>\n";
            if (array_key_exists("Star{$i}", $_POST)) {
                $sid = $_POST["Star{$i}"];
                if ($sid != 0) {
                    $s = new Star($sid);
                    #      $s->setStats(false, false, false, false);
                    $star_list[$i] = $star_list[0];
                    if ($sid == "-6" || $sid == "-7") {
                        // Select Brick as selected and add row for Grotty later
                        $brick_n_grotty = true;
                        $star_list[$i] = str_replace('option value="-6"', 'option selected value="-6"', $star_list[$i]);
                        // Hardcoded Brick
                        $star_list[$i] = str_replace('option style="background-color: ' . COLOR_HTML_READY . ';" value="-6"', 'option selected style="background-color: ' . COLOR_HTML_READY . ';" value="-6"', $star_list[$i]);
                        $sid = -6;
                        $s = new Star($sid);
                        // Making sure to switch from Grotty to Brick
                        #        $s->setStats(false, false, false, false);
                        $star_list[0] = str_replace('      <option value="-6">Brick Far\'th (+ Grotty)</option>' . "\n", '', $star_list[0]);
                        // Removing Brick from second row
                        $star_list[0] = str_replace('      <option style="background-color: ' . COLOR_HTML_READY . ';" value="-6">Brick Far\'th (+ Grotty)</option>' . "\n", '', $star_list[0]);
                        $star_list[0] = str_replace('      <option value="-7">Grotty (included in Brick Far\'th)</option>' . "\n", '', $star_list[0]);
                        // Removing Grotty from second row
                        $star_list[0] = str_replace('      <option style="background-color: ' . COLOR_HTML_READY . ';" value="-7">Grotty (included in Brick Far\'th)</option>' . "\n", '', $star_list[0]);
                    } else {
                        $star_list[$i] = str_replace('option value="' . $sid . '"', 'option selected value="' . $sid . '"', $star_list[$i]);
                        $star_list[$i] = str_replace('option style="background-color: ' . COLOR_HTML_READY . ';" value="' . $sid . '"', 'option selected style="background-color: ' . COLOR_HTML_READY . ';" value="' . $sid . '"', $star_list[$i]);
                        $star_list[0] = str_replace('<option value="' . $sid . '">' . $s->name . "</option>\n", '', $star_list[0]);
                        $star_list[0] = str_replace('option style="background-color: ' . COLOR_HTML_READY . ';" value="' . $sid . '">' . $s->name . "</option>\n", '', $star_list[0]);
                    }
                    print '    <td class="boxie"><SELECT name="Star' . $i . '" onChange="this.form.submit()">' . "\n";
                    print $star_list[$i];
                    print '    </SELECT></td>' . "\n";
                    print '<td class="cent">' . str_replace('000', '', $s->cost) . "k</td>\n<td class=\"cent\">" . $s->ma . "</td>\n<td class=\"cent\">" . $s->st . "</td>\n<td class=\"cent\">" . $s->ag . "</td>\n<td class=\"cent\">" . $s->av . "</td>\n<td>\n<small>" . skillsTrans($s->skills) . "</small></td>\n";
                    //      print "<td>".$s->cp."</td>\n<td>".$s->td."</td>\n<td>".$s->intcpt."</td>\n<td>".$s->cas."</td>\n<td>".$s->bh."</td>\n<td>".$s->si."</td>\n<td>".$s->ki."</td>\n<td>".$s->mvp."</td>\n<td>".$s->spp."</td>\n<td>";
                    print "</tr>\n";
                    $ind_cost += $s->cost;
                    $i++;
                    continue;
                }
            }
            print '    <td class="boxie"><SELECT name="Star' . $i . '" onChange="this.form.submit()">' . "\n";
            print $star_list[0];
            print '    </SELECT>' . "\n";
            print '</tr>' . "\n";
            $i++;
            break;
        }
        if ($brick_n_grotty) {
            // Print Grotty and add hidden input field
            $sid = -7;
            // ID for Grotty hardcoded :-P
            $s = new Star($sid);
            #  $s->setStats(false, false, false, false);
            echo '<tr>';
            $grotty_nr = MAX_STARS + 1;
            echo '<td>' . $s->name . '<input type="hidden" name="Star' . $grotty_nr . '" value="-7"></td>';
            print "<td class=\"cent\">" . str_replace('000', '', $s->cost) . "k</td>\n<td class=\"cent\">" . $s->ma . "</td>\n<td class=\"cent\">" . $s->st . "</td>\n<td class=\"cent\">" . $s->ag . "</td>\n<td class=\"cent\">" . $s->av . "</td>\n<td>\n<small>" . implode(', ', skillsTrans($s->skills)) . "</small></td>\n";
            //  print "<td>".$s->cp."</td>\n<td>".$s->td."</td>\n<td>".$s->intcpt."</td>\n<td>".$s->cas."</td>\n<td>".$s->bh."</td>\n<td>".$s->si."</td>\n<td>".$s->ki."</td>\n<td>".$s->mvp."</td>\n<td>".$s->spp."</td>\n<td>";
            print "</tr>\n";
        }
        ?>
</table>
<table>
    <tr>
        <td class="indtitle">Mercenaries</td>
        <td class="indtitle">Position</td>
        <td class="indtitle">Cost</td>
        <td class="indtitle">MA</td>
        <td class="indtitle">ST</td>
        <td class="indtitle">AG</td>
        <td class="indtitle">AV</td>
        <td class="indtitle">Skills</td>
        <td class="indtitle">Extra Skill</td>
    </tr>
<?php 
        // Validate to not exceed maximum number of positionals? Leaving it open for now.
        $merc_list[0] = '            <option value="0">-No Induced Mercs-</option>' . "\n";
        $merc = array(0 => 'No Merc');
        $i = 0;
        foreach ($DEA[$t->f_rname]["players"] as $p => $m) {
            $i++;
            $merc_list[0] .= '            <option value="' . "{$i}" . '">' . "Merc {$p}" . '</option>' . "\n";
            array_push($merc, $m);
            $pos[$i] = $p;
        }
        $i = 1;
        while (isset($_POST["Merc{$i}"])) {
            print "    <tr>\n";
            if ($_POST["Merc{$i}"] != '0') {
                $mid = $_POST["Merc{$i}"];
                if (isset($_POST["Extra{$i}"])) {
                    $extra_skill_cost = $_POST["Extra{$i}"] == '-No Extra Skill-' ? 0 : MERC_EXTRA_SKILL_COST;
                    $extra[$i] = $_POST["Extra{$i}"];
                } else {
                    $extra_skill_cost = 0;
                    $extra[$i] = false;
                }
                // Fill skill list from what normal skills positional has to chose from
                $n_skills = $DEA[$t->f_rname]['players'][str_replace('Merc ', '', $pos[$mid])]['norm'];
                $extra_list[$i] = "            <option>-No Extra Skill-</option>\n";
                foreach ($n_skills as $category) {
                    foreach ($skillarray[$category] as $id => $skill) {
                        if (!in_array($id, $merc[$mid]["def"])) {
                            $extra_list[$i] .= '<option>' . skillsTrans($id) . '</option>' . "\n";
                        }
                    }
                }
                $merc_list[$i] = str_replace('<option value="' . $mid . '"', '<option selected value="' . $mid . '"', $merc_list[0]);
                print '        <td><SELECT name="Merc' . $i . '" onChange="this.form.submit()">' . "\n";
                print $merc_list[$i];
                $cost[$i] = (int) $merc[$mid]["cost"] + MERC_EXTRA_COST + $extra_skill_cost;
                echo "        </SELECT></td>\n";
                if (!in_array(99, $merc[$mid]["def"])) {
                    array_unshift($merc[$mid]["def"], 99);
                }
                // Adding Loner to default skills if Merc does not have Loner already
                $def_skills = skillsTrans($merc[$mid]["def"]);
                if (empty($def_skills)) {
                    $def_skills[] = '&nbsp;';
                }
                print "        <td>{$pos[$mid]}</td><td>" . str_replace('000', '', $cost[$i]) . "k</td><td class=\"cent\">" . $merc[$mid]["ma"] . "</td><td class=\"cent\">" . $merc[$mid]["st"] . "</td>";
                print "<td class=\"cent\">" . $merc[$mid]["ag"] . "</td><td class=\"cent\">" . $merc[$mid]["av"] . "</td><td><small>" . implode(', ', $def_skills) . "</small></td>\n";
                if ($extra[$i] != false) {
                    $extra_list[$i] = str_replace('<option>' . $extra[$i] . '</option>', '<option selected>' . $extra[$i] . '</option>', $extra_list[$i]);
                }
                echo '        <td><SELECT name="Extra' . $i . '" onChange="this.form.submit()">' . "\n";
                print $extra_list[$i];
                echo "        </SELECT></td>\n";
                echo "    </tr>\n";
                $ind_cost += $cost[$i];
                $i++;
                continue;
            } else {
                $merc_list[$i] = $merc_list[0];
                break;
            }
        }
        echo "    <tr>\n";
        echo '      <td><SELECT name="Merc' . $i . '" onChange="this.form.submit()">' . "\n";
        print $merc_list[0];
        echo "      </SELECT></td>\n";
        echo "    </tr>\n";
        ?>

</table>
<table>
<tr><td>
<table>
    <tr>
        <td class="indtitle">Inducement</td>
        <td class="indtitle">#</td>
        <td class="indtitle">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
        <td class="indtitle">Cost</td>
        <td class="indtitle">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
        <td class="indtitle">Total Cost</td>
    </tr>
<?php 
        // Regular inducements
        $r = $t->f_rname;
        $rid = $t->f_race_id;
        // Checking if team can hire Igor or Wandering Apo
        unset($inducements[in_array($rid, $racesNoApothecary) ? 'Wandering Apothecaries' : 'Igor']);
        foreach ($inducements as $ind_name => $ind) {
            $this_cost = $ind[in_array($rid, $ind['reduced_cost_races']) ? 'reduced_cost' : 'cost'];
            # Reduced cost?
            echo '<tr>';
            print '<td>' . $ind_name . ' (0-' . $ind['max'] . ')</td>';
            echo '<td><SELECT name="' . str_replace(' ', '_', $ind_name) . '" onChange="this.form.submit()">';
            // Changing spaces to underscores for (ugly?) POST workaround
            $ind_list = "<option>0</option>\n";
            for ($i = 1; $i <= $ind['max']; $i++) {
                $ind_list .= '<option>' . $i . "</option>\n";
            }
            $pi = 0;
            if (isset($_POST[str_replace(' ', '_', $ind_name)])) {
                $pi = $_POST[str_replace(' ', '_', $ind_name)];
                if ($pi != 0) {
                    $ind_list = str_replace('<option>' . $pi . '</option>', '<option selected>' . $pi . '</option>', $ind_list);
                }
            }
            print $ind_list;
            echo '</SELECT></td>';
            echo '<td class="cent2">x</td><td class="cent">' . $this_cost / 1000 . 'k</td>';
            echo '<td class="cent2">=</td>';
            $ind_cost += $pi * $this_cost;
            echo '<td class="cent">' . $pi * $this_cost / 1000 . 'k</td>';
            echo '</tr>';
        }
        // Cards
        $card_list = '';
        # Declare.
        echo '<tr>';
        echo '<td>Card budget</td><td class="cent2">&nbsp;</td><td class="cent2">&nbsp;</td>';
        echo '<td><SELECT name="Card" onChange="this.form.submit()">';
        for ($i = 0; $i <= 1000; $i += 50) {
            $card_list .= '<option>' . $i . "k</option>\n";
        }
        $cardb = '';
        if (isset($_POST["Card"])) {
            $cardb = $_POST["Card"];
            if ($cardb != 0) {
                $card_list = str_replace('<option>' . $cardb . '</option>', '<option selected>' . $cardb . '</option>', $card_list);
            }
        }
        $card_cost = str_replace('k', '', $cardb);
        $ind_cost += $card_cost * 1000;
        print $card_list;
        echo '</SELECT></td>';
        echo '<td class="cent2">=</td><td class="cent">' . $cardb . '</td>';
        echo '</tr>';
        ?>
<tr>
<td class="right" colspan="6"><br><input type="submit" name="Submit" value="Create PDF roster" onclick="return SendToPDF();"></td></tr>
<tr><td><a href="<?php 
        echo urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $team_id, false, false);
        ?>
"> <- Back to team page</a></td></tr>
</table>
</td><td class="cent2">
<table>
<?php 
        function kilo($str)
        {
            if (strpos($str, '000000')) {
                return str_replace('000', '', $str) . '000';
            } else {
                return str_replace('000', '', $str);
            }
        }
        echo '<tr><td class="indtitle">Team Value:</td><td class="indtitle">' . kilo($t->value) . 'k</td></tr>';
        echo '<tr><td class="indtitle">Inducements Value:</td><td class="indtitle">' . kilo($ind_cost) . 'k</td></tr>';
        echo '<tr><td class="indtitle">Match Value:</td><td class="indtitle">' . kilo($ind_cost + $t->value) . 'k</td></tr>';
        ?>

</table>
</td>
</tr>

</table>
</form>
<!--
</div>
</div>
</body>
</html>
-->

<?php 
    }
Exemplo n.º 11
0
 foreach ($team_ids as $tid) {
     $query = "SELECT (t.f_did = {$did}) AS 'in_did', (t.f_lid = {$lid}) AS 'in_lid' FROM teams AS t WHERE t.team_id = {$tid}";
     $result = mysql_query($query);
     if ($result) {
         $state = mysql_fetch_assoc($result);
         if (!$state['in_lid']) {
             $teams_OK['l'] = false;
             break;
         }
         if ($TIE_TEAMS && !$state['in_did']) {
             $teams_OK['d'] = false;
             break;
         }
     }
 }
 $errors = array(array(!$nameSet && !$addMatchToFFA, "Please fill out the tournament name."), array($nameSet && get_alt_col('tours', 'name', $_POST['name'], 'tour_id'), "Tournament name already in use."), array(!$teams_OK['d'], 'You may not schedule matches between teams from different divisions in the selected league.'), array(!$teams_OK['l'], 'You may not schedule matches between teams from different leagues OR one or more of the selected teams are not from the chosen league.'), array($leagues[$lid]['ring'] != Coach::T_RING_LOCAL_ADMIN, 'You do not have the rights to schedule matches in the selected league.'), array($_POST['type'] == 'RR_TOUR' && $teamsCount < 3, 'Please select at least 3 teams'), array($_POST['type'] == 'FFA_TOUR' && $teamsCount % 2 != 0, 'Please select an even number of teams'));
 // Print errors.
 $STATUS = true;
 foreach ($errors as $e) {
     if ($e[0]) {
         status(false, $e[1] . "<br>\n");
         $STATUS = false;
     }
 }
 /*
     Input modification.
 */
 if ($nameSet && get_magic_quotes_gpc()) {
     $_POST['name'] = stripslashes($_POST['name']);
 }
 // Shuffle team list if multiple teams are scheduled to play a FFA.
Exemplo n.º 12
0
 public function __construct($mid)
 {
     parent::__construct($mid);
     $this->hash_botocs = get_alt_col('leegmgr_matches', 'mid', $mid, 'hash');
 }
Exemplo n.º 13
0
function sec_main()
{
    global $settings, $rules, $coach, $lng, $leagues;
    MTS('Main start');
    list($sel_lid, $HTML_LeagueSelector) = HTMLOUT::simpleLeagueSelector();
    $IS_GLOBAL_ADMIN = is_object($coach) && $coach->ring == Coach::T_RING_GLOBAL_ADMIN;
    /*
     *  Was any main board actions made?
     */
    if (isset($_POST['type']) && is_object($coach) && $coach->isNodeCommish(T_NODE_LEAGUE, $sel_lid)) {
        if (get_magic_quotes_gpc()) {
            if (isset($_POST['title'])) {
                $_POST['title'] = stripslashes($_POST['title']);
            }
            if (isset($_POST['txt'])) {
                $_POST['txt'] = stripslashes($_POST['txt']);
            }
        }
        $msg = isset($_POST['msg_id']) ? new Message((int) $_POST['msg_id']) : null;
        switch ($_POST['type']) {
            case 'msgdel':
                status($msg->delete());
                break;
            case 'msgnew':
                status(Message::create(array('f_coach_id' => $coach->coach_id, 'f_lid' => $IS_GLOBAL_ADMIN && isset($_POST['BC']) && $_POST['BC'] ? Message::T_BROADCAST : $sel_lid, 'title' => $_POST['title'], 'msg' => $_POST['txt'])));
                break;
            case 'msgedit':
                status($msg->edit($_POST['title'], $_POST['txt']));
                break;
            case 'pin':
                status($msg->pin(1));
                break;
            case 'unpin':
                status($msg->pin(0));
                break;
        }
    }
    /*
     *  Now we are ready to generate the HTML code.
     */
    ?>
    <div class="main_head"><?php 
    echo $settings['league_name'];
    ?>
</div>
    <div class='main_leftColumn'>
        <div class="main_leftColumn_head">
            <?php 
    echo "<div class='main_leftColumn_welcome'>\n";
    echo $settings['welcome'];
    echo "</div>\n";
    echo "<div class='main_leftColumn_left'>\n";
    if (count($leagues) > 1) {
        echo $HTML_LeagueSelector;
    }
    echo "</div>\n";
    echo "<div class='main_leftColumn_right'>\n";
    if (is_object($coach) && $coach->isNodeCommish(T_NODE_LEAGUE, $sel_lid)) {
        echo "<a href='javascript:void(0);' onClick=\"slideToggle('msgnew');\">" . $lng->getTrn('main/newmsg') . "</a>&nbsp;\n";
    }
    if (Module::isRegistered('RSSfeed')) {
        echo "<a href='handler.php?type=rss'>RSS</a>\n";
    }
    echo "</div>\n";
    ?>
            <div style="display:none; clear:both;" id="msgnew">
                <br><br>
                <form method="POST">
                    <textarea name="title" rows="1" cols="50"><?php 
    echo $lng->getTrn('common/notitle');
    ?>
</textarea><br><br>
                    <textarea name="txt" rows="15" cols="50"><?php 
    echo $lng->getTrn('common/nobody');
    ?>
</textarea><br><br>
                    <?php 
    if ($IS_GLOBAL_ADMIN) {
        echo $lng->getTrn('main/broadcast');
        ?>
<input type="checkbox" name="BC"><br><br><?php 
    }
    ?>
                    <input type="hidden" name="type" value="msgnew">
                    <input type="submit" value="<?php 
    echo $lng->getTrn('common/submit');
    ?>
">
                </form>
            </div>
        </div>

        <?php 
    /*
        Generate main board.
    
        Left column is the message board, consisting of both commissioner messages and game summaries/results.
        To generate this table we create a general array holding the content of both.
    */
    $j = 1;
    $prevPinned = 0;
    foreach (TextSubSys::getMainBoardMessages($settings['fp_messageboard']['length'], $sel_lid, $settings['fp_messageboard']['show_team_news'], $settings['fp_messageboard']['show_match_summaries']) as $e) {
        if ($prevPinned == 1 && !$e->pinned) {
            echo "<hr>\n";
        }
        $prevPinned = $e->pinned;
        echo "<div class='boxWide'>\n";
        echo "<h3 class='boxTitle{$e->cssidx}'>{$e->title}</h3>\n";
        echo "<div class='boxBody'>\n";
        $fmtMsg = fmtprint($e->message);
        # Basic supported syntax: linebreaks.
        echo "\r\n                    <div id='e{$j}' class='expandable'>{$fmtMsg}</div>\r\n                    <script type='text/javascript'>\r\n                      \$('#e{$j}').expander({\r\n                        slicePoint:       300,\r\n                        expandText:       '" . $lng->getTrn('main/more') . "',\r\n                        collapseTimer:    0,\r\n                        userCollapseText: ''\r\n                      });\r\n                      </script>";
        echo "<br><hr>\n";
        echo "<table class='boxTable'><tr>\n";
        switch ($e->type) {
            case T_TEXT_MATCH_SUMMARY:
                echo "<td align='left' width='100%'>" . $lng->getTrn('main/posted') . " " . textdate($e->date) . " " . (isset($e->date_mod) && $e->date_mod != $e->date ? "(" . $lng->getTrn('main/lastedit') . " " . textdate($e->date_mod) . ") " : '') . $lng->getTrn('main/by') . " {$e->author}</td>\n";
                echo "<td align='right'><a href='index.php?section=matches&amp;type=report&amp;mid={$e->match_id}'>" . $lng->getTrn('common/view') . "</a></td>\n";
                break;
            case T_TEXT_MSG:
                echo "<td align='left' width='100%'>" . $lng->getTrn('main/posted') . " " . textdate($e->date) . " " . $lng->getTrn('main/by') . " {$e->author}</td>\n";
                if (is_object($coach) && ($IS_GLOBAL_ADMIN || $coach->coach_id == $e->author_id)) {
                    // Only admins may delete messages, or if it's a commissioner's own message.
                    echo "<td align='right'><a href='javascript:void(0);' onClick=\"slideToggle('msgedit{$e->msg_id}');\">" . $lng->getTrn('common/edit') . "</a></td>\n";
                    echo "<td align='right'>";
                    $fieldname = 'pin';
                    if ($e->pinned) {
                        $fieldname = 'unpin';
                    }
                    echo inlineform(array('type' => "{$fieldname}", 'msg_id' => $e->msg_id), "{$fieldname}{$e->msg_id}", $lng->getTrn("main/{$fieldname}"));
                    echo "</td>";
                    echo "<td align='right'>";
                    echo inlineform(array('type' => 'msgdel', 'msg_id' => $e->msg_id), "msgdel{$e->msg_id}", $lng->getTrn('common/delete'));
                    echo "</td>";
                }
                break;
            case T_TEXT_TNEWS:
                echo "<td align='left' width='100%'>" . $lng->getTrn('main/posted') . " " . textdate($e->date) . "</td>\n";
                break;
        }
        ?>
                    </tr></table>
                    <?php 
        if ($e->type == T_TEXT_MSG) {
            echo "<div style='display:none;' id='msgedit{$e->msg_id}'>\n";
            echo "<hr><br>\n";
            echo '<form method="POST">
                            <textarea name="title" rows="1" cols="50">' . $e->title . '</textarea><br><br>
                            <textarea name="txt" rows="15" cols="50">' . $e->message . '</textarea><br><br>
                            <input type="hidden" name="type" value="msgedit">
                            <input type="hidden" name="msg_id" value="' . $e->msg_id . '">
                            <input type="submit" value="' . $lng->getTrn('common/submit') . '">
                        </form>';
            echo "</div>";
        }
        ?>
                </div>
            </div>
            <?php 
        $j++;
    }
    ?>

    </div>
    <?php 
    MTS('Board messages generated');
    /*
        The right hand side column optionally (depending on settings) contains standings, latest game results, touchdown and casualties stats.
        We will now generate the stats, so that they are ready to be printed in correct order.
    */
    echo "<div class='main_rightColumn'>\n";
    $boxes_all = array_merge($settings['fp_standings'], $settings['fp_leaders'], $settings['fp_events'], $settings['fp_latestgames']);
    usort($boxes_all, create_function('$a,$b', 'return (($a["box_ID"] > $b["box_ID"]) ? 1 : (($a["box_ID"] < $b["box_ID"]) ? -1 : 0) );'));
    $boxes = array();
    foreach ($boxes_all as $box) {
        # These fields distinguishes the box types.
        if (isset($box['fields'])) {
            $box['dispType'] = 'standings';
        } else {
            if (isset($box['field'])) {
                $box['dispType'] = 'leaders';
            } else {
                if (isset($box['content'])) {
                    $box['dispType'] = 'events';
                } else {
                    $box['dispType'] = 'latestgames';
                }
            }
        }
        switch ($box['type']) {
            case 'league':
                $_type = T_NODE_LEAGUE;
                break;
            case 'division':
                $_type = T_NODE_DIVISION;
                break;
            case 'tournament':
                $_type = T_NODE_TOURNAMENT;
                break;
            default:
                $_type = T_NODE_LEAGUE;
        }
        $box['type'] = $_type;
        $boxes[] = $box;
    }
    // Used in the below standings dispType boxes.
    global $core_tables, $ES_fields;
    $_MV_COLS = array_merge(array_keys($core_tables['mv_teams']), array_keys($ES_fields));
    $_MV_RG_INTERSECT = array_intersect(array_keys($core_tables['teams']), array_keys($core_tables['mv_teams']));
    // Let's print those boxes!
    foreach ($boxes as $box) {
        switch ($box['dispType']) {
            case 'standings':
                $_BAD_COLS = array();
                # Halt on these columns/fields.
                switch ($box['type']) {
                    case T_NODE_TOURNAMENT:
                        if (!get_alt_col('tours', 'tour_id', $box['id'], 'tour_id')) {
                            break 2;
                        }
                        $tour = new Tour($box['id']);
                        $SR = array_map(create_function('$val', 'return $val[0]."mv_".substr($val,1);'), $tour->getRSSortRule());
                        break;
                    case T_NODE_DIVISION:
                        $_BAD_COLS = array('elo', 'swon', 'slost', 'sdraw', 'win_pct');
                        # Divisions do not have pre-calculated, MV, values of these fields.
                        // Fall through!
                    # Divisions do not have pre-calculated, MV, values of these fields.
                    // Fall through!
                    case T_NODE_LEAGUE:
                    default:
                        global $hrs;
                        $SR = $hrs[$box['HRS']]['rule'];
                        foreach ($SR as &$f) {
                            $field = substr($f, 1);
                            if (in_array($field, $_MV_RG_INTERSECT)) {
                                if (in_array($field, $_BAD_COLS)) {
                                    # E.g. divisions have no win_pct record for teams like the mv_teams table (for tours) has.
                                    fatal("Sorry, the element '{$field}' in your specified house sortrule #{$box['HRS']} is not supported for your chosen type (ie. tournament/division/league).");
                                }
                                $f = $f[0] . "rg_" . substr($f, 1);
                            } else {
                                $f = $f[0] . "mv_" . substr($f, 1);
                            }
                        }
                        break;
                }
                list($teams, ) = Stats::getRaw(T_OBJ_TEAM, array($box['type'] => $box['id']), array(1, $box['length']), $SR, false);
                ?>
            <div class='boxWide'>
                <h3 class='boxTitle<?php 
                echo T_HTMLBOX_STATS;
                ?>
'><?php 
                echo $box['title'];
                ?>
</h3>
                <div class='boxBody'>
                    <table class="boxTable">
                        <?php 
                echo "<tr>\n";
                foreach ($box['fields'] as $title => $f) {
                    echo "<td><i>{$title}</i></td>\n";
                }
                echo "</tr>\n";
                foreach ($teams as $t) {
                    if (!$t['retired']) {
                        echo "<tr>\n";
                        foreach ($box['fields'] as $title => $f) {
                            if (in_array($f, $_MV_COLS)) {
                                $f = 'mv_' . $f;
                            }
                            echo "<td>";
                            if ($settings['fp_links'] && $f == 'name') {
                                echo "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $t['team_id'], false, false) . "'>{$t['name']}</a>";
                            } elseif (is_numeric($t[$f]) && !ctype_digit($t[$f][0] == '-' ? substr($t[$f], 1) : $t[$f])) {
                                echo sprintf('%1.2f', $t[$f]);
                            } else {
                                echo in_array($f, array('tv')) ? $t[$f] / 1000 : $t[$f];
                            }
                            echo "</td>\n";
                        }
                        echo "</tr>\n";
                    }
                }
                ?>
                    </table>
                    <?php 
                if (isset($box['infocus']) && $box['infocus']) {
                    echo "<hr>";
                    _infocus($teams);
                }
                ?>
                </div>
            </div>
            <?php 
                MTS('Standings table generated');
                break;
            case 'latestgames':
                if ($box['length'] <= 0) {
                    break;
                }
                ?>
            <div class="boxWide">
                <h3 class='boxTitle<?php 
                echo T_HTMLBOX_MATCH;
                ?>
'><?php 
                echo $box['title'];
                ?>
</h3>
                <div class='boxBody'>
                    <table class="boxTable">
                        <tr>
                            <td style="text-align: right;" width="50%"><i><?php 
                echo $lng->getTrn('common/home');
                ?>
</i></td>
                            <td> </td>
                            <td style="text-align: left;" width="50%"><i><?php 
                echo $lng->getTrn('common/away');
                ?>
</i></td>
                            <td><i><?php 
                echo $lng->getTrn('common/date');
                ?>
</i></td>
                            <td> </td>
                        </tr>
                        <?php 
                list($matches, $pages) = Match::getMatches(array(1, $box['length']), $box['type'], $box['id'], false);
                foreach ($matches as $m) {
                    echo "<tr valign='top'>\n";
                    $t1name = $settings['fp_links'] ? "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team1_id, false, false) . "'>{$m->team1_name}</a>" : $m->team1_name;
                    $t2name = $settings['fp_links'] ? "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team2_id, false, false) . "'>{$m->team2_name}</a>" : $m->team2_name;
                    echo "<td style='text-align: right;'>{$t1name}</td>\n";
                    echo "<td><nobr>{$m->team1_score}&mdash;{$m->team2_score}</nobr></td>\n";
                    echo "<td style='text-align: left;'>{$t2name}</td>\n";
                    echo "<td>" . str_replace(' ', '&nbsp;', textdate($m->date_played, true)) . "</td>";
                    echo "<td><a href='index.php?section=matches&amp;type=report&amp;mid={$m->match_id}'>Show</a></td>";
                    echo "</tr>";
                }
                ?>
                    </table>
                </div>
            </div>
            <?php 
                MTS('Latest matches table generated');
                break;
            case 'leaders':
                $f = 'mv_' . $box['field'];
                list($players, ) = Stats::getRaw(T_OBJ_PLAYER, array($box['type'] => $box['id']), array(1, $box['length']), array('-' . $f), false);
                ?>
            <div class="boxWide">
                <h3 class='boxTitle<?php 
                echo T_HTMLBOX_STATS;
                ?>
'><?php 
                echo $box['title'];
                ?>
</h3>
                <div class='boxBody'>
                    <table class="boxTable">
                        <tr>
                            <td><i><?php 
                echo $lng->getTrn('common/name');
                ?>
</i></td>
                            <?php 
                if ($box['show_team']) {
                    ?>
<td><i><?php 
                    echo $lng->getTrn('common/team');
                    ?>
</i></td><?php 
                }
                ?>
                            <td><i>#</i></td>
                            <td><i><?php 
                echo $lng->getTrn('common/value');
                ?>
</i></td>
                        </tr>
                        <?php 
                foreach ($players as $p) {
                    echo "<tr>\n";
                    echo "<td>" . ($settings['fp_links'] ? "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_PLAYER, $p['player_id'], false, false) . "'>{$p['name']}</a>" : $p['name']) . "</td>\n";
                    if ($box['show_team']) {
                        echo "<td>" . ($settings['fp_links'] ? "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $p['owned_by_team_id'], false, false) . "'>{$p['f_tname']}</a>" : $p['f_tname']) . "</td>\n";
                    }
                    echo "<td>" . $p[$f] . "</td>\n";
                    echo "<td>" . $p['value'] / 1000 . "k</td>\n";
                    echo "</tr>";
                }
                ?>
                    </table>
                </div>
            </div>
            <?php 
                MTS('Leaders standings generated');
                break;
            case 'events':
                $events = _events($box['content'], $box['type'], $box['id'], $box['length']);
                ?>
            <div class="boxWide">
                <h3 class='boxTitle<?php 
                echo T_HTMLBOX_STATS;
                ?>
'><?php 
                echo $box['title'];
                ?>
</h3>
                <div class='boxBody'>
                    <table class="boxTable">
                        <?php 
                $head = array_pop($events);
                echo "<tr>\n";
                foreach ($head as $col => $name) {
                    echo "<td><i>{$name}</i></td>\n";
                }
                echo "</tr>\n";
                foreach ($events as $e) {
                    echo "<tr>\n";
                    foreach ($head as $col => $name) {
                        switch ($col) {
                            case 'date':
                                $e->{$col} = str_replace(' ', '&nbsp;', textdate($e->{$col}, true));
                                break;
                            case 'name':
                                if ($settings['fp_links']) {
                                    $e->{$col} = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_PLAYER, $e->pid, false, false) . "'>" . $e->{$col} . "</a>";
                                }
                                break;
                            case 'tname':
                                if ($settings['fp_links']) {
                                    $e->{$col} = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $e->f_tid, false, false) . "'>" . $e->{$col} . "</a>";
                                }
                                break;
                            case 'rname':
                                if ($settings['fp_links']) {
                                    $e->{$col} = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_RACE, $e->f_rid, false, false) . "'>" . $e->{$col} . "</a>";
                                }
                                break;
                            case 'f_pos_name':
                                if ($settings['fp_links']) {
                                    $e->{$col} = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_RACE, $e->f_rid, false, false) . "'>" . $e->{$col} . "</a>";
                                }
                                break;
                            case 'value':
                                $e->{$col} = $e->{$col} / 1000 . 'k';
                                break;
                        }
                        echo "<td>" . $e->{$col} . "</td>\n";
                    }
                    echo "</tr>\n";
                }
                ?>
                    </table>
                </div>
            </div>
            <?php 
                MTS('Events box generated');
                break;
        }
    }
    ?>
    </div>
    <div class="main_foot">
        <?php 
    HTMLOUT::dnt();
    ?>
        <br>
        <a TARGET="_blank" href="http://nicholasmr.dk/index.php?sec=obblm">OBBLM official website</a><br><br>
        This web site is completely unofficial and in no way endorsed by Games Workshop Limited.
        <br>
        Bloodquest, Blood Bowl, the Blood Bowl logo, The Blood Bowl Spike Device, Chaos, the Chaos device, the Chaos logo, Games Workshop, Games Workshop logo, Nurgle, the Nurgle device, Skaven, Tomb Kings, and all associated marks, names, races, race insignia, characters, vehicles, locations, units, illustrations and images from the Blood Bowl game, the Warhammer world are either (R), TM and/or (C) Games Workshop Ltd 2000-2006, variably registered in the UK and other countries around the world. Used without permission. No challenge to their status intended. All Rights Reserved to their respective owners.
    </div>
    <?php 
}
Exemplo n.º 14
0
    protected static function _teamsSelect()
    {
        global $lng;
        $_SUBMITTED = isset($_POST['team1_as']) && isset($_POST['team2_as']) && $_POST['team1_as'] && $_POST['team2_as'];
        $t1 = $t2 = '';
        if ($_SUBMITTED) {
            $t1 = $_POST['team1_as'];
            $t2 = $_POST['team2_as'];
        }
        ?>
    <br>
    <center>
    <form method='POST'>
    <input type="text" id='team1_as' name="team1_as" size="30" maxlength="50" value="<?php 
        echo $t1;
        ?>
">
    <script>
        $(document).ready(function(){
            var options, a;

            options = {
                minChars:3,
                    serviceUrl:'handler.php?type=autocomplete&obj=<?php 
        echo T_OBJ_TEAM;
        ?>
',
            };
            a = $('#team1_as').autocomplete(options);
        });
    </script>
        VS.
    <input type="text" id='team2_as' name="team2_as" size="30" maxlength="50" value="<?php 
        echo $t2;
        ?>
">
    <script>
        $(document).ready(function(){
            var options, b;

            options = {
                minChars:3,
                    serviceUrl:'handler.php?type=autocomplete&obj=<?php 
        echo T_OBJ_TEAM;
        ?>
',
            };
            b = $('#team2_as').autocomplete(options);
        });
    </script>
    <br><br>
    <input type="submit" name="compare" value="<?php 
        echo $lng->getTrn('cmp', __CLASS__);
        ?>
!">
    </form>
    </center>
    <br>
    <?php 
        return $_SUBMITTED ? array(get_alt_col('teams', 'name', $t1, 'team_id'), get_alt_col('teams', 'name', $t2, 'team_id')) : null;
    }
Exemplo n.º 15
0
 public static function getMainBoardMessages($n, $lid = false, $get_tnews = true, $get_summaries = true)
 {
     global $settings;
     $board = array();
     // First we add all commissioner messages to the board structure.
     foreach (Message::getMessages($n, $lid) as $m) {
         $o = (object) array();
         // Specific fields:
         $o->msg_id = $m->msg_id;
         $o->author_id = $m->f_coach_id;
         // General fields:
         $o->cssidx = T_HTMLBOX_ADMIN;
         // CSS box index
         $o->type = T_TEXT_MSG;
         $o->author = get_alt_col('coaches', 'coach_id', $m->f_coach_id, 'name');
         $o->title = $m->title;
         $o->message = $m->message;
         $o->date = $m->date_posted;
         $o->pinned = $m->pinned;
         array_push($board, $o);
     }
     // Now we add all game summaries.
     if ($get_summaries) {
         foreach (MatchSummary::getSummaries($n, $lid) as $r) {
             $o = (object) array();
             $m = new Match($r->match_id);
             // Specific fields:
             $o->date_mod = $m->date_modified;
             $o->match_id = $m->match_id;
             // General fields:
             $o->cssidx = T_HTMLBOX_MATCH;
             // CSS box index
             $o->type = T_TEXT_MATCH_SUMMARY;
             $o->author = get_alt_col('coaches', 'coach_id', $m->submitter_id, 'name');
             $o->title = "Match: {$m->team1_name} {$m->team1_score}&mdash;{$m->team2_score} {$m->team2_name}";
             $o->message = $m->getText();
             $o->date = $m->date_played;
             $o->pinned = 0;
             // Not allowed for other types than board messages
             array_push($board, $o);
         }
     }
     // And finally team news.
     if ($get_tnews) {
         foreach (TeamNews::getNews(false, $n, $lid) as $t) {
             $o = (object) array();
             // Specific fields:
             # none
             // General fields:
             $o->cssidx = T_HTMLBOX_INFO;
             // CSS box index
             $o->type = T_TEXT_TNEWS;
             $o->author = get_alt_col('teams', 'team_id', $t->f_id, 'name');
             $o->title = "Team news: {$o->author}";
             $o->message = $t->txt;
             $o->date = $t->date;
             $o->pinned = 0;
             // Not allowed for other types than board messages
             array_push($board, $o);
         }
     }
     // Last touch on the board.
     if (!empty($board)) {
         objsort($board, array('-pinned', '-date'));
         if ($n) {
             $board = array_slice($board, 0, $n);
         }
     }
     return $board;
 }
Exemplo n.º 16
0
 public static function edit($pid, $title, $about)
 {
     $ENTRY_EXISTS = get_alt_col('cemetery', 'pid', $pid, 'date');
     if ($ENTRY_EXISTS) {
         $query = "UPDATE cemetery SET \n            title = '" . mysql_real_escape_string($title) . "', \n            about = '" . mysql_real_escape_string($about) . "' \n            WHERE pid = {$pid}";
         return mysql_query($query);
     } else {
         $query = "INSERT INTO cemetery \n            (pid, title, about, date) \n            VALUES \n            ({$pid}, '" . mysql_real_escape_string($title) . "', '" . mysql_real_escape_string($about) . "', NOW())";
         return mysql_query($query);
     }
 }
Exemplo n.º 17
0
 public static function getLeagueUrl($lid, $l_name = null)
 {
     if (!isset($l_name)) {
         $l_name = get_alt_col('leagues', 'lid', $lid, 'name');
     }
     return "<a href=\"" . urlcompile(T_URL_STANDINGS, T_OBJ_TEAM, false, T_NODE_LEAGUE, $lid) . "\">" . $l_name . "</a>";
 }
Exemplo n.º 18
0
 public static function create(array $input)
 {
     /**
      * Creates a new match.
      *
      * Input: team1_id, team2_id, round, f_tour_id
      **/
     global $settings;
     # Used multiple times in error conditions below.
     $tour__f_lid = (int) get_parent_id(T_NODE_TOURNAMENT, (int) $input['f_tour_id'], T_NODE_LEAGUE);
     $tour__f_did = (int) get_parent_id(T_NODE_TOURNAMENT, (int) $input['f_tour_id'], T_NODE_DIVISION);
     $t1__f_lid = (int) get_alt_col('teams', 'team_id', $input['team1_id'], 'f_lid');
     $t2__f_lid = (int) get_alt_col('teams', 'team_id', $input['team2_id'], 'f_lid');
     $t1__f_did = (int) get_alt_col('teams', 'team_id', $input['team1_id'], 'f_did');
     $t2__f_did = (int) get_alt_col('teams', 'team_id', $input['team2_id'], 'f_did');
     $errors = array(self::T_CREATE_ERROR__IDENTICAL_TEAM_IDS => (int) $input['team1_id'] == (int) $input['team2_id'], self::T_CREATE_ERROR__IDENTICAL_PARENT_COACH => (int) get_alt_col('teams', 'team_id', $input['team1_id'], 'owned_by_coach_id') == (int) get_alt_col('teams', 'team_id', $input['team2_id'], 'owned_by_coach_id'), self::T_CREATE_ERROR__PARENT_TOUR_LOCKED => (bool) get_alt_col('tours', 'tour_id', $input['f_tour_id'], 'locked'), self::T_CREATE_ERROR__TEAM_LEAGUE_IDS_DIFFER => $t1__f_lid != $t2__f_lid, self::T_CREATE_ERROR__TEAM_DIVISION_IDS_DIFFER => (bool) get_alt_col('leagues', 'lid', $tour__f_lid, 'tie_teams') && $t1__f_did != $t2__f_did, self::T_CREATE_ERROR__ILLEGAL_PARENT_LID_OF_TOUR => $t1__f_lid != $tour__f_lid || $t2__f_lid != $tour__f_lid, self::T_CREATE_ERROR__ILLEGAL_PARENT_DID_OF_TOUR => (bool) get_alt_col('leagues', 'lid', $tour__f_lid, 'tie_teams') && ($t1__f_did != $tour__f_did || $t2__f_did != $tour__f_did));
     foreach ($errors as $exitStatus => $halt) {
         if ($halt) {
             return array($exitStatus, null);
         }
     }
     $query = "INSERT INTO matches (team1_id, team2_id, round, f_tour_id, date_created)\n                    VALUES ({$input['team1_id']}, {$input['team2_id']}, {$input['round']}, '{$input['f_tour_id']}', NOW())";
     if (mysql_query($query)) {
         $mid = mysql_insert_id();
     } else {
         self::$T_CREATE_SQL_ERROR['query'] = $query;
         self::$T_CREATE_SQL_ERROR['error'] = mysql_error();
         return array(self::T_CREATE_ERROR__SQL_QUERY_FAIL, null);
     }
     Module::runTriggers(T_TRIGGER_MATCH_CREATE, array($mid));
     return array(self::T_CREATE_SUCCESS, $mid);
 }
Exemplo n.º 19
0
     break;
     /* Name autocompletion - AJAX */
 /* Name autocompletion - AJAX */
 case 'autocomplete':
     $objs = array();
     switch ($_GET['obj']) {
         case T_OBJ_COACH:
             $query = "SELECT coach_id AS 'id', name FROM coaches WHERE name LIKE '{$_GET['query']}%' ORDER BY name ASC";
             $result = mysql_query($query);
             while ($row = mysql_fetch_assoc($result)) {
                 $objs[$row['id']] = $row['name'];
             }
             break;
         case T_OBJ_TEAM:
             $lid = isset($_GET['trid']) ? get_parent_id(T_NODE_TOURNAMENT, (int) $_GET['trid'], T_NODE_LEAGUE) : false;
             $did = $lid && get_alt_col('leagues', 'lid', $lid, 'tie_teams') == 1 ? get_parent_id(T_NODE_TOURNAMENT, (int) $_GET['trid'], T_NODE_DIVISION) : false;
             $FROM_lid = $lid ? "f_lid = {$lid} AND" : '';
             $FROM_did = $did ? "f_did = {$did} AND" : '';
             $query = "SELECT team_id AS 'id', name, rdy FROM teams WHERE {$FROM_lid} {$FROM_did} name LIKE '%{$_GET['query']}%' ORDER BY name ASC";
             $result = mysql_query($query);
             while ($row = mysql_fetch_assoc($result)) {
                 $objs[$row['id']] = $row['name'];
             }
             break;
     }
     echo json_encode(array('query' => $_GET['query'], 'suggestions' => array_values($objs), 'data' => array_keys($objs)));
     break;
     /* League Tables */
 /* League Tables */
 case 'scheduler':
     $subtype = '';
Exemplo n.º 20
0
 /**
  * Generates the newsfeed and writes it to disc.
  *
  */
 public function generateNewsRssFeed()
 {
     $dom = new DOMDocument();
     $dom->formatOutput = true;
     $el_root = $dom->appendChild($dom->createElement('rss'));
     $el_root->setAttribute('version', '2.0');
     $el_channel = $el_root->appendChild($dom->createElement('channel'));
     $el_channel->appendChild($dom->createElement('title', $this->title));
     $el_channel->appendChild($dom->createElement('link', $this->link));
     $el_channel->appendChild($dom->createElement('description', $this->desc));
     if ($this->lang != '') {
         $el_channel->appendChild($dom->createElement('language', $this->lang));
     }
     $el_channel->appendChild($dom->createElement('docs', $this->docs));
     $el_channel->appendChild($dom->createElement('lastBuildDate', date(DATE_RSS)));
     $el_channel->appendChild($dom->createElement('generator', 'OBBLM ' . OBBLM_VERSION));
     $entries = array();
     foreach ($this->type as $t) {
         $obj = (object) null;
         switch ($t) {
             case T_TEXT_MSG:
                 foreach (Message::getMessages(RSS_SIZE) as $item) {
                     $entries[] = (object) array('title' => "Announcement by " . get_alt_col('coaches', 'coach_id', $item->f_coach_id, 'name') . ": {$item->title}", 'desc' => $item->message, 'date' => $item->date);
                 }
                 break;
             case 'HOF':
                 if (Module::isRegistered('HOF')) {
                     foreach (Module::run('HOF', array('getHOF', false, RSS_SIZE)) as $item) {
                         $item = $item['hof'];
                         $entries[] = (object) array('title' => "HOF entry for " . get_alt_col('players', 'player_id', $item->pid, 'name') . ": {$item->title}", 'desc' => $item->about, 'date' => $item->date);
                     }
                 }
                 break;
             case 'Wanted':
                 if (Module::isRegistered('Wanted')) {
                     foreach (Module::run('Wanted', array('getWanted', false, RSS_SIZE)) as $item) {
                         $item = $item['wanted'];
                         $entries[] = (object) array('title' => "Wanted entry for " . get_alt_col('players', 'player_id', $item->pid, 'name') . ": {$item->bounty}", 'desc' => $item->why, 'date' => $item->date);
                     }
                 }
                 break;
             case T_TEXT_MATCH_SUMMARY:
                 foreach (MatchSummary::getSummaries(RSS_SIZE) as $item) {
                     $m = new Match($item->match_id);
                     $entries[] = (object) array('title' => "Match: {$m->team1_name} ({$m->team1_score}) vs. {$m->team2_name} ({$m->team2_score})", 'desc' => $m->getText(), 'date' => $m->date_played);
                 }
                 break;
             case T_TEXT_TNEWS:
                 foreach (TeamNews::getNews(false, RSS_SIZE) as $item) {
                     $entries[] = (object) array('title' => "Team news by " . get_alt_col('teams', 'team_id', $item->f_id, 'name'), 'desc' => $item->txt, 'date' => $item->date);
                 }
                 break;
         }
     }
     objsort($entries, array('-date'));
     foreach (array_slice($entries, 0, RSS_SIZE) as $item) {
         $el_item = $dom->createElement('item');
         $el_item->appendChild($dom->createElement('title', htmlspecialchars($item->title, ENT_NOQUOTES, "UTF-8")));
         $el_item->appendChild($dom->createElement('description', htmlspecialchars($item->desc, ENT_NOQUOTES, "UTF-8")));
         $el_item->appendChild($dom->createElement('link', $this->link));
         #            $el_item->appendChild($dom->createElement('pubDate', $item->date));
         $el_item->appendChild($dom->createElement('pubDate', date('r', strtotime($item->date))));
         $el_item->appendChild($dom->createElement('guid', $this->link . 'index.php?' . date('U', strtotime($item->date))));
         # RSS 2.0 dirty workaround.
         $el_channel->appendChild($el_item);
     }
     // Write the file
     $handle = fopen("rss.xml", "w");
     fwrite($handle, $dom->saveXML());
     fclose($handle);
     return $dom->saveXML();
 }
Exemplo n.º 21
0
 private function _HHMerc($DETAILED)
 {
     global $lng;
     $team = $this;
     // Copy. Used instead of $this for readability.
     title("<a name='anc'>" . $lng->getTrn('common/merchh') . "</a>");
     $mdat = array();
     foreach (Mercenary::getMercsHiredByTeam($team->team_id, false) as $merc) {
         $o = (object) array();
         $m = new Match($merc->match_id);
         $o->date_played = $m->date_played;
         $o->opponent = $m->team1_id == $team->team_id ? $m->team1_name : $m->team2_name;
         foreach (array('match_id', 'skills', 'mvp', 'cp', 'td', 'intcpt', 'bh', 'ki', 'si') as $f) {
             $o->{$f} = $merc->{$f};
         }
         $o->cas = $o->bh + $o->ki + $o->si;
         $o->match = '[view]';
         $o->tour = get_alt_col('tours', 'tour_id', $m->f_tour_id, 'name');
         $o->score = "{$m->team1_score} - {$m->team2_score}";
         $o->result = matchresult_icon($m->team1_id == $team->team_id && $m->team1_score > $m->team2_score || $m->team2_id == $team->team_id && $m->team1_score < $m->team2_score ? 'W' : ($m->team1_score == $m->team2_score ? 'D' : 'L'));
         array_push($mdat, $o);
     }
     $fields = array('date_played' => array('desc' => $lng->getTrn('common/dateplayed')), 'tour' => array('desc' => $lng->getTrn('common/tournament')), 'opponent' => array('desc' => $lng->getTrn('common/opponent')), 'skills' => array('desc' => $lng->getTrn('common/skills')), 'cp' => array('desc' => 'Cp'), 'td' => array('desc' => 'Td'), 'intcpt' => array('desc' => 'Int'), 'cas' => array('desc' => 'Cas'), 'bh' => array('desc' => 'BH'), 'si' => array('desc' => 'Si'), 'ki' => array('desc' => 'Ki'), 'mvp' => array('desc' => 'MVP'), 'score' => array('desc' => $lng->getTrn('common/score'), 'nosort' => true), 'result' => array('desc' => $lng->getTrn('common/result'), 'nosort' => true), 'match' => array('desc' => $lng->getTrn('common/match'), 'href' => array('link' => 'index.php?section=matches&amp;type=report', 'field' => 'mid', 'value' => 'match_id'), 'nosort' => true));
     HTMLOUT::sort_table("<a name='tp_mhhanc'>" . $lng->getTrn('common/merchh') . "</a>", urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $team->team_id, false, false) . '&amp;subsec=hhmerc' . ($DETAILED ? '&amp;detailed=1' : '&amp;detailed=0'), $mdat, $fields, sort_rule('star_HH'), isset($_GET['sorttp_mhh']) ? array(($_GET['dirtp_mhh'] == 'a' ? '+' : '-') . $_GET['sorttp_mhh']) : array(), array('GETsuffix' => 'tp_mhh', 'doNr' => false));
 }
Exemplo n.º 22
0
 public static function main($argv)
 {
     global $pdf;
     global $DEA;
     global $skillarray;
     global $rules;
     global $inducements;
     define("MARGINX", 20);
     define("MARGINY", 20);
     define("DEFLINECOLOR", '#000000');
     define("HEADLINEBGCOLOR", '#c3c3c3');
     // Custom settings for inducements.
     define('MAX_STARS', 2);
     define('MERC_EXTRA_COST', 30000);
     define('MERC_EXTRA_SKILL_COST', 50000);
     // Color codes.
     define('COLOR_ROSTER_NORMAL', COLOR_HTML_NORMAL);
     define('COLOR_ROSTER_READY', COLOR_HTML_READY);
     define('COLOR_ROSTER_MNG', COLOR_HTML_MNG);
     define('COLOR_ROSTER_DEAD', COLOR_HTML_DEAD);
     define('COLOR_ROSTER_SOLD', COLOR_HTML_SOLD);
     define('COLOR_ROSTER_STARMERC', COLOR_HTML_STARMERC);
     define('COLOR_ROSTER_JOURNEY', COLOR_HTML_JOURNEY);
     define('COLOR_ROSTER_JOURNEY_USED', COLOR_HTML_JOURNEY_USED);
     define('COLOR_ROSTER_NEWSKILL', COLOR_HTML_NEWSKILL);
     //-----
     define('COLOR_ROSTER_CHR_EQP1', COLOR_HTML_CHR_EQP1);
     // Characteristic equal plus one.
     define('COLOR_ROSTER_CHR_GTP1', COLOR_HTML_CHR_GTP1);
     // Characteristic greater than plus one.
     define('COLOR_ROSTER_CHR_EQM1', COLOR_HTML_CHR_EQM1);
     // Characteristic equal minus one.
     define('COLOR_ROSTER_CHR_LTM1', COLOR_HTML_CHR_LTM1);
     // Characteristic less than minus one.
     define('T_PDF_ROSTER_SET_EMPTY_ON_ZERO', true);
     # Prints cp, td etc. as '' (empty string) when field = 0.
     $ind_cost = 0;
     //
     // Most of team and player data is copy/pasted from teams.php
     //
     $team_id = $_GET['team_id'];
     // Is team id valid?
     if (!get_alt_col('teams', 'team_id', $team_id, 'team_id')) {
         fatal("Invalid team ID.");
     }
     $team = new Team($team_id);
     $coach = isset($_SESSION['logged_in']) ? new Coach($_SESSION['coach_id']) : null;
     setupGlobalVars(T_SETUP_GLOBAL_VARS__LOAD_LEAGUE_SETTINGS, array('lid' => $team->f_lid));
     // Load correct $rules for league.
     $players = $team->getPlayers();
     $tmp_players = array();
     foreach ($players as $p) {
         if ($p->is_dead || $p->is_sold) {
             continue;
         }
         array_push($tmp_players, $p);
     }
     $players = $tmp_players;
     // Team specific data
     $rerollcost = $DEA[$team->f_rname]['other']['rr_cost'];
     $pdf = new BB_PDF('L', 'pt', 'A4');
     // Creating a new PDF doc. Landscape, scale=pixels, size A4
     $pdf->SetAutoPageBreak(false, 20);
     // No auto page break to mess up layout
     $pdf->SetAuthor('Daniel Straalman');
     $pdf->SetCreator('OBBLM');
     $pdf->SetTitle('PDF Roster for ' . utf8_decode($team->name));
     $pdf->SetSubject('PDF Roster for ' . utf8_decode($team->name));
     $pdf->AddFont('Tahoma', '', 'tahoma.php');
     // Adding regular font Tahoma which is in font dir
     $pdf->AddFont('Tahoma', 'B', 'tahomabd.php');
     // Adding Tahoma Bold
     // Initial settings
     $pdf->SetFont('Tahoma', 'B', 14);
     $pdf->AddPage();
     $pdf->SetLineWidth(1.5);
     $currentx = MARGINX;
     $currenty = MARGINY;
     $pdf->SetFillColorBB($pdf->hex2cmyk(HEADLINEBGCOLOR));
     $pdf->RoundedRect($currentx, $currenty, 802, 20, 6, 'DF');
     // Filled rectangle around Team headline
     $pdf->SetDrawColorBB($pdf->hex2cmyk(DEFLINECOLOR));
     // Text in headline
     $pdf->SetXY($currentx + 30, $currenty);
     $pdf->Cell(310, 20, utf8_decode($team->name), 0, 0, 'L', false, '');
     $pdf->SetFont('Tahoma', '', 12);
     $pdf->Cell(60, 20, "Race:", 0, 0, 'R', false, '');
     $pdf->Cell(70, 20, $team->f_rname, 0, 0, 'L', false, '');
     $pdf->Cell(300, 20, "Head Coach: " . utf8_decode($team->f_cname), 0, 0, 'R', false, '');
     $currenty += 25;
     $currentx += 6;
     $pdf->SetXY($currentx, $currenty);
     $pdf->SetFillColorBB($pdf->hex2cmyk(HEADLINEBGCOLOR));
     $pdf->SetDrawColorBB($pdf->hex2cmyk(DEFLINECOLOR));
     $pdf->SetFont('Tahoma', 'B', 8);
     $pdf->SetLineWidth(1.5);
     $h = 14;
     // Printing headline for player table
     $pdf->Cell(23, $h, 'Nr', 1, 0, 'C', true, '');
     $pdf->Cell(97, $h, 'Name', 1, 0, 'L', true, '');
     $pdf->Cell(75, $h, 'Position', 1, 0, 'L', true, '');
     $pdf->Cell(18, $h, 'MA', 1, 0, 'C', true, '');
     $pdf->Cell(18, $h, 'ST', 1, 0, 'C', true, '');
     $pdf->Cell(18, $h, 'AG', 1, 0, 'C', true, '');
     $pdf->Cell(18, $h, 'AV', 1, 0, 'C', true, '');
     $pdf->Cell(329, $h, 'Skills and Injuries', 1, 0, 'L', true, '');
     $pdf->Cell(23, $h, 'MNG', 1, 0, 'C', true, '');
     $pdf->Cell(21, $h, 'CP', 1, 0, 'C', true, '');
     $pdf->Cell(21, $h, 'TD', 1, 0, 'C', true, '');
     $pdf->Cell(21, $h, 'Int', 1, 0, 'C', true, '');
     $pdf->Cell(21, $h, 'Cas', 1, 0, 'C', true, '');
     $pdf->Cell(23, $h, 'MVP', 1, 0, 'C', true, '');
     $pdf->Cell(25, $h, 'SPP', 1, 0, 'C', true, '');
     $pdf->Cell(41, $h, 'Value', 1, 0, 'C', true, '');
     $currenty += 17;
     $pdf->SetXY($currentx, $currenty);
     $pdf->SetFont('Tahoma', '', 8);
     $h = 15;
     // Row/cell height for player table
     //
     // Printing player rows
     //
     $sum_spp = 0;
     $sum_pvalue = 0;
     $sum_p_missing_value = 0;
     $sum_avail_players = 0;
     $sum_players = 0;
     $sum_cp = 0;
     $sum_td = 0;
     $sum_int = 0;
     $sum_cas = 0;
     $sum_mvp = 0;
     $i = 0;
     // Looping through the players and printing the rows
     foreach ($players as $p) {
         $i++;
         $mng = '';
         // Journeymen
         if ($p->is_journeyman) {
             $p->position = 'Journeyman';
             $bgc = COLOR_ROSTER_JOURNEY;
             if ($p->is_journeyman_used) {
                 $bgc = COLOR_ROSTER_JOURNEY_USED;
             }
         } else {
             $bgc = COLOR_ROSTER_NORMAL;
         }
         // Concatenate skills, upgrades and injuries
         $skillstr = $p->getSkillsStr(false);
         $injstr = $p->getInjsStr(false);
         if ($skillstr == '') {
             // No skills
             if ($injstr != '') {
                 $skills_injuries = $injstr;
             } else {
                 $skills_injuries = '';
             }
             // No skills nor injuries
         } else {
             if ($injstr != '') {
                 $skills_injuries = $skillstr . ', ' . $injstr;
             } else {
                 $skills_injuries = $skillstr;
             }
             // Only skills, no injuries
         }
         // Colorcoding new skills available
         if ($p->mayHaveNewSkill()) {
             $bgc = COLOR_ROSTER_NEWSKILL;
         }
         if (!$p->is_mng) {
             $sum_avail_players++;
             $inj = "";
         } else {
             $bgc = COLOR_ROSTER_MNG;
             $sum_p_missing_value += $p->value;
             $inj = "MNG";
             // For MNG column
             // Removing MNG from skills and injuries
             $skills_injuries = str_replace(', MNG', '', $skills_injuries);
             $skills_injuries = str_replace('MNG', '', $skills_injuries);
             $skills_injuries = str_replace('  ', ' ', $skills_injuries);
             // Maybe not needed after changes to rest of code?
         }
         // Characteristic's colors, copied and modified from teams.php
         foreach (array('ma', 'ag', 'av', 'st') as $chr) {
             $sub = $p->{$chr} - $p->{"def_{$chr}"};
             if ($sub == 0) {
                 $p->{"{$chr}_color"} = $bgc;
             } elseif ($sub >= 1) {
                 $p->{"{$chr}_color"} = COLOR_ROSTER_CHR_GTP1;
             } elseif ($sub <= -1) {
                 $p->{"{$chr}_color"} = COLOR_ROSTER_CHR_LTM1;
             }
         }
         $pp = array('nr' => $p->nr, 'name' => utf8_decode($p->name), 'pos' => $p->position, 'ma' => $p->ma, 'st' => $p->st, 'ag' => $p->ag, 'av' => $p->av, 'skills' => $skills_injuries, 'inj' => $inj, 'cp' => $p->mv_cp, 'td' => $p->mv_td, 'int' => $p->mv_intcpt, 'cas' => $p->mv_cas, 'mvp' => $p->mv_mvp, 'spp' => $p->mv_spp, 'value' => $pdf->Mf($p->value));
         $sum_spp += $p->mv_spp;
         $sum_pvalue += $p->value;
         $sum_players++;
         $sum_cp += $p->mv_cp;
         $sum_td += $p->mv_td;
         $sum_int += $p->mv_intcpt;
         $sum_cas += $p->mv_cas;
         $sum_mvp += $p->mv_mvp;
         if (T_PDF_ROSTER_SET_EMPTY_ON_ZERO) {
             foreach (array('cp', 'td', 'int', 'cas', 'mvp', 'spp') as $f) {
                 if ($pp[$f] == 0) {
                     $pp[$f] = '';
                 }
             }
         }
         // Printing player row
         $currenty += $pdf->print_prow($pp, $currentx, $currenty, $h, $bgc, DEFLINECOLOR, 0.5, 8, $p->ma_color, $p->st_color, $p->ag_color, $p->av_color);
     }
     // Filling up with empty rows to max number of players
     $pp = array('nr' => '', 'name' => '', 'pos' => '', 'ma' => '', 'st' => '', 'ag' => '', 'av' => '', 'skills' => '', 'inj' => '', 'cp' => '', 'td' => '', 'int' => '', 'cas' => '', 'mvp' => '', 'spp' => '', 'value' => '');
     $bgc = COLOR_ROSTER_NORMAL;
     while ($i < $rules['max_team_players']) {
         $i++;
         $currenty += $pdf->print_prow($pp, $currentx, $currenty, $h, '#FFFFFF', '#000000', 0.5, 8, $bgc, $bgc, $bgc, $bgc);
     }
     // Sums
     $sum_pvalue -= $sum_p_missing_value;
     $pdf->SetXY($currentx = MARGINX + 6 + 23, $currenty += 4);
     $pdf->print_box($currentx, $currenty, 172, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', 'Total number of players next game:');
     $pdf->print_box($currentx += 172, $currenty, 30, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', $sum_avail_players . '/' . $sum_players);
     $pdf->SetX($currentx = MARGINX + 6 + 559);
     $pdf->print_box($currentx, $currenty, 60, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', 'Totals (excl TV for MNG players):');
     $pdf->print_box($currentx += 60, $currenty, 21, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_cp);
     $pdf->print_box($currentx += 21, $currenty, 21, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_td);
     $pdf->print_box($currentx += 21, $currenty, 21, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_int);
     $pdf->print_box($currentx += 21, $currenty, 21, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_cas);
     $pdf->print_box($currentx += 21, $currenty, 23, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_mvp);
     $pdf->print_box($currentx += 23, $currenty, 25, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_spp);
     $pdf->print_box($currentx += 25, $currenty, 41, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', $pdf->Mf($sum_pvalue));
     // Stars and Mercs part of roster
     $currentx = MARGINX + 6 + 23;
     $currenty += $h + 2;
     // Draw rounded rectangle around stars and mercs
     // This rectangle has flexible height depending on how high player table is
     $pdf->SetLineWidth(0.6);
     $pdf->RoundedRect(MARGINX + 6, $currenty, 792, 560 - $currenty - 130, 5, 'D');
     $pdf->SetXY($currentx, $currenty += 2);
     $h = 14;
     $pdf->SetFont('Tahoma', 'B', 8);
     $pdf->Cell(97 + 75, $h, 'Induced Stars and Mercenaries', 0, 0, 'L', true, '');
     $pdf->Cell(18, $h, 'MA', 0, 0, 'C', true, '');
     $pdf->Cell(18, $h, 'ST', 0, 0, 'C', true, '');
     $pdf->Cell(18, $h, 'AG', 0, 0, 'C', true, '');
     $pdf->Cell(18, $h, 'AV', 0, 0, 'C', true, '');
     $pdf->Cell(329, $h, 'Skills', 0, 0, 'L', true, '');
     //$pdf->Cell(23, $h, 'MNG', 1, 0, 'C', true, ''); // No MNG stars/mercs. They heal. ;-)
     $pdf->Cell(21, $h, 'CP', 0, 0, 'C', true, '');
     $pdf->Cell(21, $h, 'TD', 0, 0, 'C', true, '');
     $pdf->Cell(21, $h, 'Int', 0, 0, 'C', true, '');
     $pdf->Cell(21, $h, 'Cas', 0, 0, 'C', true, '');
     $pdf->Cell(23, $h, 'MVP', 0, 0, 'C', true, '');
     $pdf->Cell(25, $h, 'SPP', 0, 0, 'C', true, '');
     $pdf->Cell(41, $h, 'Value', 0, 0, 'R', true, '');
     $currenty += 14;
     $pdf->SetXY($currentx, $currenty);
     $h = 13;
     // Printing chosen stars and mercs
     $pdf->SetFont('Tahoma', '', 8);
     $merc = array(0 => 'No Merc');
     $i = 0;
     if ($_POST) {
         foreach ($DEA[$team->f_rname]["players"] as $p => $m) {
             $i++;
             array_push($merc, $m);
             $pos[$i] = $p;
         }
         $postvars = array();
         # initialize.
         foreach ($_POST as $postkey => $postvalue) {
             if ($postkey == "Submit") {
                 continue;
             }
             if ($postvalue == "0") {
                 continue;
             }
             if ($postvalue == "0k") {
                 continue;
             }
             if ($postvalue == "-No Extra Skill-") {
                 continue;
             }
             $postvars[str_replace('_', ' ', $postkey)] = $postvalue;
         }
         $star_array_tmp[0] = 0;
         $merc_array_tmp[0] = 0;
         while (list($key, $val) = each($postvars)) {
             if (strpos($key, 'Star') !== false) {
                 // if POST key is StarX
                 array_push($star_array_tmp, $val);
                 continue;
             } elseif (strpos($key, 'Merc') !== false) {
                 $merc_nr = preg_replace("/[^0-9]/", "", $key);
                 $merc_array_tmp[$merc_nr] = $pos[$val];
                 if (isset($postvars["Extra{$merc_nr}"])) {
                     $extra_array_tmp[$merc_nr] = $postvars["Extra{$merc_nr}"];
                 } else {
                     $extra_array_tmp[$merc_nr] = '';
                 }
                 continue;
             } elseif ($key == 'Bloodweiser Babes') {
                 $ind_babes = (int) $val;
                 continue;
             } elseif ($key == 'Bribes') {
                 $ind_bribes = (int) $val;
                 continue;
             } elseif ($key == 'Card') {
                 $ind_card = (int) str_replace('k', '000', $val);
                 continue;
             } elseif ($key == 'Extra Training') {
                 $ind_rr = (int) $val;
                 continue;
             } elseif ($key == 'Halfling Master Chef') {
                 $ind_chef = (int) $val;
                 continue;
             } elseif ($key == 'Igor') {
                 $ind_igor = (int) $val;
                 continue;
             } elseif ($key == 'Wandering Apothecaries') {
                 $ind_apo = (int) $val;
                 continue;
             } elseif ($key == 'Wizard') {
                 $ind_wiz = (int) $val;
                 continue;
             }
         }
         // Printing stars first
         if (isset($star_array_tmp[1])) {
             unset($star_array_tmp[0]);
             foreach ($star_array_tmp as $sid) {
                 $s = new Star($sid);
                 $s->setSkills(true);
                 $ss = array('name' => utf8_decode($s->name), 'ma' => $s->ma, 'st' => $s->st, 'ag' => $s->ag, 'av' => $s->av, 'skills' => $s->skills, 'cp' => $s->mv_cp, 'td' => $s->mv_td, 'int' => $s->mv_intcpt, 'cas' => $s->mv_cas, 'mvp' => $s->mv_mvp, 'spp' => $s->mv_spp, 'value' => $pdf->Mf($s->cost));
                 $currenty += $pdf->print_srow($ss, $currentx, $currenty, $h, $bgc, DEFLINECOLOR, 0.5, 8);
                 $ind_cost += $s->cost;
             }
         }
         // Then Mercs
         if (is_array($merc_array_tmp)) {
             unset($merc[0]);
             $r = $team->f_rname;
             $i = 0;
             unset($merc_array_tmp[0]);
             foreach ($merc_array_tmp as $mpos) {
                 $i++;
                 $m['name'] = 'Mercenary ' . $mpos;
                 $m['ma'] = $DEA[$r]['players'][$mpos]['ma'];
                 $m['st'] = $DEA[$r]['players'][$mpos]['st'];
                 $m['ag'] = $DEA[$r]['players'][$mpos]['ag'];
                 $m['av'] = $DEA[$r]['players'][$mpos]['av'];
                 $m['skillarr'] = $DEA[$r]['players']["{$mpos}"]['def'];
                 if (!in_array(99, $m['skillarr'])) {
                     array_unshift($m['skillarr'], 99);
                 }
                 // Adding Loner unless already in array
                 $m['skills'] = implode(', ', skillsTrans($m['skillarr']));
                 $m['cost'] = $DEA[$r]['players'][$mpos]['cost'] + MERC_EXTRA_COST;
                 if (isset($postvars["Extra{$i}"])) {
                     $m['cost'] += MERC_EXTRA_SKILL_COST;
                     $m['extra'] = $postvars["Extra{$i}"];
                     if ($m['skills'] == '') {
                         $m['skills'] = $m['extra'];
                     } else {
                         $m['skills'] = $m['skills'] . ', ' . $m['extra'];
                     }
                 }
                 $ss = array('name' => utf8_decode($m['name']), 'ma' => $m['ma'], 'st' => $m['st'], 'ag' => $m['ag'], 'av' => $m['av'], 'skills' => $m['skills'], 'cp' => ' ', 'td' => ' ', 'int' => ' ', 'cas' => ' ', 'mvp' => ' ', 'spp' => ' ', 'value' => $pdf->Mf($m['cost']));
                 $currenty += $pdf->print_srow($ss, $currentx, $currenty, $h, $bgc, DEFLINECOLOR, 0.5, 8);
                 $ind_cost += $m['cost'];
             }
         }
     }
     $h = 13;
     // Printing lower part of roster
     $currentx = MARGINX;
     $currenty = 435;
     //print_box($x, $y, $w, $h, $bgcolor='#FFFFFF', $bordercolor='#000000', $linewidth=1, $borderstyle, $fontsize, $font, $bold=false, $align, $text)
     $h = 13;
     // Height of cells
     $pdf->print_box($currentx, $currenty, 170, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', 'Inducements ');
     $pdf->print_box($currentx += 170, $currenty, 120, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'L', '(for next match)');
     $pdf->print_box($currentx = 630, $currenty, 40, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', 'Team Goods');
     // 156 to margin
     // Checking if Wandering Apothecary should be replaced with Igor
     $r = $team->f_rname;
     if ($r == 'Nurgle' || $r == 'Khemri' || $r == 'Necromantic' || $r == 'Undead') {
         $apo_igor = 'Igor (0-1):';
         unset($inducements['Wandering Apothecaries']);
         if (isset($ind_igor)) {
             $ind_apo_igor_cost = $ind_igor * $inducements['Igor']['cost'];
             $ind_cost += $ind_igor * $ind_apo_igor_cost;
             $ind_apo_igor = $ind_igor;
         } else {
             $ind_apo_igor = '__';
             $ind_apo_igor_cost = $inducements['Igor']['cost'];
         }
     } else {
         $apo_igor = 'Wandering Apothecaries (0-2):';
         unset($inducements['Igor']);
         if (isset($ind_apo)) {
             $ind_apo_igor_cost = $inducements['Wandering Apothecaries']['cost'];
             $ind_cost += $ind_apo * $ind_apo_igor_cost;
             $ind_apo_igor = $ind_apo;
         } else {
             $ind_apo_igor = '__';
             $ind_apo_igor_cost = $inducements['Wandering Apothecaries']['cost'];
         }
     }
     // Checking LRB6 cheaper Chef for Halfling
     $chef_cost = $inducements['Halfling Master Chef'][$r == 'Halfling' ? 'reduced_cost' : 'cost'];
     // Checking LRB6 cheaper bribes for Goblin
     $bribe_cost = $inducements['Bribes'][$r == 'Goblin' ? 'reduced_cost' : 'cost'];
     if (isset($ind_babes)) {
         $ind_cost += $ind_babes * $inducements['Bloodweiser Babes']['cost'];
     } else {
         $ind_babes = '__';
     }
     if (isset($ind_bribes)) {
         $ind_cost += $ind_bribes * $inducements['Bribes']['cost'];
     } else {
         $ind_bribes = '__';
     }
     if (isset($ind_card)) {
         $ind_cost += $ind_card;
     } else {
         $ind_card = '__';
     }
     if (isset($ind_rr)) {
         $ind_cost += $ind_rr * $inducements['Extra Training']['cost'];
     } else {
         $ind_rr = '__';
     }
     if (isset($ind_chef)) {
         $ind_cost += $ind_chef * $chef_cost;
     } else {
         $ind_chef = '__';
     }
     if (isset($ind_wiz)) {
         $ind_cost += $ind_wiz * $inducements['Wizard']['cost'];
     } else {
         $ind_wiz = '__';
     }
     // print_inducements($x, $y, $h, $bgcol, $linecol, $fontsize, $ind_name, $ind_amount, $ind_value)
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Bloodweiser Babes (0-2):', $ind_babes, $pdf->Mf($inducements['Bloodweiser Babes']['cost']));
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Bribes (0-3):', $ind_bribes, $pdf->Mf($bribe_cost));
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Extra Training (0-4):', $ind_rr, $pdf->Mf($inducements['Extra Training']['cost']));
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Halfling Master Chef (0-1):', $ind_chef, $pdf->Mf($chef_cost));
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, $apo_igor, $ind_apo_igor, $pdf->Mf($ind_apo_igor_cost));
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Wizard (0-1):', $ind_wiz, $pdf->Mf($inducements['Wizard']['cost']));
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Card budget:', ' ', $pdf->Mf($ind_card));
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Gate:', null, '');
     $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'FAME:', null, '');
     $currenty = 435;
     $currentx = 630;
     // print_team_goods($x, $y, $h, $bgcol, $linecol, $perm_name, $perm_nr, $perm_value, $perm_total_value, $bold=false)
     $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Rerolls:', $team->rerolls, $pdf->Mf($rerollcost), $pdf->Mf($team->rerolls * $rerollcost), false);
     $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Fan Factor:', $team->rg_ff, $pdf->Mf($rules['cost_fan_factor']), $pdf->Mf($team->rg_ff * $rules['cost_fan_factor']), false);
     $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Assistant Coaches:', $team->ass_coaches, $pdf->Mf($rules['cost_ass_coaches']), $pdf->Mf($team->ass_coaches * $rules['cost_ass_coaches']), false);
     $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Cheerleaders:', $team->cheerleaders, $pdf->Mf($rules['cost_cheerleaders']), $pdf->Mf($team->cheerleaders * $rules['cost_cheerleaders']), false);
     if ($r == 'Undead' || $r == 'Necromantic') {
         // Swap Apothecary for Necromancer
         $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Necromancer:', 1, 0, 0, false);
     } elseif ($r == 'Nurgle' || $r == 'Khemri') {
         // Remove Apothecary
         $currenty += $h;
     } else {
         // Normal case
         $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Apothecary:', $team->apothecary, $pdf->Mf($rules['cost_apothecary']), $pdf->Mf($team->apothecary * $rules['cost_apothecary']), false);
     }
     $pdf->print_box($currentx += 70, $currenty += $h, 40, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', 'Treasury:');
     $pdf->print_box($currentx += 40, $currenty, 65, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', $pdf->Mf($team->treasury));
     // Team Value, Inducements Value, Match Value
     $h = 13;
     $pdf->print_box($currentx -= 40, $currenty += $h, 40, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', 'Team Value (incl MNGs value):');
     $pdf->print_box($currentx += 40, $currenty, 65, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', $pdf->Mf($team->value + $sum_p_missing_value));
     $pdf->print_box($currentx -= 40, $currenty += $h, 40, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', 'Induced Value:');
     $pdf->print_box($currentx += 40, $currenty, 65, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', $pdf->Mf($ind_cost));
     $pdf->print_box($currentx -= 40, $currenty += $h, 40, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', 'Match Value (TV for match):');
     $pdf->print_box($currentx += 40, $currenty, 65, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', $pdf->Mf($team->value + $ind_cost));
     // Drawing a rectangle around inducements
     $pdf->SetLineWidth(0.6);
     $pdf->RoundedRect(MARGINX + 6, 435, 792, 130, 5, 'D');
     global $settings;
     if ($settings['enable_pdf_logos']) {
         // Team logo
         // Comment out if you dont have GD 2.x installed, or if you dont want the logo in roster.
         // Not tested with anything except PNG images that comes with OBBLM.
         $img = new ImageSubSys(IMGTYPE_TEAMLOGO, $team->team_id);
         $pdf->Image($img->getPath(), 346, 436, 128, 128, '', '', false, 0);
         // OBBLM text lower left corner as a pic
         $pdf->Image('modules/pdf/OBBLM_pdf_logo.png', MARGINX + 12, 534, 60, 28, '', '', false, 0);
     }
     // Color legends
     $pdf->SetFont('Tahoma', '', 8);
     $currentx = MARGINX + 16;
     $currenty = 572;
     $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_MNG));
     $pdf->SetXY($currentx, $currenty);
     $pdf->Rect($currentx, $currenty, 5, 5, 'DF');
     $pdf->SetXY($currentx += 5, $currenty -= 1);
     $pdf->Cell(20, 8, 'MNG', 0, 0, 'L', false);
     $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_JOURNEY));
     $pdf->Rect($currentx += 22 + 5, $currenty += 1, 5, 5, 'DF');
     $pdf->SetXY($currentx += 5, $currenty -= 1);
     $pdf->Cell(45, 8, 'Journeyman', 0, 0, 'L', false);
     $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_JOURNEY_USED));
     $pdf->Rect($currentx += 47 + 5, $currenty += 1, 5, 5, 'DF');
     $pdf->SetXY($currentx += 5, $currenty -= 1);
     $pdf->Cell(45, 8, 'Used journeyman', 0, 0, 'L', false);
     $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_NEWSKILL));
     $pdf->Rect($currentx += 67 + 5, $currenty += 1, 5, 5, 'DF');
     $pdf->SetXY($currentx += 5, $currenty -= 1);
     $pdf->Cell(70, 8, 'New skill available', 0, 0, 'L', false);
     $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_CHR_GTP1));
     $pdf->Rect($currentx += 70 + 5, $currenty += 1, 5, 5, 'DF');
     $pdf->SetXY($currentx += 5, $currenty -= 1);
     $pdf->Cell(50, 8, 'Stat upgrade', 0, 0, 'L', false);
     $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_CHR_LTM1));
     $pdf->Rect($currentx += 50 + 5, $currenty += 1, 5, 5, 'DF');
     $pdf->SetXY($currentx += 5, $currenty -= 1);
     $pdf->Cell(50, 8, 'Stat downgrade', 0, 0, 'L', false);
     $pdf->SetFont('Tahoma', '', 7);
     $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_NORMAL));
     $pdf->SetXY($currentx + 160, $currenty + 1);
     $donate = "Please consider donating to the OBBLM project if you enjoy this software and wish to support\n further development and maintenance. For more information visit nicholasmr.dk";
     $pdf->Multicell(300, 8, $donate, 0, 0, 'L', false);
     // Output the PDF document
     $pdf->Output(utf8_decode($team->name) . date(' Y-m-d') . '.pdf', 'I');
 }
Exemplo n.º 23
0
    public static function printList($node, $node_id, $ALLOW_EDIT)
    {
        global $lng;
        $prizes = self::getPrizes($node, $node_id);
        $FOLD_UP = false;
        # (count($prizes) > 20);
        foreach ($prizes as $trid => $tourprizes) {
            $tname = get_alt_col('tours', 'tour_id', $trid, 'name');
            ?>
    
        <div class="boxWide" style="width: 70%; margin: 20px auto 20px auto;">
            <div class="boxTitle<?php 
            echo T_HTMLBOX_INFO;
            ?>
"><?php 
            echo "{$tname} prizes";
            ?>
 <a href='javascript:void(0);' onClick="slideToggleFast('<?php 
            echo 'trpr' . $trid;
            ?>
');">[+/-]</a></div>
            <div id="trpr<?php 
            echo $trid;
            ?>
">
            <div class="boxBody">
                <table class="common" style='border-spacing: 10px;'>
                    <tr>
                        <td style='width:25%;'><b>Prize&nbsp;type</b></td>
                        <td><b>Team</b></td>
                        <td><b>About</b></td>
                    </tr>
                    <?php 
            $ptypes = self::getTypes();
            foreach ($tourprizes as $pr) {
                echo "<tr><td colspan='4'><hr></td></td>";
                echo "<tr>\n";
                $delete = $ALLOW_EDIT ? '&nbsp;<a href="handler.php?type=prize&amp;action=delete&amp;prid=' . $pr->prize_id . '">' . $lng->getTrn('common/delete') . '</a>' : '';
                echo "<td valign='top'>" . preg_replace('/\\s/', '&nbsp;', $ptypes[$pr->type]) . "&nbsp;{$delete}</td>\n";
                echo "<td valign='top'><b>" . preg_replace('/\\s/', '&nbsp;', get_alt_col('teams', 'team_id', $pr->team_id, 'name')) . "</b></td>\n";
                echo "<td valign='top'>" . $pr->title . "<br><br><i>" . $pr->txt . "</i></td>\n";
                echo "</tr>\n";
            }
            ?>
                </table>
            </div>
            </div>
        </div>
        <?php 
            if ($FOLD_UP) {
                ?>
            <script language="JavaScript" type="text/javascript">
                document.getElementById('trpr<?php 
                echo $t->tour_id;
                ?>
').style.display = 'none';
            </script>
            <?php 
            }
        }
    }
Exemplo n.º 24
0
// Number of entries on the front page message board.
$settings['fp_messageboard']['show_team_news'] = true;
// Default is true. Show team news on the front page message board.
$settings['fp_messageboard']['show_match_summaries'] = true;
// Default is true. Show match summaries on the front page message board.
/*********************
 *   Front page boxes
 *********************/
/*
    The below settings define which boxes to show on the right side of the front page.

    Note, every box MUST have a UNIQUE 'box_ID' number.
    The box IDs are used to determine the order in which the boxes are shown on the front page.
    The box with 'box_ID' = 1 is shown at the top of the page, the box with 'box_ID' = 2 is displayed underneath it and so forth.
*/
/*********************
 *   Front page: tournament standings boxes
 *********************/
$settings['fp_standings'] = array(array('id' => $get_prime, 'box_ID' => 1, 'type' => 'tournament', 'infocus' => true, 'HRS' => get_alt_col('tours', 'tour_id', $get_prime, 'rs'), 'title' => get_alt_col('tours', 'tour_id', $get_prime, 'name'), 'length' => 40, 'fields' => array('Name' => 'name', 'PTS' => 'pts', 'TV' => 'tv', 'CAS' => 'cas', 'W' => 'won', 'L' => 'lost', 'D' => 'draw', 'GF' => 'gf', 'GA' => 'ga')));
/*********************
 *   Front page: leaders boxes
 *********************/
$settings['fp_leaders'] = array(array('id' => get_alt_col('tours', 'tour_id', $get_prime, 'f_did'), 'box_ID' => 3, 'type' => 'division', 'title' => 'Most Individual Casualties (Division)', 'field' => 'cas', 'length' => 5, 'show_team' => true), array('id' => get_alt_col('tours', 'tour_id', $get_prime, 'f_did'), 'box_ID' => 4, 'type' => 'division', 'title' => 'Most Individual Touchdowns (Division)', 'field' => 'td', 'length' => 5, 'show_team' => true));
/*********************
 *   Front page: event boxes
 *********************/
$settings['fp_events'] = array(array('id' => $get_lid, 'box_ID' => 5, 'type' => 'league', 'title' => 'Latest Dead Players (League)', 'content' => 'dead', 'length' => 5), array('id' => $get_lid, 'box_ID' => 6, 'type' => 'league', 'title' => 'Latest Skills (League)', 'content' => 'skills', 'length' => 5));
/*********************
 *   Front page: latest games boxes
 *********************/
$settings['fp_latestgames'] = array(array('id' => $get_lid, 'box_ID' => 7, 'type' => 'league', 'title' => 'Recent Games (League)', 'length' => 5));
Exemplo n.º 25
0
 public static function create(array $input)
 {
     /**
      * Creates a new team.
      **/
     global $raceididx;
     $EXPECTED = self::$createEXPECTED;
     sort($EXPECTED);
     ksort($input);
     $errors = array(self::T_CREATE_ERROR__UNEXPECTED_INPUT => $EXPECTED !== array_keys($input), self::T_CREATE_ERROR__INVALID_RACE => !in_array((int) $input['f_race_id'], array_keys($raceididx)), self::T_CREATE_ERROR__INVALID_COACH => !get_alt_col('coaches', 'coach_id', (int) $input['owned_by_coach_id'], 'coach_id'), self::T_CREATE_ERROR__INVALID_NAME => get_alt_col('teams', 'name', mysql_real_escape_string($input['name']), 'team_id') || empty($input['name']), self::T_CREATE_ERROR__INVALID_LEAGUE => get_alt_col('coaches', 'coach_id', (int) $input['owned_by_coach_id'], 'ring') != Coach::T_RING_GLOBAL_ADMIN && 0 == (int) SQLFetchField("SELECT COUNT(*) FROM memberships WHERE lid = " . (int) $input['f_lid'] . " AND cid = " . (int) $input['owned_by_coach_id'] . " AND ring >= " . Coach::T_RING_LOCAL_REGULAR), self::T_CREATE_ERROR__INVALID_DIVISION => $input['f_did'] != self::T_NO_DIVISION_TIE && $input['f_lid'] != get_alt_col('divisions', 'did', (int) $input['f_did'], 'f_lid'));
     foreach ($errors as $exitStatus => $halt) {
         if ($halt) {
             return array($exitStatus, null);
         }
     }
     $input['name'] = "'" . mysql_real_escape_string($input['name']) . "'";
     # Need to quote strings when using INSERT statement.
     $query = "INSERT INTO teams (" . implode(',', $EXPECTED) . ") VALUES (" . implode(',', $input) . ")";
     if (mysql_query($query)) {
         $tid = mysql_insert_id();
     } else {
         self::$T_CREATE_SQL_ERROR['query'] = $query;
         self::$T_CREATE_SQL_ERROR['error'] = mysql_error();
         return array(self::T_CREATE_ERROR__SQL_QUERY_FAIL, null);
     }
     SQLTriggers::run(T_SQLTRIG_TEAM_NEW, array('id' => $tid, 'obj' => new self($tid)));
     return array(self::T_CREATE_SUCCESS, $tid);
 }
Exemplo n.º 26
0
    public static function userSched()
    {
        global $lng, $coach, $settings, $leagues, $divisions, $tours;
        if (!is_object($coach)) {
            status(false, "You must be logged in to schedule games");
            return;
        }
        if (isset($_POST['creategame'])) {
            // Test input
            $trid = (int) $_POST['trid'];
            $round = (int) $_POST['round'];
            $own_team = (int) $_POST['own_team'];
            $errmsg = '';
            // Logged in coach has access to the tour?
            if (!in_array($trid, array_keys($tours))) {
                $errmsg = 'You do not have access to the tournament ' . $tours[$trid]['tname'];
            }
            // Is the team is really owned by the logged in coach?
            if ($coach->coach_id != get_alt_col('teams', 'team_id', $own_team, 'owned_by_coach_id')) {
                $errmsg = 'The team ' . get_alt_col('teams', 'team_id', $own_team, 'name') . ' is not owned by you';
            }
            // Create match
            if (!$errmsg) {
                list($exitStatus, $mid) = Match::create(array('team1_id' => $own_team, 'team2_id' => get_alt_col('teams', 'name', $_POST['opposing_team_autocomplete'], 'team_id'), 'round' => $round, 'f_tour_id' => $trid));
                $backFromMatchLink = Mobile::isMobile() ? "index.php?mobile=1" : "index.php?section=matches&amp;type=report&amp;mid={$mid}";
                status(!$exitStatus, $exitStatus ? Match::$T_CREATE_ERROR_MSGS[$exitStatus] : "<a href='{$backFromMatchLink}'>Click here</a> to open the match report");
                if (!$exitStatus) {
                    echo "<br>";
                }
            } else {
                status(false, $errmsg);
            }
        }
        $trid = isset($_GET['trid']) && is_numeric($_GET['trid']) ? (int) $_GET['trid'] : 0;
        $lid = $trid ? get_parent_id(T_NODE_TOURNAMENT, $trid, T_NODE_LEAGUE) : false;
        $lname = $lid ? get_parent_name(T_NODE_TOURNAMENT, $trid, T_NODE_LEAGUE) : '- N/A -';
        $did = $trid && get_alt_col('leagues', 'lid', $lid, 'tie_teams') == 1 ? get_parent_id(T_NODE_TOURNAMENT, $trid, T_NODE_DIVISION) : false;
        $dname = $did ? get_parent_name(T_NODE_TOURNAMENT, $trid, T_NODE_DIVISION) : false;
        $_DISABLED = !$trid ? 'DISABLED' : '';
        #print_r(array($trid, $lid, $lname, $did));
        title($lng->getTrn('menu/matches_menu/usersched'));
        $LOCK_FORMS = false;
        ?>
    <div class='boxCommon'>
        <h3 class='boxTitle<?php 
        echo T_HTMLBOX_MATCH;
        ?>
'><?php 
        echo $lng->getTrn('menu/matches_menu/usersched');
        ?>
</h3>
        <div class='boxBody'>
            <form method="POST" id="usersched">
                <?php 
        echo "In tournament ";
        echo HTMLOUT::nodeList(T_NODE_TOURNAMENT, 'trid', array(T_NODE_TOURNAMENT => array('locked' => 0, 'type' => TT_FFA, 'allow_sched' => 1)), array(), array('sel_id' => $trid, 'extra_tags' => array('onChange="document.location.href = \'' . getFormAction('?section=matches&type=usersched') . '&trid=\' + $(this).val();"'), 'init_option' => '<option value="0">- ' . $lng->getTrn('matches/usersched/selecttour') . " -</option>\n"));
        echo ' as ';
        echo '<select name="round" id="round" ' . $_DISABLED . '>';
        $T_ROUNDS = Match::getRounds();
        foreach ($T_ROUNDS as $r => $d) {
            echo "<option value='{$r}' " . ($r == 1 ? 'SELECTED' : '') . ">" . $d . "</option>\n";
        }
        ?>
                </select>
                <br><br>
                Your team
                <?php 
        $teams = array();
        foreach ($coach->getTeams($lid, $did, array('sortby' => 'team_id DESC')) as $t) {
            if (!$t->rdy || $t->is_retired) {
                continue;
            }
            $teams[] = $t;
        }
        ?>
                <select name='own_team' id='own_team' <?php 
        echo $_DISABLED;
        ?>
>
                    <?php 
        echo "<optgroup class='leagues' label='{$lname}'>\n";
        if ($dname) {
            echo "<optgroup class='divisions' label='&nbsp;&nbsp;{$dname}'>\n";
        }
        foreach ($teams as $t) {
            echo "<option style='background-color: white; margin-left: -1em;' value='{$t->team_id}'>&nbsp;&nbsp;&nbsp;{$t->name}</option>\n";
        }
        ?>
                </select>
                &nbsp;
                VS.
                <input type="text" id='opposing_team_autoselect' name="opposing_team_autocomplete" size="30" maxlength="50" <?php 
        echo $_DISABLED;
        ?>
>
                <script>
                    $(document).ready(function(){
                        var options, b;

                        options = {
                            minChars:2,
                            serviceUrl:'handler.php?type=autocomplete&obj=<?php 
        echo T_OBJ_TEAM;
        ?>
&trid=<?php 
        echo $trid;
        ?>
',
                        };
                        b = $('#opposing_team_autoselect').autocomplete(options);
                    });
                </script>
                <br><br><br>
                <input type="submit" name="creategame" value="<?php 
        echo $lng->getTrn('menu/matches_menu/usersched');
        ?>
" <?php 
        if (empty($teams) || $_DISABLED) {
            echo 'DISABLED';
        }
        ?>
>
                
                <?php 
        if (Mobile::isMobile()) {
            echo '<a href="' . getFormAction('') . '">' . $lng->getTrn('common/back') . '</a>';
        }
        ?>
            </form>
        </div>
    </div>
    <?php 
    }
Exemplo n.º 27
0
 public static function create($f_lid, $name)
 {
     $query = "INSERT INTO divisions (f_lid, name) VALUES ({$f_lid}, '" . mysql_real_escape_string($name) . "')";
     return get_alt_col('divisions', 'name', $name, 'did') ? false : mysql_query($query);
 }
Exemplo n.º 28
0
 public static function exists($id)
 {
     return get_alt_col('game_data_stars', 'star_id', $id, 'star_id');
 }
Exemplo n.º 29
0
 public static function create(array $input)
 {
     /**
      * Creates a new coach.
      *
      * Input: name, realname, passwd, mail, phone, ring, settings, def_leagues (array of LIDs)
      **/
     global $settings;
     if (empty($input['name']) || empty($input['passwd']) || get_alt_col('coaches', 'name', $input['name'], 'coach_id') || !in_array($input['ring'], self::$RINGS[self::T_RING_GROUP_GLOBAL])) {
         return false;
     }
     $query = "INSERT INTO coaches (name, realname, passwd, mail, phone, ring, settings) \r\n                    VALUES ('" . mysql_real_escape_string($input['name']) . "',\r\n                            '" . mysql_real_escape_string($input['realname']) . "', \r\n                            '" . md5($input['passwd']) . "', \r\n                            '" . mysql_real_escape_string($input['mail']) . "', \r\n                            '" . mysql_real_escape_string($input['phone']) . "', \r\n                            " . $input['ring'] . ",\r\n                            '" . array_strpack_assoc('%k=%v', $input['settings'], ',') . "')";
     if (($status = mysql_query($query)) && is_numeric($cid = mysql_insert_id())) {
         // Set default memberships
         $newCoach = new Coach($cid);
         foreach (array_merge($settings['default_leagues'], $input['def_leagues']) as $lid) {
             $status &= $newCoach->setRing(self::T_RING_GROUP_LOCAL, self::T_RING_LOCAL_REGULAR, $lid);
         }
     }
     return $status ? $cid : false;
 }
Exemplo n.º 30
0
// Number of entries on the front page message board.
$settings['fp_messageboard']['show_team_news'] = true;
// Default is true. Show team news on the front page message board.
$settings['fp_messageboard']['show_match_summaries'] = true;
// Default is true. Show match summaries on the front page message board.
/*********************
 *   Front page boxes
 *********************/
/*
    The below settings define which boxes to show on the right side of the front page.

    Note, every box MUST have a UNIQUE 'box_ID' number.
    The box IDs are used to determine the order in which the boxes are shown on the front page.
    The box with 'box_ID' = 1 is shown at the top of the page, the box with 'box_ID' = 2 is displayed underneath it and so forth.
*/
/*********************
 *   Front page: tournament standings boxes
 *********************/
$settings['fp_standings'] = array(array('id' => $get_prime, 'box_ID' => 1, 'type' => 'tournament', 'infocus' => true, 'HRS' => get_alt_col('tours', 'tour_id', $get_prime, 'rs'), 'title' => get_alt_col('tours', 'tour_id', $get_prime, 'name'), 'length' => 12, 'fields' => array('Name' => 'name', 'PTS' => 'pts', 'TV' => 'tv', 'CAS' => 'cas', 'W' => 'won', 'L' => 'lost', 'D' => 'draw', 'GF' => 'gf', 'GA' => 'ga')), array('id' => $get_second, 'box_ID' => 2, 'type' => 'tournament', 'infocus' => false, 'HRS' => get_alt_col('tours', 'tour_id', $get_prime, 'rs'), 'title' => get_alt_col('tours', 'tour_id', $get_prime, 'name'), 'length' => 12, 'fields' => array('Name' => 'name', 'PTS' => 'pts', 'TV' => 'tv', 'CAS' => 'cas', 'W' => 'won', 'L' => 'lost', 'D' => 'draw', 'GF' => 'gf', 'GA' => 'ga')));
/*********************
 *   Front page: leaders boxes
 *********************/
$settings['fp_leaders'] = array(array('id' => $get_lid, 'box_ID' => 3, 'type' => 'league', 'title' => 'Most Individual Casualties (League)', 'field' => 'cas', 'length' => 5, 'show_team' => true), array('id' => $get_lid, 'box_ID' => 4, 'type' => 'league', 'title' => 'Most Individual Touchdowns (League)', 'field' => 'td', 'length' => 5, 'show_team' => true));
/*********************
 *   Front page: event boxes
 *********************/
$settings['fp_events'] = array(array('id' => $get_lid, 'box_ID' => 5, 'type' => 'league', 'title' => 'Latest Dead Players (League)', 'content' => 'dead', 'length' => 5), array('id' => $get_lid, 'box_ID' => 6, 'type' => 'league', 'title' => 'Latest Skills (League)', 'content' => 'skills', 'length' => 5));
/*********************
 *   Front page: latest games boxes
 *********************/
$settings['fp_latestgames'] = array(array('id' => $get_lid, 'box_ID' => 7, 'type' => 'league', 'title' => 'Recent Games (League)', 'length' => 5));