当前位置: 首页>>代码示例>>PHP>>正文


PHP eqLogic::byId方法代码示例

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


在下文中一共展示了eqLogic::byId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: ping

 public function ping()
 {
     if ($this->getConfiguration('pingState', 1) != 1) {
         return true;
     }
     log::add('alarm', 'debug', 'Lancement du ping de l\'alarme : ' . $this->getHumanName());
     foreach ($this->getConfiguration('pingTest') as $pingTest) {
         $eqLogic = eqLogic::byId(str_replace('#', '', $pingTest['eqLogic']));
         if (!is_object($eqLogic)) {
             continue;
         }
         log::add('alarm', 'debug', 'Test ping pour : ' . $eqLogic->getHumanName());
         if ($eqLogic->getIsEnable() == 1 && method_exists($eqLogic, 'ping')) {
             if (!$eqLogic->ping()) {
                 log::add('alarm', 'debug', 'Ping NOK sur : ' . $eqLogic->getHumanName());
                 $this->setConfiguration('pingState', 0);
                 $this->save();
                 log::add('alarm', 'debug', 'Alert perte ping éxecution des actions');
                 foreach ($this->getConfiguration('ping') as $action) {
                     $cmd = cmd::byId(str_replace('#', '', $action['cmd']));
                     if (is_object($cmd)) {
                         try {
                             log::add('alarm', 'debug', 'Exécution de la commande ' . $cmd->getHumanName());
                             $options = array();
                             if (isset($action['options'])) {
                                 $options = $action['options'];
                             }
                             $cmd->execCmd($options);
                         } catch (Exception $e) {
                             log::add('alarm', 'error', 'Erreur lors de l\'éxecution de ' . $cmd->getHumanName() . '. Détails : ' . $e->getMessage());
                         }
                     }
                 }
                 break;
             } else {
                 log::add('alarm', 'debug', 'Ping OK sur : ' . $eqLogic->getHumanName());
             }
         } else {
             log::add('alarm', 'debug', 'Aucune méthode de ping pour : ' . $eqLogic->getHumanName());
         }
     }
 }
开发者ID:Wators,项目名称:jeedom_plugins,代码行数:42,代码来源:alarm.class.php

示例10: Exception

<?php

if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
$eqLogic = eqLogic::byId(init('eqLogic_id'));
if (!is_object($eqLogic)) {
    throw new Exception('EqLogic non trouvé : ' . init('eqLogic_id'));
}
sendVarToJS('eqLogicInfo', utils::o2a($eqLogic));
?>
<div style="display: none;" id="md_displayEqLogicConfigure"></div>

<a class="btn btn-danger pull-right btn-sm" id="bt_eqLogicConfigureRemove"><i class="fa fa-times"></i> {{Supprimer}}</a>
<a class="btn btn-success pull-right btn-sm" id="bt_eqLogicConfigureSave"><i class="fa fa-check-circle"></i> {{Enregistrer}}</a>

<ul class="nav nav-tabs" role="tablist">
    <li role="presentation" class="active"><a href="#information" aria-controls="home" role="tab" data-toggle="tab">{{Informations}}</a></li>
    <li role="presentation"><a href="#display" aria-controls="messages" role="tab" data-toggle="tab">{{Affichage avancé}}</a></li>
</ul>

<div class="tab-content" id="div_displayEqLogicConfigure">
   <div role="tabpanel" class="tab-pane active" id="information">
       <br/>
       <div class="row">
        <div class="col-sm-4" >
            <form class="form-horizontal">
                <fieldset>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">{{ID}}</label>
                        <div class="col-sm-4">
开发者ID:GaelGRIFFON,项目名称:core,代码行数:31,代码来源:eqLogic.configure.php

示例11: getLink

 public function getLink()
 {
     if ($this->getLink_type() == 'eqLogic') {
         $eqLogic = eqLogic::byId($this->getLink_id());
         return $eqLogic;
     } else {
         if ($this->getLink_type() == 'scenario') {
             $scenario = scenario::byId($this->getLink_id());
             return $scenario;
         }
     }
     return null;
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:13,代码来源:plan.class.php

示例12: foreach

             foreach ($eqLogic->getCmd() as $cmd) {
                 $info_cmd = utils::o2a($cmd);
                 if ($cmd->getType() == 'info') {
                     $info_cmd['value'] = $cmd->execCmd();
                     $info_cmd['collectDate'] = $cmd->getCollectDate();
                 }
                 $info_cmds[] = $info_cmd;
             }
             $info_eqLogic = utils::o2a($eqLogic);
             $info_eqLogic['cmds'] = $info_cmds;
             $info_eqLogics[] = $info_eqLogic;
         }
         $return[$eqType] = $info_eqLogics;
     }
     foreach ($params['id'] as $id) {
         $eqLogic = eqLogic::byId($id);
         $info_cmds = array();
         foreach ($eqLogic->getCmd() as $cmd) {
             $info_cmd = utils::o2a($cmd);
             if ($cmd->getType() == 'info') {
                 $info_cmd['value'] = $cmd->execCmd();
                 $info_cmd['collectDate'] = $cmd->getCollectDate();
             }
             $info_cmds[] = $info_cmd;
         }
         $info_eqLogic = utils::o2a($eqLogic);
         $info_eqLogic['cmds'] = $info_cmds;
         $return[$id] = $info_eqLogic;
     }
     $jsonrpc->makeSuccess($return);
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:31,代码来源:jeeApi.php

示例13: clean

 public static function clean()
 {
     $sql = "DELETE FROM `cache`  WHERE (UNIX_TIMESTAMP(`datetime`) + lifetime) < UNIX_TIMESTAMP(NOW()) AND lifetime > 0";
     DB::Prepare($sql, array(), DB::FETCH_TYPE_ROW);
     $sql = "SELECT * FROM `cache`  WHERE `key` LIKE 'cmd%' AND lifetime = 0";
     $results = DB::Prepare($sql, array(), DB::FETCH_TYPE_ALL);
     foreach ($results as $result) {
         $id = str_replace('cmd', '', $result['key']);
         if (is_numeric($id)) {
             $cmd = cmd::byId($id);
             if (!is_object($cmd)) {
                 $sql = "DELETE FROM `cache`  WHERE `key`=:key";
                 $value = array('key' => $result['key']);
                 DB::Prepare($sql, $value, DB::FETCH_TYPE_ROW);
             }
         }
     }
     $sql = "SELECT * FROM `cache`  WHERE `key` LIKE 'core::eqLogic%::lastCommunication'";
     $results = DB::Prepare($sql, array(), DB::FETCH_TYPE_ALL);
     foreach ($results as $result) {
         $id = str_replace(array('core::eqLogic', '::lastCommunication'), '', $result['key']);
         if (is_numeric($id)) {
             $eqLogic = eqLogic::byId($id);
             if (!is_object($eqLogic)) {
                 $sql = "DELETE FROM `cache`  WHERE `key`=:key";
                 $value = array('key' => $result['key']);
                 DB::Prepare($sql, $value, DB::FETCH_TYPE_ROW);
             }
         }
     }
     $sql = "SELECT * FROM `cache`  WHERE `key` LIKE 'core::eqLogic%::numberTryWithoutSuccess'";
     $results = DB::Prepare($sql, array(), DB::FETCH_TYPE_ALL);
     foreach ($results as $result) {
         $id = str_replace(array('core::eqLogic', '::numberTryWithoutSuccess'), '', $result['key']);
         if (is_numeric($id)) {
             $eqLogic = eqLogic::byId($id);
             if (!is_object($eqLogic)) {
                 $sql = "DELETE FROM `cache`  WHERE `key`=:key";
                 $value = array('key' => $result['key']);
                 DB::Prepare($sql, $value, DB::FETCH_TYPE_ROW);
             }
         }
     }
     $sql = "SELECT * FROM `cache`  WHERE `key` LIKE 'core::eqLogic%::numberTryWithoutSuccess'";
     $results = DB::Prepare($sql, array(), DB::FETCH_TYPE_ALL);
     foreach ($results as $result) {
         $id = str_replace(array('core::eqLogic', '::numberTryWithoutSuccess'), '', $result['key']);
         if (is_numeric($id)) {
             $eqLogic = eqLogic::byId($id);
             if (!is_object($eqLogic)) {
                 $sql = "DELETE FROM `cache`  WHERE `key`=:key";
                 $value = array('key' => $result['key']);
                 DB::Prepare($sql, $value, DB::FETCH_TYPE_ROW);
             }
         }
     }
     $sql = "SELECT * FROM `cache`  WHERE `key` LIKE 'widgetHtmldashboard%'";
     $results = DB::Prepare($sql, array(), DB::FETCH_TYPE_ALL);
     foreach ($results as $result) {
         $id = str_replace(array('widgetHtmldashboard'), '', $result['key']);
         if (is_numeric($id)) {
             $eqLogic = eqLogic::byId($id);
             if (!is_object($eqLogic)) {
                 $sql = "DELETE FROM `cache`  WHERE `key`=:key";
                 $value = array('key' => $result['key']);
                 DB::Prepare($sql, $value, DB::FETCH_TYPE_ROW);
             }
         }
     }
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:70,代码来源:cache.class.php

示例14: cron30

 public static function cron30($_eqlogic_id = null)
 {
     if ($_eqlogic_id !== null) {
         $eqLogics = array(eqLogic::byId($_eqlogic_id));
     } else {
         $eqLogics = eqLogic::byType('wazeintime');
     }
     foreach ($eqLogics as $wazeintime) {
         if ($wazeintime->getIsEnable() == 1) {
             log::add('wazeintime', 'debug', 'Pull Cron pour Waze Duration');
             $latdepart = $wazeintime->getConfiguration('latdepart');
             $londepart = $wazeintime->getConfiguration('londepart');
             $latarrive = $wazeintime->getConfiguration('latarrive');
             $lonarrive = $wazeintime->getConfiguration('lonarrive');
             if ($wazeintime->getConfiguration('NOA')) {
                 $row = '';
             } else {
                 $row = 'row-';
             }
             $wazeRouteurl = "https://www.waze.com/" . $row . "RoutingManager/routingRequest?from=x%3A{$londepart}+y%3A{$latdepart}&to=x%3A{$lonarrive}+y%3A{$latarrive}&at=0&returnJSON=true&returnGeometries=true&returnInstructions=true&timeout=60000&nPaths=3&options=AVOID_TRAILS%3At";
             log::add('wazeintime', 'debug', $wazeRouteurl);
             $wazeRoutereturl = "https://www.waze.com/" . $row . "RoutingManager/routingRequest?from=x%3A{$lonarrive}+y%3A{$latarrive}&to=x%3A{$londepart}+y%3A{$latdepart}&at=0&returnJSON=true&returnGeometries=true&returnInstructions=true&timeout=60000&nPaths=3&options=AVOID_TRAILS%3At";
             $routeResponseText = file_get_contents($wazeRouteurl);
             $routeResponseJson = json_decode($routeResponseText, true);
             $route1Name = isset($routeResponseJson['alternatives'][0]['response']['routeName']) ? $routeResponseJson['alternatives'][0]['response']['routeName'] : "NA";
             $route2Name = isset($routeResponseJson['alternatives'][1]['response']['routeName']) ? $routeResponseJson['alternatives'][1]['response']['routeName'] : "NA";
             $route3Name = isset($routeResponseJson['alternatives'][2]['response']['routeName']) ? $routeResponseJson['alternatives'][2]['response']['routeName'] : "NA";
             $route1 = $routeResponseJson['alternatives'][0]['response']['results'];
             $route2 = $routeResponseJson['alternatives'][1]['response']['results'];
             $route3 = $routeResponseJson['alternatives'][2]['response']['results'];
             $route1TotalTimeSec = 0;
             foreach ($route1 as $street) {
                 $route1TotalTimeSec += $street['crossTime'];
             }
             $route2TotalTimeSec = 0;
             foreach ($route2 as $street) {
                 $route2TotalTimeSec += $street['crossTime'];
             }
             $route3TotalTimeSec = 0;
             foreach ($route3 as $street) {
                 $route3TotalTimeSec += $street['crossTime'];
             }
             $route1TotalTimeMin = round($route1TotalTimeSec / 60);
             $route2TotalTimeMin = round($route2TotalTimeSec / 60);
             $route3TotalTimeMin = round($route3TotalTimeSec / 60);
             $routeretResponseText = file_get_contents($wazeRoutereturl);
             $routeretResponseJson = json_decode($routeretResponseText, true);
             $route1retName = isset($routeretResponseJson['alternatives'][0]['response']['routeName']) ? $routeretResponseJson['alternatives'][0]['response']['routeName'] : "NA";
             $route2retName = isset($routeretResponseJson['alternatives'][1]['response']['routeName']) ? $routeretResponseJson['alternatives'][1]['response']['routeName'] : "NA";
             $route3retName = isset($routeretResponseJson['alternatives'][2]['response']['routeName']) ? $routeretResponseJson['alternatives'][2]['response']['routeName'] : "NA";
             $routeret1 = $routeretResponseJson['alternatives'][0]['response']['results'];
             $routeret2 = $routeretResponseJson['alternatives'][1]['response']['results'];
             $routeret3 = $routeretResponseJson['alternatives'][2]['response']['results'];
             $route1retTotalTimeSec = 0;
             foreach ($routeret1 as $street) {
                 $route1retTotalTimeSec += $street['crossTime'];
             }
             $route2retTotalTimeSec = 0;
             foreach ($routeret2 as $street) {
                 $route2retTotalTimeSec += $street['crossTime'];
             }
             $route3retTotalTimeSec = 0;
             foreach ($routeret3 as $street) {
                 $route3retTotalTimeSec += $street['crossTime'];
             }
             $route1retTotalTimeMin = round($route1retTotalTimeSec / 60);
             $route2retTotalTimeMin = round($route2retTotalTimeSec / 60);
             $route3retTotalTimeMin = round($route3retTotalTimeSec / 60);
             foreach ($wazeintime->getCmd('info') as $cmd) {
                 switch ($cmd->getName()) {
                     case 'Durée 1':
                         $value = $route1TotalTimeMin;
                         break;
                     case 'Durée 2':
                         $value = $route2TotalTimeMin;
                         break;
                     case 'Durée 3':
                         $value = $route3TotalTimeMin;
                         break;
                     case 'Trajet 1':
                         $value = $route1Name;
                         break;
                     case 'Trajet 2':
                         $value = $route2Name;
                         break;
                     case 'Trajet 3':
                         $value = $route3Name;
                         break;
                     case 'Durée retour 1':
                         $value = $route1retTotalTimeMin;
                         break;
                     case 'Durée retour 2':
                         $value = $route2retTotalTimeMin;
                         break;
                     case 'Durée retour 3':
                         $value = $route3retTotalTimeMin;
                         break;
                     case 'Trajet retour 1':
                         $value = $route1retName;
                         break;
//.........这里部分代码省略.........
开发者ID:eliovir,项目名称:plugin-wazeintime,代码行数:101,代码来源:wazeintime.class.php

示例15: Copyright

/*
 Uploadify v3.1.0
 Copyright (c) 2012 Reactive Apps, Ronnie Garcia
 Released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
die;
require_once dirname(__FILE__) . "/../../core/php/core.inc.php";
if (!empty($_FILES) && isset($_GET['id']) && isset($_GET['type'])) {
    $fileTypes = array('jpg', 'jpeg', 'gif', 'png');
    // File extensions
    $fileParts = pathinfo($_FILES['Filedata']['name']);
    if (in_array(strtolower($fileParts['extension']), $fileTypes)) {
        switch ($_GET['type']) {
            case "eqLogic":
                $eqLogic = eqLogic::byId($_GET['id']);
                if (!is_object($eqLogic)) {
                    error_log('EqLogic inconnu verifié l\'id');
                    return false;
                }
                $eqLogic->saveImage(getUploadedImage(200, 150));
                break;
            case "object":
                $object = object::byId($_GET['id']);
                if (!is_object($object)) {
                    error_log('Object inconnu verifié l\'id');
                    return false;
                }
                $object->saveImage(getUploadedImage());
                break;
            default:
开发者ID:GaelGRIFFON,项目名称:core,代码行数:30,代码来源:uploadify.php


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