/** * shows the data formatted for the table view * @param string data * @param object all the data in the tables current row * @return string formatted value */ function renderListData($data, $oAllRowsData) { if ($data != '') { $format = '%Y-%m-%d %H:%i:%s'; $timebits = FabrikWorker::strToDateTime($data, $format); $data = date('H:i:s', $timebits['timestamp']); } return $data; }
/** * convert a table formatted date string into a mySQL formatted date string * (if already in mySQL format returns the date) * @param string date in table view format * @return string date in mySQL format or false if string date could not be converted */ function tableDateToMySQL($v) { $params =& $this->getParams(); $store_as_local = (int) $params->get('date_store_as_local', 0); $format = $params->get('date_table_format', '%Y-%m-%d'); $b = FabrikWorker::strToDateTime($v, $format); if (!is_array($b)) { return false; } //3.0 can't use timestamp as that gets offset as its taken as numeric by JDate //$orig = new JDate($datebits['timestamp'], 2); $bstr = $b['year'] . '-' . $b['mon'] . '-' . $b['day'] . ' ' . $b['hour'] . ':' . $b['min'] . ':' . $b['sec']; $date = JFactory::getDate($bstr); if (in_array($v, $this->getNullDates()) || $v === $date->toMySQL()) { return $v; } if ($store_as_local) { $this->_resetToGMT = false; } $retval = $this->toMySQLGMT($date); $this->_resetToGMT = true; return $retval; }
/** * convert a table formatted date string into a mySQL formatted date string * (if already in mySQL format returns the date) * @param string date in table view format * @return string date in mySQL format or false if string date could not be converted */ function tableDateToMySQL($v) { $params =& $this->getParams(); $store_as_local = (int) $params->get('date_store_as_local', 0); if (in_array($v, $this->getNullDates()) || $v === JFactory::getDate($v)->toMySQL()) { return $v; } $format = $params->get('date_table_format', '%Y-%m-%d'); $datebits = FabrikWorker::strToDateTime($v, $format); if (!is_array($datebits)) { return false; } $date =& JFactory::getDate($datebits['timestamp']); if ($store_as_local) { $this->_resetToGMT = false; } $retval = $this->toMySQLGMT($date); $this->_resetToGMT = true; return $retval; }
/** * Convert a table formatted date string into a mySQL formatted date string * (if already in mySQL format returns the date) * * @param string $v date in table view format * * @deprecated not used * * @return string date in mySQL format or false if string date could not be converted */ protected function tableDateToMySQL($v) { $params = $this->getParams(); $store_as_local = (int) $params->get('date_store_as_local', 0); $format = $params->get('date_table_format', '%Y-%m-%d'); $b = FabrikWorker::strToDateTime($v, $format); if (!is_array($b)) { return false; } $bstr = $b['year'] . '-' . $b['mon'] . '-' . $b['day'] . ' ' . $b['hour'] . ':' . $b['min'] . ':' . $b['sec']; $date = JFactory::getDate($bstr); if (in_array($v, $this->getNullDates()) || $v === $date->toSql()) { return $v; } if ($store_as_local) { $this->resetToGMT = false; } $retval = $this->toMySQLGMT($date); $this->resetToGMT = true; return $retval; }