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


PHP jeedom::fromHumanReadable方法代码示例

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


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

示例1: save

 public function save()
 {
     if ($this->getQuery() == '') {
         throw new Exception(__('La commande (demande) ne peut pas être vide', __FILE__));
     }
     $this->setLink_id(str_replace('#', '', jeedom::fromHumanReadable($this->getLink_id())));
     return DB::save($this);
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:8,代码来源:interactDef.class.php

示例2: setOptions

 public function setOptions($_key, $_value)
 {
     $this->options = utils::setJsonAttr($this->options, $_key, jeedom::fromHumanReadable($_value));
 }
开发者ID:jimibi,项目名称:core,代码行数:4,代码来源:scenarioExpression.class.php

示例3: count

     $result['nbInteractQuery'] = count(interactQuery::byInteractDefId($result['id']));
     $result['nbEnableInteractQuery'] = count(interactQuery::byInteractDefId($result['id'], true));
     if ($result['link_type'] == 'cmd' && $result['link_id'] != '') {
         $link_id = '';
         foreach (explode('&&', $result['link_id']) as $cmd_id) {
             $cmd = cmd::byId($cmd_id);
             if (is_object($cmd)) {
                 $link_id .= cmd::cmdToHumanReadable('#' . $cmd->getId() . '# && ');
             }
         }
         $result['link_id'] = trim(trim($link_id), '&&');
     }
     ajax::success(jeedom::toHumanReadable($result));
 }
 if (init('action') == 'save') {
     $interact_json = jeedom::fromHumanReadable(json_decode(init('interact'), true));
     if (isset($interact_json['id'])) {
         $interact = interactDef::byId($interact_json['id']);
     }
     if (!isset($interact) || !is_object($interact)) {
         $interact = new interactDef();
     }
     utils::a2o($interact, $interact_json);
     $interact->save();
     ajax::success(utils::o2a($interact));
 }
 if (init('action') == 'regenerateInteract') {
     interactDef::regenerateInteract();
     ajax::success();
 }
 if (init('action') == 'remove') {
开发者ID:GaelGRIFFON,项目名称:core,代码行数:31,代码来源:interact.ajax.php

示例4: Exception

         throw new Exception(__('Cmd ID inconnu : ', __FILE__) . init('id'));
     }
     $return = jeedom::toHumanReadable(utils::o2a($cmd));
     $eqLogic = $cmd->getEqLogic();
     $return['eqLogic_name'] = $eqLogic->getName();
     $return['plugin'] = $eqLogic->getEqType_Name();
     if ($eqLogic->getObject_id() > 0) {
         $return['object_name'] = $eqLogic->getObject()->getName();
     }
     ajax::success($return);
 }
 if (init('action') == 'save') {
     if (!isConnect('admin')) {
         throw new Exception(__('401 - Accès non autorisé', __FILE__));
     }
     $cmd_ajax = jeedom::fromHumanReadable(json_decode(init('cmd'), true));
     $cmd = cmd::byId($cmd_ajax['id']);
     if (!is_object($cmd)) {
         $cmd = new cmd();
     }
     utils::a2o($cmd, $cmd_ajax);
     $cmd->save();
     ajax::success();
 }
 if (init('action') == 'changeHistoryPoint') {
     if (!isConnect('admin')) {
         throw new Exception(__('401 - Accès non autorisé', __FILE__));
     }
     $history = history::byCmdIdDatetime(init('cmd_id'), init('datetime'));
     if (!is_object($history)) {
         throw new Exception(__('Aucun point ne correspond pour l\'historique : ', __FILE__) . init('cmd_id') . ' - ' . init('datetime'));
开发者ID:saez0pub,项目名称:core,代码行数:31,代码来源:cmd.ajax.php

示例5: array

     $dbList = $typeCmd::byEqLogicId($eqLogic->getId());
     $eqLogic->save();
     $enableList = array();
     if (isset($params['cmd'])) {
         $cmd_order = 0;
         foreach ($params['cmd'] as $cmd_info) {
             $cmd = null;
             if (isset($cmd_info['id'])) {
                 $cmd = $typeCmd::byId($cmd_info['id']);
             }
             if (!is_object($cmd)) {
                 $cmd = new $typeCmd();
             }
             $cmd->setEqLogic_id($eqLogic->getId());
             $cmd->setOrder($cmd_order);
             utils::a2o($cmd, jeedom::fromHumanReadable($cmd_info));
             $cmd->save();
             $cmd_order++;
             $enableList[$cmd->getId()] = true;
         }
         //suppression des entrées inexistante.
         foreach ($dbList as $dbObject) {
             if (!isset($enableList[$dbObject->getId()]) && !$dbObject->dontRemoveCmd()) {
                 $dbObject->remove();
             }
         }
     }
     $jsonrpc->makeSuccess(utils::o2a($eqLogic));
 }
 if ($jsonrpc->getMethod() == 'eqLogic::byTypeAndId') {
     $return = array();
开发者ID:GaelGRIFFON,项目名称:core,代码行数:31,代码来源:jeeApi.php

示例6: foreach

     foreach ($backups as $backup) {
         $return[$backup_dir . '/' . $backup] = $backup;
     }
     ajax::success($return);
 }
 if (init('action') == 'addKey') {
     $jeeNetwork = jeeNetwork::byId(init('id'));
     if (!is_object($jeeNetwork)) {
         throw new Exception(__('JeeNetwork inconnu, vérifiez l\'ID : ', __FILE__) . init('id'));
     }
     $values = json_decode(init('value'), true);
     foreach ($values as $key => $value) {
         if ($key == 'market::password' && !preg_match('/^[0-9a-f]{40}$/i', $value)) {
             $value = sha1($value);
         }
         $jeeNetwork->configSave($key, jeedom::fromHumanReadable($value), init('plugin', 'core'));
     }
     ajax::success();
 }
 if (init('action') == 'getKey') {
     $jeeNetwork = jeeNetwork::byId(init('id'));
     if (!is_object($jeeNetwork)) {
         throw new Exception(__('JeeNetwork inconnu, vérifiez l\'ID : ', __FILE__) . init('id'));
     }
     $keys = init('key');
     if ($keys == '') {
         throw new Exception(__('Aucune clef demandée', __FILE__));
     }
     if (is_json($keys)) {
         $keys = json_decode($keys, true);
         $return = array();
开发者ID:GaelGRIFFON,项目名称:core,代码行数:31,代码来源:jeeNetwork.ajax.php

示例7: Exception

 $eqLogic = null;
 if (isset($eqLogicSave['id'])) {
     $eqLogic = $typeEqLogic::byId($eqLogicSave['id']);
 }
 if (!is_object($eqLogic)) {
     $eqLogic = new $typeEqLogic();
     $eqLogic->setEqType_name(init('type'));
 } else {
     if (!$eqLogic->hasRight('w')) {
         throw new Exception('Vous n\'etês pas autorisé à faire cette action');
     }
 }
 if (method_exists($eqLogic, 'preAjax')) {
     $eqLogic->preAjax();
 }
 $eqLogicSave = jeedom::fromHumanReadable($eqLogicSave);
 utils::a2o($eqLogic, $eqLogicSave);
 $dbList = $typeCmd::byEqLogicId($eqLogic->getId());
 $eqLogic->save();
 $enableList = array();
 if (isset($eqLogicSave['cmd'])) {
     $cmd_order = 0;
     foreach ($eqLogicSave['cmd'] as $cmd_info) {
         $cmd = null;
         if (isset($cmd_info['id'])) {
             $cmd = $typeCmd::byId($cmd_info['id']);
         }
         if (!is_object($cmd)) {
             $cmd = new $typeCmd();
         }
         $cmd->setEqLogic_id($eqLogic->getId());
开发者ID:saez0pub,项目名称:core,代码行数:31,代码来源:eqLogic.ajax.php

示例8: Exception

     nodejs::updateKey();
     ajax::success(config::byKey('nodeJsKey'));
 }
 if (init('action') == 'getNodeJsKey') {
     ajax::success(config::byKey('nodeJsKey'));
 }
 if (init('action') == 'addKey') {
     if (!isConnect('admin')) {
         throw new Exception(__('401 - Accès non autorisé', __FILE__));
     }
     $values = json_decode(init('value'), true);
     foreach ($values as $key => $value) {
         if ($key == 'market::password' && !preg_match('/^[0-9a-f]{40}$/i', $value)) {
             $value = sha1($value);
         }
         config::save($key, jeedom::fromHumanReadable($value), init('plugin', 'core'));
         if ($key == 'internalAddr') {
             jeeNetwork::pull();
         }
         if ($key == 'market::allowDNS') {
             if ($value == 1) {
                 if (!network::dns_run()) {
                     network::dns_start();
                 }
             } else {
                 if (network::dns_run()) {
                     network::dns_stop();
                 }
             }
         }
     }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:31,代码来源:config.ajax.php

示例9: dirname

    require_once dirname(__FILE__) . '/../../../../core/php/core.inc.php';
    include_file('core', 'authentification', 'php');
    if (!isConnect('admin')) {
        throw new Exception('401 Unauthorized');
    }
    if (init('action') == 'get') {
        $return = array();
        $eqLogic = eqLogic::byId(init('id'));
        if (!is_object($eqLogic)) {
            throw new Exception('Equipement non trouvé vérifiez l\'id : ' . init('id'));
        }
        $return['eqLogic'] = utils::o2a($eqLogic);
        $energy = energy::byEqLogic_id($eqLogic->getId());
        $return['energy'] = is_object($energy) ? jeedom::toHumanReadable(utils::o2a($energy)) : array('eqLogic_id' => $eqLogic->getId(), 'id' => '');
        ajax::success($return);
    }
    if (init('action') == 'save') {
        $energy_json = json_decode(init('energy'), true);
        $energy = energy::byId($energy_json['id']);
        if (!is_object($energy)) {
            $energy = new energy();
        }
        utils::a2o($energy, jeedom::fromHumanReadable($energy_json));
        $energy->save();
        ajax::success();
    }
    throw new Exception('Aucune methode correspondante');
    /*     * *********Catch exeption*************** */
} catch (Exception $e) {
    ajax::error(displayExeption($e), $e->getCode());
}
开发者ID:Wators,项目名称:jeedom_plugins,代码行数:31,代码来源:energy.ajax.php


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