Ejemplo n.º 1
0
 function post($request)
 {
     $response = new Response($request);
     if (isset($_POST['tour'])) {
         // Remove those slashes
         if (get_magic_quotes_gpc()) {
             $tour = stripslashes($_POST['tour']);
         } else {
             $tour = $_POST['tour'];
         }
         $tour_obj = json_decode($tour);
         $entitymanager = GeocacheManager::getInstance();
         //~ print_r($tour_obj);
         $data = array();
         $data['name'] = $tour_obj->name;
         $data['webcode'] = isset($tour_obj->webcode) ? $tour_obj->webcode : $this->get_new_webcode();
         $data['geocaches'] = $entitymanager->parseGeocaches($tour_obj->geocaches);
         $data['ownWaypoints'] = $entitymanager->parseOwnWaypoints($tour_obj->costumMarkers);
         $tour = new Tour($data);
         $tour->save();
         $response->code = Response::OK;
         $response->addHeader('Content-type', 'text/plain');
         $response->body = $tour->__toJSON();
     } else {
         $response->code = Response::BADREQUEST;
     }
     return $response;
 }
Ejemplo n.º 2
0
 function display()
 {
     $tour = new Tour();
     global $sugar_config;
     // $ss = new Sugar_Smarty();
     $db = DBManagerFactory::getInstance();
     // ONLY LOAD A RECORD IF A RECORD ID IS GIVEN;
     // A RECORD ID IS NOT GIVEN WHEN VIEWING IN LAYOUT EDITOR
     $record = isset($_GET["record"]) ? htmlspecialchars($_GET["record"]) : '';
     $tour->retrieve($record);
     $template = file_get_contents('modules/Tours/tpls/exports/template-dos.htm');
     $template = str_replace('${SITE_URL}', $sugar_config['site_url'], $template);
     $template = str_replace('${TOUR_NOTE}', html_entity_decode_utf8($tour->description), $template);
     $template = str_replace('${CODE}', $tour->tour_code, $template);
     $template = str_replace('${NAME}', $tour->name, $template);
     $template = str_replace('${TRANSPORT}', $tour->transport2, $template);
     $template = str_replace('${START_DATE}', $tour->start_date, $template);
     $template = str_replace('${DURATION}', $tour->duration, $template);
     // Hieu fix issue 1438
     if ($tour->picture) {
         $main_picture = '
                 <!--[if gte vml 1]>
                 <o:wrapblock>
                     <v:shape id="Picture_x0020_11"
                              o:spid="_x0000_s1028" type="#_x0000_t75"
                              alt=""
                              style=\'position:absolute;margin-left:0;margin-top:0;width:470.55pt;height:234pt;
               z-index:251657216;visibility:visible;mso-wrap-style:square;
               mso-width-percent:0;mso-height-percent:0;mso-wrap-distance-left:9pt;
               mso-wrap-distance-top:0;mso-wrap-distance-right:9pt;
               mso-wrap-distance-bottom:0;mso-position-horizontal:center;
               mso-position-horizontal-relative:margin;mso-position-vertical:absolute;
               mso-position-vertical-relative:text;mso-width-percent:0;mso-height-percent:0;
               mso-width-relative:page;mso-height-relative:page\'>
                         <v:imagedata src="' . $sugar_config['site_url'] . "/modules/images/" . $tour->picture . '"
                                      o:title="phan%20thiet%20beach"/>
                         <o:lock v:ext="edit" aspectratio="f"/>
                         <w:wrap type="topAndBottom" anchorx="margin"/>
                     </v:shape><![endif]--><![if !vml]><img width=627 height=312
                                                            src="' . $sugar_config['site_url'] . "/modules/images/" . $tour->picture . '"
                                                            alt=""
                                                            v:shapes="Picture_x0020_11"><![endif]><!--[if gte vml 1]></o:wrapblock>
                 <![endif]-->
             ';
     } else {
         $main_picture = '';
     }
     $template = str_replace('${PICTURE}', $main_picture, $template);
     // End issue 1438
     $template = str_replace('${TOUR_PROGRAM_LINES}', html_entity_decode_utf8($tour->get_data_to_expor2word()), $template);
     $size = strlen($template);
     $filename = "TOUR_PROGRAM_" . $tour->name . ".doc";
     ob_end_clean();
     header("Cache-Control: private");
     header("Content-Type: application/force-download;");
     header("Content-Disposition:attachment; filename=\"{$filename}\"");
     header("Content-length:{$size}");
     echo $template;
     ob_flush();
 }
Ejemplo n.º 3
0
 public function viewNoResult()
 {
     // Filtering
     $filter_excursion = Tour::get();
     $filter_cities = City::get();
     return array('filter_excursion' => $filter_excursion, 'filter_cities' => $filter_cities);
 }
Ejemplo n.º 4
0
 public function middleOfTheWorld()
 {
     $tour = Cache::rememberForever('middleOfTheWorld', function () {
         return Tour::first();
     });
     //$tour = Tour::first();
     return View::make('tours.middle-of-the-world', compact('tour'));
 }
Ejemplo n.º 5
0
 /**
  * @param $compet
  * @return bool
  */
 private function saveTour($compet)
 {
     // Delete Tour qui sont supérieur au compet->nbtour
     Tour::where('compet_id', '=', $compet->id)->where('num', '>', $compet->nbtours)->delete();
     for ($t = 1; $t <= $compet->nbtours; $t++) {
         $tour = Tour::where('compet_id', '=', $compet->id)->where('num', '=', $t)->first();
         if ($tour) {
             $tour->datetour = $compet->date->addDays($t - 1);
             $tour->save();
         } else {
             $tour = new Tour();
             $tour->compet_id = $compet->id;
             $tour->num = $t;
             $tour->datetour = $compet->date->addDays($t - 1);
             $tour->save();
         }
     }
     return true;
 }
Ejemplo n.º 6
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     ini_set('max_execution_time', 0);
     $data = DB::select('select * from tour');
     $insert = [];
     foreach ($data as $d) {
         $insert[] = ['id' => $d->id, 'code' => $d->id_tour, 'name' => $d->name, 'description' => $d->description, 'day_duration' => $d->day_duration, 'duration' => $d->duration, 'start_date' => $d->start_date, 'start_loc' => $d->starting_gate, 'adult_price' => $d->adult_price, 'children_price' => $d->children_price];
     }
     Tour::insert($insert);
 }
 function display()
 {
     global $db;
     $focus = new Tour();
     $focus->retrieve($_GET['record']);
     if (isset($_POST['department']) && isset($_POST['department']) != '') {
         $data = $focus->loadAreaByDepartment($_POST['department']);
         if (count($data) > 0) {
             $area_options .= '<option value ="">none</option>';
             foreach ($data as $row) {
                 $selected = '';
                 if ($focus->area == $row['id']) {
                     $selected = 'selected="selected"';
                 }
                 $area_options .= "<option data-code='" . $row['code'] . "' data-country='" . $row['country_id'] . "' value='" . $row['id'] . "' " . $selected . ">" . $row['name'] . '-' . $row['country'] . "</option>";
             }
             echo $area_options;
         }
     }
 }
Ejemplo n.º 8
0
 public function delete($cod = null)
 {
     if (is_null($cod)) {
         Redirect::to('404.html');
     } else {
         $agencia = Tour::where('codAgencia', '=', $cod)->firstOrFail();
         if (is_object($agencia)) {
             $agencia->estado = '0';
             $agencia->save();
             return Redirect::to('agencias');
         }
     }
 }
Ejemplo n.º 9
0
 /**
  * Display a listing of the resource.
  * GET /bookings
  *
  * @return Response
  */
 public function index($id = null, $tourid = null)
 {
     if (!$id || !$tourid) {
         return Redirect::route('tours');
     }
     $tour = Tour::find($id);
     $tourdates = array();
     foreach ($tour->dates as $dates) {
         if ($dates['spaces'] > 0) {
             $value = $dates['start_date'] . ' - ' . $dates['end_date'];
             $tourdates = array_add($tourdates, $dates['id'], $value);
         }
     }
     return View::make('bookings.index', compact('tour', 'tourid', 'tourdates'));
 }
 public function storeimage(Request $request)
 {
     $restaurant = Tour::find($request->input('id'));
     $galeriaid = $restaurant->id_galeria;
     $path = public_path() . $request->input('path');
     $files = $request->file('file');
     foreach ($files as $file) {
         $fileName = strtolower(str_random(40) . '.' . $file->getClientOriginalExtension());
         $file->move($path, $fileName);
         $galimg = new Galeria_Imagen();
         $galimg->id_galeria = $galeriaid;
         $galimg->nombre = $fileName;
         $galimg->save();
     }
 }
Ejemplo n.º 11
0
 function preDisplay()
 {
     parent::preDisplay();
     $tour = new Tour();
     $html = file_get_contents("custom/modules/Tours/tpls/basic_pdf.tpl");
     $html = str_replace("{NAME}", $this->bean->name, $html);
     $desc = html_entity_decode_utf8($this->bean->description);
     $desc = $tour->removeHtmlTags($desc);
     $html = str_replace("{TOUR_NOTE}", $desc, $html);
     $picture = '<img width="627" height="312" src="modules/images/' . $this->bean->picture . '">';
     $html = str_replace("{PICTURE}", $picture, $html);
     $html = str_replace("{CODE}", $this->bean->tour_code, $html);
     $html = str_replace("{DURATION}", $this->bean->duration, $html);
     $html = str_replace("{TRANSPORT}", $this->bean->transport2, $html);
     $html = str_replace("{START_DATE}", $this->bean->start_date, $html);
     $program = html_entity_decode_utf8($tour->get_data_to_export2pdf($_GET['record']));
     $html = str_replace("{TOUR_PROGRAM_LINES}", $program, $html);
     // Xuat ra pdf
     $mpdf = new mPDF("vi");
     $mpdf->SetFooter('{PAGENO}');
     $mpdf->WriteHTML($html);
     $mpdf->Output("Tour.pdf", "D");
     exit;
 }
Ejemplo n.º 12
0
 public function thankyou($payment_reference = null, $charge = null)
 {
     $charge = Session::get('charge');
     $payment_reference = Session::get('payment_reference');
     if ($payment_reference) {
         $booking = Booking::find($payment_reference);
         $booking->receipt = array('stripe_id' => $charge->id, 'payment_reference' => Session::get('payment_reference'), 'amount' => $charge->amount);
         $booking->save();
         Tour::where('dates.id', (int) $booking->tour_date)->decrement('dates.$.spaces');
         $tour = Tour::find($booking->id);
         Mail::send('emails.stripebooking', compact('booking', 'tour'), function ($message) {
             $message->to('*****@*****.**', 'Not Normal Tours')->subject('New Booking at Not Normal Tours');
         });
         return View::make('pages.thankyou');
     }
     return View::make('pages.thankyou');
 }
Ejemplo n.º 13
0
 public function index()
 {
     if (Session::has('st_date')) {
         $st_date = Session::get('st_date');
     } else {
         $st_date = date("Y/m/d");
     }
     //Session::flush();
     if (Session::has('ed_date')) {
         $ed_date = Session::get('ed_date');
     } else {
         $ed_date = date("Y/m/d", strtotime($st_date . ' + 2 days'));
     }
     $tour = Tour::take(5)->get();
     $excursion = Excursion::take(5)->get();
     $user_review = HotelReview::take(3)->get();
     $transport_packages = TransportPackage::take(5)->get();
     return View::make('index')->with(array('tour' => $tour, 'excursion' => $excursion, 'user_review' => $user_review, 'st_date' => $st_date, 'ed_date' => $ed_date, 'transport_packages' => $transport_packages));
 }
Ejemplo n.º 14
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     ini_set('max_execution_time', 0);
     $data = DB::select('select * from tour_score');
     foreach ($data as $d) {
         $ans = DB::select("select * from option_ans where attribute_id = '{$d->attribute_id}'");
         $ans = $ans[0];
         if ($d->tour_id == null || $ans->id == null) {
             continue;
         }
         $exist = TourScore::on('main')->where('id_tour', $d->tour_id)->where('id_answer', $ans->id)->first();
         if ($exist) {
             continue;
         }
         $t = Tour::on('main')->find($d->tour_id);
         if (!$t) {
             continue;
         }
         $a = Answer::on('main')->find($ans->id);
         if (!$a) {
             continue;
         }
         $tc = new TourScore();
         $tc->id_tour = $t->id;
         $tc->id_answer = $a->id;
         $tc->score = $d->score;
         try {
             DB::beginTransaction();
             $tc->save();
             DB::commit();
         } catch (ErrorException $e) {
             DB::rollback();
             echo $e->getMessage() . "\n";
         } catch (PDOException $e) {
             DB::rollback();
             echo $e->getMessage() . "\n";
         }
     }
 }
Ejemplo n.º 15
0
 function getTourObject()
 {
     $q = "select Tours.ID from Shows, Tours where Shows.date >= Tours.start_date and Shows.date <= Tours.end_date and Shows.ID = " . $this->ID;
     $r = mysql_query($q);
     if (!$r) {
         return Error::MySQL();
     }
     $row = mysql_fetch_assoc($r);
     $to = Tour::get($row['ID']);
     return $to;
 }
Ejemplo n.º 16
0
 function add($postArray)
 {
     $db = new db();
     if (!User::isAdmin()) {
         return Error::create("Only an administrator may add tours.");
     }
     $title = $db->sanitize_to_db($postArray['title']);
     $start_date = $db->sanitize_to_db($postArray['start_date']);
     $end_date = $db->sanitize_to_db($postArray['end_date']);
     $sd = strtotime($start_date);
     $start_date = date('Y-m-d', $sd);
     $ed = strtotime($end_date);
     $end_date = date('Y-m-d', $ed);
     $description = $db->sanitize_to_db($postArray['description']);
     if (!$title) {
         $title = '(untitled tour)';
     }
     $r = @mysql_query("insert into Tours (title, start_date, end_date, description, is_active) values ('{$title}', '{$start_date}', '{$end_date}', '{$description}','" . DEFAULT_ACTIVE . "')");
     if ($r) {
         return Tour::get(mysql_insert_id());
     } else {
         return Error::MySQL();
     }
 }
Ejemplo n.º 17
0
<?php

include 'base.php';
User::protect();
include_class('tours');
include_class('m2');
// type is only used on initial entry, not on an actual submit
$to = Tour::get($_GET['id']);
if (!db::isError($to)) {
    $doSubmit = false;
    if (!$_POST['area']) {
        $type = $_REQUEST['type'] == 'av' ? 'av' : 'photos';
        $ma = $type == 'av' ? $to->getAVAreaObject() : $to->getPhotoAreaObject();
    } else {
        if ($_POST['area'] == $to->getAVAreaID() || $_POST['area'] == $to->getPhotoAreaID()) {
            $doSubmit = true;
        }
    }
    if ($doSubmit) {
        $ma = MediaArea::get($_POST['area']);
        if (!db::isError($ma)) {
            if ($_POST['localfile']) {
                $res = $ma->addMediaUpload('mediafile', $to);
            } else {
                if ($_POST['url']) {
                    $res = $ma->addMediaRemote($_POST['url'], $to);
                } else {
                    if ($_POST['toAdd'] == 'all') {
                        $keepCopy = $_POST['copyFromIncoming'] ? 1 : 0;
                        $res = $ma->addAllMediaIncoming($keepCopy, $to);
                    } else {
Ejemplo n.º 18
0
<?php

include 'base.php';
User::protect();
include_class('tours');
$section = 'tours';
if ($_POST['submit']) {
    // add news entry
    $tour = Tour::add($_POST);
    if (!db::isError($tour)) {
        header('Location: tour_edit.php?id=' . $tour->getID());
    }
}
$page_title = 'Add Tour';
$calendar = true;
$editors = array('description');
include 'layout/header.php';
?>

<div id="breadcrumb">
	<a href="index.php">Audition &#62;</a>
	<a href="live.php">Live &#62;</a>
	<a href="tours.php">Tours &#62;</a>
</div>

<?php 
if (User::isAdmin()) {
    if (db::isError($tour)) {
        $tour->outputList();
    }
    ?>
Ejemplo n.º 19
0
 public static function standings($obj, $node, $node_id, array $opts)
 {
     /*
         Makes various kinds of standings tables.
         $obj and $node types are STATS_* types.
     
         $opts = array(
            'url' => page URL on which table is to be displayed (required!)
            'GET_SS' => GET Sorting suffix
            'return_objects' => bool
            'teams_from' => [T_OBJ_COACH|T_OBJ_RACE] when $obj = T_OBJ_TEAM and this is set, only teams related to this object type (teams_from), of ID = $opts[teams_from_id] are fetched.
            'teams_from_id' => ID (int) see "teams_from" for details.
         );
     */
     global $lng, $settings, $objFields_avg;
     $tblTitle = '';
     $objs = $fields = $extra = array();
     $fields_before = $fields_after = array();
     // To be merged with $fields.
     if (!array_key_exists('GET_SS', $opts)) {
         $opts['GET_SS'] = '';
     } else {
         $extra['GETsuffix'] = $opts['GET_SS'];
     }
     # GET Sorting Suffix
     $PAGE = isset($_GET["page"]) ? (int) $_GET["page"] : 1;
     $PAGELENGTH = 0;
     # Infinite, is overrided in below switch/case..
     $extra['noHelp'] = false;
     $W_TEAMS_FROM = array_key_exists('teams_from', $opts);
     $enableRaceSelector = $obj == T_OBJ_PLAYER || $obj == T_OBJ_TEAM && (!isset($opts['teams_from']) || $opts['teams_from'] != T_OBJ_RACE);
     # NO filters for teams of a coach on the coach's teams list.
     $_COACH_TEAM_LIST = $W_TEAMS_FROM && $opts['teams_from'] == T_OBJ_COACH;
     if ($_COACH_TEAM_LIST) {
         list(, , $T_STATE) = HTMLOUT::nodeSelector(array('nonodes' => true, 'state' => true));
         # Produces a state selector.
         $_SELECTOR = array(false, false, $T_STATE, T_RACE_ALL, 'GENERAL', 'mv_played', self::T_NS__ffilter_ineq_gt, 0);
     } else {
         $_SELECTOR = HTMLOUT::nodeSelector(array('force_node' => array($node, $node_id), 'race' => $enableRaceSelector, 'sgrp' => true, 'ffilter' => true, 'obj' => $obj));
     }
     list($sel_node, $sel_node_id, $sel_state, $sel_race, $sel_sgrp, $sel_ff_field, $sel_ff_ineq, $sel_ff_limit) = $_SELECTOR;
     $filter_node = array($sel_node => $sel_node_id);
     $filter_race = $sel_race != T_RACE_ALL ? array(T_OBJ_RACE => $sel_race) : array();
     $filter_having = array('having' => array($sel_ff_field . ($sel_ff_ineq == self::T_NS__ffilter_ineq_gt ? '>=' : '<=') . $sel_ff_limit));
     if ($_COACH_TEAM_LIST && $sel_state != T_STATE_ALLTIME) {
         $filter_having['having'][] = 'rdy IS TRUE';
         $filter_having['having'][] = 'retired IS FALSE';
     }
     $SGRP_GEN = $sel_sgrp == 'GENERAL';
     $ALL_TIME = self::_isNodeAllTime($obj, $sel_node, $sel_node_id);
     $manualSort = isset($_GET["sort{$opts['GET_SS']}"]);
     $sortRule = array_merge($manualSort ? array(($_GET["dir{$opts['GET_SS']}"] == 'a' ? '+' : '-') . $_GET["sort{$opts['GET_SS']}"]) : array(), $obj == T_OBJ_TEAM && $sel_node == T_NODE_TOURNAMENT && is_object($tr = new Tour($sel_node_id)) ? array_map(create_function('$val', 'return $val[0]."mv_".substr($val,1);'), $tr->getRSSortRule()) : sort_rule($obj));
     $set_avg = isset($_GET['pms']) && $_GET['pms'];
     // Per match stats?
     echo '<br><a href="' . $opts['url'] . '&amp;pms=' . ($set_avg ? 0 : 1) . '"><b>' . $lng->getTrn('common/' . ($set_avg ? 'ats' : 'pms')) . "</b></a><br><br>\n";
     // Common $obj type fields.
     $fields = self::_getDefFields($obj, $sel_node, $sel_node_id);
     // Was a different (non-general) stats group selected?
     if (!$SGRP_GEN) {
         $grps_short = getESGroups(true, true);
         $grps_long = getESGroups(true, false);
         $fields_short = $grps_short[$sel_sgrp];
         $fields_long = $grps_long[$sel_sgrp];
         $fields = array_combine(array_strpack('mv_%s', $fields_long), array_map(create_function('$f', 'return array("desc" => $f);'), $fields_short));
         $objFields_avg = array_merge($objFields_avg, array_map(create_function('$k', 'return substr($k, 3);'), array_keys($fields)));
     }
     switch ($obj) {
         case STATS_PLAYER:
             $tblTitle = $lng->getTrn('menu/statistics_menu/player_stn');
             $fields_before = array('name' => array('desc' => $lng->getTrn('common/player'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_PLAYER, false, false, false), 'field' => 'obj_id', 'value' => 'player_id')), 'f_tname' => array('desc' => $lng->getTrn('common/team'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, false, false, false), 'field' => 'obj_id', 'value' => 'owned_by_team_id')));
             $PAGELENGTH = $settings['standings']['length_players'];
             list($objs, $PAGES) = Stats::getRaw(T_OBJ_PLAYER, $filter_node + $filter_having + $filter_race, array($PAGE, $PAGELENGTH), $sortRule, $set_avg);
             break;
         case STATS_TEAM:
             $tblTitle = $lng->getTrn('menu/statistics_menu/team_stn');
             $fields_before = array('name' => array('desc' => $lng->getTrn('common/name'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, false, false, false), 'field' => 'obj_id', 'value' => 'team_id')));
             // Show teams standings list only for teams owned by... ?
             switch ($W_TEAMS_FROM ? $opts['teams_from'] : false) {
                 case T_OBJ_COACH:
                     $fields_before['f_rname'] = array('desc' => $lng->getTrn('common/race'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_RACE, false, false, false), 'field' => 'obj_id', 'value' => 'f_race_id'));
                     list($objs, $PAGES) = Stats::getRaw(T_OBJ_TEAM, $filter_node + $filter_having + $filter_race + array(T_OBJ_COACH => (int) $opts['teams_from_id']), false, $sortRule, $set_avg);
                     break;
                 case T_OBJ_RACE:
                     $fields_before['f_cname'] = array('desc' => $lng->getTrn('common/coach'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_COACH, false, false, false), 'field' => 'obj_id', 'value' => 'owned_by_coach_id'));
                     $PAGELENGTH = $settings['standings']['length_teams'];
                     list($objs, $PAGES) = Stats::getRaw(T_OBJ_TEAM, $filter_node + $filter_having + array(T_OBJ_RACE => (int) $opts['teams_from_id']), array($PAGE, $PAGELENGTH), $sortRule, $set_avg);
                     break;
                     // All teams
                 // All teams
                 default:
                     $PAGELENGTH = $settings['standings']['length_teams'];
                     list($objs, $PAGES) = Stats::getRaw(T_OBJ_TEAM, $filter_node + $filter_having + $filter_race, array($PAGE, $PAGELENGTH), $sortRule, $set_avg);
             }
             // Translating race name
             foreach ($objs as &$o) {
                 $o['f_rname'] = $lng->getTrn('race/' . strtolower(str_replace(' ', '', $o['f_rname'])));
             }
             break;
         case STATS_RACE:
             $tblTitle = $lng->getTrn('menu/statistics_menu/race_stn');
             $fields_before = array('name' => array('desc' => $lng->getTrn('common/race'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_RACE, false, false, false), 'field' => 'obj_id', 'value' => 'race_id')));
             $dash_empty = false;
             if ($sel_node == T_NODE_TOURNAMENT) {
                 $dash_empty = 'mv_team_cnt';
             } else {
                 if ($ALL_TIME) {
                     $dash_empty = 'rg_team_cnt';
                 }
             }
             if ($dash_empty) {
                 $extra['dashed'] = array('condField' => $dash_empty, 'fieldVal' => 0, 'noDashFields' => array('name'));
             }
             list($objs, $PAGES) = Stats::getRaw(T_OBJ_RACE, $filter_node + $filter_having, false, $sortRule, $set_avg);
             // Translating race name
             foreach ($objs as &$o) {
                 $o['name'] = $lng->getTrn('race/' . strtolower(str_replace(' ', '', $o['name'])));
             }
             break;
         case STATS_COACH:
             $tblTitle = $lng->getTrn('menu/statistics_menu/coach_stn');
             $fields_before = array('name' => array('desc' => $lng->getTrn('common/coach'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_COACH, false, false, false), 'field' => 'obj_id', 'value' => 'coach_id')));
             $PAGELENGTH = $settings['standings']['length_coaches'];
             list($objs, $PAGES) = Stats::getRaw(T_OBJ_COACH, $filter_node + $filter_having, array($PAGE, $PAGELENGTH), $sortRule, $set_avg);
             break;
         case STATS_STAR:
             $tblTitle = $lng->getTrn('menu/statistics_menu/star_stn');
             $fields_before = array('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')), 'cost' => array('desc' => 'Price', 'kilo' => true, 'suffix' => 'k'), 'ma' => array('desc' => 'Ma'), 'st' => array('desc' => 'St'), 'ag' => array('desc' => 'Ag'), 'av' => array('desc' => 'Av'));
             $extra['dashed'] = array('condField' => 'mv_played', 'fieldVal' => 0, 'noDashFields' => array('name'));
             list($objs, $PAGES) = Stats::getRaw(T_OBJ_STAR, $filter_node + $filter_having, false, $sortRule, $set_avg);
             break;
     }
     foreach ($objs as $idx => $obj) {
         $objs[$idx] = (object) $obj;
     }
     if (!$SGRP_GEN) {
         $tmp = $fields_before['name'];
         $fields_before = $fields_after = array();
         $fields_before['name'] = $tmp;
     }
     $fields = array_merge($fields_before, $fields, $fields_after);
     // Add average marker on fields (*).
     if ($set_avg) {
         foreach (array_keys($fields) as $f) {
             $f_cut = preg_replace('/^\\w\\w\\_/', '', $f);
             if (in_array($f_cut, $objFields_avg)) {
                 $fields[$f]['desc'] .= '*';
             }
         }
     }
     $extra['page'] = $PAGE;
     $extra['pages'] = $PAGES;
     $extra['pagelength'] = $PAGELENGTH;
     HTMLOUT::sort_table($tblTitle, $opts['url'] . ($set_avg ? '&amp;pms=1' : ''), $objs, $fields, $sortRule, array(), $extra);
     return array_key_exists('return_objects', $opts) && $opts['return_objects'] ? array($objs, $sortRule) : true;
 }
Ejemplo n.º 20
0
 function display()
 {
     $focus = new Tour();
     $quotes = new Quotes();
     global $sugar_config, $mod_strings, $timedate;
     $ss = new Sugar_Smarty();
     $db = DBManagerFactory::getInstance();
     // ONLY LOAD A RECORD IF A RECORD ID IS GIVEN;
     // A RECORD ID IS NOT GIVEN WHEN VIEWING IN LAYOUT EDITOR
     $record = isset($_GET["record"]) ? htmlspecialchars($_GET["record"]) : '';
     $department = isset($_GET["department"]) ? htmlspecialchars($_GET["department"]) : '';
     $template = file_get_contents('modules/Quotes/tpls/export.tpl');
     $quotes->retrieve($record);
     $focus->retrieve($quotes->quotes_toufa8brstours_idb);
     $content = $quotes->cost_detail;
     $content = base64_decode($content);
     $content = json_decode($content);
     $template = str_replace('{SITE_URL}', $sugar_config['site_url'], $template);
     if (!empty($focus->picture)) {
         $img = "<br/><img src='" . $sugar_config['site_url'] . "/modules/images/" . $focus->picture . "' width='600'/><br/><br/>";
     } else {
         $img = "";
     }
     $html = '';
     if ($quotes->department == 'dos') {
         $html .= '<table cellpadding="0" cellspacing="0" border="0" class="content1" align="center">';
         $html .= '<tr><td>&nbsp;&nbsp; </td> </tr>';
         $html .= '<tr><td align="center"><i>' . $mod_strings['LBL_MOD_STRING_DOS_HEAD'] . '</i></td> </tr>';
         $html .= '<tr><td align="center" style="font-size: 24px; color: blue">' . $focus->name . '</td></tr>';
         $html .= '<tr><td align="justify">' . $focus->description . ' </tr>';
         $html .= '<tr>';
         $html .= '<tr><td class="tabDetailViewDL" align="center">' . $img . '</td></tr>';
         $html .= '</tr>';
         $html .= '</table>';
         if (!empty($focus->start_date)) {
             $start_date = $timedate->to_display($focus->start_date, $timedate->get_date_format($current_user), 'd/m/Y');
             //                                    $start_date = date('d/m/Y',strtotime());
         } else {
             $start_date = '';
         }
         $html .= '<table align="center">';
         $html .= '<tr>';
         $html .= '<td class="tabDetailViewDL" align="left"><p>Thời gian : ' . $focus->duration . ' <br/> Mã tour: ' . $focus->tour_code . ' <br/> Phương tiện : ' . $focus->transport2 . ' <br/> Khởi hành : ' . $start_date . '<br/></p></td>';
         $html .= '</tr>';
         $html .= '</table><br/>';
         $template = str_replace('{HEAD}', $html, $template);
         $html = '';
         $cost_detail = $content->dos_cost_detail;
         if (count($cost_detail) > 0) {
             $html .= '<div id="dos" align="center"><table width="100%" class="table_clone" border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse">';
             $html .= '<thead>';
             $html .= '<tr height="15">';
             $html .= '<td class="tdborder" rowspan="2" style="text-align:center">' . $mod_strings['LBL_DOS_TICKET_VN'] . '</td>';
             $html .= '<td class="tdborder" colspan="2" style="text-align:center">' . $mod_strings['LBL_DOS_TOUR_COST_VN'] . '</td>';
             $html .= '<td class="tdborder" colspan="2" style="text-align:center">' . $mod_strings['LBL_DOS_SURCHANGE_VN'] . '</td>';
             $html .= '</tr>';
             $html .= '<tr height="15">';
             $html .= '<td class="tdborder" style="text-align:center">' . $mod_strings['LBL_DOS_FARE_VN'] . '</td>';
             $html .= '<td class="tdborder" style="text-align:center">' . $mod_strings['LBL_DOS_FACILITY_COST_VN'] . '</td>';
             $html .= '<td class="tdborder" style="text-align:center">' . $mod_strings['LBL_DOS_SINGLE_ROM_VN'] . '</td>';
             $html .= '<td class="tdborder" style="text-align:center">' . $mod_strings['LBL_DOS_FOREIGN_VN'] . '</td>';
             $html .= '</tr>';
             $html .= '</thead>';
             $html .= '<tbody>';
             if (count($cost_detail) > 0) {
                 foreach ($cost_detail as $val) {
                     $html .= '<tr height="15">';
                     $html .= '<td class="tdborder" align="center">' . translate('quotes_dos_hotel_standard', '', $val->dos_hotel_standard) . '</td>';
                     $html .= '<td class="tdborder" align="center">' . number_format($val->ticket_cost, 0, '', '.') . '</td>';
                     $html .= '<td class="tdborder" align="center">' . number_format($val->facility_cost, 0, '', '.') . '</td>';
                     $html .= '<td class="tdborder" align="center">' . number_format($val->single_room, 0, '', '.') . '</td>';
                     $html .= '<td class="tdborder" align="center">' . number_format($val->foreign, 0, '', '.') . '</td>';
                     $html .= '</tr>';
                 }
             }
             $html .= '</tbody>';
             $html .= '</table> </div> ';
             $template = str_replace('{COST_DETAIL}', $html, $template);
         }
         $html = '';
         $html .= '<h3 align="center">GIÁ TOUR TRỌN GÓI CHO CÁC DỊCH VỤ:</h3>';
         $html .= '<table cellpadding="0" cellspacing="0" border="0" width="100%">';
         $html .= '<tr>';
         $html .= '<td align="justify"><h2><u><b>I. GIÁ TRÊN BAO GỒM:</b></u></h2></td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="justify"><u><b>Vận chuyển:</b></u><br/>' . html_entity_decode(nl2br($quotes->transport)) . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="justify"><u><b>Khách sạn:</b></u><br/>' . html_entity_decode(nl2br($quotes->hotel)) . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="justify"><u><b>Hướng dẫn viên</b></u>: <br/> ' . html_entity_decode(nl2br($quotes->guide)) . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="justify"><u><b>Tham quan</b></u><br/>' . html_entity_decode(nl2br($quotes->room)) . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="justify"><u><b>Ăn uống</b></u>: ' . html_entity_decode(nl2br($quotes->food)) . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="justify"><u><b>Bảo hiểm</b></u>: <br/>' . html_entity_decode(nl2br($quotes->insurance)) . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="justify"><u><b>Khăn, nón, nước và quà tặng</b></u>: <br/>' . html_entity_decode(nl2br($quotes->other)) . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<tr>';
         $html .= '<td>&nbsp;</td>';
         $html .= '</tr>';
         $html .= '<td align="justify"><h2><u><b>II. GIÁ TRÊN KHÔNG BAO GỒM :</b></u></h2></td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="justify">' . html_entity_decode(nl2br($quotes->not_content)) . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="justify"><h2><u><b>III.GIÁ TOUR DÀNH CHO TRẺ EM</b></u> :</h2></td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="justify">' . html_entity_decode(nl2br($quotes->child_cost)) . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="center"><h2>THÔNG TIN HƯỚNG DẪN</h2></td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="justify">' . html_entity_decode(nl2br($quotes->surcharge)) . '</td>';
         $html .= '</tr>';
         $html .= '</table>';
         $html .= '<p align="center"> <br/> <b>CARNIVAL TOURS HÂN HẠNH PHỤC VỤ QUÝ KHÁCH</b> </p>';
         $template = str_replace('{DETAIL}', $html, $template);
     } elseif ($quotes->department == 'ib') {
         $html .= '<p align="center" style="font-size: 24px;">&nbsp;</p>';
         $html .= '<p align="center" style="font-size: 24px; color: blue">' . $focus->name . '</p>';
         $html .= '<table>';
         $html .= '<tr><td class="tabDetailViewDL" align="center">' . $img . '</td></tr>';
         $html .= '</table>';
         $html .= '<table align="center" cellpadding="0" cellspacing="0">';
         $html .= '<tr> <td>Duration : </td> <td>' . $focus->duration . '</td></tr>';
         $html .= '<tr> <td>Code tour : </td> <td>' . $focus->tour_code . '</td></tr>';
         if (!empty($focus->start_date)) {
             $start_date = $timedate->to_display($focus->start_date, $timedate->get_date_format($current_user), 'd/m/Y');
             //                                    $start_date = date('d/m/Y',strtotime());
         } else {
             $start_date = '';
         }
         $html .= '<tr> <td>Start : </td> <td>' . $start_date . '</td></tr>';
         $html .= '<tr> <td>Transport : </td> <td>' . $focus->transport2 . '</td></tr>';
         //                $html .= '<tr> <td>Depart from : </td> <td>'.$focus->.'</td></tr>';
         $html .= '</table><br />';
         $template = str_replace("{HEAD}", $html, $template);
         $html = '';
         $cost_detail_head = $content->cost_detail_head;
         $ib_cose_detai = $content->ib_cose_detai;
         $html .= '<div id="inbound">';
         $html .= '<table width="100%" border="1" class="table_clone" cellspacing="0" cellpadding="2" style="border-collapse:collapse">';
         $html .= '<thead>';
         $html .= '<tr height="15">';
         $html .= '<td colspan="7" style="text-align:center" class="tdborder"><strong>' . $mod_strings['LBL_IB_TABLE_TITLE'] . '</strong></td>';
         $html .= '</tr>';
         $html .= '<tr height="15">';
         $html .= '<td class="tdborder"><strong>' . $mod_strings['LBL_IB_GROUP_SIZE'] . '</strong></td>';
         $html .= '<td class="tdborder">' . $cost_detail_head->group_site1 . '</td>';
         $html .= '<td class="tdborder">' . $cost_detail_head->group_site2 . '</td>';
         $html .= '<td class="tdborder">' . $cost_detail_head->group_site3 . '</td>';
         $html .= '<td class="tdborder">' . $cost_detail_head->group_site4 . '</td>';
         $html .= '<td class="tdborder">' . $cost_detail_head->group_site5 . '</td>';
         $html .= '<td class="tdborder">' . $cost_detail_head->group_site6 . '</td>';
         $html .= '</tr>';
         $html .= '</thead>';
         $html .= '<tbody>';
         if (count($ib_cose_detai) > 0) {
             foreach ($ib_cose_detai as $val) {
                 $html .= '<tr height="15">';
                 $html .= '<td class="tdborder">' . translate('quotes_ib_hotel_standard', '', $val->ib_hotel_standard) . '</td>';
                 $html .= '<td class="tdborder">' . $val->group_site1_cost . '</td>';
                 $html .= '<td class="tdborder">' . $val->group_site2_cost . '</td>';
                 $html .= '<td class="tdborder">' . $val->group_site3_cost . '</td>';
                 $html .= '<td class="tdborder">' . $val->group_site4_cost . '</td>';
                 $html .= '<td class="tdborder">' . $val->group_site5_cost . '</td>';
                 $html .= '<td class="tdborder">' . $val->group_site6_cost . '</td>';
                 $html .= '</tr>';
             }
         }
         $html .= '</tbody>';
         $html .= '</table>';
         $html .= '</div>';
         $template = str_replace('{COST_DETAIL}', $html, $template);
         $html = '';
         $html .= '<table width="100%" border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse">';
         $html .= '<tr bgcolor="#CCCCCC">';
         $html .= '<td align="center">' . $mod_strings['LBL_IB_INCLUDE'] . '</td>';
         $html .= '<td align="center">' . $mod_strings['LBL_IB_EXCLUDE'] . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="justify">' . html_entity_decode_utf8(nl2br($quotes->ib_include)) . '</td>';
         $html .= '<td align="justify">' . html_entity_decode_utf8(nl2br($quotes->not_content)) . '</td>';
         $html .= '</tr>';
         $html .= '<tr bgcolor="#CCCCCC">';
         $html .= '<td colspan="2" align="center">' . $mod_strings['LBL_IB_EXPORT_HOTEL'] . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td colspan="2" align="justify">' . html_entity_decode_utf8(nl2br($quotes->hotel)) . '</td>';
         $html .= '</tr>';
         $html .= '<tr bgcolor="#CCCCCC" align="justify">';
         $html .= '<td colspan="2" align="center">' . $mod_strings['LBL_IB_EXPORT_SURCHARGE'] . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td colspan="2" align="justify">' . html_entity_decode_utf8(nl2br($quotes->surcharge)) . '</td>';
         $html .= '</tr>';
         $html .= '<tr bgcolor="#CCCCCC">';
         $html .= '<td colspan="2" align="center">' . $mod_strings['LBL_IB_EXPORT_CHILD_POLICY'] . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td colspan="2" align="justify">' . html_entity_decode_utf8(nl2br($quotes->child_cost)) . '</td>';
         $html .= '</tr>';
         $html .= '</table>';
         $html .= '<p> &nbsp;</p>';
         $html .= '<p align="center">CARNIVAL TOURS – WITH YOU ALL THE WAY!</p>';
         $template = str_replace('{DETAIL}', $html, $template);
     } elseif ($quotes->department == 'ob') {
         $html .= '<table align="center" width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">';
         $html .= '<tr><td><br /><br /><br /></td> </tr>';
         $html .= '<tr>';
         $html .= '<td align="center">Chương trình du lịch</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="center"><p align="center" style="font-size: 24px; color: blue">' . $focus->name . '</p></td>';
         $html .= '</tr>';
         $html .= '<tr><td class="tabDetailViewDL" align="center">' . $img . '</td></tr>';
         $html .= '<tr>';
         $html .= '<td>';
         $html .= '<table align="center" border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse">';
         $html .= '<tr>';
         $html .= '<td align="left">Thời gian : ' . $focus->duration . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="left">Tour Code : ' . $focus->tour_code . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         if (!empty($focus->start_date)) {
             $start_date = $timedate->to_display($focus->start_date, $timedate->get_date_format($current_user), 'd/m/Y');
             //                                    $start_date = date('d/m/Y',strtotime());
         } else {
             $start_date = '';
         }
         $html .= '<td align="left">Khởi hành : ' . $start_date . '</td>';
         $html .= '</tr>';
         $html .= '</table>';
         $html .= '</td>';
         $html .= '</tr>';
         $html .= '</table><br/>';
         $html .= '<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">';
         $html .= '<tr>';
         $html .= '<td> Lịch bay tham khảo </td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td> <br/>' . html_entity_decode_utf8(nl2br($quotes->flight_schedules)) . '</td>';
         $html .= '</tr>';
         $html .= '</table>';
         $template = str_replace("{HEAD}", $html, $template);
         $html = '';
         $ob_cost_detail = $content->ob_cost_detail;
         $html .= '<table width="100%" border="0" class="table_clone" cellspacing="0" cellpadding="2" style="border-collapse:collapse">';
         $html .= '<tr>';
         $html .= '<td align="center"><b>Giá: ' . $ob_cost_detail->price . ' ' . translate('currency_dom', '', $ob_cost_detail->currency) . ' + ' . $ob_cost_detail->tax . ' ' . translate('currency_dom', '', $ob_cost_detail->currency) . '(Thuế) = ' . $ob_cost_detail->total_price . ' ' . translate('currency_dom', '', $ob_cost_detail->currency) . ' </b></td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td align="center"><b>' . html_entity_decode_utf8(nl2br($ob_cost_detail->price_note)) . '</b></td>';
         $html .= '</tr>';
         $html .= '</table>';
         $template = str_replace('{COST_DETAIL}', $html, $template);
         $html = '';
         $html .= '<table cellspacing="0" cellpadding="0" border="0" style="border-collaspe:collapse" width="100%">';
         $html .= '<tr>';
         $html .= '<td> <u><b>' . $mod_strings['LBL_OB_INCLUDE_EXPORT'] . '</b></u><br/>' . html_entity_decode_utf8(nl2br($quotes->ib_include)) . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td><br/> <u><b>' . $mod_strings['LBL_OB_EXCLUDE_EXPORT'] . '</b></u><br/>' . html_entity_decode_utf8(nl2br($quotes->not_content)) . '</td>';
         $html .= '</tr>';
         $html .= '<tr>';
         $html .= '<td><br/> <u><b>' . $mod_strings['LBL_OB_NOTE_EXPORT'] . '</b></u><br/>' . html_entity_decode_utf8(nl2br($quotes->ob_notes)) . '</td>';
         $html .= '</tr>';
         $html .= '</table>';
         $html .= '<p align="center"><font size="14pt">Carnival Tours Kính Chúc Quý Khách Một Chuyến Du Lịch Vui Vẻ. </p></p>';
         $template = str_replace('{DETAIL}', $html, $template);
     }
     $template = str_replace("{TOUR_PROGRAM_LINE_DETAIL}", html_entity_decode_utf8($focus->get_data_to_expor2word($focus->id)), $template);
     $size = strlen($template);
     $filename = $quotes->name . ".doc";
     ob_end_clean();
     header("Cache-Control: private");
     header("Content-Type: application/force-download;");
     header("Content-Disposition:attachment; filename=\"{$filename}\"");
     header("Content-length:{$size}");
     echo $template;
     ob_flush();
 }
Ejemplo n.º 21
0
<?php

require_once "util.php";
require_once "DataBase/Product.php";
require_once "DataBase/Bill.php";
require_once "DataBase/Tour.php";
require_once "DataBase/Bill_Product.php";
$tour_id = var_get("tour_id", "");
$date = var_get("date", "");
$bill = new Bill();
$bill_data = $bill->get("", array("bill_id"), "tour_id='" . $tour_id . "' AND date='" . $date . "'");
$tour = new Tour();
$tmp = $tour->get($tour_id);
$tour_data = $tmp[0];
$bill_product = new Bill_Product();
$product = new Product();
$product_data = $product->get();
include "Druckvorlagen/tour.php";
?>

Ejemplo n.º 22
0
    private function _actionBoxes($ALLOW_EDIT, $players)
    {
        /******************************
         * Team management
         * ---------------
         *
         * Here we are able to view team stats and manage the team, depending on visitors privileges.
         *
         ******************************/
        global $lng, $rules, $settings, $skillarray, $coach, $DEA, $CHR_CONV;
        global $leagues, $divisions;
        global $racesHasNecromancer, $racesNoApothecary;
        global $T_ALLOWED_PLAYER_NR;
        $team = $this;
        // Copy. Used instead of $this for readability.
        $JMP_ANC = isset($_POST['menu_tmanage']) || isset($_POST['menu_admintools']);
        # Jump condition MUST be set here due to _POST variables being changed later.
        ?>
    <a name="aanc"></a>
    <div class="boxTeamPage">
        <div class="boxTitle<?php 
        echo T_HTMLBOX_INFO;
        ?>
"><a name='anc'><?php 
        echo $lng->getTrn('profile/team/box_info/title');
        ?>
</a></div>
        <div class="boxBody">
            <table width="100%">
                <tr>
                    <td><?php 
        echo $lng->getTrn('common/coach');
        ?>
</td>
                    <td><a href="<?php 
        echo urlcompile(T_URL_PROFILE, T_OBJ_COACH, $team->owned_by_coach_id, false, false);
        ?>
"><?php 
        echo $team->f_cname;
        ?>
</a></td>
                </tr>
                <tr>
                    <td><?php 
        echo $lng->getTrn('common/race');
        ?>
</td>
                    <td><a href="<?php 
        echo urlcompile(T_URL_PROFILE, T_OBJ_RACE, $team->f_race_id, false, false);
        ?>
"><?php 
        echo $lng->getTrn('race/' . strtolower(str_replace(' ', '', $team->f_rname)));
        ?>
</a></td>
                </tr>
                <tr>
                    <td><?php 
        echo $lng->getTrn('common/league');
        ?>
</td>
                    <td><?php 
        if (isset($leagues[$team->f_lid])) {
            echo "<a href=\"";
            echo urlcompile(T_URL_STANDINGS, T_OBJ_TEAM, false, T_NODE_LEAGUE, $team->f_lid);
            echo "\">" . $leagues[$team->f_lid]['lname'] . "</a>";
        } else {
            echo '<i>' . $lng->getTrn('common/none') . '</i>';
        }
        ?>
</td>
                </tr>
                <?php 
        if ($team->f_did != self::T_NO_DIVISION_TIE) {
            ?>
                    <tr>
                        <td><?php 
            echo $lng->getTrn('common/division');
            ?>
</td>
                        <td><?php 
            if (isset($divisions[$team->f_did])) {
                echo "<a href=\"";
                echo urlcompile(T_URL_STANDINGS, T_OBJ_TEAM, false, T_NODE_DIVISION, $team->f_did);
                echo "\">" . $divisions[$team->f_did]['dname'] . "</a>";
            } else {
                echo '<i>' . $lng->getTrn('common/none') . '</i>';
            }
            ?>
</td>
                    </tr>
                    <?php 
        }
        ?>
                <tr>
                    <td><?php 
        echo $lng->getTrn('common/ready');
        ?>
</td>
                    <td><?php 
        echo $team->rdy ? $lng->getTrn('common/yes') : $lng->getTrn('common/no');
        ?>
</td>
                </tr>
                <tr>
                    <td>TV</td>
                    <td><?php 
        echo $team->tv / 1000 . 'k';
        ?>
</td>
                </tr>
                <tr>
                     <td><?php 
        echo $lng->getTrn('matches/report/treas');
        ?>
</td>
                    <td><?php 
        echo $team->treasury / 1000 . 'k';
        ?>
</td>
                </tr>
                <tr>
                <?php 
        if (in_array($team->f_race_id, $racesHasNecromancer)) {
            ?>
                    <td>Necromancer</td>
                    <td><?php 
            echo $lng->getTrn('common/yes');
            ?>
</td>
                    <?php 
        }
        if (!in_array($team->f_race_id, $racesNoApothecary)) {
            echo "<td>" . $lng->getTrn('common/apothecary') . "</td>\n";
            echo "<td>" . ($team->apothecary ? $lng->getTrn('common/yes') : $lng->getTrn('common/no')) . "</td>\n";
        }
        ?>
                </tr>
                <tr>
                    <td><?php 
        echo $lng->getTrn('common/reroll');
        ?>
</td>
                    <td><?php 
        echo $team->rerolls;
        ?>
</td>
                </tr>
                <tr>
                    <td><?php 
        echo $lng->getTrn('matches/report/ff');
        ?>
</td>
                    <td><?php 
        echo $team->rg_ff;
        ?>
</td>
                </tr>
                <tr>
                    <td><?php 
        echo $lng->getTrn('common/ass_coach');
        ?>
</td>
                    <td><?php 
        echo $team->ass_coaches;
        ?>
</td>
                </tr>
                <tr>
                    <td><?php 
        echo $lng->getTrn('common/cheerleader');
        ?>
</td>
                    <td><?php 
        echo $team->cheerleaders;
        ?>
</td>
                </tr>
                <tr>
                    <td colspan=2><hr></td>
                </tr>
                <tr>
                    <td><?php 
        echo $lng->getTrn('common/played');
        ?>
</td>
                    <td><?php 
        echo $team->mv_played;
        ?>
</td>
                </tr>
                <tr>
                    <td>WIN%</td>
                    <td><?php 
        echo sprintf("%1.1f", $team->rg_win_pct) . '%';
        ?>
</td>
                </tr>
                <tr>
                    <td>ELO</td>
                    <td><?php 
        echo $team->rg_elo ? sprintf("%1.2f", $team->rg_elo) : '<i>N/A</i>';
        ?>
</td>
                </tr>
                <tr>
                    <td>W/L/D</td>
                    <td><?php 
        echo "{$team->mv_won}/{$team->mv_lost}/{$team->mv_draw}";
        ?>
</td>
                </tr>
                <tr>
                    <td>W/L/D <?php 
        echo $lng->getTrn('common/streaks');
        ?>
</td>
                    <td><?php 
        echo "{$team->rg_swon}/{$team->rg_slost}/{$team->rg_sdraw}";
        ?>
</td>
                </tr>
                <tr>
                    <td><?php 
        echo $lng->getTrn('common/wontours');
        ?>
</td>
                    <td><?php 
        echo $team->wt_cnt;
        ?>
</td>
                </tr>
                <tr>
                    <td><?php 
        echo $lng->getTrn('profile/team/box_info/ltour');
        ?>
</td>
                    <td><?php 
        echo Tour::getTourUrl($team->getLatestTour());
        ?>
</td>
                </tr>
                <tr valign="top">
                    <td><?php 
        echo $lng->getTrn('common/playedtours');
        ?>
</td>
                    <td><small><?php 
        $tours = $team->getToursPlayedIn(false);
        if (empty($tours)) {
            echo $lng->getTrn('common/none');
        } else {
            $first = true;
            foreach ($tours as $tour) {
                if ($first) {
                    $first = false;
                } else {
                    echo ", ";
                }
                echo $tour->getUrl();
            }
        }
        ?>
</small></td>
                </tr>
                <?php 
        if (Module::isRegistered('Prize')) {
            ?>
                    <tr valign="top">
                        <td><?php 
            echo $lng->getTrn('name', 'Prize');
            ?>
</td>
                        <td><small><?php 
            echo Module::run('Prize', array('getPrizesString', T_OBJ_TEAM, $team->team_id));
            ?>
</small></td>
                    </tr>
                    <?php 
        }
        if (Module::isRegistered('FamousTeams')) {
            ?>
                    <tr>
                        <td><?php 
            echo $lng->getTrn('isfamous', 'FamousTeams');
            ?>
</td>
                        <td><?php 
            echo Module::run('FamousTeams', array('isInFT', $team->team_id)) ? '<b><font color="green">Yes</font></b>' : 'No';
            ?>
</td>
                    </tr>
                    <?php 
        }
        ?>
            </table>
        </div>
    </div>

    <?php 
        if ($ALLOW_EDIT) {
            ?>
        <div class="boxTeamPage">
            <div class="boxTitle<?php 
            echo T_HTMLBOX_COACH;
            ?>
"><?php 
            echo $lng->getTrn('profile/team/box_tm/title');
            ?>
</div>
            <div class="boxBody">
                <?php 
            $base = 'profile/team';
            $tmanage = array('hire_player' => $lng->getTrn($base . '/box_tm/hire_player'), 'hire_journeyman' => $lng->getTrn($base . '/box_tm/hire_journeyman'), 'fire_player' => $lng->getTrn($base . '/box_tm/fire_player'), 'unbuy_player' => $lng->getTrn($base . '/box_tm/unbuy_player'), 'rename_player' => $lng->getTrn($base . '/box_tm/rename_player'), 'renumber_player' => $lng->getTrn($base . '/box_tm/renumber_player'), 'rename_team' => $lng->getTrn($base . '/box_tm/rename_team'), 'buy_goods' => $lng->getTrn($base . '/box_tm/buy_goods'), 'drop_goods' => $lng->getTrn($base . '/box_tm/drop_goods'), 'ready_state' => $lng->getTrn($base . '/box_tm/ready_state'), 'retire' => $lng->getTrn($base . '/box_tm/retire'), 'delete' => $lng->getTrn($base . '/box_tm/delete'));
            # If one of these are selected from the menu, a JavaScript confirm prompt is displayed before submitting.
            # Note: Don't add "hire_player" here - players may be un-bought if not having played any games.
            $tmange_confirm = array('hire_journeyman', 'fire_player', 'buy_goods', 'drop_goods');
            // Set default choice.
            if (!isset($_POST['menu_tmanage'])) {
                reset($tmanage);
                $_POST['menu_tmanage'] = key($tmanage);
            }
            // If action is already chosen, then make it the default selected.
            if (isset($_POST['type']) && array_key_exists($_POST['type'], $tmanage)) {
                $_POST['menu_tmanage'] = $_POST['type'];
            }
            ?>
                <form method="POST" name="menu_tmanage_form">
                    <select name="menu_tmanage" onchange="document.menu_tmanage_form.submit();">
                        <?php 
            foreach ($tmanage as $opt => $desc) {
                echo "<option value='{$opt}'" . ($_POST['menu_tmanage'] == $opt ? 'SELECTED' : '') . ">{$desc}</option>";
            }
            ?>
                    </select>
                    <!-- <input type="submit" name="tmanage" value="OK"> -->
                </form>

                <br><i><?php 
            echo $lng->getTrn('common/desc');
            ?>
:</i><br><br>
                <form name="form_tmanage" method="POST" enctype="multipart/form-data">
                <?php 
            $DISABLE = false;
            switch ($_POST['menu_tmanage']) {
                /**************
                 * Hire player
                 **************/
                case 'hire_player':
                    echo $lng->getTrn('profile/team/box_tm/desc/hire_player');
                    ?>
                        <hr><br>
                        <?php 
                    echo $lng->getTrn('common/player');
                    ?>
:<br>
                        <select name='player'>
                        <?php 
                    $active_players = array_filter($players, create_function('$p', "return (\$p->is_sold || \$p->is_dead || \$p->is_mng) ? false : true;"));
                    $DISABLE = true;
                    foreach ($DEA[$team->f_rname]['players'] as $pos => $details) {
                        // Show players on the select list if buyable, or if player is a potential journeyman AND team has not reached journeymen limit.
                        if ($team->isPlayerBuyable($details['pos_id']) && $team->treasury >= $details['cost'] || ($details['qty'] == 16 || $details['qty'] == 12) && count($active_players) < $rules['journeymen_limit']) {
                            echo "<option value='{$details['pos_id']}'>" . $details['cost'] / 1000 . "k | " . $lng->GetTrn('position/' . strtolower($lng->FilterPosition($pos))) . "</option>\n";
                            $DISABLE = false;
                        }
                    }
                    echo "</select>\n";
                    ?>
                        <br><br>
                        <?php 
                    echo $lng->getTrn('common/number');
                    ?>
:<br>
                        <select name="number">
                        <?php 
                    foreach ($T_ALLOWED_PLAYER_NR as $i) {
                        foreach ($players as $p) {
                            if ($p->nr == $i && !$p->is_sold && !$p->is_dead) {
                                continue 2;
                            }
                        }
                        echo "<option value='{$i}'>{$i}</option>\n";
                    }
                    ?>
                        </select>
                        <br><br>
                        <?php 
                    echo $lng->GetTrn('common/journeyman');
                    ?>
 ? <input type="checkbox" name="as_journeyman" value="1">
                        <br><br>
                        <?php 
                    echo $lng->getTrn('common/name');
                    ?>
:<br>
                        <input type="text" name="name">
                        <input type="hidden" name="type" value="hire_player">
                        <?php 
                    break;
                    /**************
                     * Hire journeymen
                     **************/
                /**************
                 * Hire journeymen
                 **************/
                case 'hire_journeyman':
                    echo $lng->getTrn('profile/team/box_tm/desc/hire_journeyman');
                    ?>
                        <hr><br>
                        <?php 
                    echo $lng->getTrn('common/player');
                    ?>
:<br>
                        <select name="player">
                        <?php 
                    $DISABLE = true;
                    foreach ($players as $p) {
                        $price = $DEA[$team->f_rname]['players'][$p->pos]['cost'];
                        if (!$p->is_journeyman || $p->is_sold || $p->is_dead || $team->treasury < $price || !$team->isPlayerBuyable($p->f_pos_id) || $team->isFull()) {
                            continue;
                        }
                        echo "<option value='{$p->player_id}'>{$p->name} | " . $price / 1000 . " k</option>\n";
                        $DISABLE = false;
                    }
                    ?>
                        </select>
                        <input type="hidden" name="type" value="hire_journeyman">
                        <?php 
                    break;
                    /**************
                     * Fire player
                     **************/
                /**************
                 * Fire player
                 **************/
                case 'fire_player':
                    echo $lng->getTrn('profile/team/box_tm/desc/fire_player') . ' ' . $rules['player_refund'] * 100 . "%.\n";
                    ?>
                        <hr><br>
                        <?php 
                    echo $lng->getTrn('common/player');
                    ?>
:<br>
                        <select name="player">
                        <?php 
                    $DISABLE = true;
                    foreach ($players as $p) {
                        if ($p->is_dead || $p->is_sold) {
                            continue;
                        }
                        echo "<option value='{$p->player_id}'>" . $p->value / 1000 * $rules['player_refund'] . "k refund | {$p->name}</option>\n";
                        $DISABLE = false;
                    }
                    ?>
                        </select>
                        <input type="hidden" name="type" value="fire_player">
                        <?php 
                    break;
                    /***************
                     * Un-buy player
                     **************/
                /***************
                 * Un-buy player
                 **************/
                case 'unbuy_player':
                    echo $lng->getTrn('profile/team/box_tm/desc/unbuy_player');
                    ?>
                        <hr><br>
                        <?php 
                    echo $lng->getTrn('common/player');
                    ?>
:<br>
                        <select name="player">
                        <?php 
                    $DISABLE = true;
                    foreach ($players as $p) {
                        if ($p->is_unbuyable() && !$p->is_sold) {
                            echo "<option value='{$p->player_id}'>{$p->name}</option>\n";
                            $DISABLE = false;
                        }
                    }
                    ?>
                        </select>
                        <input type="hidden" name="type" value="unbuy_player">
                        <?php 
                    break;
                    /**************
                     * Rename player
                     **************/
                /**************
                 * Rename player
                 **************/
                case 'rename_player':
                    echo $lng->getTrn('profile/team/box_tm/desc/rename_player');
                    ?>
                        <hr><br>
                        <?php 
                    echo $lng->getTrn('common/player');
                    ?>
:<br>
                        <select name="player">
                        <?php 
                    $DISABLE = true;
                    foreach ($players as $p) {
                        unset($color);
                        if ($p->is_dead) {
                            $color = COLOR_HTML_DEAD;
                        } elseif ($p->is_sold) {
                            $color = COLOR_HTML_SOLD;
                        }
                        echo "<option value='{$p->player_id}' " . (isset($color) ? "style='background-color: {$color};'" : '') . ">{$p->name}</option>\n";
                        $DISABLE = false;
                    }
                    ?>
                        </select>
                        <br><br>
                        <?php 
                    echo $lng->getTrn('common/name');
                    ?>
:<br>
                        <input type='text' name='name' maxlength=50 size=20>
                        <input type="hidden" name="type" value="rename_player">
                        <?php 
                    break;
                    /**************
                     * Renumber player
                     **************/
                /**************
                 * Renumber player
                 **************/
                case 'renumber_player':
                    echo $lng->getTrn('profile/team/box_tm/desc/renumber_player');
                    ?>
                        <hr><br>
                        <?php 
                    echo $lng->getTrn('common/player');
                    ?>
:<br>
                        <select name="player">
                        <?php 
                    $DISABLE = true;
                    foreach ($players as $p) {
                        unset($color);
                        if ($p->is_dead) {
                            $color = COLOR_HTML_DEAD;
                        } elseif ($p->is_sold) {
                            $color = COLOR_HTML_SOLD;
                        }
                        echo "<option value='{$p->player_id}' " . (isset($color) ? "style='background-color: {$color};'" : '') . ">{$p->nr} {$p->name}</option>\n";
                        $DISABLE = false;
                    }
                    ?>
                        </select>
                        <br><br>
                        <?php 
                    echo $lng->getTrn('common/number');
                    ?>
:<br>
                        <select name="number">
                        <?php 
                    foreach ($T_ALLOWED_PLAYER_NR as $i) {
                        echo "<option value='{$i}'>{$i}</option>\n";
                    }
                    ?>
                        </select>
                        <input type="hidden" name="type" value="renumber_player">
                        <?php 
                    break;
                    /**************
                     * Rename team
                     **************/
                /**************
                 * Rename team
                 **************/
                case 'rename_team':
                    echo $lng->getTrn('profile/team/box_tm/desc/rename_team');
                    ?>
                        <hr><br>
                        <?php 
                    echo $lng->getTrn('common/name');
                    ?>
:<br>
                        <input type='text' name='name' maxlength='50' size='20'>
                        <input type="hidden" name="type" value="rename_team">
                        <?php 
                    break;
                    /**************
                     * Buy team goods
                     **************/
                /**************
                 * Buy team goods
                 **************/
                case 'buy_goods':
                    echo $lng->getTrn('profile/team/box_tm/desc/buy_goods');
                    $goods_temp = $team->getGoods();
                    if ($DEA[$team->f_rname]['other']['rr_cost'] != $goods_temp['rerolls']['cost']) {
                        echo $lng->getTrn('profile/team/box_tm/desc/buy_goods_warn');
                    }
                    ?>
                        <hr><br>
                        <?php 
                    echo $lng->getTrn('profile/team/box_tm/fdescs/thing');
                    ?>
:<br>
                        <select name="thing">
                        <?php 
                    $DISABLE = true;
                    foreach ($team->getGoods() as $name => $details) {
                        if ($name == 'ff_bought' && !$team->mayBuyFF()) {
                            continue;
                        }
                        if (($team->{$name} < $details['max'] || $details['max'] == -1) && $team->treasury >= $details['cost']) {
                            echo "<option value='{$name}'>" . $details['cost'] / 1000 . "k | {$details['item']}</option>\n";
                            $DISABLE = false;
                        }
                    }
                    ?>
                        </select>
                        <input type="hidden" name="type" value="buy_goods">
                        <?php 
                    break;
                    /**************
                     * Let go (drop) of team goods
                     **************/
                /**************
                 * Let go (drop) of team goods
                 **************/
                case 'drop_goods':
                    echo $lng->getTrn('profile/team/box_tm/desc/drop_goods');
                    ?>
                        <hr><br>
                        <?php 
                    echo $lng->getTrn('profile/team/box_tm/fdescs/thing');
                    ?>
:<br>
                        <select name="thing">
                        <?php 
                    $DISABLE = true;
                    foreach ($team->getGoods() as $name => $details) {
                        if ($name == 'ff_bought' && !$team->mayBuyFF()) {
                            continue;
                        }
                        if ($team->{$name} > 0) {
                            echo "<option value='{$name}'>{$details['item']}</option>\n";
                            $DISABLE = false;
                        }
                    }
                    ?>
                        </select>
                        <input type="hidden" name="type" value="drop_goods">
                        <?php 
                    break;
                    /**************
                     * Set ready state
                     **************/
                /**************
                 * Set ready state
                 **************/
                case 'ready_state':
                    echo $lng->getTrn('profile/team/box_tm/desc/ready_state');
                    ?>
                        <hr><br>
                        <?php 
                    echo $lng->getTrn('profile/team/box_tm/fdescs/teamready');
                    ?>
                        <input type="checkbox" name="bool" value="1" <?php 
                    echo $team->rdy ? 'CHECKED' : '';
                    ?>
>
                        <input type="hidden" name="type" value="ready_state">
                        <?php 
                    break;
                    /***************
                     * Retire
                     **************/
                /***************
                 * Retire
                 **************/
                case 'retire':
                    echo $lng->getTrn('profile/team/box_tm/desc/retire');
                    ?>
                        <hr><br>
                        <?php 
                    echo $lng->getTrn('profile/team/box_tm/fdescs/retire');
                    ?>
                        <input type="checkbox" name="bool" value="1">
                        <input type="hidden" name="type" value="retire">
                        <?php 
                    break;
                    /***************
                     * Delete
                     **************/
                /***************
                 * Delete
                 **************/
                case 'delete':
                    echo $lng->getTrn('profile/team/box_tm/desc/delete');
                    if (!$this->isDeletable()) {
                        $DISABLE = true;
                    }
                    ?>
                        <hr><br>
                        <?php 
                    echo $lng->getTrn('profile/team/box_tm/fdescs/suredeleteteam');
                    ?>
                        <input type="checkbox" name="bool" value="1" <?php 
                    echo $DISABLE ? 'DISABLED' : '';
                    ?>
>
                        <input type="hidden" name="type" value="delete">
                        <?php 
                    break;
            }
            ?>
                    <br><br>
                    <input type="submit" name="button" value="OK" <?php 
            echo $DISABLE ? 'DISABLED' : '';
            ?>
                        <?php 
            if (in_array($_POST['menu_tmanage'], $tmange_confirm)) {
                echo "onClick=\"if(!confirm('" . $lng->getTrn('common/confirm_box') . "')){return false;}\"";
            }
            ?>
                    >
                </form>
            </div>
        </div>
        <?php 
            if ($coach->isNodeCommish(T_NODE_LEAGUE, $team->f_lid)) {
                ?>
            <div class="boxTeamPage">
                <div class="boxTitle<?php 
                echo T_HTMLBOX_ADMIN;
                ?>
"><?php 
                echo $lng->getTrn('profile/team/box_admin/title');
                ?>
</div>
                <div class="boxBody">
                    <?php 
                $base = 'profile/team';
                $admin_tools = array('unhire_journeyman' => $lng->getTrn($base . '/box_admin/unhire_journeyman'), 'unsell_player' => $lng->getTrn($base . '/box_admin/unsell_player'), 'unbuy_goods' => $lng->getTrn($base . '/box_admin/unbuy_goods'), 'bank' => $lng->getTrn($base . '/box_admin/bank'), 'spp' => $lng->getTrn($base . '/box_admin/spp'), 'dval' => $lng->getTrn($base . '/box_admin/dval'), 'extra_skills' => $lng->getTrn($base . '/box_admin/extra_skills'), 'ach_skills' => $lng->getTrn($base . '/box_admin/ach_skills'));
                // Set default choice.
                if (!isset($_POST['menu_admintools'])) {
                    reset($admin_tools);
                    $_POST['menu_admintools'] = key($admin_tools);
                }
                // If action is already chosen, then make it the default selected.
                if (isset($_POST['type']) && array_key_exists($_POST['type'], $admin_tools)) {
                    $_POST['menu_admintools'] = $_POST['type'];
                }
                ?>
                    <form method="POST" name="menu_admintools_form">
                        <select name="menu_admintools" onchange="document.menu_admintools_form.submit();">
                            <?php 
                foreach ($admin_tools as $opt => $desc) {
                    echo "<option value='{$opt}'" . ($_POST['menu_admintools'] == $opt ? 'SELECTED' : '') . ">{$desc}</option>";
                }
                ?>
                        </select>
                        <!-- <input type="submit" name="admintools" value="OK"> -->
                    </form>

                    <br><i><?php 
                echo $lng->getTrn('common/desc');
                ?>
:</i><br><br>
                    <form name='form_admintools' method='POST'>
                        <?php 
                $DISABLE = false;
                switch ($_POST['menu_admintools']) {
                    /***************
                     * Un-hire journeymen
                     **************/
                    case 'unhire_journeyman':
                        echo $lng->getTrn('profile/team/box_admin/desc/unhire_journeyman');
                        ?>
                                <hr><br>
                                <?php 
                        echo $lng->getTrn('common/player');
                        ?>
:<br>
                                <select name="player">
                                <?php 
                        $DISABLE = true;
                        foreach ($players as $p) {
                            if ($p->is_sold || $p->is_dead || $p->is_journeyman || $p->qty != 16) {
                                continue;
                            }
                            echo "<option value='{$p->player_id}'>{$p->name}</option>\n";
                            $DISABLE = false;
                        }
                        ?>
                                </select>
                                <input type="hidden" name="type" value="unhire_journeyman">
                                <?php 
                        break;
                        /***************
                         * Un-sell player
                         **************/
                    /***************
                     * Un-sell player
                     **************/
                    case 'unsell_player':
                        echo $lng->getTrn('profile/team/box_admin/desc/unsell_player');
                        ?>
                                <hr><br>
                                <?php 
                        echo $lng->getTrn('common/player');
                        ?>
:<br>
                                <select name="player">
                                <?php 
                        $DISABLE = true;
                        foreach ($players as $p) {
                            if ($p->is_sold) {
                                echo "<option value='{$p->player_id}'>{$p->name}</option>\n";
                                $DISABLE = false;
                            }
                        }
                        ?>
                                </select>
                                <input type="hidden" name="type" value="unsell_player">
                                <?php 
                        break;
                        /***************
                         * Un-buy team goods
                         **************/
                    /***************
                     * Un-buy team goods
                     **************/
                    case 'unbuy_goods':
                        echo $lng->getTrn('profile/team/box_admin/desc/unbuy_goods');
                        ?>
                                <hr><br>
                                <select name="thing">
                                <?php 
                        $DISABLE = true;
                        foreach ($team->getGoods() as $name => $details) {
                            if ($team->{$name} > 0) {
                                # Only allow to un-buy those things which we already have some of.
                                echo "<option value='{$name}'>{$details['item']}</option>\n";
                                $DISABLE = false;
                            }
                        }
                        ?>
                                </select>
                                <input type="hidden" name="type" value="unbuy_goods">
                                <?php 
                        break;
                        /***************
                         * Gold bank
                         **************/
                    /***************
                     * Gold bank
                     **************/
                    case 'bank':
                        echo $lng->getTrn('profile/team/box_admin/desc/bank');
                        ?>
                                <hr><br>
                                &Delta; team treasury:<br>
                                <input type="radio" CHECKED name="sign" value="+">+
                                <input type="radio" name="sign" value="-">-
                                <input type='text' name="amount" maxlength=5 size=5>k
                                <input type="hidden" name="type" value="bank">
                                <?php 
                        break;
                        /***************
                         * Manage extra SPP
                         **************/
                    /***************
                     * Manage extra SPP
                     **************/
                    case 'spp':
                        echo $lng->getTrn('profile/team/box_admin/desc/spp');
                        ?>
                                <hr><br>
                                <?php 
                        echo $lng->getTrn('common/player');
                        ?>
:<br>
                                <select name="player">
                                <?php 
                        $DISABLE = true;
                        objsort($players, array('+is_dead', '+name'));
                        foreach ($players as $p) {
                            if (!$p->is_sold) {
                                echo "<option value='{$p->player_id}'" . ($p->is_dead ? ' style="background-color:' . COLOR_HTML_DEAD . ';"' : '') . ">{$p->name}</option>";
                                $DISABLE = false;
                            }
                        }
                        objsort($players, array('+nr'));
                        ?>
                                </select>
                                <br><br>
                                <input type="radio" CHECKED name="sign" value="+">+
                                <input type="radio" name="sign" value="-">-
                                <input type='text' name='amount' maxlength="5" size="5"> &Delta; SPP
                                <input type="hidden" name="type" value="spp">
                                <?php 
                        break;
                        /***************
                         * Manage extra player value
                         **************/
                    /***************
                     * Manage extra player value
                     **************/
                    case 'dval':
                        echo $lng->getTrn('profile/team/box_admin/desc/dval');
                        ?>
                                <hr><br>
                                <?php 
                        echo $lng->getTrn('common/player');
                        ?>
:<br>
                                <select name="player">
                                <?php 
                        $DISABLE = true;
                        objsort($players, array('+is_dead', '+name'));
                        foreach ($players as $p) {
                            if (!$p->is_sold) {
                                echo "<option value='{$p->player_id}'" . ($p->is_dead ? ' style="background-color:' . COLOR_HTML_DEAD . ';"' : '') . ">{$p->name} (current extra = " . $p->extra_val / 1000 . "k)</option>";
                                $DISABLE = false;
                            }
                        }
                        objsort($players, array('+nr'));
                        ?>
                                </select>
                                <br><br>
                                Set extra value to<br>
                                <input type="radio" CHECKED name="sign" value="+">+
                                <input type="radio" name="sign" value="-">-
                                <input type='text' name='amount' maxlength="10" size="6">k
                                <input type="hidden" name="type" value="dval">
                                <?php 
                        break;
                        /***************
                         * Manage extra skills
                         **************/
                    /***************
                     * Manage extra skills
                     **************/
                    case 'extra_skills':
                        echo $lng->getTrn('profile/team/box_admin/desc/extra_skills');
                        ?>
                                <hr><br>
                                <?php 
                        echo $lng->getTrn('common/player');
                        ?>
:<br>
                                <select name="player">
                                <?php 
                        $DISABLE = true;
                        foreach ($players as $p) {
                            if (!$p->is_sold && !$p->is_dead) {
                                echo "<option value='{$p->player_id}'>{$p->name}</option>";
                                $DISABLE = false;
                            }
                        }
                        ?>
                                </select>
                                <br><br>
                                Skill:<br>
                                <select name="skill">
                                <?php 
                        foreach ($skillarray as $cat => $skills) {
                            echo "<OPTGROUP LABEL='{$cat}'>";
                            foreach ($skills as $id => $skill) {
                                echo "<option value='{$id}'>{$skill}</option>";
                            }
                            echo "</OPTGROUP>";
                        }
                        ?>
                                </select>
                                <br><br>
                                Action (add/remove)<br>
                                <input type="radio" CHECKED name="sign" value="+">+
                                <input type="radio" name="sign" value="-">-
                                <input type="hidden" name="type" value="extra_skills">
                                <?php 
                        break;
                        /***************
                         * Remove achived skills
                         **************/
                    /***************
                     * Remove achived skills
                     **************/
                    case 'ach_skills':
                        echo $lng->getTrn('profile/team/box_admin/desc/ach_skills');
                        ?>
                                <hr><br>
                                <?php 
                        echo $lng->getTrn('common/player');
                        ?>
:<br>
                                <select name="player">
                                <?php 
                        $DISABLE = true;
                        foreach ($players as $p) {
                            if (!$p->is_dead && !$p->is_sold) {
                                echo "<option value='{$p->player_id}'>{$p->name}</option>\n";
                                $DISABLE = false;
                            }
                        }
                        ?>
                                </select>
                                <br><br>
                                Skill<br>
                                <select name="skill">
                                <?php 
                        foreach ($skillarray as $cat => $skills) {
                            echo "<OPTGROUP LABEL='{$cat}'>";
                            foreach ($skills as $id => $skill) {
                                echo "<option value='{$id}'>{$skill}</option>";
                            }
                            echo "</OPTGROUP>";
                        }
                        echo "<optgroup label='Characteristic increases'>\n";
                        foreach ($CHR_CONV as $key => $name) {
                            echo "<option value='ach_{$key}'>+ " . ucfirst($name) . "</option>\n";
                        }
                        echo "</optgroup>\n";
                        ?>
                                </select>
                                <input type="hidden" name="type" value="ach_skills">
                                <?php 
                        break;
                }
                ?>
                        <br><br>
                        <input type="submit" name="button" value="OK" <?php 
                echo $DISABLE ? 'DISABLED' : '';
                ?>
 >
                    </form>
                </div>
            </div>
            <?php 
            }
        }
        ?>
    <br>
    <div class="row"></div>
    <br>
    <?php 
        if (!$settings['hide_ES_extensions']) {
            ?>
        <div class="row">
            <div class="boxWide">
                <div class="boxTitle<?php 
            echo T_HTMLBOX_STATS;
            ?>
"><a href='javascript:void(0);' onClick="slideToggleFast('ES');"><b>[+/-]</b></a> &nbsp;<?php 
            echo $lng->getTrn('common/extrastats');
            ?>
</div>
                <div class="boxBody" id="ES" style='display:none;'>
                    <?php 
            HTMLOUT::generateEStable($this);
            ?>
                </div>
            </div>
        </div>
        <?php 
        }
        // If an team action was chosen, jump to actions HTML anchor.
        if ($JMP_ANC) {
            ?>
        <script language="JavaScript" type="text/javascript">
        window.location = "#aanc";
        </script>
        <?php 
        }
    }
Ejemplo n.º 23
0
 function createBill()
 {
     $bill = new Bill();
     $customer = new Customer();
     $tour = new Tour();
     $bill_product = new Bill_Product();
     $customer_data = $customer->get($this->customer_id);
     if (count($customer_data) == 0) {
         echo "<div class=\"error\">Fehler in Session, bitte neu anmelden</div><br>\n";
         return -1;
     }
     $tour_data = $tour->getByAssistant($customer_data[0][12]);
     $bill_id = $bill->create("", array($this->customer_id, $customer_data[0][12], "", $tour_data[0][2], -2, time()));
     $list = $this->getItems();
     for ($i = 0; $i < count($list); $i++) {
         if ($list[$i][2] > 0) {
             $bill_product->create(array($bill_id, $list[$i][0], $list[$i][2], $list[$i][5], "", 0, 0, time()));
         }
     }
     return 0;
 }
Ejemplo n.º 24
0
<?php

/* For licensing terms, see /license.txt */
/**
 * Initialization install
 * @author Angel Fernando Quiroz Campos <*****@*****.**>
 * @package chamilo.plugin.tour
 */
require_once __DIR__ . '/config.php';
Tour::create()->install();
Ejemplo n.º 25
0
 public function privacyAndPolicy()
 {
     if (Session::has('st_date')) {
         $st_date = Session::get('st_date');
     } else {
         $st_date = date("Y/m/d");
     }
     //Session::flush();
     if (Session::has('ed_date')) {
         $ed_date = Session::get('ed_date');
     } else {
         $ed_date = date("Y/m/d", strtotime($st_date . ' + 2 days'));
     }
     $filter_tours = Tour::get();
     $filter_cities = City::get();
     $path = array();
     //        dd(DB::getQueryLog());
     return View::make('pages.privacy_policy')->with(array('path' => $path, 'st_date' => $st_date, 'ed_date' => $ed_date, 'filter_tours' => $filter_tours, 'filter_cities' => $filter_cities));
 }
Ejemplo n.º 26
0
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function tourDetail($country = '', $tour = '', $tour_type = '')
 {
     if (Session::has('st_date')) {
         $st_date = Session::get('st_date');
     } else {
         $st_date = date("Y/m/d");
     }
     //Session::flush();
     if (Session::has('ed_date')) {
         $ed_date = Session::get('ed_date');
     } else {
         $ed_date = date("Y/m/d", strtotime($st_date . ' + 2 days'));
     }
     $filter_tours = Tour::where('val', 1)->get();
     $filter_cities = City::where('val', 1)->get();
     if (!empty($country)) {
         $country = str_replace('-', ' ', $country);
         $get_country_id = DB::table('countries')->where('country', 'LIKE', $country)->first();
         $country_id = $get_country_id->id;
     }
     if (!empty($tour)) {
         $tour = str_replace('-', ' ', $tour);
         $get_tour_id = DB::table('tours')->where('tour_title', 'LIKE', $tour)->first();
         $tour_id = $get_tour_id->id;
     }
     if (!empty($tour_type)) {
         $tour_type = str_replace('-', ' ', $tour_type);
         $get_tour_type_id = DB::table('tour_types')->where('tour_type_title', 'LIKE', $tour_type)->first();
         $tour_type_id = $get_tour_type_id->id;
     }
     $path = array();
     $tour = Tour::where('id', $tour_id)->where('val', 1)->get();
     $tour_type = TourType::where('id', $tour_type_id)->where('val', 1)->first();
     //        dd(DB::getQueryLog());
     if (!$tour_type->count()) {
         return Redirect::to('/403');
     }
     return View::make('tour.tour_details')->with(array('tour' => $tour, 'tour_id' => $tour_id, 'tour_type_id' => $tour_type_id, 'path' => $path, 'tour_type' => $tour_type, 'st_date' => $st_date, 'ed_date' => $ed_date, 'filter_tours' => $filter_tours, 'filter_cities' => $filter_cities));
 }
Ejemplo n.º 27
0
        <th>Type</th>
        <th>Date Created</th>
        <th>RS</th>
        <th>Locked</th>
        <th>Allow Scheduling</th>
        <th>Winner</th>
        <th>Finished? ('is_finished')</th>
        <th>Empty? ('is_empty')</th>
        <th>Begun? ('is_begin')</th>
        <th>Empty? ('empty')</th>
        <th>Begun? ('begun')</th>
        <th>Finished? ('finished')</th>
    </thead>
    <tbody style="text-align: center">
        <?php 
foreach (Tour::getTours() as $tour) {
    ?>
            <tr>
                <td><?php 
    echo $tour->tour_id;
    ?>
</td>
                <td><?php 
    echo $tour->f_did;
    ?>
</td>
                <td><?php 
    echo $tour->name;
    ?>
</td>
                <td><?php 
Ejemplo n.º 28
0
<?php

if (isset($_GET['sens']) && NULL != $_GET['sens'] && '' != $_GET['sens']) {
    include_once 'include/tools.php';
    include_once 'include/Tour.php';
    if ('receive' == $_GET['sens']) {
        if (isset($_GET['action']) && NULL != $_GET['action']) {
            if ('rejoindrePartie' == $_GET['action']) {
                $tour = new Tour(array('joueurs' => $_GET['joueur']));
                $tour->rejoindrePartie();
            } else {
                if ('getTourCourant' == $_GET['action']) {
                    $tour = new Tour(array('idPartie' => $_GET['idPartie'], 'numero' => $_GET['numero']));
                    $tour->getTourCourant();
                }
            }
            header("Content-Type: text/xml");
            echo $tour->getXML();
        }
    } else {
        if ('send' == $_GET['sens']) {
            if (isset($_GET['action']) && NULL != $_GET['action']) {
                if ('sendTourFini' == $_GET['action']) {
                    $tour = new Tour($_GET);
                }
                header("Content-Type: text/xml");
                echo $tour->getXML();
            }
        }
    }
}
Ejemplo n.º 29
0
<?php

/* For licensing terms, see /license.txt */
/**
 * Config the plugin
 * @author Angel Fernando Quiroz Campos <*****@*****.**>
 * @package chamilo.plugin.tour
 */
require_once __DIR__ . '/config.php';
$pluginPath = api_get_path(SYS_PLUGIN_PATH) . 'tour/';
$pluginWebPath = api_get_path(WEB_PLUGIN_PATH) . 'tour/';
$userId = api_get_user_id();
$tourPlugin = Tour::create();
$config = $tourPlugin->getTourConfig();
$showTour = $tourPlugin->get('show_tour') === 'true';
if ($showTour) {
    $pages = array();
    foreach ($config as $pageContent) {
        $pages[] = array('pageClass' => $pageContent['pageClass'], 'show' => $tourPlugin->checkTourForUser($pageContent['pageClass'], $userId));
    }
    $theme = $tourPlugin->get('theme');
    $_template['show_tour'] = $showTour;
    $_template['pages'] = json_encode($pages);
    $_template['web_path'] = array('intro_css' => "{$pluginWebPath}intro.js/introjs.min.css", 'intro_theme_css' => null, 'intro_js' => "{$pluginWebPath}intro.js/intro.min.js", 'steps_ajax' => "{$pluginWebPath}ajax/steps.ajax.php", 'save_ajax' => "{$pluginWebPath}ajax/save.ajax.php");
    if (file_exists("{$pluginPath}intro.js/introjs-{$theme}.css")) {
        $_template['web_path']['intro_theme_css'] = "{$pluginWebPath}intro.js/introjs-{$theme}.css";
    }
}
global $mod_strings;
$module_type = $_REQUEST['module'];
$module = new ContractLiquidate();
$module_type_file = strtoupper(ltrim(rtrim($module_type, 's'), ''));
$module_type_low = strtolower($module_type);
$module->retrieve($_REQUEST['contractid']);
//Lay thong tin cua hop dong goc
$contract = new Contract();
$contract->retrieve($module->contract_id);
//End
//Lay thong tin cua made tour
$madetour = new GroupProgram();
$madetour->retrieve($contract->groupprogr4251rograms_ida);
//End
//Lay thong tin cua tour
$tour = new Tour();
$tour->retrieve($madetour->tour_id);
//End
$task = $_REQUEST['task'];
$doc = new clsMsDocGenerator();
$contractliquidatevalue = array();
$sql = "SELECT * FROM contractliquidatevalues WHERE contract_liquidate_id ='" . $module->id . "'and deleted = 0";
$res = $module->db->query($sql);
while ($row = $module->db->fetchByAssoc($res)) {
    $contractliquidatevalue[$row['id']] = $row['contract_liquidate_id'];
}
$contractliquidateincre = array();
$sql1 = "SELECT * FROM contractliquidateincre WHERE contract_liquidate_id ='" . $module->id . "' AND deleted = 0";
$res1 = $module->db->query($sql1);
while ($row1 = $module->db->fetchByAssoc($res1)) {
    $contractliquidateincre[$row1['id']] = $row1['contract_liquidate_id'];