function sendSms() { $npwd = ''; $no_telp = ''; $message = ''; include 'save_excel.php'; if (!empty($_GET)) { $npwd = $_GET['npwd']; $no_telp = $_GET['no_telp']; $message = $_GET['message']; } else { if (!empty($_POST)) { $npwd = $_POST['npwd']; $no_telp = $_POST['no_telp']; $message = $_POST['message']; } } $ptn = "/^0/"; // Regex $rpltxt = "62"; // Replacement string $no_telp = preg_replace($ptn, $rpltxt, $no_telp); $file_name = createExcel($no_telp, $npwd . '_' . time()); date_default_timezone_set('Asia/Jakarta'); $send_date = date('Y-m-d-H-i-s'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://smsblast.radbdg.net/_libz/usersignin.php"); curl_setopt($ch, CURLOPT_POST, 1); // in real life you should use something like: curl_setopt($ch, CURLOPT_POSTFIELDS, array('loginUsername' => 'disyanjak', 'loginPass' => 'disyanjakbdg12345678', 'attached_type' => 'action_1', 'senderID' => 'JMP000007', 'sender' => 'DISYANJAK', 'tanggal' => substr($send_date, 0, 10), 'jam1' => substr($send_date, 11, 2), 'mnt1' => '' . (substr($send_date, 14, 2) + 3) . '', 'pesan' => $message, 'tb_simpan' => 'Submit', 'login_btn' => 'Login', 'nmbatch' => '@' . realpath($file_name . '.xls') . ';filename=' . $file_name . '.xls')); // receive server response ... curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)"); $tmp_fname = tempnam("/tmp", "COOKIE"); curl_setopt($ch, CURLOPT_COOKIEJAR, $tmp_fname); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $server_output = curl_exec($ch); curl_setopt($ch, CURLOPT_URL, "http://smsblast.radbdg.net/userarea/p/single_exe.php"); curl_setopt($ch, CURLOPT_COOKIEFILE, $tmp_fname); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, 1); // in real life you should use something like: curl_setopt($ch, CURLOPT_POSTFIELDS, array('loginUsername' => 'disyanjak', 'loginPass' => 'disyanjakbdg12345678', 'attached_type' => 'action_1', 'senderID' => 'JMP000007', 'sender' => 'DISYANJAK', 'tanggal' => substr($send_date, 0, 10), 'jam1' => substr($send_date, 11, 2), 'mnt1' => '' . (substr($send_date, 14, 2) + 3) . '', 'pesan' => $message, 'tb_simpan' => 'Submit', 'login_btn' => 'Login', 'nmbatch' => '@' . realpath($file_name . '.xls') . ';filename=' . $file_name . '.xls')); $server_output = curl_exec($ch); echo $server_output; exit; curl_close($ch); }
function parseConfig($basename, $server) { $xmlfile = '/etc/voip/voipconfig.xml'; $xlsfile = dirname(__FILE__) . DIRECTORY_SEPARATOR . $basename; if (!file_exists($xmlfile)) { VOIPXMLConfiguredElement::error("Can't find {$xmlfile}."); } $config = new VOIPConfig(new SimpleXMLElement(file_get_contents($xmlfile))); $config->findRefs(); if (createExcel()) { $objPHPExcel = phpexcel_createPHPExcelObject(); $objPHPExcel->getProperties()->setCreator("freePbxConfig - MEVOIP - {$basename}")->setLastModifiedBy("freePbxConfig - MEVOIP - {$basename}")->setTitle("freePbxConfig - MEVOIP - {$basename}")->setSubject("freePbxConfig - MEVOIP - {$basename}")->setDescription("freePbxConfig - MEVOIP - {$basename}")->setKeywords("freePbxConfig - MEVOIP - {$basename}")->setCategory("freePbxConfig - MEVOIP - {$basename}"); $s = $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setTitle('VOIP PABX'); $objPHPExcel->getDefaultStyle()->getFont()->setName('Tahoma'); $objPHPExcel->getDefaultStyle()->getFont()->setSize(8); $config->writeExcel($objPHPExcel); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save($xlsfile . '.xls'); } if (true) { $serdata = array(); $serdata['adLogin'] = $config->getUserArrayByField($config->users, 'adLogin'); $serdata['ext'] = $config->getUserArrayByField($config->users, 'extension'); $serdata['area'] = $config->getUserArrayByField($config->users, 'area', false); $serdata['queues'] = $config->getUserArrayByField($config->queues, 'extension'); $serdata['groups'] = $config->getUserArrayByField($config->ringGroups, 'extension'); $serdata['confs'] = $config->getUserArrayByField($config->confs, 'extension'); $provision = dirname(__FILE__) . DIRECTORY_SEPARATOR . $basename . DIRECTORY_SEPARATOR . $basename . '.dat'; file_put_contents($provision, serialize($serdata)); VOIPXMLConfiguredElement::info("Wrote provisioning info to {$provision}."); } $argv = @$_SERVER['argv']; if (@$argv[1] == "run") { if (!hasErrors()) { VOIPXMLConfiguredElement::info("Previous errors not detected, applying configuration."); $config->applyConfigToFreePBX($server); } else { VOIPXMLConfiguredElement::error("Previous errors detected. STOPPING."); } } else { $config->generateOutboundRulesFile('outbound_rules.conf'); } //print_r($config); }
$rule .= " and c.channel_name like '%{$_POST["channel_name"]}%' "; } if (isset($_POST["bd"]) && $_POST["bd"] != "") { $rule .= " and c.bd like '%{$_POST["bd"]}%' "; } if (isset($_POST["promotion_team"]) && $_POST["promotion_team"] != "") { $rule .= " and c.promotion_number= '{$_POST["promotion_team"]}'"; } if (isset($_POST["payment_method"]) && $_POST["payment_method"] != "") { $rule .= " and c.payment_number='{$_POST["payment_method"]}' "; } if (isset($_POST["cooperation_mode"]) && $_POST["cooperation_mode"] != "") { $rule .= " and c.cooperation_number= '{$_POST["cooperation_mode"]}'"; } if (isset($_POST["version_type"]) && $_POST["version_type"] != "") { $rule .= " and c.version_number= '{$_POST["version_type"]}'"; } if (isset($_POST["has_sdk"]) && $_POST["has_sdk"] != "") { $rule .= " and c.has_sdk= '{$_POST["has_sdk"]}'"; } //serch data $db = new ChannelDB(); $rows = $db->selectChannelNumbers($rule); createExcel($rows); ?>
<?php session_start(); if (isset($_SESSION['registrado'])) { require_once "../clases/AccesoDatos.php"; require_once "../clases/invitado.php"; require_once "../clases/cliente.php"; require_once "excel.php"; require_once "excel-ext.php"; header("Content-Type: application/vnd.ms-excel"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("content-disposition: attachment;filename=invitados.xls"); $arrayDeInvitados = invitado::TraerInvitados($_SESSION['registrado']); foreach ($arrayDeInvitados as $invitado) { $assoc = array(array("DNI" => $invitado->dni, "Nombre" => $invitado->nomyape, "Parentezco" => $invitado->pariente, "Mesa" => $invitado->nromesa)); } createExcel("invitados.xls", $assoc); //$arrayDeInvitados); exit; }
<?php include 'save_excel.php'; createExcel();
<?php require_once "excel.php"; require_once "excel-ext.php"; $assoc = array(array("Nombre" => "Mattias", "IQ" => 250), array("Nombre" => "Tony", "IQ" => 100), array("Nombre" => "Peter", "IQ" => 100), array("Nombre" => "Edvard", "IQ" => 100)); createExcel("excel-mysql.xls", $data); exit;
if ($tipo == 1) { $sql = "SELECT nc as num, concat(alma.apellidos,', ',alma.nombre) as alumno FROM alma, FALUMNOS WHERE FALUMNOS.claveal=alma.claveal and alma.unidad='" . $grupo . "' ORDER BY nc"; } if ($tipo == 2) { $sql = "SELECT concat(alma.apellidos,', ',alma.nombre) as alumno, combasi as asignaturas, nc as num FROM alma, FALUMNOS WHERE alma.claveal=FALUMNOS.claveal and alma.Unidad='" . $grupo . "' ORDER BY nc"; } $resEmp = mysqli_query($db_con, $sql) or die(mysqli_error($db_con)); $totEmp = mysqli_num_rows($resEmp); if ($tipo == 1) { while ($datatmp = mysqli_fetch_assoc($resEmp)) { $data[] = $datatmp; } } if ($tipo == 2) { while ($datatmp = mysqli_fetch_array($resEmp)) { $mat = ""; $asig0 = explode(":", $datatmp[1]); foreach ($asig0 as $asignatura) { $unidadn = substr($grupo, 0, 1); $consulta = "select distinct abrev, curso from asignaturas where codigo = '{$asignatura}' and curso like '%{$unidadn}%' limit 1"; $abrev = mysqli_query($db_con, $consulta); $abrev0 = mysqli_fetch_array($abrev); $curs = substr($abrev0[1], 0, 2); $mat .= $abrev0[0] . "; "; } is_numeric($datatmp[2]); $data[] = array($datatmp[2], $datatmp[0], $mat); } } createExcel("listado_{$grupo}.xls", $data); exit;
<?php require_once "excel.php"; require_once "excel-ext.php"; include "../../includes/conexion.inc.php"; $queEmp = $_GET['sentencia']; #$queEmp = "SELECT * FROM alumnos"; $resEmp = mysqli_query($db_con, $queEmp, $c) or die(mysqli_error($db_con)); $totEmp = mysqli_num_rows($resEmp); while ($datatmp = mysqli_fetch_assoc($resEmp)) { $data[] = $datatmp; } createExcel("datos_excel.xls", $data); exit;
<?php define("RelativePath", ".."); include_once RelativePath . "/Common.php"; include_once RelativePath . "/include/excel/save_excel_2.php"; $dbConn = new clsDBConnSIKP(); $query = "SELECT * FROM t_sms_outbox where is_sent = 'N' and message_type='SMS_BLAST'"; $dbConn->query($query); $data = array(); while ($dbConn->next_record()) { $data[] = $item = array('t_sms_outbox_id' => $dbConn->f("t_sms_outbox_id"), 'npwpd' => $dbConn->f("npwpd"), 'mobile_no' => $dbConn->f("mobile_no"), 'message' => $dbConn->f("message"), 'is_sent' => $dbConn->f("is_sent"), 'date_sent' => $dbConn->f("date_sent"), 'date_addded' => $dbConn->f("date_addded")); } if (count($data) < 1) { exit; } $file_name = createExcel($data); //print_r($file_name); //exit; date_default_timezone_set('Asia/Jakarta'); $send_date = date('Y-m-d-H-i-s'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://smsblast.radbdg.net/_libz/usersignin.php"); curl_setopt($ch, CURLOPT_POST, 1); // in real life you should use something like: curl_setopt($ch, CURLOPT_POSTFIELDS, array('loginUsername' => 'disyanjak', 'loginPass' => 'disyanjakbdg12345678', 'attached_type' => 'action_1', 'senderID' => 'JMP000007', 'sender' => 'DISYANJAK', 'tanggal' => substr($send_date, 0, 10), 'jam1' => substr($send_date, 11, 2), 'mnt1' => '' . (substr($send_date, 14, 2) + 3) . '', 'pesan' => "", 'tb_simpan' => 'Submit', 'login_btn' => 'Login', 'nmbatch' => '')); // receive server response ... curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)"); $tmp_fname = tempnam("/tmp", "COOKIE"); curl_setopt($ch, CURLOPT_COOKIEJAR, $tmp_fname); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
<?php require_once "excel.php"; require_once "excel-ext.php"; $assoc = array(array("Nombre" => "Mattias", "IQ" => 250), array("Nombre" => "Tony", "IQ" => 100), array("Nombre" => "Peter", "IQ" => 100), array("Nombre" => "Edvard", "IQ" => 100)); createExcel("excel-array.xls", $assoc); exit;
function generarFormatoUnificado($datos) { $parametros = $datos["datos"]; $parametros = explode("||", $parametros); //datos concadenados /* +--------------------------------------------------------------------------------------+ */ $arrayCabecera1 = array(); $arrayCuerpo = array(); /* +------------------------------ Cabecera -------------------------------+ */ // $diasSem = Array('Monday' => 'Lunes', 'Tuesday' => 'Martes', 'Wednesday' => 'Miercoles', 'Thursday' => 'Jueves', 'Friday' => 'Viernes', 'Saturday' => 'Sabado', 'Sunday' => 'Domingo'); $diasSem = array('Monday' => 'L-', 'Tuesday' => 'M-', 'Wednesday' => 'M- ', 'Thursday' => 'J- ', 'Friday' => 'V- ', 'Saturday' => 'S- ', 'Sunday' => 'D-'); $fecha = getdate(time()); $fileExportar = "PROGRAMACION_" . strtoupper($datos["descMes"]) . "_" . $datos["descArea"]; if ($datos["mes"] != "") { $mes = $datos["mes"]; } else { $mes = $fecha["mon"]; } if ($datos["anio"] != "") { $anio = $datos["anio"]; } else { $anio = $fecha['year']; } $fecha = mktime(0, 0, 0, $mes, 1, $anio); $fechaInicioMes = mktime(0, 0, 0, $mes, 1, $anio); $fechaInicioMes = date("w", $fechaInicioMes); $ultimoDia = date('t', $fecha); $númeroDeDias = intval(date("t", $mes)); /* +-----------------------------------------------------------------------------------------------+ */ /* +-----------------------------------------------------------------------------------------------+ */ $fila = 0; $oLRrhh = new LRrhh(); foreach ($parametros as $key => $arrayDatos) { $arrayDatos = explode("|", $arrayDatos); $datos["nomSubArea"] = $arrayDatos[2]; $datos["nomCategoriapuesto"] = $arrayDatos[3]; //$valorsubareas[0]."|".$valorcategorias[0]."|".$nomSubArea."|".$nomCategoria."|".$nomSede $datos["nomSede"] = $arrayDatos[4]; $datos["codigoSubArea"] = $arrayDatos[0]; $datos["codigoCategoria"] = $arrayDatos[1]; $nameFileGenerar = $datos["anio"] . "_" . $datos["descMes"] . "_" . $datos["nomSede"] . "_" . $datos["nomSubArea"] . "_" . $datos["nomCategoriapuesto"]; if ($fila == 0) { //es un artificio, para mostrar las cabeceras, pues el framework me limita $arrayCabecera1[$fila]["Codigo"] = "Archivo :"; $arrayCabecera1[$fila]["Nombres"] = $nameFileGenerar; $arrayCabecera1[$fila + 1]["Codigo"] = ""; $arrayCabecera1[$fila + 1]["Nombres"] = strtoupper($datos["nomSede"]) . " - " . strtoupper($datos["nomSubArea"]) . " - " . strtoupper($datos["nomCategoriapuesto"]); $arrayCabecera1[$fila + 2]["Codigo"] = ""; $arrayCabecera1[$fila + 2]["Nombres"] = ""; $diaMes = 0; for ($coln = 2; $coln < $númeroDeDias + 2; $coln++) { if ($diaMes < $ultimoDia) { $diaMes++; $diaInicial = date("l", mktime(0, 0, 0, $mes, $diaMes, $anio)); $arrayCabecera1[$fila][$diaMes] = $diasSem[$diaInicial]; $arrayCabecera1[$fila + 1][$diaMes] = ""; $arrayCabecera1[$fila + 2][$diaMes] = ""; } } $arrayCabecera1[$fila]["Tot_Horas"] = ""; $arrayCabecera1[$fila]["Num_Prog"] = ""; $arrayCabecera1[$fila + 1]["Tot_Horas"] = ""; $arrayCabecera1[$fila + 1]["Num_Prog"] = ""; $arrayCabecera1[$fila + 2]["Tot_Horas"] = ""; $arrayCabecera1[$fila + 2]["Num_Prog"] = ""; $fila = $fila + 2; } else { $arrayCabecera1[$fila]["Codigo"] = "Codigo"; $arrayCabecera1[$fila]["Nombres"] = "Nombres"; $arrayCabecera1[$fila + 1]["Codigo"] = ""; $arrayCabecera1[$fila + 1]["Nombres"] = strtoupper($datos["nomSede"]) . " - " . strtoupper($datos["nomSubArea"]) . " - " . strtoupper($datos["nomCategoriapuesto"]); $arrayCabecera1[$fila + 2]["Codigo"] = "Archivo :"; $arrayCabecera1[$fila + 2]["Nombres"] = $nameFileGenerar; $diaMes = 0; for ($coln = 2; $coln < $númeroDeDias + 2; $coln++) { if ($diaMes < $ultimoDia) { $diaMes++; $diaInicial = date("l", mktime(0, 0, 0, $mes, $diaMes, $anio)); $arrayCabecera1[$fila][$diaMes] = $diaMes; $arrayCabecera1[$fila + 1][$diaMes] = ""; $arrayCabecera1[$fila + 2][$diaMes] = $diasSem[$diaInicial]; } } $arrayCabecera1[$fila]["Tot_Horas"] = "Tot_Horas"; $arrayCabecera1[$fila]["Num_Prog"] = "Num_Prog"; $arrayCabecera1[$fila + 1]["Tot_Horas"] = ""; $arrayCabecera1[$fila + 1]["Num_Prog"] = ""; $arrayCabecera1[$fila + 2]["Tot_Horas"] = ""; $arrayCabecera1[$fila + 2]["Num_Prog"] = ""; $fila = $fila + 3; } /* +------------------------------ Fin cabecera ---------------------------+ */ /* +------------------------------ Cuerpo ---------------------------+ */ $empleado = $oLRrhh->obtenerEmpleadosCategoriadelSubArea($datos); foreach ($empleado as $i => $value) { $arrayCabecera1[$i + $fila]["Codigo"] = $value[0]; $arrayCabecera1[$i + $fila]["Nombres"] = $value[1]; for ($j = 2; $j < $númeroDeDias + 2; $j++) { $arrayCabecera1[$i + $fila][$j - 1] = ""; } $arrayCabecera1[$i + $fila]["Tot_Horas"] = ""; $arrayCabecera1[$i + $fila]["Num_Prog"] = ""; } $fila = $fila + count($empleado); for ($i = 0; $i < 4; $i++) { $arrayCabecera1[$i + $fila]["Codigo"] = ""; $arrayCabecera1[$i + $fila]["Nombres"] = ""; for ($j = 2; $j < $númeroDeDias + 2; $j++) { $arrayCabecera1[$i + $fila][$j - 1] = ""; } $arrayCabecera1[$i + $fila]["Tot_Horas"] = ""; $arrayCabecera1[$i + $fila]["Num_Prog"] = ""; $fila++; } } /* +-----------------------------------------------------------------------------------------------+ */ /* +-----------------------------------------------------------------------------------------------+ */ /* +------------------------------ Fin cuerpo ---------------------------+ */ require_once "../../MSExcelStreamHandler/excel.php"; require_once "../../MSExcelStreamHandler/excel-ext.php"; createExcel($fileExportar . ".xls", $arrayCabecera1); exit; }
//$plantilla="<table border='1'>"; //$plantilla.="<tr>"; //foreach ($arrayCabecera1 as $j => $value) { // $plantilla.="<td bgcolor='#95BB9E'>".$value."</td>"; //} //$plantilla.="</tr>"; //$plantilla.="<tr>"; //foreach ($arrayCabecera2 as $j => $value) { // $plantilla.="<td bgcolor='#95BB9E' width='".$arrayWidth[$j]."' >".$value."</td>"; //} //$plantilla.="</tr>"; // //foreach ($arrayCuerpo as $i => $value) { // $plantilla.="<tr>"; // for ($j = 0; $j < $numColum; $j++) { // $plantilla.="<td>".$value[$j]."</td>"; // } // $plantilla.="</tr>"; //} //$plantilla.="</table>"; // // //echo $plantilla; ?> <?php $assoc = array(array("Nombre" => "Mattias", "IQ" => 250), array("Nombre" => "Tony", "IQ" => 100), array("Nombre" => "Peter", "IQ" => 100), array("Nombre" => "Edvard", "IQ" => 100)); require_once "../../MSExcelStreamHandler/MSExcelStreamHandler/excel.php"; require_once "../../MSExcelStreamHandler/MSExcelStreamHandler/excel-ext.php"; createExcel("excel_mysql.xls", $assoc); exit;