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