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


PHP Sample::get_datetime方法代码示例

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


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

示例1: get_sample_information

 /**
  * @param string $get_array
  * @throws SampleIDMissingException
  */
 public static function get_sample_information($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']);
             $owner = new User($sample->get_owner_id());
             $template = new HTMLTemplate("sample/ajax/detail_information.html");
             $template->set_var("id", $sample->get_formatted_id());
             $template->set_var("name", $sample->get_name());
             $template->set_var("owner", $owner->get_full_name(false));
             $template->set_var("template", $sample->get_template_name());
             $template->set_var("permissions", $sample_security->get_access_string());
             $datetime = new DatetimeHandler($sample->get_datetime());
             $template->set_var("datetime", $datetime->get_datetime());
             if ($sample->get_date_of_expiry()) {
                 $date_of_expiry = new DatetimeHandler($sample->get_date_of_expiry());
                 $template->set_var("date_of_expiry", $date_of_expiry->get_date());
             } else {
                 $template->set_var("date_of_expiry", false);
             }
             if ($sample->get_current_location_name()) {
                 $template->set_var("location", $sample->get_current_location_name());
             } else {
                 $template->set_var("location", false);
             }
             if ($sample->get_manufacturer_id()) {
                 $manufacturer = new Manufacturer($sample->get_manufacturer_id());
                 $template->set_var("manufacturer", $manufacturer->get_name());
             } else {
                 $template->set_var("manufacturer", false);
             }
             if ($sample->get_availability() == true) {
                 $template->set_var("status", "available");
             } else {
                 $template->set_var("status", "not 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);
             }
             $owner_paramquery = array();
             $owner_paramquery['username'] = $_GET['username'];
             $owner_paramquery['session_id'] = $_GET['session_id'];
             $owner_paramquery['nav'] = "sample";
             $owner_paramquery['run'] = "common_dialog";
             $owner_paramquery['dialog'] = "user_detail";
             $owner_paramquery['id'] = $sample->get_owner_id();
             $owner_params = http_build_query($owner_paramquery, '', '&');
             $template->set_var("owner_params", $owner_params);
             $location_history_paramquery = $_GET;
             $location_history_paramquery['run'] = "location_history";
             $location_history_params = http_build_query($location_history_paramquery, '', '&');
             $template->set_var("location_history_params", $location_history_params);
             $template->output();
         }
     } else {
         throw new SampleIDMissingException();
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:74,代码来源:sample.ajax.php

示例2: get_full_report

 /**
  * @return object
  * @throws SampleIDMissingException
  * @throws BaseReportTCPDFClassMissingException
  */
 public static function get_full_report()
 {
     if (class_exists("TCPDF")) {
         if ($_GET['sample_id']) {
             $sample_id = $_GET['sample_id'];
             $sample = new Sample($sample_id);
             $owner = new User($sample->get_owner_id());
             $owner_name = str_replace(" ", " ", $owner->get_full_name(false));
             $paper_size_info_array = PaperSize::get_standard_size();
             $format = array($paper_size_info_array['width'], $paper_size_info_array['height']);
             if ($paper_size_info_array['width'] >= $paper_size_info_array['height']) {
                 $orientation = "L";
             } else {
                 $orientation = "P";
             }
             $pdf = new SamplePDF($sample_id, $sample->get_name(), $orientation, "mm", $format, true, 'UTF-8', false);
             $pdf->SetCreator(PDF_CREATOR);
             $pdf->SetAuthor('Open-LIMS');
             $pdf->SetTitle('Sample Report');
             $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
             $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
             $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
             $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
             $pdf->SetMargins($paper_size_info_array['margin_left'], $paper_size_info_array['margin_top'] * 3, $paper_size_info_array['margin_right']);
             $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
             $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
             $pdf->SetAutoPageBreak(TRUE, $paper_size_info_array['margin_bottom']);
             $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
             $pdf->setLanguageArray($l);
             $pdf->setFontSubsetting(true);
             $pdf->SetFont('dejavusans', '', 14, '', true);
             $pdf->AddPage();
             $print_sample_id = "S" . str_pad($sample_id, 8, '0', STR_PAD_LEFT);
             $pdf->Write(0, '', '', 0, 'L', true, 0, false, false, 0);
             $pdf->SetFillColor(255, 255, 255);
             $pdf->SetTextColor(0, 0, 0);
             $pdf->MultiCell(90, 0, "ID", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(100, 0, $print_sample_id, 1, '', 1, 1, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(90, 0, "Name", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(100, 0, $sample->get_name(), 1, '', 1, 1, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(90, 0, "Type/Template", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(100, 0, $sample->get_template_name(), 1, '', 1, 1, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(90, 0, "Owner", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(100, 0, $owner_name, 1, '', 1, 1, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(90, 0, "Status", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
             if ($sample->get_availability() == true) {
                 $pdf->MultiCell(100, 0, "available", 1, '', 1, 1, '', '', true, 0, false, true, 0);
             } else {
                 $pdf->MultiCell(100, 0, "not available", 1, '', 1, 1, '', '', true, 0, false, true, 0);
             }
             $pdf->MultiCell(90, 0, "Date/Time", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
             $datetime = new DatetimeHandler($sample->get_datetime());
             $pdf->MultiCell(100, 0, $datetime->get_datetime(false), 1, '', 1, 1, '', '', true, 0, false, true, 0);
             if ($sample->get_manufacturer_id()) {
                 $manufacturer = new Manufacturer($sample->get_manufacturer_id());
                 $pdf->MultiCell(90, 0, "Manufacturer", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
                 $pdf->MultiCell(100, 0, $manufacturer->get_name(), 1, '', 1, 1, '', '', true, 0, false, true, 0);
             }
             if ($sample->get_date_of_expiry()) {
                 $pdf->MultiCell(90, 0, "Date of Expiry", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
                 $date_of_expiry = new DatetimeHandler($sample->get_date_of_expiry());
                 $pdf->MultiCell(100, 0, $date_of_expiry->get_date(), 1, '', 1, 1, '', '', true, 0, false, true, 0);
             }
             $module_dialog_array = ModuleDialog::list_dialogs_by_type("item_report");
             if (is_array($module_dialog_array) and count($module_dialog_array) >= 1) {
                 foreach ($module_dialog_array as $key => $value) {
                     if (file_exists($value['class_path'])) {
                         require_once $value['class_path'];
                         if (class_exists($value['class'])) {
                             if (method_exists($value['class'], $value['method'])) {
                                 $sql = " SELECT item_id FROM " . constant("SAMPLE_HAS_ITEM_TABLE") . " WHERE sample_id = " . $_GET['sample_id'] . "";
                                 $pdf = $value['class']::$value['method']($sql, $sample->get_item_id(), $pdf);
                             }
                         }
                     }
                 }
             }
             return $pdf;
         } else {
             throw new SampleIDMissingException();
         }
     } else {
         throw new BaseReportTCPDFClassMissingException();
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:90,代码来源:sample_report.io.php


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