Reload the news categories widget.

@param DataContainer $dc
557696
private function reloadNewsCategoriesWidget(DataContainer $dc)
    {
        /**
         * @var Database
         * @var Input    $input
         */
        $db = $this->framework->createInstance(Database::class);
        $input = $this->framework->getAdapter(Input::class);

        $id = $input->get('id');
        $field = $dc->inputName = $input->post('name');

        // Handle the keys in "edit multiple" mode
        if ('editAll' === $input->get('act')) {
            $id = \preg_replace('/.*_([0-9a-zA-Z]+)$/', '$1', $field);
            $field = \preg_replace('/(.*)_[0-9a-zA-Z]+$/', '$1', $field);
        }

        $dc->field = $field;

        // The field does not exist
        if (!isset($GLOBALS['TL_DCA'][$dc->table]['fields'][$field])) {
            $this->logger->log(
                LogLevel::ERROR,
                \sprintf('Field "%s" does not exist in DCA "%s"', $field, $dc->table),
                ['contao' => new ContaoContext(__METHOD__, TL_ERROR)]
            );

            throw new BadRequestHttpException('Bad request');
        }

        $row = null;
        $value = null;

        // Load the value
        if ('overrideAll' !== $input->get('act') && $id > 0 && $db->tableExists($dc->table)) {
            $row = $db->prepare('SELECT * FROM '.$dc->table.' WHERE id=?')->execute($id);

            // The record does not exist
            if ($row->numRows < 1) {
                $this->logger->log(
                    LogLevel::ERROR,
                    \sprintf('A record with the ID "%s" does not exist in table "%s"', $id, $dc->table),
                    ['contao' => new ContaoContext(__METHOD__, TL_ERROR)]
                );

                throw new BadRequestHttpException('Bad request');
            }

            $value = $row->$field;
            $dc->activeRecord = $row;
        }

        // Call the load_callback
        if (\is_array($GLOBALS['TL_DCA'][$dc->table]['fields'][$field]['load_callback'])) {
            /** @var System $systemAdapter */
            $systemAdapter = $this->framework->getAdapter(System::class);

            foreach ($GLOBALS['TL_DCA'][$dc->table]['fields'][$field]['load_callback'] as $callback) {
                if (\is_array($callback)) {
                    $value = $systemAdapter->importStatic($callback[0])->{$callback[1]}($value, $dc);
                } elseif (\is_callable($callback)) {
                    $value = $callback($value, $dc);
                }
            }
        }

        // Set the new value
        $value = $input->post('value', true);

        // Convert the selected values
        if ($value) {
            /** @var StringUtil $stringUtilAdapter */
            $stringUtilAdapter = $this->framework->getAdapter(StringUtil::class);
            $value = $stringUtilAdapter->trimsplit("\t", $value);
            $value = \serialize($value);
        }

        /** @var NewsCategoriesPickerWidget $strClass */
        $strClass = $GLOBALS['BE_FFL']['newsCategoriesPicker'];

        /** @var NewsCategoriesPickerWidget $objWidget */
        $objWidget = new $strClass($strClass::getAttributesFromDca($GLOBALS['TL_DCA'][$dc->table]['fields'][$field], $dc->inputName, $value, $field, $dc->table, $dc));

        throw new ResponseException(new Response($objWidget->generate()));
    }
90998
public function editModule(DataContainer $dc)
    {
        return ($dc->value < 1) ? '' : ' <a href="contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $dc->value . '&amp;popup=1&amp;nb=1&amp;rt=' . REQUEST_TOKEN . '" title="' . sprintf(StringUtil::specialchars($GLOBALS['TL_LANG']['tl_content']['editalias'][1]), $dc->value) . '" onclick="Backend.openModalIframe({\'title\':\'' . StringUtil::specialchars(str_replace("'", "\\'", sprintf($GLOBALS['TL_LANG']['tl_content']['editalias'][1], $dc->value))) . '\',\'url\':this.href});return false">' . Image::getHtml('alias.svg', $GLOBALS['TL_LANG']['tl_content']['editalias'][0]) . '</a>';
    }
134443
public static function update_category(stdClass $record) {
        $category = new category($record->id);
        $category->from_record($record);

        $result = $category->update();

        return $category;
    }
1204196
public function showAlreadyUsedHint($dc)
	{
		if ($GLOBALS['_POST'] || \Input::get('act') != 'edit')
		{
			return;
		}

		// Return if the user cannot access the layout module (see #6190)
		if (!$this->User->hasAccess('themes', 'modules') || !$this->User->hasAccess('layout', 'themes'))
		{
			return;
		}

		// Check if the content block is in use
		$objPattern = \PatternModel::findById($dc->id);
		
		while ($objPattern->ptable != 'tl_elements')
		{
			$objPattern = \PatternModel::findById($objPattern->pid);
		}
		
		$objElement = \ElementsModel::findById($objPattern->pid);
		
		if (\ContentModel::countBy('type', $objElement->alias) > 0)
		{
			\Message::addInfo($GLOBALS['TL_LANG']['MSC']['elementInUse']);
		}
	}
269843
public function deleteMemberWishEntries(\DataContainer $dc) {
		if ($dc->activeRecord) {
			$db = \Database::getInstance();
			//SmS Course Choice
			$db->prepare("DELETE FROM tl_sms_course_choice WHERE id = ?")->execute($dc->activeRecord->id);
			//SmS Exchange
			$db->prepare("DELETE FROM tl_sms_exchange WHERE student = ?")->execute($dc->activeRecord->id);
			//TdW Choice
			$db->prepare("DELETE FROM tl_tdwChoices WHERE student = ?")->execute($dc->activeRecord->id);
		}
	}
1155503
private function getManagerFromDca(DataContainer $dc): ManagerInterface
    {
        return $this->registry->get($GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['eval']['tagsManager']);
    }
1083831
protected function updateCategories(Collection $data)
	{
		$ids = explode(',', $this->preferences['product_categories']);

		$categories = Collection::make($ids)
			->merge($data)
			->unique()
			->take(self::MAX_TAGS)
			->implode(',');

		$this->preferences['product_categories'] = trim($categories, ',');
	}
288398
function reload() {
  eval($("#layerdef").val());

  // refresh buttons
  var t = '';
  for(var i=1;i<net.layers.length-1;i++) { // ignore input and regression layers (first and last)
    var butid = "button" + i;
    t += "<input id=\""+butid+"\" value=\"" + net.layers[i].layer_type +"\" type=\"submit\" onclick=\"updateLix("+i+")\" style=\"width:80px; height: 30px; margin:5px;\";>";
  }
  $("#layer_ixes").html(t);
  $("#button"+lix).css('background-color', '#FFA');
}
1339411
public function Reload($resetpage = true)
    {
        parent::Reload($resetpage);

        $this->datalist = $this->getItems();
    }
308104
public function onloadCallback($dc)
	{
		if (\Input::get('act') === 'create') {
			return;
		}

		if (\Input::get('act') === 'edit') {
			$this->reloadConfig();
		}

		if ($dc->table === 'tl_content' && class_exists('CeAccess')) {
			$ceAccess = new \CeAccess;
			$ceAccess->filterContentElements($dc);
		}

		if (\Input::get('act') === 'editAll') {
			return $this->createDcaMultiEdit($dc);
		}

		$type = $this->getDcaFieldValue($dc, 'type');
		if (!$type || substr($type, 0, 5) !== 'rsce_') {
			return;
		}

		$data = $this->getDcaFieldValue($dc, 'rsce_data', true);
		if ($data && substr($data, 0, 1) === '{') {
			$this->data = json_decode($data, true);
		}

		$createFromPost = \Input::post('FORM_SUBMIT') === $dc->table;
		$tmpField = null;

		if (\Input::get('field') && substr(\Input::get('field'), 0, 11) === 'rsce_field_') {
			// Ensures that the fileTree oder pageTree field exists
			$tmpField = \Input::get('field');
		}
		elseif (
			\Input::get('target')
			&& ($target = explode('.', \Input::get('target'), 3))
			&& $target[0] === $dc->table
			&& substr($target[1], 0, 11) === 'rsce_field_'
		) {
			// Ensures that the fileTree oder pageTree field exists
			$tmpField = $target[1];
		}
		elseif (\Input::post('name') && substr(\Input::post('name'), 0, 11) === 'rsce_field_') {
			// Ensures that the fileTree oder pageTree field exists
			$tmpField = \Input::post('name');
		}

		$this->createDca($dc, $type, $createFromPost, $tmpField);
	}
290123
public function doAddAliasButton($arrButtons, \DataContainer $dc)
    {
        // Generate the aliases
        if (\Input::post('FORM_SUBMIT') == 'tl_select' && isset($_POST['alias'])) {
            if (version_compare(VERSION, '4.0', '<')) {
                $objSessionData = \Session::getInstance()->getData();
                $arrIds         = $objSessionData['CURRENT']['IDS'];
            } else {
                /** @var \Symfony\Component\HttpFoundation\Session\SessionInterface $objSession */
                $objSession = \System::getContainer()->get('session');
                $session    = $objSession->all();
                $arrIds     = $session['CURRENT']['IDS'];
            }

            $strItemClass = \Model::getClassFromTable($dc->table);

            if (!class_exists($strItemClass)) {
                return $arrButtons;
            }

            foreach ($arrIds as $intId) {
                $objItem = $strItemClass::findByPk($intId);

                if ($objItem === null) {
                    continue;
                }

                $dc->id           = $intId;
                $dc->activeRecord = $objItem;

                $strAlias = '';

                // Generate new alias through save callbacks
                foreach ($GLOBALS['TL_DCA'][$dc->table]['fields']['alias']['save_callback'] as $callback) {
                    if (is_array($callback)) {
                        $this->import($callback[0]);
                        $strAlias = $this->{$callback[0]}->{$callback[1]}($strAlias, $dc);
                    } elseif (is_callable($callback)) {
                        $strAlias = $callback($strAlias, $dc);
                    }
                }

                // The alias has not changed
                if ($strAlias == $objItem->alias) {
                    continue;
                }

                // Initialize the version manager
                $objVersions = new \Versions($dc->table, $intId);
                $objVersions->initialize();

                // Store the new alias
                \Database::getInstance()->prepare("UPDATE $dc->table SET alias=? WHERE id=?")->execute($strAlias, $intId);

                // Create a new version
                $objVersions->create();
            }

            \Controller::redirect($this->getReferer());
        }

        // Add the button
        if (version_compare(VERSION, '4.0', '<')) {
            $arrButtons['alias'] = '<input type="submit" name="alias" id="alias" class="tl_submit" accesskey="a" value="' . specialchars(
                    $GLOBALS['TL_LANG']['MSC']['aliasSelected']
                ) . '"> ';
        } else {
            $arrButtons['alias'] = '<button type="submit" name="alias" id="alias" class="tl_submit" accesskey="a">' .
                $GLOBALS['TL_LANG']['MSC']['aliasSelected'] .
                '</button> ';
        }

        return $arrButtons;
    }
681327
public function loadDc(string $table)
    {
        if (!isset($GLOBALS['TL_DCA'][$table]) || null === $GLOBALS['TL_DCA'][$table]) {
            /** @var Controller $controller */
            $controller = $this->framework->getAdapter(Controller::class);

            $controller->loadDataContainer($table);
        }
    }
702023
void onDataSetDefRegisteredEvent(@Observes DataSetDefRegisteredEvent event) {
        checkNotNull("event",
                     event);

        final DataSetDef def = event.getDataSetDef();
        if (def != null && def.isPublic() && isSupported(def)) {
            // Reload the whole data set panels list.
            show();
        }
    }
1299018
public function onLoadCallback(DataContainer $dc): void
    {
        if (!($dc instanceof Driver)) {
            return;
        }

        $ids = [];

        // Collect the top tags from all registries
        foreach ($this->registry->getAliases() as $alias) {
            $manager = $this->registry->get($alias);

            if ($manager instanceof DefaultManager) {
                foreach ($manager->getTopTagIds([], null, true) as $id => $count) {
                    $ids[$id] = $count;
                }
            }
        }

        // Append all other tags
        foreach ($this->db->executeQuery("SELECT id FROM {$dc->table}")->fetchAll(\PDO::FETCH_COLUMN, 0) as $id) {
            if (!\array_key_exists($id, $ids)) {
                $ids[$id] = 0;
            }
        }

        /** @var AttributeBagInterface $bag */
        $bag = $this->session->getBag('contao_backend');
        $session = $bag->all();

        // Handle the sorting selection
        switch ($session['sorting'][$dc->table]) {
            case 'total_asc':
                \asort($ids);
                break;
            case 'total_desc':
                \arsort($ids);
                break;
            default:
                $session['sorting'][$dc->table] = null;
                $bag->replace($session);

                return;
        }

        /** @var Database $db */
        $db = $this->framework->createInstance(Database::class);
        $dc->setOrderBy([$db->findInSet('id', \array_keys($ids))]);

        // Prevent adding an extra column to the listing
        $dc->setFirstOrderBy('name');
    }
379354
public function addBreadcrumb(\DataContainer $dc)
  {
    // Set a new cat
    if (isset($_GET['cat']))
    {
      $this->Session->set('tl_category_id', $this->Input->get('cat'));
      $this->redirect(preg_replace('/&cat=[^&]*/', '', $this->Environment->request));
    }

    $intCategoryId = $this->Session->get('tl_category_id');

    if ($intCategoryId < 1)
    {
      return;
    }

    $arrIds = array();
    $arrLinks = array();

    // Generate breadcrumb trail
    $category = $this->getCategoryForId($intCategoryId, true, false);

    if ($category == null)
    {
      $this->Session->set('tl_category_id', 0);
      return;
    }

    // Add root link
    $arrLinks[] = '<img src="system/modules/DocumentManagementSystem/assets/dms.png" width="16" height="16" alt=""> <a href="' . $this->addToUrl('cat=0') . '">' . $GLOBALS['TL_LANG']['MSC']['filterAll'] . '</a>';
    foreach ($category->getPath(false) as $eachCategory)
    {
      $image = 'category.png';
      if (!$eachCategory->isPublished())
      {
        $image = 'category_1.png';
      }
      if ($eachCategory->id == $intCategoryId)
      {
        $arrLinks[] = $this->generateImage('system/modules/DocumentManagementSystem/assets/' . $image, '', "") . ' ' . $eachCategory->name;
      }
      else
      {
        $arrLinks[] = $this->generateImage('system/modules/DocumentManagementSystem/assets/' . $image, '', "") . ' <a href="' . $this->addToUrl('cat='.$eachCategory->id) . '">' . $eachCategory->name . '</a>';
      }
    }

    // Limit tree
    $GLOBALS['TL_DCA']['tl_dms_categories']['list']['sorting']['root'] = array($intCategoryId);

    // Insert breadcrumb menu
    $GLOBALS['TL_DCA']['tl_dms_categories']['list']['sorting']['breadcrumb'] .= '

<ul id="tl_breadcrumb">
  <li>' . implode(' &gt; </li><li>', $arrLinks) . '</li>
</ul>';
  }
469050
public function update(CategoryUpdateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        if (null !== $category = CategoryQuery::create()->findPk($event->getCategoryId())) {
            $category
                ->setDispatcher($dispatcher)
                ->setDefaultTemplateId($event->getDefaultTemplateId() == 0 ? null : $event->getDefaultTemplateId())
                ->setLocale($event->getLocale())
                ->setTitle($event->getTitle())
                ->setDescription($event->getDescription())
                ->setChapo($event->getChapo())
                ->setPostscriptum($event->getPostscriptum())

                ->setParent($event->getParent())
                ->setVisible($event->getVisible())

                ->save();

            $event->setCategory($category);
        }
    }
745362
public function addAliasButton(array $buttons, DataContainer $dc)
    {
        $request = $this->requestStack->getCurrentRequest();

        // Generate the aliases
        if ('tl_select' === $request->request->get('FORM_SUBMIT') && $request->request->has('alias')) {
            $ids = $this->session->all()['CURRENT']['IDS'];

            /**
             * @var Controller
             * @var System     $systemAdapter
             * @var TagModel   $tagAdapter
             */
            $controllerAdapter = $this->framework->getAdapter(Controller::class);
            $systemAdapter = $this->framework->getAdapter(System::class);
            $tagAdapter = $this->framework->getAdapter(TagModel::class);

            // Handle each model individually
            if (null !== ($tagModels = $tagAdapter->findMultipleByIds($ids))) {
                /** @var TagModel $tagModel */
                foreach ($tagModels as $tagModel) {
                    $dc->id = $tagModel->id;
                    $dc->activeRecord = $tagModel;

                    $alias = '';

                    // Generate new alias through save callbacks
                    foreach ($GLOBALS['TL_DCA'][$dc->table]['fields']['alias']['save_callback'] as $callback) {
                        if (\is_array($callback)) {
                            $alias = $systemAdapter->importStatic($callback[0])->{$callback[1]}($alias, $dc);
                        } elseif (\is_callable($callback)) {
                            $alias = $callback($alias, $dc);
                        }
                    }

                    // The alias has not changed
                    if ($alias === $tagModel->alias) {
                        continue;
                    }

                    // Initialize the version manager
                    /** @var Versions $versions */
                    $versions = $this->framework->createInstance(Versions::class, [$dc->table, $tagModel->id]);
                    $versions->initialize();

                    // Store the new alias
                    $this->db->update($dc->table, ['alias' => $alias], ['id' => $tagModel->id]);

                    // Create a new version
                    $versions->create();
                }
            }

            $controllerAdapter->redirect($systemAdapter->getReferer());
        }

        // Add the button
        $buttons['alias'] = \sprintf('<button type="submit" name="alias" id="alias" class="tl_submit" accesskey="a">%s</button> ', $GLOBALS['TL_LANG']['MSC']['aliasSelected']);

        return $buttons;
    }