示例#1
0
 function generateForm(&$edit)
 {
     global $lr_session, $CONFIG;
     $this->smarty->assign('privacy_url', variable_get('privacy_policy', ''));
     $this->smarty->assign('app_org_short_name', variable_get('app_org_short_name', 'the league'));
     $this->smarty->assign('province_names', getProvinceNames());
     $this->smarty->assign('state_names', getStateNames());
     $this->smarty->assign('country_names', getCountryNames());
     $player_classes = array('player' => 'Player', 'visitor' => 'Non-player account');
     if ($lr_session->has_permission('person', 'edit', $this->person->id, 'class')) {
         $player_classes['administrator'] = 'Leaguerunner administrator';
         $player_classes['volunteer'] = 'Volunteer';
     }
     # Volunteers can unset themselves as volunteer if they wish.
     if ($this->person->class == 'volunteer') {
         $player_classes['volunteer'] = 'Volunteer';
     }
     $this->smarty->assign('player_classes', $player_classes);
     $this->smarty->assign('player_statuses', getOptionsFromEnum('person', 'status'));
     $this->smarty->assign('skill_levels', getOptionsFromRange(1, 10));
     $this->smarty->assign('start_years', getOptionsFromRange(1986, strftime('%Y', time()), 'reverse'));
     $this->smarty->assign('shirt_sizes', getShirtSizes());
     $this->smarty->assign('dog_questions', variable_get('dog_questions', 1));
     return true;
 }
示例#2
0
 function generateForm(&$edit)
 {
     $this->smarty->assign('field_statuses', array('open' => 'open', 'closed' => 'closed'));
     $this->smarty->assign('ratings', field_rating_values());
     // TODO: Should become Field::get_eligible_parents()
     $sth = Field::query(array('_extra' => 'ISNULL(parent_fid)', '_order' => 'f.name,f.num'));
     $parents = array();
     $parents[0] = "---";
     while ($p = $sth->fetch(PDO::FETCH_OBJ)) {
         $parents[$p->fid] = $p->fullname;
     }
     $this->smarty->assign('parents', $parents);
     $this->smarty->assign('regions', getOptionsFromEnum('field', 'region'));
     $this->smarty->assign('noyes', array(0 => 'No', 1 => 'Yes'));
     $this->smarty->assign('province_names', getProvinceNames());
     $this->smarty->assign('state_names', getStateNames());
     $this->smarty->assign('country_names', getCountryNames());
     return true;
 }
示例#3
0
 function generateForm(&$edit)
 {
     if (!isset($edit['app_admin_email'])) {
         $edit['app_admin_email'] = $_SERVER['SERVER_ADMIN'];
     }
     if (!isset($edit['privacy_policy'])) {
         $edit['privacy_policy'] = $_SERVER['SERVER_NAME'] . "/privacy";
     }
     if (!isset($edit['password_reset'])) {
         $edit['password_reset'] = url('person/forgotpassword');
     }
     $this->smarty->assign('app_org_province', $edit['app_org_province']);
     $this->smarty->assign('province_names', getProvinceNames());
     $this->smarty->assign('state_names', getStateNames());
     $this->smarty->assign('country_names', getCountryNames());
     $this->smarty->assign('seasons', getOptionsFromQuery("SELECT id AS theKey, display_name AS theValue FROM season ORDER BY year, id"));
     $this->smarty->assign('enable_disable', array('Disabled', 'Enabled'));
     $this->smarty->assign('questions', array('team_spirit' => 'team_spirit', 'ocua_team_spirit' => 'ocua_team_spirit'));
     $this->smarty->assign('log_levels', array(KLogger::EMERG => 'Emergency', KLogger::ALERT => 'Alert', KLogger::CRIT => 'Critical', KLogger::ERR => 'Error', KLogger::WARN => 'Warning', KLogger::NOTICE => 'Notice', KLogger::INFO => 'Information', KLogger::DEBUG => 'Debug'));
     $this->smarty->assign('live_sandbox', array('Live', 'Sandbox'));
 }
示例#4
0
<?php

include "../config.php";
include "functions.php";
if (!$_GET['not_json']) {
    header('Content-Type: application/x-json;charset=utf-8');
}
header("Access-Control-Allow-Origin: *");
/*
$_POST['c']='US';
$_POST['src']=0;
*/
$country_names = getCountryNames();
$other_flow = array();
if ($_POST['src']) {
    $flows = getFlowsFrom($_POST['c'], 10, "`qta` DESC");
    $index = 1;
    $other_flow = getFlowFromTo($_POST['c'], $_POST['o']);
} else {
    $flows = getFlowsTo($_POST['c'], 10, "`qta` DESC");
    $index = 0;
    $other_flow = getFlowFromTo($_POST['o'], $_POST['c']);
}
if ($_POST['o']) {
    //var_export($other_flow);
    //var_export($flows);
    if (!in_array($other_flow, $flows)) {
        array_push($flows, array($other_flow[0], $other_flow[1], $other_flow[2], 1));
    }
}
$population = getPopulation(2010, $_POST['c']);
示例#5
0
        $LIMIT = " LIMIT {$limit}";
    }
    $query = "SELECT `src`,`dst`,`qta` FROM `flows` WHERE `qta`>0 {$WHERE} ORDER BY {$order} {$LIMIT}";
    $result = mysql_query($query) or die("what's up with this query? " . $query);
    $people = array();
    while ($row = mysql_fetch_assoc($result)) {
        //if(!$people[$row['src']])
        //	$people[$row['src']]=array();
        //$people[$row['src']][$row['dst']]=$row['qta'];
        if ($row['qta'] >= 1) {
            array_push($people, array($row['src'], $row['dst'], round($row['qta'])));
        }
    }
    return $people;
}
$countries = getCountryNames();
function cmp($a, $b)
{
    global $countries;
    return strcmp($countries[$a[0]], $countries[$b[0]]);
    //return $countries[$a[0]] < $countries[$b[0]];
}
function getFlowsFrom($country = null, $limit = 0, $order = "`src`")
{
    $WHERE = " AND `dst`!='XS' AND `dst`!='XN' AND `src`!='XS' AND `src`!='XN' ";
    if ($country) {
        $WHERE .= "AND `src`='{$country}'";
    }
    if ($limit) {
        $LIMIT = " LIMIT {$limit}";
    }