} else { $body_contact .= '<thead><th>Nombres</th>'; $body_contact .= '<th>Titulo</th>'; $body_contact .= '<th>E-mail</th>'; $body_contact .= '<th>Notas</th>'; $body_contact .= '<th></th>'; $body_contact .= '</tr></thead>'; $body_contact .= "<tbody id='table_contacts' name='table_contacts'>"; $paginacion = new BasePagination(); $paginacion->porPagina(1); $paginacion->SetPagArrayData($contact); $contact = $paginacion->GetPagination(); $nav = $paginacion->Getnavigate(); foreach ($contact as $c_k => $c_v) { $id_contact = $c_v['id_prospect_contact']; $phone_contact = $sales->Get_PhonesContact($id_contact); $json_phone_contact = null; $json_class = new SivarApi\Tools\Services_JSON(); if (count($phone_contact) != 0) { $json_phone_contact = $json_class->encode($phone_contact); } $val_id = "Ctl" . (string) $id_contact; $json_contact = $json_class->encode($c_v); $body_contact .= "<input type='hidden' name='" . $val_id . "' id='" . $val_id . "' value='" . $json_contact . "' />"; $body_contact .= "<input type='hidden' name='" . $id_contact . "' id='" . $id_contact . "' value='" . $json_phone_contact . "' />"; $body_contact .= '<tr id="child' . (string) $c_v['id_prospect_contact'] . '" class="odd gradeX">'; $body_contact .= "<td>" . $c_v['nombres'] . " " . $c_v['apellidos'] . "</td>"; $body_contact .= "<td>" . $c_v['titulo'] . "</td>"; $body_contact .= "<td>" . '<button type="button" onclick="EmailContact(' . "'" . $c_v['email'] . "'" . ');" class=" btn btn-info"><i class="fa fa-envelope-o"></i></i></i></button>' . "</td>"; $body_contact .= "<td><button type='button' class='btn btn-success' " . 'onclick="ShowNotes(' . "'" . htmlspecialchars($c_v['notas']) . "'" . ');"' . ">" . '<i class="fa fa-comment"></i>' . "</button></td>"; $body_contact .= "<td>" . '<button type="button" onclick="ProspectPhones(' . $id_contact . ');" class=" btn btn-info"><i class="fa fa-phone"></i></i></button>' . "";
*/ include '../../../Conf/Include.php'; set_dependencies(array("ProspectController", "AdminController")); if (!isset($_REQUEST['type'])) { exit; } $prospect = new ProspectController(); $type = $_REQUEST['type']; switch ($type) { case "add_contact": $id = $_REQUEST['id']; $name = $_REQUEST['name']; $tel = $_REQUEST['tel']; $result = $prospect->SetContactPhone($id, $name, $tel); if ($result) { $contact = $prospect->Get_PhonesContact($id); $json = new \SivarApi\Tools\Services_JSON(); echo $json->encode($contact); } unset($id); unset($name); unset($tel); break; case "add": $id = $_REQUEST['id']; $name = $_REQUEST['name']; $name2 = $_REQUEST['name2']; $title = $_REQUEST['title']; $mail = $_REQUEST['mail']; $notes = $_REQUEST['notes']; $result = $prospect->SetContact(array("id_prospect" => $id, "nombres" => $name, "apellidos" => $name2, "titulo" => $title, "email" => $mail, "notas" => $notes));