element['class'] ? (string) $this->element['class'] : ''; $unit = $this->element['unit'] ? (string) $this->element['unit'] : ''; $format = $this->element['format'] ? (string) $this->element['format'] : 'integer'; $thousand_sep = $params->get('sep_thousand', ','); $decimal_sep = $params->get('sep_decimal', '.'); $decimal_cyp = $params->get('decimals', 2); $dateformat = ($format == 'datetime') ? (string) $params->get('dateformat', 'Y-m-d') . ' H:i:s' : (string) $params->get('dateformat','Y-m-d'); $cur = explode("," , KissGeneralHelper::getCurrency($params->get('currency'))); $currency = $cur[0]; $db = JFactory::getDBO(); switch ($format) { case 'text': $output = $this->value; break; case 'date': case 'datetime': // check whether we have a valid date $datum = date_parse($this->value); if ($datum['year'] && $datum !== false) { $output = date($dateformat, strtotime($this->value))."  "; } else { $output = JText::_('KISS_GENERAL_NOTYET').",  "; } break; case 'age': $date1 = strtotime($this->value); $date2 = strtotime(date()->toMySQL()); $differenz = $date2 - $date1; $output = KISS_GENERAL_AGE.": "; if (intval(date("Y", $date2) - date("Y", $date1))) {$output .= intval(date("Y", $date2) - date("Y", $date1)).KISS_GENERAL_YEARS;} if (intval(date("n", $date2) - date("n", $date1))) {$output .= " " . intval(date("n", $date2) - date("n", $date1)).KISS_GENERAL_MONTHS;} if (intval(date("j", $date2) - date("j", $date1))) {$output .= " " . intval(date("j", $date2) - date("j", $date1)).KISS_GENERAL_DAYS;} break; case 'currency': $output = number_format($this->value, $decimal_cyp, $decimal_sep, $thousand_sep)." ".$currency; break; case 'decimal': $output = number_format($this->value, $decimal_cyp, $decimal_sep, $thousand_sep)." ".$unit; break; case 'integer': default: $wert = ($this->value) ? $this->value : 0; $output = number_format($wert, 0, $decimal_sep, $thousand_sep)." ".$unit; break; case 'identno': $wert = ($this->value) ? $this->value : 0; $output = substr($wert,0,2) . number_format(substr($wert, 2), 0, $decimal_sep, $thousand_sep)." ".$unit; break; case 'username': if (KissGeneralHelper::field_exists('users', 'firstname')) { $query = "SELECT CONCAT_WS(' ', firstname, name) AS name"; } else { $query = "SELECT name"; } $query .= " FROM #__users WHERE id = " . $this->value; $db->setQuery($query); if (!$this->value) { $output = JText::_('KISS_GENERAL_SYSTEM'); } else { if ($usr = $db->loadObject()) { $output = $usr->name; } else { $output = JText::_('KISS_GENERAL_UNDEFINED'); } } break; case 'customername': if (!$this->value) { // No customer ID, try to get it from session $session = JFactory::getSession(); $custID = $session->get('customerID'); } else { $custID = $this->value; } $query = "SELECT *"; $query .= " FROM #__".KISS_COMPONENT_TPFX."_custs WHERE id = " . $custID; $db->setQuery($query); if (!$custID) { $output = JText::_('KISS_GENERAL_NOTEXISTS'); } else { if ($csr = $db->loadObject()) { $output = $csr->title; } else { $output = JText::_('KISS_GENERAL_NOTEXISTS'); } } break; case 'paymentsystemname': if (!$this->value) { // No payment system ID, try to get it from session $session = JFactory::getSession(); $psysID = $session->get('paymentsysID'); } else { $psysID = $this->value; } $query = "SELECT *"; $query .= " FROM #__".KISS_COMPONENT_TPFX."_payment_sys WHERE id = " . $psysID; $db->setQuery($query); if (!$psysID) { $output = JText::_('KISS_GENERAL_NOTEXISTS'); } else { if ($csr = $db->loadObject()) { $output = $csr->title; } else { $output = JText::_('KISS_GENERAL_NOTEXISTS'); } } break; } return '' . '
'.$output.'
'; } protected function getLabel() { echo '
'; return parent::getLabel(); } }