commit
a14ba552c0
@ -0,0 +1,88 @@ |
||||
<div id="comment-popup" style="display: none"> |
||||
<div id="comment-area" class="well"> |
||||
<textarea id="txt-comment" style="width: 100%;height: 150px;" placeholder="<?php echo get_lang('WriteAComment'); ?>"></textarea>
|
||||
</div> |
||||
<span id="save-comment-controls"> |
||||
<span id="comment-results"></span> |
||||
<button id="comment-popup-save" class="btn btn-primary" type="submit"> |
||||
<em class="fa fa-save"></em> <?php echo get_lang('Save'); ?> |
||||
</button> |
||||
<button id="comment-popup-close" class="btn btn-default" type="submit"> |
||||
<em class="fa fa-eraser"></em> <?php echo get_lang('Close'); ?> |
||||
</button> |
||||
</span> |
||||
<span class="loading" style="display: none"><em class="fa fa-spinner"></em></span> |
||||
<input type="hidden" id="comment-selected" /> |
||||
</div> |
||||
<script> |
||||
var urlAjax = "<?php echo api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?'.api_get_cidreq(); ?>";
|
||||
var attendance_id = "<?php echo $attendance_id; ?>";
|
||||
|
||||
$(function() { |
||||
|
||||
$("#comment-popup-save").on("click", function() { |
||||
var comment = $("#txt-comment").val(); |
||||
if (comment == '') { |
||||
alert('<?php echo get_lang('ProvideACommentFirst'); ?>');
|
||||
return false; |
||||
} |
||||
var selected = $("#comment-selected").val(); |
||||
$.ajax({ |
||||
beforeSend: function(result) { |
||||
$('#loading').show(); |
||||
}, |
||||
type: "POST", |
||||
url: urlAjax, |
||||
data: "a=comment_attendance&selected="+selected+"&comment="+comment+"&attendance_id="+attendance_id, |
||||
success: function(data) { |
||||
$('#loading').hide(); |
||||
$('#save-comment-controls').hide(); |
||||
$('#comment-area').hide(); |
||||
if (1 == data) { |
||||
$('#comment-results').html('<?php echo get_lang('Saved'); ?>');
|
||||
} else { |
||||
$('#comment-results').html('<?php echo get_lang('Error'); ?>');
|
||||
} |
||||
$("#comment-popup-close").click(); |
||||
}, |
||||
}); |
||||
}); |
||||
|
||||
$("#comment-popup-close").on("click", function() { |
||||
$("#comment-popup").dialog("close"); |
||||
$('#loading').hide(); |
||||
$('#save-comment-controls').show(); |
||||
$('#comment-area').show(); |
||||
$("#txt-comment").val(''); |
||||
}); |
||||
|
||||
$(".attendance-comment").on("click", function() { |
||||
var selected = $(this).attr("id"); |
||||
$("#comment-selected").val(selected); |
||||
$("#comment-popup").dialog({ |
||||
autoOpen: true, |
||||
width: 500, |
||||
height: 'auto' |
||||
}); |
||||
$("#comment-results").hide(); |
||||
$("#save-comment-controls").show(); |
||||
$('#comment-area').show(); |
||||
var comment = getComment(selected); |
||||
$("#txt-comment").val(comment); |
||||
}); |
||||
|
||||
function getComment(selected) { |
||||
var response = $.ajax({ |
||||
data: "a=get_attendance_comment&selected="+selected, |
||||
url: urlAjax, |
||||
async: false, |
||||
success: function (comment) { |
||||
response = comment; |
||||
}, |
||||
type: 'post' |
||||
}); |
||||
|
||||
return response.responseText; |
||||
} |
||||
}); |
||||
</script> |
||||
@ -0,0 +1,182 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CourseBundle\Entity; |
||||
|
||||
use Doctrine\ORM\Mapping as ORM; |
||||
|
||||
/** |
||||
* CAttendanceResultComment. |
||||
* |
||||
* @ORM\Table( |
||||
* name="c_attendance_result_comment", |
||||
* indexes={ |
||||
* @ORM\Index(name="attendance_sheet_id", columns={"attendance_sheet_id"}), |
||||
* @ORM\Index(name="user_id", columns={"user_id"}) |
||||
* } |
||||
* ) |
||||
* @ORM\Entity |
||||
*/ |
||||
class CAttendanceResultComment |
||||
{ |
||||
/** |
||||
* @var int |
||||
* |
||||
* @ORM\Column(name="iid", type="integer") |
||||
* @ORM\Id |
||||
* @ORM\GeneratedValue |
||||
*/ |
||||
protected $iid; |
||||
|
||||
/** |
||||
* @var int |
||||
* |
||||
* @ORM\Column(name="attendance_sheet_id", type="integer", nullable=false) |
||||
*/ |
||||
protected $attendanceSheetId; |
||||
|
||||
/** |
||||
* @var int |
||||
* |
||||
* @ORM\Column(name="user_id", type="integer", nullable=false) |
||||
*/ |
||||
protected $userId; |
||||
|
||||
/** |
||||
* @var string |
||||
* |
||||
* @ORM\Column(name="comment", type="text", nullable=true) |
||||
*/ |
||||
protected $comment; |
||||
|
||||
/** |
||||
* @var \DateTime |
||||
* |
||||
* @ORM\Column(name="created_at", type="datetime", nullable=false) |
||||
*/ |
||||
protected $createdAt; |
||||
|
||||
/** |
||||
* @var \DateTime |
||||
* |
||||
* @ORM\Column(name="updated_at", type="datetime", nullable=false) |
||||
*/ |
||||
protected $updatedAt; |
||||
|
||||
/** |
||||
* Project constructor. |
||||
*/ |
||||
public function __construct() |
||||
{ |
||||
$this->createdAt = new \DateTime(); |
||||
$this->updatedAt = new \DateTime(); |
||||
} |
||||
|
||||
/** |
||||
* Get attendanceSheetId. |
||||
*/ |
||||
public function getAttendanceSheetId(): int |
||||
{ |
||||
return $this->attendanceSheetId; |
||||
} |
||||
|
||||
/** |
||||
* Set attendanceSheetId. |
||||
* |
||||
* @return CAttendanceResultComment |
||||
*/ |
||||
public function setAttendanceSheetId(int $attendanceSheetId) |
||||
{ |
||||
$this->attendanceSheetId = $attendanceSheetId; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* Set userId. |
||||
* |
||||
* @param int $userId |
||||
* |
||||
* @return CAttendanceResultComment |
||||
*/ |
||||
public function setUserId($userId) |
||||
{ |
||||
$this->userId = $userId; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* Get userId. |
||||
* |
||||
* @return int |
||||
*/ |
||||
public function getUserId() |
||||
{ |
||||
return $this->userId; |
||||
} |
||||
|
||||
/** |
||||
* @param \DateTime $createdAt |
||||
* |
||||
* @return CAttendanceResultComment |
||||
*/ |
||||
public function setCreatedAt($createdAt) |
||||
{ |
||||
$this->createdAt = $createdAt; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return \DateTime |
||||
*/ |
||||
public function getCreatedAt() |
||||
{ |
||||
return $this->createdAt; |
||||
} |
||||
|
||||
/** |
||||
* @param \DateTime $updatedAt |
||||
* |
||||
* @return CAttendanceResultComment |
||||
*/ |
||||
public function setUpdatedAt($updatedAt) |
||||
{ |
||||
$this->updatedAt = $updatedAt; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return \DateTime |
||||
*/ |
||||
public function getUpdatedAt() |
||||
{ |
||||
return $this->updatedAt; |
||||
} |
||||
|
||||
/** |
||||
* Set comment. |
||||
* |
||||
* @param string $comment |
||||
* |
||||
* @return CAttendanceResultComment |
||||
*/ |
||||
public function setComment($comment) |
||||
{ |
||||
$this->comment = $comment; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* Get comment. |
||||
* |
||||
* @return string |
||||
*/ |
||||
public function getComment() |
||||
{ |
||||
return $this->comment; |
||||
} |
||||
} |
||||
Loading…
Reference in new issue