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


PHP Sample::get_template_id方法代码示例

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


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

示例1: associate

 /**
  * @param array $type_array
  * @param array $category_array
  */
 public static function associate($type_array, $category_array)
 {
     global $user, $session;
     $template = new HTMLTemplate("sample/associate.html");
     $template->set_var("username", $_GET['username']);
     $template->set_var("session_id", $_GET['session_id']);
     $template->set_var("get_array", serialize($_GET));
     $result = array();
     $sample_array = Sample::list_user_related_samples($user->get_user_id());
     if (!is_array($type_array) or count($type_array) == 0) {
         $type_array = null;
     }
     if (is_array($sample_array) and count($sample_array) >= 1) {
         $counter = 0;
         foreach ($sample_array as $key => $value) {
             $sample = new Sample($value);
             if ($type_array == null or in_array($sample->get_template_id(), $type_array)) {
                 $result[$counter]['value'] = $value;
                 $result[$counter]['content'] = $sample->get_name();
                 if ($_POST['sample'] == $value) {
                     $result[$counter]['selected'] = "selected";
                 } else {
                     $result[$counter]['selected'] = "";
                 }
                 $counter++;
             }
         }
     } else {
         $result[0]['value'] = 0;
         $result[0]['content'] = "You have no samples";
         $result[0]['selected'] = "";
     }
     $template->set_var("sample", $result);
     $template->output();
 }
开发者ID:suxinde2009,项目名称:www,代码行数:39,代码来源:sample.io.php

示例2: 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

示例3: is_type_or_category

 /**
  * @see ItemListenerInterface::is_type_or_category()
  * @param $category_id
  * @param integer $type_id
  * @param integer $item_id
  * @return bool
  */
 public static function is_type_or_category($category_id, $type_id, $item_id)
 {
     if (is_numeric($type_id)) {
         $sample_id = SampleIsItem_Access::get_entry_by_item_id($item_id);
         $sample = new Sample($sample_id);
         if ($sample->get_template_id() == $type_id) {
             return true;
         } else {
             return false;
         }
     } elseif (is_numeric($category_id)) {
         $sample_id = SampleIsItem_Access::get_entry_by_item_id($item_id);
         $sample = new Sample($sample_id);
         $sample_template = new SampleTemplate($sample->get_template_id());
         if ($sample_template->get_cat_id() == $category_id) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:30,代码来源:sample.class.php


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