Пример #1
0
 public static function event()
 {
     $nodeId = init('n');
     $port = init('p');
     if (is_numeric(init('t'))) {
         $type = chr(init('t'));
     } else {
         $type = init('t');
     }
     $value = init('v');
     $jeenodeReal = jeenodeReal::byLogicalId($nodeId, 'jeenode');
     if (count($jeenodeReal) == 0) {
         log::add('jeenode', 'error', 'Jeenode id : ' . $nodeId . ' inconnue');
         return;
     }
     if (count($jeenodeReal) > 1) {
         log::add('jeenode', 'error', 'Jeenode id : ' . $nodeId . ' n\'est pas unique');
         return;
     }
     $jeenodeReal = $jeenodeReal[0];
     if (is_object($jeenodeReal)) {
         if ($type == 'b') {
             $linkToEquipement = 'index.php?v=d&p=jeenode&id=';
             $linkToEquipement .= $jeenodeReal->getId();
             $message = 'L\'équipement <a href="' . $linkToEquipement . '">' . $jeenodeReal->getName();
             $message .= '</a> à une batterie faible';
             message::add('jeenode', $message);
             return false;
         } else {
             $jeenode = $jeenodeReal->getPortNumber($port);
             if (is_object($jeenode)) {
                 $cmd = $jeenode->getCmdByType($type);
                 if (is_object($cmd)) {
                     $jeenodeReal->updateLastCommunication();
                     $cmd->event($value);
                 }
             }
         }
     }
 }
Пример #2
0
if (!isConnect('admin')) {
    throw new Exception('Error 401 Unauthorized');
}
include_file('core', 'jeenode', 'class', 'jeenode');
?>

<div class="row">
    <div class="col-lg-2">
        <div class="bs-sidebar affix">
            <ul id="ul_jeenode" class="nav nav-list bs-sidenav fixnav">
                <li class="nav-header">Liste des jeenodes
                    <i class="fa fa-plus-circle pull-right cursor" id="bt_addJeenode" style="font-size: 1.5em;margin-bottom: 5px;"></i>
                </li>
                <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="Rechercher" style="width: 100%"/></li>
                <?php 
foreach (jeenodeReal::liste() as $jeenodeReal) {
    echo '<li class="cursor li_jeenode" data-jeenodeReal_id="' . $jeenodeReal['id'] . '" data-type="' . $jeenodeReal['type'] . '" data-name="' . $jeenodeReal['name'] . '"><a>' . $jeenodeReal['name'] . ' (' . $jeenodeReal['type'] . ')</a></li>';
}
?>
            </ul>
        </div>
    </div>
    <div class="col-lg-10 eqReal" style="border-left: solid 1px #EEE; padding-left: 25px;display: none;" id="div_conf">
        <div id="div_confCommun">
            <div class="row">
                <div class="col-lg-6">
                    <form class="form-horizontal">
                        <fieldset>
                            <legend>Général</legend>
                            <div class="form-group">
                                <label class="col-lg-3 control-label">Nom du jeenode</label>
Пример #3
0
                            $eqLogic_db = jeenode::byId($eqLogic_ajax['id']);
                            $eqLogic_db->remove();
                        }
                    }
                    foreach ($eqReal_db->getEqLogic() as $eqLogic_db) {
                        if (!isset($enable_eqLogic[$eqLogic_db->getId()])) {
                            $eqLogic_db->remove();
                        }
                    }
                    break;
            }
        }
        ajax::success();
    }
    if (init('action') == 'getJeenodeConf') {
        $jeenodeReal = jeenodeReal::byId(init('jeenodeRealId'));
        if (!is_object($jeenodeReal)) {
            throw new Exception('JeenodeReal inconnu verifié l\'id');
        }
        $return = utils::o2a($jeenodeReal);
        $return['port'] = array();
        foreach ($jeenodeReal->getEqLogic() as $eqLogic) {
            $portConfiguration = utils::o2a($eqLogic);
            $portConfiguration['cmd'] = utils::o2a($eqLogic->getCmd());
            $return['port'][] = $portConfiguration;
        }
        ajax::success($return);
    }
    throw new Exception('Aucune methode correspondante');
    /*     * *********Catch exeption*************** */
} catch (Exception $e) {