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


PHP JUcmType::getTypeId方法代码示例

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


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

示例1: getQuery

 /**
  * Builds the query for the ordering list.
  *
  * @return  JDatabaseQuery  The query for the ordering form field
  *
  * @since   3.2
  */
 protected function getQuery()
 {
     $categoryId = (int) $this->form->getValue('catid');
     $contentType = (string) $this->element['content_type'];
     $ucmType = new JUcmType();
     $ucmRow = $ucmType->getType($ucmType->getTypeId($contentType));
     $ucmMapCommon = json_decode($ucmRow->field_mappings)->common;
     if (is_object($ucmMapCommon)) {
         $ordering = $ucmMapCommon->core_ordering;
         $title = $ucmMapCommon->core_title;
     } elseif (is_array($ucmMapCommon)) {
         $ordering = $ucmMapCommon[0]->core_ordering;
         $title = $ucmMapCommon[0]->core_title;
     }
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select(array($db->quoteName($ordering, 'value'), $db->quoteName($title, 'text')))->from($db->quoteName(json_decode($ucmRow->table)->special->dbtable))->where($db->quoteName('catid') . ' = ' . (int) $categoryId)->order('ordering');
     return $query;
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:26,代码来源:ordering.php

示例2: addTagMapping

 /**
  * Method to add tag rows to mapping table.
  *
  * @param   integer          $ucmId  ID of the #__ucm_content item being tagged
  * @param   JTableInterface  $table  JTable object being tagged
  * @param   array            $tags   Array of tags to be applied.
  *
  * @return  boolean  true on success, otherwise false.
  *
  * @since   3.1
  */
 public function addTagMapping($ucmId, JTableInterface $table, $tags = array())
 {
     $db = $table->getDbo();
     $key = $table->getKeyName();
     $item = $table->{$key};
     $ucm = new JUcmType($this->typeAlias, $db);
     $typeId = $ucm->getTypeId();
     // Insert the new tag maps
     if (strpos('#', implode(',', $tags)) === false) {
         $tags = self::createTagsFromField($tags);
     }
     // Prevent saving duplicate tags
     $tags = array_unique($tags);
     $query = $db->getQuery(true);
     $query->insert('#__contentitem_tag_map');
     $query->columns(array($db->quoteName('type_alias'), $db->quoteName('core_content_id'), $db->quoteName('content_item_id'), $db->quoteName('tag_id'), $db->quoteName('tag_date'), $db->quoteName('type_id')));
     foreach ($tags as $tag) {
         $query->values($db->quote($this->typeAlias) . ', ' . (int) $ucmId . ', ' . (int) $item . ', ' . $db->quote($tag) . ', ' . $query->currentTimestamp() . ', ' . (int) $typeId);
     }
     $db->setQuery($query);
     return (bool) $db->execute();
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:33,代码来源:tags.php

示例3: addToolbar

 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $extension = JFactory::getApplication()->input->get('extension');
     $user = JFactory::getUser();
     $userId = $user->id;
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     // Check to see if the type exists
     $ucmType = new JUcmType();
     $this->typeId = $ucmType->getTypeId($extension . '.category');
     // Avoid nonsense situation.
     if ($extension == 'com_categories') {
         return;
     }
     // The extension can be in the form com_foo.section
     $parts = explode('.', $extension);
     $component = $parts[0];
     $section = count($parts) > 1 ? $parts[1] : null;
     $componentParams = JComponentHelper::getParams($component);
     // Need to load the menu language file as mod_menu hasn't been loaded yet.
     $lang = JFactory::getLanguage();
     $lang->load($component, JPATH_BASE, null, false, true) || $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, null, false, true);
     // Load the category helper.
     require_once JPATH_COMPONENT . '/helpers/categories.php';
     // Get the results for each action.
     $canDo = $this->canDo;
     // If a component categories title string is present, let's use it.
     if ($lang->hasKey($component_title_key = $component . ($section ? "_{$section}" : '') . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE')) {
         $title = JText::_($component_title_key);
     } elseif ($lang->hasKey($component_section_key = $component . ($section ? "_{$section}" : ''))) {
         $title = JText::sprintf('COM_CATEGORIES_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE', $this->escape(JText::_($component_section_key)));
     } else {
         $title = JText::_('COM_CATEGORIES_CATEGORY_BASE_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE');
     }
     // Load specific css component
     JHtml::_('stylesheet', $component . '/administrator/categories.css', array(), true);
     // Prepare the toolbar.
     JToolbarHelper::title($title, 'folder category-' . ($isNew ? 'add' : 'edit') . ' ' . substr($component, 4) . ($section ? "-{$section}" : '') . '-category-' . ($isNew ? 'add' : 'edit'));
     // For new records, check the create permission.
     if ($isNew && count($user->getAuthorisedCategories($component, 'core.create')) > 0) {
         JToolbarHelper::apply('category.apply');
         JToolbarHelper::save('category.save');
         JToolbarHelper::save2new('category.save2new');
     } elseif (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_user_id == $userId)) {
         JToolbarHelper::apply('category.apply');
         JToolbarHelper::save('category.save');
         if ($canDo->get('core.create')) {
             JToolbarHelper::save2new('category.save2new');
         }
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('category.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('category.cancel');
     } else {
         if ($componentParams->get('save_history', 0) && $user->authorise('core.edit')) {
             $typeAlias = $extension . '.category';
             JToolbarHelper::versions($typeAlias, $this->item->id);
         }
         JToolbarHelper::cancel('category.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     // Compute the ref_key if it does exist in the component
     if (!$lang->hasKey($ref_key = strtoupper($component . ($section ? "_{$section}" : '')) . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_HELP_KEY')) {
         $ref_key = 'JHELP_COMPONENTS_' . strtoupper(substr($component, 4) . ($section ? "_{$section}" : '')) . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT');
     }
     /* Get help for the category/section view for the component by
      * -remotely searching in a language defined dedicated URL: *component*_HELP_URL
      * -locally  searching in a component help file if helpURL param exists in the component and is set to ''
      * -remotely searching in a component URL if helpURL param exists in the component and is NOT set to ''
      */
     if ($lang->hasKey($lang_help_url = strtoupper($component) . '_HELP_URL')) {
         $debug = $lang->setDebug(false);
         $url = JText::_($lang_help_url);
         $lang->setDebug($debug);
     } else {
         $url = null;
     }
     JToolbarHelper::help($ref_key, $componentParams->exists('helpURL'), $url, $component);
 }
开发者ID:N6REJ,项目名称:joomla-cms,代码行数:89,代码来源:view.html.php

示例4: getTypeId

 /**
  * Method to get the type id for a type alias.
  *
  * @param   string  $typeAlias  A type alias.
  *
  * @return  string  Name of the table for a type
  *
  * @since   3.1
  * @deprecated  4.0  Use JUcmType::getTypeId() instead
  */
 public function getTypeId($typeAlias)
 {
     $contentType = new JUcmType();
     return $contentType->getTypeId($typeAlias);
 }
开发者ID:ziyou-liu,项目名称:1line,代码行数:15,代码来源:tags.php

示例5: testGetTypeId

 /**
  * Tests the getTypeId() method
  *
  * @return  void
  *
  * @since   3.2
  */
 public function testGetTypeId()
 {
     $this->assertEquals(1, $this->object->getTypeId('com_content.article'), 'Articles are type_id = 1');
 }
开发者ID:klas,项目名称:joomla-cms,代码行数:11,代码来源:JUcmTypeTest.php


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