Skip to content

Commit

Permalink
Delete ARLEMs from MirageXR
Browse files Browse the repository at this point in the history
User can delete their own files directly from MirageXR app
  • Loading branch information
aradjafari committed Apr 16, 2021
1 parent 76539c3 commit f5982d3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
31 changes: 31 additions & 0 deletions classes/webservice/getdata_from_db.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

require_once(dirname(__FILE__). '/../../../../config.php');
require_once($CFG->dirroot.'/mod/arete/classes/utilities.php');
require_once($CFG->dirroot.'/mod/arete/classes/filemanager.php');

$request = filter_input(INPUT_POST, 'request');
$itemid = filter_input(INPUT_POST, 'itemid');
$sessionid = filter_input(INPUT_POST, 'sessionid');
$userid = filter_input(INPUT_POST, 'userid');
$token = filter_input(INPUT_POST, 'token');

Expand All @@ -13,6 +15,9 @@
case "arlemlist":
get_arlem_list();
break;
case "deleteArlem":
delete_arlem();
break;
default:
print_r('Error: request is NULL');
break;
Expand Down Expand Up @@ -211,4 +216,30 @@ function find_author($arlem){
$authoruser = $DB->get_record('user', array('id' => $arlem->userid));
return $authoruser->firstname . ' ' .$authoruser->lastname;

}


function delete_arlem(){

global $DB,$itemid,$sessionid;

if(!isset($sessionid))
{
$sessionid = '';
}

if(!isset($itemid))
{
$itemid = '';
}

$filename = $DB -> get_field('arete_allarlems', 'filename' , array('itemid'=> $itemid, 'sessionid' => $sessionid));

if(isset($itemid) && $filename !== null){
deletePluginArlem($filename, $itemid);
}
else{
echo 'Error: Check if itemid is not empty. Or maybe the file you are trying to delete is not exist!';
}

}
4 changes: 2 additions & 2 deletions css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ only screen and (max-width: 1300px) {
.table-responsive td:nth-of-type(4):before { content: "Thumbnail"; }
.table-responsive td:nth-of-type(5):before { content: "Size"; }
.table-responsive td:nth-of-type(6):before { content: "Author"; }
.table-responsive td:nth-of-type(7):before { content: "Download"; }
.table-responsive td:nth-of-type(7):before { content: "Launch"; }
.table-responsive td:nth-of-type(8):before { content: "Edit"; }
.table-responsive td:nth-of-type(9):before { content: "QR Code"; }
.table-responsive td:nth-of-type(10):before { content: "Public"; }
Expand All @@ -386,7 +386,7 @@ only screen and (max-width: 1300px) {
#assignedTable td:nth-of-type(5):before { content: "Size"; }
#assignedTable td:nth-of-type(6):before { content: "Author"; }
#assignedTable td:nth-of-type(7):before { content: "Assigned By"; }
#assignedTable td:nth-of-type(8):before { content: "Download"; }
#assignedTable td:nth-of-type(8):before { content: "Launch"; }
#assignedTable td:nth-of-type(9):before { content: "QR Code"; }


Expand Down

0 comments on commit f5982d3

Please sign in to comment.