本文整理汇总了PHP中Date::formatDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::formatDate方法的具体用法?PHP Date::formatDate怎么用?PHP Date::formatDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date
的用法示例。
在下文中一共展示了Date::formatDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
public function search()
{
$criteria = new CDbCriteria();
if ($this->startDate) {
$criteria->compare('cli_created', '>=' . Date::formatDate('Y-m-d', $this->startDate));
}
if ($this->endDate) {
$criteria->compare('cli_created', '<=' . Date::formatDate('Y-m-d', $this->endDate));
}
$data = Yii::app()->db->createCommand()->from('client');
switch ($this->granulation) {
case self::GRANULARITY_WEEK:
$data = $data->select('YEAR(cli_created) year, WEEK(cli_created) period, COUNT(*) count');
$data = $data->group('YEAR(cli_created), WEEK(cli_created)');
break;
case self::GRANULARITY_MONTH:
$data = $data->select('YEAR(cli_created) year, MONTH(cli_created) period, COUNT(*) count');
$data = $data->group('YEAR(cli_created), MONTH(cli_created)');
break;
case self::GRANULARITY_DAY:
$data = $data->select('YEAR(cli_created) year, DAYOFYEAR(cli_created) period, COUNT(*) count');
$data = $data->group('YEAR(cli_created), DAYOFYEAR(cli_created)');
break;
default:
$data = $data->select('YEAR(cli_created) year, WEEK(cli_created) period, COUNT(*) count');
$data = $data->group('YEAR(cli_created), WEEK(cli_created)');
break;
}
if ($criteria->toArray()['condition']) {
$data->where($criteria->toArray()['condition']);
$data->params = $criteria->params;
}
$data = $data->queryAll();
return $data;
}
示例2: actionSelectClient
public function actionSelectClient()
{
AppointmentBuilder::start();
AppointmentBuilder::getCurrent()->setUser(Yii::app()->user->id);
$availableTypes = ['viewing', 'valuation'];
$appointmentType = isset($_GET['for']) && in_array($_GET['for'], $availableTypes) ? $_GET['for'] : reset($availableTypes);
$appointmentDate = isset($_GET['date']) && $_GET['date'] ? Date::formatDate("Y/m/d", $_GET['date']) : date("Y/m/d");
$model = new Client('search');
$model->cli_created = '';
$model->cli_saleemail = '';
$model->telephones = [new Telephone('search')];
AppointmentBuilder::getCurrent()->setDate($appointmentDate);
AppointmentBuilder::getCurrent()->setType($appointmentType);
AppointmentBuilder::getCurrent()->setInstructionId(isset($_GET['instructionId']) ? $_GET['instructionId'] : null);
$this->render('selectClient', compact('model', 'appointmentDate', 'appointmentType'));
}
示例3: loadModel
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param $id
* @throws CHttpException
* @internal param \the $integer ID of the model to be loaded
* @return Deal
*/
public function loadModel($id)
{
$model = Deal::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, "Instruction [id : {$id}] was not found");
}
$model->followUpDue = $model->followUpDue ? Date::formatDate('d/m/Y', $model->followUpDue) : null;
// follow up due is a very logical field. it must be either null or a real date.
$model->valuationDate = $model->valuationDate ? Date::formatDate('d/m/Y', $model->valuationDate) : null;
$model->dea_compdate = $model->dea_compdate ? Date::formatDate('d/m/Y', $model->dea_compdate) : null;
$model->dea_exchdate = $model->dea_exchdate ? Date::formatDate('d/m/Y', $model->dea_exchdate) : null;
$model->dea_marketprice = $model->dea_marketprice;
$model->dea_valueprice = $model->dea_valueprice;
$model->dea_valuepricemax = $model->dea_valuepricemax;
return $model;
}
示例4: getDataById
private function getDataById($id)
{
$data = [];
$client = Client::model()->findByPk($id);
if ($client) {
$data[] = ['label' => 'Client: ' . $client->getFullName(), 'value' => $client->getFullName(), 'url' => $this->createUrl('client/update', ['id' => $client->cli_id])];
}
$instruction = Deal::model()->findByPk($id);
if ($instruction) {
$data[] = ['label' => 'Instruction: ' . $instruction->title, 'value' => $instruction->title, 'url' => $this->createUrl('instruction/summary', ['id' => $instruction->dea_id])];
}
/** @var Appointment $appointment */
$appointment = Appointment::model()->with('user')->findByPk($id);
if ($appointment) {
$data[] = ['label' => $appointment->app_type . ': ' . Date::formatDate('d/m H:i', $appointment->app_start) . ' ' . $appointment->user->getFullName(), 'value' => $instruction->title, 'url' => $this->createUrl('instruction/update', ['id' => $instruction->dea_id])];
}
return $data;
}
示例5: ob_start
ob_start();
foreach ($dealNotes as $note) {
?>
<div class="note <?php
echo $note->not_status;
?>
">
<div class="header">
<div class="author">
<?php
echo $note->creator->getFullUsername();
?>
</div>
<div class="date">
<?php
echo Date::formatDate('d/m/y', $note->not_edited);
?>
</div>
<div class="icon">
<?php
echo CHtml::image(Icon::EDIT_ICON, "Edit", ["onClick" => "popupWindow('" . $this->createUrl("note/edit/", ["id" => $note->not_id, 'callback' => "showNotesBlocksById", "popup" => true]) . "');"]);
?>
</div>
<div class="icon">
<?php
echo CHtml::image(Icon::CROSS_ICON, "Delete", ["onClick" => "deleteNote('" . $note->not_id . "')"]);
?>
</div>
</div>
<div class="content">
<?php
示例6: date
echo $form->textField($model, 'off_price', ['placeholder' => '£']);
?>
</div>
</div>
<?php
} else {
?>
<div class="control-group">
<label class="control-label"><?php
echo $form->controlLabel($model, 'off_timestamp');
?>
</label>
<div class="controls">
<span class="text"><?php
echo Date::formatDate('d F Y', $model->off_timestamp);
?>
</span>
<?php
echo $form->hiddenField($model, 'off_timestamp', ['value' => date('Y-m-d H:i:s')]);
?>
</div>
</div>
<div class="control-group">
<label class="control-label"><?php
echo $form->controlLabel($model, 'off_price');
?>
</label>
<div class="controls">
<span class="text"><?php
示例7: explode
if ($data['vendorsNames']) {
$vendors = explode(',', $data['vendorsNames']);
$vendorsId = explode(',', $data['vendorsIds']);
for ($i = 0; $i < count($vendorsId); $i++) {
echo CHtml::link($vendors[$i], ['client/update', 'id' => $vendorsId[$i]], ['class' => 'table-link']);
echo $i + 1 == count($vendorsId) ? '' : ',';
}
} else {
echo 'No vendor found';
}
}), array('name' => 'vendorLastContacted', 'header' => "Last Contacted", 'value' => function ($data) {
if ($data['vendorsIds']) {
$date = "";
$dateLink = "-- -- ----";
if ($data['vendorLastContacted'] && $data['vendorLastContacted'] != '0000-00-00 00:00:00') {
$date = $dateLink = Date::formatDate('d/m/Y', $data['vendorLastContacted']);
}
echo CHtml::textField("Vendor[lastContacted][" . str_replace(',', '_', $data['vendorsIds']) . "]", $date, ['class' => 'datepicker', 'placeholder' => 'dd/mm/yyyy', 'style' => 'width:66px;', 'data-id' => $data['vendorsIds']]);
echo CHtml::label($dateLink, '#', ['class' => 'saveLastContacted', 'data-id' => $data['vendorsIds'], 'onclick' => 'saveContactedDt(this.id)', 'id' => str_replace(',', '_', $data['vendorsIds'])]);
}
}), array('name' => 'totalOffers', 'header' => "Offers", 'value' => function ($data) {
echo CHtml::link($data['totalOffers'], ['instruction/summary/id/' . $data['dea_id'] . '##offers'], ['class' => 'table-link']);
}), array('name' => 'dea_board', 'header' => "Board", 'value' => function ($data) {
$boardText = $data['dea_board'] . ' - ' . ($data['dea_boardtype'] ? $data['dea_boardtype'] : "Not specified");
echo CHtml::link($boardText, ['instruction/summary/id/' . $data['dea_id'] . '##marketingDetails'], ['class' => 'table-link']);
}), array('name' => 'latestViewing', 'header' => "Last Viewing", 'type' => 'raw', 'value' => function ($data) {
if ($data['latestViewing']) {
return CHtml::link(date("d/m/Y", strtotime($data['latestViewing'])), ['instruction/latestApp', 'id' => $data['dea_id']], ['class' => 'table-link']);
} else {
return 'No viewing found';
}
示例8: foreach
<th>Type</th>
<th>Total</th>
<th>Queued</th>
<th>Sent</th>
<th>Opened</th>
<th>Property Hits</th>
<th>Unique Hits</th>
<th>User</th>
<th>Details</th>
</tr>
<?php
foreach ($model->mandrillMailshots as $key => $mailshot) {
?>
<tr>
<td><?php
echo Date::formatDate('d/m/Y H:i', $mailshot->created);
?>
</td>
<td><?php
echo $mailshot->type;
?>
</td>
<!-- <td>--><?php
//echo $mailshot->emailCount
?>
<!--</td>-->
<!-- <td>--><?php
//echo $mailshot->queuedEmailCount
?>
<!--</td>-->
<!-- <td>--><?php
示例9:
<div class="info">
<div class="block titles">
<div class="inner-block">
<h3 class="title">
<?php
echo CHtml::link($data->title, ['blog/view', 'id' => $data->id]);
?>
</h3>
</div>
</div>
<div class="block strapline">
<div class="inner-block">
<?php
echo Util::strapString(CHtml::encode($data->strapline), 0, 300);
?>
</div>
</div>
<div class="block">
<div class="inner-block blog-date">
<?php
echo Date::formatDate('F jS', $data->created);
?>
</div>
</div>
</div>
</div>
示例10: array
echo $data->timeFrom ? " " . CHtml::encode($data->timeFrom) : "";
?>
<br/>
<?php
}
?>
<?php
if ($data->dateTo) {
?>
<b><?php
echo "Finishes";
?>
:</b>
<?php
echo CHtml::encode(Date::formatDate("d/m/Y", $data->dateTo));
?>
<?php
echo $data->timeTo ? " " . CHtml::encode($data->timeTo) : "";
?>
<br/>
<?php
}
?>
<b>Status: </b><?php
echo $data->statusValue ? $data->statusValue->ListItem : "";
?>
<br>
<?php
echo CHtml::link('Delete', $this->createUrl('delete', ['id' => $data->id]), array('onclick' => ' {' . CHtml::ajax(array('type' => 'POST', 'beforeSend' => 'js:function(){if(confirm("Are you sure you want to delete?"))return true;else return false;}', 'url' => $this->createUrl('delete', array('id' => $data->id, 'ajax' => 'delete')), 'complete' => "js:function(jqXHR, textStatus){ location.reload(); }")) . 'return false;}'));
?>
示例11: foreach
$activeViewing = false;
foreach ($model->viewings as $viewing) {
if ($viewing->app_start <= date('Y-m-d H:i:s') && $viewing->app_status == Appointment::STATUS_ACTIVE) {
$activeViewing = true;
}
?>
<tr class="<?php
echo strtotime($viewing->app_start) > time() ? "highlight green" : "";
?>
">
<td><?php
echo Date::formatDate("d/m/Y", $viewing->app_start);
?>
</td>
<td><?php
echo Date::formatDate("H:i", $viewing->app_start);
?>
</td>
<td>
<?php
if ($viewing->user) {
?>
<span class="negotiator-color"
style="background-color:#<?php
echo $viewing->user->use_colour;
?>
"></span><?php
echo $viewing->user->fullName;
?>
<?php
}
示例12: foreach
?>
<table class="small-table">
<tr>
<th>Date</th>
<th>Client</th>
<th>Email</th>
<th>Text</th>
<th>Registered</th>
</tr>
<?php
foreach ($model->interest as $interest) {
?>
<tr>
<td><?php
echo Date::formatDate('d/m/Y H:i', $interest->created);
?>
</td>
<td><?php
echo CHtml::link($interest->client->getFullName(), ['client/update', 'id' => $interest->client->cli_id]);
?>
</td>
<td><?php
echo $interest->email ? CHtml::image(Icon::GREEN_TICK_ICON) : CHtml::image(Icon::CROSS_ICON);
?>
</td>
<td><?php
echo $interest->text ? CHtml::image(Icon::GREEN_TICK_ICON) : CHtml::image(Icon::CROSS_ICON);
?>
</td>
<td></td>
示例13: array
<div class="controls">
<?php
echo $form->checkBoxListWithSelectOnLabel($model, 'app_notetype', Appointment::getNoteTypes(), ['separator' => ' ']);
?>
</div>
<?php
echo $form->endControlGroup();
?>
</div>
</fieldset>
<?php
$this->endWidget();
$this->widget('AdminGridView', array('dataProvider' => $dataProvider, 'title' => 'SEARCH APPOINTMENT', 'id' => 'appointment-list', 'columns' => array(array('class' => 'CButtonColumn', 'header' => 'Actions', 'template' => '{edit}', 'buttons' => array('edit' => array('label' => 'Edit', 'url' => function (Appointment $data) {
return AppointmentController::createEditLink($data->app_id);
}, 'imageUrl' => Icon::EDIT_ICON))), array('name' => 'app_status', 'htmlOptions' => ['style' => 'width: 80px;']), 'app_start' => array('name' => 'app_start', 'header' => 'start', 'htmlOptions' => ['style' => 'width: 130px;'], 'value' => function (Appointment $data) {
return Date::formatDate('d/m/Y H:i', $data->app_start);
}), 'app_type', 'app_notetype', 'app_subject', array('name' => 'user.fullName', 'header' => 'User', 'value' => function ($data) {
return $data->user ? $data->user->fullName : 'unassigned';
}), array('name' => 'client', 'header' => 'Clients', 'type' => 'raw', 'value' => function (Appointment $data) {
$t = [];
foreach ($data->clients as $key => $client) {
$t[] = CHtml::link($client->getFullName(), Yii::app()->createUrl('admin4/client/update', ['id' => $client->cli_id]));
}
return implode(', ', $t);
}), array('header' => 'Address', 'name' => 'address', 'type' => 'raw', 'value' => function (Appointment $data) {
$str = [];
foreach ($data->addresses as $key => $value) {
$str[] = $value->getFullAddressString(', ');
}
return implode('<br>', $str);
}))));
示例14: array
<?php
echo $form->endControlGroup();
?>
<?php
echo $form->beginControlGroup($model, 'app_end');
?>
<?php
echo $form->controlLabel($model, 'app_end');
?>
<div class="controls nofloat">
<?php
echo CHtml::textField('endDay', Date::formatDate('d/m/Y', $model->app_end), array('class' => 'datepicker'));
?>
<?php
echo CHtml::textField('endTime', Date::formatDate('H:i', $model->app_end), array('class' => 'timepicker input-xxsmall', 'placeholder' => 'hh:mm'));
?>
</div>
<?php
echo $form->endControlGroup();
?>
<?php
} else {
?>
<div class="control-group">
<label class="control-label">Date</label>
<div class="controls">
This is a <em>follow up</em> appointment to change its date please do it on <?php
echo CHtml::link('instruction screen', ['instruction/summary', 'id' => $model->instructions[0]->dea_id, '#' => '#valuation']);
?>
示例15: array
<label for="Property[pro_postcode]">Postcode</label>
<?php
echo $form->textField($model, 'pro_postcode', array('size' => 10));
?>
<label for="Deal[dea_status]">Postcode</label>
<?php
echo $form->textField($model, 'pro_postcode', array('size' => 10));
?>
</div>
</fieldset>
<?php
$this->endWidget();
?>
</div>
<?php
$this->widget('AdminGridView', array('id' => 'property-list', 'dataProvider' => $model->search(), 'columns' => array('pro_id', array('header' => 'Instructions', 'type' => 'raw', 'value' => function (Property $data) {
$instructionsHtml = array();
foreach ($data->instructions as $instruction) {
$instructionsHtml[] = '<td><a href="/admin4/instruction/summary/' . $instruction->dea_id . '">' . $instruction->dea_id . '</a></td>' . '<td style="width:100px">' . $instruction->dea_status . '</td>' . '<td>' . Date::formatDate('d/m/Y', $instruction->dea_created) . "</td>" . '</td><td>' . $instruction->dea_type . "</td>";
}
return '<table class="sublist"><tr>' . implode('</tr><tr>', $instructionsHtml) . '</tr></table>';
}, 'htmlOptions' => array('style' => 'width:400px;')), array('name' => 'fullAddressString', 'header' => 'Address'), array('name' => 'pro_postcode', 'header' => 'Postcode'))));
?>
<script type="text/javascript">
var goToInstruction = function (id)
{
document.location.href = "/admin4/instruction/summary/" + id + "";
}
</script>