<commit_before><?php
defined('BASEPATH') OR exit('No direct script access allowed');

/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
| files.  Please see the user guide for info:
|
|	http://codeigniter.com/user_guide/general/hooks.html
|
*/

function genderString( $gender ){
	switch ($gender) {
		case 'L':
			return 'Laki-Laki';
			break;
		case 'P':
			return 'Perempuan';
			break;
		default:
			return 'Error';
			break;
	}
}

function genderInt( $gender ){
	switch ($gender) {
		case 'L':
			return 1;
			break;
		case 'P':
			return 2;
			break;
		default:
			return 0;
			break;
	}
}

function return_flag( $bool )
{
	if( $bool )
		return 1;
	else
		return 0;
}

function insert_flag( $bool )
{
	if( $bool )
		return lang('message_success_insert');
	else
		return lang('message_error_insert');
}

function update_flag( $bool )
{
	if( $bool )
		return lang('message_success_update');
	else
		return lang('message_error_update');
}

function delete_flag( $bool )
{
	if( $bool )
		return lang('message_success_delete');
	else
		return lang('message_error_delete');
}

function to_db_date($string)
{
	if($string)
	{
		$string = date('Y-m-d', strtotime($string));
	}

	return $string;
}

function datePrint($string)
{
	if($string)
	{
		$string = date('d-M-Y', strtotime($string));
	}

	return $string;
}

function reverseDate($strDate)
{
    if ( $strDate )
    {
        $buffer = explode( '-' , $strDate );
        $first = $buffer[2];
        $mid = $buffer[1];
        $last = $buffer[0];

        return $first.'-'.$mid.'-'.$last;
    }
    else
    {
        return $strDate;
    }
}

function year_list()
{
	$year = array();
	$now = date('Y');
	$minyear = 1985;
	for($i=$minyear;$i<=$now;$i++)
	{
		$year[$i] = $i;
	}
	return $year;
}

function month_list()
{
	$month = array(
		1 => lang('januari'),
		2 => lang('februari'),
		3 => lang('maret'),
		4 => lang('april'),
		5 => lang('mei'),
		6 => lang('juni'),
		7 => lang('juli'),
		8 => lang('agustus'),
		9 => lang('september'),
		10 => lang('oktober'),
		11 => lang('november'),
		12 => lang('desember')
		);
	
	return $month;	
}

function date_list()
{
	$date = array();
	for($i=1;$i<=31;$i++){
		$date[$i] = $i;
	}

	return $date;
}

function userStatus($int)
{
	switch ($int) {
		case 1:
			return 'Active';
			break;
		
		default:
			return 'Inactive';<commit_msg>edit hooks<commit_after><?php
defined('BASEPATH') OR exit('No direct script access allowed');

/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
| files.  Please see the user guide for info:
|
|	http://codeigniter.com/user_guide/general/hooks.html
|
*/

function genderString( $gender ){
	switch ($gender) {
		case 'L':
			return 'Laki-Laki';
			break;
		case 'P':
			return 'Perempuan';
			break;
		default:
			return 'Error';
			break;
	}
}

function genderInt( $gender ){
	switch ($gender) {
		case 'L':
			return 1;
			break;
		case 'P':
			return 2;
			break;
		default:
			return 0;
			break;
	}
}

function tempHash($string, $option)
{
	$pass = password_hash($string, PASSWORD_BCRYPT, $option);
	return $pass;
}

function return_flag( $bool )
{
	if( $bool )
		return 1;
	else
		return 0;
}

function insert_flag( $bool )
{
	if( $bool )
		return lang('message_success_insert');
	else
		return lang('message_error_insert');
}

function update_flag( $bool )
{
	if( $bool )
		return lang('message_success_update');
	else
		return lang('message_error_update');
}

function delete_flag( $bool )
{
	if( $bool )
		return lang('message_success_delete');
	else
		return lang('message_error_delete');
}

function to_db_date($string)
{
	if($string)
	{
		$string = date('Y-m-d', strtotime($string));
	}

	return $string;
}

function datePrint($string)
{
	if($string)
	{
		$string = date('d-M-Y', strtotime($string));
	}

	return $string;
}

function reverseDate($strDate)
{
    if ( $strDate )
    {
        $buffer = explode( '-' , $strDate );
        $first = $buffer[2];
        $mid = $buffer[1];
        $last = $buffer[0];

        return $first.'-'.$mid.'-'.$last;
    }
    else
    {
        return $strDate;
    }
}

function year_list()
{
	$year = array();
	$year[''] = lang('date_year');
	$now = date('Y');
	$minyear = 1985;
	for($i=$minyear;$i<=$now;$i++)
	{
		$year[$i] = $i;
	}
	return $year;
}

function month_list()
{
	$month = array(
		'' => lang('date_month'),
		1 => lang('januari'),
		2 => lang('februari'),
		3 => lang('maret'),
		4 => lang('april'),
		5 => lang('mei'),
		6 => lang('juni'),
		7 => lang('juli'),
		8 => lang('agustus'),
		9 => lang('september'),
		10 => lang('oktober'),
		11 => lang('november'),
		12 => lang('desember')
		);
	
	return $month;	
}

function date_list()
{
	$date = array();
	$date[''] = lang('date_date');
	for($i=1;$i<=31;$i++){
		$date[$i] = $i;
	}
	return $date;
}

function userStatus($int)
{
	switch ($int) {
		case 1:
			return 'Active';
			break;
		
		default:
			return 'Inactive';
{'fraction_non_alphanumeric': 0.23575376405565085, 'fraction_numerical': 0.011816275967219363, 'mean_word_length': 2.631833910034602, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6617762', 'n_tokens_mistral': 2094, 'n_tokens_neox': 1927, 'n_words': 428}