setName() public method

public setName ( $p_name )
Example #1
0
 public function testToArray()
 {
     $alias = new Alias();
     $alias->setName('name');
     $alias->setDescription('description');
     $alias->setPackage('bootstrap');
     $alias->setVersion('version');
     $alias->setSource('source');
     $this->assertSame(['name' => 'name', 'description' => 'description', 'package' => 'bootstrap', 'version' => 'version', 'source' => 'source'], $alias->toArray());
 }
Example #2
0
$correct = true;
$errorMsgs = array();

if (empty($f_name)) {
	$correct = false;
	$errorMsgs[] = getGS('You must fill in the $1 field.', '<B>Name</B>');
}

$alias = new Alias($f_alias_id);
$aliases = 0;
if ($correct) {
	if ($alias->getName() != $f_name) {
		$aliasDups = count(Alias::GetAliases(null, null, $f_name));
		if ($aliasDups <= 0) {
			$success = $alias->setName($f_name);
			if ($success) {
				$logtext = getGS('The site alias for publication "$1" has been modified to "$2".',
								 $publicationObj->getName(), $f_name);
				Log::Message($logtext, $g_user->getUserId(), 153);
			}
		}
		else {
			$errorMsgs[] = getGS('Another alias with the same name exists already.');
			$correct = false;
		}
	}
}

if ($correct) {
	camp_html_goto_page("/$ADMIN/pub/aliases.php?Pub=$f_publication_id&Alias=$f_alias_id");