Esempio n. 1
0
 public function saveRiwayatDiklat($post)
 {
     if ($post) {
         $this->db->trans_begin();
         $this->db->set('NIP', $post['nip']);
         $this->db->set('JENIS_DIKLAT_ID', $post['jenis_diklat']);
         $this->db->set('DIKLAT_STRUKTURAL_ID', $post['diklat_struktural']);
         $this->db->set('NAMA_DIKLAT', $post['nama_diklat']);
         $this->db->set('TANGGAL_MULAI', mysql_date($post['tanggal_mulai']));
         $this->db->set('TANGGAL_SELESAI', mysql_date($post['tanggal_selesai']));
         $this->db->set('NOMOR_SERTIFIKAT', $post['no_sertifikat']);
         $this->db->set('JUMLAH_PJL', $post['jumlah_pjl']);
         $this->db->set('PENYELENGGARA', $post['penyelenggara']);
         if (!empty($post['riwayat_diklat_id'])) {
             $this->db->set('USERUPDATE', user_id());
             $this->db->set('UPDATEDATE', 'NOW()', FALSE);
             $this->db->where('RIWAYAT_DIKLAT_ID', $post['riwayat_diklat_id']);
             $this->db->update('sp_riwayat_diklat');
         } else {
             $this->db->set('USERINSERT', user_id());
             $this->db->set('INSERTDATE', 'NOW()', FALSE);
             $this->db->insert('sp_riwayat_diklat');
         }
         if ($this->db->trans_status() === FALSE) {
             $this->db->trans_rollback();
             $success = FALSE;
         } else {
             $this->db->trans_commit();
             $success = TRUE;
         }
         return $success;
     }
 }
 public function saveRiwayatPendidikan($post)
 {
     if ($post) {
         $this->db->trans_begin();
         $this->db->set('NIP', $post['nip']);
         $this->db->set('TINGKAT_PENDIDIKAN_ID', $post['tingkat_pendidikan']);
         $this->db->set('PENDIDIKAN_ID', $post['nama_pendidikan']);
         $this->db->set('TANGGAL_LULUS', mysql_date($post['tanggal_lulus']));
         $this->db->set('TAHUN_LULUS', $post['tahun_lulus']);
         $this->db->set('NOMOR_IJAZAH', $post['nomor_ijazah']);
         $this->db->set('NAMA_SEKOLAH', $post['nama_sekolah']);
         $this->db->set('GELAR_DEPAN', $post['gelar_depan']);
         $this->db->set('GELAR_BELAKANG', $post['gelar_belakang']);
         $this->db->set('STATUS_PENDIDIKAN', $post['status_pendidikan']);
         if (!empty($post['riwayat_pendidikan_id'])) {
             $this->db->set('USERUPDATE', user_id());
             $this->db->set('UPDATEDATE', 'NOW()', FALSE);
             $this->db->where('RIWAYAT_PENDIDIKAN_ID', $post['riwayat_pendidikan_id']);
             $this->db->update('sp_riwayat_pendidikan');
         } else {
             $this->db->set('USERINSERT', user_id());
             $this->db->set('INSERTDATE', 'NOW()', FALSE);
             $this->db->insert('sp_riwayat_pendidikan');
         }
         if ($this->db->trans_status() === FALSE) {
             $this->db->trans_rollback();
             $success = FALSE;
         } else {
             $this->db->trans_commit();
             $success = TRUE;
         }
         return $success;
     }
 }
Esempio n. 3
0
 protected function parse_content($array)
 {
     if (is_array($array) and !empty($array)) {
         if (!empty($array['seo'])) {
             $url = _URL . "content/detail/{$array['seo']}";
         } else {
             $url = _URL . "content/detail/{$array['id']}/" . url_title($array['title'], "-", true);
         }
         $explode_title = explode(' ', $array['title']);
         $content = array();
         $content['id'] = $array['id'];
         $content['title'] = $array['title'];
         $content['subtitle'] = $array['subtitle'];
         $content['seo'] = $array['seo'];
         $content['created'] = mysql_date($array['created'], 'd/m/y', true);
         $content['user_id'] = $array['created_by'];
         $content['name'] = $array['name'];
         $content['image'] = $array['image'];
         $content['image_url'] = image("files/content/" . $array['image'], 'alt="' . $array['title'] . '"');
         $content['content'] = $array['content'];
         $content['meta_keyword'] = $array['meta_keyword'];
         $content['meta_description'] = $array['meta_description'];
         $content['hits'] = $array['hits'];
         $content['url'] = $url;
         return $content;
     }
 }
Esempio n. 4
0
 public function saveRiwayatKursus($post)
 {
     if ($post) {
         $this->db->trans_begin();
         $this->db->set('NIP', $post['nip']);
         //$this->db->set('KURSUS_ID', $post['tingkat_pendidikan']);
         $this->db->set('NAMA_KURSUS', $post['nama_kursus']);
         $this->db->set('TANGGAL_KURSUS', mysql_date($post['tanggal_kursus']));
         $this->db->set('JUMLAH_JAM', $post['jumlah_jam']);
         $this->db->set('TAHUN_KURSUS', $post['tahun_kursus']);
         $this->db->set('INSTANSI_ID', $post['instansi']);
         $this->db->set('INSTITUSI_PENYELENGGARA', $post['institusi_penyelenggara']);
         $this->db->set('TIPE_KURSUS', $post['tipe_kursus']);
         $this->db->set('NOMOR_SERTIFIKAT', $post['nomor_sertifikat']);
         if (!empty($post['riwayat_kursus_id'])) {
             $this->db->set('USERUPDATE', user_id());
             $this->db->set('UPDATEDATE', 'NOW()', FALSE);
             $this->db->where('RIWAYAT_KURSUS_ID', $post['riwayat_kursus_id']);
             $this->db->update('sp_riwayat_kursus');
         } else {
             $this->db->set('USERINSERT', user_id());
             $this->db->set('INSERTDATE', 'NOW()', FALSE);
             $this->db->insert('sp_riwayat_kursus');
         }
         if ($this->db->trans_status() === FALSE) {
             $this->db->trans_rollback();
             $success = FALSE;
         } else {
             $this->db->trans_commit();
             $success = TRUE;
         }
         return $success;
     }
 }
 public function saveRiwayatPenghargaan($post)
 {
     if ($post) {
         $this->db->trans_begin();
         $this->db->set('NIP', $post['nip']);
         $this->db->set('PENGHARGAAN_ID', $post['jenis_penghargaan_id']);
         $this->db->set('TANGGAL_SK', mysql_date($post['penghargaan_tgl_sk']));
         $this->db->set('NOMOR_SK', $post['penghargaan_no_sk']);
         if (!empty($post['riwayat_penghargaan_id'])) {
             $this->db->set('USERUPDATE', user_id());
             $this->db->set('UPDATEDATE', 'NOW()', FALSE);
             $this->db->where('RIWAYAT_PENGHARGAAN_ID', $post['riwayat_penghargaan_id']);
             $this->db->update('sp_riwayat_penghargaan');
         } else {
             $this->db->set('USERINSERT', user_id());
             $this->db->set('INSERTDATE', 'NOW()', FALSE);
             $this->db->insert('sp_riwayat_penghargaan');
         }
         if ($this->db->trans_status() === FALSE) {
             $this->db->trans_rollback();
             $success = FALSE;
         } else {
             $this->db->trans_commit();
             $success = TRUE;
         }
         return $success;
     }
 }
Esempio n. 6
0
function get_leaflets($email_alert)
{
    if (ALERT_DEBUG > 0) {
        print $email_alert->type . "\n";
        print "frequency : " . $email_alert->frequency_hours . "\n";
    }
    $results = array();
    $search = factory::create('search');
    $time = time() - 60 * 60 * $email_alert->frequency_hours;
    $time = mysql_date($time);
    //do we have any matching leaflets?
    if ($email_alert->type == 'attack') {
        $results = $search->search('leaflet', array(array('leaflet_party_attack.party_id', '=', $email_alert->parent_id), array('leaflet.date_uploaded', '>=', $time), array('leaflet.live', '=', 1)), 'AND', array(array('leaflet_party_attack', 'inner')));
    } else {
        if ($email_alert->type == 'party') {
            $results = $search->search('leaflet', array(array('leaflet.publisher_party_id', '=', $email_alert->parent_id), array('leaflet.date_uploaded', '>=', $time), array('leaflet.live', '=', 1)));
        } else {
            if ($email_alert->type == 'constituency') {
                $results = $search->search('leaflet', array(array('leaflet_constituency.constituency_id', '=', $email_alert->parent_id), array('leaflet.date_uploaded', '>=', $time), array('leaflet.live', '=', 1)), 'AND', array(array('leaflet_constituency', 'inner')));
            } else {
                if ($email_alert->type == 'category') {
                    $results = $search->search('leaflet', array(array('leaflet_category.category_id', '=', $email_alert->parent_id), array('leaflet.date_uploaded', '>=', $time), array('leaflet.live', '=', 1)), 'AND', array(array('leaflet_category', 'inner')));
                }
            }
        }
    }
    return $results;
}
Esempio n. 7
0
 public function insert()
 {
     //create an ID for subscribing and unsubscribing
     $this->confirm_id = md5(uniqid());
     //set the last sent to now
     $this->last_sent = mysql_date(time());
     return parent::insert();
 }
Esempio n. 8
0
function format_date_time_mysql($date)
{
    if (trim($date)) {
        list($fff, $sss) = explode(" ", $date);
        $ddd = mysql_date($fff);
        return $ddd . " " . $sss . ":00";
    }
}
 public function saveRiwayatGolongan($post)
 {
     if ($post) {
         $this->db->trans_begin();
         $this->db->set('NIP', $post['nip']);
         $this->db->set('KODE_JENIS_KP', $post['kode_jenis_kp']);
         $this->db->set('NOMOR_SK', $post['no_sk_gol']);
         $this->db->set('TANGGAL_SK', mysql_date($post['tgl_sk_gol']));
         $this->db->set('TMT_GOLONGAN', mysql_date($post['tmt_golongan']));
         $this->db->set('NOMOR_BKN', $post['no_bkn']);
         $this->db->set('TANGGAL_BKN', mysql_date($post['tgl_bkn']));
         $this->db->set('GOLONGAN_ID', $post['golongan_id']);
         $this->db->set('MASA_KERJA_TAHUN', $post['masa_kerja_tahun']);
         $this->db->set('MASA_KERJA_BULAN', $post['masa_kerja_bulan']);
         $this->db->set('ANGKA_KREDIT_UTAMA', $post['angka_kredit_utama']);
         $this->db->set('ANGKA_KREDIT_TAMBAHAN', $post['angka_kredit_tambahan']);
         $this->db->set('PENETAP_ID', $post['penetap_id']);
         if (isset($post['riwayat_golongan_id']) && !empty($post['riwayat_golongan_id'])) {
             $this->db->set('USERUPDATE', user_id());
             $this->db->set('UPDATEDATE', 'NOW()', FALSE);
             $this->db->where('riwayat_golongan_id', $post['riwayat_golongan_id']);
             $save = $this->db->update('sp_riwayat_golongan');
         } else {
             $this->db->set('USERINSERT', user_id());
             $this->db->set('INSERTDATE', 'NOW()', FALSE);
             $save = $this->db->insert('sp_riwayat_golongan');
         }
         if ($save && $this->db->trans_status() === TRUE) {
             $this->setLastGolongan($post['nip'], $post['golongan_id']);
             $this->db->trans_commit();
             $success = TRUE;
         } else {
             $this->db->trans_rollback();
             $success = FALSE;
         }
         return $success;
     }
 }
function get_leaflets($email_alert)
{
    $results = array();
    $search = factory::create('search');
    $time = time() - 60 * 60 * $email_alert->frequency_hours;
    $time = mysql_date($time);
    //do we have any matching leaflets?
    if ($email_alert->type = 'attack') {
        $search->search('leaflet', array(array('leaflet_party_attack.party_id', '=', $email_alert->parent_id), array('leaflet.date_uploaded', '>=', $time)), 'AND', array(array('leaflet_party_attack', 'inner')));
    } else {
        if ($email_alert->type = 'party') {
            $search->search('leaflet', array(array('leaflet.party_id', '=', $email_alert->parent_id), array('leaflet.date_uploaded', '>=', $time)));
        } else {
            if ($email_alert->type = 'constituency') {
                $search->search('leaflet', array(array('leaflet_constituency.constituency_id', '=', $email_alert->parent_id), array('leaflet.date_uploaded', '>=', $time)), 'AND', array(array('leaflet_constituency', 'inner')));
            } else {
                if ($email_alert->type = 'category') {
                    $search->search('leaflet', array(array('leaflet_category.category_id', '=', $email_alert->parent_id), array('leaflet.date_uploaded', '>=', $time)), 'AND', array(array('leaflet_category', 'inner')));
                }
            }
        }
    }
}
Esempio n. 11
0
 public function saveRiwayatHukuman($post)
 {
     if ($post) {
         $this->db->trans_begin();
         $this->db->set('NIP', $post['nip']);
         $this->db->set('JENIS_HUKUMAN_ID', $post['jenis_hukuman_id']);
         $this->db->set('NOMOR_SK', $post['no_sk']);
         $this->db->set('TANGGAL_SK', mysql_date($post['tgl_sk']));
         $this->db->set('TANGGAL_MULAI_HUKUM', mysql_date($post['tanggal_mulai_hukuman']));
         $this->db->set('TANGGAL_AKHIR_HUKUM', mysql_date($post['tanggal_akhir_hukuman']));
         $this->db->set('MASA_TAHUN', $post['masa_tahun']);
         $this->db->set('MASA_BULAN', $post['masa_bulan']);
         $this->db->set('NOMOR_PP', $post['nomor_pp']);
         $this->db->set('GOLONGAN_ID', $post['golongan_id']);
         $this->db->set('NOMOR_SK_BATAL', $post['no_sk_batal']);
         $this->db->set('TANGGAL_SK_BATAL', mysql_date($post['tgl_sk_batal']));
         if (!empty($post['riwayat_hukuman_id'])) {
             $this->db->set('USERUPDATE', user_id());
             $this->db->set('UPDATEDATE', 'NOW()', FALSE);
             $this->db->where('RIWAYAT_HUKUMAN_ID', $post['riwayat_hukuman_id']);
             $this->db->update('sp_riwayat_hukuman');
         } else {
             $this->db->set('USERINSERT', user_id());
             $this->db->set('INSERTDATE', 'NOW()', FALSE);
             $this->db->insert('sp_riwayat_hukuman');
         }
         if ($this->db->trans_status() === FALSE) {
             $this->db->trans_rollback();
             $success = FALSE;
         } else {
             $this->db->trans_commit();
             $success = TRUE;
         }
         return $success;
     }
 }
 public function saveRiwayatAngkaKredit($post)
 {
     if ($post) {
         $this->db->trans_begin();
         $this->db->set('NIP', $post['nip']);
         $this->db->set('ANGKA_KREDIT_PERTAMA', $post['AK_ANGKA_KREDIT_PERTAMA']);
         $this->db->set('JABATAN_ID', $post['AK_JABATAN_ID']);
         $this->db->set('NOMOR_SK', $post['AK_NOMOR_SK']);
         $this->db->set('TANGGAL_SK', mysql_date($post['AK_TANGGAL_SK']));
         $this->db->set('BULAN_MULAI_PENILAIAN', $post['AK_BULAN_MULAI_PENILAIAN']);
         $this->db->set('TAHUN_MULAI_PENILAIAN', $post['AK_TAHUN_MULAI_PENILAIAN']);
         $this->db->set('BULAN_SELESAI_PENILAIAN', $post['AK_BULAN_SELESAI_PENILAIAN']);
         $this->db->set('TAHUN_SELESAI_PENILAIAN', $post['AK_TAHUN_SELESAI_PENILAIAN']);
         $this->db->set('KREDIT_UTAMA_BARU', $post['AK_KREDIT_UTAMA_BARU']);
         $this->db->set('KREDIT_PENUNJANG_BARU', $post['AK_KREDIT_PENUNJANG_BARU']);
         $this->db->set('KREDIT_BARU_TOTAL', $post['AK_KREDIT_BARU_TOTAL']);
         if (!empty($post['riwayat_angka_kredit_id'])) {
             $this->db->set('USERUPDATE', user_id());
             $this->db->set('UPDATEDATE', 'NOW()', FALSE);
             $this->db->where('RIWAYAT_ANGKA_KREDIT_ID', $post['riwayat_angka_kredit_id']);
             $this->db->update('sp_riwayat_angka_kredit');
         } else {
             $this->db->set('USERINSERT', user_id());
             $this->db->set('INSERTDATE', 'NOW()', FALSE);
             $this->db->insert('sp_riwayat_angka_kredit');
         }
         if ($this->db->trans_status() === FALSE) {
             $this->db->trans_rollback();
             $success = FALSE;
         } else {
             $this->db->trans_commit();
             $success = TRUE;
         }
         return $success;
     }
 }
Esempio n. 13
0
 /**
  * Update user's time shift
  */
 public function save_shift()
 {
     $data['id'] = param('id|int');
     $data['staff_id'] = param('staff_id|int');
     // break if we dont have user's ID!
     if (empty($data['staff_id'])) {
         response_to(array('error' => 'Error, Staff ID is empty'));
         return;
     }
     // decode our row params from JSON
     $data['fromdate'] = mysql_date(not_empty(param('fromdate', FALSE, FALSE), now2mysql()));
     $data['shift_id'] = param('shift_id|int');
     try {
         $id = $this->staffshift->save($data);
         $data['id'] = $id;
         // make row for return if we create him
         $shiftheads = $this->shiftheads();
         //$data['shifts']      = $this->shifts( $id );
         $row = shift_row($data, TRUE, $shiftheads);
         //$id = $data['id'];
         $response = array('msg' => 'Good, TimeShift saved', 'id' => $id, 'row' => $row);
     } catch (Exception $e) {
         $response = array('error' => $e->getMessage());
     }
     response_to($response);
     return;
 }
 function parse_applications($feed_url, $authority_id)
 {
     $return_applications = array();
     //reset warnings
     //Grab the XML
     $xml = "";
     try {
         $xml = safe_scrape_page($feed_url);
     } catch (exception $e) {
         array_push($this->log, "ERROR: problem occured when grabbing feed: " . $feed_url . " ---->>>" . $e);
     }
     if ($xml == false) {
         $this->store_log("ERROR: empty feed feed: " . $feed_url);
     }
     //Turn the xml into an object
     $parsed_applications = simplexml_load_string($xml);
     //Loop through the applications, add tinyurl / google maps etc and add to array
     if (sizeof($parsed_applications) > 0) {
         foreach ($parsed_applications->applications->application as $parsed_application) {
             $application = new application();
             //Grab basic data from the xml
             $application->authority_id = $authority_id;
             $application->council_reference = $parsed_application->council_reference;
             $date_received_dmy = split("/", $parsed_application->date_received);
             if (count($date_received_dmy) == 3) {
                 $application->date_received = "{$date_received_dmy['2']}-{$date_received_dmy['1']}-{$date_received_dmy['0']}";
             } else {
                 // Make a best effort attempt to parse the date
                 $ts = strtotime($parsed_application->date_received);
                 if ($ts != FALSE && $ts != -1) {
                     $application->date_received = date("Y-m-d", $ts);
                 }
             }
             $application->address = $parsed_application->address;
             $application->description = $parsed_application->description;
             $application->info_url = $parsed_application->info_url;
             $application->comment_url = $parsed_application->comment_url;
             $application->date_scraped = mysql_date(time());
             //Make the urls
             $info_tiny_url = tiny_url($application->info_url);
             if ($info_tiny_url == "") {
                 $this->store_log("ERROR: Created blank info tiny url");
             }
             $comment_tiny_url = tiny_url($application->comment_url);
             if ($comment_tiny_url == "") {
                 $this->store_log("ERROR: Created blank comment tiny url");
             }
             if (isset($parsed_application->postcode)) {
                 //Workout the XY location from postcode
                 $xy = postcode_to_location($parsed_application->postcode);
                 $application->postcode = $parsed_application->postcode;
                 $application->x = $xy[0];
                 $application->y = $xy[1];
             } else {
                 if (isset($parsed_application->easting) && isset($parsed_application->northing)) {
                     $postcode = location_to_postcode($parsed_application->easting, $parsed_application->northing);
                     $application->postcode = $postcode;
                     $application->x = $parsed_application->easting;
                     $application->y = $parsed_application->northing;
                 }
             }
             $application->info_tinyurl = $info_tiny_url;
             $application->comment_tinyurl = $comment_tiny_url;
             $application->map_url = googlemap_url_from_postcode($application->postcode);
             //Add to array
             array_push($return_applications, $application);
         }
     }
     return $return_applications;
 }
Esempio n. 15
0
 unset($datos);
 if (isset($_FILES['fotografia']) && $_FILES['fotografia']['error'] == UPLOAD_ERR_OK) {
     $datos['fotografia'] = sha1(microtime());
     Imagen__Convertir_JPEG($_FILES['fotografia']['tmp_name'], 'IMG/fotografias/' . $datos['fotografia'] . '.jpg');
 }
 $datos['ID_empresa'] = usuario_cache('ID_empresa');
 $datos['ID_usuario'] = usuario_cache('ID_usuario');
 $datos['fecha_ingreso'] = mysql_date();
 $datos = array_merge($datos, array_intersect_key($_POST, array_flip(array('DUI', 'NIT', 'nombres', 'apellidos', 'conocido_por', 'op_fecha_nacimiento', 'op_lugar_nacimiento', 'op_direccion', 'op_correo', 'op_estado_civil', 'op_idioma', 'op_informatica', 'op_interes', 'op_referencias', 'op_telefono1', 'op_telefono2', 'op_movil1', 'op_movil2'))));
 $ID_empleado = db_agregar_datos(db_prefijo . 'empleado', $datos);
 // Su primer cargo laboral - aww :)
 unset($datos);
 $datos['ID_empresa'] = usuario_cache('ID_empresa');
 $datos['ID_usuario'] = usuario_cache('ID_usuario');
 $datos['ID_empleado'] = $ID_empleado;
 $datos['fecha_ingreso'] = mysql_date();
 $datos = array_merge($datos, array_intersect_key($_POST, array_flip(array('fecha_inicio', 'cargo', 'salario'))));
 $ID_historial = db_agregar_datos(db_prefijo . 'historial', $datos);
 echo '<h1>Resultado de solicitud de ingreso de nuevo registro de empleado</h1>';
 if ($ID_empleado && $ID_historial) {
     $mensaje['mensaje'] = 'El usuario <strong>' . usuario_cache('nombre') . '</strong>, añadió un nuevo empleado [<strong>' . $_POST['apellidos'] . ',' . $_POST['nombres'] . '</strong>] a su empresa.';
     $mensaje['tipo'] = 'info';
     mensaje(array(usuario_cache('ID_empresa')), array($mensaje));
     empleado_difundir_actualizaciones($_POST['DUI'], $_POST['NIT'], 'ha sido registrado en la empresa <strong>' . usuario_cache('razon_social') . '</strong>. Registrado con nombre <strong>' . $_POST['apellidos'] . ',' . $_POST['nombres'] . '</strong>.');
     echo '<p>Gracias, su solicitud de ingreso de datos a sido recibida y aceptada. El nuevo registro de empleado ya se encuentra disponible.</p>';
     echo '<p>Si desea añadir mas cargos laborales a su empleado dirijase a <a href="' . PROY_URL . '~empleado?cargo=' . $ID_empleado . '">cargos laborales para ' . $_POST['apellidos'] . ', ' . $_POST['nombres'] . '</a></p>';
     echo '<p>Tambien puede <a href="' . PROY_URL . '~empleado" alt="Empleados de su empresa">revisar sus registros de empleado</a>, <a href="' . PROY_URL . '~empleado?agregar" alt="Agregar empleado a su empresa">agregar otro empleado</a> o <a href="' . PROY_URL . '" title="Pagina de inicio de BCA">regresar a la pagina de inicio de BCA</a></p>';
     return;
 } else {
     $buffer = '<p class="error">Lo sentimos, sucedio un error desconocido y su solicitud no pudo ser procesada, puede intentarlo nuevamene si lo desea</p>';
 }
Esempio n. 16
0
     )
     return false;
 }
 $("#cmdCargarArchivo").click(function(){ajaxFileUpload();});
 ';
     break;
 case 8:
     $nPaso = "8: Información";
     $InfoPaso = "Ingrese cualquier nota que desee que tomemos en cuenta al momento de procesar esta orden";
     $Datos = "Notas y observaciones:<br />" . ui_textarea('txtNotas', _F_orden_cache('txtNotas'), '', 'width:99%');
     $InfoExtra = "Tip: Las sugerencias generales puede hacerlas utilizando el botón 'Comentarios' en el menú superior";
     $Recoger = 'txtNotas: $("#txtNotas").val()';
     $Script = '$("#cmdSiguiente").attr("value", "Imprimir");';
     break;
 case 9:
     $_SESSION['orden']['datos']['txtFechaorden'] = mysql_date('now');
     $id_orden = db_agregar_datos('ahm_ordenes', $_SESSION['orden']['datos']);
     $nPaso = "9. Confirmación";
     $InfoPaso = "Se ha completado con exito el asistente de solicitud de impresión.";
     $Datos = "Su número de comprobante de impresión es <b>" . $id_orden . "+" . $_SESSION['orden']['datos']['validacion'] . "</b>. Este número a sido registrado en el sistema y puede ser consultado en cualquier momento. Ud. necesitará este número para realizar cualquier consulta vía telefónica sobre el estado de esta impresión.<br /><br />Datos de la orden:<br /><br />" . dumpOrden($_SESSION['orden']['datos']);
     $InfoExtra = "La orden ha sido enviada y <b>no</b> puede modificarla.<br />Si desea intentar cancelarla puede comunicarse (lo antes posible) de forma telefonica con I·Print, se le solicitará el código de la orden de impresión.";
     $Script = '$("#cmdAnterior").hide();$("#cmdSiguiente").attr("value", "Nueva orden");$("#cmdAbortar").attr("value", "Salir");';
     despachar_notificaciones('El usuario ' . _F_usuario_cache('nombre') . ' ha solicitado un impresion para el ' . _F_orden_cache('txtFechaEntrega'));
     break;
 case 10:
     $nPaso = "Creando nueva orden...";
     $InfoPaso = "Por favor espere...";
     $Datos = "";
     $InfoExtra = "";
     $Script = "window.location='./?accion=orden'";
     break;
function get_url($url, $cache_hard = true)
{
    global $http_cache_timeout;
    global $api_calls;
    global $cached_api_calls;
    # Check whether we have a cached response for this URL
    # Note there are two cache timestamps: fetched_on_server is tied to the
    # server (mothership)'s clock and fetched_on is tied to the local clock.
    # We are careful to compare the local now() against fetched_on and the
    # server's "Date:" header values against fetched_on_server.
    if (!$http_cache_timeout) {
        throw new Exception("\$http_cache_timeout not set");
    }
    # Expire old cache entries.
    mysql_query('delete from http_cache where fetched_on < now() - ' . $http_cache_timeout);
    # Load a valid cache element, if any.
    $sql = 'select content, fetched_on_server from http_cache where url = \'' . mysql_real_escape_string($url) . '\' and fetched_on >= now() - ' . $http_cache_timeout;
    $q = mysql_query($sql);
    if (!$q) {
        throw new Exception("Getting cache, got database error: " . mysql_error());
    }
    require_once 'HTTP/Request.php';
    if ($row = mysql_fetch_row($q)) {
        list($content, $fetched_on) = $row;
        # Under "hard" caching, return the cached data without talking to server.
        if ($cache_hard) {
            message("Hard cache hit at {$url}");
            return $content;
        }
        # Under "soft" caching, we make a request to ask the server if the resource
        # has changed since our copy.
        $fetched_on_http_date = date(DATE_RFC1123, from_mysql_date($fetched_on));
        $req = new HTTP_Request($url);
        $req->addHeader('If-Modified-Since', $fetched_on_http_date);
        $request_timer -= microtime(true);
        $ok = $req->sendRequest();
        $request_timer += microtime(true);
        $cached_api_calls = $cached_api_calls + 1;
        if (!PEAR::isError($ok)) {
            $respCode = $req->getResponseCode();
            if (304 == $respCode) {
                # 304 Not Modified; we can use the cached copy.
                message('Cache hit at ' . $url . ' using If-Modified-Since: ' . $fetched_on_http_date . "Request timer: {$request_timer}" . 's');
                return $content;
            } elseif (200 <= $respCode && $respCode < 300) {
                # Got an OK response, use the data.
                message('Cache refresh at ' . $url . ' If-Modified-Since: ' . $fetched_on_http_date . '. Request timer: ' . $request_timer . 's');
                $content = $req->getResponseBody();
                $fetched_on_server = mysql_date(from_http_date($req->getResponseHeader('Date')));
                mysql_query('delete from http_cache where url = \'' . mysql_real_escape_string($url) . '\'');
                if (!insert_into('http_cache', array('url' => $url, 'content' => $content, 'fetched_on_server' => $fetched_on_server))) {
                    throw new Exception("Database error writing to HTTP cache: " . mysql_error());
                }
                return $content;
            }
        } else {
            throw new Exception("Error while GETing {$url} ({$ok})");
        }
    } else {
        $req = new HTTP_Request($url);
        $request_timer -= microtime(true);
        $ok = $req->sendRequest();
        $request_timer += microtime(true);
        $api_calls = $api_calls + 1;
        message("Cache miss at {$url} Request timer: " . $request_timer . "s");
        if (PEAR::isError($ok)) {
            throw new Exception("Unknown error trying GET {$url}");
        }
        $respCode = $req->getResponseCode();
        if (200 <= $respCode && $respCode < 300) {
            # Got an OK response, use it.
            $content = $req->getResponseBody();
            $fetched_on_server = mysql_date(from_http_date($req->getResponseHeader('Date')));
            mysql_query('delete from http_cache where url = \'' . mysql_real_escape_string($url) . '\'');
            if (!insert_into('http_cache', array('url' => $url, 'content' => $content, 'fetched_on_server' => $fetched_on_server))) {
                throw new Exception("Database error writing to HTTP cache: " . mysql_error());
            }
            return $content;
        } else {
            error("GET {$url} returned {$respCode}");
            return null;
        }
    }
}
		<?php 
echo get_msg();
?>
		<table class="table table-bordered tablesorter table-striped">
			<tr>
				<td width="20%" align="right"><strong>Nama pengirim :</strong></td>
				<td width="80%"><?php 
echo $contact->name;
?>
</td>
			</tr>

			<tr>
				<td align="right"><strong>Tanggal :</strong></td>
				<td><?php 
echo mysql_date($contact->created);
?>
</td>
			</tr>

			<tr>
				<td align="right"><strong>Email :</strong></td>
				<td><?php 
echo $contact->email;
?>
</td>
			</tr>

			<tr>
				<td align="right"><strong>Subject :</strong></td>
				<td><?php 
Esempio n. 19
0
?>
" method="post">
<table class="t100 vtop wauto">
<tr>
<td>
<p>Seleccione las empresas a las que aplicará el pago</p>
<select name="ID_empresa[]" size="20" multiple="multiple">
<?php 
echo $ui_lista_empresas;
?>
</select>
</td>
<td>
<p>Monto del pago en dólares ($USA) <input name="pago" type="text" value=""></p>
<p>Fecha de inicio de la válidez del pago <input name="fecha_inicio" class="datepicker" type="text" value="<?php 
echo mysql_date();
?>
"></p>
<p>Cantidad de días para el cúal el pago será válido (contando desde la fecha de inicio)<br />
<input name="cantidad_dias" type="text" value="0" /> o <input name="fecha_fin" class="datepicker" type="text" value="" />
</p>
<p><input name="pendiente" type="checkbox" checked="checked" value="1" /> Pago pendiente de cobro</p>
</td>
</tr>
</table>
<center><input name="grabar" value="Grabar pagos" type="submit" /></center>
</form>

<hr />
<h1>Pagos pendientes</h1>
<?php 
Esempio n. 20
0
 public function simpanDataEditTugasBelajarPegawai($post)
 {
     $success = FALSE;
     if ($post['current_tugas_id']) {
         $this->db->trans_begin();
         $this->db->set('TGL_MULAI_TUGAS', mysql_date($post['inputTglMulaitugas']));
         $this->db->set('TGL_SELESAI_TUGAS', mysql_date($post['inputTglselesaitugas']));
         $this->db->set('JENJANG_DIDIK', $post['jenjang_didik_id']);
         $this->db->set('JURUSAN', $post['inputJurusan']);
         $this->db->set('UNIVERSITAS', $post['inputUniversitas']);
         $this->db->where('TUGAS_ID', $post['current_tugas_id']);
         $insert = $this->db->update('sp_tugas_belajar');
         if ($this->db->trans_status() === FALSE) {
             $this->db->trans_rollback();
             $success = FALSE;
         } else {
             $this->db->trans_commit();
             $success = TRUE;
         }
     }
     return $success;
 }
 function run()
 {
     $db = DB::connect(DB_CONNECTION_STRING);
     //Grab all the users
     $sql = "select user_id, email, postcode, bottom_left_x, bottom_left_y, top_right_x, top_right_y, alert_area_size, confirm_id\n            from user\n            where confirmed = 1 and last_sent < " . $db->quote(mysql_date(time() - 20 * 60 * 60));
     $this->store_log("Grabbing users");
     $user_results = $db->getAll($sql);
     $this->store_log("Found " . sizeof($user_results) . " who havnt been checked since " . mysql_date(time() - 20 * 60 * 60));
     if (sizeof($user_results) > 0) {
         //Loop though users
         for ($i = 0; $i < sizeof($user_results); $i++) {
             //Find applications for that user
             $sql = "select distinct council_reference, address, \n                            postcode, description, info_tinyurl, \n                            comment_tinyurl, map_url, full_name\n                        from application\n                            inner join authority on application.authority_id = authority.authority_id \n                         where date_scraped > " . $db->quote(mysql_date(time() - 24 * 60 * 60)) . " and (application.x > " . $user_results[$i][3] . " and application.x < " . $user_results[$i][5] . ")\n                              and (application.y > " . $user_results[$i][4] . " and application.y < " . $user_results[$i][6] . ") and (application.y <> 0  and application.y <> 0 )";
             $application_results = $db->getAll($sql);
             //Send email if we have any
             if (sizeof($application_results) > 0) {
                 //Setup applications array (bit pikey this)
                 $applications = array();
                 for ($ii = 0; $ii < sizeof($application_results); $ii++) {
                     $application = new application();
                     $application->council_reference = $application_results[$ii][0];
                     $application->address = $application_results[$ii][1];
                     $application->postcode = $application_results[$ii][2];
                     $application->description = $application_results[$ii][3];
                     $application->info_tinyurl = $application_results[$ii][4];
                     $application->comment_tinyurl = $application_results[$ii][5];
                     $application->map_url = $application_results[$ii][6];
                     $application->authority_name = $application_results[$ii][7];
                     array_push($applications, $application);
                 }
                 $this->application_count += sizeof($applications);
                 //Smarty template
                 $smarty = new Smarty();
                 $smarty->force_compile = true;
                 $smarty->compile_dir = SMARTY_COMPILE_DIRECTORY;
                 $smarty->assign("applications", $applications);
                 $smarty->assign("base_url", BASE_URL);
                 $smarty->assign("confirm_id", $user_results[$i][8]);
                 $smarty->assign("alert_area_size", $user_results[$i][7]);
                 $smarty->assign("alert_postcode", $user_results[$i][2]);
                 //Get the email text
                 $email_text = $smarty->fetch(SMARTY_TEMPLATE_DIRECTORY . 'alert_email_text.tpl');
                 //Send the email
                 if ($email_text != "") {
                     send_text_email($user_results[$i][1], EMAIL_FROM_NAME, EMAIL_FROM_ADDRESS, "Planning applications near " . strtoupper($user_results[$i][2]), $email_text);
                     $this->email_count += 1;
                 } else {
                     $this->store_log("BLANK EMAIL TEXT !!! EMAIL NOT SENT");
                 }
                 //Update last sent
                 $sql = "update user set last_sent = " . $db->quote(mysql_date(time())) . " where user_id = " . $user_results[$i][0];
                 $db->query($sql);
                 $this->store_log("Updating last checked date/time");
             }
         }
     }
     $this->store_log("Sent " . $this->application_count . " applications  to " . $this->email_count . " people!");
     //update the number of apps sent
     $sql = "select `key`, `value` from stats";
     $stats_results = $db->getAll($sql);
     $new_application_total = 0;
     $new_email_total = 0;
     for ($i = 0; $i < sizeof($stats_results); $i++) {
         if ($stats_results[$i][0] == 'applications_sent') {
             $new_application_total = $stats_results[$i][1] + $this->application_count;
             $new_email_total = $stats_results[$i][1] + $this->email_count;
         }
     }
     //add stats to email
     $this->store_log("Total applications ever sent:  " . $new_application_total);
     $this->store_log("Total emails ever sent:  " . $new_email_total);
     //update stats in DB
     $sql = "update stats set `value` = " . $new_application_total . " where `key` = 'applications_sent'";
     $db->query($sql);
     $sql = "update stats set `value` = " . $new_email_total . " where `key` = 'emails_sent'";
     $db->query($sql);
     //Send the log
     send_text_email(LOG_EMAIL, "mailer@" . DOMAIN, "mailer@" . DOMAIN, "Planning mailer log", print_r($this->log, true));
 }
 function process()
 {
     if ($this->validate()) {
         //create & save leaflet
         $leaflet = factory::create('leaflet');
         $leaflet->title = $this->data['txtTitle'];
         $leaflet->description = $this->data['txtDescription'];
         $leaflet->publisher_party_id = $this->data['ddlPartyBy'];
         $leaflet->postcode = $this->data['txtPostcode'];
         $leaflet->lng = $this->lng;
         $leaflet->lat = $this->lat;
         $leaflet->name = $this->data['txtName'];
         $leaflet->email = $this->data['txtEmail'];
         //date delivered
         $days = $this->data['ddlDelivered'];
         if ((int) $days > 30) {
             $days = 30;
         }
         $date = mktime(0, 0, 0, date("m"), date("d") - $days, date("Y"));
         $leaflet->date_delivered = mysql_date($date);
         if ($leaflet->insert()) {
             //save images
             $image_ids = session_read("image_ids");
             $sequence = 1;
             foreach ($image_ids as $image_id) {
                 $leaflet_image = factory::create("leaflet_image");
                 $leaflet_image->leaflet_id = $leaflet->leaflet_id;
                 $leaflet_image->image_key = $image_id;
                 $leaflet_image->sequence = $sequence;
                 if (!$leaflet_image->insert()) {
                     trigger_error("Unable to save leaflet image");
                 }
                 $sequence++;
             }
             //TODO: move the code below into the leaflet object
             //save party attack
             foreach ($this->selected_party_attack_ids as $selected_party_attack_id) {
                 $leaflet_party_attack = factory::create("leaflet_party_attack");
                 $leaflet_party_attack->leaflet_id = $leaflet->leaflet_id;
                 $leaflet_party_attack->party_id = $selected_party_attack_id;
                 if (!$leaflet_party_attack->insert()) {
                     trigger_error("Unable to save leaflet party attack");
                 }
             }
             //save categories
             foreach ($this->selected_category_ids as $selected_category_id) {
                 $leaflet_category = factory::create("leaflet_category");
                 $leaflet_category->leaflet_id = $leaflet->leaflet_id;
                 $leaflet_category->category_id = $selected_category_id;
                 if (!$leaflet_category->insert()) {
                     trigger_error("Unable to save leaflet category");
                 }
             }
             //save tags
             $tag_string = trim($this->data['txtTags']);
             $tags = split(",", $tag_string);
             if ($tag_string != '' && isset($tag_string) && count($tags) > 0) {
                 foreach ($tags as $tag) {
                     $new_tag = factory::create('tag');
                     $new_tag->tag = $tag;
                     if (!$new_tag->insert()) {
                         trigger_error("Unable to save new tag");
                     }
                     $leaflet_tag = factory::create('leaflet_tag');
                     $leaflet_tag->leaflet_id = $leaflet->leaflet_id;
                     $leaflet_tag->tag_id = $new_tag->tag_id;
                     if (!$leaflet_tag->insert()) {
                         trigger_error("Unable to save leaflet/tag bridge");
                     }
                 }
             }
         } else {
             trigger_error("Unable to save leaflet");
         }
         //clear session
         session_delete('image_ids');
         //redirect with callback provided
         if ($this->viewstate['callback']) {
             redirect($this->viewstate['callback'] . "?v1=" . WWW_SERVER . "/leaflet.php?q=" . $leaflet->leaflet_id);
         } else {
             redirect("leaflet.php?q=" . $leaflet->leaflet_id . "&m=1");
         }
     } else {
         $this->bind();
         $this->render();
     }
 }
Esempio n. 23
0
 public function simpanDataPegawai($post, $nip = null)
 {
     $success = FALSE;
     if ($post) {
         $this->db->trans_begin();
         $this->db->set('NIP_LAMA', $post['inputNipLama']);
         $this->db->set('NAMA_PEGAWAI', $post['inputNama']);
         $this->db->set('GELAR_DEPAN', $post['inputGelarDepan']);
         $this->db->set('GELAR_BELAKANG', $post['inputGelarBelakang']);
         $this->db->set('GELAR_LAIN', $post['inputGelarLain']);
         $this->db->set('TEMPAT_LAHIR', $post['inputTempatLahir']);
         $this->db->set('TANGGAL_LAHIR', mysql_date($post['inputTanggaLahir']));
         //date
         $this->db->set('NO_AKTA_LAHIR', $post['inputNoAktaLahir']);
         $this->db->set('JENIS_KELAMIN', $post['inputJenisKelamin']);
         $this->db->set('AGAMA_ID', $post['inputAgama']);
         $this->db->set('ALAMAT', $post['inputAlamat']);
         $this->db->set('KODEPOS', $post['inputKodepos']);
         $this->db->set('NO_HANDPHONE', $post['inputHandphone']);
         $this->db->set('NO_TELEPHONE', $post['inputTelephone']);
         $this->db->set('NO_IDENTITAS', $post['inputNoIdentitas']);
         $this->db->set('GOLONGAN_DARAH', $post['inputGolonganDarah']);
         $this->db->set('BERAT_BADAN', $post['inputBeratBadan']);
         $this->db->set('TINGGI_BADAN', $post['inputTinggiBadan']);
         $this->db->set('WARNA_KULIT', $post['inputWarnaKulit']);
         $this->db->set('NO_SK_CPNS', $post['inputNoSKCPns']);
         $this->db->set('TANGGAL_SK_CPNS', mysql_date($post['inputTanggalSKCpns']));
         $this->db->set('TMT_SK_CPNS', mysql_date($post['inputTMTSKCpns']));
         $this->db->set('TMT_SPMT_CPNS', mysql_date($post['inputTMTSPCpns']));
         $this->db->set('NO_NPWP', $post['inputNoNpwp']);
         $this->db->set('TANGGAL_NPWP', mysql_date($post['inputTanggalNpwp']));
         $this->db->set('NO_BPJS', $post['inputNoBpjs']);
         $this->db->set('STATUS_KEPEMILIKAN_RUMAH', $post['inputStatusKepemilikanRumah']);
         $this->db->set('PHOTO', $post['inputPhoto']);
         $this->db->set('JENIS_PEGAWAI_ID', $post['inputJenisPegawai']);
         if ($post['mode'] == 'new') {
             $this->db->set('KEDUDUKAN_ID', '01');
             $this->db->set('NIP', $post['inputNip']);
             $this->db->set('USERINSERT', $post['user_id']);
             $this->db->set('INSERTDATE', 'NOW()', FALSE);
             $insert = $this->db->insert('sp_pegawai');
             if ($insert) {
                 # Insert Riwayat Jabatan
                 if (!empty($post['inputTanggalSKCpns']) && !empty($post['inputNoSKCPns']) && !empty($post['inputTMTSKCpns'])) {
                     $this->db->set('NIP', $post['inputNip']);
                     $this->db->set('UNOR_ID', $post['inputUnor']);
                     $this->db->set('JENIS_JABATAN_ID', '5');
                     $this->db->set('NOMOR_SK', $post['inputNoSKCPns']);
                     $this->db->set('TANGGAL_SK', mysql_date($post['inputTanggalSKCpns']));
                     $this->db->set('TMT_JABATAN', mysql_date($post['inputTMTSKCpns']));
                     $this->db->set('PENETAP_ID', 'G');
                     $this->db->set('INSERTDATE', 'NOW()', FALSE);
                     $this->db->set('USERINSERT', $this->dx_auth->get_user_id());
                     $this->db->insert('sp_riwayat_jabatan');
                 }
                 # Insert Riwayat Golongan
                 if (!empty($post['inputGolongan'])) {
                     $this->db->set('NIP', $post['inputNip']);
                     $this->db->set('KODE_JENIS_KP', '211');
                     $this->db->set('NOMOR_SK', $post['inputNoSKCPns']);
                     $this->db->set('TANGGAL_SK', mysql_date($post['inputTanggalSKCpns']));
                     $this->db->set('TMT_GOLONGAN', mysql_date($post['inputTMTSKCpns']));
                     $this->db->set('GOLONGAN_ID', $post['inputGolongan']);
                     $this->db->set('PENETAP_ID', 'G');
                     $this->db->set('INSERTDATE', 'NOW()', FALSE);
                     $this->db->set('USERINSERT', $this->dx_auth->get_user_id());
                     $this->db->insert('sp_riwayat_golongan');
                 }
                 # Insert Riwayat Unor
                 $this->db->set('NIP', $post['inputNip']);
                 $this->db->set('NOMOR_SK', $post['inputNoSKCPns']);
                 $this->db->set('TANGGAL_SK', mysql_date($post['inputTanggalSKCpns']));
                 $this->db->set('UNOR_ID', $post['inputUnor']);
                 $this->db->set('INSERTDATE', 'NOW()', FALSE);
                 $this->db->set('USERINSERT', $this->dx_auth->get_user_id());
                 $this->db->insert('sp_riwayat_unor');
                 #created user
                 $this->dx_auth->register($post['inputNip'], $post['inputNip'], $post['inputNip'] . "@bkd.jogjaprov.go.id");
             }
         } else {
             $this->db->set('USERUPDATE', $post['user_id']);
             $this->db->set('UPDATEDATE', 'NOW()', FALSE);
             $this->db->where('NIP', $post['inputNip']);
             $this->db->update('sp_pegawai');
         }
         if ($this->db->trans_status() === FALSE) {
             $this->db->trans_rollback();
             $success = FALSE;
         } else {
             $this->db->trans_commit();
             $success = TRUE;
         }
     }
     return $success;
 }
Esempio n. 24
0
    $WHERE .= ' AND aplicacion_valida="invalida"';
}
if (isset($_GET['esperando'])) {
    $WHERE .= ' AND aplicacion_valida="desconocido"';
}
if (isset($_GET['vendidas'])) {
    $WHERE .= ' AND aplicacion_valida="vendida"';
}
if (isset($_GET['cerradas'])) {
    $WHERE = 'AND fecha_cerrada';
}
if (isset($_GET['fecha_inicio']) && isset($_GET['fecha_final'])) {
    $WHERE .= sprintf(' AND DATE(fecha_ingresada) BETWEEN "%s" AND "%s"', mysql_date(str_replace('/', '-', $_GET['fecha_inicio'])), mysql_date(str_replace('/', '-', $_GET['fecha_final'])));
}
if (isset($_GET['fecha_ingresada'])) {
    $WHERE .= sprintf(' AND DATE(fecha_ingresada)="%s"', mysql_date(str_replace('/', '-', $_GET['fecha_ingresada'])));
}
if (isset($_GET['grupo'])) {
    $WHERE .= sprintf(' AND ID_agente_sv IN (SELECT ID_usuario FROM ' . db_prefijo . 'usuarios WHERE ID_supervisor=(SELECT ID_supervisor FROM ' . db_prefijo . 'supervisores WHERE ID_usuario=%s)) ', _F_usuario_cache('ID_usuario'));
}
if (isset($_GET['supervisor'])) {
    $WHERE .= sprintf(' AND ID_agente_sv IN (SELECT ID_usuario FROM ' . db_prefijo . 'usuarios WHERE ID_supervisor=' . $_GET['supervisor'] . ') ', _F_usuario_cache('ID_usuario'));
}
switch (_F_usuario_cache('nivel')) {
    /*
    case _N_administrador_sv:
        $WHERE .= sprintf(' AND ID_agente_sv IN (SELECT ID_usuario FROM '.db_prefijo.'usuarios WHERE ID_supervisor=(SELECT ID_supervisor FROM '.db_prefijo.'supervisores WHERE ID_usuario=%s)) ', _F_usuario_cache('ID_usuario'));
        break;
    */
    case _N_administrador_sv:
        $WHERE .= sprintf(' AND ID_agente_sv<>0');
Esempio n. 25
0
 function populate_new($email, $postcode, $alert_area_size)
 {
     //Set email, postcode and size
     $this->email = $email;
     $this->postcode = $postcode;
     $this->alert_area_size = $alert_area_size;
     //cleanup postcode
     $this->postcode = str_replace(" ", "", $this->postcode);
     $this->postcode = strtolower($this->postcode);
     //Get xy of the postcode
     $xy = postcode_to_location($postcode);
     //if we couldent find the XY, throw an exception
     if ($xy == false) {
         //throw new exception("Something bad happened when trying to convert postcode to X 'n Y");
     }
     //Get actual size of zone
     $area_size_meters = alert_size_to_meters($this->alert_area_size);
     //Work out bounding box + buffer area (assumes OSGB location == meters)
     $area_buffered_meters = $area_size_meters + $area_size_meters / 100 * ZONE_BUFFER_PERCENTAGE;
     $this->bottom_left_x = $xy[0] - $area_buffered_meters / 2;
     $this->bottom_left_y = $xy[1] - $area_buffered_meters / 2;
     $this->top_right_x = $xy[0] + $area_buffered_meters / 2;
     $this->top_right_y = $xy[1] + $area_buffered_meters / 2;
     //Make a confirmation ID for them (no unique check, ho hum)
     $this->confirm_id = substr(md5(rand(5, 15) . time()), 0, 20);
     $this->confirmed = false;
     //Set last sent date to yesterday
     $this->last_sent = mysql_date(time() - 24 * 60 * 60);
 }
Esempio n. 26
0
             $_SESSION["sess_msg"] = "Invalid file type!";
         } else {
             $imgpath = "image/";
             //img folder with slash in last
             //$small_imgpath="image/thumb/";//small img folder with slash in last
             $image = time() . str_replace(" ", "", $_FILES["image"]["name"]);
             @move_uploaded_file($_FILES["image"]["tmp_name"], $imgpath . $image);
             //@resize_img($imgpath.$image,100,80,false); //use it for image resize
             //@copy($imgpath.$image,$small_imgpath.$image);
             $new_name = "image/" . $image;
             // @watermark_image($imgpath . $image, $new_name);//for creating watermark with png logo, but does not add watermarks to a png image
             //@watermark_text($imgpath.$image, $new_name, 20, "RN", "Kushwaha");//for creating watermark with text, does not add watermarks to a png image
         }
     }
 }
 $added_date = mysql_date($added_date);
 $datetime = format_date_time_mysql($datetime);
 if (!$id) {
     //insert query
     $sql = "insert into tbl_products (product_code, product_name, product_desc, image, price, added_by, added_date, datetime, status)  values( ?, ?, ?, ?, ?, ?, ?, ?, ?)";
     $stmt = $conn->prepare($sql);
     if ($stmt === false) {
         trigger_error("Wrong SQL: " . $sql . " Error: " . $conn->error, E_USER_ERROR);
     }
     $stmt->bind_param("ssssdissi", $product_code, $product_name, $product_desc, $image, $price, $added_by, $added_date, $datetime, $status);
     $stmt->execute();
     if ($stmt->affected_rows) {
         $_SESSION["sess_msg"] = $stmt->affected_rows . " Products inserted Successfully with id: " . $stmt->insert_id;
         $stmt->close();
         header("Location: products_addf.php");
         exit;
Esempio n. 27
0
}
// Viendo un prospecto numerado
if (isset($_GET['p']) && empty($_GET['r'])) {
    $WHERE = 'ID_prospecto="' . db_codex($_GET['p']) . '"';
}
$c = 'SELECT `ID_prospecto`, `situacion`, IF(`ultima_presentacion`,`ultima_presentacion`,"Nunca") AS "ultima_presentacion", `intentos`, `apellido`, `nombre`, `direccion1`, `direccion2`, `ciudad`, `estado`, `zip`, `telefono`, `especial2`, `especial3`, `especial5`, `especial6`, `especial7`, `interes`, `tipo` FROM `' . db_prefijo . 'prospectos` WHERE ' . $WHERE;
$r = db_consultar($c);
if (!mysql_num_rows($r)) {
    echo '<p>No hay prospectos disponibles en este momento.</p>';
    return;
}
$f = mysql_fetch_assoc($r);
// Configuracion de _prospecto_encuesta
$ID_prospecto = $f['ID_prospecto'];
// Tocar para que no le salga a nadie mas por este dia
db_actualizar_datos(db_prefijo . 'prospectos', array('ultima_presentacion' => mysql_date()), 'ID_prospecto=' . $f['ID_prospecto']);
// Obtengamos los recordatorios de esta hora...
$c = 'SELECT `ID_recordatorio`, `ID_usuario`, `ID_prospecto`, `fecha`, `nota`, `nombre`, `apellido` FROM `' . db_prefijo . 'recordatorio` LEFT JOIN `' . db_prefijo . 'prospectos` USING(ID_prospecto) WHERE ID_usuario=' . _F_usuario_cache('ID_usuario') . ' AND ( `fecha` < (NOW() + INTERVAL 5 MINUTE) )';
$rr = db_consultar($c);
echo '<h2>Recordatorios programados para esta hora</h2>';
if (mysql_num_rows($rr)) {
    echo '<table class="tabla-estandar">';
    echo '<tr><th width="30%">Fecha</th><th>Prospecto</th><th width="50%">Nota</th><th>Enlace</th></tr>';
    while ($ff = mysql_fetch_assoc($rr)) {
        echo sprintf('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $ff['fecha'], $ff['apellido'] . ' , ' . $ff['nombre'], $ff['nota'], '<a href="' . PROY_URL_ACTUAL . '?p=' . $ff['ID_prospecto'] . '&r=' . $ff['ID_recordatorio'] . '">ver</a>');
    }
    echo '</table><hr style="border:1px solid #F00;"/>';
} else {
    echo '<p>Por el momento no hay ningún recordatorio que mostrar.<br /> Todos los recordatorios pendientes se muestran 5 minutos antes de la hora programada.</p>';
}
if ($f['tipo'] == 'debt') {
Esempio n. 28
0
 public function simpanDataPengangkatanPegawai($post, $nip = null)
 {
     $setangkat = FALSE;
     $success = FALSE;
     if ($post) {
         $this->db->trans_begin();
         if (!empty($post['inputNoSuratSehat']) && !empty($post['inputTglSuratSehat'])) {
             $datesuratsehat = date("Y-m-d", strtotime($post['inputTglSuratSehat']));
             // update ke sp_pegawai no dan tanggal surat sehat
             $this->db->set('NO_SURAT_SEHAT', $post['inputNoSuratSehat']);
             $this->db->set('TGL_SURAT_SEHAT', $datesuratsehat);
             $this->db->where('NIP', $post['current_nip']);
             $this->db->update('sp_pegawai');
             $setangkat = TRUE;
         } else {
             $setangkat = FALSE;
         }
         if (!empty($post['inputNoSuratPrajab']) && !empty($post['inputTglSuratPrajab'])) {
             $dateprajab = date("Y-m-d", strtotime($post['inputTglSuratPrajab']));
             //cek udah pernah diisi blm
             $querydiklat = "SELECT RIWAYAT_DIKLAT_ID FROM sp_riwayat_diklat WHERE NIP = '" . $post['current_nip'] . "' AND PENGANGKATAN_CPNS = 1";
             $datadiklat = $this->dbQueryCache($querydiklat, 'row', 100);
             if (empty($datadiklat)) {
                 //insert ke riwayat diklat -> sp_riwayat_diklat
                 $this->db->set('TANGGAL_MULAI', $dateprajab);
                 $this->db->set('TANGGAL_SELESAI', $dateprajab);
                 $this->db->set('NOMOR_SERTIFIKAT', $post['inputNoSuratPrajab']);
                 $this->db->set('NIP', $post['current_nip']);
                 $this->db->set('PENGANGKATAN_CPNS', 1);
                 $this->db->insert('sp_riwayat_diklat');
             }
             $setangkat = TRUE;
         } else {
             $setangkat = FALSE;
         }
         // insert ke riwayat golongan -> sp_riwayat_golongan
         // cari data pegawai dulu
         $query = "SELECT * FROM sp_pegawai WHERE nip = '" . $post['current_nip'] . "'";
         $run = $this->dbQueryCache($query, 'row', 300);
         if (!empty($post['inputSKPengangkatan']) && !empty($post['inputTglSKPengangkatan']) && !empty($post['inputTMTPengangkatan'])) {
             //cek udah pernah diisi blm
             $querygol = "SELECT \tRIWAYAT_GOLONGAN_ID FROM sp_riwayat_golongan WHERE NIP = '" . $post['current_nip'] . "' AND PENGANGKATAN_CPNS = 1";
             $datagolongan = $this->dbQueryCache($querygol, 'row', 100);
             if (empty($datagolongan)) {
                 $this->db->set('NIP', $post['current_nip']);
                 $this->db->set('NOMOR_SK', $post['inputSKPengangkatan']);
                 $this->db->set('KODE_JENIS_KP', '211');
                 $this->db->set('TANGGAL_SK', mysql_date($post['inputTglSKPengangkatan']));
                 // $this->db->set( 'GOLONGAN_ID', mysql_date($run['CPNS_GOLONGAN_ID']) );
                 $this->db->set('GOLONGAN_ID', $run['CPNS_GOLONGAN_ID']);
                 $this->db->set('TMT_GOLONGAN', mysql_date($post['inputTMTPengangkatan']));
                 $this->db->set('INSERTDATE', 'NOW()', FALSE);
                 $this->db->set('PENGANGKATAN_CPNS', 1);
                 $this->db->set('INSERTDATE', 'NOW()', FALSE);
                 $insert = $this->db->insert('sp_riwayat_golongan');
             }
             $setangkat = TRUE;
         } else {
             $setangkat = FALSE;
         }
         if ($setangkat === TRUE) {
             // update cpns jadi pns
             $this->db->set('STATUS_PEGAWAI', 2);
             $this->db->set('KEDUDUKAN_ID', '01');
             $this->db->where('NIP', $post['current_nip']);
             $this->db->update('sp_pegawai');
         }
         if ($this->db->trans_status() === FALSE) {
             $this->db->trans_rollback();
             $success = FALSE;
         } else {
             $this->db->trans_commit();
             $success = TRUE;
         }
     }
     return $success;
 }
Esempio n. 29
0
 function process()
 {
     if ($this->validate()) {
         //create & save leaflet
         $leaflet = factory::create('leaflet');
         $leaflet->title = trim($this->data['txtTitle']);
         $leaflet->description = $this->data['txtDescription'];
         $leaflet->publisher_party_id = $this->data['ddlPartyBy'];
         $leaflet->postcode = trim($this->data['txtPostcode']);
         $leaflet->lng = $this->lng;
         $leaflet->lat = $this->lat;
         $leaflet->name = trim($this->data['txtName']);
         $leaflet->email = trim($this->data['txtEmail']);
         $leaflet->live = 1;
         //date delivered
         $days = (int) $this->data['ddlDelivered'];
         if ($days > 90) {
             $days = 90;
         }
         $date = mktime(0, 0, 0, date("m"), date("d") - $days, date("Y"));
         $leaflet->date_delivered = mysql_date($date);
         if ($leaflet->insert()) {
             //save images
             $images = $this->get_images_from_que();
             $sequence = 1;
             foreach ($images as $image) {
                 $leaflet_image = factory::create("leaflet_image");
                 $leaflet_image->leaflet_id = $leaflet->leaflet_id;
                 $leaflet_image->image_key = $image->image_key;
                 $leaflet_image->sequence = $sequence;
                 if (!$leaflet_image->insert()) {
                     trigger_error("Unable to save leaflet image");
                 }
                 $sequence++;
             }
             //TODO: move the code below into the leaflet object
             //save party attack
             foreach ($this->selected_party_attack_ids as $selected_party_attack_id) {
                 $leaflet_party_attack = factory::create("leaflet_party_attack");
                 $leaflet_party_attack->leaflet_id = $leaflet->leaflet_id;
                 $leaflet_party_attack->party_id = $selected_party_attack_id;
                 if (!$leaflet_party_attack->insert()) {
                     trigger_error("Unable to save leaflet party attack");
                 }
             }
             //save categories
             foreach ($this->selected_category_ids as $selected_category_id) {
                 $leaflet_category = factory::create("leaflet_category");
                 $leaflet_category->leaflet_id = $leaflet->leaflet_id;
                 $leaflet_category->category_id = $selected_category_id;
                 if (!$leaflet_category->insert()) {
                     trigger_error("Unable to save leaflet category");
                 }
             }
             //save tags
             $tag_string = trim($this->data['txtTags']);
             // match, all, these, and these, "and these"
             $tag_string = preg_replace("/[^a-z0-9, ]/i", '', $tag_string);
             // drop extended chars
             preg_match_all("/[\\w ]+/i", $tag_string, $found_tags);
             // search for tags
             $tags = array_map('trim', $found_tags[0]);
             // trim found tags
             $tags = array_unique($tags);
             // remove dupes
             if ($tag_string != '' && isset($tag_string) && count($tags) > 0) {
                 foreach ($tags as $tag) {
                     $new_tag = factory::create('tag');
                     $new_tag->tag = trim($tag);
                     if (!$new_tag->insert()) {
                         trigger_error("Unable to save new tag");
                     }
                     $leaflet_tag = factory::create('leaflet_tag');
                     $leaflet_tag->leaflet_id = $leaflet->leaflet_id;
                     $leaflet_tag->tag_id = $new_tag->tag_id;
                     if (!$leaflet_tag->insert()) {
                         trigger_error("Unable to save leaflet/tag bridge");
                     }
                 }
             }
             // Now save the constituency
             $leaflet_constituency = factory::create('leaflet_constituency');
             $leaflet_constituency->leaflet_id = $leaflet->leaflet_id;
             $leaflet_constituency->constituency_id = $this->constituency_id;
             if (!$leaflet_constituency->insert()) {
                 trigger_error("Unable to save constituency information");
             }
         } else {
             trigger_error("Unable to save leaflet");
         }
         //clear session
         session_delete('image_ids');
         //clear the image que for this upload
         $this->clear_images_from_que();
         //redirect with callback provided
         if ($this->viewstate['callback']) {
             redirect($this->viewstate['callback'] . "?v1=" . WWW_SERVER . "/leaflets/" . $leaflet->leaflet_id . "/");
         } else {
             redirect("leaflets/" . $leaflet->leaflet_id . "?m=1");
         }
     } else {
         $this->bind();
         $this->render();
     }
 }
Esempio n. 30
0
 public function saveRiwayatJabatan($post)
 {
     if ($post) {
         $this->db->trans_begin();
         $this->db->set('NIP', $post['nip']);
         $this->db->set('UNOR_ID', $post['unor_id']);
         $this->db->set('UNIT_ID', $post['unit_id']);
         $this->db->set('SUBUNIT_ID', $post['subunit_id']);
         $this->db->set('JENIS_JABATAN_ID', $post['jabatan_id']);
         $this->db->set('TANGGAL_SK', mysql_date($post['tgl_sk']));
         $this->db->set('TMT_JABATAN', mysql_date($post['tmt_jabatan']));
         $this->db->set('TMT_PELANTIKAN', mysql_date($post['tmt_pelantikan']));
         $this->db->set('ESELON_ID', $post['eselon_id']);
         $this->db->set('PENETAP_ID', $post['penetap_id']);
         $this->db->set('NOMOR_SK', $post['no_sk']);
         $this->db->set('JENJANG_JABATAN_ID', $post['jenjang_jabatan_id']);
         if (!empty($post['riwayat_jabatan_id'])) {
             $this->db->set('USERUPDATE', user_id());
             $this->db->set('UPDATEDATE', 'NOW()', FALSE);
             $this->db->where('RIWAYAT_JABATAN_ID', $post['riwayat_jabatan_id']);
             $this->db->update('sp_riwayat_jabatan');
         } else {
             $this->db->set('USERINSERT', user_id());
             $this->db->set('INSERTDATE', 'NOW()', FALSE);
             $this->db->insert('sp_riwayat_jabatan');
         }
         if ($this->db->trans_status() === FALSE) {
             $this->db->trans_rollback();
             $success = FALSE;
         } else {
             $this->db->trans_commit();
             $success = TRUE;
         }
         return $success;
     }
 }