Skip to content

Commit

Permalink
Getting ARLEM list bug is fixed
Browse files Browse the repository at this point in the history
The issue that cause the user who is not enrolled to an activity cannot see the activity list is fixed
  • Loading branch information
aradjafari committed Apr 13, 2021
1 parent 20cbe6e commit 76539c3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
33 changes: 20 additions & 13 deletions classes/webservice/getdata_from_db.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,34 @@
*
*/
function get_arlem_list(){
global $DB,$userid,$token;

global $DB,$userid,$token;


if(isset($userid) && isset($token)){

//save all arete ids which user are enrolled to
$unsorted_arlems = $DB->get_records_select('arete_allarlems', 'upublic = 1 OR userid = ' . $userid , null, 'timecreated DESC'); //only public and for the user

//the moudules that the user enrolled to their activities
$USER_moduleIDs = get_user_arete_modules_ids();

//All arlems with the ARLEMs which are assigne to the courses that user is enrolled to on top of the list
$arlems = sorted_arlemList_by_user_assigned($unsorted_arlems, $USER_moduleIDs);

}else{
$arlems = $DB->get_records('arete_allarlems' , array('upublic' => 1 ), 'timecreated DESC'); //only public and for the user

//add author name to ARLEM file
foreach ($arlems as $arlem) {
$arlem->author = find_author($arlem);
//if the user is enrolled atleast to one activity which contains arete module
if(!empty($USER_moduleIDs)){

//save all arete ids which user are enrolled to
$unsorted_arlems = $DB->get_records_select('arete_allarlems', 'upublic = 1 OR userid = ' . $userid , null, 'timecreated DESC'); //only public and for the user
//All arlems with the ARLEMs which are assigne to the courses that user is enrolled to on top of the list
$arlems = sorted_arlemList_by_user_assigned($unsorted_arlems, $USER_moduleIDs);

print_r(json_encode($arlems));
return;
}
}

$arlems = $DB->get_records('arete_allarlems' , array('upublic' => 1 ), 'timecreated DESC'); //only public and for the user
//
//add author name to ARLEM file
foreach ($arlems as $arlem) {
$arlem->author = find_author($arlem);
}

print_r(json_encode($arlems));
}
Expand Down
2 changes: 1 addition & 1 deletion lang/en/arete.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
$string['qrtitle'] = 'QR Code';
$string['qrbutton'] = 'Generate';
$string['authortitle'] = 'Author';
$string['downloadtitle'] = 'Lunch';
$string['downloadtitle'] = 'Launch';
$string['downloadbutton'] = 'Play';
$string['editbutton'] = 'Edit';
$string['publictitle'] = 'Public';
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2021040900; // The current module version (Date: YYYYMMDDXX)
$plugin->version = 2021041300; // The current module version (Date: YYYYMMDDXX)
$plugin->requires = 2015111000; // Requires this Moodle version
$plugin->component = 'mod_arete'; // Full name of the plugin (used for diagnostics)

0 comments on commit 76539c3

Please sign in to comment.