function instance_config_save($data)
 {
     if (empty($data->quizid)) {
         $data->quizid = $this->get_owning_quiz();
     }
     parent::instance_config_save($data);
 }
 function instance_config_save($data, $nolongerused = false)
 {
     if (empty($data->quizid)) {
         $data->quizid = $this->get_owning_quiz();
     }
     parent::instance_config_save($data);
 }
 public function instance_config_save($data)
 {
     if (get_config('simplehtml', 'Allow_HTML') == '1') {
         $data->text = strip_tags($data->text);
     }
     // And now forward to the default implementation defined in the parent class
     return parent::instance_config_save($data);
 }
Example #4
0
 /**
  * Serialize and store config data
  */
 function instance_config_save($data, $nolongerused = false)
 {
     global $DB;
     $config = clone $data;
     // Move embedded files into a proper filearea and adjust HTML links to match
     $config->text = file_save_draft_area_files($data->text['itemid'], $this->context->id, 'block_html', 'content', 0, array('subdirs' => true), $data->text['text']);
     $config->format = $data->text['format'];
     parent::instance_config_save($config, $nolongerused);
 }
 function instance_config_save($data)
 {
     $savedata = null;
     if (isset($data->general['moduleUrl'])) {
         $savedata->moduleUrl = $data->general['moduleUrl'];
     }
     $savedata->configuration = $data->configuration;
     $savedata->preferences = $data->preferences;
     return parent::instance_config_save($savedata);
 }
Example #6
0
 /**
  * @desc Saves the form data from configuration into the wwassignment_bridge table.
  */
 function instance_config_save($data)
 {
     $webworkcourse = $data->webwork_link_id;
     $moodlecourse = $data->courseid;
     $wwassignmentbridge = new stdClass();
     $wwassignmentbridge->course = $moodlecourse;
     $wwassignmentbridge->webwork_course = $webworkcourse;
     //has this mapping been defined
     $record = get_record('wwassignment_bridge', 'course', $moodlecourse);
     if (!$record) {
         //new one
         insert_record('wwassignment_bridge', $wwassignmentbridge);
     } else {
         //update
         $wwassignmentbridge->id = $record->id;
         update_record('wwassignment_bridge', $wwassignmentbridge);
     }
     return parent::instance_config_save($data);
 }
 public function instance_config_save($data)
 {
     global $DB, $USER;
     $alerts = $DB->get_records('block_itutor_profiler_alerts', array('course_id' => $data->courseid));
     foreach ($alerts as $alert) {
         $s = 'isalerting' . $alert->id;
         //alert has been unticked
         if (!isset($data->{$s})) {
             //remove alert from database
             $DB->delete_records('block_itutor_profiler_alerts', array('id' => $alert->id));
         }
         unset($data->{$s});
     }
     //If new alert create => add it to the DB
     if ($data->alerttype != 0) {
         $record = new stdClass();
         $record->course_id = $data->courseid;
         $record->alert_date = $data->alertdate;
         $record->alert_type = $data->alerttype;
         $record->alert_data = $data->alertdata;
         $record->alert_message = $data->alertmessage;
         if (isset($data->sendtostaff)) {
             $record->alert_sendto = $USER->id;
         } else {
             $record->alert_sendto = null;
         }
         $DB->insert_record('block_itutor_profiler_alerts', $record, false);
         //false, no return, no bulk
     }
     unset($data->courseid);
     unset($data->alertdate);
     unset($data->alerttype);
     unset($data->alertdata);
     unset($data->alertmessage);
     unset($data->sendtostaff);
     //Call normal save functionality
     return parent::instance_config_save($data);
 }
 /**
  * Override the instance_config_save method
  */
 function instance_config_save($data, $nolongerused = false)
 {
     parent::instance_config_save($data, $nolongerused);
     global $DB, $COURSE;
     foreach ($data as $name => $value) {
         $rec = $DB->get_record('block_timetracker_config', array('courseid' => $COURSE->id, 'name' => $name));
         $conf = new stdClass();
         $conf->name = $name;
         $conf->value = $value;
         $conf->courseid = $COURSE->id;
         if ($rec) {
             $conf->id = $rec->id;
             $DB->update_record('block_timetracker_config', $conf);
         } else {
             $DB->insert_record('block_timetracker_config', $conf);
         }
     }
 }
 /**
  * Used to save the form config data
  * @param stdclass $data
  * @param bool $nolongerused
  */
 public function instance_config_save($data, $nolongerused = false)
 {
     global $DB;
     if (empty($data->activitygradeitemid)) {
         // Figure out info about parent module.
         $info = $this->get_owning_activity();
         $data->activitygradeitemid = $info->id;
         if ($info->id < 1) {
             // No activity was selected.
             $info->itemmodule = '';
             $info->iteminstance = '';
         } else {
             $data->activityparent = $info->itemmodule;
             $data->activityparentid = $info->iteminstance;
         }
     } else {
         // Lookup info about the parent module (we have the id from mdl_grade_items.
         $info = $DB->get_record('grade_items', array('id' => $data->activitygradeitemid));
         $data->activityparent = $info->itemmodule;
         $data->activityparentid = $info->iteminstance;
     }
     parent::instance_config_save($data);
 }
Example #10
0
 function instance_config_save($data, $nolongerused = false)
 {
     parent::instance_config_save($data);
 }
 function instance_config_save($data, $notused = false)
 {
     global $USER;
     // check if curent user forcing a filelocationadminoverride can really do it
     // in case it seems to be forced, set it to empty anyway.
     if (!has_capability('block/dashboard:systempathaccess', context_system::instance())) {
         $data->filepathadminoverride = '';
     }
     // retrieve sql params directly from POST
     $data->sqlparams = @$_POST['sqlparams'];
     // print_object($data);
     return parent::instance_config_save($data, $notused);
 }
 function instance_config_save($data, $nolongerused = false)
 {
     //append stuff to data - this is BAD
     //chapters
     $chapters = array();
     $lastIndex = 0;
     $total = 0;
     if ($data->chapEnable == 0) {
         $data->subChapEnable = 0;
     }
     $chapterNames = optional_param_array('chapterNames', array(), PARAM_RAW_TRIMMED);
     $childrenElementsNo = optional_param_array('chapterChildElementsNumber', array(), PARAM_INT);
     $chapterCounts = optional_param_array('chapterCounts', array(), PARAM_INT);
     $childElementTypes = optional_param_array('childElementTypes', array(), PARAM_ALPHANUMEXT);
     $childElementCounts = optional_param_array('childElementCounts', array(), PARAM_INT);
     $childElementNames = optional_param_array('childElementNames', array(), PARAM_RAW_TRIMMED);
     if ($this->page->course->id != SITEID) {
         //save chapters
         foreach ($chapterNames as $k => $name) {
             $chapter = array();
             $chapter['name'] = $name;
             $chapter['childElements'] = array();
             for ($i = $lastIndex; $i < $lastIndex + $childrenElementsNo[$k]; $i++) {
                 $child = array();
                 if ($data->chapEnable == 0) {
                     //only one subchapter
                     $child['type'] = "subchapter";
                     $child['count'] = count($this->get_sections());
                     $child['name'] = get_string("subchapter", "block_course_menu") . " 1-1";
                 } elseif ($data->subChapEnable == 0) {
                     $child['type'] = "subchapter";
                     $xx = $k + 1;
                     $child['name'] = get_string("subchapter", "block_course_menu") . " {$xx}-1";
                     $child['count'] = $chapterCounts[$k];
                 } else {
                     $child['type'] = $childElementTypes[$i];
                     if ($child['type'] == "subchapter") {
                         $child['count'] = $childElementCounts[$i];
                         $total += $child['count'];
                         $child['name'] = $childElementNames[$i];
                     }
                 }
                 $chapter['childElements'][] = $child;
             }
             $lastIndex = $i;
             $chapters[] = $chapter;
         }
     } else {
         $data->chapEnable = 0;
         $data->subChapEnable = 0;
         $data->subChaptersCount = 1;
         $data->chapters = array();
         $chapter = array();
         $chapter['name'] = get_string("chapter", "{$this->blockname}") . " 1";
         $child = array();
         $child['type'] = "subchapter";
         $child['name'] = get_string("subchapter", "{$this->blockname}") . " 1";
         $child['count'] = 0;
         $chapter['childElements'] = array($child);
         $chapters[] = $chapter;
     }
     $data->chapters = $chapters;
     // elements
     $data->elements = array();
     $ids = optional_param_array('ids', array(), PARAM_RAW_TRIMMED);
     $urls = optional_param_array('urls', array(), PARAM_RAW_TRIMMED);
     $icons = optional_param_array('icons', array(), PARAM_RAW_TRIMMED);
     $canHides = optional_param_array('canHides', array(), PARAM_INT);
     $visibles = optional_param_array('visibles', array(), PARAM_INT);
     foreach ($ids as $k => $id) {
         if (empty($id)) {
             continue;
         }
         if (strpos($id, 'link') !== false) {
             $index = str_replace('link', '', $id);
             $name = optional_param('cm_link_name' . $index, '', PARAM_RAW_TRIMMED);
             if (!$name) {
                 $name = get_string('link', 'block_course_menu');
             }
         } else {
             $name = $this->get_name($id);
         }
         $data->elements[] = $this->create_element($id, $name, $urls[$k], $icons[$k], $canHides[$k], $visibles[$k]);
     }
     //links
     $linkCounter = optional_param_array('linkCounter', array(), PARAM_INT);
     $data->links = array();
     foreach ($linkCounter as $k => $notimportant) {
         $url = optional_param('cm_link_url' . $k, '', PARAM_RAW_TRIMMED);
         //            if (empty($url)) { //no empty urls
         //                continue;
         //            }
         $link = array();
         $link['name'] = optional_param('cm_link_name' . $k, '', PARAM_RAW_TRIMMED);
         $link['target'] = optional_param('cm_link_target' . $k, '', PARAM_RAW_TRIMMED);
         $link['icon'] = optional_param('cm_link_icon' . $k, '', PARAM_RAW_TRIMMED);
         // url
         $link['url'] = $url;
         if (!preg_match('/http(s)?:\\/\\//i', $link['url'])) {
             $link['url'] = 'http://' . $link['url'];
         }
         // checkbox configs
         foreach ($this->get_link_checkboxes() as $field) {
             $idx = "cm_link_{$field}{$k}";
             $link[$field] = optional_param($idx, '', PARAM_RAW_TRIMMED) ? 1 : 0;
         }
         // defaultwidth + defaultheight
         $link['defaultwidth'] = optional_param('cm_link_defaultwidth' . $k, 0, PARAM_INT);
         $link['defaultheight'] = optional_param('cm_link_defaultheight' . $k, 0, PARAM_INT);
         $data->links[] = $link;
     }
     return parent::instance_config_save($data, $nolongerused);
 }
 /**
  * Serialize and store config data
  */
 function instance_config_save($data, $nolongerused = false)
 {
     global $USER, $COURSE;
     $config = new stdClass();
     foreach ($data as $fieldname => $fieldvalue) {
         if (is_array($fieldvalue)) {
             $config->{$fieldname} = array();
         } else {
             $config->{$fieldname} = $fieldvalue;
         }
     }
     $fileoptions = array('subdirs' => false, 'maxfiles' => 1, 'maxbytes' => $COURSE->maxbytes, 'accepted_types' => 'web_image', 'return_types' => FILE_INTERNAL);
     $saved = 0;
     for ($i = 0; $i < $data->slides; $i++) {
         $usercontext = context_user::instance($USER->id);
         $fs = get_file_storage();
         $draftfiles = $fs->get_area_files($usercontext->id, 'user', 'draft', $data->imageslide[$i], 'id');
         if (count($draftfiles) > 1 || isset($data->title[$i]) && !empty($data->title[$i]) || isset($data->caption[$i]) && !empty($data->caption[$i]) || isset($data->link[$i]) && !empty($data->link[$i])) {
             $config->enabled[$saved] = 0;
             if (isset($data->enabled[$i]) && !empty($data->enabled[$i])) {
                 $config->enabled[$saved] = $data->enabled[$i];
                 if ($data->firstslide >= $saved) {
                     $config->firstslide = $saved;
                 }
             }
             if (isset($data->imageslide[$i]) && !empty($data->imageslide[$i])) {
                 $config->imageslide[$saved] = $data->imageslide[$i];
                 file_save_draft_area_files($config->imageslide[$saved], $this->context->id, 'block_slideshow', 'slides', $saved, $fileoptions);
             }
             $config->imageposition[$saved] = isset($data->imageposition[$i]) && !empty($data->imageposition[$i]) ? $data->imageposition[$i] : '';
             $config->title[$saved] = isset($data->title[$i]) && !empty($data->title[$i]) ? $data->title[$i] : '';
             $config->caption[$saved] = isset($data->caption[$i]) && !empty($data->caption[$i]) ? $data->caption[$i] : '';
             $config->captionposition[$saved] = isset($data->captionposition[$i]) && !empty($data->captionposition[$i]) ? $data->captionposition[$i] : '';
             $config->link[$saved] = isset($data->link[$i]) && !empty($data->link[$i]) ? $data->link[$i] : '';
             $saved++;
         }
     }
     for ($i = $saved; $i < $data->slides; $i++) {
         file_save_draft_area_files($data->imageslide[$i], $this->context->id, 'block_slideshow', 'slides', $i, $fileoptions);
     }
     $config->slides = $saved;
     parent::instance_config_save($config, $nolongerused);
 }
 /**
  * the method overrides the standard instance_config_save()
  * it tries to apply selected settings to similar blocks
  * in other courses in which this user can edit blocks
  *
  * @param object $data contains the new config form data
  * @param boolean $pinned (optional, default=false)
  * @return xxx
  */
 function instance_config_save($data, $pinned = false)
 {
     global $COURSE, $DB, $USER;
     // do nothing if user hit the "cancel" button
     if (optional_param('cancel', 0, PARAM_INT)) {
         return true;
     }
     $name = 'showactivitygrades';
     $types = $name . 'types';
     switch (true) {
         case empty($data->{$name}):
             $data->{$name} = array();
             break;
         case $data->{$name} == 'all':
             $data->{$name} = array('all');
             break;
         case $data->{$name} == 'specific':
             if (empty($data->{$types})) {
                 $data->{$name} = array();
             } else {
                 $data->{$name} = $data->{$types};
             }
             break;
         default:
             $data->{$name} = array();
     }
     if (isset($data->{$types})) {
         unset($data->{$types});
     }
     $js = '';
     if (empty($data->showactivitygrades)) {
         $data->showactivitygrades = '';
     } else {
         $data->showactivitygrades = implode(',', $data->showactivitygrades);
         $js .= "<script type=\"text/javascript\">\n";
         $js .= "//<![CDATA[\n";
         $js .= "var src = location.href.replace(new RegExp('^(.*?)/course/view.php.*\$'), '\$1');\n";
         $js .= "src += '/mod/taskchain/courselinks.js.php?id=';\n";
         $js .= "src += location.href.replace(new RegExp('^.*?id=([0-9]+).*\$'), '\$1');\n";
         $js .= "src += '&rnd='+Math.ceil(10000*Math.random());\n";
         $js .= "src += '&showgrades=1';\n";
         $js .= "src += '&showaverages={$data->showaverages}';\n";
         $js .= "src += '&displayasblock=1';\n";
         $js .= "src += '&mods={$data->showactivitygrades}';\n";
         $js .= "document.writeln('<scr'+'ipt type=\"text/javascr'+'ipt\" src=\"'+src+'\"></scr'+'ipt>');\n";
         $js .= "//]]>\n";
         $js .= "</script>\n";
     }
     $modinfo = get_fast_modinfo($COURSE, $USER->id);
     $section = $this->get_section_info($modinfo, 0);
     $search = '/<script[^>]+>.*?<\\/script>[\\n\\r]*/s';
     $summary = preg_replace($search, '', $section->summary);
     $summary .= $js;
     if ($summary != $section->summary) {
         $DB->set_field('course_sections', 'summary', $summary, array('id' => $section->id));
         rebuild_course_cache($COURSE->id, true);
     }
     if ($data->singlesection) {
         if (function_exists('course_get_format')) {
             // Moodle >= 2.3
             $update = false;
             if ($options = course_get_format($COURSE)->get_format_options()) {
                 if (empty($options['coursedisplay'])) {
                     $update = true;
                     $options['coursedisplay'] = 1;
                     // COURSE_DISPLAY_MULTIPAGE;
                 }
                 if (empty($options['hiddensections'])) {
                     $update = true;
                     $options['hiddensections'] = 1;
                     // completely invisible
                 }
             }
             if ($update) {
                 course_get_format($COURSE)->update_course_format_options($options);
             }
         }
     }
     // expand "select_sectiontextlength", if required
     if (isset($data->select_sectiontextlength)) {
         $configs = array('name', 'head', 'tail');
         $langs = get_string_manager()->get_list_of_translations();
         $langs = array_keys($langs);
         array_unshift($langs, '');
         foreach ($langs as $lang) {
             $lang = substr($lang, 0, 2);
             foreach ($configs as $config) {
                 $selectname = 'select_' . $config . 'length' . $lang;
                 $data->{$selectname} = $data->select_sectiontextlength;
             }
         }
         unset($data->select_sectiontextlength);
     }
     $selected = array();
     $contextids = array();
     $vars = get_object_vars($data);
     foreach ($vars as $name => $value) {
         if ($name == 'mycourses') {
             $contextids = $value;
             unset($data->{$name});
             continue;
             // field is special
         }
         $selectname = 'select_' . $name;
         if (empty($_POST[$selectname])) {
             continue;
             // field not selected
         }
         $selected[$name] = $value;
     }
     unset($vars, $name, $value);
     // get contextids of courses (excluding this one) in which user can edit blocks
     if ($contextids = implode(',', $contextids)) {
         // get TaskChain navigation blocks in selected courses
         $select = "blockname = ? AND pagetypepattern = ? AND parentcontextid IN ({$contextids})";
         $params = array($this->instance->blockname, 'course-view-*');
         if ($instances = $DB->get_records_select('block_instances', $select, $params)) {
             // user requires this capbility to update blocks
             $capability = 'block/taskchain_navigation:addinstance';
             // update values in the selected block instances
             foreach ($instances as $instance) {
                 if (class_exists('context')) {
                     $context = context::instance_by_id($instance->parentcontextid);
                 } else {
                     $context = get_context_instance_by_id($instance->parentcontextid);
                 }
                 if (has_capability($capability, $context)) {
                     $instance->config = unserialize(base64_decode($instance->configdata));
                     if (empty($instance->config)) {
                         $instance->config = new stdClass();
                     }
                     foreach ($selected as $name => $value) {
                         $instance->config->{$name} = $value;
                     }
                     $instance->configdata = base64_encode(serialize($instance->config));
                     $DB->set_field('block_instances', 'configdata', $instance->configdata, array('id' => $instance->id));
                 }
             }
         }
     }
     //  save config settings as usual
     return parent::instance_config_save($data, $pinned);
 }
Example #15
0
 function instance_config_save($data, $pinned = false, $updaterafl = true)
 {
     global $CFG;
     // if in rafl mode then attempt to update the rafl tables
     if ($CFG->raflmodeenabled && $updaterafl) {
         $course = get_record('course', 'id', $this->instance->pageid);
         if ($course->learning_path_mode == LEARNING_PATH_MODE_RAFL) {
             // look up raflitem id
             if ($pageitem = get_record('format_page_items', 'blockinstance', $this->instance->id)) {
                 require_once $CFG->dirroot . '/mod/rafl/locallib.php';
                 $rafl = new localLibRafl();
                 $rafl->update_share_item($course->id, $pageitem->rafl_item, $data->text);
             } else {
                 error_log('no matching rafl item could be found');
             }
         }
     }
     // And now forward to the default implementation defined in the parent class
     return parent::instance_config_save($data);
 }
 function instance_config_save($data, $nolongerused = false)
 {
     //append stuff to data - this is BAD
     //chapters
     $chapters = array();
     $lastIndex = 0;
     $total = 0;
     if ($data->chapEnable == 0) {
         $data->subChapEnable = 0;
     }
     if ($this->page->course->id != SITEID) {
         //save chapters
         foreach ($_POST['chapterNames'] as $k => $name) {
             $chapter = array();
             $chapter['name'] = $name;
             $chapter['childElements'] = array();
             for ($i = $lastIndex; $i < $lastIndex + $_POST['chapterChildElementsNumber'][$k]; $i++) {
                 $child = array();
                 if ($data->chapEnable == 0) {
                     //only one subchapter
                     $child['type'] = "subchapter";
                     $child['count'] = count($this->get_sections());
                     $child['name'] = get_string("subchapter", "block_course_menu") . " 1-1";
                 } elseif ($data->subChapEnable == 0) {
                     $child['type'] = "subchapter";
                     $xx = $k + 1;
                     $child['name'] = get_string("subchapter", "block_course_menu") . " {$xx}-1";
                     $child['count'] = $_POST['chapterCounts'][$k];
                 } else {
                     $child['type'] = $_POST['childElementTypes'][$i];
                     if ($child['type'] == "subchapter") {
                         $child['count'] = $_POST['childElementCounts'][$i];
                         $total += $child['count'];
                         $child['name'] = $_POST['childElementNames'][$i];
                     }
                 }
                 $chapter['childElements'][] = $child;
             }
             $lastIndex = $i;
             $chapters[] = $chapter;
         }
     }
     $data->chapters = $chapters;
     // elements
     $data->elements = array();
     foreach ($_POST['ids'] as $k => $id) {
         $url = $_POST['urls'][$k];
         $icon = $_POST['icons'][$k];
         $canHide = $_POST['canHides'][$k];
         $visible = $_POST['visibles'][$k];
         $name = $this->get_name($id);
         $data->elements[] = $this->create_element($id, $name, $url, $icon, $canHide, $visible);
     }
     //links
     $data->links = array();
     if (isset($_POST['linkNames'])) {
         // means: if instance config. we don't have links in global config
         foreach ($_POST['linkNames'] as $k => $name) {
             $link = array();
             $link['name'] = $name;
             $link['target'] = $_POST['linkTargets'][$k];
             $link['icon'] = $_POST['linkIcons'][$k];
             // url
             $link['url'] = $_POST['linkUrls'][$k];
             if (strpos($_POST['linkUrls'][$k], "://") === false) {
                 // if no protocol then add "http://" - [CM-TD2]
                 $link['url'] = "http://" . $link['url'];
             }
             // checkbox configs
             $idx = "keeppagenavigation{$k}";
             $link['keeppagenavigation'] = isset($_POST[$idx]) && $_POST[$idx] == "on" ? 1 : 0;
             $idx = "allowresize{$k}";
             $link['allowresize'] = isset($_POST[$idx]) && $_POST[$idx] == "on" ? 1 : 0;
             $idx = "allowresize{$k}";
             $link['allowresize'] = isset($_POST[$idx]) && $_POST[$idx] == "on" ? 1 : 0;
             $idx = "allowresize{$k}";
             $link['allowresize'] = isset($_POST[$idx]) && $_POST[$idx] == "on" ? 1 : 0;
             $idx = "allowscroll{$k}";
             $link['allowscroll'] = isset($_POST[$idx]) && $_POST[$idx] == "on" ? 1 : 0;
             $idx = "showdirectorylinks{$k}";
             $link['showdirectorylinks'] = isset($_POST[$idx]) && $_POST[$idx] == "on" ? 1 : 0;
             $idx = "showlocationbar{$k}";
             $link['showlocationbar'] = isset($_POST[$idx]) && $_POST[$idx] == "on" ? 1 : 0;
             $idx = "showmenubar{$k}";
             $link['showmenubar'] = isset($_POST[$idx]) && $_POST[$idx] == "on" ? 1 : 0;
             $idx = "showtoolbar{$k}";
             $link['showtoolbar'] = isset($_POST[$idx]) && $_POST[$idx] == "on" ? 1 : 0;
             $idx = "showstatusbar{$k}";
             $link['showstatusbar'] = isset($_POST[$idx]) && $_POST[$idx] == "on" ? 1 : 0;
             // defaultwidth + defaultheight
             $link['defaultwidth'] = !empty($_POST['defaultwidth'][$k]) ? $_POST['defaultwidth'][$k] : 0;
             $link['defaultheight'] = !empty($_POST['defaultheight'][$k]) ? $_POST['defaultheight'][$k] : 0;
             $data->links[] = $link;
         }
     }
     return parent::instance_config_save($data, $nolongerused);
 }
 public function instance_config_save($data, $nolongerused = false)
 {
     /* 		if (empty($data->courseid)) {
          $data->courseid = $this->get_owning_course();
          } */
     parent::instance_config_save($data);
 }
 /**
  * Serialize and store config data
  */
 function instance_config_save($data, $nolongerused = false)
 {
     global $COURSE;
     $config = clone $data;
     $fileoptions = array('subdirs' => false, 'maxfiles' => 1, 'maxbytes' => $COURSE->maxbytes, 'accepted_types' => 'web_image', 'return_types' => FILE_INTERNAL);
     file_save_draft_area_files($config->imagespot, $this->context->id, 'block_informationspot', 'image', 0, $fileoptions);
     parent::instance_config_save($config, $nolongerused);
 }
 /**
  * Serialize and store config data
  */
 function instance_config_save($data, $nolongerused = false) {
     global $DB;
     $config = clone($data);
     parent::instance_config_save($config, $nolongerused);
 }
 /**
  * Serialize and store config data
  */
 function instance_config_save($data, $nolongerused = false)
 {
     global $DB, $COURSE;
     $config = clone $data;
     // Move embedded files into a proper filearea and adjust HTML links to match
     $config->text_all = file_save_draft_area_files($data->text_all['itemid'], $this->context->id, 'block_groupspecificthtml', 'content', 0, array('subdirs' => true), $data->text_all['text']);
     $config->format_all = $data->text_all['format'];
     $config->text_0 = file_save_draft_area_files($data->text_all['itemid'], $this->context->id, 'block_groupspecificthtml', 'content', 0, array('subdirs' => true), $data->text_0['text']);
     $config->format_0 = $data->text_0['format'];
     $groups = groups_get_all_groups($COURSE->id);
     if (!empty($groups)) {
         foreach ($groups as $g) {
             $textkey = 'text_' . $g->id;
             $formatkey = 'format_' . $g->id;
             $config->{$textkey} = file_save_draft_area_files($data->{$textkey}['itemid'], $this->context->id, 'block_groupspecificthtml', 'content', 0, array('subdirs' => true), $data->{$textkey}['text']);
             $config->{$formatkey} = $data->{$textkey}['format'];
         }
     }
     parent::instance_config_save($config, $nolongerused);
 }