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


PHP Sample::get_requirements方法代码示例

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


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

示例1: get_sample_menu

 /**
  * @param string $get_array
  * @throws SampleIDMissingException
  */
 public static function get_sample_menu($get_array)
 {
     global $user;
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     if ($_GET['sample_id']) {
         $sample_security = new SampleSecurity($_GET['sample_id']);
         if ($sample_security->is_access(1, false)) {
             $sample = new Sample($_GET['sample_id']);
             $template = new HTMLTemplate("sample/ajax/detail_menu.html");
             if ($sample->get_availability() == true) {
                 $template->set_var("new_status", "not available");
             } else {
                 $template->set_var("new_status", "available");
             }
             if ($sample->get_owner_id() == $user->get_user_id() or $user->is_admin() == true) {
                 $template->set_var("is_owner", true);
             } else {
                 $template->set_var("is_owner", false);
             }
             if ($user->is_admin() == true) {
                 $template->set_var("is_admin", true);
             } else {
                 $template->set_var("is_admin", false);
             }
             if ($sample_security->is_access(2)) {
                 $sample_template = new SampleTemplate($sample->get_template_id());
                 $current_requirements = $sample->get_requirements();
                 $result = array();
                 $counter = 0;
                 if (is_array($current_requirements) and count($current_requirements) >= 1) {
                     foreach ($current_requirements as $key => $value) {
                         switch ($value['element_type']) {
                             case "item":
                                 $paramquery = array();
                                 $paramquery['username'] = $_GET['username'];
                                 $paramquery['session_id'] = $_GET['session_id'];
                                 $paramquery['nav'] = "sample";
                                 $paramquery['sample_id'] = $_GET['sample_id'];
                                 require_once "core/modules/item/common/item_common.io.php";
                                 $menu_element_array = ItemCommonIO::get_menu_element($value, $key, $counter, $paramquery, "Sample", $_GET['sample_id']);
                                 $result = array_merge($result, $menu_element_array[0]);
                                 $counter = $menu_element_array[1];
                                 break;
                             case "extension":
                                 // Extension implementation in Sample
                                 break;
                         }
                     }
                 }
                 $template->set_var("action", $result);
             } else {
                 $template->set_var("action", "");
             }
             $move_paramquery = $_GET;
             $move_paramquery['run'] = "move";
             unset($move_paramquery['nextpage']);
             $move_params = http_build_query($move_paramquery, '', '&');
             $template->set_var("move_params", $move_params);
             $availability_paramquery = $_GET;
             $availability_paramquery['run'] = "set_availability";
             unset($availability_paramquery['nextpage']);
             $availability_params = http_build_query($availability_paramquery, '', '&');
             $template->set_var("availability_params", $availability_params);
             $rename_paramquery = $_GET;
             $rename_paramquery['run'] = "rename";
             unset($rename_paramquery['nextpage']);
             $rename_params = http_build_query($rename_paramquery, '', '&');
             $template->set_var("rename_params", $rename_params);
             $user_permissions_paramquery = $_GET;
             $user_permissions_paramquery['run'] = "admin_permission_user";
             unset($user_permissions_paramquery['nextpage']);
             $user_permissions_params = http_build_query($user_permissions_paramquery, '', '&');
             $template->set_var("user_permissions_params", $user_permissions_params);
             $ou_permissions_paramquery = $_GET;
             $ou_permissions_paramquery['run'] = "admin_permission_ou";
             unset($ou_permissions_paramquery['nextpage']);
             $ou_permissions_params = http_build_query($ou_permissions_paramquery, '', '&');
             $template->set_var("ou_permissions_params", $ou_permissions_params);
             $delete_paramquery = $_GET;
             $delete_paramquery['run'] = "delete";
             unset($delete_paramquery['nextpage']);
             $delete_params = http_build_query($delete_paramquery, '', '&');
             $template->set_var("delete_params", $delete_params);
             $add_subsample_paramquery = $_GET;
             $add_subsample_paramquery['run'] = "new_subsample";
             unset($add_subsample_paramquery['nextpage']);
             $add_subsample_params = http_build_query($add_subsample_paramquery, '', '&');
             $template->set_var("add_subsample_params", $add_subsample_params);
             $template->output();
         }
     } else {
         throw new SampleIDMissingException();
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:100,代码来源:sample.ajax.php

示例2: item_add_edit_handler

 /**
  * @param string $role
  * @throws ItemParentIDMissingException
  * @throws ItemPositionIDMissingException
  * @throws BaseModuleDialogMethodNotFoundException
  * @throws BaseModuleDialogClassNotFoundException
  * @throws BaseModuleDialogFileNotFoundException
  * @throws BaseModuleDialogNotFoundException
  * @throws SampleSecurityAccessDeniedException
  * @throws BaseModuleDialogMissingException
  */
 public static function item_add_edit_handler($role = "add")
 {
     if ($_GET['dialog']) {
         if (!is_numeric($_GET['parent_id'])) {
             throw new ItemParentIDMissingException();
         }
         if (!is_numeric($_GET['key'])) {
             throw new ItemPositionIDMissingException();
         }
         $sample = new Sample($_GET['parent_id']);
         $sample_security = new SampleSecurity($_GET['parent_id']);
         if ($sample_security->is_access(2, false) == true) {
             if ($role == "add") {
                 $module_dialog = ModuleDialog::get_by_type_and_internal_name("item_add", $_GET['dialog']);
             } elseif ($role == "edit") {
                 $module_dialog = ModuleDialog::get_by_type_and_internal_name("item_edit", $_GET['dialog']);
             }
             if (is_array($module_dialog) and $module_dialog['class_path']) {
                 if (file_exists($module_dialog['class_path'])) {
                     require_once $module_dialog['class_path'];
                     if (class_exists($module_dialog['class'])) {
                         if (method_exists($module_dialog['class'], $module_dialog['method'])) {
                             $sample_item = new SampleItem($_GET['parent_id']);
                             $sample_item->set_gid($_GET['key']);
                             $current_requirements = $sample->get_requirements();
                             if ($role == "add") {
                                 $module_dialog['class']::$module_dialog['method']($current_requirements[$_GET['key']]['type_id'], $current_requirements[$_GET['key']]['category_id'], "Sample", $_GET['parent_id'], $_GET['key']);
                             } elseif ($role == "edit") {
                                 $module_dialog['class']::$module_dialog['method']($current_requirements[$_GET['key']]['fulfilled'][0]['item_id']);
                             }
                         } else {
                             throw new BaseModuleDialogMethodNotFoundException();
                         }
                     } else {
                         throw new BaseModuleDialogClassNotFoundException();
                     }
                 } else {
                     throw new BaseModuleDialogFileNotFoundException();
                 }
             } else {
                 throw new BaseModuleDialogNotFoundException();
             }
         } else {
             throw new SampleSecurityAccessDeniedException();
         }
     } else {
         throw new BaseModuleDialogMissingException();
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:60,代码来源:sample.request.php


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