Example #1
0
<?php

include_once "../templates/classEmma.class.php";
if (isset($_POST['btnSubmit'])) {
    Emma::CreateCompetition($_POST['name'], $_POST['org'], $_POST['date']);
    header("Location: /liveresultat/adm/admincompetitions.php");
    exit;
}
include_once "../templates/emmalang_sv.php";
$lang = "sv";
if (isset($_GET['lang']) && $_GET['lang'] != "") {
    $lang = $_GET['lang'];
}
include_once "../templates/emmalang_{$lang}.php";
?>

<html>
<head><title><?php 
echo $_TITLE;
?>
</title>
<link rel="stylesheet" type="text/css" href="../css/style.css">
<meta name="robots" content="noindex">
<script language="javascript">
function colorRow(row)
{
var el = document.getElementById(row);
if (el == null)
  return;
el.style.backgroundColor = "#C0D6FF";
}
<?php

require 'vendor/Emma.php';
$account_id = 1721615;
$public_key = '9b7ceb72fef20670294d';
$private_key = '9ea5894c4af8e1364f43';
$emma = new Emma($account_id, $public_key, $private_key);
$email = $_POST['email'];
$zip_code = $_POST['zip'];
$group_id = $_POST['group_id'];
try {
    $member = array();
    $member['email'] = $email;
    $member['fields'] = array('postal_code' => $zip_code);
    $member['group_ids'] = array($group_id);
    $req = $emma->membersAddSingle($member);
    echo $req;
} catch (Emma_Invalid_Response_Exception $e) {
    exit($e->getMessage());
}
Example #3
0
echo $_CHOOSECMP;
?>
</h1>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" id="tblComps">
			<tr><th align="left"><?php 
echo $_DATE;
?>
</th><th align="left"><?php 
echo $_NAME;
?>
</th><th align="left"><?php 
echo $_ORGANIZER;
?>
</th></tr>
<?php 
$comps = Emma::GetCompetitions();
foreach ($comps as $comp) {
    ?>
		<tr id="row<?php 
    echo $comp["tavid"];
    ?>
"><td><?php 
    echo date("Y-m-d", strtotime($comp['compDate']));
    ?>
</td>
		<td><a onmouseover="colorRow('row<?php 
    echo $comp["tavid"];
    ?>
')" onmouseout="resetRow('row<?php 
    echo $comp["tavid"];
    ?>
 /**
  * Check if the account ID is valid.
  *
  * @return bool|null
  */
 public function has_valid_account_id()
 {
     /* Load the Emma API library. */
     require_once 'includes/api/Emma.php';
     /* Get the plugin settings */
     $settings = $this->get_plugin_settings();
     /* If any of the account information fields are empty, return null. */
     if (rgblank($settings['account_id']) || rgblank($settings['public_api_key']) || rgblank($settings['private_api_key'])) {
         return null;
     }
     $emma = new Emma($settings['account_id'], $settings['public_api_key'], $settings['private_api_key'], false);
     try {
         /* Run test request. */
         $emma->myGroups();
         return true;
     } catch (Exception $e) {
         /* Log that test failed based on HTTP code. */
         if ($e->getHttpCode() == 403) {
             $this->log_error(__METHOD__ . '(): API credentials are valid, Account ID is invalid; ' . $e->getMessage());
         }
         return false;
     }
 }
Example #5
0
<?php

date_default_timezone_set("Europe/Stockholm");
$lang = "sv";
if (isset($_GET['lang'])) {
    $lang = $_GET['lang'];
}
include_once "emmalang_en.php";
include_once "emmalang_{$lang}.php";
include_once "classEmma.class.php";
$currentComp = new Emma($_GET['comp']);
$updTime = "60";
if (isset($_GET['updTime'])) {
    $updTime = $_GET['updTime'];
}
if ($updTime < 15) {
    $updTime = "15";
}
$RunnerStatus = array("1" => $_STATUSDNS, "2" => $_STATUSDNF, "11" => $_STATUSWO, "12" => $_STATUSMOVEDUP, "9" => $_STATUSNOTSTARTED, "0" => $_STATUSOK, "3" => $_STATUSMP, "4" => $_STATUSDSQ, "5" => $_STATUSOT);
$times = array("15" => $_UP15SEK, "30" => $_UP30SEK, "60" => $_UP60SEK, "120" => $_UP120SEK, "-1" => $_UPNEVER);
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title><?php 
echo $_TITLE;
?>
 :: <?php 
echo $currentComp->CompName();
?>
Example #6
0
<?php

include_once "class.emma.php";
$email = strtolower(trim($_GET['email']));
////////////////////////////////////
//send the first time order email
$emma = new Emma();
$emma->SignupPost = "";
//the signup post id from your account
$emma->AccountID = "";
//the numeric account id of your account
$emma->Username = "";
//provided by emma suppport (not your account username)
$emma->Password = "";
//provided by emma suppport (not your account username)
$emma->GroupID = "";
// add them to this group id?
//$emma -> noConfirm();				//uncomment to suppress signup confirmation email
//$emma -> flushGroups();			//uncomment to flush user from all existing groups (if any)
//$emma -> deleteMember();			//uncomment to delete this member
$emma->AddField("emma_member_email", $email);
$emma->AddField("emma_member_name_first", $first_name);
$emma->AddField("emma_member_name_last", $first_name);
$emma->AddField("emma_member_wildcard_{id}", $custom_field);
//custom fields can be stacked also
$emma->AddDateField("emma_member_wildcard_{id}", date('Y'), date('m'), date('d'));
/* format yyyy,mm,dd date fields can be setup too*/
//$emma -> friendlyReturn();			//uncomment for friendly message in place of error code
$emma->Go();
echo "Resp: " . $emma->Resp . " <br>";
Example #7
0
<?php

date_default_timezone_set("Europe/Stockholm");
$lang = "sv";
if (isset($_GET['lang'])) {
    $lang = $_GET['lang'];
}
include_once "templates/emmalang_en.php";
include_once "templates/emmalang_{$lang}.php";
include_once "templates/classEmma.class.php";
header('Content-Type: text/html; charset=' . $CHARSET);
$currentComp = new Emma($_GET['comp']);
$isSingleClass = isset($_GET['class']);
$isSingleClub = isset($_GET['club']);
$showPath = true;
if (isset($_GET['showpath']) && $_GET['showpath'] == "false") {
    $showPath = false;
}
$singleClass = "";
$singleClub = "";
if ($isSingleClass) {
    $singleClass = $_GET['class'];
}
if ($isSingleClub) {
    $singleClub = utf8_decode(rawurldecode($_GET['club']));
}
$showLastPassings = !($isSingleClass || $isSingleClub) || isset($_GET['showLastPassings']) && $_GET['showLastPassings'] == "true";
$RunnerStatus = array("1" => $_STATUSDNS, "2" => $_STATUSDNF, "11" => $_STATUSWO, "12" => $_STATUSMOVEDUP, "9" => $_STATUSNOTSTARTED, "0" => $_STATUSOK, "3" => $_STATUSMP, "4" => $_STATUSDSQ, "5" => $_STATUSOT, "9" => "", "10" => "");
$showTimePrediction = true;
echo "<?xml version=\"1.0\" encoding=\"{$CHARSET}\" ?>\n";
?>
Example #8
0
             <tr>

               <td>
<a href="createComp.php">Create new competition</a><br/>


<h1 class="categoriesheader">Existing competitions</h1>

			<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>Date</td><td>Name</td><td>Organizer</td><td>Public</td><td></td>
</tr>

<?php 
$comps = Emma::GetAllCompetitions();
//echo(sizeof($comps));
//for ($i = 0; $i < sizeof($comps); $i++)
foreach ($comps as $comp) {
    ?>

		<tr id="row<?php 
    echo $comp["tavid"];
    ?>
"><td><?php 
    echo date("Y-m-d", strtotime($comp['compDate']));
    ?>
</td><td><?php 
    echo $comp["compName"];
    ?>
</td><td><?php 
Example #9
0
<input type="checkbox" name="public" <?php 
echo $comp['public'] == 1 ? "checked" : "";
?>
/><br/><br/>
<input type="submit" name="btnSave" value="Save"/>
</form>
<h1 class="categoriesheader">Radio Controls</h1>

<form name="formrdo1" action="editComp.php?what=radio&compid=<?php 
echo $comp['tavid'];
?>
" method="post">
<table border="0">
<tr><td><b>Code</td><td><b>Name</td><td><b>Class</td><td><b>Order</td></tr>
<?php 
$rcontrols = Emma::GetRadioControls($_GET['compid']);
for ($i = 0; $i < sizeof($rcontrols); $i++) {
    echo "<tr><td>" . $rcontrols[$i]["code"] . "</td><td>" . $rcontrols[$i]["name"] . "</td><td>" . $rcontrols[$i]["classname"] . "</td><td>" . $rcontrols[$i]["corder"] . "</td><td><a href='javascript:confirmDelete(\"Do you want to delete this radiocontrol?\",\"?compid=" . $_GET['compid'] . "&what=delctr&compid=" . $_GET['compid'] . "&code=" . $rcontrols[$i]['code'] . "&class=" . urlencode($rcontrols[$i]["classname"]) . "\");'>Delete</a></td></tr>";
}
?>
</table>
<br/><b>Add Radio Control</b><br/>
Code = 1000*passingcnt + controlCode, <br/>
ex. first pass at control 53 => Code = 1053, second pass => Code = 2053<br/>
Code: <input type="text" name="code"/><br/>
Control-Name: <input type="text" name="controlname"/><br/>
ClassName: <input type="text" name="classname"/><br/>
<input type="submit" name="btnAdd" value="Add Control"/>
</form>
		</td>
	     </tr>
Example #10
0
<?php

date_default_timezone_set("Europe/Stockholm");
$lang = "sv";
if (isset($_GET['lang'])) {
    $lang = $_GET['lang'];
}
include_once "templates/emmalang_en.php";
include_once "templates/emmalang_{$lang}.php";
include_once "templates/classEmma.class.php";
$currentComp = new Emma($_GET['comp']);
$isSingleClass = isset($_GET['class']);
$showPath = false;
$singleClass = "";
if ($isSingleClass) {
    $singleClass = $_GET['class'];
}
$showLastPassings = !$isSingleClass || isset($_GET['showLastPassings']) && $_GET['showLastPassings'] == "true";
$RunnerStatus = array("1" => $_STATUSDNS, "2" => $_STATUSDNF, "11" => $_STATUSWO, "12" => $_STATUSMOVEDUP, "9" => $_STATUSNOTSTARTED, "0" => $_STATUSOK, "3" => $_STATUSMP, "4" => $_STATUSDSQ, "5" => $_STATUSOT);
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title><?php 
echo $_TITLE;
?>
 :: <?php 
echo $currentComp->CompName();
?>
 [<?php 
Example #11
0
         if ($modified) {
             $ret .= ",{$br} \"DT_RowClass\": \"new_result\"";
         }
         $ret .= "{$br}}";
         $first = false;
     }
     $hash = MD5($ret);
     if (isset($_GET['last_hash']) && $_GET['last_hash'] == $hash) {
         echo "{ \"status\": \"NOT MODIFIED\"}";
     } else {
         echo "{ \"status\": \"OK\",{$br} \"clubName\": \"" . $club . "\", {$br}\"results\": [{$br}{$ret}{$br}]";
         echo ", {$br} \"hash\": \"" . $hash . "\"}";
     }
 } elseif ($_GET['method'] == 'getclassresults') {
     $class = $_GET['class'];
     $currentComp = new Emma($_GET['comp']);
     $results = $currentComp->getAllSplitsForClass($class);
     $splits = $currentComp->getSplitControlsForClass($class);
     $total = null;
     $retTotal = false;
     if (isset($_GET['includetotal']) && $_GET['includetotal'] == "true") {
         $retTotal = true;
         $total = $currentComp->getTotalResultsForClass($class);
         foreach ($results as $key => $res) {
             $id = $res['DbId'];
             $results[$key]["totaltime"] = $total[$id]["Time"];
             $results[$key]["totalstatus"] = $total[$id]["Status"];
             $results[$key]["totalplace"] = $total[$id]["Place"];
             $results[$key]["totalplus"] = $total[$id]["TotalPlus"];
         }
     }
Example #12
0
    foreach ($classes as $class) {
        if (!$first) {
            $ret .= ",";
        }
        $ret .= "{\"className\": \"" . $class['Class'] . "\"}";
        $first = false;
    }
    $hash = MD5($ret);
    if (isset($_GET['last_hash']) && $_GET['last_hash'] == $hash) {
        echo "{ \"status\": \"NOT MODIFIED\"}";
    } else {
        echo "{ \"status\": \"OK\", \"classes\" : [{$ret}]";
        echo ", \"hash\": \"" . $hash . "\"}";
    }
} elseif ($_GET['method'] == 'getclassresults') {
    $currentComp = new Emma($_GET['comp']);
    $results = $currentComp->getAllSplitsForClass($_GET['class']);
    $splits = $currentComp->getSplitControlsForClass($_GET['class']);
    $ret = "";
    $first = true;
    $place = 1;
    $lastTime = -9999;
    $winnerTime = 0;
    $resultsAsArray = false;
    $unformattedTimes = false;
    if (isset($_GET['resultsAsArray'])) {
        $resultsAsArray = true;
    }
    if (isset($_GET['unformattedTimes']) && $_GET['unformattedTimes'] == "true") {
        $unformattedTimes = true;
    }