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


PHP JLanguageAssociations::getAssociations方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: getItem

 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         $registry = new JRegistry();
         $registry->loadString($item->metadata);
         $item->metadata = $registry->toArray();
     }
     // Load associated contact items
     $app = JFactory::getApplication();
     $assoc = JLanguageAssociations::isEnabled();
     if ($assoc) {
         $item->associations = array();
         if ($item->id != null) {
             $associations = JLanguageAssociations::getAssociations('com_authorlist', '#__authorlist', 'com_authorlist.author', $item->id, 'id', '', '');
             foreach ($associations as $tag => $association) {
                 $item->associations[$tag] = $association->id;
             }
         }
     }
     // Load item tags
     if (!empty($item->id)) {
         $item->tags = new JHelperTags();
         $item->tags->getTagIds($item->id, 'com_authorlist.author');
     }
     return $item;
 }
开发者ID:jasonrgd,项目名称:Digital-Publishing-Platform-Joomla,代码行数:26,代码来源:author.php

示例6: 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

示例7: 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">&#160;*</span></label>';
     return $label;
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:63,代码来源:tos.php

示例8: 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

示例9: 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

示例10: 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

示例11: association

 /**
  * Render the list of associated items
  * 
  * @param	integer $competitie_id	The competitie item id
  * 
  * @return  string  The language HTML
  */
 public static function association($competitie_id)
 {
     // Get the associations
     // Defaults
     $html = '';
     // Get the associations
     if ($associations = JLanguageAssociations::getAssociations('com_knvbapi', '#__knvbapi_competities', 'com_knvbapi.competitie.item', $competitie_id, 'id', 'alias', 'catid')) {
         foreach ($associations as $tag => $associated) {
             $associations[$tag] = (int) $associated->id;
         }
         // Get the associated menu items
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('a.*');
         $query->from($db->quoteName('#__knvbapi_competities') . ' as a');
         $query->select($db->quoteName('c.title') . ' as category_title');
         $query->join('LEFT', $db->quoteName('#__categories') . ' as c ON ' . $db->quoteName('c.id') . ' = ' . $db->quoteName('a.catid'));
         $query->where($db->quoteName('a.id') . ' IN (' . implode(',', array_values($associations)) . ')');
         $query->join('LEFT', $db->quoteName('#__languages') . ' as l ON ' . $db->quoteName('a.language') . ' = ' . $db->quoteName('l.lang_code'));
         $query->select($db->quoteName('l.image'));
         $query->select($db->quoteName('l.title') . ' as language_title');
         $query->select($db->quoteName('l.sef') . ' as lang_sef');
         $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_knvbapi&task=competitie.edit&id=' . (int) $item->id);
                 $tooltip_parts = array(JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array('title' => $item->language_title), true), $item->name, '(' . $item->category_title . ')');
                 $item->link = JHtml::_('tooltip', implode(' ', $tooltip_parts), null, null, $text, $url, null, 'hasTooltip label label-association label-' . $item->lang_sef);
             }
         }
         $html = JLayoutHelper::render('joomla.content.associations', $items);
     }
     return $html;
 }
开发者ID:esorone,项目名称:efcpw,代码行数:47,代码来源:competitieadministrator.php

示例12: 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 == 'newsfeed') {
         if ($id) {
             $associations = JLanguageAssociations::getAssociations('com_newsfeeds', '#__newsfeeds', 'com_newsfeeds.item', $id);
             $return = array();
             foreach ($associations as $tag => $item) {
                 $return[$tag] = NewsfeedsHelperRoute::getNewsfeedRoute($item->id, (int) $item->catid, $item->language);
             }
             return $return;
         }
     }
     if ($view == 'category' || $view == 'categories') {
         return self::getCategoryAssociations($id, 'com_newsfeeds');
     }
     return array();
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:32,代码来源:association.php

示例13: 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();
             JLoader::register('ContentHelper', JPATH_ADMINISTRATOR . '/components/com_content/helpers/content.php');
             foreach ($associations as $tag => $item) {
                 $return[$tag] = ContentHelperRoute::getArticleRoute($item->id, $item->catid, $item->language);
             }
             return $return;
         }
     }
     if ($view == 'category' || $view == 'categories') {
         return self::getCategoryAssociations($id, 'com_jevents');
     }
     return array();
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:33,代码来源:association.php

示例14: save

 /**
  * Method to save the form data.
  *
  * @param   array  $data  The form data.
  *
  * @return  boolean  True on success.
  *
  * @since   3.2
  */
 public function save($data)
 {
     // Associations are not edited in frontend ATM so we have to inherit them
     if (JLanguageAssociations::isEnabled() && !empty($data['id'])) {
         if ($associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $data['id'])) {
             foreach ($associations as $tag => $associated) {
                 $associations[$tag] = (int) $associated->id;
             }
             $data['associations'] = $associations;
         }
     }
     return parent::save($data);
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:22,代码来源:form.php

示例15: getItem

 /**
  * Method to get a single record.
  *
  * @param   integer    The id of the primary key.
  *
  * @return  mixed  Object on success, false on failure.
  * @since   1.6
  */
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         // Convert the params field to an array.
         $registry = new JRegistry();
         $registry->loadString($item->metadata);
         $item->metadata = $registry->toArray();
         // Convert the images field to an array.
         $registry = new JRegistry();
         $registry->loadString($item->images);
         $item->images = $registry->toArray();
     }
     // Load associated newsfeeds items
     $app = JFactory::getApplication();
     $assoc = JLanguageAssociations::isEnabled();
     if ($assoc) {
         $item->associations = array();
         if ($item->id != null) {
             $associations = JLanguageAssociations::getAssociations('com_newsfeeds', '#__newsfeeds', 'com_newsfeeds.item', $item->id);
             foreach ($associations as $tag => $association) {
                 $item->associations[$tag] = $association->id;
             }
         }
     }
     if (!empty($item->id)) {
         $item->tags = new JHelperTags();
         $item->tags->getTagIds($item->id, 'com_newsfeeds.newsfeed');
         $item->metadata['tags'] = $item->tags;
     }
     return $item;
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:39,代码来源:newsfeed.php


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