function sync_project($gtdProj){ #get all entries for that project #get staff, estimates and entries into arrays $staff = getStaff(); $hours = getHours($gtdProj['id']); $est = getEsts($gtdProj['id']); $items = getBasecampHours($gtdProj['basecamp']); $x=0; foreach ($items as $item) { #check entry to see if time entry enterned if (!$hours[$item->id]){ #echo 'no hour entry movin forward <br>'; #check to see if estimate is entered #echo 'est'.$est[$item->{'todo-item-id'}].'<br>' ; if (!$est[$item->{'todo-item-id'}] ){ #echo 'no est entry moving forward <br>'; #if no estimate create one $todo = getBasecampTodo($item->{'todo-item-id'}); addEstimate($item->{'todo-item-id'},$todo->content,$gtdProj['id']); #echo 'added estimate '.$todo->content.' '.$item->{'todo-item-id'}.'<br>'; } # add hours $est = getEsts($gtdProj['id']); addHours($item->{'id'}, $est[$item->{'todo-item-id'}], $staff[$item->{'person-id'}] ,$item->{'hours'}, $item->{'description'}, $item->{'date'}); #addHours($basecampID,$gtdEst,$gtdStaff,$hours,$desc,$date){ #echo 'added hour '.$staff[$item->{'person-id'}].' x '.$est[$item->{'todo-item-id'}].' <br>'; # echo $item->{'id'}.' '. $est[$item->{'todo-item-id'}].' '. $staff[$item->{'person-id'}] .' '.$item->{'hours'}.' '. $item->{'description'}.' '. $item->{'date'}.'<br> dd '; $hours = getHours($gtdProj['id']); #echo $item->description. ' entered <br><br><br>'; $x++; } } echo $x; }
<?php //receive the sms, phone, Message require_once 'connect.php'; $sms = getSmsInput(); $staff = getStaff($sms['message']); if ($staff['id'] != 0) { $reply = "ID is valid and it belongs to " . $staff['first_name'] . " " . $staff['last_name']; } else { $reply = "No Staff with that id"; } //$reply = "Thank you for your SMS"; sendSmsOutput($sms['from'], $reply); exit; //send back a message to the phone number_format function sendSmsOutput($number, $msg) { //lets add the variables to the records array if (is_array($msg)) { $records[0] = array('message' => $msg[0], 'to' => $number[0]); $records[1] = array('message' => $msg[1], 'to' => $number[1]); } else { $records[] = array('message' => $msg, 'to' => $number); } $sms_array = array(); $sms_array[] = array('success' => "true", 'secret' => "", 'task' => "send", 'messages' => $records); $payload = array('payload' => $sms_array[0]); header('content-type: application/json; charset=utf-8'); echo json_encode($payload); //mysql_close($connect); }
// titulo $title = 'Derivado a '. utf8_encode($seccion_res["nombre"]) . " desde " . utf8_encode($sector["nombre"]) . ", por <b>". $derivador_staff ."</b>"; $icon = 'replies'; ?> <li class="<?php echo $li_active; ?>"> <div class="timeline-icon"><i class="gi gi-share"></i></div> <div class="timeline-time"><?php echo date("d-m-Y",strtotime($val["data"]["fecha"])); ?> <strong><?php echo date("H:i",strtotime($val["data"]["fecha"])); ?></strong></div> <div class="timeline-content"> <p class="push-bit"><strong>Derivación</strong></p> <?php echo $title; ?> </div> </li> <?php } elseif ( $val["data"]["alarma"] != 0 ) { // staff $creador = getStaff( $val["data"]["staff_id"] ); $derivador_staff = utf8_encode($creador["nombre"]); // titulo $title = 'Derivado a '. utf8_encode($seccion_res["nombre"]) . " desde " . utf8_encode($sector["nombre"]) . ", por <b>". $derivador_staff ."</b>"; $icon = 'replies'; ?> <li class="active"> <div class="timeline-icon"><i class="gi gi-alarm"></i></div> <div class="timeline-time"><?php echo date("d-m-Y",strtotime($val["data"]["fecha"])); ?> <strong><?php echo date("H:i",strtotime($val["data"]["fecha"])); ?></strong></div> <div class="timeline-content"> <p class="push-bit"><strong>Alarma</strong></p> Fecha de Aviso: <b><?php echo date("d-m-Y H:i",strtotime($var_alarma_aviso)); ?></b><br/> Fecha de Inicio: <b><?php echo date("d-m-Y H:i",strtotime($var_alarma_fecha)); ?></b> </div> </li> <?php
<div class="form-group"> <label for="sector" class="control-label">Sector <span class="required">*</span></label> <select id="seccion" name="seccion_old" class="form-control" onchange="cargarTipoTramite(this.value);$('.clientePotencialDiv').hide();"> <option></option> <?php // por ahora afuera liquidacion de alquileres y gerencia $sql = "select * from acsa_sector where id!=5 and id!=7 order by id"; $rs = executeSelect($sql, $conn); while ($row = mysql_fetch_array($rs)) { $options = "<option value='" . $row['id'] . "'>" . utf8_encode($row['nombre']) . "</option>\n"; echo $options; } mysql_free_result($rs); // marco el sector del operador por defecto $staff = getStaff($var_staffid); // si el operador no es staff, entonces marco el sector del operador logueado. Si es staff, habilito todos if ($var_staffid != 1 and $var_staffid != 2) { ?> <script> // marco el sector del operador por defecto $("document").ready(function(){ $( "#seccion option[value=<?php echo $staff['sector_id']; ?> ]" ).attr( 'selected', true ); $( "#seccion").attr( "disabled", true ); $( "#seccion").attr( "name", 'seccion_old' ); cargarTipoTramite(<?php echo $staff['sector_id']; ?>
function getMenu1($input) { switch ($input) { case 1: $response = "Please enter your names"; break; case 2: $result = getStaff($phoneNumber); $phonecheck = $result['phoneNumber']; if ($phoneNumber == $phonecheck) { $response = getHomeMenu2(); sendOutput($response, 2); exit; } $response = "Please register as you aren't in our records"; break; default: getHomeMenu(); break; } sendOutput($response, 1); return $response; }
</td> <?php $query_q = "SELECT * FROM questions"; $value_q = mysql_query($query_q) or die(mysql_error()); while ($data_q = mysql_fetch_assoc($value_q)) { if ($data_q['ID'] == $data_introduction['ID']) { ?> <td><?php echo $data_q['b2']; ?> </td> <?php } } getStaff($data_introduction); $query_q = "SELECT * FROM questions"; $value_q = mysql_query($query_q) or die(mysql_error()); while ($data_q = mysql_fetch_assoc($value_q)) { if ($data_q['ID'] == $data_introduction['ID']) { ?> <td><?php echo $data_q['d4']; ?> </td> <td><?php echo $data_q['e5']; ?> </td> <td><?php echo $data_q['f6'];
public function filtrosPost($post) { // buscar if ($post["referencia"] != '') { $this->_filtros .= " AND t.vRefNo = '" . $post["referencia"] . "'"; } if (isset($post["sector"]) && !empty($post["sector"]) && $post["sector"] > 0) { $this->_filtros .= " AND t.seccion_id = '" . $post["sector"] . "' "; } if ($post["tipo_tramite"] != '') { $this->_filtros .= " AND t.tipo_tramite_id = '" . $post["tipo_tramite"] . "'"; } if ($post["operador"] != '') { $this->_filtros .= " AND t.nOwner = '" . $post["operador"] . "'"; } if ($post["derivado"] != '') { $this->_filtros .= " AND t.sector_id_derivado = '" . $post["derivado"] . "'"; } if ($post["ubicacion"] == "filtros" && $post["contrato"] != '') { $this->_filtros .= " AND t.contratoTotvs LIKE '%" . $post["contrato"] . "%'"; } if ($post["totvs"] != '') { $this->_filtros .= " AND ( u.userIdAcsa = '" . $post["totvs"] . "' OR u_dos.userIdAcsa = '" . $post["totvs"] . "' )"; } if ($post["cliente"] != '') { $this->_filtros .= " AND ( u.vUserName LIKE '%" . $post["cliente"] . "%' OR u_dos.vUserName LIKE '%" . $post["cliente"] . "%' )"; } if ($post["cliente_direccion"] != '') { $this->_filtros .= " AND ( u.vDireccion LIKE '%" . $post["cliente_direccion"] . "%' OR u_dos.vDireccion LIKE '%" . $post["cliente_direccion"] . "%' OR prop.direccion LIKE '%" . $post["cliente_direccion"] . "%' )"; } // if ( $post["suscriptor"] != '' ) $this->_filtros.= " AND rp.nStaffId = '" . $post["suscriptor"] . "' AND t.nOwner <> '" . $post["suscriptor"] . "'"; if ($post["suscriptor"] != '') { $this->_filtros .= " AND EXISTS (SELECT * FROM sptbl_replies r WHERE r.nTicketId=t.nTicketId AND r.nStaffId = '" . $post["suscriptor"] . "' )"; } if ($post["sucursal"] != '') { $this->_filtros .= " AND prop.sucursal = '" . $post["sucursal"] . "'"; } if ($post["direccion_prop"] != '') { $this->_filtros .= " AND prop.direccion LIKE '%" . $post["direccion_prop"] . "%'"; } // estado //if ( $post["estado"] == "o" ) $this->_filtros .= " AND t.vStatus='open' AND FIND_IN_SET('". $post["staffid"] ."', vViewers) "; $staff = getStaff($post["staffid"]); //if ( $post["estado"] == "n" ) $this->_filtros .= " AND t.vStatus='open' AND FIND_IN_SET('". $staff['sector_id'] ."', vViewersSector) "; if ($post["estado"] == "o" || $post["estado"] == 'o') { $this->_filtros .= " AND t.vStatus='open' "; } elseif ($post["estado"] == "n" || $post["estado"] == 'n') { $this->_filtros .= " AND t.vStatus='open' AND vViewersSector NOT LIKE ('%" . $staff['sector_id'] . "%')"; } elseif ($post["estado"] == "c" || $post["estado"] == 'c') { $this->_filtros .= " AND t.vStatus='closed' "; } elseif ($post["estado"] == "e") { $this->_filtros .= " AND t.vStatus='escalated' "; } elseif ($post["estado"] == "f") { $this->_filtros .= " AND t.nTicketId IN ( SELECT nTicketId FROM sptbl_follow_tickets WHERE nStaffId = '" . $post["staffid"] . "' AND vStaffType = 'S') "; } elseif ($post["estado"] == "h") { $this->_filtros .= " AND t.nTicketId IN ( SELECT nTicketId FROM sptbl_replies WHERE nHold = '1' ) "; } elseif ($post["estado"] == "a") { $this->_filtros .= " "; } // fechas if ($post["txtFrom"] != '' and $post["txtTo"] != '') { $this->_fechas = "AND dPostDate BETWEEN '" . $post["txtFrom"] . "' AND '" . $post["txtTo"] . "'"; } // alarma //if ( $post["estado"] == "al" ) $this->_filtros .= " AND t.vStatus='open' AND t.alarmaFecha >= '". date('Y-m-d H:i:s') ."' "; if ($post["estado"] == "al") { $this->_filtros .= " AND t.alarmaFecha != '0000-00-00 00:00:00' "; } // else $this->_filtros .= " AND (t.alarmaFecha IS NULL OR t.alarmaFecha = '0000-00-00 00:00:00' OR t.alarmaFecha <= '". date('Y-m-d H:i:s') ."')"; // si busco por algún dato, que no sea el estado, ordeno con los cerrados abajo if ($post["tipo_tramite"] != '' or $post["operador"] != '' or $post["derivado"] != '' or $post["contrato"] != '' or $post["totvs"] != '' or $post["cliente"] != '' or $post["cliente_direccion"] != '') { $this->_ordenCerrados = 1; } else { $this->_ordenCerrados = 0; } // joins inteligentes if ($post["sucursal"] != '' or $post["direccion_prop"] != '' or $post["cliente_direccion"] != '') { $this->_join_if = true; } }
// This is the first request. Note how we start the response with CON $response = "Please enter Staff ID"; sendOutput($response, 1); } else { //receive what Edwin has sent in as text $id = $input['text']; /* $leo = array('name'=>'Leo', 'staff_id' => 1234); $macharia = array('name'=>'Macharia', 'staff_id' => 12345); $kevin = array('name'=>'Kevin', 'staff_id' => 231); $staff = array('1234'=>$leo,'12345'=>$macharia,'231'=>$kevin); */ $staff = getStaff($id); if ($staff['id'] != 0) { $message = "ID is valid and it belongs to " . $staff['first_name'] . " " . $staff['last_name']; } else { $message = "No Staff with that id"; } sendOutput($message, 2); } //verify if the id belongs to one of the staff members function getInput() { $input = array(); $input['sessionId'] = $_REQUEST["sessionId"]; $input['serviceCode'] = $_REQUEST["serviceCode"]; $input['phoneNumber'] = $_REQUEST["phoneNumber"]; $input['text'] = $_REQUEST["text"];
<?php include "connect.php"; //$first_name = "Hal"; //$last_name = "Jordan"; //createStaff($first_name , $last_name); $id = $_REQUEST['id']; $result = getStaff($id); print_r($result); function createStaff($first_name, $last_name) { $query = mysql_query("INSERT INTO Staff (first_name , last_name)\n\t\tVALUES ('{$first_name}' , '{$last_name}')"); return $query; } function getStaff($id) { $query = mysql_query("SELECT * FROM Staff WHERE id='{$id}'"); if (mysql_num_rows($query) > 0) { $row = mysql_fetch_assoc($query); } else { $row['id'] = 0; } return $row; } function deleteStaff($id) { $query = mysql_query("DELETE FROM Staff WHERE id = '{$id}'"); return $query; } function updateStaff($id) {
</p> <?php } ?> </div> </li> <?php } // +----------------------------------------------------------------------+ // | Historial | // +----------------------------------------------------------------------+ if ($var_historial == true and $val['tipo'] == "historial") { if ($val["data"]["derivado"] != 0) { $sector = getSector($val["data"]["derivado"]); // staff $derivador = getStaff($val["data"]["staff_id"]); $derivador_staff = htmlentities($derivador["nombre"]); // titulo $title = 'Derivado a ' . htmlentities($seccion_res["nombre"]) . " desde " . htmlentities($sector["nombre"]) . ", por <b>" . $derivador_staff . "</b>"; $icon = 'replies'; } else { $title = 'Historial'; $icon = 'history'; } ?> <li> <time class="cbp_tmtime" datetime="<?php echo date("Y-d-m H:i", strtotime($val["data"]["fecha"])); ?> "> <span><?php