Exemple #1
0
require_once 'components/com_jtips/classes/jseason.class.php';
require_once 'components/com_jtips/classes/jteam.class.php';
$jTeam = new jTeam($database);
$ids = jTipsGetParam($_REQUEST, 'cid', array());
//Do we have an existing Season?
$id = array_shift($ids);
if (is_numeric($id)) {
    $jTeam->load($id);
}
//set the page title
$title = $jLang['_ADMIN_TEAM_TITLE'] . ": " . ($jTeam->exists() ? $jLang['_ADMIN_OTHER_EDIT'] : $jLang['_ADMIN_OTHER_NEW']);
//set the custom javascripts
$mainframe->addCustomHeadTag("<script type='text/javascript' src='components/com_jtips/modules/Teams/Teams.js'></script>");
//what seasons are there
$jSeason = new jSeason($database);
$jSeasons = forceArray($jSeason->loadByParams(array()));
$jSeasonOptions = array(jTipsHTML::makeOption('', $jLang['_ADMIN_CONF_NONE']));
jTipsSortArrayObjects($jSeasons, 'name', 'ASC');
foreach ($jSeasons as $season) {
    $jSeasonOptions[] = jTipsHTML::makeOption($season->id, $season->name);
}
//build the field definitions
$formData = array('basic' => array('legend' => '_ADMIN_BASIC_INFORMATION', 'fields' => array('id' => array('field' => array('type' => 'hidden', 'attributes' => array('type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => $jTeam->id))), 'season' => array('label' => '_ADMIN_TEAM_SEASON', 'field' => array('type' => 'select', 'attributes' => array('name' => 'season_id', 'id' => 'season_id', 'class' => 'inputbox'), 'options' => $jSeasonOptions, 'selected' => $jTeam->season_id)), 'name' => array('label' => '_ADMIN_TEAM_NAME', 'field' => array('type' => 'text', 'attributes' => array('name' => 'name', 'id' => 'name', 'class' => 'inputbox', 'size' => '50', 'type' => 'text', 'value' => $jTeam->name))), 'location' => array('label' => '_ADMIN_TEAM_LOCATION', 'field' => array('type' => 'text', 'attributes' => array('name' => 'location', 'id' => 'location', 'class' => 'inputbox', 'size' => '50', 'type' => 'text', 'value' => $jTeam->location))), 'website' => array('label' => '_ADMIN_TEAM_URL', 'field' => array('type' => 'text', 'attributes' => array('name' => 'url', 'id' => 'url', 'class' => 'inputbox', 'size' => '50', 'type' => 'text', 'value' => $jTeam->url))), 'about' => array('label' => '_ADMIN_TEAM_ABOUT', 'field' => array('type' => 'editor', 'attributes' => array('name' => 'about', 'id' => 'about', 'class' => 'inputbox', 'value' => jTipsStripslashes($jTeam->about)))))));
$formData['image'] = array('legend' => '_ADMIN_TEAM_LOGO', 'fields' => array('logo' => array('label' => '_ADMIN_TEAM_LOGO', 'field' => array('type' => 'file', 'attributes' => array('size' => '50', 'type' => 'file', 'class' => 'inputbox', 'name' => 'logo', 'id' => 'logo')))));
if ($jTeam->logo) {
    $formData['image']['fields']['current_logo'] = array('label' => '_ADMIN_TEAM_CURRENT_LOGO', 'field' => array('type' => 'img', 'attributes' => array('alt' => 'Logo', 'id' => 'current_logo', 'src' => $mosConfig_live_site . '/' . getJtipsImage($jTeam->logo, 100))));
    $formData['image']['fields']['remove_logo'] = array('label' => '_ADMIN_TEAM_REMOVE_LOGO', 'field' => array('type' => 'checkbox', 'attributes' => array('class' => 'inputbox', 'name' => 'remove_logo', 'value' => '1', 'type' => 'checkbox', 'onClick' => 'if (this.checked){$("logo").disabled=true;}else{$("logo").disabled=false}')), 'description' => '_ADMIN_TEAM_REMOVE_LOGO_DEF');
}
// BUG 287 - can no longer edit team points
/*$formData['points'] = array(
	'legend' => '_ADMIN_TEAM_POINTS_ADJUST',
    $data = JFile::read(dirname(__FILE__) . '/installer.xml');
    JFile::write(dirname(__FILE__) . '/mod_jtips_dash_comp_ladder.xml', $data);
    JFile::delete(dirname(__FILE__) . '/installer.xml');
}
$jSeason = new jSeason($database);
$season_id = getSeasonID();
if (is_numeric($season_id)) {
    $jSeason->load($season_id);
} else {
    $date = gmdate('Y-m-d');
    //Bug 33.4 - Extended params array to default to season for current user
    $objParams = array('end_time' => array('type' => 'query', 'query' => "> '{$date}'"), 'left_join' => array('type' => 'left_join', 'join_table' => '#__jtips_users', 'lhs_table' => '#__jtips_seasons', 'lhs_key' => 'id', 'rhs_table' => '#__jtips_users', 'rhs_key' => 'season_id'));
    if (isset($jTipsUser->user_id) and !empty($jTipsUser->user_id)) {
        $objParams['#__jtips_users.user_id'] = $jTipsUser->user_id;
    }
    $jSeasons = forceArray($jSeason->loadByParams($objParams));
    if (count($jSeasons) > 0) {
        $jSeason =& array_shift($jSeasons);
    }
}
$jRound = new jRound($database);
$round_id = $jSeason->getCurrentRound();
$jRound->load($round_id);
if ($jRound->scored == 0) {
    $prev_round_id = $jSeason->getLastRound();
    $prev_round = new jRound($database);
    $prev_round->load($prev_round_id);
    $jRound =& $prev_round;
    $load_round = $prev_round_id;
} else {
    $load_round = $jRound->id;
Exemple #3
0
            $jTipsVersion = getFullVersion();
            //BUG 262 - AutoUpgrade to version message corrected
            $newVersion = jTipsGetParam($_SESSION, 'jtips_upgraded_version', 'Latest Version');
            $message = 'System Upgraded!';
            // to ' .$jTipsVersion;
            unset($_SESSION['jtips_upgraded_version']);
        } else {
            if ($autoUpgradeResult == 0) {
                //upgrade not required
            } else {
                if (is_string($autoUpgradeResult)) {
                    //display the error message
                    //Auto Update Failed: [message]
                    $message = 'System Upgrade Failed: ' . $autoUpgradeResult;
                }
            }
        }
        if ($message) {
            mosRedirect('index2.php?option=com_jtips&module=Dashboard&nu=1&task=Validate', $message);
        }
    }
}
$jSeason = new jSeason($database);
$parameters = array('end_time' => array('type' => 'query', 'query' => "> '" . gmdate('Y-m-d') . "'"), 'start_time' => array('type' => 'query', 'query' => "< '" . gmdate('Y-m-d') . "'"));
$jSeasons = forceArray($jSeason->loadByParams($parameters));
$tpl->jSeasons = $jSeasons;
$dashboard = array();
include 'components/com_jtips/modules/Dashboard/dashboard.php';
$tpl->menu = $dashboard;
//jdash_HTML::dashboard($jSeasons, $dashboard);
$tpl->display();
require_once $include_path . 'classes/jteam.class.php';
require_once $include_path . 'classes/juser.class.php';
include $include_path . 'config.jtips.php';
//BUG
if (!$jTipsCurrentUser) {
    $jTipsCurrentUser = new jTipsUser($database);
    $my =& $mainframe->getUser();
    $parameters = array('user_id' => $my->id);
    $temp = forceArray($jTipsCurrentUser->loadByParams($parameters));
    $jTipsCurrentUser = array_shift($temp);
    unset($parameters);
}
//Get the season
$jtips_params = array('name' => trim($season_name));
$jSeason = new jSeason($database);
$jSeason->loadByParams($jtips_params);
if (isset($jSeason->id) and !empty($jSeason->id)) {
    //parse the info here
    $hasData = true;
    $round_id = $jSeason->getCurrentRound();
    $jRound = new jRound($database);
    if (!$round_id) {
        $hasData = false;
    } else {
        $jRound->load($round_id);
    }
    $data = array('round_id' => $round_id);
    $game = new jGame($database);
    $jGames = forceArray($game->loadByParams($data));
    if (empty($jGames)) {
        $hasData = false;
Exemple #5
0
require_once 'components/com_jtips/classes/jcomment.class.php';
require_once 'components/com_jtips/classes/jround.class.php';
require_once 'components/com_jtips/classes/jseason.class.php';
require_once 'components/com_jtips/classes/jtip.class.php';
require_once 'components/com_jtips/classes/juser.class.php';
$ids = jTipsGetParam($_REQUEST, 'cid', array());
$destroyed = array();
if (!empty($ids)) {
    foreach ($ids as $id) {
        if (is_numeric($id)) {
            $jSeason = new jSeason($database);
            $jSeason->load($id);
            jTipsLogger::_log('Deleting season ' . $jSeason->name);
            $params = array('season_id' => $id);
            $jRound = new jRound($database);
            $jRounds = $jSeason->loadByParams($params);
            if (!is_array($jRounds)) {
                if ($jRound->exists()) {
                    $jRounds = array($jRound);
                } else {
                    $jRounds = array();
                }
            }
            jTipsLogger::_log('deleting rounds from season');
            foreach ($jRounds as $jRound) {
                array_push($destroyed, $jRound->destroy());
            }
            $jTipsUser = new jTipsUser($database);
            $jTipsUsers = $jTipsUser->loadByParams($params);
            if (!is_array($jTipsUsers)) {
                if ($jTipsUser->exists()) {
/components/com_jtips/js/moodalbox.js"></script>
	<script type="text/javascript" src="<?php 
    echo $mosConfig_live_site;
    ?>
/components/com_jtips/js/Popup.js"></script>
	<link rel='stylesheet' href='<?php 
    echo $mosConfig_live_site;
    ?>
/components/com_jtips/css/moodalbox.css' type='text/css' media='screen' />
	<?php 
} else {
    JHTML::_('behavior.modal');
}
// load the selected season
$jSeason = new jSeason($database);
$jSeason->loadByParams(array('name' => $params->get('season')));
if (!$jSeason->id) {
    // show an error message
    ?>
<p class="error">No competition selected. Please update module configuration.</p><?php 
} else {
    $my =& $mainframe->getUser();
    //do we have a valid user?
    $jTipsMyTipsUser = new jTipsUser($database);
    $jTipsMyTipsUser->loadByParams(array('user_id' => $my->id, 'season_id' => $jSeason->id));
    if (!$jTipsMyTipsUser->id) {
        ?>
<p class="message">Join the <?php 
        echo $jSeason->name;
        ?>
 competition!</p><?php 
Exemple #7
0
require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/classes/jseason.class.php';
$jSeason = new jSeason($database);
//can add in an ordering field here in the params
$direction = jTipsGetParam($_REQUEST, 'filter_order_Dir', 'asc');
if (empty($direction)) {
    $direction = 'asc';
}
$orderby = jTipsGetParam($_REQUEST, 'filter_order', 'name');
if (empty($orderby)) {
    $orderby = 'name';
}
$parameters = array('order' => array('type' => 'order', 'direction' => $direction, 'by' => $orderby));
$limit = jTipsGetParam($_REQUEST, 'limit', 25);
$limitstart = jTipsGetParam($_REQUEST, 'limitstart', 0);
$pageNav = new mosPageNav($jSeason->getCount(), $limitstart, $limit);
$jSeasons = forceArray($jSeason->loadByParams($parameters, $limit, $limitstart));
$formData = array('title' => $jLang['_ADMIN_SEASON_TITLE'], 'editTask' => 'edit', 'module' => 'Seasons', 'icon' => 'seasons');
$currentDir = jTipsGetParam($_REQUEST, 'filter_order_Dir', 'asc');
if ($currentDir == 'asc') {
    $dir = 'desc';
} else {
    $dir = 'asc';
}
//The header row
$header = array('', "<a href='javascript:tableOrdering(\"name\", \"{$dir}\", \"list\");'>" . $jLang['_ADMIN_SEASON_NAME'] . "</a>", "<a href='javascript:tableOrdering(\"start_time\", \"{$dir}\", \"list\");'>" . $jLang['_ADMIN_SEASON_START'] . "</a>", "<a href='javascript:tableOrdering(\"end_time\", \"{$dir}\", \"list\");'>" . $jLang['_ADMIN_SEASON_END'] . "</a>");
//The row data for each for
$data = array();
$i = 0;
foreach ($jSeasons as $jSeason) {
    $data[$jSeason->id] = array(makeListLink($jSeason->name, $i++), $jSeason->start_time, $jSeason->end_time);
}