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


PHP Sample::set_template_data方法代码示例

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


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

示例1: run

 /**
  * @param string $username
  * @param string $session_id
  * @return string
  */
 public static function run($username, $session_id)
 {
     global $session, $user, $transaction;
     $sample_add_role = $session->read_value("SAMPLE_ADD_ROLE");
     $sample_item_retrace = $session->read_value("SAMPLE_ITEM_RETRACE");
     $sample_item_get_array = $session->read_value("SAMPLE_ITEM_GET_ARRAY");
     $sample_item_keywords = $session->read_value("SAMPLE_ITEM_KEYWORDS");
     $sample_item_description = $session->read_value("SAMPLE_ITEM_DESCRIPTION");
     $sample_organ_unit = $session->read_value("SAMPLE_ORGANISATION_UNIT");
     $sample_template = $session->read_value("SAMPLE_TEMPLATE");
     $sample_name = $session->read_value("SAMPLE_NAME");
     $sample_manufacturer = $session->read_value("SAMPLE_MANUFACTURER_ID");
     $sample_manufacturer_name = $session->read_value("SAMPLE_MANUFACTURER_NAME");
     $sample_location = $session->read_value("SAMPLE_LOCATION");
     $sample_expiry = $session->read_value("SAMPLE_EXPIRY");
     $sample_expiry_warning = $session->read_value("SAMPLE_EXPIRY_WARNING");
     $sample_desc = $session->read_value("SAMPLE_DESCRIPTION");
     $sample_template_data_type = $session->read_value("SAMPLE_TEMPLATE_DATA_TYPE");
     $sample_template_data_type_id = $session->read_value("SAMPLE_TEMPLATE_DATA_TYPE_ID");
     $sample_template_data_array = $session->read_value("SAMPLE_TEMPLATE_DATA_ARRAY");
     $transaction_id = $transaction->begin();
     try {
         $sample = new Sample(null);
         $sample->set_template_data($sample_template_data_type, $sample_template_data_type_id, $sample_template_data_array);
         $sample_id = $sample->create($sample_organ_unit, $sample_template, $sample_name, $sample_manufacturer, $sample_location, $sample_desc, null, $sample_expiry, $sample_expiry_warning);
         if ($sample_add_role == "item" or $sample_add_role == "item_parent") {
             // Special Parent Sample Case
             if ($sample_add_role == "item_parent") {
                 $parent_sample = new Sample($sample_item_get_array['sample_id']);
                 $sample_item_get_array['sample_id'] = $sample_id;
                 $sample_item_get_array['parent_sample'] = "1";
                 $event_item_id = $parent_sample->get_item_id();
             } else {
                 $event_item_id = $sample->get_item_id();
             }
             $post_array = array();
             $post_array['keywords'] = $sample_item_keywords;
             $post_array['description'] = $sample_item_description;
             $item_add_event = new ItemAddEvent($event_item_id, $sample_item_get_array, $post_array, true, "sample");
             $event_handler = new EventHandler($item_add_event);
             if ($event_handler->get_success() == true) {
                 // Nothing
             }
         }
     } catch (BaseException $e) {
         if ($transaction_id != null) {
             $transaction->rollback($transaction_id);
         }
         throw $e;
     }
     $session->delete_value("SAMPLE_ADD_ROLE");
     $session->delete_value("SAMPLE_ADD_ITEM_HOLDER_CLASS");
     $session->delete_value("SAMPLE_ADD_ITEM_HOLDER_ID");
     $session->delete_value("SAMPLE_ITEM_RETRACE");
     $session->delete_value("SAMPLE_ITEM_GET_ARRAY");
     $session->delete_value("SAMPLE_ITEM_KEYWORDS");
     $session->delete_value("SAMPLE_ITEM_DESCRIPTION");
     $session->delete_value("SAMPLE_ITEM_TYPE_ARRAY");
     $session->delete_value("SAMPLE_ORGANISATION_UNIT");
     $session->delete_value("SAMPLE_TEMPLATE");
     $session->delete_value("SAMPLE_NAME");
     $session->delete_value("SAMPLE_MANUFACTURER_ID");
     $session->delete_value("SAMPLE_MANUFACTURER_NAME");
     $session->delete_value("SAMPLE_LOCATION");
     $session->delete_value("SAMPLE_EXPIRY");
     $session->delete_value("SAMPLE_EXPIRY_WARNING");
     $session->delete_value("SAMPLE_DESCRIPTION");
     $session->delete_value("SAMPLE_TEMPLATE_DATA_TYPE");
     $session->delete_value("SAMPLE_TEMPLATE_DATA_TYPE_ID");
     $session->delete_value("SAMPLE_TEMPLATE_DATA_ARRAY");
     if ($sample_add_role == "item" or $sample_add_role == "item_parent") {
         if ($transaction_id != null) {
             $transaction->commit($transaction_id);
         }
         if ($sample_item_retrace) {
             $params = http_build_query(Retrace::resolve_retrace_string($sample_item_retrace), '', '&');
             return "index.php?" . $params;
         } else {
             $paramquery['username'] = $username;
             $paramquery['session_id'] = $session_id;
             $paramquery['nav'] = "home";
             $params = http_build_query($paramquery, '', '&');
             return "index.php?" . $params;
         }
     } else {
         if ($transaction_id != null) {
             $transaction->commit($transaction_id);
         }
         $paramquery = array();
         $paramquery['username'] = $username;
         $paramquery['session_id'] = $session_id;
         $paramquery['nav'] = "sample";
         $paramquery['run'] = "detail";
         $paramquery['sample_id'] = $sample_id;
         $params = http_build_query($paramquery, '', '&');
//.........这里部分代码省略.........
开发者ID:suxinde2009,项目名称:www,代码行数:101,代码来源:sample_create.ajax.php


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