PHP code example of tecnocen / yii2-bootstrap-year-calendar
1. Go to this page and download the library: Download tecnocen/yii2-bootstrap-year-calendar library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tecnocen / yii2-bootstrap-year-calendar example snippets
use tecnocen\yearcalendar\widgets\Calendar;
echo Calendar::widget([
// 'language' => 'es',
'options' => [
// HTML attributes for the container.
// the `tag` option is specially handled as the HTML tag name
],
'clientOptions' => [
// JS Options to be passed to the `calendar()` plugin.
// see http://bootstrap-year-calendar.com/#Documentation/Options
],
'clientEvents' => [
// JS Events for the `calendar()` plugin.
// see http://bootstrap-year-calendar.com/#Documentation/Events
]
]);
namespace api\models;
use tecnocen\yearcalendar\data\DataItem;
use tecnocen\yearcalendar\data\JsExpressionHelper;
use yii\db\ActiveRecord;
class Conference extends ActiveRecord implements DataItem
{
public function getName()
{
return $this->name;
}
public function getStartDate()
{
return JsExpressionHelper::parse($this->start_date);
}
public function getEndDate()
{
return JsExpressionHelper::parse($this->end_date);
}
// rest of the active record code.
}
// $dateTime is an object of the class DateTime
// see http://php.net/manual/en/class.datetime.php
JsExpressionHelper::parse($dateTime);
// $timestamp is an integer which will be used as
// unix time tamp
JsExpressionHelper::parse($timestamp);
// $date is an string here it can accept a second
// parameter $format which by default is 'Y-m-d'
// see http://php.net/manual/es/datetime.createfromformat.php
JsExpressionHelper::parse($date, $format);
use api\models\Conference;
use tecnocen\yearcalendar\widgets\ActiveCalendar;
use yii\data\ActiveDataProvider;
echo ActiveCalendar::widget([
// 'language' => 'es',
'dataProvider' => new ActiveDataProvider([
'query' => Conference::find()->andWhere(['active' => 1])
]),
'options' => [
// HTML attributes for the container.
// the `tag` option is specially handled as the HTML tag name
],
'clientOptions' => [
// JS Options to be passed to the `calendar()` plugin.
// The `dataSource` property will be overwritten by the dataProvider.
// see http://bootstrap-year-calendar.com/#Documentation/Options
],
'clientEvents' => [
// JS Events for the `calendar()` plugin.
// see http://bootstrap-year-calendar.com/#Documentation/Events
]
])