function renderHeaders($headers, $sort, $route) { foreach ($headers as $k => $v) { echo '<th class="' . strtolower(sfInflector::underscore($k)) . '">'; $change_sort_type = $sort[0] == $k && $sort[1] == $v[1] ? toggleStatus($v[1]) : $v[1]; $class = $sort[0] == $k ? toggleStatus($change_sort_type) : null; echo link_to(__($v[0]), $route . '?sort[0]=' . $k . '&sort[1]=' . $change_sort_type, array('class' => $class)); echo '</th>'; } }
<?php $method = $_POST['method']; $status = (string) $_POST['status']; //Initialize if (isset($method) && isset($status) && $method != "init" && $method != "electstatus" && $method != "writetotxt" && $method != "readfromtext") { toggleStatus($method, $status); } function toggleStatus($method, $status) { system("gpio -g mode " . $method . " out"); system("gpio -g write " . $method . " " . $status); system("gpio -g read " . $method); } if (isset($method) && $method == "init") { init(); } else { if (isset($method) && $method == "electstatus") { electstatus(); } else { if (isset($method) && $method == "writetotxt") { $file = $_POST['file']; $status = $_POST['status']; writetotxt($file, $status); } else { if (isset($method) && $method == "readfromtext") { $content = (string) $_POST['content']; readfromtext($content); } } }