MDL-20534 lti: Updating privacy settings dynamically based on matched Launch URL.
[moodle.git] / mod / lti / ajax.php
index efa6c80..8bcc089 100644 (file)
@@ -46,6 +46,22 @@ switch ($action) {
             $response->toolid = $tool->id;
             $response->toolname = htmlspecialchars($tool->name);
             $response->tooldomain = htmlspecialchars($tool->tooldomain);
+            
+            //Look up privacy settings
+            $query = 
+            '
+                SELECT name, value
+                FROM {lti_types_config}
+                WHERE
+                    typeid = :typeid
+                AND name IN (\'sendname\', \'sendemailaddr\', \'acceptgrades\', \'allowroster\')
+            ';
+                        
+            $privacyconfigs = $DB->get_records_sql($query, array('typeid' => $tool->id));
+            foreach($privacyconfigs as $config){
+                $configname = $config->name;
+                $response->$configname = $config->value;
+            }
         }
         break;
 }