/** * the controller to save updates to inhabitant data * * @depends test_inhabitant_dialog_edit */ public function test_save_updates_to_inhabitant() { // get an inhabitantID to test with $inhabitant = ms('inhabitant', 'name', 'bob'); // get a planetID to test with $planet = reset(get_models('planet')); $params = array('planetID' => $planet->getID(), 'inhabitantID' => $inhabitant->getID(), 'name' => 'bob_has_a_new_name'); dispatch_controller('inhabitant/save_inhabitant', $params); // assert we got the correct URI $this->assertViewURI('json/success'); }
public function inhabitant_dialog(array $params) { $tpl_vars = array(); $planets = get_models('planet'); $tpl_vars['planets'] = toArray($planets); // are we editing an existing inhabitant if ($inhabitantID = array_val($params, 'inhabitantID')) { $inhabitant = m('inhabitant', $inhabitantID); $tpl_vars['inhabitantID'] = $inhabitant->getID(); $tpl_vars['name'] = $inhabitant->get_name(); $tpl_vars['inhabitant_planet'] = $inhabitant->get_planet()->toArray(); } v('partial/inhabitant/inhabitant_form', $tpl_vars); }
mysqli_stmt_execute($stmt); mysqli_stmt_close($stmt); } BD::desconectar();*/ exit; break; case "generate-cache": // generate_cache(true); exit; break; } } else { $actions_opt_list = array('get-models'); if (in_array($action_opt, $actions_opt_list)) { switch ($action_opt) { case 'get-models': if (isset($_GET['pct'])) { $marca = !empty($_GET['marca']) ? filter_input(INPUT_GET, 'marca', FILTER_SANITIZE_STRING) : ''; $prefijo_categoria = filter_input(INPUT_GET, 'pct', FILTER_SANITIZE_STRING); $grupo = !empty($_GET['grupo']) ? filter_input(INPUT_GET, 'grupo', FILTER_SANITIZE_STRING) : ''; $str = get_models($prefijo_categoria, $marca, $grupo); echo $str; } break; default: break; } } else { exit; } }
$make_id = set_value('make_id', $car['make_id']); echo form_dropdown('make_id', get_makes(), $make_id); ?> <?php echo form_error('make_id', '<span class="error_text">', '</span>'); ?> </div> </div> <div class="basic-grey"> <div class="left"> <label>Model</label> </div> <div class="right"> <?php echo form_dropdown('model_id', get_models($make_id, false), set_value('model_id', $car['model_id'])); ?> <?php echo form_error('model_id', '<span class="error_text">', '</span>'); ?> </div> </div> <div class="basic-grey"> <div class="left"> <label>Comfort</label> </div> <div class="right"> <?php echo form_dropdown('comfort_id', get_comforts($make_id), set_value('comfort_id', $car['comfort_id']));
<div class="row"> <div class="col-md-3 col-sm-4"> <!-- left sec --> <div class="left-sec"> <div class="left-cont"> <h6><span class="glyphicon glyphicon-search"></span> Refine Search</h6> <form class="filter-sec" id="facets"> <select name="make" class="form-control"> <option value="">Make</option> <?php $result = get_models(); foreach ($result as $m) { ?> <option value="<?php echo $m['make']; ?> "><?php echo $m['make']; ?> </option> <?php } ?> </select> <h5>Condition:</h5>
?> </div> <div class="inner_cont"> <h1 style="margin-top:0px;">Your car details</h1> <?php if (count($cars)) { ?> <table> <tbody> <?php $makes = get_makes(); $models = get_models(); $types = get_types(); foreach ($cars as $car) { $img = $car['img_name'] ? 'assets/uploads/cars/' . $car['img_name'] : 'assets/frontend/images/car.png'; $btnText = $car['img_name'] ? 'Click here to Change Photo' : 'Upload Photo'; $details = '<p>'; $details .= $makes[$car['make_id']] . ' ' . $models[$car['make_id']][$car['model_id']]; $details .= '<br/>' . $car['seat_count'] . ' seats'; $details .= '<br/><a href="' . site_url('dashboard/profile/car/edit/' . $car['id']) . '"><img src="' . include_img_path() . '/edit.png" width="15px"></a>'; $details .= ' <a href="' . site_url('dashboard/profile/car/delete/' . $car['id']) . '"><img src="' . include_img_path() . '/del.png" width="15px"></a>'; echo '<tr>'; echo '<td> <img width="120px" id="car-' . $car['id'] . '" src="' . base_url($img) . '" /></td>'; echo '<td>' . $details . '</td>'; echo '</tr>'; echo '<tr>'; echo ' <td colspan="2">
public function profile($type = 'general') { $this->data['type'] = $type; $this->data['tmenu'] = $this->load->view('frontend/_partials/top-menu', $this->data, TRUE); $this->data['smenu'] = $this->load->view('frontend/_partials/profile-left-menu', $this->data, TRUE); switch ($type) { case 'general': $this->form_validation->set_rules($this->get_rules($type)); $this->data['general'] = $this->user_model->get_where(array('id' => $this->user_id))->row_array(); if ($this->form_validation->run()) { $form = $this->input->post(); $insert = array(); $insert['gender'] = $form['gender']; $insert['first_name'] = $form['first_name']; $insert['last_name'] = $form['last_name']; $insert['email'] = $form['email']; $insert['phone'] = $form['phone']; $insert['dob'] = $form['dob']; $insert['bio'] = $form['bio']; $this->user_model->update(array('id' => $this->user_id), $insert); $this->service_message->set_message('custom_message_success', 'Updated successfully.'); } break; case 'picture': $this->layout->add_javascripts(array('SimpleAjaxUploader')); $this->init_scripts = array('frontend/dashboard/ajax_uploader_script'); $this->data['general'] = $this->user_model->get_where(array('id' => $this->user_id))->row_array(); break; case 'address': $this->data['general'] = $this->user_model->get_where(array('id' => $this->user_id))->row_array(); $address = array(); $address['user_id'] = $this->user_id; $address['first_name'] = $this->data['general']['first_name']; $address['last_name'] = $this->data['general']['last_name']; $address['address_1'] = ''; $address['address_2'] = ''; $address['zip'] = ''; $address['city'] = ''; $address['country'] = 'HK'; $result = $this->user_model->get_address_by_user_id($this->user_id); if (count($result)) { $address = $result; } $this->data['address'] = $address; $this->form_validation->set_rules($this->get_rules($type)); if ($this->form_validation->run()) { $form = $this->input->post(); $insert = array(); $insert['first_name'] = $form['first_name']; $insert['last_name'] = $form['last_name']; $insert['address_1'] = $form['address_1']; $insert['address_2'] = $form['address_2']; $insert['zip'] = $form['zip']; $insert['city'] = $form['city']; $insert['country'] = $form['country']; $insert['user_id'] = $this->user_id; if (isset($address['id']) && $address['id']) { $this->user_model->update(array('user_id' => $this->user_id), $insert, 'address'); } else { $this->user_model->insert($insert, 'address'); } $this->service_message->set_message('custom_message_success', 'Updated successfully.'); } break; case 'preferences': $form = $this->input->post(); $insert = array(); $insert['user_id'] = $this->user_id; $insert['chattiness'] = $form['chattiness']; $insert['smoking'] = $form['smoking']; $insert['pets'] = $form['pets']; $insert['music'] = $form['music']; $result = $this->user_model->get_where(array('user_id' => $this->user_id), '*', 'preferences')->row_array(); if (is_array($result) && $result) { $this->user_model->update(array('user_id' => $this->user_id), $insert, 'preferences'); } else { $this->user_model->insert($insert, 'preferences'); } $this->service_message->set_message('custom_message_success', 'Updated successfully.'); break; case 'car': $this->layout->add_javascripts(array('SimpleAjaxUploader')); $action = $this->uri->segment(4, 'list'); switch ($action) { case 'list': $type = 'car_list'; $cars = $this->car_model->get_cars(); $this->data['cars'] = $cars; break; case 'add': case 'edit': $type = 'car_add'; $car = array(); $car['make_id'] = '1'; $car['model_id'] = ''; $car['comfort_id'] = '1'; $car['colour_id'] = '1'; $car['type_id'] = '1'; $car['seat_count'] = ''; $car_id = $this->uri->segment(5, 0); if ($car_id) { $car = $this->car_model->get_where(array('id' => $car_id))->row_array(); } $this->data['car'] = $car; $this->form_validation->set_rules($this->get_rules($type)); if ($this->form_validation->run()) { $form = $this->input->post(); $insert = array(); $insert['make_id'] = $form['make_id']; $insert['model_id'] = $form['model_id']; $insert['comfort_id'] = $form['comfort_id']; $insert['colour_id'] = $form['colour_id']; $insert['type_id'] = $form['type_id']; $insert['seat_count'] = $form['seat_count']; $insert['user_id'] = $this->user_id; if ($car_id) { $this->car_model->update(array('id' => $car_id), $insert); } else { $this->car_model->insert($insert); } $this->service_message->set_flash_message('custom_message_success', 'Updated successfully.'); redirect('dashboard/profile/car'); } break; case 'delete': $car_id = $this->uri->segment(5, 0); $this->car_model->delete(array('id' => $car_id)); //echo $this->db->last_query();die; redirect('dashboard/profile/car'); break; case 'get_models': $make_id = $this->uri->segment(5, 0); $models = get_models($make_id, false); $content = array(); foreach ($models as $key => $val) { $content[] = array('id' => $key, 'value' => $val); } echo json_encode(array('content' => $content)); die; default: # code... break; } break; case 'change_password': $this->data['general'] = $this->user_model->get_where(array('id' => $this->user_id))->row_array(); $this->form_validation->set_rules($this->get_rules($type)); if ($this->form_validation->run()) { $form = $this->input->post(); $insert = array(); $insert['password'] = $form['password']; $this->user_model->update(array('id' => $this->user_id), $insert); $this->service_message->set_message('custom_message_success', 'Updated successfully.'); } break; default: # code... break; } $this->layout->view('frontend/dashboard/' . $type); }
} // what site is earth $earth = 1118; // some constants for met formats, this is a list of all models that // implement a CF to model code, with the appropriate output format. $met = array('ED2' => 12, 'SIPNET' => 24, 'CF' => 33, 'DALEC' => 1000000002, 'LINKAGES' => 1000000003, 'MAESPA' => 1000000016, 'LPJGUESS' => 1000000017); $host = isset($_REQUEST['host']) ? $_REQUEST['host'] : ""; $model = isset($_REQUEST['model']) ? $_REQUEST['model'] : ""; $sitegroup = isset($_REQUEST['sitegroup']) ? $_REQUEST['sitegroup'] : ""; // Start XML file, create parent node $dom = new DOMDocument("1.0"); $dom->formatOutput = true; $root = $dom->appendChild($dom->createElement("info")); // get information get_hosts(); get_models(); get_sites(); echo $dom->saveXML(); close_database(); // ---------------------------------------------------------------------- // SITES // ---------------------------------------------------------------------- function get_hosts() { global $pdo, $dom, $root, $hostlist; global $model; $parnode = $root->appendChild($dom->createElement("hosts")); // check for hosts $query = "SELECT machines.* FROM machines"; $subs = array(); if ($model) {
<?php require_once "bd.php"; require_once "model.php"; $link = db_connect(); $m_id = $_POST['m']; $models = get_models($link, $m_id); echo json_encode($models);