Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Logeshwaran
/
mandatoryactivities
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
d5d122f0
authored
2020-09-03 13:41:57 +0530
by
logesh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added condition for empty ids.
1 parent
a7ec8fdb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
7 deletions
ajax.php
templates/confirmation.mustache
ajax.php
View file @
d5d122f
...
...
@@ -49,7 +49,12 @@ switch ($action) {
$instance
->
cmid
=
$madatorycmids
;
$instance
->
mandatory
=
$mandatoryactivities
->
mandatory
;
$DB
->
update_record
(
'local_mandatory_activities'
,
$instance
);
if
(
!
empty
(
$madatorycmids
)){
$DB
->
update_record
(
'local_mandatory_activities'
,
$instance
);
}
else
{
$sql
=
"delete from mdl_local_mandatory_activities where course=
$course
"
;
$DB
->
execute
(
$sql
);
}
}
else
{
...
...
@@ -84,7 +89,7 @@ switch ($action) {
$allcmids
[]
=
$value
->
id
;
}
if
(
$mandatoryids
&&
$checkedids
){
if
(
$mandatoryids
||
$checkedids
){
$previousestatus
=
explode
(
","
,
$mandatoryids
);
foreach
(
$checkedids
as
$id
){
...
...
@@ -140,7 +145,41 @@ switch ($action) {
$unchangedactivities
[]
=
$aname
;
}
}
}
else
{
}
else
if
(
$checkedids
)
{
foreach
(
$checkedids
as
$id
){
if
(
isset
(
$qresult
[
$id
])){
$id
=
number_format
(
$id
);
$modaname
=
$qresult
[
$id
]
->
name
;
$instance
=
$qresult
[
$id
]
->
instance
;
$sqlactivityname
=
"select name from mdl_
$modaname
where id=
$instance
"
;
$aname
=
$DB
->
get_record_sql
(
$sqlactivityname
);
$newlyaddedactivities
[]
=
$aname
;
$newlyaddedids
[]
=
$id
;
}
}
$res
=
array_diff
(
$allcmids
,
$newlyaddedids
);
$unchangedids
=
array_diff
(
$res
,
$removedids
);
foreach
(
$unchangedids
as
$data
){
if
(
isset
(
$qresult
[
$data
])){
$id
=
number_format
(
$data
);
$modaname
=
$qresult
[
$data
]
->
name
;
$instance
=
$qresult
[
$data
]
->
instance
;
$sqlactivityname
=
"select name from mdl_
$modaname
where id=
$instance
"
;
$aname
=
$DB
->
get_record_sql
(
$sqlactivityname
);
$unchangedactivities
[]
=
$aname
;
}
}
}
else
{
foreach
(
$qresult
as
$val
){
$modaname
=
$val
->
name
;
...
...
templates/confirmation.mustache
View file @
d5d122f
...
...
@@ -128,14 +128,19 @@ th,td{
$(document).on('click', '#savemandatory', function(){
$('#madatorysection').css("display", "none");
$('#loadingcomparision').css("display", "block");
var checkedids=[];
$('input:checkbox.checkboxesavilable:checked').each(function () {
checkedids.push($(this).attr("data-cmid"));
});
// if(checkedids.length > 0){
$('#madatorysection').css("display", "none");
$('#loadingcomparision').css("display", "block");
var rootPath = M.cfg.wwwroot;
var arg = { action:'getcomparision',
...
...
@@ -220,6 +225,12 @@ th,td{
}
});
// }else{
// alert("Please do select atleast one activity to proceed");
// }
// $('#accordion1').css("display", "none");
...
...
@@ -267,7 +278,7 @@ th,td{
$('#loadingcomparision').css("display", "none");
var alerttags='<div class="alert alert-success"><strong>Successfully S
s
ved</strong></div>';
var alerttags='<div class="alert alert-success"><strong>Successfully S
a
ved</strong></div>';
$('#successalert').append(alerttags);
setTimeout(function(){
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment