本文整理匯總了PHP中Translation::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP Translation::delete方法的具體用法?PHP Translation::delete怎麽用?PHP Translation::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Translation
的用法示例。
在下文中一共展示了Translation::delete方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setName
/**
* Set the type name for the given language. A new entry in
* the database will be created if the language did not exist.
*
* @param int $p_languageId
* @param string $p_value
*
* @return boolean
*/
public function setName($p_languageId, $p_value)
{
global $g_ado_db;
if (!is_numeric($p_languageId)) {
return false;
}
// if the string is empty, nuke it
if (!is_string($p_value) || $p_value == '') {
if ($phrase_id = $this->translationExists($p_languageId)) {
$trans = new Translation($p_languageId, $phrase_id);
$trans->delete();
$changed = true;
} else {
$changed = false;
}
} else {
$description = new Translation($p_languageId, $this->getProperty('fk_phrase_id'));
if ($description->exists()) {
$changed = $description->setText($p_value);
} else {
$changed = $description->create($p_value);
if ($changed && is_null($this->getProperty('fk_phrase_id'))) {
$this->setProperty('fk_phrase_id', $description->getPhraseId());
}
}
}
return $changed;
}
示例2: setName
/**
* Set the type name for the given language. A new entry in
* the database will be created if the language did not exist.
*
* @param int $p_languageId
* @param string $p_value
*
* @return boolean
*/
public function setName($p_languageId, $p_value)
{
global $g_ado_db;
if (!is_numeric($p_languageId)) {
return false;
}
// if the string is empty, nuke it
if (!is_string($p_value) || $p_value == '') {
if ($phrase_id = $this->translationExists($p_languageId)) {
$trans = new Translation($p_languageId, $phrase_id);
$trans->delete();
$changed = true;
} else {
$changed = false;
}
} else {
$description = new Translation($p_languageId, $this->getProperty('fk_phrase_id'));
if ($description->exists()) {
$changed = $description->setText($p_value);
} else {
$changed = $description->create($p_value);
if ($changed && is_null($this->getProperty('fk_phrase_id'))) {
$this->setProperty('fk_phrase_id', $description->getPhraseId());
}
}
}
if ($changed) {
if (function_exists("camp_load_translation_strings")) {
camp_load_translation_strings("api");
}
$logtext = getGS('Field "$1" updated', $this->m_data['field_name']);
Log::Message($logtext, null, 143);
}
return $changed;
} // fn setName