本文整理汇总了PHP中logtrace函数的典型用法代码示例。如果您正苦于以下问题:PHP logtrace函数的具体用法?PHP logtrace怎么用?PHP logtrace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logtrace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateTournament
public function CreateTournament($request)
{
$mundane_id = Ork3::$Lib->authorization->IsAuthorized($request['Token']);
if (!valid_id($mundane_id)) {
return NoAuthorization();
}
logtrace("CreateTournament() :1", $request);
$this->Tournament->clear();
$this->Tournament->kingdom_id = $request['KingdomId'];
$this->Tournament->park_id = $request['ParkId'];
$this->Tournament->event_calendardetail_id = $request['EventCalendarDetailId'];
$detail = new yapo($this->db, DB_PREFIX . 'event_calendardetail');
$detail->event_calendardetail_id = $request['EventCalendarDetailId'];
if ($detail->find()) {
$this->Tournament->event_id = $detail->event_id;
} else {
if (valid_id($request['EventCalendarDetailId'])) {
return InvalidParameter();
}
}
$this->Tournament->name = $request['Name'];
$this->Tournament->description = strip_tags($request['Description'], "<p><br><ul><li><b><i>");
$this->Tournament->date_time = $request['When'];
$this->Tournament->save();
return Success($this->Tournament->tournament_id);
}
示例2: index
public function index($principality_id = null)
{
$this->load_model('Reports');
$this->data['park_summary'] = $this->Principality->get_park_summary($principality_id);
$this->data['event_summary'] = $this->Principality->get_kingdom_events($principality_id);
$this->data['principality_info'] = $this->Principality->get_principality_shortinfo($principality_id);
$this->data['kingdom_tournaments'] = $this->Reports->get_tournaments(null, $principality_id);
logtrace("index({$kingdom_id} = null)", $this->data['kingdom_tournaments']);
}
示例3: Geocode
public static function Geocode($address, $city, $state, $postal_code, $geocode = null)
{
logtrace("Geocode", [$address, $city, $state, $postal_code, $geocode]);
if (strlen($geocode) > 0) {
$latlng = urlencode(str_replace(' ', '', $geocode));
$geocodeURL = signUrl("http://maps.googleapis.com/maps/api/geocode/json?latlng={$latlng}&sensor=false", GOOGLE_MAPS_API_KEY);
} else {
$address = urlencode($address . ', ' . $city . ', ' . $state . ', ' . $postal_code);
$geocodeURL = signUrl("http://maps.googleapis.com/maps/api/geocode/json?address={$address}&sensor=false", GOOGLE_MAPS_API_KEY);
}
$ch = curl_init($geocodeURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$details = [];
logtrace("Geocode: Processing.", null);
if ($httpCode == 200) {
$geocode = json_decode($result);
logtrace("Geocode: Processing.", $geocode);
$lat = $geocode->results[0]->geometry->location->lat;
$lng = $geocode->results[0]->geometry->location->lng;
$formatted_address = $geocode->results[0]->formatted_address;
$details['Address'] = $formatted_address;
$geo_status = $geocode->status;
$location_type = $geocode->results[0]->geometry->location_type;
$details['Geocode'] = $result;
$details['Location'] = json_encode($geocode->results[0]->geometry);
if (is_array($geocode->results[0]->address_components)) {
foreach ($geocode->results[0]->address_components as $k => $component) {
switch ($component->types[0]) {
case 'locality':
if ($component->types[1] == 'political') {
$details['City'] = $component->long_name;
}
break;
case 'administrative_area_level_1':
if ($component->types[1] == 'political') {
$details['Province'] = $component->long_name;
}
break;
case 'postal_code':
$details['PostalCode'] = $component->long_name;
break;
}
}
}
logtrace("Geocode: Details.", $details);
return $details;
} else {
logtrace("Geocode: failed.", []);
return false;
}
}
示例4: view
public function view()
{
$V = null;
if (is_null($this->view)) {
logtrace("Controller: view(): {$this->template}, " . $this->controller_class() . ", {$this->method}, {$this->action}", null);
$V = new View($this->template, $this->controller_class(), $this->method, $this->action);
$V->__setttings = $this->settings;
} else {
logtrace("Controller: view(): {$this->template}, " . $this->controller_class() . ", {$this->method}, {$this->action}", null);
$V = new View($this->template, $this->controller_class(), $this->method, $this->action);
$V->__setttings = $this->settings;
}
logtrace("Controller view(): data, {$this->kingdom}", $this->data);
$CONTENT = $V->view($this->data, $this->kingdom);
return $CONTENT;
}
示例5: del_unit_auth
function del_unit_auth($request)
{
logtrace("del_unit_auth()", $request);
$this->Authorization->RemoveAuthorization($request);
}
示例6: __construct
function __construct()
{
logtrace('Settings', $this);
}
示例7: IsAuthorized
public function IsAuthorized($token)
{
logtrace("IsAuthorized({$token})", null);
if ($this->IsLocalCall() || true) {
$response = $this->IsAuthorized_h($token);
} else {
$response = $this->IsAuthorized_app($token);
}
logtrace("Authorization():", $response);
return $response;
}
示例8: event
public function event($p)
{
$params = explode('/', $p);
$event_id = $params[0];
$detail_id = $params[1];
if (count($params) > 2) {
$action = $params[2];
}
if (count($params) > 3) {
$del_id = $params[3];
}
$this->data['DetailId'] = $detail_id;
$this->data['EventId'] = $event_id;
$this->data['Id'] = $event_id;
// Legacy reference ... christ
$this->data['DefaultAttendanceCredits'] = 1;
$this->data['DefaultParkName'] = $this->session->park_name;
$this->data['DefaultParkId'] = $this->session->park_id;
$this->data['DefaultKingdomName'] = $this->session->kingdom_name;
$this->data['DefaultKingdomId'] = $this->session->kingdom_id;
if (strlen($action) > 0) {
$this->request->save('Attendance_event', true);
$r = array('Status' => 0);
if (!isset($this->session->user_id)) {
//header( 'Location: '.UIR."Login/login/Attendance/event/$event_id/$detail_id" );
} else {
switch ($action) {
case 'new':
$r = $this->Attendance->add_attendance($this->session->token, $this->request->Attendance_event->AttendanceDate, null, $detail_id, $this->request->Attendance_event->MundaneId, $this->request->Attendance_event->ClassId, $this->request->Attendance_event->Credits);
break;
case 'delete':
$r = $this->Attendance->delete_attendance($this->session->token, $del_id);
break;
}
if ($r['Status'] == 0) {
$this->data['AttendanceDate'] = $this->request->Attendance_event->AttendanceDate;
$this->data['DefaultParkName'] = $this->request->Attendance_event->ParkName;
$this->data['DefaultParkId'] = $this->request->Attendance_event->ParkId;
$this->data['DefaultKingdomName'] = $this->request->Attendance_event->KingdomName;
$this->data['DefaultKingdomId'] = $this->request->Attendance_event->KingdomId;
$this->data['DefaultAttendanceCredits'] = $this->request->Attendance_event->Credits;
$this->request->clear('Attendance_event');
} else {
if ($r['Status'] == 5) {
//header( 'Location: '.UIR."Login/login/Attendance/event/$event_id/$detail_id" );
} else {
$this->data['Error'] = $r['Error'] . ':<p>' . $r['Detail'];
}
}
}
}
$this->data['EventDetailInfo'] = $this->Attendance->get_eventdetail_info($detail_id);
$this->data['EventInfo'] = $this->Attendance->get_event_info($event_id);
logtrace('Attendance->event()', array($params, $this->request));
$this->data['AttendanceReport'] = $this->Attendance->get_attendance_for_event($event_id, $detail_id);
if ($this->request->exists('Attendance_event')) {
$this->data['Attendance_event'] = $this->request->Attendance_event->Request;
}
$this->data['Classes'] = $this->Attendance->get_classes();
if ($this->data['Classes']['Status']['Status'] != 0) {
$this->data['Error'] = $this->data['Classes']['Status']['Error'];
}
}
示例9: create_park
function create_park($request)
{
logtrace("create_park", $request);
$r = $this->Park->CreatePark($request);
return $r;
}
示例10: logtrace
logtrace("Index: Route(2): {$class}({$call})", null);
$C = new $class($call);
$C->{$call}();
} else {
if (count($route) == 3) {
logtrace("Index: Route(3): {$class}({$call},{$action})", null);
$C = new $class($call, $action);
$C->{$call}($action);
} else {
if (count($route) > 3) {
$action = implode('/', array_slice($route, 2));
logtrace("Index: Route(3+): {$class}({$call},{$action})", null);
$C = new $class($call, $action);
$C->{$call}($action);
}
}
}
}
} else {
$C = new Controller("index");
$C->index();
}
Ork3::$Lib->session->times['Route Complete'] = time();
$CONTENT = $C->view();
Ork3::$Lib->session->times['Composite'] = time();
echo $CONTENT;
logtrace("Timing Information", Ork3::$Lib->session->times);
if (DUMPTRACE) {
logtrace('Session', $_SESSION);
dumplogtrace();
}
示例11: SetParkDetails
public function SetParkDetails($request)
{
logtrace("SetParkDetails", $request);
$response = array();
$this->park->clear();
if (trimlen($request['Name']) > 0) {
$this->park->name = trim($request['Name']);
if ($this->park->find()) {
if ($this->park->park_id != $request['ParkId']) {
return InvalidParameter('This park name already exists.');
}
}
}
$this->park->clear();
$this->park->park_id = $request['ParkId'];
if ($this->park->find()) {
if (($mundane_id = Ork3::$Lib->authorization->IsAuthorized($request['Token'])) > 0 && Ork3::$Lib->authorization->HasAuthority($mundane_id, AUTH_PARK, $request['ParkId'], AUTH_EDIT)) {
$this->log->Write('Park', $mundane_id, LOG_EDIT, $request);
$this->park->modified = date("Y-m-d H:i:s", time());
if (Ork3::$Lib->authorization->HasAuthority($mundane_id, AUTH_KINGDOM, $this->park->kingdom_id, AUTH_EDIT)) {
$this->park->name = trimlen($request['Name']) == 0 ? $this->park->name : $request['Name'];
$this->park->abbreviation = trimlen($request['Abbreviation']) == 0 ? $this->park->abbreviation : $request['Abbreviation'];
$parktitle = new yapo($this->db, DB_PREFIX . 'parktitle');
$parktitle->clear();
if (isset($request['ParkTitleId']) && $request['ParkTitleId'] != $this->park->parktitle_id) {
$parktitle->parktitle_id = $request['ParkTitleId'];
if ($parktitle->find()) {
$this->park->parktitle_id = $request['ParkTitleId'];
}
}
$this->park->active = trimlen($request['Active']) == 0 ? $this->park->active : $request['Active'];
}
$address_change = false;
if (isset($request['Address']) && ($this->park->address != $request['Address'] || trimlen($this->park->location) == 0)) {
$address_change = true;
}
$this->park->url = isset($request['Url']) ? $request['Url'] : $this->park->url;
$this->park->address = isset($request['Address']) ? $request['Address'] : $this->park->address;
$this->park->city = isset($request['City']) ? $request['City'] : $this->park->city;
$this->park->province = isset($request['Province']) ? $request['Province'] : $this->park->province;
$this->park->postal_code = isset($request['PostalCode']) ? $request['PostalCode'] : $this->park->postal_code;
$this->park->directions = isset($request['Directions']) ? $request['Directions'] : $this->park->directions;
$this->park->description = isset($request['Description']) ? $request['Description'] : $this->park->description;
$this->park->map_url = isset($request['MapUrl']) ? $request['MapUrl'] : $this->park->map_url;
$this->park->save();
$this->park->clear();
$this->park->park_id = $request['ParkId'];
if ($this->park->find()) {
if ($address_change) {
if (isset($request['GeoCode']) && trimlen($request['GeoCode']) > 0) {
$this->park_geocode_h($request['GeoCode']);
} else {
$this->park_geocode_h();
}
}
$response = Success();
if ($request['KingdomId'] > 0 && $this->park->kingdom_id != $request['KingdomId']) {
// Seriously? You couldn't work it out somehow?
// AKA Blackspire Code, AKA Golden Plains Exception
if (Ork3::$Lib->authorization->HasAuthority($mundane_id, AUTH_ADMIN, $request['KingdomId'], AUTH_ADMIN)) {
$this->park->kingdom_id = $request['KingdomId'];
} else {
$response = Warning('You do not have permissions to move this Park [' . $this->park->park_id . ', ' . $this->park->kingdom_id . '] to another Kingdom [' . $request['KingdomId'] . '].');
}
}
if (strlen($request['Heraldry'])) {
Ork3::$Lib->heraldry->SetParkHeraldry($request);
}
$this->park->save();
$response = Success($this->park->park_id);
} else {
$response = InvalidParameter('ParkId could not be found.');
}
} else {
$response = NoAuthorization('You do not have permissions to perform this action: ' . $mundane_id);
}
} else {
$response = InvalidParameter('ParkId could not be found.');
}
return $response;
}
示例12: RemoveAward
public function RemoveAward($request)
{
logtrace("RemoveAward()", $request);
$mundane_id = Ork3::$Lib->authorization->IsAuthorized($request['Token']);
$awards = new yapo($this->db, DB_PREFIX . 'awards');
$awards->clear();
$awards->awards_id = $request['AwardsId'];
if (valid_id($request['AwardsId']) && $awards->find()) {
$mundane = $this->player_info($awards->mundane_id);
if (valid_id($mundane_id) && Ork3::$Lib->authorization->HasAuthority($mundane_id, AUTH_PARK, $mundane['ParkId'], AUTH_EDIT)) {
$awards->delete();
} else {
return NoAuthorization();
}
} else {
return InvalidParameter();
}
}
示例13: GetActivePlayers
public function GetActivePlayers($request)
{
if (strlen($request['MinimumWeeklyAttendance']) == 0) {
$request['MinimumWeeklyAttendance'] = 0;
}
if (strlen($request['MinimumDailyAttendance']) == 0) {
$request['MinimumDailyAttendance'] = 6;
}
if (strlen($request['MonthlyCreditMaximum']) == 0) {
$request['MonthlyCreditMaximum'] = 6;
}
if (strlen($request['MinimumCredits']) == 0) {
$request['MinimumCredits'] = 9;
}
if (strlen($request['PerWeeks']) == 0 && strlen($request['PerMonths']) == 0) {
$request['PerMonths'] = 6;
}
if (strlen($request['ReportFromDate']) == 0) {
$request['ReportFromDate'] = 'curdate()';
}
if (strlen($request['PerWeeks']) > 0) {
$per_period = mysql_real_escape_string($request['PerWeeks']) . ' week';
} else {
$per_period = mysql_real_escape_string($request['PerMonths']) . ' month';
}
if (valid_id($request['ParkId'])) {
$location = " and m.park_id = '" . mysql_real_escape_string($request['ParkId']) . "'";
$duesclause = "a.park_id = '" . mysql_real_escape_string($request['ParkId']) . "'";
if (valid_id($request['ByLocalPark'])) {
$park_comparator = " and a.park_id = '" . mysql_real_escape_string($request['ParkId']) . "' ";
}
} else {
if (strlen($request['KingdomId']) > 0 && $request['KingdomId'] > 0) {
$location = " and m.kingdom_id = '" . mysql_real_escape_string($request['KingdomId']) . "'";
$duesclause = "a.kingdom_id = '" . mysql_real_escape_string($request['KingdomId']) . "'";
if (valid_id($request['ByKingdom'])) {
$park_list = Ork3::$Lib->Kingdom->GetParks($request);
$parks = array();
foreach ($park_list['Parks'] as $p => $park) {
$parks[] = $p['ParkId'];
}
$park_comparator = " and a.park_id in (" . implode($parks) . ") ";
}
} else {
$park_comparator = "";
}
}
if ($request['KingdomId'] > 0 || $request['ParkId'] > 0) {
if ($request['DuesPaid']) {
$has_dues = "and s.is_dues = 1";
}
$duespaid_clause = "\n\t\t\t\t\tleft join \n\t\t\t\t\t\t(select distinct case split_id when null then 0 else 1 end as split_id, src_mundane_id \n\t\t\t\t\t\t\tfrom " . DB_PREFIX . "split s \n\t\t\t\t\t\t\tleft join " . DB_PREFIX . "account a on s.account_id = a.account_id \n\t\t\t\t\t\t\t\tand {$duesclause}\n\t\t\t\t\t\t\t\t{$has_dues}\n\t\t\t\t\t\t\twhere s.dues_through > curdate()) dues on attendance_summary.mundane_id = dues.src_mundane_id\n\t\t\t";
$duespaid_field = ',
ifnull(split_id,0) as duespaid';
$duespaid_order = 'duespaid desc, ';
}
if (trimlen($request['Peerage']) > 0) {
$peerage = "\n left join\n (select distinct awards.mundane_id, award.peerage \n from " . DB_PREFIX . "awards awards\n left join " . DB_PREFIX . "kingdomaward ka on ka.kingdomaward_id = awards.kingdomaward_id\n left join " . DB_PREFIX . "award award on ka.award_id = award.award_id\n left join " . DB_PREFIX . "mundane m on awards.mundane_id = m.mundane_id\n where award.peerage = '" . mysql_real_escape_string($request['Peerage']) . "' and awards.mundane_id > 0 {$location}\n group by awards.mundane_id\n ) peers on attendance_summary.mundane_id = peers.mundane_id\n ";
$peerage_clause = "and peers.peerage = '" . mysql_real_escape_string($request['Peerage']) . "'";
$peer_field = 'peers.peerage, ';
}
if ($request['Waivered']) {
$waiver_clause = ' and m.waivered = 1';
} else {
if ($request['UnWaivered']) {
$waiver_clause = ' and m.waivered = 0';
}
}
$sql = "\n select main_summary.*, total_monthly_credits, credit_counts.daily_credits, credit_counts.rop_limited_credits\n from\n (select \n \t\t\t\t\t\t{$peer_field} count(week) as weeks_attended, sum(weekly_attendance) as park_days_attended, sum(daily_attendance) as days_attended, sum(credits_earned) total_credits, attendance_summary.mundane_id, \n \t\t\t\t\t\t\tmundane.persona, kingdom.kingdom_id, park.park_id, kingdom.name kingdom_name, kingdom.parent_kingdom_id, park.name park_name, attendance_summary.waivered {$duespaid_field}\n \t\t\t\t\tfrom\n \t\t\t\t\t\t(select \n \t\t\t\t\t\t\t\ta.park_id > 0 as weekly_attendance, count(a.park_id > 0) as daily_attendance, a.mundane_id, \n week(a.date,3) as week, year(a.date) as year, a.kingdom_id, a.park_id, max(credits) as credits_earned, m.waivered \n \t\t\t\t\t\t\tfrom " . DB_PREFIX . "attendance a\n \t\t\t\t\t\t\t\tleft join " . DB_PREFIX . "mundane m on a.mundane_id = m.mundane_id\n \t\t\t\t\t\t\twhere \n date > adddate(curdate(), interval -{$per_period}) {$park_comparator} {$location} {$waiver_clause}\n \t\t\t\t\t\t\tgroup by week(date,3), year(date), mundane_id) attendance_summary \n \t\t\t\t\tleft join " . DB_PREFIX . "mundane mundane on mundane.mundane_id = attendance_summary.mundane_id\n \t\t\t\t\t\tleft join " . DB_PREFIX . "kingdom kingdom on kingdom.kingdom_id = mundane.kingdom_id\n \t\t\t\t\t\tleft join " . DB_PREFIX . "park park on park.park_id = mundane.park_id\n \t\t\t\t\t{$duespaid_clause}\n {$peerage}\n \t\t\t\t\tgroup by mundane_id\n \t\t\t\t\thaving\n \t\t\t\t\t\tweeks_attended >= '" . mysql_real_escape_string($request['MinimumWeeklyAttendance']) . "'\n and days_attended >= '" . mysql_real_escape_string($request['MinimumDailyAttendance']) . "'\n and total_credits >= '" . mysql_real_escape_string($request['MinimumCredits']) . "'\n {$peerage_clause}\n \t\t\t\t\torder by {$duespaid_order} kingdom_name, park_name, persona) main_summary\n left join\n (select mundane_id, sum(monthly_credits) as total_monthly_credits\n from\n (select \n \t\t\t\t\t\t\tleast(sum(credits), " . mysql_real_escape_string($request['MonthlyCreditMaximum']) . ") as monthly_credits, a.mundane_id\n \t\t\t\t\t\t\tfrom ork_attendance a\n \t\t\t\t\t\t\t\tleft join ork_mundane m on a.mundane_id = m.mundane_id\n \t\t\t\t\t\t\twhere \n date > adddate(curdate(), interval -{$per_period}) {$location} {$waiver_clause}\n \t\t\t\t\t\t\tgroup by month(date), year(date), mundane_id) monthly_list\n group by monthly_list.mundane_id) monthly_summary on main_summary.mundane_id = monthly_summary.mundane_id\n left join\n (select mundane_id, sum(daily_credits) as daily_credits, sum(rop_limited_credits) as rop_limited_credits\n from \n (select least(" . mysql_real_escape_string($request['MonthlyCreditMaximum']) . ", sum(daily_credits)) as daily_credits, least(" . mysql_real_escape_string($request['MonthlyCreditMaximum']) . ", sum(rop_credits)) rop_limited_credits, mundane_id\n from\n (select \n \t\t\t\t\t\t\tmax(credits) as daily_credits, 1 as rop_credits, a.mundane_id, a.date\n \t\t\t\t\t\t\tfrom ork_attendance a\n \t\t\t\t\t\t\t\tleft join ork_mundane m on a.mundane_id = m.mundane_id\n \t\t\t\t\t\t\twhere \n date > adddate(curdate(), interval -{$per_period}) {$location} {$waiver_clause}\n \t\t\t\t\t\t\tgroup by dayofyear(date), year(date), mundane_id) credit_list_source\n \t\t\t\t\t group by mundane_id, month(`date`)) credit_list\n group by credit_list.mundane_id) credit_counts on main_summary.mundane_id = credit_counts.mundane_id\n\t\t\t\t\t";
// For last join, need to limit monthly credits to monthly credit maximum per kingdom config
logtrace('Report: GetActivePlayers', array($request, $sql));
$r = $this->db->query($sql);
$report = array();
if ($r !== false && $r->size() > 0) {
do {
$report[] = array('KingdomName' => $r->kingdom_name, 'KingdomId' => $r->kingdom_id, 'ParentKingdomId' => $r->parent_kingodm_id, 'ParkName' => $r->park_name, 'ParkId' => $r->park_id, 'Persona' => $r->persona, 'MundaneId' => $r->mundane_id, 'TotalCredits' => $r->total_credits, 'TotalMonthlyCredits' => $r->total_monthly_credits, 'WeeksAttended' => $r->weeks_attended, 'ParkDaysAttended' => $r->park_days_attended, 'DaysAttended' => $r->days_attended, 'DailyCredits' => $r->daily_credits, 'RopLimitedCredits' => $r->rop_limited_credits, 'DuesPaid' => $r->duespaid, 'Waivered' => $r->waivered);
} while ($r->next());
}
$response = array('Status' => Success(), 'ActivePlayerSummary' => $report);
return $response;
}
示例14: get_event_info
function get_event_info($event_id)
{
$r = $this->Search->Event(null, null, null, null, null, null, $event_id);
logtrace("get_event_info({$event_id})", $r);
return $r;
}
示例15: createpark
public function createpark($params = null)
{
$params = explode('/', $params);
if ('submit' == $params[0]) {
$post = 'submit';
$this->data['KingdomId'] = $this->session->kingdom_id;
} else {
if ('park' == $params[0]) {
$park_id = $params[1];
$this->data['ParkId'] = $park_id;
$this->data['KingdomId'] = $this->session->kingdom_id;
} else {
if ('kingdom' == $params[0]) {
$kingdom_id = $params[1];
$this->data['KingdomId'] = $kingdom_id;
}
}
}
logtrace('createpark', $params);
if (strlen($post) > 0) {
$this->request->save('Admin_createpark', true);
if (!isset($this->session->user_id)) {
header('Location: ' . UIR . 'Login/login/Admin/createpark' . ($post != null ? '/' . $post : ''));
} else {
if (trimlen($this->request->Admin_createpark->Name) == 0) {
$this->data['Error'] = "Park must have a name.";
} else {
if (trimlen($this->request->Admin_createpark->Abbreviation) == 0) {
$this->data['Error'] = "Park must have an abbreviation.";
} else {
if (!valid_id($this->request->Admin_createpark->kingdom_id)) {
$this->data['Error'] = "Somehow, a Kingdom was not selected. Good luck with that.";
} else {
if (!valid_id($this->request->Admin_createpark->ParkTitleId)) {
$this->data['Error'] = "Parks must have a title.";
} else {
$r = $this->Park->create_park(['Token' => $this->session->token, 'Name' => $this->request->Admin_createpark->Name, 'Abbreviation' => $this->request->Admin_createpark->Abbreviation, 'KingdomId' => $this->session->kingdom_id, 'ParkTitleId' => $this->request->Admin_createpark->ParkTitleId]);
if ($r['Status'] == 0) {
$this->request->clear('Admin_createpark');
//header( 'Location: '.UIR.'Park/index/'.$r['Detail'] );
} else {
if ($r['Status'] == 5) {
header('Location: ' . UIR . 'Login/login/Admin/createpark' . ($post != null ? '/' . $post : ''));
} else {
$this->data['Error'] = $r['Error'] . ':<p>' . $r['Detail'];
}
}
}
}
}
}
}
}
$this->data['ParkTitleId_options'] = [];
$r = $this->Kingdom->get_kingdom_details($this->session->kingdom_id);
foreach ($r['ParkTitles'] as $key => $detail) {
$this->data['ParkTitleId_options'][$detail['ParkTitleId']] = $detail['Title'];
}
if ($this->request->exists('Admin_createpark')) {
$this->data['Admin_createpark'] = $this->request->Admin_createpark->Request;
}
}