Ejemplo n.º 1
0
    }
    if (init('action') == 'nezcouleur') {
        porkfolio::changenezporkfolio(init('id'), init('couleur'));
        ajax::success();
    }
    if (init('action') == 'objectif') {
        $objectif = init('montant');
        if (!is_numeric($objectif)) {
            ajax::error('Veuillez saisire un nombre SVP');
        } else {
            if ($objectif < 0) {
                ajax::error('Vous ne pouvez pas fixer un objectif négatif');
            } else {
                if ($objectif > 99) {
                    ajax::error('Vous ne pouvez pas fixer un objectif supérieur à 99€');
                } else {
                    if ($objectif == 0) {
                        ajax::error('Inutile de fixer un objectif à 0€, essayez un vrai objectif');
                    } else {
                        porkfolio::changeobjectifporkfolio(init('id'), init('montant'));
                        ajax::success();
                    }
                }
            }
        }
    }
    throw new Exception(__('Aucune methode correspondante à : ', __FILE__) . init('action'));
    /*     * *********Catch exeption*************** */
} catch (Exception $e) {
    ajax::error(displayExeption($e), $e->getCode());
}
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Jeedom is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Jeedom. If not, see <http://www.gnu.org/licenses/>.
*/
if (init('id') == '') {
    throw new Exception('{{L\'id de l\'équipement ne peut etre vide : }}' . init('op_id'));
}
$id = init('id');
$porkfolio = porkfolio::byId($id);
if (!is_object($porkfolio)) {
    throw new Exception(__('Aucun equipement ne  correspond : Il faut (re)-enregistrer l\'équipement ', __FILE__) . init('action'));
}
$id = $porkfolio->getId();
$nez = $porkfolio->getCmd(null, 'nez')->execCmd();
?>
<div class="alert alert-info">
            Choisissez la couleur du nez de votre porkfolio. La couleur actuelle est <i class="fa fa-circle fa-lg" style="color : #<?php 
echo $nez;
?>
;"></i>.
</div>
<div id="nezcouleur">
<input type="color" id="couleur" name='<?php 
echo $id;
Ejemplo n.º 3
0
 public function changeobjectifporkfolio($id, $objectif)
 {
     $porkfolio = porkfolio::byId($id);
     $porkid = $porkfolio->getConfiguration('porkid');
     $objectif = $objectif * 100;
     $cmd = '/usr/bin/python ' . dirname(__FILE__) . '/../../3rdparty/py-wink-adapt/set_info.py ' . $porkid . ' Objectif ' . $objectif . ' 2>&1 &';
     log::add('porkfolio', 'debug', 'Execution de la commande suivante : ' . $cmd);
     $resultid = exec($cmd);
     log::add('porkfolio', 'debug', 'Le retour de la commande est : ' . $resultid);
     $porkfolio->cronHourly();
 }