-
Notifications
You must be signed in to change notification settings - Fork 6
/
AppBuilderController.php
88 lines (63 loc) · 2.43 KB
/
AppBuilderController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
class AppBuilderController extends CI_Controller {
public function __construct()
{
parent::__construct();
//$this->load->database();
$this->load->model('appBuilderModel');
}
/*public function coordinates() {
$lat = 40.034093;
$lng = 0.333345345;
$kilometers = 100;
$this->db->select("*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( Latitud ) ) * cos( radians( Longitud ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( Latitud ) ) ) ) AS distance");
$this->db->having('distance <= ' . $kilometers);
$this->db->order_by('distance');
$this->db->limit(20, 0);
$queryDist = $this->db->get('listaPueblos');
foreach($queryDist->result_array() as $pueblo) {
echo $pueblo['Poblacion'].'<br>';
}
}*/
public function configDatabase() {
$objectData = json_decode(file_get_contents('php://input'), true);
$db['default']['hostname'] = $objectData['hostname'];
$db['default']['database'] = $objectData['database'];
$db['default']['username'] = $objectData['username'];
$db['default']['password'] = $objectData['password'];
}
public function saveObject() {
$objectData = json_decode(file_get_contents('php://input'), true);
echo $this->appBuilderModel->saveObject($objectData);
}
public function getObject() {
$objectData = json_decode(file_get_contents('php://input'), true);
echo $this->appBuilderModel->getObject($objectData);
}
public function getCreateObject() {
$objectData = json_decode(file_get_contents('php://input'), true);
echo $this->appBuilderModel->getCreateObject($objectData);
}
public function updateCreateObject() {
$objectData = json_decode(file_get_contents('php://input'), true);
echo $this->appBuilderModel->updateCreateObject($objectData);
}
public function updateObject() {
$objectData = json_decode(file_get_contents('php://input'), true);
echo $this->appBuilderModel->updateObject($objectData);
}
public function deleteObject() {
$objectData = json_decode(file_get_contents('php://input'), true);
echo $this->appBuilderModel->deleteObject($objectData);
}
public function count() {
$objectData = json_decode(file_get_contents('php://input'), true);
echo $this->appBuilderModel->count($objectData);
}
public function prueba() {
echo getcwd();
copy('https://img21.taquilla.com/data/images/t/d0/fiestas-en-ibiza__330x275.jpg', 'public/file.jpg');
echo 'ok';
}
}
?>