Commit 70b89a41 by nurchamim

menambahkan asset default foto saat cetak biodata

parent 19205995
......@@ -22,35 +22,15 @@ function __file_exists($jenis=null, $url=null){
return $file;
}
// function __file_exists($jenis=null, $url=null){
// $ch = curl_init($url);
// curl_setopt($ch, CURLOPT_NOBODY, true);
// curl_exec($ch);
// $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// curl_close($ch);
// if($httpCode == 200){
// $file = $url;
// }else{
// switch($jenis) {
// case 'foto':
// $file = base_url()."assets/images/default-foto.svg";
// break;
// case 'file':
// $file = base_url()."assets/images/default-image.svg";
// break;
// case 'logo':
// $file = base_url()."assets/images/default-logo.svg";
// break;
// case 'absensi':
// $file = base_url()."assets/images/default-foto-absensi.svg";
// break;
// case 'lokasi':
// $file = base_url()."assets/images/lokasi-not-found.svg";
// break;
// default:
// $file = base_url()."assets/images/default-image.svg";
// }
// }
// return $file;
// }
function __file_exists_image($jenis=null, $url=null){
switch($jenis) {
case 'photo':
$file = _MYPATH."assets/images/default-foto.png";
break;
default:
$file = "";
}
return $file;
}
......@@ -81,7 +81,8 @@ class Data_keluarga_m extends CI_Model {
}else{
$id_company = $this->session->userdata('id_company');
$nextId = $this->fungsi->getNextId('data_keluarga','id_keluarga',$id_company,4);
$id_keluarga = array('id_keluarga' => $nextId);
// $id_keluarga = array('id_keluarga' => $nextId);
$nextId = $this->getNextId_keluarga();
$save = $this->db->insert('data_keluarga', array_merge($data, $id_keluarga));
return __response_save($save);
}
......@@ -94,4 +95,28 @@ class Data_keluarga_m extends CI_Model {
return __response_delete($delete);
}
public function getNextId_keluarga()
{
$gedId = $this->db->query("SELECT RIGHT(MAX(id_keluarga), 4) as id
FROM data_keluarga_p
WHERE id_company = '$this->id_company'
AND LEFT(id_keluarga, '".strlen($this->id_company.date('Ym'))."') = CONCAT('".$this->id_company."',DATE_FORMAT(CURRENT_DATE(),'%Y%m'))")->row();
if(!empty($gedId->id)){
$nextid = $this->id_company.date('Ym').sprintf("%04d", ($gedId->id+1));
}else{
$gedId = $this->db->query("SELECT RIGHT(MAX(id_keluarga), 4) as id
FROM data_keluarga
WHERE id_company = '$this->id_company'
AND LEFT(id_keluarga, '".strlen($this->id_company.date('Ym'))."') = CONCAT('".$this->id_company."',DATE_FORMAT(CURRENT_DATE(),'%Y%m'))")->row();
if(!empty($gedId->id)){
$nextid = $this->id_company.date('Ym').sprintf("%04d", ($gedId->id+1));
}else{
$nextid = $this->id_company.date('Ym').'0001';
}
}
return $nextid;
}
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Data_keluarga_histori_m extends CI_Model {
public $table = 'data_keluarga_h';
public $table = 'data_keluarga_h';
function get_datatables(){
$this->_get_datatables_query();
......@@ -21,9 +21,11 @@ class Data_keluarga_histori_m extends CI_Model {
public function count_all(){
$this->db->select("id")->from($this->table);
$this->db->where('id_karyawan', $this->input->get('id_karyawan'));
$this->db->where("id_company",$this->session->userdata('id_company'));
return $this->db->count_all_results();
}
private function _get_datatables_query(){
$this->db->select("id, action, hub_keluarga, tgl_input")->from($this->table);
$this->db->where('id_karyawan', $this->input->get('id_karyawan'));
......
......@@ -1114,7 +1114,7 @@
}
?>
<input type="hidden" name="foto_lama" id="foto_lama" value="<?= $data->foto ?>">
<input type="file" name="foto" id="foto" id="input-file-now-custom-1" class="dropify" <?= $foto ?> data-allowed-file-extensions="jpg png jpeg" />
<input type="file" name="foto" id="foto" id="input-file-now-custom-1" class="dropify" <?= $foto ?> data-allowed-file-extensions="jpg png jpeg" data-max-file-size="2M">
</div>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment