public function add(Request $request) { $className = $request->input('className'); $obj = new $className(); $obj = $obj::find($request->input('id')); \Star::star($obj, $request->input('value')); return response()->json('hehe'); }
public function postStar($id) { $StudentID = Auth::user()->StudentID; $owner = Post::find($id); $checkStar = Star::where('id', $id)->where('StudentID', $StudentID)->first(); if (count($checkStar) > 0) { $checkStar->delete(); } else { Star::create(['id' => $id, 'StudentID' => $StudentID, 'starstar' => '1']); PostNotification::create(['StudentID' => $StudentID, 'OwnerID' => $owner->StudentID, 'agroup' => 0, 'post_id' => $id, 'grouppageID' => 0, 'grouppagepostID' => 0, 'eventID' => 1, 'seen' => 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&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); }
$q = new C('?'); $po = new C('('); $pc = new C(')'); $bo = new C('['); $bc = new C(']'); $co = new C('{'); $cc = new C('}'); $num = new R('[+-]?((?:\\d*\\.\\d+|\\d+\\.\\d*)(?:[eE][+-]?\\d+)?|[1-9]\\d*|0(?:[xX][a-fA-F\\d]+|b[01]+)?)'); $str = new StrEscSeq(); $name = new R('[a-zA-Z_]\\w*'); $name_cl_o = new OptAnd(['NAME' => $name, $cl]); $stat = new Wrap(); $exp = new Wrap(); $exp_o = new Opt($exp); $exp_e = new OptE($exp); $code = new Star($stat); $blk = new CombAnd($co, $code, $cc); $blk_e = new CombAnd($co, new OptE($code), $cc); $enc = new CombAnd($po, $exp, $pc); $key = new CombOr(new CombAnd([$d, 'NAME' => $name]), new CombAnd([$bo, 'EXP' => $exp_e, $bc])); $var = new CombAnd(['SCOPE' => new Ss(['$', '@']), 'VAR' => $name, 'KEYS' => new Star($key)]); $else_o = new OptAnd([new S('else'), 'ELSE' => $stat]); $if = new CombAnd([new S('if'), 'IF' => $enc, 'STAT' => $stat, $else_o]); $case = new Star(new CombAnd(new CombOr(new CombAnd([new S('case'), 'CASE' => $exp]), new S('default')), new CombOr(['CODE' => new CombAnd($cl, $code), 'BLK' => $blk_e]))); $switch = new CombAnd([new S('switch'), 'SWITCH' => $enc, $co, 'CASE' => $case, $cc]); $while = new CombAnd(new S('while'), $enc); $foreach = new CombAnd([new S('foreach'), $po, 'FOREACH' => $exp, new OptAnd([$c, 'KEY' => new OptAnd($var, $cl), 'VAL' => $var]), $pc]); $for = new CombAnd([new S('for'), $po, 'INIT' => $exp_o, $sc, 'FOR' => $exp_e, $sc, 'REP' => $exp_o, $pc]); $loop = new CombAnd([new CombOr(['WHILE' => $while, $foreach, $for]), 'STAT' => $stat]); $do = new CombAnd([new S('do'), 'STAT' => $stat, 'DO' => $while, $sc]); $catch_o = new OptAnd([new S('catch'), new OptAnd($po, new Opt($var), $pc), 'CATCH' => $stat]);
private function _roster($ALLOW_EDIT, $DETAILED, $players) { global $rules, $settings, $lng, $skillididx; $team = $this; // Copy. Used instead of $this for readability. /****************************** * * Make the players ready for roster printing. * ******************************/ foreach ($players as $p) { /* Misc */ $p->name = preg_replace('/\\s/', ' ', $p->name); $p->position = preg_replace('/\\s/', ' ', $p->position); /* Colors */ // Fictive player color fields used for creating player table. $p->HTMLfcolor = '#000000'; $p->HTMLbcolor = COLOR_HTML_NORMAL; if ($p->is_sold && $DETAILED) { $p->HTMLbcolor = COLOR_HTML_SOLD; } elseif ($p->is_dead && $DETAILED) { $p->HTMLbcolor = COLOR_HTML_DEAD; } elseif ($p->is_mng) { $p->HTMLbcolor = COLOR_HTML_MNG; } elseif ($p->is_journeyman_used) { $p->HTMLbcolor = COLOR_HTML_JOURNEY_USED; } elseif ($p->is_journeyman) { $p->HTMLbcolor = COLOR_HTML_JOURNEY; } elseif ($p->mayHaveNewSkill()) { $p->HTMLbcolor = COLOR_HTML_NEWSKILL; } elseif ($DETAILED) { $p->HTMLbcolor = COLOR_HTML_READY; } $p->skills = '<small>' . $p->getSkillsStr(true) . '</small>'; $p->injs = $p->getInjsStr(true); $p->position = "<table style='border-spacing:0px;'><tr><td><img align='left' src='{$p->icon}' alt='player avatar'></td><td>" . $lng->getTrn("position/" . strtolower($lng->FilterPosition($p->position))) . "</td></tr></table>"; if ($DETAILED) { $p->mv_cas = "{$p->mv_bh}/{$p->mv_si}/{$p->mv_ki}"; $p->mv_spp = "{$p->mv_spp}/{$p->extra_spp}"; } // Characteristic's colors foreach (array('ma', 'ag', 'av', 'st') as $chr) { $sub = $p->{$chr} - $p->{"def_{$chr}"}; if ($sub == 0) { // Nothing! } elseif ($sub == 1) { $p->{"{$chr}_color"} = COLOR_HTML_CHR_EQP1; } elseif ($sub > 1) { $p->{"{$chr}_color"} = COLOR_HTML_CHR_GTP1; } elseif ($sub == -1) { $p->{"{$chr}_color"} = COLOR_HTML_CHR_EQM1; } elseif ($sub < -1) { $p->{"{$chr}_color"} = COLOR_HTML_CHR_LTM1; } if ($p->{$chr} != $p->{"{$chr}_ua"}) { $p->{"{$chr}_color"} = COLOR_HTML_CHR_BROKENLIMIT; $p->{$chr} = $p->{$chr . '_ua'} . ' <i>(' . $p->{$chr} . ' eff.)</i>'; } } /* New skills drop-down. */ $x = ''; if ($ALLOW_EDIT && $p->mayHaveNewSkill()) { $p->setChoosableSkills(); $x .= "<form method='POST'>\n"; $x .= "<select name='skill'>\n"; $x .= "<optgroup label='Normal skills'>\n"; foreach ($p->choosable_skills['norm'] as $s) { $x .= "<option value='{$s}'>" . $skillididx[$s] . "</option>\n"; } $x .= "</optgroup>\n"; $x .= "<optgroup label='Double skills'>\n"; foreach ($p->choosable_skills['doub'] as $s) { $x .= "<option value='{$s}'>" . $skillididx[$s] . "</option>\n"; } $x .= "</optgroup>\n"; $x .= "<optgroup label='Characteristic increases'>\n"; foreach ($p->choosable_skills['chr'] as $s) { global $CHR_CONV; $x .= "<option value='ach_{$s}'>+ " . ucfirst($CHR_CONV[$s]) . "</option>\n"; } $x .= "</optgroup>\n"; $x .= ' </select> <input type="submit" name="button" value="OK" onClick="if(!confirm(\'' . $lng->getTrn('common/confirm_box') . '\')){return false;}"> <input type="hidden" name="type" value="skill"> <input type="hidden" name="player" value="' . $p->player_id . '"> </form> </td> '; } $p->skills .= $x; } /* If enabled add stars and summed mercenaries entries to the roster */ if ($DETAILED) { $stars = array(); foreach (Star::getStars(STATS_TEAM, $team->team_id, false, false) as $s) { $s->name = preg_replace('/\\s/', ' ', $s->name); $s->player_id = $s->star_id; $s->nr = 0; $s->position = "<table style='border-spacing:0px;'><tr><td><img align='left' src='{$s->icon}' alt='player avatar'></td><td><i>Star player</i></td></tr></table>"; $s->setSkills(true); $s->skills = '<small>' . $s->skills . '</small>'; $s->injs = ''; $s->value = 0; foreach ($s->getStats(T_OBJ_TEAM, $team->team_id) as $k => $v) { $s->{$k} = $v; } $s->is_dead = $s->is_sold = $s->is_mng = $s->is_journeyman = false; $s->HTMLbcolor = COLOR_HTML_STARMERC; $s->href = array('link' => urlcompile(T_URL_PROFILE, T_OBJ_STAR, false, false, false), 'field' => 'obj_id', 'value' => 'player_id'); # Like in below $fields def, but with T_OBJ_STAR instead. array_push($stars, $s); } $players = array_merge($players, $stars); $smerc = (object) null; $smerc->mv_mvp = $smerc->mv_td = $smerc->mv_cp = $smerc->mv_intcpt = $smerc->mv_bh = $smerc->mv_si = $smerc->mv_ki = $smerc->skills = 0; foreach (Mercenary::getMercsHiredByTeam($team->team_id) as $merc) { $smerc->mv_mvp += $merc->mvp; $smerc->mv_td += $merc->td; $smerc->mv_cp += $merc->cp; $smerc->mv_intcpt += $merc->intcpt; $smerc->mv_bh += $merc->bh; $smerc->mv_si += $merc->si; $smerc->mv_ki += $merc->ki; $smerc->skills += $merc->skills; } $smerc->player_id = ID_MERCS; $smerc->nr = 0; $smerc->name = 'All mercenary hirings'; $smerc->position = "<i>Mercenaries</i>"; $smerc->mv_cas = "{$smerc->mv_bh}/{$smerc->mv_si}/{$smerc->mv_ki}"; $smerc->ma = '-'; $smerc->st = '-'; $smerc->ag = '-'; $smerc->av = '-'; $smerc->skills = 'Total bought extra skills: ' . $smerc->skills; $smerc->injs = ''; $smerc->mv_spp = '-'; $smerc->value = 0; $smerc->is_dead = $smerc->is_sold = $smerc->is_mng = $smerc->is_journeyman = false; $smerc->HTMLbcolor = COLOR_HTML_STARMERC; array_push($players, $smerc); } /****************************** * Team players table * ------------------ * * Contains player information and menu(s) for skill choice. * ******************************/ title($team->name . ($team->is_retired ? ' <font color="red"> (Retired)</font>' : '')); $fields = array('nr' => array('desc' => '#'), 'name' => array('desc' => $lng->getTrn('common/name'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_PLAYER, false, false, false), 'field' => 'obj_id', 'value' => 'player_id')), 'position' => array('desc' => $lng->getTrn('common/pos'), 'nosort' => true), 'ma' => array('desc' => 'Ma'), 'st' => array('desc' => 'St'), 'ag' => array('desc' => 'Ag'), 'av' => array('desc' => 'Av'), 'skills' => array('desc' => $lng->getTrn('common/skills'), 'nosort' => true), 'injs' => array('desc' => $lng->getTrn('common/injs'), 'nosort' => true), 'mv_cp' => array('desc' => 'Cp'), 'mv_td' => array('desc' => 'Td'), 'mv_intcpt' => array('desc' => 'Int'), 'mv_cas' => array('desc' => $DETAILED ? 'BH/SI/Ki' : 'Cas', 'nosort' => $DETAILED ? true : false), 'mv_mvp' => array('desc' => 'MVP'), 'mv_spp' => array('desc' => $DETAILED ? 'SPP/extra' : 'SPP', 'nosort' => $DETAILED ? true : false), 'value' => array('desc' => $lng->getTrn('common/value'), 'kilo' => true, 'suffix' => 'k')); echo "<a href=" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $this->team_id, false, false) . "&detailed=" . ($DETAILED ? 0 : 1) . ">" . $lng->getTrn('profile/team/viewtoggle') . "</a><br><br>\n"; HTMLOUT::sort_table($team->name . ' roster', urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $team->team_id, false, false) . ($DETAILED ? '&detailed=1' : '&detailed=0'), $players, $fields, $DETAILED ? array('+is_dead', '+is_sold', '+is_mng', '+is_journeyman', '+nr', '+name') : sort_rule('player'), isset($_GET['sort']) ? array(($_GET['dir'] == 'a' ? '+' : '-') . $_GET['sort']) : array(), array('color' => $DETAILED ? true : false, 'doNr' => false, 'noHelp' => true)); ?> <table class="text"> <tr> <td style="width: 100%;"> </td> <?php if ($DETAILED) { ?> <td style="background-color: <?php echo COLOR_HTML_READY; ?> ;"><font color='black'><b> Ready </b></font></td> <td style="background-color: <?php echo COLOR_HTML_MNG; ?> ;"><font color='black'><b> MNG </b></font></td> <td style="background-color: <?php echo COLOR_HTML_JOURNEY; ?> ;"><font color='black'><b> Journey </b></font></td> <td style="background-color: <?php echo COLOR_HTML_JOURNEY_USED; ?> ;"><font color='black'><b> Used journey </b></font></td> <td style="background-color: <?php echo COLOR_HTML_DEAD; ?> ;"><font color='black'><b> Dead </b></font></td> <td style="background-color: <?php echo COLOR_HTML_SOLD; ?> ;"><font color='black'><b> Sold </b></font></td> <td style="background-color: <?php echo COLOR_HTML_STARMERC; ?> ;"><font color='black'><b> Star/merc </b></font></td> <td style="background-color: <?php echo COLOR_HTML_NEWSKILL; ?> ;"><font color='black'><b> New skill </b></font></td> <?php } ?> </tr> </table> <?php }
$pb->assign('message', sprintf(Intl::msg('Can not protect %s directory with .htaccess, check permissions'), DATA_DIR)); $pb->renderPage('message'); } } } // XSRF protection with token if (!empty($_POST)) { if (!Session::isToken($_POST['token'])) { $pb->assign('message', Intl::msg('Wrong token')); $pb->renderPage('message'); } unset($_SESSION['tokens']); } $kfc = new FeedConf(CONFIG_FILE, FEED_VERSION); $kf = new Feed(DATA_FILE, CACHE_DIR, $kfc); $ks = new Star(STAR_FILE, ITEM_FILE, $kfc); // autosave opml if (Session::isLogged()) { if (!is_file(OPML_FILE)) { $kf->loadData(); file_put_contents(OPML_FILE, Opml::generateOpml($kf->getFeeds(), $kf->getFolders())); } else { if (filemtime(OPML_FILE) < time() - UPDATECHECK_INTERVAL) { $kf->loadData(); rename(OPML_FILE, OPML_FILE_SAVE); file_put_contents(OPML_FILE, Opml::generateOpml($kf->getFeeds(), $kf->getFolders())); } } } // List or Expanded ? $view = $kfc->view;
public static function report() { // Is $match_id valid? $match_id = (int) $_GET['mid']; if (!get_alt_col('matches', 'match_id', $match_id, 'match_id')) { fatal("Invalid match ID."); } global $lng, $stars, $rules, $settings, $coach, $racesHasNecromancer, $racesMayRaiseRotters, $DEA, $T_PMD__ENTRY_EXPECTED; global $T_MOUT_REL, $T_MOUT_ACH, $T_MOUT_IR, $T_MOUT_INJ; global $leagues, $divisions, $tours; $T_ROUNDS = Match::getRounds(); // Perform actions (delete, lock/unlock and reset). Needs the $IS_LOCAL_ADMIN = is_object($coach) && $coach->isNodeCommish(T_NODE_TOURNAMENT, get_alt_col('matches', 'match_id', $match_id, 'f_tour_id')); self::matchActions($IS_LOCAL_ADMIN); // Create objects $m = new Match($match_id); $team1 = new Team($m->team1_id); $team2 = new Team($m->team2_id); // Determine visitor privileges. $lid = $divisions[$tours[$m->f_tour_id]['f_did']]['f_lid']; $ALLOW_EDIT = !$m->locked && is_object($coach) && ($coach->ring == Coach::T_RING_GLOBAL_ADMIN || $leagues[$lid]['ring'] == Coach::T_RING_LOCAL_ADMIN || $coach->isInMatch($m->match_id)); $DIS = $ALLOW_EDIT ? '' : 'DISABLED'; // Lock page for other reasons? (Used journeys etc) $USED_JOURNEYMAN_PRESENT = false; foreach (array(1 => $team1, 2 => $team2) as $id => $t) { foreach ($t->getPlayers() as $p) { if (!self::player_validation($p, $m)) { continue; } if (!$m->is_played && $p->is_journeyman_used) { $USED_JOURNEYMAN_PRESENT = true; } } } if ($USED_JOURNEYMAN_PRESENT) { $DIS = 'DISABLED'; } // Relay to ES report page? if (isset($_GET['es_report'])) { # Don't care what value the GET field has! self::report_ES($match_id, !$ALLOW_EDIT); return; } $easyconvert = new array_to_js(); @$easyconvert->add_array($stars, 'phpStars'); // Load stars array into JavaScript array. echo $easyconvert->output_all(); echo '<script language="JavaScript" type="text/javascript"> var ID_MERCS = ' . ID_MERCS . '; var ID_STARS_BEGIN = ' . ID_STARS_BEGIN . '; </script> '; /***************** * * Submitted form? * *****************/ if (isset($_POST['button']) && $ALLOW_EDIT) { if (get_magic_quotes_gpc()) { $_POST['summary'] = stripslashes($_POST['summary']); } MTS('Report submit STARTED'); // FIRST, if any raised zombies are kept we need to create their player objects in order have the correct player- vs. match creation & played dates. foreach (array(1 => $team1, 2 => $team2) as $id => $t) { if (in_array($t->f_race_id, $racesHasNecromancer) && isset($_POST["t{$id}zombie"])) { $pos_id = $DEA[$t->f_rname]['players']['Zombie']['pos_id']; list($exitStatus, $pid) = Player::create(array('nr' => $t->getFreePlayerNr(), 'f_pos_id' => $pos_id, 'team_id' => $t->team_id, 'name' => 'RAISED ZOMBIE'), array('free' => true)); /* Knowing the new zombie's PID we relocate the zombie match data to regular player data - this allows us to use the same loop for submitting the zombie's match data. */ foreach ($T_PMD__ENTRY_EXPECTED as $f) { $postName = "{$f}_t{$id}zombie"; $_POST["{$f}_{$pid}"] = isset($_POST[$postName]) ? $_POST[$postName] : 0; unset($_POST[$postName]); } } } // SECONDLY, look for raised rotters too, do same as above with zombies... foreach (array(1 => $team1, 2 => $team2) as $id => $t) { if (in_array($t->f_race_id, $racesMayRaiseRotters) && isset($_POST["t{$id}rotterCnt"]) && ($N = (int) $_POST["t{$id}rotterCnt"]) > 0) { foreach (range(1, $N) as $n) { $pos_id = $DEA[$t->f_rname]['players']['Rotter']['pos_id']; list($exitStatus, $pid) = Player::create(array('nr' => $t->getFreePlayerNr(), 'f_pos_id' => $pos_id, 'team_id' => $t->team_id, 'name' => "RAISED ROTTER {$n}"), array('free' => true)); /* Knowing the new rotter's PID we relocate the rotter match data to regular player data - this allows us to use the same loop for submitting the rotter's match data. */ foreach ($T_PMD__ENTRY_EXPECTED as $f) { $postName = "{$f}_t{$id}rotter{$n}"; $_POST["{$f}_{$pid}"] = isset($_POST[$postName]) ? $_POST[$postName] : 0; unset($_POST[$postName]); } } } } // Update general match data status($m->update(array('submitter_id' => (int) $_SESSION['coach_id'], 'stadium' => (int) $_POST['stadium'], 'gate' => (int) $_POST['gate'] * 1000, 'fans' => (int) $_POST['fans'], 'ffactor1' => (int) $_POST['ff1'], 'ffactor2' => (int) $_POST['ff2'], 'income1' => (int) $_POST['inc1'] * 1000, 'income2' => (int) $_POST['inc2'] * 1000, 'team1_score' => (int) $_POST['result1'], 'team2_score' => (int) $_POST['result2'], 'smp1' => (int) $_POST['smp1'], 'smp2' => (int) $_POST['smp2'], 'tcas1' => (int) $_POST['tcas1'], 'tcas2' => (int) $_POST['tcas2'], 'fame1' => (int) $_POST['fame1'], 'fame2' => (int) $_POST['fame2'], 'tv1' => (int) $_POST['tv1'] * 1000, 'tv2' => (int) $_POST['tv2'] * 1000)), 'Saving match report'); if (!empty($_POST['summary'])) { $m->saveText($_POST['summary']); # Save summery. } MTS('matches entry submitted'); // Update match's player data foreach (array(1 => $team1, 2 => $team2) as $id => $t) { /* Save ordinary players */ foreach ($t->getPlayers() as $p) { if (!self::player_validation($p, $m)) { continue; } // We create zero entries for MNG player(s). This is required! $pid = $p->player_id; # Shortcut if ($p->getStatus($m->match_id) == MNG) { $_POST["mvp_{$pid}"] = 0; $_POST["cp_{$pid}"] = 0; $_POST["td_{$pid}"] = 0; $_POST["intcpt_{$pid}"] = 0; $_POST["bh_{$pid}"] = 0; $_POST["si_{$pid}"] = 0; $_POST["ki_{$pid}"] = 0; $_POST["ir1_d1_{$pid}"] = 0; $_POST["ir1_d2_{$pid}"] = 0; $_POST["ir2_d1_{$pid}"] = 0; $_POST["ir2_d2_{$pid}"] = 0; $_POST["ir3_d1_{$pid}"] = 0; $_POST["ir3_d2_{$pid}"] = 0; $_POST["inj_{$pid}"] = NONE; $_POST["agn1_{$pid}"] = NONE; $_POST["agn2_{$pid}"] = NONE; } $m->entry($p->player_id, array('mvp' => $_POST["mvp_{$pid}"], 'cp' => $_POST["cp_{$pid}"], 'td' => $_POST["td_{$pid}"], 'intcpt' => $_POST["intcpt_{$pid}"], 'bh' => $_POST["bh_{$pid}"], 'si' => $_POST["si_{$pid}"], 'ki' => $_POST["ki_{$pid}"], 'ir1_d1' => $_POST["ir1_d1_{$pid}"], 'ir1_d2' => $_POST["ir1_d2_{$pid}"], 'ir2_d1' => $_POST["ir2_d1_{$pid}"], 'ir2_d2' => $_POST["ir2_d2_{$pid}"], 'ir3_d1' => $_POST["ir3_d1_{$pid}"], 'ir3_d2' => $_POST["ir3_d2_{$pid}"], 'inj' => $_POST["inj_{$pid}"], 'agn1' => $_POST["agn1_{$pid}"], 'agn2' => $_POST["agn2_{$pid}"])); } MTS('Saved all REGULAR player entries in match_data for team ' . $id); /* Save stars entries. */ foreach ($stars as $star) { $s = new Star($star['id']); if (isset($_POST['team_' . $star['id']]) && $_POST['team_' . $star['id']] == $id) { $sid = $s->star_id; $m->entry($sid, array('f_team_id' => $t->team_id, 'mvp' => isset($_POST["mvp_{$sid}"]) && $_POST["mvp_{$sid}"] ? 1 : 0, 'cp' => $_POST["cp_{$sid}"], 'td' => $_POST["td_{$sid}"], 'intcpt' => $_POST["intcpt_{$sid}"], 'bh' => $_POST["bh_{$sid}"], 'si' => $_POST["si_{$sid}"], 'ki' => $_POST["ki_{$sid}"], 'ir1_d1' => 0, 'ir1_d2' => 0, 'ir2_d1' => 0, 'ir2_d2' => 0, 'ir3_d1' => 0, 'ir3_d2' => 0, 'inj' => NONE, 'agn1' => NONE, 'agn2' => NONE)); } else { $s->rmMatchEntry($m->match_id, $t->team_id); } } MTS('Saved all STAR player entries in match_data for team ' . $id); /* Save mercenary entries. */ Mercenary::rmMatchEntries($m->match_id, $t->team_id); // Remove all previously saved mercs in this match. for ($i = 0; $i <= 20; $i++) { # We don't expect over 20 mercs. This is just some large random number. $idm = '_' . ID_MERCS . '_' . $i; if (isset($_POST["team{$idm}"]) && $_POST["team{$idm}"] == $id) { $m->entry(ID_MERCS, array('f_team_id' => $t->team_id, 'nr' => $i, 'skills' => $_POST["skills{$idm}"], 'mvp' => isset($_POST["mvp{$idm}"]) && $_POST["mvp{$idm}"] ? 1 : 0, 'cp' => $_POST["cp{$idm}"], 'td' => $_POST["td{$idm}"], 'intcpt' => $_POST["intcpt{$idm}"], 'bh' => $_POST["bh{$idm}"], 'si' => $_POST["si{$idm}"], 'ki' => $_POST["ki{$idm}"], 'ir1_d1' => 0, 'ir1_d2' => 0, 'ir2_d1' => 0, 'ir2_d2' => 0, 'ir3_d1' => 0, 'ir3_d2' => 0, 'inj' => NONE, 'agn1' => NONE, 'agn2' => NONE)); } } MTS('Saved all MERC player entries in match_data for team ' . $id); } $m->finalizeMatchSubmit(); # Required! MTS('Report submit ENDED'); // Refresh objects used to display form. $m = new Match($match_id); $team1 = new Team($m->team1_id); $team2 = new Team($m->team2_id); } // Change round form submitted? if ($IS_LOCAL_ADMIN && isset($_POST['round'])) { status($m->chRound((int) $_POST['round'])); } /**************** * * Generate form * ****************/ $teamUrl1 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team1_id, false, false) . "\">" . $m->team1_name . "</a>"; $teamUrl2 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team2_id, false, false) . "\">" . $m->team2_name . "</a>"; $coachUrl1 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_COACH, $team1->owned_by_coach_id, false, false) . "\">" . $team1->f_cname . "</a>"; $coachUrl2 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_COACH, $team2->owned_by_coach_id, false, false) . "\">" . $team2->f_cname . "</a>"; $raceUrl1 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_RACE, $team1->f_race_id, false, false) . "\">" . $lng->getTrn('race/' . strtolower(str_replace(' ', '', $team1->f_rname))) . "</a>"; $raceUrl2 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_RACE, $team2->f_race_id, false, false) . "\">" . $lng->getTrn('race/' . strtolower(str_replace(' ', '', $team2->f_rname))) . "</a>"; $leagueUrl = League::getLeagueUrl(get_parent_id(T_NODE_MATCH, $m->match_id, T_NODE_LEAGUE)); $divUrl = "<a href=\"" . urlcompile(T_URL_STANDINGS, T_OBJ_TEAM, false, T_NODE_DIVISION, get_parent_id(T_NODE_MATCH, $m->match_id, T_NODE_DIVISION)) . "\">" . get_parent_name(T_NODE_MATCH, $m->match_id, T_NODE_DIVISION) . "</a>"; $tourUrl = Tour::getTourUrl(get_parent_id(T_NODE_MATCH, $m->match_id, T_NODE_TOURNAMENT)); title($teamUrl1 . " - " . $teamUrl2); $CP = 8; // Colspan. ?> <table> <tr><td></td><td style='text-align: right;'><i><?php echo $lng->getTrn('common/home'); ?> </i></td><td>—</td><td style='text-align: left;'><i><?php echo $lng->getTrn('common/away'); ?> </i></td></tr> <tr><td><b><?php echo $lng->getTrn('common/teams'); ?> </b>:</td><td style='text-align: right;'><?php echo "{$teamUrl1}</td><td> — </td><td style='text-align: left;'>{$teamUrl2}"; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/coaches'); ?> </b>:</td><td style='text-align: right;'><?php echo "{$coachUrl1}</td><td> — </td><td style='text-align: left;'>{$coachUrl2}"; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/races'); ?> </b>:</td><td style='text-align: right;'><?php echo "{$raceUrl1}</td><td> — </td><td style='text-align: left;'>{$raceUrl2}"; ?> </td></tr> <tr><td colspan="4"><hr></td></tr> <tr><td><b><?php echo $lng->getTrn('common/league'); ?> </b>:</td><td colspan="3"> <?php echo $leagueUrl; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/division'); ?> </b>:</td><td colspan="3"> <?php echo $divUrl; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/tournament'); ?> </b>:</td><td colspan="3"><?php echo $tourUrl; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/round'); ?> </b>:</td><td colspan="3"> <?php echo $T_ROUNDS[$m->round]; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/dateplayed'); ?> </b>:</td><td colspan="3"><?php echo $m->is_played ? textdate($m->date_played) : '<i>' . $lng->getTrn('matches/report/notplayed') . '</i>'; ?> </td></tr> <?php if (Module::isRegistered('PDFMatchReport')) { $str = '<a href="handler.php?type=pdfmatchreport&tid1=' . $team1->team_id . '&tid2=' . $team2->team_id . '&mid=' . $m->match_id . '" TARGET="_blank">Download PDF report</a>'; echo "<tr><td><b>Match report</b>:</td><td>{$str}</td></tr>"; } if (Module::isRegistered('UPLOAD_BOTOCS')) { echo "<tr><td><b>Replay</b>:</td><td colspan='3'><a href='handler.php?type=leegmgr&replay={$m->match_id}'>View replay</a></td></tr>"; } if ($IS_LOCAL_ADMIN) { ?> <script language="JavaScript" type="text/javascript"> function match_delete() { return confirm('<?php echo $lng->getTrn('matches/tourmatches/matchdelete'); ?> '); } function match_reset() { return confirm('<?php echo $lng->getTrn('matches/tourmatches/reset_notice'); ?> '); } </script> <?php $matchURL = "index.php?section=matches&type=report&mid={$m->match_id}"; $deleteURL = "index.php?section=matches&type=tourmatches&trid={$m->f_tour_id}&mid={$m->match_id}"; echo "<tr><td><b>Admin:</b></td><td colspan='3'><b>"; echo "<a onclick=\"return match_reset();\" href='{$matchURL}&action=reset'>" . $lng->getTrn('common/reset') . "</a> \n"; echo "<a onclick=\"return match_delete();\" href='{$deleteURL}&action=delete' style='color:" . (!empty($m->date_played) ? 'Red' : 'Blue') . ";'>" . $lng->getTrn('common/delete') . "</a> \n"; echo "<a href='{$matchURL}&action=" . ($m->locked ? 'unlock' : 'lock') . "'>" . ($m->locked ? $lng->getTrn('common/unlock') : $lng->getTrn('common/lock')) . "</a> \n"; echo "<br><a href='javascript:void(0);' onClick='slideToggleFast(\"chRound\");'>" . $lng->getTrn('matches/report/chround') . "</a><div id='chRound' style='display:none;'>\n\t\t<form method='POST'>\n\t\t<select name='round'>"; foreach ($T_ROUNDS as $id => $desc) { echo "<option value='{$id}'>" . $desc . "</option>\n"; } echo "</select>\n\t\t<input type='submit' value='" . $lng->getTrn('matches/report/chround') . "'>\n\t\t</form>\n\t\t</div>"; echo "</b></td></tr>"; } ?> </table> <br> <?php echo "<b><a TARGET='_blank' href='" . DOC_URL_GUIDE . "'>" . $lng->getTrn('common/needhelp') . "</a></b><br><br>"; ?> <form method="POST" enctype="multipart/form-data"> <table class="common"> <tr class='commonhead'><td colspan="<?php echo $CP; ?> "><b><?php echo $lng->getTrn('matches/report/info'); ?> </b></td></tr> <tr><td class='seperator' colspan='<?php echo $CP; ?> '></td></tr> <tr><td colspan='<?php echo $CP; ?> '> <b><?php echo $lng->getTrn('matches/report/stadium'); ?> </b> <select name="stadium" <?php echo $DIS; ?> > <?php $stad = $m->stadium ? $m->stadium : $m->team1_id; foreach (array($team1, $team2) as $_t) { echo "<option value='{$_t->team_id}'" . ($stad == $_t->team_id ? 'SELECTED' : '') . ">{$_t->name}</option>\n"; } ?> </select> </td></tr> <tr><td colspan='<?php echo $CP; ?> '> <b><?php echo $lng->getTrn('common/gate'); ?> </b> <input type="text" name="gate" onChange='numError(this);' value="<?php echo $m->gate ? $m->gate / 1000 : 0; ?> " size="4" maxlength="4" <?php echo $DIS; ?> >k </td></tr> <tr><td colspan='<?php echo $CP; ?> '> <b><?php echo $lng->getTrn('matches/report/fans'); ?> </b> <input type="text" name="fans" onChange='numError(this);' value="<?php echo $m->fans; ?> " size="7" maxlength="12" <?php echo $DIS; ?> > </td></tr> <?php if (!$settings['hide_ES_extensions']) { ?> <tr><td colspan='<?php echo $CP; ?> '> <b>E</b>xtra player <b>S</b>tats (ES) <a href="index.php?section=matches&type=report&mid=<?php echo $m->match_id; ?> &es_report=1">report page here</a> </td></tr> <?php } ?> <tr><td class="seperator" colspan='<?php echo $CP; ?> '></td></tr> <tr class='commonhead'> <td><b><?php echo $lng->getTrn('common/teams'); ?> </b></td> <td><b><?php echo $lng->getTrn('common/score'); ?> </b></td> <td><b>Δ <?php echo $lng->getTrn('matches/report/treas'); ?> </b></td> <td><b><?php echo $lng->getTrn('matches/report/ff'); ?> </b></td> <td><b><?php echo $lng->getTrn('matches/report/smp'); ?> </b></td> <td><b><?php echo $lng->getTrn('matches/report/tcas'); ?> </b></td> <td><b><?php echo $lng->getTrn('matches/report/fame'); ?> </b></td> <td><b><?php echo $lng->getTrn('matches/report/tv'); ?> </b></td> </tr> <tr><td class='seperator' colspan='<?php echo $CP; ?> '></td></tr> <?php foreach (array(1, 2) as $N) { echo "<tr>\n"; echo "<td>" . ${"teamUrl{$N}"} . "</td>\n"; echo "<td><input type='text' onChange='numError(this);' name='result{$N}' value='" . (int) $m->{"team{$N}_score"} . "' size='1' maxlength='2' {$DIS}></td>\n"; echo "<td><input type='text' onChange='numErrorAllowNegative(this);' name='inc{$N}' value='" . (int) $m->{"income{$N}"} / 1000 . "' size='4' maxlength='4' {$DIS}>k</td>\n"; echo "<td>"; foreach (array('1' => 'green', '0' => 'blue', '-1' => 'red') as $Nff => $color) { echo "<input {$DIS} type='radio' name='ff{$N}' value='{$Nff}' " . ($m->{"ffactor{$N}"} == (int) $Nff ? 'CHECKED' : '') . "><font color='{$color}'><b>{$Nff}</b></font>"; } echo "</td>\n"; echo "<td><input type='text' onChange='numError(this);' name='smp{$N}' value='" . $m->{"smp{$N}"} . "' size='1' maxlength='2' {$DIS}>" . $lng->getTrn('matches/report/pts') . "</td>\n"; echo "<td><input type='text' onChange='numError(this);' name='tcas{$N}' value='" . $m->{"tcas{$N}"} . "' size='1' maxlength='2' {$DIS}></td>\n"; echo "<td><input type='text' onChange='numError(this);' name='fame{$N}' value='" . $m->{"fame{$N}"} . "' size='1' maxlength='2' {$DIS}></td>\n"; echo "<td><input type='text' onChange='numError(this);' name='tv{$N}' value='" . ($m->is_played ? $m->{"tv{$N}"} / 1000 : ${"team{$N}"}->value / 1000) . "' size='4' maxlength='10' {$DIS}>k</td>\n"; echo "</tr>\n"; } ?> </table> <?php $playerFields = array_merge($T_MOUT_REL, $T_MOUT_ACH, $T_MOUT_IR, $T_MOUT_INJ); $CPP = count($playerFields); foreach (array(1 => $team1, 2 => $team2) as $id => $t) { ?> <table class='common'> <tr><td class='seperator' colspan='<?php echo $CPP; ?> '></td></tr> <tr class='commonhead'><td colspan='<?php echo $CPP; ?> '> <b><a href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $t->team_id, false, false); ?> "><?php echo $t->name; ?> </a> <?php echo $lng->getTrn('matches/report/report'); ?> </b> </td></tr> <tr><td class='seperator' colspan='<?php echo $CPP; ?> '></td></tr> <?php echo "<tr>\n"; foreach (array_values($playerFields) as $f) { // We need to translate table headers switch (strtolower(str_replace(' ', '', $f))) { case 'name': $header_text = $lng->getTrn('common/name'); break; case 'mvp': $header_text = $lng->getTrn('matches/report/mvp'); break; case 'cp': $header_text = $lng->getTrn('matches/report/cp'); break; case 'bh': $header_text = $lng->getTrn('matches/report/bh'); break; case 'si': $header_text = $lng->getTrn('matches/report/si'); break; case 'ki': $header_text = $lng->getTrn('matches/report/ki'); break; case 'ir1d1': $header_text = $lng->getTrn('matches/report/ir1') . " D1"; break; case 'ir1d2': $header_text = $lng->getTrn('matches/report/ir1') . " D2"; break; case 'ir2d1': $header_text = $lng->getTrn('matches/report/ir2') . " D1"; break; case 'ir2d2': $header_text = $lng->getTrn('matches/report/ir2') . " D2"; break; case 'ir3d1': $header_text = $lng->getTrn('matches/report/ir3') . " D1"; break; case 'ir3d2': $header_text = $lng->getTrn('matches/report/ir3') . " D2"; break; case 'inj': $header_text = $lng->getTrn('matches/report/inj'); break; case 'ageing1': $header_text = $lng->getTrn('matches/report/ageing1'); break; case 'ageing2': $header_text = $lng->getTrn('matches/report/ageing2'); break; default: $header_text = $f; } echo "<td><i>{$header_text}</i></td>\n"; } echo "</tr>\n"; $NORMSTAT = true; // only normal player statuses foreach ($t->getPlayers() as $p) { if (!self::player_validation($p, $m)) { continue; } // Fetch player data from match $status = $p->getStatus($m->match_id); $mdat = $m->getPlayerEntry($p->player_id); // Print player row if ($p->is_journeyman_used && !$m->is_played) { $bgcolor = COLOR_HTML_JOURNEY_USED; $NORMSTAT = false; } elseif ($p->is_journeyman) { $bgcolor = COLOR_HTML_JOURNEY; $NORMSTAT = false; } elseif ($status == MNG) { $bgcolor = COLOR_HTML_MNG; $NORMSTAT = false; } elseif ($p->mayHaveNewSkill()) { $bgcolor = COLOR_HTML_NEWSKILL; $NORMSTAT = false; } else { $bgcolor = false; } self::_print_player_row($p->player_id, '<a href="index.php?section=objhandler&type=1&obj=1&obj_id=' . $p->player_id . '">' . $p->name . '</a>', $p->nr, $lng->getTrn('position/' . strtolower($lng->FilterPosition($p->position))) . ($status == MNG ? ' [MNG]' : ''), $bgcolor, $mdat, $DIS || $status == MNG); } echo "</table>\n"; echo "<br>\n"; if (!$NORMSTAT) { ?> <table class="text"><tr><td style="width: 100%;"></td><?php if (1) { ?> <td style="background-color: <?php echo COLOR_HTML_MNG; ?> ;"><font color='black'><b> MNG </b></font></td> <td style="background-color: <?php echo COLOR_HTML_JOURNEY; ?> ;"><font color='black'><b> Journeyman </b></font></td> <td style="background-color: <?php echo COLOR_HTML_JOURNEY_USED; ?> ;"><font color='black'><b> Used journeyman </b></font></td> <td style="background-color: <?php echo COLOR_HTML_NEWSKILL; ?> ;"><font color='black'><b> New skill available </b></font></td> <?php } ?> </tr></table><?php } // Add raised zombies global $racesHasNecromancer; if (in_array($t->f_race_id, $racesHasNecromancer)) { echo "<hr style='width:200px;float:left;'><br>\n <b>Raised zombie?:</b> <input type='checkbox' name='t{$id}zombie' value='1' onclick='slideToggleFast(\"t{$id}zombie\");'><br>\n"; echo "<div id='t{$id}zombie' style='display:none;'>\n"; echo "<table class='common'>\n"; self::_print_player_row("t{$id}zombie", 'Raised zombie', '—', 'Zombie', false, array(), $DIS); echo "</table>\n"; echo "</div>\n"; } // Add raised rotters global $racesMayRaiseRotters; if (in_array($t->f_race_id, $racesMayRaiseRotters)) { $maxRotters = 6; # Note there is no real limit for raised rotters. echo "<hr style='width:200px;float:left;'><br>\n <b>Raised rotters?:</b>\n <select name='t{$id}rotterCnt' onChange='var i = this.options[this.selectedIndex].value; var j=1; for (j=1; j<={$maxRotters}; j++) {if (j<=i) {slideDownFast(\"t{$id}rotter\"+j);} else {slideUpFast(\"t{$id}rotter\"+j);}}' >"; foreach (range(0, $maxRotters) as $n) { echo "<option value='{$n}'>{$n}</option>"; } echo "</select>\n"; foreach (range(0, $maxRotters) as $n) { echo "<div id='t{$id}rotter{$n}' style='display:none;'><table class='common'>\n"; self::_print_player_row("t{$id}rotter{$n}", "Raised Rotter #{$n}", '—', 'Rotter', false, array(), $DIS); echo "</table></div>\n"; } } ?> <table style='border-spacing: 0px 10px;'> <tr><td align="left" valign="top"> <b>Star Players</b>: <input type='button' id="addStarsBtn_<?php echo $id; ?> " value="<?php echo $lng->getTrn('common/add'); ?> " onClick="stars = document.getElementById('stars_<?php echo $id; ?> '); addStarMerc(<?php echo $id; ?> , stars.options[stars.selectedIndex].value);" <?php echo $DIS; ?> > <select id="stars_<?php echo $id; ?> " <?php echo $DIS; ?> > <?php foreach ($stars as $s => $d) { echo "<option " . (in_array($t->f_race_id, $d['races']) ? 'style="background-color: ' . COLOR_HTML_READY . ';"' : '') . " value='{$d['id']}'>{$s}</option>\n"; } ?> </select> </td></tr> <tr><td align="left" valign="top"> <b>Mercenaries</b>: <input type='button' id="addMercsBtn_<?php echo $id; ?> " value="<?php echo $lng->getTrn('common/add'); ?> " onClick="addStarMerc(<?php echo "{$id}, " . ID_MERCS; ?> );" <?php echo $DIS; ?> > </td></tr> </table> <table class='common' id='<?php echo "starsmercs_{$id}"; ?> '> </table> <?php } ?> <table class='common'> <tr><td class='seperator' colspan='13'></td></tr> <tr class='commonhead'><td colspan='13'><b><?php echo $lng->getTrn('matches/report/summary'); ?> </b></td></tr> <tr><td colspan='13'><textarea name='summary' rows='10' cols='100' <?php echo $DIS . ">" . $m->getText(); ?> </textarea></td></tr> </table> <br> <center> <input type="submit" name='button' value="<?php echo $lng->getTrn('common/save'); ?> " <?php echo $DIS; ?> > <?php if ($USED_JOURNEYMAN_PRESENT) { echo "<br><br><b>" . $lng->getTrn('matches/report/usedjourney') . "</b>"; } ?> </center> </form> <br><br> <?php /* Now, we call javascript routine(s) to fill out stars and mercs rows, if such entries exist in database. */ $i = 0; // Counter. Used to pass PHP-data to Javascript. foreach (array(1 => $team1->team_id, 2 => $team2->team_id) as $id => $t) { foreach (Star::getStars(STATS_TEAM, $t, STATS_MATCH, $m->match_id) as $s) { echo "<script language='JavaScript' type='text/javascript'>\n"; echo "var mdat{$i} = [];\n"; $mdat = $s->getStats(T_NODE_MATCH, $m->match_id); foreach (array_keys($T_MOUT_ACH) as $f) { echo "mdat{$i}['{$f}'] = " . $mdat[$f] . ";\n"; } echo "existingStarMerc({$id}, {$s->star_id}, mdat{$i});\n"; echo "</script>\n"; $i++; } foreach (Mercenary::getMercsHiredByTeam($t, $m->match_id) as $merc) { echo "<script language='JavaScript' type='text/javascript'>\n"; echo "var mdat{$i} = [];\n"; foreach (array_merge(array_keys($T_MOUT_ACH), array('skills')) as $f) { echo "mdat{$i}['{$f}'] = " . $merc->{$f} . ";\n"; } echo "existingStarMerc({$id}, " . ID_MERCS . ", mdat{$i});\n"; echo "</script>\n"; $i++; } } }
<?php session_start(); include_once "stars_bd.php"; if (isset($_POST['valeur'])) { if (isset($_POST)) { $starBD = new StarsBD(); $star = new Star(-1, $_POST['utilisateur'], $_POST['film'], $_POST['valeur']); if ($starBD->getUserMovieStars($star->getUser(), $star->getMovie()) == null) { $starBD->addRateMovie($star); } else { $starBD->updateRateMovie($star); } } header('Location: ../movie.php?id=' . $star->getMovie()); } ?>
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'); }
public function finalizeMatchSubmit() { // Run triggers. SQLTriggers::run(T_SQLTRIG_MATCH_UPD, array('mid' => $this->match_id, 'trid' => $this->f_tour_id, 'tid1' => $this->team1_id, 'tid2' => $this->team2_id, 'played' => (int) $this->is_played)); Module::runTriggers(T_TRIGGER_MATCH_SAVE, array($this->match_id)); foreach (Star::getStars(false, false, STATS_MATCH, $this->match_id) as $s) { mysql_query("SELECT syncMVplayer({$s->star_id}, {$this->f_tour_id})"); } return true; }
<input type="hidden" name="teamID" id="teamID"> </form> </div> </div> <div class="row bio"> <div class="col-sm-4"> <strong>Starring</strong> </div> <div class="col-sm-8"> <?php if ($portraitedby == null) { echo "-"; } else { foreach ($portraitedby as $star) { if ($star) { echo "<a href='#' id='" . $star->getStarId() . "' onclick='sendStarID(this.id)'>" . Star::findById($star->getStarId())->getFirstName() . " " . Star::findById($star->getStarId())->getLastName() . "</a><br>"; } } } ?> <form id="star-form" action="star.php" method="post"> <input type="hidden" name="starID" id="starID"> </form> </div> </div> </div> <!--Power--> <div class="col-xs-4"> <h3 class="text-danger">POWERGRID</h3> <div class="row">
private static function initializeConnection() { if (is_null(self::$dbConn)) { self::$dbConn = DatabasePDO::getInstance(); } }
<!-- Latest compiled and minified JavaScript --> <script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script> <link rel="stylesheet" href="css.css"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="server.js" type="text/javascript"></script> </head> <body class="bg2"> <?php require "server/DatabasePDO.php"; require "server/Star.php"; require "server/PortraitedBy.php"; require "server/PortraitedIn.php"; require "server/Superhero.php"; require "server/Movie.php"; $star = Star::findById($_POST["starID"]); $portraitedin = PortraitedIn::findByStarId($star->getId()); $portraitedby = PortraitedBy::findByStarId($star->getId()); ?> <img id="upper_left" class="reflect" src="images/spiderman.png" width="450px"> <div class="container result"> <div class="row text-center header"> <div id="logo"></div> </div> <!--Character Start--> <div class="panel panel-default"> <div class="panel-heading text-center"> STAR </div>
</p> <h4 class="text-primary">Rating</h4> <p><?php echo $movie->getImdbScore(); ?> </p> <h4 class="text-primary">Plot</h4> <p><?php echo $movie->getPlot(); ?> </p> <h4 class="text-primary">Cast</h4> <div class="row"> <?php foreach ($portraitedin as $starID) { $star = Star::findById($starID->getStarId()); echo "<div class='col-xs-2'>"; echo "<a href='#' id='" . $star->getId() . "' onclick='sendStarID(this.id)'>"; echo "<div class='thumbnail'>"; echo "<img src='" . $star->getImageUrl() . "' class='img-rounded' width='100px' height='80px'>"; echo "<div class='caption text-center'>"; echo "<p>" . $star->getFirstName() . " " . $star->getLastName() . "</p>"; echo "</div>"; echo "</div>"; echo "</a>"; echo "</div>"; } ?> <form id="star-form" action="star.php" method="post"> <input type="hidden" name="starID" id="starID"> </form>