Example #1
0
$Alexa = file_get_contents('php://input');
// $Alexa = print_r($_POST,true);
file_put_contents("/echo/alexa.log", date(DATE_ATOM) . " " . $Alexa . "\n", FILE_APPEND);
$jAlexa = json_decode($Alexa, true);
file_put_contents("/echo/alexa.log", date(DATE_ATOM) . " " . print_r($jAlexa, true) . "\n\n", FILE_APPEND);
if (!empty($Alexa)) {
    $reply = "";
    $type = $jAlexa["request"]["type"];
    file_put_contents("/echo/alexa.log", date(DATE_ATOM) . " " . "I think the intent is " . $intent . "\n", FILE_APPEND);
    if ($type = "IntentRequest") {
        $type = $jAlexa["request"]["intent"]["name"];
        $slots = $jAlexa["request"]["intent"]["slots"];
        $onoff = $slots["onoff"]["value"];
        $device = $slots["device"]["value"];
        $housecode = "a";
        $cmd = $housecode . wordsToNumber($device) . " " . $onoff;
        file_put_contents("/echo/alexa.cmd", $cmd);
        file_put_contents("/echo/alexa.log", date(DATE_ATOM) . " Sent " . $cmd . "\n", FILE_APPEND);
        $arrReply = array();
        $arrReply["version"] = "1.0";
        $arrReply["response"] = array("outputSpeech" => array("type" => "PlainText", "text" => $cmd));
        $arrReply["shouldEndSession"] = true;
        file_put_contents("/echo/alexa.log", date(DATE_ATOM) . " Sent " . print_r($arrReply, true) . "\n", FILE_APPEND);
        $reply = json_encode($arrReply);
        file_put_contents("/echo/alexa.log", date(DATE_ATOM) . " Sent " . $reply . "\n", FILE_APPEND);
    }
} else {
    file_put_contents("/echo/alexa.in", "Hmmm --- didn't get a post");
}
echo $reply;
?>
Example #2
0
echo $bill_no;
?>
 <?php 
if ($copy != 'original') {
    echo "-Duplicate Copy";
}
?>
</td><td align="right">Date: <?php 
echo date('d/m/y', strtotime($bill['bill_date']));
?>
</td></tr>
<tr><td >Vehicle No: <?php 
echo $bill['vehicle_number'];
?>
</td><td align="right">Counter :  <?php 
echo wordsToNumber($bill['counter']);
?>
</td></tr>
<?php 
if ($bill['indent_no'] != "NULL" || $bill['km_reading'] != "") {
    print "<tr>";
    if ($bill['indent_no'] != "NULL") {
        print "<td>Indent No: " . $bill['indent_no'] . " </td>";
    } else {
        print "<td></td>";
    }
    if ($bill['km_reading'] != "") {
        print "<td align='right'>KM Reading: " . $bill['km_reading'] . " </td>";
    } else {
        print "<td align='right'></td>";
    }
Example #3
0
 /**
  * Content::rendertCustomFields()
  * 
  * @param mixed $type
  * @param mixed $data
  * @param str $wrap
  * @param bool $labels
  * @return
  */
 public function rendertCustomFields($type, $data, $wrap = "two", $labels = true)
 {
     $html = '';
     if ($fdata = Registry::get("Database")->fetch_all("SELECT *" . "\n FROM " . self::fTable . "\n WHERE type = '" . $type . "'" . "\n AND active = 1" . "\n ORDER BY sorting")) {
         $value = $data ? explode("::", $data) : null;
         $group_nr = 1;
         $last_row = count($fdata) - 1;
         $wrapper = wordsToNumber($wrap);
         foreach ($fdata as $id => $cfrow) {
             if ($id % $wrapper == 0) {
                 $html .= '<div class="' . $wrap . ' fields">';
                 $i = 0;
                 $group_nr++;
             }
             $tip = $cfrow->tooltip ? $cfrow->tooltip : $cfrow->title;
             $html .= '<div class="field">';
             if ($labels) {
                 $html .= '<label>' . $cfrow->title . '</label>';
             }
             $html .= '<label class="input">';
             if ($cfrow->req) {
                 $html .= '<i class="icon-append icon asterisk"></i>';
             }
             $html .= '<input name="custom_' . $cfrow->name . '" type="text" placeholder="' . $tip . '" value="' . $value[$id] . '">';
             $html .= '</label>';
             $html .= '</div>';
             $i++;
             if ($i == $wrapper || $id == $last_row) {
                 $html .= '</div>';
             }
         }
         unset($cfrow);
     }
     return $html;
 }