* 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');
$nabaztag = nabaztag::byId($id);
if (!is_object($nabaztag)) {
    throw new Exception(__('Aucun equipement ne  correspond : Il faut (re)-enregistrer l\'équipement ', __FILE__) . init('action'));
}
?>
<div id='div_microNabaztagAlert' style="display: none;"></div>
<div>
	<textarea class="form-control ta_ttsMessage" placeholder="{{Message...}}" rows="10"></textarea><br/>
	<a class="btn btn-success bt_ttsNabaztag pull-right"><i class="fa fa-check-circle"></i> {{Lire le message}}</a>
</div>
<script>
	$('.bt_ttsNabaztag').on('click', function() {
		var that = $(this);
		$.ajax({// fonction permettant de faire de l'ajax
			type: "POST", // methode de transmission des données au fichier php
			url: "plugins/nabaztag/core/ajax/nabaztag.ajax.php", // url du fichier php
Example #2
0
 *
 * You should have received a copy of the GNU General Public License
 * along with Jeedom. If not, see <http://www.gnu.org/licenses/>.
 */
try {
    require_once dirname(__FILE__) . '/../../../../core/php/core.inc.php';
    include_file('core', 'authentification', 'php');
    if (!isConnect('admin')) {
        throw new Exception(__('401 - Accès non autorisé', __FILE__));
    }
    ajax::init();
    if (init('action') == 'tts') {
        if (init('message') == '') {
            throw new Exception(__('Veuillez saisir un message', __FILE__));
        }
        $nabaztag = nabaztag::byId(init('id'));
        if (!is_object($nabaztag)) {
            throw new Exception(__('Nabaztag non trouvé', __FILE__));
        }
        $cmd = $nabaztag->getCmd(null, 'speak');
        if (!is_object($cmd)) {
            throw new Exception(__('Commande non trouvée', __FILE__));
        }
        $cmd->execCmd(array('message' => init('message')));
        ajax::success();
    }
    throw new Exception(__('Aucune méthode correspondante à : ', __FILE__) . init('action'));
    /*     * *********Catch exeption*************** */
} catch (Exception $e) {
    ajax::error(displayExeption($e), $e->getCode());
}