[eluser]daulex[/eluser]
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Date_eu extends jTabyForms
{
function Date_eu($name,$params) {
jTabyForms::initiate($name,$params);
}
function prepForDisplay($value){
if(!empty($value) AND ($value != 0 AND $value != "0000-00-00")){
$explode = explode('-',$value);
return date('F j, Y',mktime(0,0,0,$explode[1],$explode[2],$explode[0]));
}
else
return '';
}
function prepForDB($value){
$valori=explode("/",$value);
$date_eu=$valori[2]."-".$valori[1]."-".$valori[0];
return ($date_eu);
}
function getHTML()
{
$CI = &get;_instance();
$CI->codextemplates->css_assets('css-datepicker','ui.datepicker.css');
$CI->codextemplates->js('js-datepicker','ui.datepicker.eu.js');
$html = $this->prefix;
//format the data with eu format
$valori=explode("-",$this->value);
$new_date_eu=$valori[2]."/".$valori[1]."/".$valori[0];
if($this->getMessage($this->name))
$html .= '<div class="failure">'.$this->getMessage($this->name).'</div>';
$html .= '
<label for="'.$this->element_name.'">
'.$this->label.'
</label>';
$html .='
<input class="text" id="codexdatepicker'.$this->name.'" type="text" value="'.$new_date_eu.'" name="'.$this->element_name.'" '.$this->getAttributes($this->attributes).'>
';
$js ="$(document).ready(function() {
$('#codexdatepicker".$this->name."').datepicker({dateFormat: 'dd/mm/yy'});
});";
$CI->codextemplates->inlineJS('js-'.$this->name.'-init',$js);
$html .= $this->suffix;
return $html;
}
}
can someone rewrite this to work with the jtaby thing instead of codex?
I started at the top, but when I got to $CI->codextemplates-> I didn't know what to put in.
another thing:
the backend seems to be formatting posts either by body or title (the only ones it shows up), I also have id and date fields, why are they not in the sort by list?
update: found where to add id, now I need to change how it sorts it by default, default comes descending order, however I need ascending, how can I achieve that?
thanks