Avaible -> Available

This commit is contained in:
Matteo Gheza 2020-07-03 11:38:41 +02:00
parent ca148c3339
commit 0db26731f5
17 changed files with 32 additions and 32 deletions

View File

@ -394,12 +394,12 @@ class user{
return $profiles;
}
public function avaible($name){
$user = $this->database->exec("SELECT avaible FROM `%PREFIX%_users` WHERE name = :name;", true, [":name" => $name]);
public function available($name){
$user = $this->database->exec("SELECT available FROM `%PREFIX%_users` WHERE name = :name;", true, [":name" => $name]);
if(empty($user)){
return false;
} else {
return $user[0]["avaible"];
return $user[0]["available"];
}
}

View File

@ -265,7 +265,7 @@ CREATE TABLE IF NOT EXISTS `".$prefix."_profiles` (
`hidden` BOOLEAN NOT NULL DEFAULT FALSE,
`disabled` BOOLEAN NOT NULL DEFAULT FALSE,
`name` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`avaible` tinyint(1) NOT NULL DEFAULT 0,
`available` tinyint(1) NOT NULL DEFAULT 0,
`caposquadra` tinyint(1) NOT NULL DEFAULT 0,
`autista` tinyint(1) NOT NULL DEFAULT 0,
`telefono` varchar(25) DEFAULT NULL,

View File

@ -68,7 +68,7 @@ function array_combine_($keys, $values){
//print("<br><pre>" . print_r(array_combine_(explode(" - ", $a1), explode(" - ", $a2)), true) . "</pre><br>");
$sql = "SELECT * FROM %PREFIX%_profiles ORDER BY avaible DESC, caposquadra DESC, interventi ASC, name ASC"; // Pesco i dati della table e li ordino in base alla disponibilità
$sql = "SELECT * FROM %PREFIX%_profiles ORDER BY available DESC, caposquadra DESC, interventi ASC, name ASC"; // Pesco i dati della table e li ordino in base alla disponibilità
$risultato = $database->exec($sql, true);
$profiles_tot = array();
@ -76,7 +76,7 @@ $incremento = array();
$minuti_dispo_old = array();
foreach($risultato as $row){
$profiles_tot[] = $row['name'];
if($row['avaible'] == "1"){
if($row['available'] == "1"){
$incremento[] = $row['name'];
$minuti_dispo_old[] = $row['minuti_dispo'];
}
@ -93,11 +93,11 @@ foreach($incremento as $key=>$user){
$sql = "UPDATE %PREFIX%_profiles SET minuti_dispo = '" . $minuti_dispo . "' WHERE name ='" . $user . "'";
$risultato = $database->exec($sql, true);
}
$sql = "SELECT * FROM %PREFIX%_profiles ORDER BY avaible DESC, caposquadra DESC, interventi ASC, name ASC"; // Pesco i dati della table e li ordino in base alla disponibilità
$sql = "SELECT * FROM %PREFIX%_profiles ORDER BY available DESC, caposquadra DESC, interventi ASC, name ASC"; // Pesco i dati della table e li ordino in base alla disponibilità
$risultato = $database->exec($sql, true);
$minuti_dispo = array();
foreach($risultato as $row){
if($row['avaible'] == "1"){
if($row['available'] == "1"){
$minuti_dispo[] = $row['minuti_dispo'];
}
}

View File

@ -3,10 +3,10 @@ include_once '../../core.php';
init_class();
$user->requirelogin();
if(isset($_POST["change_id"]) && $_POST["dispo"] == 1){
$risultato = $database->exec("UPDATE `%PREFIX%_profiles` SET `avaible` = '1' WHERE `%PREFIX%_profiles`.`id` = :id;", false, [":id" => $_POST["change_id"]]);
$risultato = $database->exec("UPDATE `%PREFIX%_profiles` SET `available` = '1' WHERE `%PREFIX%_profiles`.`id` = :id;", false, [":id" => $_POST["change_id"]]);
$user->log("Attivazione disponibilita'", $_POST["change_id"], $user->auth->getUserId(), date("d/m/Y"), date("H:i.s"));
} else if(isset($_POST["change_id"]) && $_POST["dispo"] == 0){
$risultato = $database->exec("UPDATE `%PREFIX%_profiles` SET `avaible` = '0' WHERE `%PREFIX%_profiles`.`id` = :id;", false, [":id" => $_POST["change_id"]]);
$risultato = $database->exec("UPDATE `%PREFIX%_profiles` SET `available` = '0' WHERE `%PREFIX%_profiles`.`id` = :id;", false, [":id" => $_POST["change_id"]]);
$user->log("Rimozione disponibilita'", $_POST["change_id"], $user->auth->getUserId(), date("d/m/Y"), date("H:i.s"));
}
?>

View File

@ -318,11 +318,11 @@ foreach($risultato as $row){
$name = ($row['online']==1) ? '<u>' . $row['name'] . "</u>" : $row['name'];
echo("<h1>".t("Personal data",false)." <b>$name</b></h1><br><br>");
echo('<img alt="VVF" src="./risorse/images/distaccamento.png" width="150" class="img-resposive"><br><br><br>');
$disp = vero1($row['avaible'], "<i class='fa fa-check' style='color:green' width='22px'></i>", "<i class='fa fa-times' style='color:red' width='22px'></i>");
$disp = vero1($row['available'], "<i class='fa fa-check' style='color:green' width='22px'></i>", "<i class='fa fa-times' style='color:red' width='22px'></i>");
$caposquadra = vero1($row['caposquadra'], "<img src='./risorse/images/cascoRosso.png' width='22px'>", "<img src='./risorse/images/cascoNero.png' width='22px'>");
$autista = vero1($row['autista'], "<img src='./risorse/images/volante.png' width='22px'>");
echo("<p>".t("Name",false).": <b>$name</b></p><br>");
echo("<p>".t("Avaible",false).": <b>{$disp}</b></p><br>");
echo("<p>".t("Available",false).": <b>{$disp}</b></p><br>");
echo("<p>".t("Foreman",false).": <b>{$caposquadra}</b></p><br>");
echo("<p>".t("Driver",false).": <b>{$autista}</b></p><br>");
echo("<p>".t("Phone number",false)." <i class='fa fa-phone' style='color:green' width='22px'></i>: <b><a href='tel:{$row['telefono']}'>{$row['telefono']}</a></b></p><br>");

View File

@ -3,7 +3,7 @@ include_once("../../core.php");
init_class();
$user->requirelogin();
$users_sql = "SELECT `id`, `name`, `avaible`, `caposquadra`, `autista`, `telefono`, `interventi`, `esercitazioni`, `online`, `minuti_dispo`, `immagine` FROM `%PREFIX%_profiles` LIMIT 0 , 30";
$users_sql = "SELECT `id`, `name`, `available`, `caposquadra`, `autista`, `telefono`, `interventi`, `esercitazioni`, `online`, `minuti_dispo`, `immagine` FROM `%PREFIX%_profiles` LIMIT 0 , 30";
$users = $database->exec($users_sql, true);
$interventi_sql="SELECT * FROM `%PREFIX%_interventi` ORDER BY `interventi`.`id` DESC LIMIT 0 , 30";

View File

@ -7,11 +7,11 @@ $user->requirelogin();
function arraynum(){
global $database;
$risultato = $database->exec("SELECT * FROM `%PREFIX%_profiles` ORDER BY avaible DESC, caposquadra DESC, interventi ASC, name ASC", true); // Pesco i dati della table e li ordino in base alla disponibilità
$risultato = $database->exec("SELECT * FROM `%PREFIX%_profiles` ORDER BY available DESC, caposquadra DESC, interventi ASC, name ASC", true); // Pesco i dati della table e li ordino in base alla disponibilità
$incremento = array();
$minuti_dispo_old = array();
foreach($risultato as $row){
if($row['avaible'] == "1"){
if($row['available'] == "1"){
$incremento[] = $row['name'];
$minuti_dispo_old[] = $row['minuti_dispo'];
}

View File

@ -3,7 +3,7 @@ include_once("../../core.php");
init_class();
$user->requirelogin();
$risultato = $database->exec("SELECT * FROM `%PREFIX%_profiles` ORDER BY avaible DESC, caposquadra DESC, interventi ASC, minuti_dispo ASC, name ASC;", true);
$risultato = $database->exec("SELECT * FROM `%PREFIX%_profiles` ORDER BY available DESC, caposquadra DESC, interventi ASC, minuti_dispo ASC, name ASC;", true);
$hidden = $user->hidden();
?>
@ -41,7 +41,7 @@ th, td {
<table style="width: 90%; text-align:center;">
<tr>
<th><?php t("Name"); ?></th>
<th><?php t("Avaible"); ?></th>
<th><?php t("Available"); ?></th>
<?php
foreach($risultato as $row){
if(!in_array($row['name'], $hidden)){
@ -52,7 +52,7 @@ th, td {
} else {
echo "".$user->nameById($row["id"])."</td><td>";
}
if ($row['avaible'] == 1) {echo "<i class='fa fa-check' style='color:green'></i>";} else{echo "<i class='fa fa-times' style='color:red'></i>";};
if ($row['available'] == 1) {echo "<i class='fa fa-check' style='color:green'></i>";} else{echo "<i class='fa fa-times' style='color:red'></i>";};
echo "</td></tr>";
}
}

View File

@ -3,7 +3,7 @@ include_once("../../core.php");
init_class();
$user->requirelogin();
$risultato = $database->exec("SELECT * FROM `%PREFIX%_profiles` ORDER BY avaible DESC, caposquadra DESC, interventi ASC, minuti_dispo ASC, name ASC;", true);
$risultato = $database->exec("SELECT * FROM `%PREFIX%_profiles` ORDER BY available DESC, caposquadra DESC, interventi ASC, minuti_dispo ASC, name ASC;", true);
$hidden = $user->hidden();
?>
@ -39,7 +39,7 @@ th, td {
<table style="width: 90%; text-align:center;">
<tr>
<th><?php t("Name"); ?></th>
<th><?php t("Avaible"); ?></th>
<th><?php t("Available"); ?></th>
<th><?php t("Driver"); ?></th>
<th><?php t("Call"); ?></th>
<th><?php t("Write"); ?></th>
@ -52,8 +52,8 @@ th, td {
echo "<tr>
<td>";
$name = $user->nameById($row["id"]);
$callFunction = ($row['avaible'] == 1) ? "NonAttivo" : "Attivo";
$avaible = $row["avaible"];
$callFunction = ($row['available'] == 1) ? "NonAttivo" : "Attivo";
$available = $row["available"];
if ($row['caposquadra'] == 1) {
echo "<a onclick='$callFunction(".$row["id"].");'><img src='./risorse/images/cascoRosso.png' width='20px'> ";
} else {
@ -64,7 +64,7 @@ th, td {
} else {
echo $name."</a></td><td><a onclick='$callFunction(".$row["id"].");'>";
}
if ($row['avaible'] == 1) {
if ($row['available'] == 1) {
echo "<i class='fa fa-check' style='color:green'></i>";
} else {
echo "<i class='fa fa-times' style='color:red'></i>";
@ -79,7 +79,7 @@ th, td {
echo "</td>
<td><a href='tel:+" . $row['telefono'] . "'><i class='fa fa-phone'></i></a></td><td>";
//if ($row['avaible'] == 1) {
//if ($row['available'] == 1) {
$nome_url = urlencode($row['name']);
echo " <a href='https://api.whatsapp.com/send?phone=" . $row['telefono'] . "&text=ALLERTA IN CORSO.%20Mettiti%20in%20contatto%20con%20$nome_url'><i class='fa fa-whatsapp' style='color:green'></i></td>";
/*} else{

View File

@ -12,7 +12,7 @@ $(document).ready(function(){
console.log("cleaned");
}
db.version(1).stores({
users: '++id,name,avaible,caposquadra,autista,telefono,interventi,esercitazioni,online,minuti_dispo,immagine',
users: '++id,name,available,caposquadra,autista,telefono,interventi,esercitazioni,online,minuti_dispo,immagine',
interventi: '++id,data,codice,uscita,rientro,capo,autisti,personale,luogo,note,tipo,incrementa,inseritoda'
});
$.each( data.users, function( key, val ) {

View File

@ -4,7 +4,7 @@
[].map||(Array.prototype.map=function(a,b){for(var c=this,d=c.length,e=new Array(d),f=0;f<d;f++)f in c&&(e[f]=a.call(b,c[f],f,c));return e}),[].filter||(Array.prototype.filter=function(a){if(null==this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=arguments[1],f=0;f<c;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g)}return d}),[].indexOf||(Array.prototype.indexOf=function(a){if(null==this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!=d?d=0:0!==d&&d!=1/0&&d!=-1/0&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);e<c;e++)if(e in b&&b[e]===a)return e;return-1});/*!
* Cross-Browser Split 1.1.1
* Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
* avaible under the MIT License
* available under the MIT License
* http://blog.stevenlevithan.com/archives/cross-browser-split
*/
var nativeSplit=String.prototype.split,compliantExecNpcg=void 0===/()??/.exec("")[1];String.prototype.split=function(a,b){var c=this;if("[object RegExp]"!==Object.prototype.toString.call(a))return nativeSplit.call(c,a,b);var d,e,f,g,h=[],i=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.extended?"x":"")+(a.sticky?"y":""),j=0;for(a=new RegExp(a.source,i+"g"),c+="",compliantExecNpcg||(d=new RegExp("^"+a.source+"$(?!\\s)",i)),b=void 0===b?-1>>>0:b>>>0;(e=a.exec(c))&&!((f=e.index+e[0].length)>j&&(h.push(c.slice(j,e.index)),!compliantExecNpcg&&e.length>1&&e[0].replace(d,function(){for(var a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(e[a]=void 0)}),e.length>1&&e.index<c.length&&Array.prototype.push.apply(h,e.slice(1)),g=e[0].length,j=f,h.length>=b));)a.lastIndex===e.index&&a.lastIndex++;return j===c.length?!g&&a.test("")||h.push(""):h.push(c.slice(j)),h.length>b?h.slice(0,b):h};

View File

@ -3,7 +3,7 @@
{% block content %}
<br>
<div class="text-center">
<p>{{ 'Are you avaible in case of alert?'|t }}</p>
<p>{{ 'Are you available in case of alert?'|t }}</p>
<button class="btn btn-lg btn-success " onclick="Attivo('{{ user.id }}')">{{ 'Active'|t }}</button>
<button class="btn btn-lg btn-danger" style="background-color: red" onclick="NonAttivo('{{ user.id }}')">{{ 'Not Active'|t }}</button>

View File

@ -2,7 +2,7 @@
namespace Helper;
// here you can define custom actions
// all public methods declared in helper class will be avaible in $I
// all public methods declared in helper class will be available in $I
class Acceptance extends \Codeception\Module
{

View File

@ -4,7 +4,7 @@
return [
"Personal data" => "Personal data",
"Name" => "Name",
"Avaible" => "Avaible",
"Available" => "Available",
"Foreman" => "Foreman",
"Driver" => "Driver",
"Phone number" => "Phone number",

View File

@ -3,5 +3,5 @@
return [
"Name" => "Name",
"Avaible" => "Avaible"
"Available" => "Available"
];

View File

@ -3,7 +3,7 @@
return [
"Name" => "Name",
"Avaible" => "Avaible",
"Available" => "Available",
"Driver" => "Driver",
"Call" => "Call",
"Write" => "Write",

View File

@ -2,7 +2,7 @@
// Translated by: Name Surname (github, email or another social profile url/username)
return [
"Are you avaible in case of alert?" => "Are you avaible in case of alert?",
"Are you available in case of alert?" => "Are you available in case of alert?",
"Active" => "Active",
"Not Active" => "Not Active",
"Thanks, %s, you have given your availability in case of alert." => "Thanks, %s, you have given your availability in case of alert.",