本文整理汇总了PHP中JLanguageAssociations类的典型用法代码示例。如果您正苦于以下问题:PHP JLanguageAssociations类的具体用法?PHP JLanguageAssociations怎么用?PHP JLanguageAssociations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JLanguageAssociations类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Display the view.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$section = $this->state->get('category.section') ? $this->state->get('category.section') . '.' : '';
$this->canDo = JHelperContent::getActions($this->state->get('category.component'), $section . 'category', $this->item->id);
$this->assoc = $this->get('Assoc');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Check for tag type
$this->checkTags = JHelperTags::getTypes('objectList', array($this->state->get('category.extension') . '.category'), true);
JFactory::getApplication()->input->set('hidemainmenu', true);
if ($this->getLayout() == 'modal') {
// If we are forcing a language in modal (used for associations).
if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) {
// Set the language field to the forcedLanguage and disable changing it.
$this->form->setValue('language', null, $forcedLanguage);
$this->form->setFieldAttribute('language', 'readonly', 'true');
// Only allow to select categories with All language or with the forced language.
$this->form->setFieldAttribute('parent_id', 'language', '*,' . $forcedLanguage);
// Only allow to select tags with All language or with the forced language.
$this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage);
}
} elseif ($this->item->id && $this->form->getValue('language', null, '*') != '*' && JLanguageAssociations::isEnabled() && count($this->item->associations) > 0) {
$this->form->setFieldAttribute('language', 'readonly', 'true');
}
$this->addToolbar();
return parent::display($tpl);
}
开发者ID:eshiol,项目名称:joomla-cms,代码行数:40,代码来源:view.html.php
示例2: association
/**
* Get the associated language flags
*
* @param int $contactid The item id to search associations
*
* @return string The language HTML
*/
public static function association($contactid)
{
// Defaults
$html = '';
// Get the associations
if ($associations = JLanguageAssociations::getAssociations('com_contact', '#__contact_details', 'com_contact.item', $contactid)) {
foreach ($associations as $tag => $associated) {
$associations[$tag] = (int) $associated->id;
}
// Get the associated contact items
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select('c.*')->from('#__contact_details as c')->select('cat.title as category_title')->join('LEFT', '#__categories as cat ON cat.id=c.catid')->where('c.id IN (' . implode(',', array_values($associations)) . ')')->join('LEFT', '#__languages as l ON c.language=l.lang_code')->select('l.image')->select('l.title as language_title');
$db->setQuery($query);
try {
$items = $db->loadObjectList('id');
} catch (runtimeException $e) {
throw new Exception($e->getMessage(), 500);
return false;
}
$flags = array();
// Construct html
foreach ($associations as $tag => $associated) {
if ($associated != $contactid) {
$flags[] = JText::sprintf('COM_CONTACT_TIP_ASSOCIATED_LANGUAGE', JHtml::_('image', 'mod_languages/' . $items[$associated]->image . '.gif', $items[$associated]->language_title, array('title' => $items[$associated]->language_title), true), $items[$associated]->name, $items[$associated]->category_title);
}
}
$html = JHtml::_('tooltip', implode('<br />', $flags), JText::_('COM_CONTACT_TIP_ASSOCIATION'), 'admin/icon-16-links.png');
}
return $html;
}
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:37,代码来源:contact.php
示例3: display
/**
* Display the view.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
// Initialise variables.
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
if ($this->getLayout() == 'modal') {
// If we are forcing a language in modal (used for associations).
if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) {
// Set the language field to the forcedLanguage and disable changing it.
$this->form->setValue('language', null, $forcedLanguage);
$this->form->setFieldAttribute('language', 'readonly', 'true');
// Only allow to select categories with All language or with the forced language.
$this->form->setFieldAttribute('catid', 'language', '*,' . $forcedLanguage);
// Only allow to select tags with All language or with the forced language.
$this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage);
}
} elseif ($this->item->id && $this->form->getValue('language', null, '*') != '*' && JLanguageAssociations::isEnabled() && count($this->item->associations) > 0) {
$this->form->setFieldAttribute('language', 'readonly', 'true');
}
$this->addToolbar();
return parent::display($tpl);
}
开发者ID:eshiol,项目名称:joomla-cms,代码行数:35,代码来源:view.html.php
示例4: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 11.1
*/
protected function getOptions()
{
$options = array();
foreach ($this->element->children() as $option) {
// Only add <option /> elements.
if ($option->getName() != 'option') {
continue;
}
// Filter requirements
if ($requires = explode(',', (string) $option['requires'])) {
// Requires multilanguage
if (in_array('multilanguage', $requires) && !JLanguageMultilang::isEnabled()) {
continue;
}
// Requires associations
if (in_array('associations', $requires) && !JLanguageAssociations::isEnabled()) {
continue;
}
}
$value = (string) $option['value'];
$disabled = (string) $option['disabled'];
$disabled = $disabled == 'true' || $disabled == 'disabled' || $disabled == '1';
$disabled = $disabled || $this->readonly && $value != $this->value;
// Create a new option object based on the <option /> element.
$tmp = JHtml::_('select.option', $value, JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', trim((string) $option))), 'value', 'text', $disabled);
// Set some option attributes.
$tmp->class = (string) $option['class'];
// Set some JavaScript option attributes.
$tmp->onclick = (string) $option['onclick'];
// Add the option object to the result set.
$options[] = $tmp;
}
reset($options);
return $options;
}
开发者ID:kosir,项目名称:wp-pipes,代码行数:42,代码来源:list.php
示例5: getAssociations
/**
* Method to get the associations for a given item
*
* @param integer $id Id of the item
* @param string $view Name of the view
*
* @return array Array of associations for the item
*
* @since 3.0
*/
public static function getAssociations($id = 0, $view = null)
{
jimport('helper.route', JPATH_COMPONENT_SITE);
$app = JFactory::getApplication();
$jinput = $app->input;
$view = is_null($view) ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
if ($view == 'article') {
if ($id) {
$associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $id);
$return = array();
foreach ($associations as $tag => $item) {
$return[$tag] = TZ_PortfolioHelperRoute::getArticleRoute($item->id, $item->catid, $item->language);
}
return $return;
}
} elseif ($view == 'p_article') {
if ($id) {
$associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $id);
$return = array();
foreach ($associations as $tag => $item) {
$return[$tag] = TZ_PortfolioHelperRoute::getPortfolioArticleRoute($item->id, $item->catid, $item->language);
}
return $return;
}
}
if ($view == 'category' || $view == 'categories') {
return self::getCategoryAssociations($id, 'com_content');
}
return array();
}
开发者ID:Glonum,项目名称:tz_portfolio,代码行数:41,代码来源:association.php
示例6: association
/**
* Get the associated language flags
*
* @param int $newsfeedid The item id to search associations
*
* @return string The language HTML
*/
public static function association($newsfeedid)
{
// Defaults
$html = '';
// Get the associations
if ($associations = JLanguageAssociations::getAssociations('com_newsfeeds', '#__newsfeeds', 'com_newsfeeds.item', $newsfeedid)) {
foreach ($associations as $tag => $associated) {
$associations[$tag] = (int) $associated->id;
}
// Get the associated newsfeed items
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select('c.id, c.name as title')->select('l.sef as lang_sef')->from('#__newsfeeds as c')->select('cat.title as category_title')->join('LEFT', '#__categories as cat ON cat.id=c.catid')->where('c.id IN (' . implode(',', array_values($associations)) . ')')->join('LEFT', '#__languages as l ON c.language=l.lang_code')->select('l.image')->select('l.title as language_title');
$db->setQuery($query);
try {
$items = $db->loadObjectList('id');
} catch (RuntimeException $e) {
throw new Exception($e->getMessage(), 500);
}
if ($items) {
foreach ($items as &$item) {
$text = strtoupper($item->lang_sef);
$url = JRoute::_('index.php?option=com_newsfeeds&task=newsfeed.edit&id=' . (int) $item->id);
$tooltipParts = array(JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array('title' => $item->language_title), true), $item->title, '(' . $item->category_title . ')');
$item->link = JHtml::_('tooltip', implode(' ', $tooltipParts), null, null, $text, $url, null, 'hasTooltip label label-association label-' . $item->lang_sef);
}
}
$html = JLayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:37,代码来源:newsfeed.php
示例7: preprocessForm
/**
* Auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
* @since 3.0
*/
protected function preprocessForm(JForm $form, $data, $group = 'jevents')
{
// Association content items
$app = JFactory::getApplication();
$assoc = false && JLanguageAssociations::isEnabled() && JFactory::getApplication()->isAdmin();
if ($assoc) {
$languages = JLanguageHelper::getLanguages('lang_code');
$addform = new SimpleXMLElement('<form />');
$fields = $addform->addChild('fields');
$fields->addAttribute('name', 'associations');
$fieldset = $fields->addChild('fieldset');
$fieldset->addAttribute('name', 'item_associations');
$fieldset->addAttribute('description', 'COM_JEVENTS_ITEM_ASSOCIATIONS_FIELDSET_DESC');
$add = false;
foreach ($languages as $tag => $language) {
if (empty($data->language) || $tag != $data->language) {
$add = true;
$field = $fieldset->addChild('field');
$field->addAttribute('name', $tag);
$field->addAttribute('type', 'modal_article');
$field->addAttribute('language', $tag);
$field->addAttribute('label', $language->title);
$field->addAttribute('translate_label', 'false');
$field->addAttribute('edit', 'true');
$field->addAttribute('clear', 'true');
}
}
if ($add) {
$form->load($addform, false);
}
}
parent::preprocessForm($form, $data, $group);
}
开发者ID:site4com,项目名称:prometheus,代码行数:41,代码来源:icalevent.php
示例8: association
/**
* Get the associated language flags
*
* @param integer $contactid The item id to search associations
*
* @return string The language HTML
*
* @throws Exception
*/
public static function association($contactid)
{
// Defaults
$html = '';
// Get the associations
if ($associations = JLanguageAssociations::getAssociations('com_contact', '#__contact_details', 'com_contact.item', $contactid)) {
foreach ($associations as $tag => $associated) {
$associations[$tag] = (int) $associated->id;
}
// Get the associated contact items
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select('c.id, c.name as title')->select('l.sef as lang_sef, lang_code')->from('#__contact_details as c')->select('cat.title as category_title')->join('LEFT', '#__categories as cat ON cat.id=c.catid')->where('c.id IN (' . implode(',', array_values($associations)) . ')')->join('LEFT', '#__languages as l ON c.language=l.lang_code')->select('l.image')->select('l.title as language_title');
$db->setQuery($query);
try {
$items = $db->loadObjectList('id');
} catch (RuntimeException $e) {
throw new Exception($e->getMessage(), 500, $e);
}
if ($items) {
foreach ($items as &$item) {
$text = strtoupper($item->lang_sef);
$url = JRoute::_('index.php?option=com_contact&task=contact.edit&id=' . (int) $item->id);
$tooltip = $item->title . '<br />' . JText::sprintf('JCATEGORY_SPRINTF', $item->category_title);
$classes = 'hasPopover label label-association label-' . $item->lang_sef;
$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes . '" data-content="' . $tooltip . '" data-placement="top">' . $text . '</a>';
}
}
JHtml::_('bootstrap.popover');
$html = JLayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
开发者ID:eshiol,项目名称:joomla-cms,代码行数:41,代码来源:contact.php
示例9: display
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*
* @since 1.6
*/
public function display($tpl = null)
{
$user = JFactory::getUser();
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->modules = $this->get('Modules');
$this->levels = $this->get('ViewLevels');
$this->state = $this->get('State');
$this->canDo = JHelperContent::getActions('com_menus', 'menu', (int) $this->state->get('item.menutypeid'));
// Check if we're allowed to edit this item
// No need to check for create, because then the moduletype select is empty
if (!empty($this->item->id) && !$this->canDo->get('core.edit')) {
throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
if ($this->getLayout() == 'modal') {
// If we are forcing a language in modal (used for associations).
if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) {
// Set the language field to the forcedLanguage and disable changing it.
$this->form->setValue('language', null, $forcedLanguage);
$this->form->setFieldAttribute('language', 'readonly', 'true');
// Only allow to select categories with All language or with the forced language.
$this->form->setFieldAttribute('parent_id', 'language', '*,' . $forcedLanguage);
}
} elseif ($this->item->id && $this->form->getValue('language', null, '*') != '*' && JLanguageAssociations::isEnabled() && count($this->item->associations) > 0) {
$this->form->setFieldAttribute('language', 'readonly', 'true');
}
parent::display($tpl);
$this->addToolbar();
}
开发者ID:eshiol,项目名称:joomla-cms,代码行数:43,代码来源:view.html.php
示例10: getAssociations
/**
* Gets a list of associations for a given item.
*
* @param integer $pk Content item key.
* @param string $extension Optional extension name.
*
* @return array of associations.
*/
public static function getAssociations($pk, $extension = 'com_content')
{
$langAssociations = JLanguageAssociations::getAssociations($extension, '#__categories', 'com_categories.item', $pk, 'id', 'alias', '');
$associations = array();
foreach ($langAssociations as $langAssociation) {
$associations[$langAssociation->language] = $langAssociation->id;
}
return $associations;
}
开发者ID:ITPrism,项目名称:GamificationDistribution,代码行数:17,代码来源:categories.php
示例11: getLabel
/**
* Method to get the field label markup.
*
* @return string The field label markup.
*
* @since 2.5.5
*/
protected function getLabel()
{
$label = '';
if ($this->hidden) {
return $label;
}
// Get the label text from the XML element, defaulting to the element name.
$text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name'];
$text = $this->translateLabel ? JText::_($text) : $text;
// Set required to true as this field is not displayed at all if not required.
$this->required = true;
// Add CSS and JS for the TOS field
$doc = JFactory::getDocument();
$css = "#jform_profile_tos {width: 18em; margin: 0 !important; padding: 0 2px !important;}\n\t\t\t\t#jform_profile_tos input {margin:0 5px 0 0 !important; width:10px !important;}\n\t\t\t\t#jform_profile_tos label {margin:0 15px 0 0 !important; width:auto;}\n\t\t\t\t";
$doc->addStyleDeclaration($css);
JHtml::_('behavior.modal');
// Build the class for the label.
$class = !empty($this->description) ? 'hasTooltip' : '';
$class = $class . ' required';
$class = !empty($this->labelClass) ? $class . ' ' . $this->labelClass : $class;
// Add the opening label tag and main attributes attributes.
$label .= '<label id="' . $this->id . '-lbl" for="' . $this->id . '" class="' . $class . '"';
// If a description is specified, use it to build a tooltip.
if (!empty($this->description)) {
$label .= ' title="' . htmlspecialchars(trim($text, ':') . '<br />' . ($this->translateDescription ? JText::_($this->description) : $this->description), ENT_COMPAT, 'UTF-8') . '"';
}
$tosarticle = $this->element['article'] > 0 ? (int) $this->element['article'] : 0;
if ($tosarticle) {
JLoader::register('ContentHelperRoute', JPATH_BASE . '/components/com_content/helpers/route.php');
$attribs = array();
$attribs['class'] = 'modal';
$attribs['rel'] = '{handler: \'iframe\', size: {x:800, y:500}}';
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id, alias, catid, language')->from('#__content')->where('id = ' . $tosarticle);
$db->setQuery($query);
$article = $db->loadObject();
if (JLanguageAssociations::isEnabled()) {
$tosassociated = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $tosarticle);
}
$current_lang = JFactory::getLanguage()->getTag();
if (isset($tosassociated) && $current_lang != $article->language && array_key_exists($current_lang, $tosassociated)) {
$url = ContentHelperRoute::getArticleRoute($tosassociated[$current_lang]->id, $tosassociated[$current_lang]->catid);
$link = JHtml::_('link', JRoute::_($url . '&tmpl=component&lang=' . $tosassociated[$current_lang]->language), $text, $attribs);
} else {
$slug = $article->alias ? $article->id . ':' . $article->alias : $article->id;
$url = ContentHelperRoute::getArticleRoute($slug, $article->catid);
$link = JHtml::_('link', JRoute::_($url . '&tmpl=component&lang=' . $article->language), $text, $attribs);
}
} else {
$link = $text;
}
// Add the label text and closing tag.
$label .= '>' . $link . '<span class="star"> *</span></label>';
return $label;
}
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:63,代码来源:tos.php
示例12: __construct
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array('id', 'a.id', 'name', 'a.name', 'groups', 'a.groups', 'site', 'a.site', 'work_start', 'a.work_start');
if (JLanguageAssociations::isEnabled()) {
$config['filter_fields'][] = 'association';
}
}
parent::__construct($config);
}
开发者ID:Caojunkai,项目名称:working,代码行数:18,代码来源:welders.php
示例13: __construct
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array('id', 'a.id', 'num', 'a.num', 'model', 'a.model', 'position', 'a.position', 'use_time', 'a.use_time', 'weld_time', 'a.weld_time', 'times', 'welder_name');
if (JLanguageAssociations::isEnabled()) {
$config['filter_fields'][] = 'association';
}
}
parent::__construct($config);
}
开发者ID:Caojunkai,项目名称:working,代码行数:18,代码来源:machines.php
示例14: __construct
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @since 1.6
* @see JController
*/
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array('id', 'a.id', 'title', 'a.title', 'alias', 'a.alias', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', 'catid', 'a.catid', 'category_title', 'state', 'a.state', 'access', 'a.access', 'access_level', 'created', 'a.created', 'created_by', 'a.created_by', 'created_by_alias', 'a.created_by_alias', 'ordering', 'a.ordering', 'featured', 'a.featured', 'language', 'a.language', 'hits', 'a.hits', 'publish_up', 'a.publish_up', 'publish_down', 'a.publish_down', 'published', 'a.published', 'author_id', 'category_id', 'level', 'tag');
if (JLanguageAssociations::isEnabled()) {
$config['filter_fields'][] = 'association';
}
}
parent::__construct($config);
}
开发者ID:densem-2013,项目名称:exikom,代码行数:18,代码来源:articles.php
示例15: __construct
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array('id', 'a.id', 'num', 'a.num', 'brand', 'a.brand');
if (JLanguageAssociations::isEnabled()) {
$config['filter_fields'][] = 'association';
}
}
parent::__construct($config);
}
开发者ID:Caojunkai,项目名称:working,代码行数:18,代码来源:gases.php
示例16: __construct
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @see JController
* @since 1.7.0
*/
public function __construct($config = [])
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = ['id', 'a.id', 'name', 'a.name', 'alias', 'a.alias', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', 'user_id', 'a.user_id', 'published', 'a.published', 'access', 'a.access', 'access_level', 'created', 'a.created', 'created_by', 'a.created_by', 'ordering', 'a.ordering', 'language', 'a.language', 'publish_up', 'a.publish_up', 'publish_down', 'a.publish_down', 'ul.name', 'linked_user', 'tag', 'level', 'c.level'];
$assoc = JLanguageAssociations::isEnabled();
if ($assoc) {
$config['filter_fields'][] = 'association';
}
}
parent::__construct($config);
}
开发者ID:Joomla-Bible-Study,项目名称:joomla_churchdirectory,代码行数:19,代码来源:positions.php
示例17: store
public function store($updateNulls = false)
{
if (is_array($this->params)) {
$registry = new JRegistry();
$registry->loadArray($this->params);
$this->params = (string) $registry;
}
$date = JFactory::getDate();
$user = JFactory::getUser();
$db = JFactory::getDBO();
$db->setQuery('SELECT username FROM #__users WHERE id=' . $this->userid);
$this->alias = $db->loadResult();
$this->alias = JApplication::stringURLSafe($this->alias);
$table = JTable::getInstance('Author', 'AuthorListTable');
if (!$this->userid) {
$this->setError(JText::_('COM_AUTHORLIST_STORE_ERROR_USER_REQUIRED'));
return false;
}
if ($table->load(array('userid' => $this->userid)) && ($table->id != $this->id || $this->id == 0)) {
$app = JFactory::getApplication();
$assoc = JLanguageAssociations::isEnabled();
if ($assoc) {
if ($table->language == $this->language || $this->language == '*' || $table->language == '*') {
$this->setError(JText::_('COM_AUTHORLIST_STORE_ERROR_AUTHOR_EXISTS_LANGUAGE'));
return false;
}
} else {
$this->setError(JText::_('COM_AUTHORLIST_STORE_ERROR_AUTHOR_EXISTS'));
return false;
}
}
if (!$this->id) {
if (!intval($this->created)) {
$this->created = $date->toSql();
}
if (empty($this->created_by)) {
$this->created_by = $user->get('id');
}
// Include user into the Editor Group
$db->setQuery('SELECT user_id FROM #__user_usergroup_map WHERE user_id = ' . $this->userid . ' AND group_id = 3');
if (!$db->loadResult()) {
$db->setQuery('INSERT INTO `#__user_usergroup_map` (`user_id`,`group_id`) VALUES (' . $this->userid . ',3)');
$db->query();
}
}
return parent::store($updateNulls);
}
开发者ID:jasonrgd,项目名称:Digital-Publishing-Platform-Joomla,代码行数:47,代码来源:author.php
示例18: getAssociationsForm
public static function getAssociationsForm($id, $name, $config = array())
{
$addform = new SimpleXMLElement('<form />');
$fields = $addform->addChild('fields');
$fields->addAttribute('name', $name);
$fieldset = $fields->addChild('fieldset');
$fieldset->addAttribute('name', 'item_associations');
$fieldset->addAttribute('description', 'COM_CONTENT_ITEM_ASSOCIATIONS_FIELDSET_DESC');
$fieldset->addAttribute('addfieldpath', '/administrator/components/com_content/models/fields');
$hasForm = false;
$languages = JLanguageHelper::getLanguages('lang_code');
foreach ($languages as $tag => $language) {
if (empty($config['language']) || $tag != $config['language']) {
$hasForm = true;
$f = $fieldset->addChild('field');
$f->addAttribute('name', $tag);
$f->addAttribute('type', 'modal_article');
$f->addAttribute('language', $tag);
$f->addAttribute('label', $language->title);
$f->addAttribute('translate_label', 'false');
}
}
$form = JForm::getInstance($id, $addform->asXML());
if ($hasForm) {
$form->load($addform, false);
$associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $config['pk']);
if (count($associations)) {
foreach ($associations as $tag => $association) {
$form->setValue($tag, $name, $association->id);
}
}
if ($config['translate_id'] && isset($config['translate'])) {
$form->setValue($config['translate'], $name, $config['translate_id']);
}
}
// Render Form
$fields = $form->getFieldset('item_associations');
$form = '';
foreach ($fields as $f) {
$form .= '<div class="control-group"><div class="control-label">' . $f->label . '</div><div class="controls">' . $f->input . '</div></div>';
}
return $form;
}
开发者ID:hamby,项目名称:SEBLOD,代码行数:43,代码来源:helper.php
示例19: getAssociations
/**
* Method to get the associations for a given item
*
* @param integer $id Id of the item
* @param string $view Name of the view
*
* @return array Array of associations for the item
*
* @since 3.0
*/
public static function getAssociations($id = 0, $view = null)
{
$jinput = JFactory::getApplication()->input;
$view = $view === null ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
if ($view === 'contact') {
if ($id) {
$associations = JLanguageAssociations::getAssociations('com_contact', '#__contact_details', 'com_contact.item', $id);
$return = array();
foreach ($associations as $tag => $item) {
$return[$tag] = ContactHelperRoute::getContactRoute($item->id, (int) $item->catid, $item->language);
}
return $return;
}
}
if ($view === 'category' || $view === 'categories') {
return self::getCategoryAssociations($id, 'com_contact');
}
return array();
}
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:30,代码来源:association.php
示例20: getAssociations
public static function getAssociations($id = 0, $view = null)
{
jimport('helper.route', JPATH_COMPONENT_SITE);
$app = JFactory::getApplication();
$jinput = $app->input;
$view = is_null($view) ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
if ($view == 'author') {
if ($id) {
$associations = JLanguageAssociations::getAssociations('com_authorlist', '#__authorlist', 'com_authorlist.author', $id, 'id', '', '');
$return = array();
foreach ($associations as $tag => $item) {
$author_slug = AuthorListHelperRoute::getAuthorSlug($item->id);
$return[$tag] = AuthorListHelperRoute::getAuthorRoute($author_slug, $item->language);
}
return $return;
}
}
return array();
}
开发者ID:jasonrgd,项目名称:Digital-Publishing-Platform-Joomla,代码行数:20,代码来源:association.php
注:本文中的JLanguageAssociations类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论