本文整理汇总了PHP中Sample::set_name方法的典型用法代码示例。如果您正苦于以下问题:PHP Sample::set_name方法的具体用法?PHP Sample::set_name怎么用?PHP Sample::set_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sample
的用法示例。
在下文中一共展示了Sample::set_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rename
/**
* @throws SampleIDMissingException
* @throws SampleSecurityAccessDeniedException
*/
public static function rename()
{
global $user;
if ($_GET['sample_id']) {
$sample_id = $_GET['sample_id'];
$sample = new Sample($sample_id);
if ($sample->get_owner_id() == $user->get_user_id() or $user->is_admin() == true) {
if ($_GET['nextpage'] == 1) {
if ($_POST['name']) {
$page_1_passed = true;
} else {
$page_1_passed = false;
$error = "You must enter a name";
}
} else {
$page_1_passed = false;
$error = "";
}
if ($page_1_passed == false) {
$template = new HTMLTemplate("sample/int_admin/rename.html");
$paramquery = $_GET;
$paramquery['nextpage'] = "1";
$params = http_build_query($paramquery, '', '&');
$template->set_var("params", $params);
$template->set_var("error", $error);
if ($_POST['name']) {
$template->set_var("name", $_POST['name']);
} else {
$template->set_var("name", trim($sample->get_name()));
}
$template->output();
} else {
$paramquery = $_GET;
unset($paramquery['nextpage']);
$paramquery['run'] = "detail";
$params = http_build_query($paramquery);
if ($sample->set_name($_POST['name'])) {
Common_IO::step_proceed($params, "Rename Sample", "Operation Successful", null);
} else {
Common_IO::step_proceed($params, "Rename Sample", "Operation Failed", null);
}
}
} else {
throw new SampleSecurityAccessDeniedException();
}
} else {
throw new SampleIDMissingException();
}
}