mdjnelson / moodle-mod_customcert

Enables the creation of dynamically generated certificates with complete customisation via the web browser.
https://moodle.org/plugins/mod_customcert
GNU General Public License v3.0
94 stars 159 forks source link

Reposition items DB posy val -12 #408

Closed antoniodaugello closed 3 years ago

antoniodaugello commented 3 years ago

Hi Mark, congratulations on the awesome plugin. I have an element repositioning problem, i use moodle Version 3.10 and adaptable template. When i create a model and i use the reposition item and save all, in the db the background save in the column posy the value -12 and this value is application on all item before it's saved in database.

i have half solved editing file ajax.php

// Loop through the data. /foreach ($values as $value) { $element = new stdClass(); $element->id = $value->id; $element->posx = $value->posx; $element->posy = $value->posy; $DB->update_record('customcert_elements', $element); }/

// HALF FIX Loop through the data. foreach ($va lues as $value) { if($value->posy == -12){ $element = new stdClass(); $element->id = $value->id; $element->posx = $value->posx; $element->posy = $value->posy+12; } else { $element = new stdClass(); $element->id = $value->id; $element->posx = $value->posx; $element->posy = $value->posy;

}
$DB->update_record('customcert_elements', $element);

} but the problem it's not resolve because $value->posy it is not always -12.

do you have any suggestions?

could it be a bug?

tnx

mdjnelson commented 3 years ago

Hi there and sorry for the late reply.

Yes, that seems like a bug. That code was written a loooong time ago and I have forgotten why there is a random -12. I will look into this. Perhaps I can replace the YUI code completely.

mdjnelson commented 3 years ago

I am closing this in favour of https://github.com/mdjnelson/moodle-mod_customcert/issues/416.

antoniodaugello commented 3 years ago

perfect. tnx