2021-10-30 19:02:07 +02:00
|
|
|
<?php
|
|
|
|
class Weather_model extends MO_Model
|
|
|
|
{
|
2021-11-14 11:02:22 +01:00
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
public function get_weathers_drop_admin()
|
|
|
|
{
|
|
|
|
$sql = "SELECT * FROM weathers";
|
|
|
|
$q = $this->db->query($sql);
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$res = $q->result_array();
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$data[] = 'Nothing';
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
foreach ($res as $row) {
|
|
|
|
$data[] = $row['name'];
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
return $data;
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
public function get_weather_effects_drop_admin()
|
|
|
|
{
|
|
|
|
$data[0] = 'No Effect';
|
|
|
|
$data[1] = 'Fires';
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
return $data;
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
public function list_weathers_admin()
|
|
|
|
{
|
|
|
|
$sql = "SELECT * FROM weathers";
|
|
|
|
$q = $this->db->query($sql);
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
return $q->result_array();
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
public function get_weather_admin($id)
|
|
|
|
{
|
|
|
|
$sql = "SELECT * FROM weathers WHERE id='$id'";
|
|
|
|
$q = $this->db->query($sql);
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
return $q->row_array();
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
public function edit_weather_admin($data)
|
|
|
|
{
|
|
|
|
$sql = "UPDATE weathers
|
2021-10-30 19:02:07 +02:00
|
|
|
SET name='" . $data['name'] . "',
|
|
|
|
description='" . $data['description'] . "',
|
|
|
|
art='" . $data['art'] . "',
|
|
|
|
css='" . $data['css'] . "',
|
|
|
|
effect='" . $data['effect'] . "',
|
|
|
|
mod_max_food='" . $data['mod_max_food'] . "',
|
|
|
|
mod_max_wood='" . $data['mod_max_wood'] . "',
|
|
|
|
mod_max_stone='" . $data['mod_max_stone'] . "',
|
|
|
|
mod_max_iron='" . $data['mod_max_iron'] . "',
|
|
|
|
mod_max_mana='" . $data['mod_max_mana'] . "',
|
|
|
|
mod_percent_food='" . $data['mod_percent_food'] . "',
|
|
|
|
mod_percent_wood='" . $data['mod_percent_wood'] . "',
|
|
|
|
mod_percent_stone='" . $data['mod_percent_stone'] . "',
|
|
|
|
mod_percent_iron='" . $data['mod_percent_iron'] . "',
|
|
|
|
mod_percent_mana='" . $data['mod_percent_mana'] . "'
|
|
|
|
WHERE id='" . $data['id'] . "'";
|
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$this->db->query($sql);
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$this->_create_sql($sql);
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
public function add_weather_admin($data)
|
|
|
|
{
|
|
|
|
$sql = "INSERT INTO weathers VALUES(default,
|
2021-10-30 19:02:07 +02:00
|
|
|
'" . $data['name'] . "',
|
|
|
|
'" . $data['description'] . "',
|
|
|
|
'" . $data['art'] . "',
|
|
|
|
'" . $data['css'] . "',
|
|
|
|
'" . $data['effect'] . "',
|
|
|
|
'" . $data['mod_max_food'] . "',
|
|
|
|
'" . $data['mod_max_wood'] . "',
|
|
|
|
'" . $data['mod_max_stone'] . "',
|
|
|
|
'" . $data['mod_max_iron'] . "',
|
|
|
|
'" . $data['mod_max_mana'] . "',
|
|
|
|
'" . $data['mod_percent_food'] . "',
|
|
|
|
'" . $data['mod_percent_wood'] . "',
|
|
|
|
'" . $data['mod_percent_stone'] . "',
|
|
|
|
'" . $data['mod_percent_iron'] . "',
|
|
|
|
'" . $data['mod_percent_mana'] . "')";
|
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$this->db->query($sql);
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$this->_create_sql($sql);
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
}
|
2021-11-14 11:02:22 +01:00
|
|
|
//nowhitesp
|