本文整理汇总了PHP中JHelperContent::getLanguageId方法的典型用法代码示例。如果您正苦于以下问题:PHP JHelperContent::getLanguageId方法的具体用法?PHP JHelperContent::getLanguageId怎么用?PHP JHelperContent::getLanguageId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JHelperContent
的用法示例。
在下文中一共展示了JHelperContent::getLanguageId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store data to the appropriate table
*
* @param array $data Data to be stored
* @param JTableInterface $table JTable Object
* @param boolean $primaryKey Flag that is true for data that are using #__ucm_content as their primary table
*
* @return boolean true on success
*
* @since 3.1
*/
protected function store($data, JTableInterface $table = null, $primaryKey = null)
{
$table = $table ? $table : JTable::getInstance('Corecontent');
$typeId = $this->getType()->type->type_id;
$primaryKey = $primaryKey ? $primaryKey : $this->getPrimaryKey($typeId, $data['core_content_item_id']);
if (!$primaryKey) {
// Store the core UCM mappings
$baseData = array();
$baseData['ucm_type_id'] = $typeId;
$baseData['ucm_item_id'] = $data['core_content_item_id'];
$baseData['ucm_language_id'] = JHelperContent::getLanguageId($data['core_language']);
if (parent::store($baseData)) {
$primaryKey = $this->getPrimaryKey($typeId, $data['core_content_item_id']);
}
}
return parent::store($data, $table, $primaryKey);
}
示例2: storeUcmBase
/**
* Insert or update row in ucm_base table
*
* @param boolean $updateNulls True to update fields even if they are null.
* @param boolean $isNew if true, need to insert. Otherwise update.
*
* @return boolean True on success.
*
* @since 3.1
*/
protected function storeUcmBase($updateNulls = false, $isNew = false)
{
// Store the ucm_base row
$db = $this->getDbo();
$query = $db->getQuery(true);
$languageId = JHelperContent::getLanguageId($this->core_language);
// Selecting "all languages" doesn't give a language id - we can't store a blank string in non mysql databases, so save 0 (the default value)
if (!$languageId) {
$languageId = '0';
}
if ($isNew) {
$query->insert($db->quoteName('#__ucm_base'))->columns(array($db->quoteName('ucm_id'), $db->quoteName('ucm_item_id'), $db->quoteName('ucm_type_id'), $db->quoteName('ucm_language_id')))->values($db->quote($this->core_content_id) . ', ' . $db->quote($this->core_content_item_id) . ', ' . $db->quote($this->core_type_id) . ', ' . $db->quote($languageId));
} else {
$query->update($db->quoteName('#__ucm_base'))->set($db->quoteName('ucm_item_id') . ' = ' . $db->quote($this->core_content_item_id))->set($db->quoteName('ucm_type_id') . ' = ' . $db->quote($this->core_type_id))->set($db->quoteName('ucm_language_id') . ' = ' . $db->quote($languageId))->where($db->quoteName('ucm_id') . ' = ' . $db->quote($this->core_content_id));
}
$db->setQuery($query);
return $db->execute();
}
示例3: mapBase
/**
* Method to map the base ucm fields
*
* @param array $original Data array
* @param JUcmType $type UCM Content Type
*
* @return array Data array of UCM mappings
*
* @since 3.1
*/
public function mapBase($original, JUcmType $type = null)
{
$type = $type ? $type : $this->type;
$data = array('ucm_type_id' => $type->id, 'ucm_item_id' => $original[$type->primary_key], 'ucm_language_id' => JHelperContent::getLanguageId($original['language']));
return $data;
}
示例4: storeUcmBase
/**
* Insert or update row in ucm_base table
*
* @param boolean $updateNulls True to update fields even if they are null.
* @param boolean $isNew if true, need to insert. Otherwise update.
*
* @return boolean True on success.
*
* @since 3.1
*/
protected function storeUcmBase($updateNulls = false, $isNew = false)
{
// Store the ucm_base row
$db = $this->getDbo();
$query = $db->getQuery(true);
$languageId = JHelperContent::getLanguageId($this->core_language);
if ($isNew) {
$query->insert($db->quoteName('#__content_ucm_base'))->columns(array($db->quoteName('ucm_id'), $db->quoteName('ucm_item_id'), $db->quoteName('ucm_type_id'), $db->quoteName('ucm_language_id')))->values($db->quote($this->core_content_id) . ', ' . $db->quote($this->core_content_item_id) . ', ' . $db->quote($this->core_type_id) . ', ' . $db->quote($languageId));
} else {
$query->update($db->quoteName('#__content_ucm_base'))->set($db->quoteName('ucm_item_id') . ' = ' . $db->quote($this->core_content_item_id))->set($db->quoteName('ucm_type_id') . ' = ' . $db->quote($this->core_type_id))->set($db->quoteName('ucm_language_id') . ' = ' . $db->quote($languageId))->where($db->quoteName('ucm_id') . ' = ' . $db->quote($this->core_content_id));
}
$db->setQuery($query);
return $db->execute();
}