Exemple #1
0
 /**
  * @param $instance
  * @param int $totalCount
  * @return string
  */
 public function render($instance, $totalCount)
 {
     $date = $this->valueFromInstance($instance, $this->name);
     $formattedDate = '';
     if (!is_null($date)) {
         $formattedDate = DateFormatter::format($date, $this->formatDate, $this->formatTime, $this->customFormat);
     }
     return parent::render($instance, $totalCount, $formattedDate);
 }
Exemple #2
0
 /**
  * @param $name
  * @param $label
  * @param bool $showSeconds
  * @param null $value
  * @param array $options
  * @return string
  */
 public function timeGroup($name, $label, $showSeconds = false, $value = null, array $options = [])
 {
     $options = $this->updateOptions($options);
     $value = $this->getValueAttribute($name, $value);
     $value = DateFormatter::format($value, DateFormatter::NONE, $showSeconds ? DateFormatter::MEDIUM : DateFormatter::SHORT);
     $content = $this->text($name, $value, $options);
     $content .= $this->html->tag('span', ['class' => 'input-group-addon'], '<span></span>');
     $content = $this->html->tag('div', ['class' => 'form-group input-group timepicker'], $content);
     return $this->makeGroup($name, $label, $content);
 }
Exemple #3
0
 public static function datetime($name, $label, $value = null, array $options = [], $rule = [], $dateFormat = DateFormatter::SHORT, $timeFormat = DateFormatter::SHORT)
 {
     if ($value) {
         $value = DateFormatter::format($value, $dateFormat, $timeFormat, 'dd.MM.y H:mm');
     }
     if (empty($options['id'])) {
         $options['id'] = uniqid();
     }
     AssetManager::addScript(Admin::instance()->router->routeToAsset('js/moment.js'));
     AssetManager::addScript(Admin::instance()->router->routeToAsset('js/bootstrap-datetimepicker.min.js'));
     AssetManager::addStyle(Admin::instance()->router->routeToAsset('css/bootstrap-datetimepicker.min.css'));
     AssetManager::addScript(Admin::instance()->router->routeToAsset('js/parsley.min.js'));
     AssetManager::addScript(Admin::instance()->router->routeToAsset('js/parsley-init.js'));
     return view('admin::_partials/view_filters/datetime')->with('name', $name)->with('label', $label)->with('value', $value)->with('options', $options)->with('date_format', $dateFormat)->with('time_format', $timeFormat)->with('id', $options['id'])->with('rule', $rule)->with('error', self::getError($name));
 }