/** * Save a setting * * @param string $data * @return string empty of error string */ public function write_setting($data) { $validated = $this->validate($data); if ($validated !== true) { return $validated; } return parent::write_setting($data); }
/** * Saves the new settings passed in $data * * @todo Add vartype handling to ensure $data is an array * @param array $data * @return mixed string or Array */ public function write_setting($data) { $error = parent::write_setting($data['value']); if (!$error) { $value = empty($data['adv']) ? 0 : 1; $this->config_write($this->name . '_adv', $value); } return $error; }
/** * Updates the database and save the setting * * @param string data * @return string empty or error message */ public function write_setting($data) { global $DB, $CFG; if ($data == 0) { $blogblocks = $DB->get_records_select('block', "name LIKE 'blog_%' AND visible = 1"); foreach ($blogblocks as $block) { $DB->set_field('block', 'visible', 0, array('id' => $block->id)); } } else { // reenable all blocks only when switching from disabled blogs if (isset($CFG->bloglevel) and $CFG->bloglevel == 0) { $blogblocks = $DB->get_records_select('block', "name LIKE 'blog_%' AND visible = 0"); foreach ($blogblocks as $block) { $DB->set_field('block', 'visible', 1, array('id' => $block->id)); } } } return parent::write_setting($data); }
/** * Saves the new setting. * * @param mixed $data * @return string empty string or error message */ function write_setting($data) { global $CFG; $previous = $this->get_setting(); $result = parent::write_setting($data); // If saved and the value has changed. if (empty($result) && $previous != $data) { require_once $CFG->libdir . '/gradelib.php'; grade_force_site_regrading(); } return $result; }
/** * Save the selected setting * * @param string $data The selected site * @return string empty string or error message */ public function write_setting($data) { global $CFG; set_marsupial_state($data); return parent::write_setting($data); }
function write_setting($data) { global $CFG; // do not change active CFG setting! $current = $CFG->{$this->name}; $result = parent::write_setting($data); $CFG->{$this->name} = $current; return $result; }
public function write_setting($data) { $error = parent::write_setting($data['value']); if (!$error) { if (empty($data['fix'])) { $ok = $this->config_write('fix_' . $this->name, 0); } else { $ok = $this->config_write('fix_' . $this->name, 1); } if (!$ok) { $error = get_string('errorsetting', 'admin'); } } return $error; }