Created
October 16, 2019 00:26
-
-
Save govaniso/b7009fc3e939a1b44fa5fba5a8e58ce0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class JardinController extends AppController { | |
public function index() { | |
$Idiomas = new Idiomas(); | |
// var_dump($Idiomas->find(["jardin_id" => "5d9ab7c70a21a04f88123d65"])); | |
$Jardin = new Jardin(); | |
//$j= $Jardin->create(["hola" => "elisa"]); | |
$j = $Jardin->findOne("5d9ab7c70a21a04f88123d65"); | |
//var_dump($j); | |
Flash::info($j->id); | |
//$Jardin->delete($j->id); | |
// $a["hola"] = "elisa"; | |
//$Jardin->delete(["hola" => "elisa"]); | |
// $Jardin->delete($a); | |
//$j->delete(); | |
$this->j = $j; | |
$idioma = new Idiomas(["lang" => "CH"]); | |
$idiomas = new Idiomas(["lang" => "CH"]); | |
$j->addIdiomas($idioma); | |
$j->addIdiomas($idiomas); | |
$j->save(); | |
//var_dump($j->getIdiomas()); | |
} | |
public function terreno() { | |
} | |
// retornar X Y para la grafica | |
// 5d896075f2a3a7fc14643def | |
public function get_xy($id) { | |
$Jardin = new Jardin(); | |
$jardin = $Jardin->findOne($id); | |
View::json($jardin->attrs); | |
} | |
public function set_xy($id = "5d896075f2a3a7fc14643def") { | |
$Jardin = new Jardin(); | |
$jardin = $Jardin->findOne($id); | |
$arreglo = $jardin; | |
$atributos["intruso"]["x"] = 71; | |
$atributos["intruso"]["y"] = 42; | |
$jardin->update($atributos); | |
$jardin = $Jardin->findOne($id); | |
View::json($jardin->attrs); | |
} | |
/** | |
* Establece el idioma del jardin | |
* | |
* @param type $idioma 'es' | |
*/ | |
public function set_lang($id, $lang) { | |
$Jardin = new Jardin(); | |
$jardin = $Jardin->findOne($id); | |
$attr["lang"] = $lang; | |
$jardin->update($attr); | |
$jardin = $Jardin->findOne($id); | |
View::json($jardin->attrs); | |
} | |
public function set_alarma($id, $status) { | |
$Jardin = new Jardin(); | |
$jardin = $Jardin->findOne($id); | |
$attr["status_alarma"] = (int) $status; | |
$jardin->update($attr); | |
// sleep(1); | |
$jardin = $Jardin->findOne($id); | |
View::json($jardin->attrs); | |
} | |
public function get_idiomas() { | |
$Idiomas = new Idiomas(); | |
// $attr["fecha"] = date("h:i:s"); | |
// $IdiomaZ = new Idiomas(); | |
// $IdiomaZ->save($attr); | |
// | |
// $idiomas = $Idiomas->findOne("5d8eaaa0c2773e2caa87d4e1"); | |
View::json($Idiomas->find()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment