Performs the reset of this workshop instance.

@param stdClass $data The actual course reset settings.
@return array List of results, each being array[(string)component, (string)item, (string)error]
497628
public function reset_userdata(stdClass $data) {

        $componentstr = get_string('pluginname', 'workshop').': '.format_string($this->name);
        $status = array();

        if (!empty($data->reset_workshop_assessments) or !empty($data->reset_workshop_submissions)) {
            // Reset all data related to assessments, including assessments of
            // example submissions.
            $result = $this->reset_userdata_assessments($data);
            if ($result === true) {
                $status[] = array(
                    'component' => $componentstr,
                    'item' => get_string('resetassessments', 'mod_workshop'),
                    'error' => false,
                );
            } else {
                $status[] = array(
                    'component' => $componentstr,
                    'item' => get_string('resetassessments', 'mod_workshop'),
                    'error' => $result,
                );
            }
        }

        if (!empty($data->reset_workshop_submissions)) {
            // Reset all remaining data related to submissions.
            $result = $this->reset_userdata_submissions($data);
            if ($result === true) {
                $status[] = array(
                    'component' => $componentstr,
                    'item' => get_string('resetsubmissions', 'mod_workshop'),
                    'error' => false,
                );
            } else {
                $status[] = array(
                    'component' => $componentstr,
                    'item' => get_string('resetsubmissions', 'mod_workshop'),
                    'error' => $result,
                );
            }
        }

        if (!empty($data->reset_workshop_phase)) {
            // Do not use the {@link workshop::switch_phase()} here, we do not
            // want to trigger events.
            $this->reset_phase();
            $status[] = array(
                'component' => $componentstr,
                'item' => get_string('resetsubmissions', 'mod_workshop'),
                'error' => false,
            );
        }

        return $status;
    }
865168
public function reset($data = [], $labels = [])
    {
        $this->_attributes = $data;
        $this->_labels = $labels;
        $this->_errors = [];
        $this->_validations = [];
        return $this;
    }
465164
protected static function convert_fields(\stdClass $data) {
        $data = parent::convert_fields($data);

        if (!empty($data->lawfulbases) && is_array($data->lawfulbases)) {
            $data->lawfulbases = implode(',', $data->lawfulbases);
        }
        if (!empty($data->sensitivedatareasons) && is_array($data->sensitivedatareasons)) {
            $data->sensitivedatareasons = implode(',', $data->sensitivedatareasons);
        }

        // A single value.
        $data->retentionperiod = 'P' . $data->retentionperiodnumber . $data->retentionperiodunit;
        unset($data->retentionperiodnumber);
        unset($data->retentionperiodunit);

        return $data;
    }
83608
public function takeData($data)
    {
        $keyColumn = $this->getKeyColumn();
        if (array_key_exists($keyColumn, $data) && is_array($data[$keyColumn])) {
            foreach ($data[$keyColumn] as $recPos => $recordKey) {
                if (substr($recordKey, 0, 4) == 'ext:') {
                    $data['external-ids'][] = $recordKey;
                    unset($data[$keyColumn][$recPos]);
                }
            }
            if (count($data[$keyColumn]) == 1) {
                $data[$keyColumn] = current($data[$keyColumn]);
            }
        }
        $result = parent::takeData($data);

        if (array_key_exists($keyColumn, $data) || array_key_exists('kod', $data)) {
            $this->updateApiURL();
        }

        return $result;
    }
1165428
public function set_data($data) {
        $purpose = $this->get_persistent();

        $count = 0;
        foreach ($this->existingoverrides as $override) {
            $overridedata = $this->convert_existing_data_to_values($override->to_record());
            foreach ($overridedata as $key => $value) {
                $keyname = "roleoverride_{$key}[{$count}]";
                $data->$keyname = $value;
            }
            $count++;
        }

        parent::set_data($data);
    }
1306941
public function populate(array $data) : Form
    {
        $this->resetErrors();

        foreach ($this->components as $name => $component) {
            $value = isset($data[$name]) ? $data[$name] : null;
            $component->populate($value);
        }

        return $this;
    }
620944
public function resetPassword(array $data)
    {
        $result = array();
        $this->hook->attach('user.reset.password.before', $data, $result, $this);

        if (!empty($result)) {
            return (array) $result;
        }

        if (empty($data['user']['user_id'])) {
            return $this->getResultError();
        }

        if (isset($data['password'])) {
            $result = $this->resetPasswordFinish($data);
        } else {
            $result = $this->resetPasswordStart($data);
        }

        $this->session->regenerate(true);
        $this->hook->attach('user.reset.password.after', $data, $result, $this);
        return (array) $result;
    }
959248
protected function cleanData($data)
    {
        $originalFields = $this->getFields();
        $uniqueId       = $this->getUniqueId();
        $fields         = array_merge(
            $originalFields,
            array($uniqueId));

        // clean data from data item
        foreach ($data as $fieldName => $value) {
            if (array_search($fieldName, $fields) === false) {
                unset($data[ $fieldName ]);
            }
        }

        if (isset($data[ $uniqueId ]) && empty($data[ $uniqueId ])) {
            unset($data[ $uniqueId ]);
        }

        return $data;
    }
160563
public static function course_reset_ended($event) {
        if (!empty(self::$resetinprogress)) {
            if (!empty($event->other['reset_options']['reset_groups_remove'])) {
                quiz_process_group_deleted_in_course($event->courseid);
            }
            if (!empty($event->other['reset_options']['reset_groups_members'])) {
                quiz_update_open_attempts(array('courseid' => $event->courseid));
            }
        }

        self::$resetinprogress = null;
    }
674571
public function reset( array $names = array() )
    {
        if( array() == $names )
        {
            // Unset new instance to force reset
            $this->new_instance = array();
            return $this->update();
        }
        else
        {
            foreach( $this->components as $c )
            {
                if( in_array($c->get_name(), $names) )
                {
                    $this->new_instance[$c->get_name()] = $c->get_default_value();
                }
            }
            return $this->update();
        }
    }
1272860
public function get_role_overrides_from_data(\stdClass $data) {
        $overrides = [];
        if (!empty($data->overrides)) {
            $searchkey = 'roleoverride_';

            for ($i = 0; $i < $data->overrides; $i++) {
                $overridedata = (object) [];
                foreach ((array) $data as $fieldname => $value) {
                    if (strpos($fieldname, $searchkey) !== 0) {
                        continue;
                    }

                    $overridefieldname = substr($fieldname, strlen($searchkey));
                    $overridedata->$overridefieldname = $value[$i];
                }

                if (empty($overridedata->roleid) || empty($overridedata->retentionperiodnumber)) {
                    // Skip this one.
                    // There is no value and it will be delete.
                    continue;
                }

                $override = static::convert_fields($overridedata);

                $overrides[$i] = $override;
            }
        }

        return $overrides;
    }
300268
protected function transformAll(stdClass $data)
    {
        $name = $this->getFirstPropertyName($data);

        return array_map(function ($data) use ($name) {
            return $this->transform($data, $name);
        }, $this->getFirstProperty($data));
    }
1104874
public function process_course_competency_settings($data) {
        global $DB;
        $data = (object) $data;

        // We do not restore the course settings during merge.
        $target = $this->get_task()->get_target();
        if ($target == backup::TARGET_CURRENT_ADDING || $target == backup::TARGET_EXISTING_ADDING) {
            return;
        }

        $courseid = $this->task->get_courseid();
        $exists = \core_competency\course_competency_settings::record_exists_select('courseid = :courseid',
            array('courseid' => $courseid));

        // Strangely the course settings already exist, let's just leave them as is then.
        if ($exists) {
            $this->log('Course competency settings not restored, existing settings have been found.', backup::LOG_WARNING);
            return;
        }

        $data = (object) array('courseid' => $courseid, 'pushratingstouserplans' => $data->pushratingstouserplans);
        $settings = new \core_competency\course_competency_settings(0, $data);
        $settings->create();
    }
784277
public static function assign( $data ) 
	{
		// return null if we have no data
		if ( $data === null || empty( $data ) ) 
		{
			return null;
		}

		// do we have a collection or a single result?
		if ( CCArr::is_collection( $data ) ) 
		{
			$return = array();

			foreach( $data as $key => $item ) 
			{
				$return[$key] = static::create( $item );
			}
			return $return;
		}

		return static::create( $data );
	}
1027031
public function remove($data)
    {
        if (is_array($data)) {
            foreach ($data as $entity) {
                $this
                    ->manager
                    ->remove($entity);
            }
        } else {
            $this
                ->manager
                ->remove($data);
        }

        $this
            ->manager
            ->flush($data);

        return $data;
    }
110478
public function reset()
    {
        $this->_headers->clearHeaders();
        $this->params = [];
        $this->postRawData = null;
        $this->httpClient->reset();
        return $this;
    }
1044797
private function reset() {
      $this->select  = " SELECT * ";
      $this->from    = " FROM _table_ ";
      $this->join    = " ";
      $this->on      = " ";
      $this->where   = " ";
      $this->groupBy = " ";
      $this->having  = " ";
      $this->orderBy = " ";
      $this->limit   = " ";
      $this->offset  = " ";
      $this->union   = " ";
      $this->case    = "";
      $this->when    = "";
      $this->else    = "";
      $this->rows    = [] ;
      $this->placeholder_data = [] ;
      $_ENV["daniia_daniia"]  = null;

      $this->get_instance();
      return $this;
   }