本文整理汇总了PHP中Versions类的典型用法代码示例。如果您正苦于以下问题:PHP Versions类的具体用法?PHP Versions怎么用?PHP Versions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Versions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: toggleVisibility
/**
* Disable/enable a user group
* @param integer
* @param boolean
*/
public function toggleVisibility($intId, $blnVisible)
{
// Check permissions to edit
$objInput = \Input::getInstance();
$objInput->setGet('id', $intId);
$objInput->setGet('act', 'toggle');
#$this->checkPermission();
// Check permissions to publish
if (!$this->User->isAdmin && !$this->User->hasAccess('tl_glossary_term::published', 'alexf')) {
$this->log('Not enough permissions to publish/unpublish item ID "' . $intId . '"', 'tl_glossary_term toggleVisibility', TL_ERROR);
$this->redirect('contao/main.php?act=error');
}
$objVersions = new \Versions('tl_glossary_term', $intId);
$objVersions->initialize();
// Trigger the save_callback
if (is_array($GLOBALS['TL_DCA']['tl_glossary_term']['fields']['published']['save_callback'])) {
foreach ($GLOBALS['TL_DCA']['tl_glossary_term']['fields']['published']['save_callback'] as $callback) {
$this->import($callback[0]);
$blnVisible = $this->{$callback}[0]->{$callback}[1]($blnVisible, $this);
}
}
// Update the database
\Database::getInstance()->prepare("UPDATE tl_glossary_term SET tstamp=" . time() . ", published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);
$objVersions->create();
$this->log('A new version of record "tl_glossary_term.id=' . $intId . '" has been created', 'tl_revolutionslider_slides toggleVisibility()', TL_GENERAL);
}
开发者ID:w3scout,项目名称:glossary_revisited,代码行数:31,代码来源:TableGlossaryTerm.php
示例3: 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
示例4: __construct
public function __construct($versions = NULL)
{
if ($versions == NULL) {
$versions = Versions::getVersions();
}
$this->versions = $versions;
}
开发者ID:Rogiel,项目名称:star-replay,代码行数:7,代码来源:VersionLoader.php
示例5: toggleVisibility
/**
* Disable/enable a user group
* @param integer
* @param boolean
*/
public function toggleVisibility($intId, $blnVisible)
{
// Check permissions
if (!$this->User->hasAccess('tl_member_group::disable', 'alexf')) {
$this->log('Not enough permissions to activate/deactivate member group ID "' . $intId . '"', __METHOD__, TL_ERROR);
$this->redirect('contao/main.php?act=error');
}
$objVersions = new Versions('tl_member_group', $intId);
$objVersions->initialize();
// Trigger the save_callback
if (is_array($GLOBALS['TL_DCA']['tl_member_group']['fields']['disable']['save_callback'])) {
foreach ($GLOBALS['TL_DCA']['tl_member_group']['fields']['disable']['save_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$blnVisible = $this->{$callback}[0]->{$callback}[1]($blnVisible, $this);
} elseif (is_callable($callback)) {
$blnVisible = $callback($blnVisible, $this);
}
}
}
// Update the database
$this->Database->prepare("UPDATE tl_member_group SET tstamp=" . time() . ", disable='" . ($blnVisible ? '' : 1) . "' WHERE id=?")->execute($intId);
$objVersions->create();
$this->log('A new version of record "tl_member_group.id=' . $intId . '" has been created' . $this->getParentEntries('tl_member_group', $intId), __METHOD__, TL_GENERAL);
}
开发者ID:iCodr8,项目名称:core,代码行数:30,代码来源:tl_member_group.php
示例6: layout
/**
* list versions
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// initialize variables
$prefix = $suffix = $icon = '';
// the url to view this item
$url = '_' . $item['id'];
// Versions::get_url($item['id']);
// version description
$label = sprintf(i18n::s('edited by %s %s'), ucfirst($item['edit_name']), Skin::build_date($item['edit_date']));
// command to view this version
$suffix .= ' ' . Skin::build_link(Versions::get_url($item['id'], 'view'), i18n::s('compare to current version'), 'button');
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'version', $icon);
}
// end of processing
SQL::free($result);
return $items;
}
开发者ID:rair,项目名称:yacs,代码行数:36,代码来源:layout_versions.php
示例7: 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
示例8: _publish_queued
public static function _publish_queued ($posts) {
foreach (array_keys ($posts) as $k) {
if ($posts[$k]->published === 'que') {
$posts[$k]->published = 'yes';
$posts[$k]->put ();
\Versions::add ($posts[$k]);
}
}
return $posts;
}
开发者ID:R-J,项目名称:elefant,代码行数:10,代码来源:Post.php
示例9: getAllVersions
public static function getAllVersions()
{
$versions = array();
$db = Zend_Registry::get('my_db');
$v = new Versions($db);
$result = $v->fetchAll("version_id = " . $id);
foreach ($result as $row) {
switch (DB_TYPE) {
case 'mysql':
$version = new Version($row->version_id);
break;
case 'oci8':
$version = new Version($row->version_id);
break;
}
array_push($versions, $version);
}
return $versions;
}
开发者ID:Koulio,项目名称:OpenZIS,代码行数:19,代码来源:Version.php
示例10: 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
示例11: getAllVersions
public static function getAllVersions()
{
$versions = array();
//$db = ZitDBAdapter::getDBAdapter();
$db = Zend_Registry::get('my_db2');
$v = new Versions($db);
$result = $v->fetchAll("active = 1");
foreach ($result as $row) {
switch (DB_TYPE) {
case 'mysql':
$version = new Version($row->version_id);
break;
case 'oci8':
$version = new Version($row->VERSION_ID);
break;
}
array_push($versions, $version);
}
return $versions;
}
开发者ID:Koulio,项目名称:OpenZIS,代码行数:20,代码来源:Version.php
示例12: last_version
public static function last_version()
{
$query = Versions::find(array('order' => 'date DESC', 'limit' => 1));
$result = $query->getFirst();
$version = $result->version;
$array = explode('.', $version);
$key_terakhir = count($array);
$key_terakhir = $key_terakhir - 1;
$array[$key_terakhir] = $array[$key_terakhir] + 1;
$version_now = implode('.', $array);
return $version_now;
}
开发者ID:mahrizal,项目名称:system-management-system,代码行数:12,代码来源:Versions.php
示例13: checkVersion
public static function checkVersion($passVer)
{
$db = Zend_Registry::get('my_db');
$versions = new Versions($db);
$quoted = $db->quote($passVer);
$result = $versions->fetchAll("active = 1 and version_num = {$quoted}");
foreach ($result as $row) {
switch (DB_TYPE) {
case 'mysql':
if ($passVer == $row->version_num) {
return true;
}
break;
case 'oci8':
if ($passVer == $row->VERSION_NUM) {
return true;
}
break;
}
}
return false;
}
开发者ID:Koulio,项目名称:OpenZIS,代码行数:22,代码来源:Zit.php
示例14: 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
示例15: deleteAction
function deleteAction($version_id, $system_id)
{
$versions = Versions::findFirstById($version_id);
if ($versions != false) {
if ($versions->delete() == false) {
echo "Sorry, we can't delete the version right now: \n";
foreach ($versions->getMessages() as $message) {
echo $message, "\n";
}
} else {
$this->flash->success('Delete version Success');
$this->response->redirect('versions/system/' . $system_id);
}
}
}
开发者ID:mahrizal,项目名称:system-management-system,代码行数:15,代码来源:VersionsController.php
示例16: 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
}
// Check the field access
if (!$this->User->hasAccess('tl_member::disable', 'alexf')) {
throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to activate/deactivate member ID ' . $intId . '.');
}
$objVersions = new Versions('tl_member', $intId);
$objVersions->initialize();
// Reverse the logic (members have disabled=1)
$blnVisible = !$blnVisible;
// Trigger the save_callback
if (is_array($GLOBALS['TL_DCA']['tl_member']['fields']['disable']['save_callback'])) {
foreach ($GLOBALS['TL_DCA']['tl_member']['fields']['disable']['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);
}
}
}
$time = time();
// Update the database
$this->Database->prepare("UPDATE tl_member SET tstamp={$time}, disable='" . ($blnVisible ? '1' : '') . "' WHERE id=?")->execute($intId);
$objVersions->create();
// Remove the session if the user is disabled (see #5353)
if (!$blnVisible) {
$this->Database->prepare("DELETE FROM tl_session WHERE name='FE_USER_AUTH' AND pid=?")->execute($intId);
}
}
开发者ID:qzminski,项目名称:contao-core-bundle,代码行数:46,代码来源:tl_member.php
示例17: 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
示例18: 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
示例19: Webpage
$wp = new Webpage($_GET['page']);
$f = new Form('post', 'admin/edit');
$f->verify_csrf = false;
if ($f->submit()) {
$wp->id = $_POST['id'];
$wp->title = $_POST['title'];
$wp->menu_title = $_POST['menu_title'];
$wp->window_title = $_POST['window_title'];
$wp->access = $_POST['access'];
$wp->layout = $_POST['layout'];
$wp->description = $_POST['description'];
$wp->keywords = $_POST['keywords'];
$wp->body = $_POST['body'];
$wp->put();
if (!$wp->error) {
Versions::add($wp);
$memcache->delete('_admin_page_' . $_GET['page']);
$this->add_notification(i18n_get('Page saved.'));
$_POST['page'] = $_GET['page'];
$lock->remove();
$this->hook('admin/edit', $_POST);
$this->redirect('/' . $_POST['id']);
}
$page->title = i18n_get('An Error Occurred');
echo i18n_get('Error Message') . ': ' . $wp->error;
} else {
$wp->layouts = admin_get_layouts();
$wp->failed = $f->failed;
$wp = $f->merge_values($wp);
$page->title = i18n_get('Edit Page') . ': ' . $wp->title;
$page->head = $tpl->render('admin/edit/head', $wp) . $tpl->render('admin/wysiwyg');
开发者ID:nathanieltite,项目名称:elefant,代码行数:31,代码来源:edit.php
示例20: compile
/**
* Generate the module
*/
protected function compile()
{
/** @var \PageModel $objPage */
global $objPage;
$this->import('FrontendUser', 'User');
$GLOBALS['TL_LANGUAGE'] = $objPage->language;
\System::loadLanguageFile('tl_member');
$this->loadDataContainer('tl_member');
// Call onload_callback (e.g. to check permissions)
if (is_array($GLOBALS['TL_DCA']['tl_member']['config']['onload_callback'])) {
foreach ($GLOBALS['TL_DCA']['tl_member']['config']['onload_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->{$callback[0]}->{$callback[1]}();
} elseif (is_callable($callback)) {
$callback();
}
}
}
// Set the template
if ($this->memberTpl != '') {
/** @var \FrontendTemplate|object $objTemplate */
$objTemplate = new \FrontendTemplate($this->memberTpl);
$this->Template = $objTemplate;
$this->Template->setData($this->arrData);
}
$this->Template->fields = '';
$this->Template->tableless = $this->tableless;
$arrFields = array();
$doNotSubmit = false;
$hasUpload = false;
$row = 0;
// Predefine the group order (other groups will be appended automatically)
$arrGroups = array('personal' => array(), 'address' => array(), 'contact' => array(), 'login' => array(), 'profile' => array());
$blnModified = false;
$objMember = \MemberModel::findByPk($this->User->id);
$strTable = $objMember->getTable();
// Initialize the versioning (see #7415)
$objVersions = new \Versions($strTable, $objMember->id);
$objVersions->setUsername($objMember->username);
$objVersions->setUserId(0);
$objVersions->setEditUrl('contao/main.php?do=member&act=edit&id=%s&rt=1');
$objVersions->initialize();
// Build the form
foreach ($this->editable as $field) {
$arrData =& $GLOBALS['TL_DCA']['tl_member']['fields'][$field];
// Map checkboxWizards to regular checkbox widgets
if ($arrData['inputType'] == 'checkboxWizard') {
$arrData['inputType'] = 'checkbox';
}
// Map fileTrees to upload widgets (see #8091)
if ($arrData['inputType'] == 'fileTree') {
$arrData['inputType'] = 'upload';
}
/** @var \Widget $strClass */
$strClass = $GLOBALS['TL_FFL'][$arrData['inputType']];
// Continue if the class does not exist
if (!$arrData['eval']['feEditable'] || !class_exists($strClass)) {
continue;
}
$strGroup = $arrData['eval']['feGroup'];
$arrData['eval']['required'] = false;
$arrData['eval']['tableless'] = $this->tableless;
// Use strlen() here (see #3277)
if ($arrData['eval']['mandatory']) {
if (is_array($this->User->{$field})) {
if (empty($this->User->{$field})) {
$arrData['eval']['required'] = true;
}
} else {
if (!strlen($this->User->{$field})) {
$arrData['eval']['required'] = true;
}
}
}
$varValue = $this->User->{$field};
// Call the load_callback
if (isset($arrData['load_callback']) && is_array($arrData['load_callback'])) {
foreach ($arrData['load_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$varValue = $this->{$callback[0]}->{$callback[1]}($varValue, $this->User, $this);
} elseif (is_callable($callback)) {
$varValue = $callback($varValue, $this->User, $this);
}
}
}
/** @var \Widget $objWidget */
$objWidget = new $strClass($strClass::getAttributesFromDca($arrData, $field, $varValue, $field, $strTable, $this));
$objWidget->storeValues = true;
$objWidget->rowClass = 'row_' . $row . ($row == 0 ? ' row_first' : '') . ($row % 2 == 0 ? ' even' : ' odd');
// Increase the row count if it is a password field
if ($objWidget instanceof \FormPassword) {
if ($objMember->password != '') {
$objWidget->mandatory = false;
}
$objWidget->rowClassConfirm = 'row_' . ++$row . ($row % 2 == 0 ? ' even' : ' odd');
//.........这里部分代码省略.........
开发者ID:bytehead,项目名称:contao-core,代码行数:101,代码来源:ModulePersonalData.php
注:本文中的Versions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论