Commit a25524c5 authored by Tino Goratsch's avatar Tino Goratsch

added a new Smarty plugin: datepicker

parent 6ec26887
......@@ -8,6 +8,10 @@ namespace ACP3\Core;
*/
class Date
{
const DEFAULT_DATE_FORMAT_LONG = 'Y-m-d H:i';
const DEFAULT_DATE_FORMAT_FULL = 'Y-m-d H:i:s';
const DEFAULT_DATE_FORMAT_SHORT = 'Y-m-d';
/**
* @var string
*/
......@@ -264,7 +268,7 @@ class Date
*/
public function getCurrentDateTime($isLocalTime = false)
{
return $this->format('now', 'Y-m-d H:i:s', true, $isLocalTime);
return $this->format('now', self::DEFAULT_DATE_FORMAT_FULL, true, $isLocalTime);
}
/**
......@@ -276,7 +280,7 @@ class Date
*/
public function toSQL($value = '')
{
return $this->format(empty($value) === true ? 'now' : $value, 'Y-m-d H:i:s', true, false);
return $this->format(empty($value) === true ? 'now' : $value, self::DEFAULT_DATE_FORMAT_FULL, true, false);
}
/**
......@@ -289,6 +293,6 @@ class Date
*/
public function timestampToDateTime($value, $isLocalTime = false)
{
return $this->format($value, 'Y-m-d H:i:s', true, $isLocalTime);
return $this->format($value, self::DEFAULT_DATE_FORMAT_FULL, true, $isLocalTime);
}
}
......@@ -110,9 +110,7 @@ class Date
*
* @param string|array $name
* @param string|array $value
* @param string $format
* @param array $params
* @param bool $withTime
* @param bool $showTime
* @param bool $inputFieldOnly
*
* @return array
......@@ -120,35 +118,29 @@ class Date
public function datepicker(
$name,
$value = '',
$format = 'Y-m-d H:i',
array $params = [],
$withTime = true,
$showTime = true,
$inputFieldOnly = false
)
{
$datePicker = [
'range' => $this->isRange($name),
'with_time' => (bool)$withTime,
'length' => $withTime === true ? 16 : 10,
'with_time' => (bool)$showTime,
'length' => $showTime === true ? 16 : 10,
'input_only' => (bool)$inputFieldOnly,
'params' => [
'format' => $this->getPickerDateFormat($withTime),
'format' => $this->getPickerDateFormat($showTime),
'changeMonth' => 'true',
'changeYear' => 'true',
]
];
if (!empty($params)) {
$datePicker['params'] = array_merge($datePicker['params'], $params);
}
if ($this->isRange($name) === true) {
$datePicker['name_start'] = $name[0];
$datePicker['name_end'] = $name[1];
$datePicker['id_start'] = $this->getInputId($name[0]);
$datePicker['id_end'] = $this->getInputId($name[1]);
$datePicker = array_merge($datePicker, $this->fetchRangeDatePickerValues($name, $value, $format));
$datePicker = array_merge($datePicker, $this->fetchRangeDatePickerValues($name, $value, $showTime));
$datePicker['range_json'] = json_encode(
[
......@@ -161,7 +153,7 @@ class Date
} else { // Einfaches Inputfeld mit Datepicker
$datePicker['name'] = $name;
$datePicker['id'] = $this->getInputId($name);
$datePicker['value'] = $this->fetchSimpleDatePickerValue($name, $value, $format);
$datePicker['value'] = $this->fetchSimpleDatePickerValue($name, $value, $showTime);
}
return $datePicker;
......@@ -178,13 +170,13 @@ class Date
}
/**
* @param array $name
* @param array $value
* @param string $format
* @param array $name
* @param array $value
* @param bool $showTime
*
* @return array
*/
protected function fetchRangeDatePickerValues(array $name, $value, $format)
protected function fetchRangeDatePickerValues(array $name, $value, $showTime)
{
if ($this->request->getPost()->has($name[0]) && $this->request->getPost()->has($name[1])) {
$valueStart = $this->request->getPost()->get($name[0]);
......@@ -192,13 +184,13 @@ class Date
$valueStartR = $this->date->format($valueStart, 'r', false);
$valueEndR = $this->date->format($valueEnd, 'r', false);
} elseif (is_array($value) && $this->dateValidator->date($value[0], $value[1]) === true) {
$valueStart = $this->date->format($value[0], $format);
$valueEnd = $this->date->format($value[1], $format);
$valueStart = $this->date->format($value[0], $this->getDateFormat($showTime));
$valueEnd = $this->date->format($value[1], $this->getDateFormat($showTime));
$valueStartR = $this->date->format($value[0], 'r');
$valueEndR = $this->date->format($value[1], 'r');
} else {
$valueStart = $this->date->format('now', $format, false);
$valueEnd = $this->date->format('now', $format, false);
$valueStart = $this->date->format('now', $this->getDateFormat($showTime), false);
$valueEnd = $this->date->format('now', $this->getDateFormat($showTime), false);
$valueStartR = $this->date->format('now', 'r', false);
$valueEndR = $this->date->format('now', 'r', false);
}
......@@ -214,29 +206,29 @@ class Date
/**
* @param string $name
* @param string $value
* @param string $format
* @param bool $showTime
*
* @return string
*/
protected function fetchSimpleDatePickerValue($name, $value, $format)
protected function fetchSimpleDatePickerValue($name, $value, $showTime)
{
if ($this->request->getPost()->has($name)) {
return $this->request->getPost()->get($name, '');
} elseif ($this->dateValidator->date($value) === true) {
return $this->date->format($value, $format);
return $this->date->format($value, $this->getDateFormat($showTime));
}
return $this->date->format('now', $format, false);
return $this->date->format('now', $this->getDateFormat($showTime), false);
}
/**
* @param bool $withTime
* @param bool $showTime
*
* @return string
*/
protected function getPickerDateFormat($withTime)
protected function getPickerDateFormat($showTime)
{
return 'YYYY-MM-DD' . ($withTime === true ? ' HH:mm' : '');
return 'YYYY-MM-DD' . ($showTime === true ? ' HH:mm' : '');
}
/**
......@@ -249,4 +241,14 @@ class Date
return (is_array($name) === true);
}
/**
* @param bool $showTime
*
* @return string
*/
protected function getDateFormat($showTime)
{
return $showTime === true ? \ACP3\Core\Date::DEFAULT_DATE_FORMAT_LONG : \ACP3\Core\Date::DEFAULT_DATE_FORMAT_SHORT;
}
}
\ No newline at end of file
......@@ -34,7 +34,7 @@ class DateRange
}
/**
* Gibt die Formularfelder für den Veröffentlichungszeitraum aus
* Gibt die Formularfelder f�r den Ver�ffentlichungszeitraum aus
*
* @param string $start
* @param string $end
......@@ -44,17 +44,16 @@ class DateRange
*/
public function formatTimeRange($start, $end = '', $format = 'long')
{
$datetimeFormat = 'Y-m-d H:i';
if ($end === '' || $start >= $end) {
if ($end === '') {
$title = $this->date->format($start, $format);
} else {
$title = sprintf($this->lang->t('system', 'date_published_since'), $this->date->format($start, $format));
}
return '<time datetime="' . $start . '" title="' . $title . '">' . $this->date->format($start, $datetimeFormat) . '</time>';
return '<time datetime="' . $start . '" title="' . $title . '">' . $this->date->format($start, Date::DEFAULT_DATE_FORMAT_LONG) . '</time>';
} else {
$title = sprintf($this->lang->t('system', 'date_time_range'), $this->date->format($start, $format), $this->date->format($end, $format));
return '<time datetime="' . $start . '/' . $end . '" title="' . $title . '">' . $this->date->format($start, $datetimeFormat) . '&ndash;' . $this->date->format($end, $datetimeFormat) . '</time>';
return '<time datetime="' . $start . '/' . $end . '" title="' . $title . '">' . $this->date->format($start, Date::DEFAULT_DATE_FORMAT_LONG) . '&ndash;' . $this->date->format($end, $datetimeFormat) . '</time>';
}
}
......
<?php
namespace ACP3\Core\View\Renderer\Smarty\Functions;
use ACP3\Core\Helpers\Date;
use ACP3\Core\View;
/**
* Class Datepicker
* @package ACP3\Core\View\Renderer\Smarty\Functions
*/
class Datepicker extends AbstractFunction
{
/**
* @var \ACP3\Core\View
*/
protected $view;
/**
* @var \ACP3\Core\Helpers\Date
*/
protected $dateHelper;
/**
* @param \ACP3\Core\View $view
* @param \ACP3\Core\Helpers\Date $dateHelper
*/
public function __construct(
View $view,
Date $dateHelper
)
{
$this->view = $view;
$this->dateHelper = $dateHelper;
}
/**
* @param array $params
* @param \Smarty_Internal_Template $smarty
*
* @return string
*/
public function process(array $params, \Smarty_Internal_Template $smarty)
{
$params = $this->mergeParameters($params);
$this->view->assign('datepicker', $this->dateHelper->datepicker(
$params['name'],
$params['value'],
$params['params'],
$params['withTime'],
$params['inputFieldOnly']
));
return $this->view->fetchTemplate('system/datepicker.tpl');
}
private function mergeParameters(array $params)
{
$defaults = [
'name' => '',
'value' => '',
'params' => [],
'withTime' => true,
'inputFieldOnly' => false
];
return array_merge($defaults, $params);
}
/**
* @return string
*/
public function getPluginName()
{
return 'datepicker';
}
}
\ No newline at end of file
......@@ -7,6 +7,10 @@ services:
class: ACP3\Core\View\Renderer\Smarty\Functions\DateFormat
arguments: ['@core.date']
smarty.plugin.date_picker:
class: ACP3\Core\View\Renderer\Smarty\Functions\Datepicker
arguments: [@core.view, @core.helpers.date]
smarty.plugin.date_ramge:
class: ACP3\Core\View\Renderer\Smarty\Functions\DateRange
arguments: [@core.helpers.formatter.dateRange]
......
......@@ -112,17 +112,17 @@ class Index extends Core\Modules\AdminController
$this->_createPost($this->request->getPost()->getAll());
}
if ($this->acl->hasPermission('admin/menus/items/create') === true && $this->menusHelpers) {
if ($this->acl->hasPermission('admin/menus/items/create') === true) {
$lang_options = [$this->lang->t('articles', 'create_menu_item')];
$this->view->assign('options', $this->get('core.helpers.forms')->checkboxGenerator('create', [1], $lang_options, 0));
$this->view->assign($this->menusHelpers->createMenuItemFormFields());
}
$this->view->assign('publication_period', $this->get('core.helpers.date')->datepicker(['start', 'end']));
$defaults = [
'title' => '',
'text' => ''
'text' => '',
'start' => '',
'end' => ''
];
$this->view->assign('SEO_FORM_FIELDS', $this->seo->formFields());
......@@ -217,10 +217,7 @@ class Index extends Core\Modules\AdminController
$this->_editPost($this->request->getPost()->getAll(), $id);
}
if ($this->acl->hasPermission('admin/menus/items/create') === true &&
$this->menusHelpers &&
$this->menusModel
) {
if ($this->acl->hasPermission('admin/menus/items/create') === true) {
$menuItem = $this->menusModel->getOneMenuItemByUri(sprintf(Articles\Helpers::URL_KEY_PATTERN, $id));
$lang_options = [$this->lang->t('articles', 'create_menu_item')];
......@@ -237,9 +234,6 @@ class Index extends Core\Modules\AdminController
);
}
// Datumsauswahl
$this->view->assign('publication_period', $this->get('core.helpers.date')->datepicker(['start', 'end'], [$article['start'], $article['end']]));
$this->view->assign('SEO_FORM_FIELDS', $this->seo->formFields(sprintf(Articles\Helpers::URL_KEY_PATTERN, $id)));
$this->view->assign('form', array_merge($article, $this->request->getPost()->getAll()));
......
......@@ -28,7 +28,7 @@ class Model extends Core\Model
public function resultExists($id, $time = '')
{
$period = empty($time) === false ? ' AND ' . $this->_getPeriod() : '';
return $this->db->fetchColumn('SELECT COUNT(*) FROM ' . $this->getTableName() . ' WHERE id = :id' . $period, ['id' => $id, 'time' => $time]) > 0;
return $this->db->fetchColumn("SELECT COUNT(*) FROM {$this->getTableName()} WHERE id = :id{$period}", ['id' => $id, 'time' => $time]) > 0;
}
/**
......@@ -38,7 +38,7 @@ class Model extends Core\Model
*/
public function getOneById($id)
{
return $this->db->fetchAssoc('SELECT * FROM ' . $this->getTableName() . ' WHERE id = ?', [$id]);
return $this->db->fetchAssoc("SELECT * FROM {$this->getTableName()} WHERE id = ?", [$id]);
}
/**
......@@ -62,7 +62,7 @@ class Model extends Core\Model
{
$where = empty($time) === false ? ' WHERE ' . $this->_getPeriod() : '';
$limitStmt = $this->buildLimitStmt($limitStart, $resultsPerPage);
return $this->db->fetchAll('SELECT * FROM ' . $this->getTableName() . $where . ' ORDER BY title ASC' . $limitStmt, ['time' => $time]);
return $this->db->fetchAll("SELECT * FROM {$this->getTableName()}{$where} ORDER BY title ASC{$limitStmt}", ['time' => $time]);
}
/**
......@@ -76,7 +76,7 @@ class Model extends Core\Model
{
$where = empty($time) === false ? ' WHERE ' . $this->_getPeriod() : '';
$limitStmt = $this->buildLimitStmt($limitStart, $resultsPerPage);
return $this->db->fetchAll('SELECT * FROM ' . $this->getTableName() . $where . ' ORDER BY `start` DESC' . $limitStmt, ['time' => $time]);
return $this->db->fetchAll("SELECT * FROM {$this->getTableName()}{$where} ORDER BY `start` DESC{$limitStmt}", ['time' => $time]);
}
......@@ -85,7 +85,7 @@ class Model extends Core\Model
*/
public function getAllInAcp()
{
return $this->db->fetchAll('SELECT * FROM ' . $this->getTableName() . ' ORDER BY title ASC');
return $this->db->fetchAll("SELECT * FROM {$this->getTableName()} ORDER BY title ASC");
}
/**
......@@ -98,7 +98,9 @@ class Model extends Core\Model
*/
public function getAllSearchResults($fields, $searchTerm, $sort, $time)
{
$period = ' AND ' . $this->_getPeriod();
return $this->db->fetchAll('SELECT id, title, text FROM ' . $this->getTableName() . ' WHERE MATCH (' . $fields . ') AGAINST (' . $this->db->getConnection()->quote($searchTerm) . ' IN BOOLEAN MODE)' . $period . ' ORDER BY START ' . $sort . ', END ' . $sort . ', title ' . $sort, ['time' => $time]);
return $this->db->fetchAll(
"SELECT `id`, `title`, `text` FROM {$this->getTableName()} WHERE MATCH ({$fields}) AGAINST ({$this->db->getConnection()->quote($searchTerm)} IN BOOLEAN MODE) AND {$this->_getPeriod()} ORDER BY START {$sort}, END {$sort}, title {$sort}",
['time' => $time]
);
}
}
......@@ -13,7 +13,7 @@
</ul>
<div class="tab-content">
<div id="tab-1" class="tab-pane fade in active">
{include file="asset:system/datepicker.tpl" datepicker=$publication_period}
{datepicker name=['start', 'end'] value=[$form.start, $form.end]}
</div>
<div id="tab-2" class="tab-pane fade">
<div class="form-group">
......
......@@ -63,7 +63,6 @@ class Helpers
* Erzeugt das Captchafeld für das Template
*
* @param integer $captchaLength
* Anzahl der Zeichen, welche das Captcha haben soll
* @param string $id
* @param bool $inputOnly
* @param string $path
......
......@@ -90,9 +90,6 @@ class Index extends Core\Modules\AdminController
$this->_createPost($this->request->getPost()->getAll(), $settings);
}
// Datumsauswahl
$this->view->assign('publication_period', $this->get('core.helpers.date')->datepicker(['start', 'end']));
$units = ['Byte', 'KiB', 'MiB', 'GiB', 'TiB'];
$this->view->assign('units', $this->get('core.helpers.forms')->selectGenerator('units', $units, $units, ''));
......@@ -115,6 +112,8 @@ class Index extends Core\Modules\AdminController
'file_external' => '',
'filesize' => '',
'text' => '',
'start' => '',
'end' => ''
];
$this->view->assign('SEO_FORM_FIELDS', $this->seo->formFields());
......@@ -174,9 +173,6 @@ class Index extends Core\Modules\AdminController
$this->_editPost($this->request->getPost()->getAll(), $settings, $file, $id);
}
// Datumsauswahl
$this->view->assign('publication_period', $this->get('core.helpers.date')->datepicker(['start', 'end'], [$file['start'], $file['end']]));
$units = ['Byte', 'KiB', 'MiB', 'GiB', 'TiB'];
$this->view->assign('units', $this->get('core.helpers.forms')->selectGenerator('units', $units, $units, trim(strrchr($file['size'], ' '))));
......
......@@ -13,7 +13,7 @@
</ul>
<div class="tab-content">
<div id="tab-1" class="tab-pane fade in active">
{include file="asset:system/datepicker.tpl" datepicker=$publication_period}
{datepicker name=['start', 'end'] value=[$form.start, $form.end]}
</div>
<div id="tab-2" class="tab-pane fade">
<div class="form-group">
......
......@@ -13,7 +13,7 @@
</ul>
<div class="tab-content">
<div id="tab-1" class="tab-pane fade in active">
{include file="asset:system/datepicker.tpl" datepicker=$publication_period}
{datepicker name=['start', 'end'] value=[$form.start, $form.end]}
</div>
<div id="tab-2" class="tab-pane fade">
<div class="form-group">
......
......@@ -70,13 +70,12 @@ class Index extends Core\Modules\AdminController
$this->_createPost($this->request->getPost()->getAll());
}
// Datumsauswahl
$this->view->assign('publication_period', $this->get('core.helpers.date')->datepicker(['start', 'end']));
$this->view->assign('SEO_FORM_FIELDS', $this->seo->formFields());
$defaults = [
'title' => '',
'start' => '',
'end' => ''
];
$this->view->assign('form', array_merge($defaults, $this->request->getPost()->getAll()));
......@@ -134,7 +133,6 @@ class Index extends Core\Modules\AdminController
}
$this->view->assign('gallery_id', $id);
$this->view->assign('publication_period', $this->get('core.helpers.date')->datepicker(['start', 'end'], [$gallery['start'], $gallery['end']]));
$this->view->assign('form', array_merge($gallery, $this->request->getPost()->getAll()));
$this->_actionEditPictures();
......
......@@ -12,7 +12,7 @@
</ul>
<div class="tab-content">
<div id="tab-1" class="tab-pane fade in active">
{include file="asset:system/datepicker.tpl" datepicker=$publication_period}
{datepicker name=['start', 'end'] value=[$form.start, $form.end]}
<div class="form-group">
<label for="title" class="col-sm-2 control-label">{lang t="gallery|title"}</label>
......
......@@ -90,9 +90,6 @@ class Index extends Core\Modules\AdminController
$this->_createPost($this->request->getPost()->getAll(), $settings);
}
// Datumsauswahl
$this->view->assign('publication_period', $this->get('core.helpers.date')->datepicker(['start', 'end']));
// Kategorien
$this->view->assign('categories', $this->categoriesHelpers->categoriesList('news', '', true));
......@@ -126,7 +123,9 @@ class Index extends Core\Modules\AdminController
'title' => '',
'text' => '',
'uri' => '',
'link_title' => ''
'link_title' => '',
'start' => '',
'end' => ''
];
$this->view->assign('form', array_merge($defaults, $this->request->getPost()->getAll()));
......@@ -179,9 +178,6 @@ class Index extends Core\Modules\AdminController
$this->_editPost($this->request->getPost()->getAll(), $settings, $id);
}
// Datumsauswahl
$this->view->assign('publication_period', $this->get('core.helpers.date')->datepicker(['start', 'end'], [$news['start'], $news['end']]));
// Kategorien
$this->view->assign('categories', $this->categoriesHelpers->categoriesList('news', $news['category_id'], true));
......
<?php
namespace ACP3\Modules\ACP3\News\Installer;
use ACP3\Core\Date;
use ACP3\Core\Modules\Installer\AbstractSampleData;
/**
......@@ -15,7 +16,7 @@ class SampleData extends AbstractSampleData
*/
public function sampleData()
{
$currentDate = gmdate('Y-m-d H:i:s');
$currentDate = gmdate(Date::DEFAULT_DATE_FORMAT_FULL);
$lang = $this->schemaHelper->getContainer()->get('core.lang');
return [
......
......@@ -14,7 +14,7 @@
</ul>
<div class="tab-content">
<div id="tab-1" class="tab-pane fade in active">
{include file="asset:system/datepicker.tpl" datepicker=$publication_period}
{datepicker name=['start', 'end'] value=[$form.start, $form.end]}
</div>
<div id="tab-2" class="tab-pane fade">
<div class="form-group">
......
......@@ -65,9 +65,8 @@ class Index extends Core\Modules\AdminController
$this->_createPost($this->request->getPost()->getAll(), $settings);
}
$this->view->assign('date', $this->get('core.helpers.date')->datepicker('date'));
$this->view->assign('settings', $settings);
$this->view->assign('form', array_merge(['title' => '', 'text' => ''], $this->request->getPost()->getAll()));
$this->view->assign('form', array_merge(['title' => '', 'text' => '', 'date'], $this->request->getPost()->getAll()));
$this->view->assign('test', $this->get('core.helpers.forms')->yesNoCheckboxGenerator('test', 0));
......@@ -116,7 +115,6 @@ class Index extends Core\Modules\AdminController
$this->_editPost($this->request->getPost()->getAll(), $settings, $id);
}
$this->view->assign('date', $this->get('core.helpers.date')->datepicker('date', $newsletter['date']));
$this->view->assign('settings', array_merge($settings, ['html' => $newsletter['html']]));
$this->view->assign('form', array_merge($newsletter, $this->request->getPost()->getAll()));
......
......@@ -11,7 +11,7 @@
<div class="col-sm-10">
<input class="form-control" type="text" name="title" id="title" value="{$form.title}" required></div>
</div>
{include file="asset:system/datepicker.tpl" datepicker=$date}
{datepicker name="date" value=$form.date}
<div class="form-group">
<label for="text" class="col-sm-2 control-label">{lang t="newsletter|text"}</label>
......
......@@ -78,9 +78,13 @@ class Index extends Core\Modules\AdminController
$answers[1]['value'] = '';
}
// Übergabe der Daten an Smarty
$this->view->assign('publication_period', $this->get('core.helpers.date')->datepicker(['start', 'end']));
$this->view->assign('title', $this->request->getPost()->get('title', ''));
$defaults = [
'title' => '',
'start' => '',
'end' => ''
];
$this->view->assign('form', array_merge($defaults, $this->request->getPost()->getAll()));
$this->view->assign('answers', $answers);
$this->view->assign('multiple', $this->get('core.helpers.forms')->selectEntry('multiple', '1', '0', 'checked'));
......@@ -164,9 +168,7 @@ class Index extends Core\Modules\AdminController
$options[1]['lang'] = $this->lang->t('polls', 'multiple_choice');
$this->view->assign('options', $options);
// Übergabe der Daten an Smarty
$this->view->assign('publication_period', $this->get('core.helpers.date')->datepicker(['start', 'end'], [$poll['start'], $poll['end']]));
$this->view->assign('title', $this->request->getPost()->get('title', $poll['title']));
$this->view->assign('form', array_merge($poll, $this->request->getPost()->getAll()));
$this->formTokenHelper->generateFormToken();
} else {
......
......@@ -12,14 +12,14 @@
</ul>
<div class="tab-content">
<div id="tab-1" class="tab-pane fade in active">
{include file="asset:system/datepicker.tpl" datepicker=$publication_period}
{datepicker name=['start', 'end'] value=[$form.start, $form.end]}
</div>
<div id="tab-2" class="tab-pane fade">
<div class="form-group">
<label for="title" class="col-sm-2 control-label">{lang t="polls|question"}</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="title" id="title" value="{$title}" maxlength="120">
<input class="form-control" type="text" name="title" id="title" value="{$form.title}" maxlength="120">
</div>
</div>
{foreach $answers as $row}
......
......@@ -12,14 +12,14 @@
</ul>
<div class="tab-content">
<div id="tab-1" class="tab-pane fade in active">
{include file="asset:system/datepicker.tpl" datepicker=$publication_period}
{datepicker name=['start', 'end'] value=[$form.start, $form.end]}
</div>
<div id="tab-2" class="tab-pane fade">
<div class="form-group">
<label for="title" class="col-sm-2 control-label">{lang t="polls|question"}</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="title" id="title" value="{$title}" maxlength="120">
<input class="form-control" type="text" name="title" id="title" value="{$form.title}" maxlength="120">
</div>
</div>
{foreach $answers as $row}
......
......@@ -186,7 +186,7 @@ class Forms
public function fetchUserProfileFormFields($birthday = '', $country = '', $gender = 1)
{
return [
'birthday_datepicker' => $this->fetchBirthdayDatepicker($birthday),
'birthday' => $birthday,
'countries' => $this->generateWorldCountriesSelect($country),
'gender' => $this->fetchGenderField($gender),
];
......@@ -207,20 +207,4 @@ class Forms
return $this->formsHelpers->selectGenerator('gender', [1, 2, 3], $lang_gender, $value);
}
/**
* @param string $value
*
* @return array
*/
protected function fetchBirthdayDatepicker($value)
{
$datepickerParams = [
'constrainInput' => 'true',
'changeMonth' => 'true',
'changeYear' => 'true',
'yearRange' => "'-50:+0'"
];
return $this->dateHelpers->datepicker('birthday', $value, 'Y-m-d', $datepickerParams, false, true);
}