当前位置: 首页>>代码示例>>PHP>>正文


PHP Versions::create方法代码示例

本文整理汇总了PHP中Versions::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Versions::create方法的具体用法?PHP Versions::create怎么用?PHP Versions::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Versions的用法示例。


在下文中一共展示了Versions::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: importRobotsTxt

 /**
  * Import the default robots.txt
  * @param \DataContainer
  */
 public function importRobotsTxt(\DataContainer $dc)
 {
     if (\Input::get('key') != 'importRobotsTxt') {
         return '';
     }
     if (!file_exists(TL_ROOT . "/" . FILE_ROBOTS_TXT_DEFAULT)) {
         \Message::addError($GLOBALS['TL_LANG']['ERR']['no_robotstxt_default']);
         $this->redirect(str_replace('&key=importRobotsTxt', '', \Environment::get('request')));
     }
     $objVersions = new \Versions($dc->table, \Input::get('id'));
     $objVersions->create();
     $strFileContent = file_get_contents(TL_ROOT . "/" . FILE_ROBOTS_TXT_DEFAULT);
     \Database::getInstance()->prepare("UPDATE " . $dc->table . " SET robotsTxtContent=? WHERE id=?")->execute($strFileContent, \Input::get('id'));
     $this->redirect(str_replace('&key=importRobotsTxt', '', \Environment::get('request')));
 }
开发者ID:hofff,项目名称:contao-robots-txt-editor,代码行数:19,代码来源:RobotsTxtEditor.php

示例2: executePostActions

 /**
  * Execute AJAX post actions to toggle.
  *
  * @param string         $action
  * @param \DataContainer $dc
  */
 public function executePostActions($action, \DataContainer $dc)
 {
     if ($action !== 'hasteAjaxOperation') {
         return;
     }
     $id = $dc->id = \Input::post('id');
     $currentValue = \Input::post('value');
     $operation = \Input::post('operation');
     $hasteAjaxOperationSettings = $GLOBALS['TL_DCA'][$dc->table]['list']['operations'][$operation]['haste_ajax_operation'];
     if (!isset($hasteAjaxOperationSettings)) {
         return;
     }
     // Check permissions
     if (!$this->checkPermission($dc->table, $hasteAjaxOperationSettings)) {
         \System::log(sprintf('Not enough permissions to toggle field %s::%s', $dc->table, $hasteAjaxOperationSettings['field']), __METHOD__, TL_ERROR);
         \Controller::redirect('contao/main.php?act=error');
     }
     // Initialize versioning
     $versions = new \Versions($dc->table, $id);
     $versions->initialize();
     // Determine next value and icon
     $options = $this->getOptions($hasteAjaxOperationSettings);
     $nextIndex = 0;
     foreach ($options as $k => $option) {
         if ($option['value'] == $currentValue) {
             $nextIndex = $k + 1;
         }
     }
     // Make sure that if $nextIndex does not exist it's the first
     if (!isset($options[$nextIndex])) {
         $nextIndex = 0;
     }
     $value = $options[$nextIndex]['value'];
     $value = $this->executeSaveCallback($dc, $value, $hasteAjaxOperationSettings);
     // Update DB
     \Database::getInstance()->prepare('UPDATE ' . $dc->table . ' SET ' . $hasteAjaxOperationSettings['field'] . '=? WHERE id=?')->execute($value, $id);
     $versions->create();
     if ($GLOBALS['TL_DCA'][$dc->table]['config']['enableVersioning']) {
         \System::log(sprintf('A new version of record "%s.id=%s" has been created', $dc->table, $id), __METHOD__, TL_GENERAL);
     }
     $response = array('nextValue' => $options[$nextIndex]['value'], 'nextIcon' => $options[$nextIndex]['icon']);
     $response = new JsonResponse($response);
     $response->send();
 }
开发者ID:codefog,项目名称:contao-haste,代码行数:50,代码来源:AjaxOperations.php

示例3: toggleVisibility

 /**
  * Publish/unpublish rule
  * @param integer
  * @param boolean
  * @param \DataContainer
  */
 public function toggleVisibility($intId, $blnVisible, \DataContainer $dc = null)
 {
     $objVersions = new \Versions('tl_css_class_replacer', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_css_class_replacer']['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_css_class_replacer']['fields']['published']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $blnVisible = \System::importStatic($callback[0])->{$callback}[1]($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     // Update the database
     \Database::getInstance()->prepare("UPDATE tl_css_class_replacer SET tstamp=" . time() . ", published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);
     $objVersions->create();
     \System::log('A new version of record "tl_css_class_replacer.id=' . $intId . '" has been created', __METHOD__, TL_GENERAL);
 }
开发者ID:toflar,项目名称:contao-css-class-replacer,代码行数:25,代码来源:BackendHelper.php

示例4: toggleVisibility

 public function toggleVisibility($intId, $blnVisible)
 {
     $objUser = \BackendUser::getInstance();
     $objDatabase = \Database::getInstance();
     // Check permissions to publish
     if (!$objUser->isAdmin && !$objUser->hasAccess('tl_entity_cleaner::published', 'alexf')) {
         \Controller::log('Not enough permissions to publish/unpublish item ID "' . $intId . '"', 'tl_entity_cleaner toggleVisibility', TL_ERROR);
         \Controller::redirect('contao/main.php?act=error');
     }
     $objVersions = new Versions('tl_entity_cleaner', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_entity_cleaner']['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_entity_cleaner']['fields']['published']['save_callback'] as $callback) {
             $this->import($callback[0]);
             $blnVisible = $this->{$callback}[0]->{$callback}[1]($blnVisible, $this);
         }
     }
     // Update the database
     $objDatabase->prepare("UPDATE tl_entity_cleaner SET tstamp=" . time() . ", published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);
     $objVersions->create();
     \Controller::log('A new version of record "tl_entity_cleaner.id=' . $intId . '" has been created' . $this->getParentEntries('tl_entity_cleaner', $intId), 'tl_entity_cleaner toggleVisibility()', TL_GENERAL);
 }
开发者ID:heimrichhannot,项目名称:contao-entity_cleaner,代码行数:23,代码来源:tl_entity_cleaner.php

示例5: toggleVisibility

 /**
  * Disable/enable a user group
  *
  * @param integer       $intId
  * @param boolean       $blnVisible
  * @param DataContainer $dc
  *
  * @throws Contao\CoreBundle\Exception\AccessDeniedException
  */
 public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
 {
     // Set the ID and action
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     if ($dc) {
         $dc->id = $intId;
         // see #8043
     }
     $this->checkPermission();
     // Check the field access
     if (!$this->User->hasAccess('tl_faq::published', 'alexf')) {
         throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to publish/unpublish FAQ ID ' . $intId . '.');
     }
     $objVersions = new Versions('tl_faq', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_faq']['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_faq']['fields']['published']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     // Update the database
     $this->Database->prepare("UPDATE tl_faq SET tstamp=" . time() . ", published='" . ($blnVisible ? '1' : '') . "' WHERE id=?")->execute($intId);
     $objVersions->create();
 }
开发者ID:contao,项目名称:faq-bundle,代码行数:40,代码来源:tl_faq.php

示例6: toggleVisibility

 /**
  * Disable/enable a user group
  *
  * @param integer       $intId
  * @param boolean       $blnVisible
  * @param DataContainer $dc
  */
 public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
 {
     // Set the ID and action
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     if ($dc) {
         $dc->id = $intId;
         // see #8043
     }
     $this->checkPermission();
     // Check the field access
     if (!$this->User->hasAccess('tl_comments::published', 'alexf')) {
         $this->log('Not enough permissions to publish/unpublish comment ID "' . $intId . '"', __METHOD__, TL_ERROR);
         $this->redirect('contao/main.php?act=error');
     }
     $objVersions = new Versions('tl_comments', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_comments']['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_comments']['fields']['published']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     // Update the database
     $this->Database->prepare("UPDATE tl_comments SET tstamp=" . time() . ", published='" . ($blnVisible ? '1' : '') . "' WHERE id=?")->execute($intId);
     $objVersions->create();
 }
开发者ID:eknoes,项目名称:core,代码行数:39,代码来源:tl_comments.php

示例7: toggleVisibility

 /**
  * Disable/enable a user group
  *
  * @param integer        $intId
  * @param boolean        $blnVisible
  * @param DataContainer $dc
  */
 public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
 {
     // Set the ID and action
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     if ($dc) {
         $dc->id = $intId;
         // see #8043
     }
     $this->checkPermission();
     // Check the field access
     if (!$this->User->hasAccess('tl_calendar_events::published', 'alexf')) {
         $this->log('Not enough permissions to publish/unpublish event ID "' . $intId . '"', __METHOD__, TL_ERROR);
         $this->redirect('contao/main.php?act=error');
     }
     $objVersions = new Versions('tl_calendar_events', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_calendar_events']['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_calendar_events']['fields']['published']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     // Update the database
     $this->Database->prepare("UPDATE tl_calendar_events SET tstamp=" . time() . ", published='" . ($blnVisible ? '1' : '') . "' WHERE id=?")->execute($intId);
     $objVersions->create();
     $this->log('A new version of record "tl_calendar_events.id=' . $intId . '" has been created' . $this->getParentEntries('tl_calendar_events', $intId), __METHOD__, TL_GENERAL);
     // Update the RSS feed (for some reason it does not work without sleep(1))
     sleep(1);
     $this->import('Calendar');
     $this->Calendar->generateFeedsByCalendar(CURRENT_ID);
 }
开发者ID:bytehead,项目名称:contao-core,代码行数:44,代码来源:tl_calendar_events.php

示例8: toggleVisibility

 /**
  * Disable/enable a user group
  * @param integer
  * @param boolean
  * @param \DataContainer
  */
 public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
 {
     // Check permissions to edit
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     $this->checkPermission();
     // Check permissions to publish
     if (!$this->User->hasAccess('tl_product_price::published', 'alexf')) {
         $this->log('Not enough permissions to publish/unpublish price item ID "' . $intId . '"', __METHOD__, TL_ERROR);
         $this->redirect('contao/main.php?act=error');
     }
     $objVersions = new Versions('tl_product_price', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_product_price']['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_product_price']['fields']['published']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $blnVisible = $this->{$callback}[0]->{$callback}[1]($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     // Update the database
     $this->Database->prepare("UPDATE tl_product_price SET tstamp=" . time() . ", published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);
     $objVersions->create();
     $this->log('A new version of record "tl_product_price.id=' . $intId . '" has been created' . $this->getParentEntries('tl_product_price', $intId), __METHOD__, TL_GENERAL);
 }
开发者ID:respinar,项目名称:contao-product,代码行数:35,代码来源:tl_product_price.php

示例9: toggleVisibility

 /**
  * Toggle the visibility state.
  *
  * @param int  $recordId Record id.
  * @param bool $newState New state.
  *
  * @return void
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 private function toggleVisibility($recordId, $newState)
 {
     if (!$this->hasAccess()) {
         $this->log(sprintf('Not enough permission to show/shide record ID "%s"', $recordId), __METHOD__, TL_ERROR);
         $this->redirect('contao/main.php?act=error');
     }
     $versions = new \Versions($this->table, $recordId);
     if (isset($GLOBALS['TL_DCA'][$this->table]['fields'][$this->column]['save_callback'])) {
         foreach ((array) $GLOBALS['TL_DCA'][$this->table]['fields'][$this->column]['save_callback'] as $callback) {
             $instance = new $callback[0]();
             $instance->{$callback}[1]($newState, $this);
         }
     }
     $this->database->prepare(sprintf('UPDATE %s %s WHERE id=?', $this->table, '%s'))->set(array('tstamp' => time(), $this->column => $newState ? '1' : ''))->execute($recordId);
     $versions->create();
 }
开发者ID:contao-bootstrap,项目名称:grid-editor,代码行数:26,代码来源:ToggleIconCallback.php

示例10: toggleVisibility

 /**
  * Toggle the visibility of an element
  *
  * @param integer       $intId
  * @param boolean       $blnVisible
  * @param DataContainer $dc
  */
 public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
 {
     // Check permissions to edit
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     // The onload_callbacks vary depending on the dynamic parent table (see #4894)
     if (is_array($GLOBALS['TL_DCA']['tl_content']['config']['onload_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_content']['config']['onload_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $this->{$callback}[0]->{$callback}[1]($dc ?: $this);
             } elseif (is_callable($callback)) {
                 $callback($dc ?: $this);
             }
         }
     }
     // Check permissions to publish
     if (!$this->User->hasAccess('tl_content::invisible', 'alexf')) {
         $this->log('Not enough permissions to show/hide content element ID "' . $intId . '"', __METHOD__, TL_ERROR);
         $this->redirect('contao/main.php?act=error');
     }
     $objVersions = new Versions('tl_content', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_content']['fields']['invisible']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_content']['fields']['invisible']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $blnVisible = $this->{$callback}[0]->{$callback}[1]($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     // Update the database
     $this->Database->prepare("UPDATE tl_content SET tstamp=" . time() . ", invisible='" . ($blnVisible ? '' : 1) . "' WHERE id=?")->execute($intId);
     $objVersions->create();
     $this->log('A new version of record "tl_content.id=' . $intId . '" has been created' . $this->getParentEntries('tl_content', $intId), __METHOD__, TL_GENERAL);
 }
开发者ID:juergen83,项目名称:contao,代码行数:46,代码来源:tl_content.php

示例11: toggleVisibility

 /**
  * Toggle the visibility of a form field
  *
  * @param integer       $intId
  * @param boolean       $blnVisible
  * @param DataContainer $dc
  */
 public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
 {
     // Set the ID and action
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     if ($dc) {
         $dc->id = $intId;
         // see #8043
     }
     $this->checkPermission();
     $objVersions = new Versions('tl_form_field', $intId);
     $objVersions->initialize();
     // Reverse the logic (form fields have invisible=1)
     $blnVisible = !$blnVisible;
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_form_field']['fields']['invisible']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_form_field']['fields']['invisible']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     // Update the database
     $this->Database->prepare("UPDATE tl_form_field SET tstamp=" . time() . ", invisible='" . ($blnVisible ? '1' : '') . "' WHERE id=?")->execute($intId);
     $objVersions->create();
 }
开发者ID:contao,项目名称:core-bundle,代码行数:36,代码来源:tl_form_field.php

示例12: doAddAliasButton

 /**
  * Generic method for automatically generating aliases
  *
  * @param array          $arrButtons
  * @param \DataContainer $dc
  *
  * @return array
  */
 public function doAddAliasButton($arrButtons, \DataContainer $dc)
 {
     // Generate the aliases
     if (\Input::post('FORM_SUBMIT') == 'tl_select' && isset($_POST['alias'])) {
         $objSessionData = \Session::getInstance()->getData();
         $arrIds = $objSessionData['CURRENT']['IDS'];
         foreach ($arrIds as $intId) {
             $strItemClass = \Model::getClassFromTable($dc->table);
             $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
     $arrButtons['alias'] = '<input type="submit" name="alias" id="alias" class="tl_submit" accesskey="a" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['aliasSelected']) . '"> ';
     return $arrButtons;
 }
开发者ID:heimrichhannot,项目名称:contao-haste_plus,代码行数:50,代码来源:General.php

示例13: toggleVisibility

 /**
  * Toggle the visibility of an element
  *
  * @param integer       $intId
  * @param boolean       $blnVisible
  * @param DataContainer $dc
  *
  * @throws Contao\CoreBundle\Exception\AccessDeniedException
  */
 public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
 {
     // Set the ID and action
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     if ($dc) {
         $dc->id = $intId;
         // see #8043
     }
     $this->checkPermission();
     // Check the field access
     if (!$this->User->hasAccess('tl_content::invisible', 'alexf')) {
         throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to show/hide content element ID ' . $intId . '.');
     }
     // Reverse the logic (elements have invisible=1)
     $blnVisible = !$blnVisible;
     // The onload_callbacks vary depending on the dynamic parent table (see #4894)
     if (is_array($GLOBALS['TL_DCA']['tl_content']['config']['onload_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_content']['config']['onload_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $this->{$callback[0]}->{$callback[1]}($dc ?: $this);
             } elseif (is_callable($callback)) {
                 $callback($dc ?: $this);
             }
         }
     }
     $objVersions = new Versions('tl_content', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_content']['fields']['invisible']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_content']['fields']['invisible']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     // Update the database
     $this->Database->prepare("UPDATE tl_content SET tstamp=" . time() . ", invisible='" . ($blnVisible ? '1' : '') . "' WHERE id=?")->execute($intId);
     $objVersions->create();
 }
开发者ID:bytehead,项目名称:core-bundle,代码行数:53,代码来源:tl_content.php

示例14: toggleVisibility

 /**
  * Disable/enable
  * @param integer
  * @param boolean
  */
 public function toggleVisibility($intId, $blnVisible)
 {
     // Check permissions to edit
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     $objVersions = new Versions('tl_webfonts', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_webfonts']['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_webfonts']['fields']['published']['save_callback'] as $callback) {
             $this->import($callback[0]);
             $blnVisible = $this->{$callback}[0]->{$callback}[1]($blnVisible, $this);
         }
     }
     // Update the database
     $this->Database->prepare("UPDATE tl_webfonts SET tstamp=" . time() . ", published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);
     $objVersions->create();
     $this->log('A new version of record "tl_tiles.id=' . $intId . '" has been created' . $this->getParentEntries('tl_webfonts', $intId), 'tl_webfonts toggleVisibility()', TL_GENERAL);
 }
开发者ID:yfridelance,项目名称:contao-webfonts,代码行数:24,代码来源:tl_webfonts.php

示例15: edit


//.........这里部分代码省略.........
            foreach ($this->arrTranslations as $language) {
                if (in_array($language, $arrAvailableLanguages)) {
                    if ($_SESSION['BE_DATA']['language'][$this->strTable][$this->intId] == $language) {
                        $available .= '<option value="' . $language . '" selected="selected">' . $this->arrTranslationLabels[$language] . '</option>';
                        $_SESSION['TL_INFO'] = array($GLOBALS['TL_LANG']['MSC']['editingLanguage']);
                    } else {
                        $available .= '<option value="' . $language . '">' . $this->arrTranslationLabels[$language] . '</option>';
                    }
                } else {
                    $undefined .= '<option value="' . $language . '">' . $this->arrTranslationLabels[$language] . ' (' . $GLOBALS['TL_LANG']['MSC']['undefinedLanguage'] . ')' . '</option>';
                }
            }
            $version = str_replace('<div class="tl_version_panel">', '<div class="tl_version_panel tl_iso_products_panel">
<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_language" class="tl_form" method="post">
<div class="tl_formbody">
<input type="hidden" name="FORM_SUBMIT" value="tl_language">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<select name="language" class="tl_select' . (strlen($_SESSION['BE_DATA']['language'][$this->strTable][$this->intId]) ? ' active' : '') . '" onchange="document.id(this).getParent(\'form\').submit()">
    <option value="">' . $GLOBALS['TL_LANG']['MSC']['defaultLanguage'] . '</option>' . $available . $undefined . '
</select>
<noscript>
<input type="submit" name="editLanguage" class="tl_submit" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['editLanguage']) . '">
</noscript>
</div>
</form>', $version);
        }
        // Submit buttons
        $arrButtons = array();
        $arrButtons['save'] = '<input type="submit" name="save" id="save" class="tl_submit" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['save']) . '">';
        if (!\Input::get('nb')) {
            $arrButtons['saveNclose'] = '<input type="submit" name="saveNclose" id="saveNclose" class="tl_submit" accesskey="c" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['saveNclose']) . '">';
        }
        if (!\Input::get('popup') && !$GLOBALS['TL_DCA'][$this->strTable]['config']['closed'] && !$GLOBALS['TL_DCA'][$this->strTable]['config']['notCreatable']) {
            $arrButtons['saveNcreate'] = '<input type="submit" name="saveNcreate" id="saveNcreate" class="tl_submit" accesskey="n" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['saveNcreate']) . '">';
        }
        if (\Input::get('s2e')) {
            $arrButtons['saveNedit'] = '<input type="submit" name="saveNedit" id="saveNedit" class="tl_submit" accesskey="e" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['saveNedit']) . '">';
        } elseif (!\Input::get('popup') && ($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 4 || strlen($this->ptable) || $GLOBALS['TL_DCA'][$this->strTable]['config']['switchToEdit'])) {
            $arrButtons['saveNback'] = '<input type="submit" name="saveNback" id="saveNback" class="tl_submit" accesskey="g" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['saveNback']) . '">';
        }
        if ($this->blnEditLanguage) {
            $arrButtons['deleteLanguage'] = '<input type="submit" name="deleteLanguage" class="tl_submit" style="float:right" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['deleteLanguage']) . '" onclick="return confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteLanguageConfirm'] . '\')">';
        }
        // Call the buttons_callback (see #4691)
        if (is_array($GLOBALS['TL_DCA'][$this->strTable]['edit']['buttons_callback'])) {
            foreach ($GLOBALS['TL_DCA'][$this->strTable]['edit']['buttons_callback'] as $callback) {
                if (is_array($callback)) {
                    $this->import($callback[0]);
                    $arrButtons = $this->{$callback}[0]->{$callback}[1]($arrButtons, $this);
                } elseif (is_callable($callback)) {
                    $arrButtons = $callback($arrButtons, $this);
                }
            }
        }
        // Add the buttons and end the form
        $return .= '
</div>

<div class="tl_formbody_submit">

<div class="tl_submit_container">
  ' . implode(' ', $arrButtons) . '
</div>

</div>
</form>
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:67,代码来源:DC_ProductData.php


注:本文中的Versions::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。