function index() { $this->data['pagebody'] = 'homepage'; // get the list of airports that can be flown from $list = array(); // use XML-RPC to get the list $this->load->library('xmlrpc'); $this->xmlrpc->server(RPCSERVER, RPCPORT); $this->xmlrpc->method('since'); $request = array(); $this->xmlrpc->request($request); //$this->xmlrpc->set_debug(true); if (!$this->xmlrpc->send_request()) { echo $this->xmlrpc->display_error(); } $list = $this->xmlrpc->display_response(); //load team model $this->load->model('Teams'); //reset # values to 0 in teams table because we pull //all the data at once $reset = array('wins' => 0, 'losses' => 0, 'points_for' => 0, 'points_against' => 0); //update teams table with above data $this->db->update('teams', $reset); //switch to history model $this->load->model('History'); //pass XMLRPC $list of data to History model $updatedTeams = $this->History->updateGameRecords($list); //Prediction section $label = "Select the opposing team:"; $name = "ddlOpposingTeam"; $value = "NE"; //load all teams to drop down list $options = $this->teams->getAllTeamCodes(); $this->load->helper('formfields'); $this->data['ddlOpposingTeam'] = makeComboField($label, $name, $value, $options); $this->render(); }
function displayPlayer($ID = null, $invalidEntry = false) { $this->session->set_userdata('editPage', '/player/displayPlayer/' . $ID); // If null, we are creating a new player if ($ID === null) { $playerTemp = $this->createPlayer(); // If displayPlayer is being recalled from validation, it is therefore invalid. } else { if ($invalidEntry) { $playerTemp = $this->parsePlayerBuffer(); // Retrieve player from database with ID } else { $playerTemp = $this->loadPlayerFromDb($ID); } } // determine if we're in edit mode if (isset($_SESSION['editMode'])) { $editMode = $this->session->userdata('editMode'); } else { $editMode = FALSE; } $message = ''; if (count($this->errors) > 0) { foreach ($this->errors as $booboo) { $message .= $booboo . "<BR>"; } } $this->data['message'] = $message; // make text fields for each key value pair foreach ($playerTemp as $key => $val) { $this->data[$key] = makeTextField($key, $key, $val, "", 40, 15, !$editMode); } // override previous foreach loop: ID and Photo are not text fields $this->data['ID'] = $playerTemp->ID; $this->data['Photo'] = $playerTemp->Photo; // Get all Codes from standings table and populate dropdown list $this->db->select('Code'); $query = $this->db->get('standings'); foreach ($query->result() as $row) { $codes[] = $row->Code; } $this->session->set_userdata('codes', $codes); $this->data['Code'] = makeComboField('Code', "Code", 24, $codes, "", 40, 15, !$editMode); $this->data['Submit'] = ""; $this->data['Cancel'] = ""; $this->data['Delete'] = ""; // if editMode is set and we're in edit mode, display CRUD controls if (isset($_SESSION['editMode']) && $this->session->userdata('editMode')) { $this->data['Submit'] = makeSubmitButton('Save', "Save", 'btn-success'); $this->data['Cancel'] = makeCancelButton('Cancel', "Cancel", 'btn-primary'); $this->data['Delete'] = makeDeleteButton('Delete', "Delete", 'btn-danger', $ID); } $this->data['pagebody'] = 'player'; $this->render(); }