setName() public method

Set the type name for the given language. A new entry in the database will be created if the language did not exist.
public setName ( integer $p_languageId, string $p_value ) : boolean
$p_languageId integer
$p_value string
return boolean
Example #1
0
 /**
  * Set the type name for the given language. A new entry in
  * the database will be created if the language does 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) || $p_languageId == 0) {
         return false;
     }
     $changed = $this->m_metadata->setName($p_languageId, $p_value);
     return $changed;
 }
Example #2
0
	/**
	 * Set the type name for the given language. A new entry in
	 * the database will be created if the language does 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) || $p_languageId == 0) {
			return false;
		}

		$changed = $this->m_metadata->setName($p_languageId, $p_value);

		if ($changed) {
			if (function_exists("camp_load_translation_strings")) {
				camp_load_translation_strings("api");
			}
			$logtext = getGS('Article type "$1" translation updated', $this->m_name);
			Log::Message($logtext, null, 143);
		}
		return $changed;
	} // fn setName
Example #3
0
$errorMsgs = array();
if (empty($f_field_translation_name)) {
	$correct = false;
	$errorMsgs[] = getGS('You must fill in the $1 field.','<B>'.getGS('Name').'</B>');
}

if ($f_field_language_id <= 0) {
	$correct = false;
	$errorMsgs[] = getGS('You must choose a language for the field.');
}

if ($correct) {
	// Translate existing type
	$field = new ArticleTypeField($f_article_type, $f_field_id);
	$created = $field->setName($f_field_language_id, $f_field_translation_name);
	if ($created) {
		camp_html_goto_page("/$ADMIN/article_types/fields/?f_article_type=". $f_article_type);
		exit;
	}
	else {
		$errorMsgs[] = getGS('The translation could not be added.');
	}
}

$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Article Types"), "/$ADMIN/article_types/");
$crumbs[] = array($f_article_type, '');
$crumbs[] = array(getGS("Article type fields"), "/$ADMIN/article_types/fields/?f_article_type=".urlencode($f_article_type));
$crumbs[] = array(getGS("Adding new article type"), "");