Updates course module name

@param int $itemid course module id
@param string $newvalue new name
@return static
502630
public static function update($itemid, $newvalue) {
        $context = context_module::instance($itemid);
        // Check access.
        \external_api::validate_context($context);
        require_capability('moodle/course:manageactivities', $context);
        // Update value.
        set_coursemodule_name($itemid, $newvalue);
        $coursemodulerecord = get_coursemodule_from_id('', $itemid, 0, false, MUST_EXIST);
        // Return instance.
        $cm = get_fast_modinfo($coursemodulerecord->course)->get_cm($itemid);
        return new static($cm, true);
    }
657825
protected function StockWasUpdatedHook($dOldValue, $dNewValue)
    {
        $bReturn = parent::StockWasUpdatedHook($dOldValue, $dNewValue);
        if ($dOldValue < 1 && $dNewValue > 0) {
            $oShopArticlePreorderList = &TdbPkgShopArticlePreorderList::GetListForShopArticleId($this->id);
            while ($oShopArticlePreorder = $oShopArticlePreorderList->Next()) {
                $oShopArticlePreorder->SendMail();
            }
        }

        return $bReturn;
    }
199746
public function addItem(
        $itemData,
        $locale,
        $userId,
        OrderEntity $order,
        ItemInterface $lastProcessedProductItem = null
    ) {
        $item = $this->itemManager->save(
            $itemData,
            $locale,
            $userId,
            null,
            null,
            $order->getCustomerContact(),
            $lastProcessedProductItem
        );

        $order->addItem($item->getEntity());

        return $item;
    }
670753
public function setCatalogItemId(int $nb_catalog_item_id) : CNabuDataObject
    {
        if ($nb_catalog_item_id === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$nb_catalog_item_id")
            );
        }
        $this->setValue('nb_catalog_item_id', $nb_catalog_item_id);
        
        return $this;
    }
560541
public boolean isValueUpdate(Long configId, String newValue) {

        //
        // 判断值有没有更新
        //
        String oldValue = configMgr.getValue(configId);

        if (newValue.equals(oldValue)) {
            return false;
        }
        return true;
    }
873688
public function updateItem($itemId, $data, $user = null, $locale = null)
    {
        $cart = $this->getUserCart($user, $locale);
        $userId = $user ? $user->getId() : null;

        $this->validateOrCreateAddresses($cart, $user);

        $item = $this->orderManager->getOrderItemById($itemId, $cart->getEntity());

        $this->orderManager->updateItem($item, $data, $locale, $userId);

        $this->removeOrderAddressIfContactAddressIdIsEqualTo(
            $item,
            $cart->getDeliveryAddress()->getContactAddress()->getId()
        );

        $this->orderManager->updateApiEntity($cart, $locale);

        return $cart;
    }
1166841
public static function load($lessonid) {
        global $DB;

        if (!$lesson = $DB->get_record('lesson', array('id' => $lessonid))) {
            print_error('invalidcoursemodule');
        }
        return new lesson($lesson);
    }
31616
public static function fromString($itemValue)
    {
        $bits = preg_split(
            '/\s*(?:;*("[^"]+");*|;*(\'[^\']+\');*|;+)\s*/',
            $itemValue,
            0,
            PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
        );
        $value = array_shift($bits);
        $attributes = array();

        $lastNullAttribute = null;
        foreach ($bits as $bit) {
            if (($start = substr($bit, 0, 1)) === ($end = substr($bit, -1)) &&
                ('"' === $start || '\'' === $start)) {
                $attributes[$lastNullAttribute] = substr($bit, 1, -1);
            } elseif ('=' === $end) {
                $lastNullAttribute = $bit = substr($bit, 0, -1);
                $attributes[$bit] = null;
            } else {
                $parts = explode('=', $bit);
                $attributes[$parts[0]] = isset($parts[1]) && strlen($parts[1]) > 0 ? $parts[1] : '';
            }
        }

        return new self(($start = substr($value, 0, 1)) === ($end = substr($value, -1)) &&
        ('"' === $start || '\'' === $start) ? substr($value, 1, -1) : $value, $attributes);
    }
32823
public function getNewValue(int $maxValue, int $changeValue, string $progressType)
    {
        switch ($progressType) {
            case AchievementCriteriaChange::PROGRESS_SET:
                $newValue = $changeValue;
                break;
            case AchievementCriteriaChange::PROGRESS_ACCUMULATE:
                $newValue = $this->value + $changeValue;

                if ($maxValue > 0) {
                    $newValue = $maxValue - $this->value > $changeValue ? $this->value + $changeValue : $maxValue;
                }
                break;
            case AchievementCriteriaChange::PROGRESS_HIGHEST:
                $newValue = $this->value < $changeValue ? $changeValue : $this->value;
                break;
            default:
                throw new \InvalidArgumentException('Given progress type is invalid ('.$progressType.').');
        }

        return $newValue;
    }
299065
public function fill($newValue): self
    {
        foreach ($this->values as $index => $value) {
            $this->values[$index] = $newValue;
        }

        return $this;
    }
498840
function (subpath, newValue) {
    var args = Util.resolveArgs(arguments, '?subpath', 'newValue');
    update(this, args.subpath, Util.constantly(args.newValue));
    return this;
  }
214316
public function getItem($itemId, $data = null)
	{
		$params = $this->setUpParams('item', $itemId, $data, 'itemListData', 'itemData');
		$array  = $this->makeRequest('item', $itemId, $params);

		if ($this->appendId($itemId))
		{
			return new staticItem($array);
		}
		else
		{
			return new ItemList($array);
		}
	}
1134181
protected function fillItem(Item $item, Item $new_item, $field)
    {
        switch ($field) {
            case self::FIELD_COUNTRY:
                $item->setCountry($new_item->getCountry());
                break;
            case self::FIELD_DATE_END:
                $item->setDateEnd($new_item->getDateEnd());
                break;
            case self::FIELD_DATE_PREMIERE:
                $item->setDatePremiere($new_item->getDatePremiere());
                break;
            case self::FIELD_DURATION:
                $item->setDuration($new_item->getDuration());
                break;
            case self::FIELD_EPISODES:
                $item->setEpisodes($new_item->getEpisodes());
                break;
            case self::FIELD_EPISODES_NUMBER:
                $item->setEpisodesNumber($new_item->getEpisodesNumber());
                break;
            case self::FIELD_FILE_INFO:
                $item->setFileInfo($new_item->getFileInfo());
                break;
            case self::FIELD_GENRES:
                /* @var $new_genre \AnimeDb\Bundle\CatalogBundle\Entity\Genre */
                foreach ($new_item->getGenres() as $new_genre) {
                    $item->addGenre($new_genre);
                }
                break;
            case self::FIELD_NAMES:
                // set main name in top of names list
                $new_names = $new_item->getNames()->toArray();
                array_unshift($new_names, (new Name())->setName($new_item->getName()));
                foreach ($new_names as $new_name) {
                    $item->addName($new_name);
                }
                break;
            case self::FIELD_SOURCES:
                foreach ($new_item->getSources() as $new_source) {
                    $item->addSource($new_source);
                }
                break;
            case self::FIELD_STUDIO:
                $item->setStudio($new_item->getStudio());
                break;
            case self::FIELD_SUMMARY:
                $item->setSummary($new_item->getSummary());
                break;
        }

        return $item;
    }
1211916
public static function update($cohortid, $newvalue) {
        global $DB;
        $cohort = $DB->get_record('cohort', array('id' => $cohortid), '*', MUST_EXIST);
        $cohortcontext = \context::instance_by_id($cohort->contextid);
        \external_api::validate_context($cohortcontext);
        require_capability('moodle/cohort:manage', $cohortcontext);
        $record = (object)array('id' => $cohort->id, 'idnumber' => $newvalue, 'contextid' => $cohort->contextid);
        cohort_update_cohort($record);
        $cohort->idnumber = $newvalue;
        return new static($cohort);
    }
1082230
public static function update($itemid, $newvalue) {
        global $DB;
        require_capability('moodle/tag:manage', context_system::instance());
        $tagcoll = $DB->get_record('tag_coll', array('id' => $itemid), '*', MUST_EXIST);
        \core_tag_collection::update($tagcoll, array('name' => $newvalue));
        return new self($tagcoll);
    }
713384
public function addItemToReplacementData( $itemId )
    {
        if ( !isset( $this->replacementData[$itemId] ) )
        {
            $this->replacementData[$itemId] = 0;
        }
        ++$this->replacementData[$itemId];
    }
742042
function (propertyName, newValue) {
            if (!this._cfg) {
                return;
            }
            if (propertyName === "items" && this._cfg.bind.hasOwnProperty(propertyName)) {
                var oldValue = this.getProperty(propertyName);
                this._cfg[propertyName] = newValue;
                this._onBoundPropertyChange(propertyName, newValue, oldValue);
            } else {
                this.$TemplateBasedWidget.setWidgetProperty.apply(this, arguments);
            }
        }