MDL-40096 assign: Prevent js error because uniqid() is not unique.

Use html_writer::random_id instead because it incorporates a static counter.
This commit is contained in:
Damyon Wiese 2013-12-09 10:24:17 +08:00
parent c36a2401ab
commit 9a046c0683

View file

@ -55,7 +55,7 @@ class mod_assign_renderer extends plugin_renderer_base {
* @return string
*/
public function render_assign_files(assign_files $tree) {
$this->htmlid = 'assign_files_tree_'.uniqid();
$this->htmlid = html_writer::random_id('assign_files_tree');
$this->page->requires->js_init_call('M.mod_assign.init_tree', array(true, $this->htmlid));
$html = '<div id="'.$this->htmlid.'">';
$html .= $this->htmllize_tree($tree, $tree->dir);