Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Lockhome
LockHome
Commits
1cbdc274
Commit
1cbdc274
authored
Mar 11, 2020
by
LockhomeDevelopper
Browse files
Up for capteur desactive
parent
9ebaf766
Changes
3
Hide whitespace changes
Inline
Side-by-side
application/controllers/API.php
View file @
1cbdc274
...
...
@@ -62,9 +62,9 @@ class API extends CI_Controller{
// Si le profil est activé a l'heure actuelle
if
(
(
$now
>=
$debut
AND
$now
<=
$fin
)
OR
(
$profil
->
debut
==
$profil
->
fin
)
)
{
$capteurs_actives
=
$this
->
ProfilModele
->
getCapteur
A
ctive
(
$profil
->
id
);
$capteurs_actives
=
$this
->
ProfilModele
->
getCapteur
Desa
ctive
(
$profil
->
id
);
if
(
in_array
(
$capteur
->
id
,
$capteurs_actives
)){
if
(
!
in_array
(
$capteur
->
id
,
$capteurs_actives
)){
// On ajoute le log dans la base de donnée
if
(
$this
->
LogCapteurModele
->
add
(
$capteur
->
id
,
$type
)){
...
...
application/controllers/Profil.php
View file @
1cbdc274
...
...
@@ -36,7 +36,29 @@ class Profil extends CI_Controller{
}
$data
=
array
();
$data
[
"capteurs"
]
=
$this
->
getCapteurActiveAll
();
/***************************************************************** */
/* PERMET D'AFFICHER CORRECTEMENT LES CAPTEURS ACTIVE / DESACTIVE */
$data
[
"capteurs"
]
=
$this
->
CapteurModele
->
getAll
();
$disabledCapteurs
=
array
();
if
(
$idProfil
!=
"new"
)
{
$disabledCapteurs
=
$this
->
ProfilModele
->
getCapteurDesactive
(
$idProfil
);
}
$listes_capteurs
=
array
();
foreach
(
$data
[
"capteurs"
]
as
$Capteur
)
{
if
(
in_array
(
$Capteur
->
id
,
$disabledCapteurs
))
{
$Capteur
->
disabled
=
true
;
}
array_push
(
$listes_capteurs
,
$Capteur
);
}
$data
[
"capteurs"
]
=
$listes_capteurs
;
/***************************************************************** */
if
(
$this
->
input
->
server
(
'REQUEST_METHOD'
)
==
'POST'
)
{
//REQUETE HTTP POST
...
...
application/views/profil/edit.php
View file @
1cbdc274
...
...
@@ -87,7 +87,7 @@
<label
for=
"capteur_
<?=
$capteur
->
id
?>
"
class=
"l_r element"
>
<div
class=
"left"
>
<?=
$capteur
->
nom
;
?>
</div>
<div
class=
"right"
>
<input
id=
"capteur_
<?=
$capteur
->
id
?>
"
name=
"capteur_
<?=
$capteur
->
id
?>
"
<?=
i
n_array
(
$capteur
->
id
,
$state
)
?
""
:
"checked"
?>
value=
"1"
type=
"checkbox"
>
<input
id=
"capteur_
<?=
$capteur
->
id
?>
"
name=
"capteur_
<?=
$capteur
->
id
?>
"
<?=
i
sset
(
$capteur
->
disabled
)
&&
$capteur
->
disabled
==
true
?
""
:
"checked"
?>
value=
"1"
type=
"checkbox"
>
<div
class=
"switch"
></div>
</div>
</label>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment