本文整理汇总了PHP中app\models\Task::calcDuration方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::calcDuration方法的具体用法?PHP Task::calcDuration怎么用?PHP Task::calcDuration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Task
的用法示例。
在下文中一共展示了Task::calcDuration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDatatableColumns
protected function getDatatableColumns($entityType, $hideClient)
{
return [['client_name', function ($model) {
return $model->client_public_id ? link_to("clients/{$model->client_public_id}", Utils::getClientDisplayName($model)) : '';
}, !$hideClient], ['created_at', function ($model) {
return link_to("tasks/{$model->public_id}/edit", Task::calcStartTime($model));
}], ['time_log', function ($model) {
return Utils::formatTime(Task::calcDuration($model));
}], ['description', function ($model) {
return $model->description;
}], ['invoice_number', function ($model) {
return self::getStatusLabel($model);
}]];
}
示例2: getDatatable
public function getDatatable($clientPublicId = null)
{
$tasks = $this->taskRepo->find($clientPublicId, Input::get('sSearch'));
$table = Datatable::query($tasks);
if (!$clientPublicId) {
$table->addColumn('checkbox', function ($model) {
return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '" ' . Utils::getEntityRowClass($model) . '>';
})->addColumn('client_name', function ($model) {
return $model->client_public_id ? link_to('clients/' . $model->client_public_id, Utils::getClientDisplayName($model)) : '';
});
}
return $table->addColumn('created_at', function ($model) {
return link_to("tasks/{$model->public_id}/edit", Task::calcStartTime($model));
})->addColumn('time_log', function ($model) {
return gmdate('H:i:s', Task::calcDuration($model));
})->addColumn('description', function ($model) {
return $model->description;
})->addColumn('invoice_number', function ($model) {
return self::getStatusLabel($model);
})->addColumn('dropdown', function ($model) {
$str = '<div class="btn-group tr-action" style="visibility:hidden;">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
' . trans('texts.select') . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">';
if (!$model->deleted_at || $model->deleted_at == '0000-00-00') {
$str .= '<li><a href="' . URL::to('tasks/' . $model->public_id . '/edit') . '">' . trans('texts.edit_task') . '</a></li>';
}
if ($model->invoice_number) {
$str .= '<li>' . link_to("/invoices/{$model->invoice_public_id}/edit", trans('texts.view_invoice')) . '</li>';
} elseif ($model->is_running) {
$str .= '<li><a href="javascript:stopTask(' . $model->public_id . ')">' . trans('texts.stop_task') . '</a></li>';
} elseif (!$model->deleted_at || $model->deleted_at == '0000-00-00') {
$str .= '<li><a href="javascript:invoiceTask(' . $model->public_id . ')">' . trans('texts.invoice_task') . '</a></li>';
}
if (!$model->deleted_at || $model->deleted_at == '0000-00-00') {
$str .= '<li class="divider"></li>
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans('texts.archive_task') . '</a></li>';
} else {
$str .= '<li><a href="javascript:restoreEntity(' . $model->public_id . ')">' . trans('texts.restore_task') . '</a></li>';
}
if (!$model->is_deleted) {
$str .= '<li><a href="javascript:deleteEntity(' . $model->public_id . ')">' . trans('texts.delete_task') . '</a></li></ul>';
}
return $str . '</div>';
})->make();
}
示例3: columns
public function columns()
{
return [['client_name', function ($model) {
if (!Auth::user()->can('viewByOwner', [ENTITY_CLIENT, $model->client_user_id])) {
return Utils::getClientDisplayName($model);
}
return $model->client_public_id ? link_to("clients/{$model->client_public_id}", Utils::getClientDisplayName($model))->toHtml() : '';
}, !$this->hideClient], ['created_at', function ($model) {
return link_to("tasks/{$model->public_id}/edit", Task::calcStartTime($model))->toHtml();
}], ['time_log', function ($model) {
return Utils::formatTime(Task::calcDuration($model));
}], ['description', function ($model) {
return $model->description;
}], ['invoice_number', function ($model) {
return self::getStatusLabel($model);
}]];
}