• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP eqLogic类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中eqLogic的典型用法代码示例。如果您正苦于以下问题:PHP eqLogic类的具体用法?PHP eqLogic怎么用?PHP eqLogic使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了eqLogic类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: cron30

 public function cron30($_eqlogic_id = null)
 {
     if ($_eqlogic_id !== null) {
         $eqLogics = array(eqLogic::byId($_eqlogic_id));
     } else {
         $eqLogics = eqLogic::byType('karotz');
     }
     foreach ($eqLogics as $karotz) {
         if ($karotz->getIsEnable() == 1) {
             $request = 'http://' . $karotz->getConfiguration('addr') . '/cgi-bin/status';
             $request = new com_http($request);
             $jsonstatus = json_decode($request->exec(5, 1), true);
             $change = false;
             foreach ($karotz->getCmd() as $cmd) {
                 if (!isset($jsonstatus[$cmd->getLogicalId()])) {
                     continue;
                 }
                 $value = $jsonstatus[$cmd->getLogicalId()];
                 if ($cmd->getLogicalId() == 'led_color') {
                     $value = '#' . $value;
                 }
                 if ($cmd->execCmd() !== $cmd->formatValue($value)) {
                     $cmd->event($value);
                     $change = true;
                 }
             }
             if ($change) {
                 $karotz->refreshWidget();
             }
         }
     }
 }
开发者ID:jeedom,项目名称:plugin-karotz,代码行数:32,代码来源:karotz.class.php


示例2: pull

 public static function pull($_options)
 {
     $date = time();
     log::add('mySensors', 'info', 'Cron de vérification des nodes');
     foreach (eqLogic::byType('mySensors') as $elogic) {
         log::add('mySensors', 'info', 'Vérification du node' . $elogic->getName());
         if ($elogic->getConfiguration('followActivity') == '1') {
             log::add('mySensors', 'info', $elogic->getName() . ' en surveillance');
             $actDate = $elogic->getConfiguration('LastActivity');
             log::add('mySensors', 'info', 'Derniere Activite ' . $actDate);
             $activity = strtotime($actDate);
             $duration = $elogic->getConfiguration('AlertLimit');
             log::add('mySensors', 'info', 'Interval paramétré ' . $duration);
             $interval = round(abs($date - $activity) / 60, 2);
             log::add('mySensors', 'info', 'Durée d inactivité ' . $interval);
             if ($interval > $duration) {
                 log::add('mySensors', 'info', 'Délai dépassé pour ' . $elogic->getName());
                 $gate = self::byLogicalId('gateway', 'mySensors');
                 $value = $elogic->getName();
                 $cmdlogic = mySensorsCmd::byEqLogicIdAndLogicalId($gate->getId(), 'Inactif');
                 $cmdlogic->setConfiguration('value', $value);
                 $cmdlogic->save();
                 $cmdlogic->event($value);
             }
         }
     }
 }
开发者ID:conselio,项目名称:jeedom_mysensors,代码行数:27,代码来源:mySensors.class.php


示例3: openzwave_update

function openzwave_update()
{
    if (openzwave::deamonRunning()) {
        echo 'Stop zwave network...';
        openzwave::stopDeamon();
        echo "OK\n";
    }
    echo 'Stop cron...';
    $cron = cron::byClassAndFunction('openzwave', 'pull');
    if (config::byKey('jeeNetwork::mode') != 'slave') {
        if (!is_object($cron)) {
            $cron = new cron();
        }
        $cron->setClass('openzwave');
        $cron->setFunction('pull');
        $cron->setEnable(1);
        $cron->setDeamon(1);
        $cron->setDeamonSleepTime(0.5);
        $cron->setTimeout(1440);
        $cron->setSchedule('* * * * *');
        $cron->save();
        $cron->stop();
    } else {
        if (is_object($cron)) {
            $cron->remove();
        }
    }
    echo "OK\n";
    echo 'Check zwave system...';
    if (count(eqLogic::byType('zwave')) > 0) {
        log::add('openzwave', 'error', 'Attention vous etes sur la nouvelle version d\'openzwave, des actions de votre part sont necessaire merci d\'aller voir https://jeedom.fr/blog/?p=1576');
    }
    if (config::byKey('port', 'openzwave', 'none') != 'none') {
        if (method_exists('openzwave', 'getVersion')) {
            if (version_compare(config::byKey('openzwave_version', 'openzwave'), openzwave::getVersion('openzwave'), '>')) {
                if (jeedom::getHardwareName() == 'Jeedomboard') {
                    config::save('allowStartDeamon', 0, 'openzwave');
                    openzwave::updateOpenzwave(false);
                    config::save('allowStartDeamon', 1, 'openzwave');
                } else {
                    log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur le démon local, il faut ABSOLUMENT la mettre à jour', __FILE__));
                }
            }
        }
    }
    if (config::byKey('jeeNetwork::mode') == 'master') {
        foreach (jeeNetwork::byPlugin('openzwave') as $jeeNetwork) {
            try {
                if ($jeeNetwork->configByKey('port', 'openzwave', 'none') != 'none') {
                    if (version_compare($jeeNetwork->sendRawRequest('getVersion', array('plugin' => 'openzwave', 'module' => 'openzwave')), openzwave::getVersion('openzwave'), '>')) {
                        log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur', __FILE__) . ' ' . $jeeNetwork->getName() . ' ' . __('il faut ABSOLUMENT la mettre à jour', __FILE__));
                    }
                }
            } catch (Exception $e) {
            }
        }
    }
    echo "OK\n";
}
开发者ID:stef3569,项目名称:plugin-openzwave,代码行数:59,代码来源:install.php


示例4: cronHourly

 public static function cronHourly($_eqlogic_id = null)
 {
     if ($_eqlogic_id !== null) {
         $eqLogics = array(eqLogic::byId($_eqlogic_id));
     } else {
         $eqLogics = eqLogic::byType('porkfolio');
     }
     foreach ($eqLogics as $porkfolio) {
         if ($porkfolio->getIsEnable() == 1) {
             log::add('porkfolio', 'debug', 'Pull Cron pour Porkfolio');
             $porkfolioInfo = $porkfolio->getporkfolioInfo();
             $somme = isset($porkfolioInfo['Somme']) ? $porkfolioInfo['Somme'] : "old";
             $derniervers = isset($porkfolioInfo['Dernier']) ? $porkfolioInfo['Dernier'] : "old";
             $datemvt = isset($porkfolioInfo['Date Mouvement']) ? $porkfolioInfo['Date Mouvement'] : "old";
             $dateretournement = isset($porkfolioInfo['Date Retournement']) ? $porkfolioInfo['Date Retournement'] : "old";
             $datevers = isset($porkfolioInfo['Date depot']) ? $porkfolioInfo['Date depot'] : "old";
             $objectif = isset($porkfolioInfo['Objectif']) ? $porkfolioInfo['Objectif'] : "old";
             $nez = isset($porkfolioInfo['Nez']) ? $porkfolioInfo['Nez'] : "old";
             foreach ($porkfolio->getCmd('info') as $cmd) {
                 switch ($cmd->getName()) {
                     case 'Somme':
                         $value = $somme;
                         break;
                     case 'Dernière Opération':
                         $value = $derniervers;
                         break;
                     case 'Date mouvement':
                         $value = $datemvt;
                         break;
                     case 'Date dépot':
                         $value = $datevers;
                         break;
                     case 'Nez':
                         $value = $nez;
                         break;
                     case 'Date retournement':
                         $value = $dateretournement;
                         break;
                     case 'Objectif':
                         $value = $objectif;
                         break;
                 }
                 if ($value == 0 || $value != 'old') {
                     $cmd->event($value);
                     log::add('porkfolio', 'debug', 'set:' . $cmd->getName() . ' to ' . $value);
                 }
             }
             $mc = cache::byKey('porkfolioWidgetmobile' . $porkfolio->getId());
             $mc->remove();
             $mc = cache::byKey('porkfolioWidgetdashboard' . $porkfolio->getId());
             $mc->remove();
             $porkfolio->toHtml('mobile');
             $porkfolio->toHtml('dashboard');
             $porkfolio->refreshWidget();
         }
     }
 }
开发者ID:jeedom,项目名称:plugin-porkfolio,代码行数:57,代码来源:porkfolio.class.php


示例5: openzwave_update

function openzwave_update()
{
    log::add('openzwave', 'error', __('Après toute installation/mise à jour pensez bien à mettre à jour les dépendances Openzwave (voir documentation)', __FILE__));
    if (!file_exists(dirname(__FILE__) . '/../data')) {
        mkdir(dirname(__FILE__) . '/../data');
    }
    shell_exec('cp -R /opt/python-openzwave/xml_backups ' . dirname(__FILE__) . '/../data');
    shell_exec('cp -R /opt/python-openzwave/zwcfg_*.xml ' . dirname(__FILE__) . '/../data');
    shell_exec('rm -rf /opt/python-openzwave/xml_backups');
    shell_exec('rm -rf /opt/python-openzwave/zwcfg_*.xml');
    config::save('allowStartDeamon', 0, 'openzwave');
    echo 'Stop zwave network...';
    openzwave::stop();
    openzwave::stopDeamon();
    echo "OK\n";
    echo 'Stop cron...';
    $cron = cron::byClassAndFunction('openzwave', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
    echo "OK\n";
    echo 'Check zwave system...';
    if (count(eqLogic::byType('zwave')) > 0) {
        log::add('openzwave', 'error', 'Attention vous etes sur la nouvelle version d\'openzwave, des actions de votre part sont necessaire merci d\'aller voir https://jeedom.fr/blog/?p=1576');
    }
    if (config::byKey('port', 'openzwave', 'none') != 'none') {
        if (method_exists('openzwave', 'getVersion')) {
            if (version_compare(config::byKey('openzwave_version', 'openzwave'), openzwave::getVersion('openzwave'), '>')) {
                if (jeedom::getHardwareName() == 'Jeedomboard') {
                    openzwave::updateOpenzwave(false);
                } else {
                    log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur le démon local, il faut ABSOLUMENT la mettre à jour', __FILE__));
                }
            }
        }
    }
    if (config::byKey('jeeNetwork::mode') == 'master') {
        foreach (jeeNetwork::byPlugin('openzwave') as $jeeNetwork) {
            try {
                if ($jeeNetwork->configByKey('port', 'openzwave', 'none') != 'none') {
                    if (version_compare($jeeNetwork->sendRawRequest('getVersion', array('plugin' => 'openzwave', 'module' => 'openzwave')), openzwave::getVersion('openzwave'), '>')) {
                        log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur', __FILE__) . ' ' . $jeeNetwork->getName() . ' ' . __('il faut ABSOLUMENT la mettre à jour', __FILE__));
                    }
                }
            } catch (Exception $e) {
            }
        }
    }
    echo "OK\n";
    echo 'Redemarrage zwave network...';
    try {
        config::save('allowStartDeamon', 1, 'openzwave');
        openzwave::runDeamon();
    } catch (Exception $e) {
    }
    echo "OK\n";
}
开发者ID:kaneda-fr,项目名称:plugin-openzwave,代码行数:57,代码来源:install.php


示例6: karotz_update

function karotz_update()
{
    foreach (eqLogic::byType('karotz') as $karotz) {
        foreach ($karotz->getCmd() as $cmd) {
            if ($cmd->getLogicalId() == '') {
                $cmd->remove();
            }
        }
        $karotz->save();
    }
}
开发者ID:jeedom,项目名称:plugin-karotz,代码行数:11,代码来源:install.php


示例7: nabaztag_update

function nabaztag_update()
{
    foreach (eqLogic::byType('nabaztag') as $nabaztag) {
        foreach ($nabaztag->getCmd() as $cmd) {
            if ($cmd->getLogicalId() == '') {
                $cmd->remove();
            }
        }
        $nabaztag->save();
    }
}
开发者ID:jeedom,项目名称:plugin-nabaztag,代码行数:11,代码来源:install.php


示例8: getDisplayIds

 public static function getDisplayIds($pebbleId)
 {
     $displayIds = '';
     foreach (eqLogic::byType('jebble') as $jebble) {
         if ($jebble->getIsEnable() && $jebble->getId() == $pebbleId) {
             $displayIds = $jebble->getConfiguration('display_ids');
             log::add('jebble', 'debug', 'ids:' . $displayIds);
             break;
         }
     }
     return $displayIds;
 }
开发者ID:edouardkleinhans,项目名称:jebble_jeedom,代码行数:12,代码来源:jebble_v2.class.php


示例9: cron30

 public static function cron30($_eqlogic_id = null)
 {
     if ($_eqlogic_id !== null) {
         $eqLogics = array(eqLogic::byId($_eqlogic_id));
     } else {
         $eqLogics = eqLogic::byType('wazeintime');
         sleep(rand(0, 120));
     }
     foreach ($eqLogics as $wazeintime) {
         if ($wazeintime->getIsEnable() == 1) {
             try {
                 $start = $wazeintime->getPosition('start');
                 $end = $wazeintime->getPosition('end');
                 $row = $wazeintime->getConfiguration('NOA') ? '' : 'row-';
                 $wazeRouteurl = 'https://www.waze.com/' . $row . 'RoutingManager/routingRequest?from=x%3A' . $start['lon'] . '+y%3A' . $start['lat'] . '&to=x%3A' . $end['lon'] . '+y%3A' . $end['lat'] . '&at=0&returnJSON=true&returnGeometries=true&returnInstructions=true&timeout=60000&nPaths=3&options=AVOID_TRAILS%3At';
                 $request_http = new com_http($wazeRouteurl);
                 $request_http->setUserAgent('User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0');
                 $json = json_decode($request_http->exec(6, 2), true);
                 if (isset($json['error'])) {
                     throw new Exception($json['error']);
                 }
                 $data = self::extractInfo($json);
                 $wazeRoutereturl = 'https://www.waze.com/' . $row . 'RoutingManager/routingRequest?from=x%3A' . $end['lon'] . '+y%3A' . $end['lat'] . '&to=x%3A' . $start['lon'] . '+y%3A' . $start['lat'] . '&at=0&returnJSON=true&returnGeometries=true&returnInstructions=true&timeout=60000&nPaths=3&options=AVOID_TRAILS%3At';
                 $request_http = new com_http($wazeRoutereturl);
                 $request_http->setUserAgent('User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0');
                 $json = json_decode($request_http->exec(6, 2), true);
                 if (isset($json['error'])) {
                     throw new Exception($json['error']);
                 }
                 $data = array_merge($data, self::extractInfo($json, 'ret'));
                 log::add('wazeintime', 'debug', 'Data : ' . print_r($data, true));
                 foreach ($wazeintime->getCmd('info') as $cmd) {
                     if ($cmd->getLogicalId() == 'lastrefresh') {
                         $cmd->event(date('H:i'));
                         continue;
                     }
                     if (!isset($data[$cmd->getLogicalId()])) {
                         continue;
                     }
                     if ($cmd->formatValue($data[$cmd->getLogicalId()]) != $cmd->execCmd()) {
                         $cmd->setCollectDate('');
                         $cmd->event($data[$cmd->getLogicalId()]);
                     }
                 }
                 $wazeintime->refreshWidget();
             } catch (Exception $e) {
                 log::add('wazeintime', 'error', $e->getMessage());
             }
         }
     }
 }
开发者ID:jeedom,项目名称:plugin-wazeintime,代码行数:51,代码来源:wazeintime.class.php


示例10: cron

 public static function cron($_eqlogic_id = null, $force = false)
 {
     if ($_eqlogic_id !== null) {
         $eqLogics = array(eqLogic::byId($_eqlogic_id));
     } else {
         $eqLogics = eqLogic::byType('trains');
     }
     foreach ($eqLogics as $trains) {
         if ($trains->getIsEnable() == 1) {
             if ($force || date('Hi', time()) >= $trains->getConfiguration('trains_maj_deb') && date('Hi', time()) <= $trains->getConfiguration('trains_maj_fin')) {
                 log::add('trains', 'debug', 'Pull ' . ($force ? 'Forcé' : 'Cron') . ' pour trains ');
                 $baseUrl = 'http://www.gares-sncf.com/fr/train-times/departure/' . $trains->getConfiguration('trains_depart') . '/gl';
                 $arrivee = $trains->getConfiguration('trains_arrivee');
                 $response = file_get_contents($baseUrl);
                 $json = json_decode($response, true);
                 $departs = [];
                 foreach ($json['trains'] as $depart) {
                     $trainCourant = (object) [];
                     if ($arrivee == '' || $trains->string_contains($depart['origdest'], $arrivee)) {
                         $trainCourant->dest = $depart['origdest'];
                         $trainCourant->type = $depart['type'];
                         $trainCourant->voie = $depart['voie'];
                         $trainCourant->heure = $depart['heure'];
                         $trainCourant->etat = $depart['etat'];
                         $trainCourant->retard = $depart['retard'];
                         $trainCourant->infos = $depart['infos'];
                         $departs[] = $trainCourant;
                     }
                 }
                 log::add('trains', 'debug', 'Date de mise à jour des infos récupérées : ' . $json['updated']);
                 log::add('trains', 'debug', 'infos récupérées : ' . json_encode($departs));
                 $result = (object) [];
                 $result->updated = $json['updated'];
                 $result->departs = $departs;
                 $trainsCmd = $trains->getCmd(null, 'Departs');
                 if (is_object($trainsCmd)) {
                     $trainsCmd->event(json_encode($result));
                 }
                 $trains->refreshWidget();
             }
         }
     }
 }
开发者ID:bemar,项目名称:jeedom_trains,代码行数:43,代码来源:trains.class.php


示例11: openzwave_update

function openzwave_update()
{
    if (!file_exists(dirname(__FILE__) . '/../data')) {
        mkdir(dirname(__FILE__) . '/../data');
        if (file_exists('/opt/python-openzwave/xml_backups')) {
            shell_exec('cp -R /opt/python-openzwave/xml_backups ' . dirname(__FILE__) . '/../data');
            shell_exec('cp -R /opt/python-openzwave/zwcfg_*.xml ' . dirname(__FILE__) . '/../data');
            shell_exec('rm -rf /opt/python-openzwave/xml_backups');
            shell_exec('rm -rf /opt/python-openzwave/zwcfg_*.xml');
        }
    }
    $cron = cron::byClassAndFunction('openzwave', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
    if (count(eqLogic::byType('zwave')) > 0) {
        log::add('openzwave', 'error', 'Attention vous etes sur la nouvelle version d\'openzwave, des actions de votre part sont necessaire merci d\'aller voir https://jeedom.fr/blog/?p=1576');
    }
    openzwave::syncconfOpenzwave();
}
开发者ID:sfrias,项目名称:plugin-openzwave,代码行数:20,代码来源:install.php


示例12: ecodevice_remove

function ecodevice_remove()
{
    $cron = cron::byClassAndFunction('ecodevice', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
    $cron = cron::byClassAndFunction('ecodevice', 'cron');
    if (is_object($cron)) {
        $cron->remove();
    }
    foreach (eqLogic::byType('ecodevice_compteur') as $SubeqLogic) {
        $SubeqLogic->remove();
    }
    foreach (eqLogic::byType('ecodevice_teleinfo') as $SubeqLogic) {
        $SubeqLogic->remove();
    }
    foreach (eqLogic::byType('ecodevice') as $eqLogic) {
        $eqLogic->remove();
    }
}
开发者ID:jooooooon,项目名称:plugin-ecodevice,代码行数:20,代码来源:install.php


示例13: copyFromEqLogic

 public function copyFromEqLogic($_eqLogic_id)
 {
     $eqLogic = eqLogic::byId($_eqLogic_id);
     if (!is_object($eqLogic)) {
         throw new Exception(__('Impossible de trouver l\'équipement : ', __FILE__) . $_eqLogic_id);
     }
     if ($eqLogic->getEqType_name() == 'virtual') {
         throw new Exception(__('Vous ne pouvez importer la configuration d\'un équipement virtuel', __FILE__));
     }
     foreach ($eqLogic->getCategory() as $key => $value) {
         $this->setCategory($key, $value);
     }
     foreach ($eqLogic->getCmd() as $cmd_def) {
         $cmd = new virtualCmd();
         $cmd->setName($cmd_def->getName());
         $cmd->setEqLogic_id($this->getId());
         $cmd->setIsVisible($cmd_def->getIsVisible());
         $cmd->setType($cmd_def->getType());
         $cmd->setUnite($cmd_def->getUnite());
         $cmd->setOrder($cmd_def->getOrder());
         $cmd->setDisplay('icon', $cmd_def->getDisplay('icon'));
         $cmd->setDisplay('invertBinary', $cmd_def->getDisplay('invertBinary'));
         foreach ($cmd_def->getTemplate() as $key => $value) {
             $cmd->setTemplate($key, $value);
         }
         $cmd->setSubType($cmd_def->getSubType());
         if ($cmd->getType() == 'info') {
             $cmd->setConfiguration('calcul', '#' . $cmd_def->getId() . '#');
             $cmd->setValue($cmd_def->getId());
             $cmd->setEventOnly(1);
         } else {
             $cmd->setValue($cmd_def->getValue());
             $cmd->setConfiguration('infoName', '#' . $cmd_def->getId() . '#');
         }
         $cmd->save();
     }
     $this->save();
 }
开发者ID:GaelGRIFFON,项目名称:plugin-virtual,代码行数:38,代码来源:virtual.class.php


示例14: setIsEnable

 public function setIsEnable($_state)
 {
     if (version_compare(jeedom::version(), $this->getRequire()) == -1 && $_state == 1) {
         throw new Exception('Votre version de jeedom n\'est pas assez récente pour activer ce plugin');
     }
     $alreadyActive = config::byKey('active', $this->getId(), 0);
     if ($_state == 1) {
         if (config::byKey('jeeNetwork::mode') != 'master' && $this->getAllowRemote() != 1) {
             throw new Exception('Vous ne pouvez pas activer ce plugin sur un Jeedom configuré en esclave');
         }
         //market::checkPayment($this->getId());
         config::save('active', $_state, $this->getId());
     }
     if ($_state == 0) {
         $eqLogics = eqLogic::byType($this->getId());
         if (is_array($eqLogics)) {
             foreach ($eqLogics as $eqLogic) {
                 try {
                     $eqLogic->setConfiguration('previousIsEnable', $eqLogic->getIsEnable());
                     $eqLogic->setConfiguration('previousIsVisible', $eqLogic->getIsVisible());
                     $eqLogic->setIsEnable(0);
                     $eqLogic->setIsVisible(0);
                     $eqLogic->save();
                 } catch (Exception $e) {
                 }
             }
         }
         $listeners = listener::byClass($this->getId());
         if (is_array($listeners)) {
             foreach ($listeners as $listener) {
                 $listener->remove();
             }
         }
     }
     if ($alreadyActive == 0 && $_state == 1) {
         foreach (eqLogic::byType($this->getId()) as $eqLogic) {
             try {
                 $eqLogic->setIsEnable($eqLogic->getConfiguration('previousIsEnable', 1));
                 $eqLogic->setIsVisible($eqLogic->getConfiguration('previousIsVisible', 1));
                 $eqLogic->save();
             } catch (Exception $e) {
             }
         }
     }
     try {
         if ($_state == 1) {
             if ($alreadyActive == 1) {
                 $out = $this->callInstallFunction('update');
             } else {
                 $out = $this->callInstallFunction('install');
             }
         } else {
             if ($alreadyActive == 1) {
                 $out = $this->callInstallFunction('remove');
             }
         }
         if (isset($out) && trim($out) != '') {
             log::add($this->getId(), 'info', "Installation/remove/update result : " . $out);
         }
     } catch (Exception $e) {
         config::save('active', $alreadyActive, $this->getId());
         log::add('plugin', 'error', $e->getMessage());
         throw $e;
     }
     if ($_state == 0) {
         config::save('active', $_state, $this->getId());
     }
     return true;
 }
开发者ID:saez0pub,项目名称:core,代码行数:69,代码来源:plugin.class.php


示例15: Exception

<?php

if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
sendVarToJS('eqType', '#plugin_id#');
$eqLogics = eqLogic::byType('#plugin_id#');
?>

<div class="row row-overflow">
    <div class="col-lg-2 col-md-3 col-sm-4">
        <div class="bs-sidebar">
            <ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
                <a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add">
                    <i class="fa fa-plus-circle"></i> {{Ajouter un #plugin_name#}}
                </a>
                <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
            </ul>
            <ul id="ul_eqLogicView" class="nav nav-pills nav-stacked"></ul> <!-- la sidebar -->
        </div>
    </div>

    <div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
        <legend>{{Mes #plugin_name#}}</legend> <!-- changer pour votre type d'équipement -->

        <div class="eqLogicThumbnailContainer"></div> <!-- le container -->
    </div>

    <!-- Affichage de l'eqLogic sélectionné -->
    <div class="col-lg-10 col-md-9 col-sm-8 eqLogic" style="border-left: solid 1px #EEE; padding-left: 25px;display: none;">
        <form class="form-horizontal">
开发者ID:GaelGRIFFON,项目名称:plugin-template,代码行数:31,代码来源:template.php


示例16: init

    }
    if (init('action') == 'syncEqLogicWithTeslaSite') {
        tesla::syncEqLogicWithTeslaSite();
        ajax::success();
    }
    if (init('action') == 'createToken') {
        $result = tesla::createToken(init('email'), init('password'));
        //config::save('token',$result,'tesla');
        ajax::success($result);
    }
    if (init('action') == 'checkAPI') {
        ajax::success(tesla::checkAPI());
    }
    // action qui permet d'obtenir l'ensemble des eqLogic
    if (init('action') == 'getAll') {
        $eqLogics = eqLogic::byType('tesla');
        // ne pas oublier de modifier pour le nom de votre plugin
        // la liste des équipements
        foreach ($eqLogics as $eqLogic) {
            $data['id'] = $eqLogic->getId();
            $data['humanSidebar'] = $eqLogic->getHumanName(true, false);
            $data['humanContainer'] = $eqLogic->getHumanName(true, true);
            $return[] = $data;
        }
        ajax::success($return);
    }
    throw new Exception(__('Aucune methode correspondante à : ', __FILE__) . init('action'));
    /*     * *********Catch exeption*************** */
} catch (Exception $e) {
    ajax::error(displayExeption($e), $e->getCode());
}
开发者ID:kaneda-fr,项目名称:jeedom_tesla,代码行数:31,代码来源:tesla.ajax.php


示例17:

				<div class="col-lg-3">
					<input type="checkbox" class="configKey bootstrapSwitch" data-l1key="auto_health" />
				</div>
			</div>
			<legend><i class="fa fa-cog"></i>  {{Gestion avancée}}</legend>
			<div class="form-group">
				<label class="col-lg-4 control-label">{{Options avancées}}</label>
				<div class="col-lg-5">
					<a class="btn btn-success" id="bt_consoleZwave"><i class="fa fa-terminal"></i> {{Console}}</a>
					<a class="btn btn-warning" id="bt_backupsZwave"><i class="fa fa-floppy-o"></i> {{Backups}}</a>
					<a class="btn btn-danger" id="bt_fileconfigZwave"><i class="fa fa-file-o"></i> {{Configuration}}</a>
				</div>
			</div>
			<?php 
}
if (config::byKey('jeeNetwork::mode') == 'master' && count(eqLogic::byType('zwave')) > 0) {
    ?>
			<div class="form-group">
				<label class="col-lg-4 control-label">{{Migration des équipements zwave}}</label>
				<div class="col-lg-3">
					<a class="btn btn-warning" id="bt_migrateZwave"><i class="fa fa-ship"></i> {{Migrer}}</a>
				</div>
			</div>
			<?php 
}
?>
		</fieldset>
	</form>
	<form class="form-horizontal">
		<fieldset>
			<legend><i class="icon loisir-darth"></i>  {{Démon local}}</legend>
开发者ID:kouaw,项目名称:plugin-openzwave,代码行数:31,代码来源:configuration.php


示例18: getEqLogic

 public function getEqLogic()
 {
     if ($this->_eqLogic == null) {
         $this->_eqLogic = eqLogic::byId($this->eqLogic_id);
     }
     return $this->_eqLogic;
 }
开发者ID:jimibi,项目名称:core,代码行数:7,代码来源:cmd.class.php


示例19: Exception

    throw new Exception(__('401 - Accès non autorisé', __FILE__));
}
$type = init('type');
switch ($type) {
    case 'cmdHistory':
        $cmd = cmd::byId(init('id'));
        if (!is_object($cmd)) {
            throw new Exception(__('Commande introuvable : ', __FILE__) . init('id'));
        }
        header('Content-Type: text/csv; charset=utf-8');
        header('Content-Disposition: attachment; filename=' . str_replace(' ', '_', $cmd->getHumanName()) . '.csv');
        $histories = $cmd->getHistory();
        foreach ($histories as $history) {
            echo $history->getDatetime();
            echo ';';
            echo str_replace('.', ',', $history->getValue());
            echo "\n";
        }
        break;
    case 'eqLogic':
        $eqLogic = eqLogic::byId(init('id'));
        if (!is_object($eqLogic)) {
            throw new Exception(__('Commande introuvable : ', __FILE__) . init('id'));
        }
        header('Content-Type: text/csv; charset=utf-8');
        header('Content-Disposition: attachment; filename=' . $eqLogic->getHumanName() . '.json');
        echo json_encode($eqLogic->export(), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
        break;
    default:
        break;
}
开发者ID:GaelGRIFFON,项目名称:core,代码行数:31,代码来源:export.php


示例20: execute

 public function execute(&$scenario = null)
 {
     if ($this->getOptions('enable', 1) == 0) {
         return;
     }
     $message = '';
     try {
         if ($this->getType() == 'element') {
             $element = scenarioElement::byId($this->getExpression());
             if (is_object($element)) {
                 $this->setLog($scenario, __('Exécution d\'un bloc élément : ', __FILE__) . $this->getExpression());
                 return $element->execute($scenario);
             }
             return;
         }
         $options = $this->getOptions();
         if (isset($options['enable'])) {
             unset($options['enable']);
         }
         if (is_array($options) && $this->getExpression() != 'wait') {
             foreach ($options as $key => $value) {
                 $options[$key] = str_replace('"', '', self::setTags($value, $scenario));
             }
         }
         if ($this->getType() == 'action') {
             if ($this->getExpression() == 'icon') {
                 if ($scenario != null) {
                     $options = $this->getOptions();
                     $this->setLog($scenario, __('Changement de l\'icone du scénario : ', __FILE__) . $options['icon']);
                     $scenario->setDisplay('icon', $options['icon']);
                     $scenario->save();
                 }
                 return;
             } else {
                 if ($this->getExpression() == 'wait') {
                     if (!isset($options['condition'])) {
                         return;
                     }
                     $result = false;
                     $occurence = 0;
                     $limit = isset($options['timeout']) && is_numeric($options['timeout']) ? $options['timeout'] : 7200;
                     while ($result !== true) {
                         $expression = self::setTags($options['condition'], $scenario);
                         $result = evaluate($expression);
                         if ($occurence > $limit) {
                             $this->setLog($scenario, __('[Wait] Condition valide par dépassement de temps', __FILE__));
                             return;
                         }
                         $occurence++;
                         sleep(1);
                     }
                     $this->setLog($scenario, __('[Wait] Condition valide : ', __FILE__) . $expression);
                     return;
                 } else {
                     if ($this->getExpression() == 'sleep') {
                         if (isset($options['duration'])) {
                             try {
                                 $options['duration'] = evaluate($options['duration']);
                             } catch (Exception $e) {
                             }
                             if (is_numeric($options['duration']) && $options['duration'] > 0) {
                                 $this->setLog($scenario, __('Pause de ', __FILE__) . $options['duration'] . __(' seconde(s)', __FILE__));
                                 if ($options['duration'] < 1) {
                                     return usleep($options['duration'] * 1000);
                                 } else {
                                     return sleep($options['duration']);
                                 }
                             }
                         }
                         $this->setLog($scenario, __('Aucune durée trouvée pour l\'action sleep ou la durée n\'est pas valide : ', __FILE__) . $options['duration']);
                         return;
                     } else {
                         if ($this->getExpression() == 'stop') {
                             if ($scenario != null) {
                                 $this->setLog($scenario, __('Arret du scénario', __FILE__));
                                 $scenario->setState('stop');
                                 $scenario->setPID('');
                                 $scenario->persistLog();
                                 $scenario->save();
                             }
                             die;
                         } else {
                             if ($this->getExpression() == 'log') {
                                 if ($scenario != null) {
                                     $scenario->setLog('Log : ' . $options['message']);
                                     if ($scenario->getConfiguration('speedPriority', 0) == 1) {
                                         $scenario->persistLog();
                                     }
                                 }
                                 return;
                             } else {
                                 if ($this->getExpression() == 'message') {
                                     message::add('scenario', $options['message']);
                                     return;
                                 } else {
                                     if ($this->getExpression() == 'equipement') {
                                         $eqLogic = eqLogic::byId(str_replace(array('#eqLogic', '#'), '', $this->getOptions('eqLogic')));
                                         if (!is_object($eqLogic)) {
                                             throw new Exception(__('Action sur l\'équipement impossible. Equipement introuvable - Vérifiez l\'id : ', __FILE__) . $this->getOptions('eqLogic'));
                                         }
//.........这里部分代码省略.........
开发者ID:jimibi,项目名称:core,代码行数:101,代码来源:scenarioExpression.class.php



注:本文中的eqLogic类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP erConfigClassLhConfig类代码示例发布时间:2022-05-23
下一篇:
PHP entryPeer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap