/** * Get view value * * @param array $field Field * * @return mixed */ protected function getViewValue(array $field) { $value = parent::getViewValue($field); if (is_scalar($value)) { $value = \XLite\Core\Converter::formatDate($value); } return $value; }
/** * Get default options * * @return array */ protected function getDefaultOptions() { $time = \XLite\Core\Converter::time(); $allowedDateFormats = \XLite\Core\Converter::getAvailableDateFormats(); $options = array(); foreach ($allowedDateFormats as $phpFormat => $formats) { $options[$phpFormat] = \XLite\Core\Converter::formatDate($time, $phpFormat); } return $options; }
/** * Get list of expired keys * * @return array */ public function getExpiredKeys() { if (!isset($this->expiredKeys)) { $this->expiredKeys = array(); $entries = \XLite\Upgrade\Cell::getInstance()->getEntries(); $keys = \XLite\Core\Database::getRepo('XLite\\Model\\ModuleKey')->findAll(); $commonURLPart = 'https://secure.x-cart.com/customer.php?target=generate_invoice&action=buy&'; $urlParamsAggregated = array(); $i = 1; foreach ($keys as $key) { $entityID = 'CDev' == $key->getAuthor() && 'Core' == $key->getName() ? \XLite\Upgrade\Cell::CORE_IDENTIFIER : $key->getAuthor() . '\\' . $key->getName(); $keyData = $key->getKeyData(); if (!empty($keyData['message']) && in_array($entityID, array_keys($entries))) { $urlParamsAggregated[] = $this->getKeyURLParams($i++, $key); $title = isset($entries[$entityID]) ? sprintf('%s (%s)', $entries[$entityID]->getName(), $entries[$entityID]->getAuthor()) : sprintf('%s (%s)', $key->getName(), $key->getAuthor()); $this->expiredKeys[] = array('title' => $title, 'expDate' => \XLite\Core\Converter::formatDate($keyData['expDate']), 'purchaseURL' => $commonURLPart . $this->getKeyURLParams(1, $key) . '&proxy_checkout=1'); } } $this->allKeysPurchaseURL = $urlParamsAggregated ? $commonURLPart . implode('&', $urlParamsAggregated) . '&proxy_checkout=1' : null; } return $this->expiredKeys; }
/** * Get day of the given date * * @param integer $date Date (UNIX timestamp) * * @return string */ protected function getDayDate($date) { return \XLite\Core\Converter::formatDate($date); }
/** * Get widget value as string * * @return string */ public function getValueAsString() { return 0 >= $this->getParam(self::PARAM_VALUE) ? '' : \XLite\Core\Converter::formatDate($this->getParam(self::PARAM_VALUE), null, false); }
/** * Format date * * @param mixed $base String or object instance to get field value from * @param string $field Field to get value OPTIONAL * @param string $format Date format OPTIONAL * * @return string */ protected function formatDate($base, $field = null, $format = null) { if (is_object($base)) { $base = $base instanceof \XLite\Model\AEntity ? $base->{$field} : $base->get($field); } return \XLite\Core\Converter::formatDate($base, $format); }
/** * getCurrentYear * * @return string */ protected function getCurrentYear() { return \XLite\Core\Converter::formatDate(time(), '%Y'); }
/** * Get default options * * @return array */ protected function getDefaultOptions() { $time = time(); return array('%T' => \XLite\Core\Converter::formatDate($time, '%T'), '%H:%M' => \XLite\Core\Converter::formatDate($time, '%H:%M'), '%I:%M %p' => \XLite\Core\Converter::formatDate($time, '%I:%M %p'), '%r' => \XLite\Core\Converter::formatDate($time, '%r')); }
/** * Get last export date * * @return string */ protected function getPackExportDate() { $list = $this->getPackedFiles(); $file = $list ? new \SplFileInfo(current($list)) : null; $date = date('Y-m-d'); if ($file) { $date = \XLite\Core\Converter::formatDate($file->getMTime(), '%Y-%m-%d'); } return $date; }
/** * getCommonAttributes * * @return array */ protected function getCommonAttributes() { $list = parent::getCommonAttributes(); if (is_numeric($list['value']) || is_int($list['value'])) { $list['value'] = $list['value'] ? \XLite\Core\Converter::formatDate($list['value']) : ''; } return $list; }
/** * Get company year * * @return string */ protected function getCompanyYear() { $currentYear = intval(\XLite\Core\Converter::formatDate(\XLite\Core\Converter::time(), '%Y')); $startYear = \XLite::isAdminZone() ? 2002 : intval(\XLite\Core\Config::getInstance()->Company->start_year); return $startYear && $startYear < $currentYear ? $startYear . ' - ' . $currentYear : $currentYear; }
/** * Get last export date * * @return string */ protected function getLastExportDate() { $list = $this->getDownloadFiles(); $file = $list ? current($list) : null; return \XLite\Core\Converter::formatDate($file ? $file->getMTime() : \XLite\Core\Converter::time()); }
/** * Get default options * * @return array */ protected function getDefaultOptions() { $time = time(); return array('%m/%d/%Y' => \XLite\Core\Converter::formatDate($time, '%m/%d/%Y'), '%b %e, %Y' => \XLite\Core\Converter::formatDate($time, '%b %e, %Y'), '%d.%m.%Y' => \XLite\Core\Converter::formatDate($time, '%d.%m.%Y')); }