Revize 810
Přidáno uživatelem Michal Kliment před téměř 14 roky(ů)
freenetis/branches/approval/application/controllers/work_reports.php | ||
---|---|---|
//'separator' => '',
|
||
'use_paginator' => false,
|
||
'use_selector' => false,
|
||
'total_items' => count ($works)
|
||
'total_items' => count ($works),
|
||
'show_no_items' => false
|
||
));
|
||
|
||
if ($this->acl_check_new('Users_Controller','work', $work_report->user->member_id))
|
||
$grid->add_new_button(url_lang::base().'works/add_to_work_report/'.$work_report->id, url_lang::lang('texts.Add new work'));
|
||
$grid->add_new_button(url_lang::base().'works/add_to_work_report/'.$work_report->id, url_lang::lang('texts.Add new work'), array('class' => 'add_button'));
|
||
|
||
$grid->field('date')->label(url_lang::lang('texts.Date'))->class('date');
|
||
$grid->callback_field('time_from')->label(url_lang::lang('texts.Time from'))->callback('Work_reports_Controller::time_field')->class('time');
|
||
... | ... | |
$grid->callback_field('description')->label(url_lang::lang('texts.Description'))->callback('Work_reports_Controller::description_field')->class('description');
|
||
$grid->field('suggest_amount')->label(url_lang::lang('texts.Suggest amount'))->class('suggest_amount');
|
||
$grid->callback_field('id')->label(url_lang::lang('texts.Work'))->callback('Work_reports_Controller::edit_field');
|
||
$grid->callback_field('id')->label(url_lang::lang('texts.Work'))->callback('Work_reports_Controller::delete_field');
|
||
|
||
$grid->datasource($works);
|
||
|
||
... | ... | |
|
||
public static function description_field($item, $name)
|
||
{
|
||
echo '<textarea class="description">'.$item->description.'</textarea>';
|
||
echo '<textarea class="description" readonly>'.$item->description.'</textarea>';
|
||
}
|
||
|
||
public static function edit_field($item, $name)
|
||
{
|
||
echo '<a href="'.url_lang::base().'works/edit/'.$item->id.'" title="'.url_lang::lang('texts.Edit').'" class="edit_work_link"><img src="'.url::base().'media/images/edit.png"></a>';
|
||
echo html::anchor(url_lang::base().'works/edit/'.$item->id, html::image(array('src' => url::base().'media/images/edit.png')), array('title' => url_lang::lang('texts.Edit'), 'class' => 'edit_button'));
|
||
}
|
||
|
||
public static function delete_field($item, $name)
|
||
{
|
||
echo html::anchor(url_lang::base().'works/delete/'.$item->id, html::image(array('src' => url::base().'media/images/delete.png')), array('title' => url_lang::lang('texts.Delete'), 'class' => 'delete_button'));
|
||
}
|
||
|
||
}
|
freenetis/branches/approval/application/controllers/works.php | ||
---|---|---|
$work_user_id= $work->user_id;
|
||
$work_description = $work->description;
|
||
$work_suggest_amount = $work->suggest_amount;
|
||
$work_report_id = $work->job_report_id;
|
||
$saved = $work->delete();
|
||
|
||
// set up state of approval template
|
||
... | ... | |
|
||
$this->session->set_flash('message', url_lang::lang('texts.Work has been successfully deleted').'.');
|
||
}
|
||
url::redirect(url_lang::base().'works/show_by_user/'.$work_user_id);
|
||
if ($work_report_id)
|
||
url::redirect(url_lang::base().'work_reports/show/'.$work_report_id);
|
||
else
|
||
url::redirect(url_lang::base().'works/show_by_user/'.$work_user_id);
|
||
}
|
||
|
||
/** CALLBACK FUNCTIONS **/
|
freenetis/branches/approval/application/libraries/Grid.php | ||
---|---|---|
protected $form_submit_value = '';
|
||
protected $form_extra_buttons = array();
|
||
|
||
protected $buttons = array();
|
||
protected $buttons = array();
|
||
|
||
protected $show_no_items = true;
|
||
|
||
private $first_add_button;
|
||
|
||
... | ... | |
$this->template->form = $this->form;
|
||
$this->template->form_extra_buttons = $this->form_extra_buttons;
|
||
$this->template->form_submit_value = ($this->form_submit_value!='') ? $this->form_submit_value : url_lang::lang('texts.Update');
|
||
$this->template->show_no_items = $this->show_no_items;
|
||
return $this->template->render();
|
||
}
|
||
|
freenetis/branches/approval/application/views/main.php | ||
---|---|---|
|
||
$(document).ready(function(){
|
||
|
||
var $dialog = $('<div></div>').dialog({
|
||
$dialog = $('<div></div>').dialog({
|
||
autoOpen: false,
|
||
title: '<?php echo url_lang::lang('texts.Change language') ?>',
|
||
modal: true,
|
freenetis/branches/approval/application/views/js/work_reports_show.php | ||
---|---|---|
|
||
i++;
|
||
|
||
var row = $("#jobs_grid").children("tbody").append("<tr>").children().last();
|
||
$(".work_reports_submit").removeAttr("disabled");
|
||
|
||
var row = $(".grid_table").children("tbody").append("<tr>").children().last();
|
||
|
||
date = row.append("<td>").children().last().append("<input type=text name='date["+i+"]' class='date required'>").children().last();
|
||
time_from = row.append("<td>").children().last().append("<input type=text name='time_from["+i+"]' class='time_from time required'>").children().last();
|
||
time_to = row.append("<td>").children().last().append("<input type=text name='time_to["+i+"]' class='time_to time'>").children().last();
|
||
... | ... | |
km = row.append("<td>").children().last().append("<input type=text name='km["+i+"]' class='km number'>").children().last();
|
||
description = row.append("<td>").children().last().append("<textarea name='description["+i+"]' class='description required'>").children().last();
|
||
suggest_amount = row.append("<td>").children().last().append("<input type=text name='suggest_amount["+i+"]' class='suggest_amount required number'>").children().last();
|
||
edit_field = row.append("<td>").children().last();
|
||
delete_field = row.append("<td>").children().last().append("<a href='#' class='delete_button new_delete_button'><img src=<?php echo url::base()?>media/images/delete.png></a>").children().last();
|
||
|
||
date.datepicker({
|
||
dateFormat: "yy-mm-dd",
|
||
... | ... | |
return false;
|
||
});
|
||
|
||
$(".delete_button").live("click", function() {
|
||
|
||
if (!$(this).hasClass("new_delete_button"))
|
||
$.get(this.href);
|
||
|
||
$(this).parent().parent().remove();
|
||
|
||
return false;
|
||
});
|
||
|
||
$(".work_reports_form").validate({
|
||
submitHandler: function(form) {
|
||
alert ("test");
|
freenetis/branches/approval/application/views/work_reports_show.php | ||
---|---|---|
<br /><br />
|
||
<h3><?php echo url_lang::lang('texts.Works') ?></h3>
|
||
|
||
<?php echo $grid ?>
|
||
<form method="post" class="work_reports_form">
|
||
<?php echo $grid ?>
|
||
<input type="submit" value="ok" class="work_reports_submit" disabled>
|
||
</form>
|
freenetis/branches/approval/application/views/grid_template.php | ||
---|---|---|
endforeach; ?>
|
||
</tr>
|
||
<?php endforeach;
|
||
else echo '<tr><td colspan="'.count($fields).'">'.url_lang::lang('texts.There are no items yet.').'</td></tr>';
|
||
else if ($show_no_items) echo '<tr><td colspan="'.count($fields).'">'.url_lang::lang('texts.There are no items yet.').'</td></tr>';
|
||
?>
|
||
|
||
<!-- table footer -->
|
Také k dispozici: Unified diff
Dalsi zmeny ve vetvi approval.