当前位置: 首页>>代码示例>>PHP>>正文


PHP Sample::add_location方法代码示例

本文整理汇总了PHP中Sample::add_location方法的典型用法代码示例。如果您正苦于以下问题:PHP Sample::add_location方法的具体用法?PHP Sample::add_location怎么用?PHP Sample::add_location使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sample的用法示例。


在下文中一共展示了Sample::add_location方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: move

 /**
  * @throws SampleIDMissingException
  * @throws SampleSecurityAccessDeniedException
  */
 public static function move()
 {
     global $user, $sample_security;
     if ($_GET['sample_id']) {
         if ($sample_security->is_access(2, false)) {
             $sample_id = $_GET['sample_id'];
             $sample = new Sample($sample_id);
             if ($_GET['nextpage'] == 1) {
                 if (is_numeric($_POST['location'])) {
                     $page_1_passed = true;
                 } else {
                     $page_1_passed = false;
                     $error = "You must select a location.";
                 }
             } elseif ($_GET['nextpage'] > 1) {
                 $page_1_passed = true;
             } else {
                 $page_1_passed = false;
                 $error = "";
             }
             if ($page_1_passed == false) {
                 $template = new HTMLTemplate("sample/move.html");
                 $paramquery = $_GET;
                 $paramquery['nextpage'] = "1";
                 $params = http_build_query($paramquery, '', '&');
                 $template->set_var("params", $params);
                 $template->set_var("error", $error);
                 $result = array();
                 $counter = 0;
                 $sample_location_array = Location::list_entries();
                 if (is_array($sample_location_array) and count($sample_location_array) >= 1) {
                     foreach ($sample_location_array as $key => $value) {
                         $sample_location_obj = new Location($value);
                         $result[$counter]['value'] = $value;
                         $result[$counter]['content'] = $sample_location_obj->get_name(true);
                         $counter++;
                     }
                 } else {
                     $result[$counter]['value'] = "0";
                     $result[$counter]['content'] = "NO LOCATIONS FOUND!";
                 }
                 $template->set_var("option", $result);
                 $template->output();
             } else {
                 $paramquery = $_GET;
                 unset($paramquery['nextpage']);
                 $paramquery['run'] = "detail";
                 $params = http_build_query($paramquery);
                 if ($sample->add_location($_POST['location'])) {
                     Common_IO::step_proceed($params, "Move Sample", "Operation Successful", null);
                 } else {
                     Common_IO::step_proceed($params, "Move Sample", "Operation Failed", null);
                 }
             }
         } else {
             throw new SampleSecurityAccessDeniedException();
         }
     } else {
         throw new SampleIDMissingException();
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:65,代码来源:sample.io.php


注:本文中的Sample::add_location方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。