Add.php dosyasında şu kodu buldum.
<script>
$(document).ready(function() {
var slug = function(str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.replace("Ş","s");
str = str.replace("ş","s");
str = str.replace("Ğ","g");
str = str.replace("ğ","g");
str = str.replace("I","i");
str = str.replace("İ","i");
str = str.replace("Ç","c");
str = str.replace("ç","c");
str = str.replace("Ü","u");
str = str.replace("ü","u");
str = str.replace("Ö","ö");
str = str.replace("ö","o");
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = 'ãàáäâẽèéëêìíïîõòóöôùúüûñç·/_,:;';
var to = 'aaaaaeeeeeiiiiooooouuuunc------';
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}
str = str.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
.replace(/\s+/g, '-') // collapse whitespace and replace by -
.replace(/-+/g, '-'); // collapse dashes
return str;
};
<?php
$fields = array();
foreach($this->columns as $key=>$value){
$field = $value['Field'];
$fields[] = $field;
}
// Check if Table Exists in Required Fields Array
if (array_key_exists($this->table, $this->required_fields)) {
$required_fields = $this->required_fields[$this->table];
}else{
$required_fields = $this->required_fields;
}
// Check if Table Exists in File Fields Array
$file_fields_names=array();
if (array_key_exists($this->table, $this->file_fields)) {
$file_fields = $this->file_fields[$this->table];
foreach($file_fields as $db_key => $field_info){
$file_fields_names[$db_key]=$field_info['field'];
}
}else{
$file_fields = $this->file_fields;
}
// Validation of Reqired Fields Array
foreach($required_fields as $required){
if (in_array($required, $fields)) {
echo "
$('#".$required."').attr('data-trigger','change');
$('#".$required."').attr('data-required','true');
$('#".$required."').addClass('parsley-validated');
";
}
}
// Check if Table Exists in Slug Fields
if (array_key_exists($this->table, $this->slug_fields)) {
$slug_fields = $this->slug_fields[$this->table];
}else{
$slug_fields = "";
}
if (array_key_exists($this->table, $this->date_fields)) {
$date_fields = $this->date_fields[$this->table];
}else{
$date_fields = array();
}
foreach($slug_fields as $key=>$value){
//pr($slug_fields);
if (array_key_exists('main', $value)) {
echo "
$('#".$value['secondary']."').attr('readonly','readonly');
$('#".$value['secondary']."').parent().parent().hide();
$('#".$value['main']."').live('keyup',function(){
var slugval = slug($('#".$value['main']."').attr('value'));
$('#".$value['secondary']."').attr('value',slugval);
});";
}
};
//relationship fields
$rel_main_fields_array=array();
foreach($this->get_another_data as $db_id=>$rel_info)
{
if($rel_info['is_multiple']==1)
$rel_main_fields_array[]=$rel_info['main_field'];
}
?>
});
</script>
<script>
İçerisine şu kodları ekleyince oldu