function include_js_alaxos($inline = false) { /* * The alaxos.js file contains code that need jquery declared as $j */ $this->include_js_jquery($inline); $this->include_js_jquery_no_conflict($inline); /* * The alaxos.js file contains code that need a date_format global variable */ $this->scriptBlock('var date_format = "' . strtolower(DateTool::get_date_format()) . '";', array('inline' => $inline)); $this->scriptBlock('var application_root = "' . $this->url('/') . '";', array('inline' => $inline)); $this->script('/alaxos/js/alaxos/alaxos.js', array('inline' => $inline)); }
/** * Format a given date to an SQL formatted date. * * @param $date string The date to format * @param $locale string The locale in which the date is formatted. If no locale is given, the current locale is used * @param $with_time boolean Indicates wether the time part must be added if present * @return string */ public static function date_to_sql($date, $locale = null, $with_time = true) { $date = trim($date); if ($with_time && strpos($date, ' ') !== false) { return DateTool::datetime_to_sql($date, $locale); } else { $format = DateTool::get_date_format($locale); } $format = str_replace('Y', '%Y', $format); $format = str_replace('m', '%m', $format); $format = str_replace('d', '%d', $format); $date_array = strptime($date, $format); if ($date_array !== false) { $day = sprintf("%02d", $date_array['tm_mday']); $month = sprintf("%02d", $date_array['tm_mon'] + 1); $year = DateTool::get_complete_year(1900 + $date_array['tm_year']); return $year . '-' . $month . '-' . $day; } else { return null; } }