本文整理汇总了PHP中Sample::get_item_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Sample::get_item_id方法的具体用法?PHP Sample::get_item_id怎么用?PHP Sample::get_item_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sample
的用法示例。
在下文中一共展示了Sample::get_item_id方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* @see SampleItemFactoryInterface::create()
* @param integer $sample_id
* @param integer $item_id
* @param integer $gid
* @param string $keywords
* @param string $description
* @param bool $parent
* @return bool
*/
public static function create($sample_id, $item_id, $gid, $keywords = null, $description = null, $parent_item_id = null, $parent_sample = false, $parent_is_parent_sample = false)
{
global $transaction;
if ($transaction->is_in_transction() == true) {
$sample = new Sample($sample_id);
$sample_item = new SampleItem($sample_id);
$sample_item->set_gid($gid);
$sample_item->set_parent($parent_sample);
// For parent sample only
$sample_item->set_parent_item_id($parent_item_id);
if ($sample_item->set_item_id($item_id) == false) {
return false;
}
if ($sample_item->link_item() == false) {
return false;
}
if (($class_name = $sample_item->is_classified()) == true) {
if ($sample_item->set_class($class_name) == false) {
return false;
}
}
$description_required = $sample_item->is_description();
$keywords_required = $sample_item->is_keywords();
if ($description_required == true xor $keywords_required == true) {
if ($description_required == false and $keywords_required == true) {
$sample_item->set_information(null, $keywords);
} else {
$sample_item->set_information($description, null);
}
} else {
if ($description_required == true and $keywords_required == true) {
$sample_item->set_information($description, $keywords);
}
}
$item_holder_type_array = Item::list_holders();
$item_holder_id_array = array();
if (is_array($item_holder_type_array) and count($item_holder_type_array) >= 1) {
foreach ($item_holder_type_array as $key => $value) {
$item_holder_id_array[$key] = $value::list_item_holders_by_item_id($sample->get_item_id());
if ($key == "sample" and $parent_is_parent_sample == true) {
$item_holder_id_array[$key] = array_merge($item_holder_id_array[$key], Sample_Wrapper::get_sample_id_and_gid_by_parent_sample_id($sample_id));
}
}
}
$item_holder_add_event = new ItemHolderAddEvent($item_holder_id_array, $sample->get_item_id(), $item_id, $gid);
$event_handler = new EventHandler($item_holder_add_event);
if ($event_handler->get_success() == false) {
return false;
}
return true;
} else {
return false;
}
}
示例2: associate
/**
* @param string $get_array
* @param integer $sample_id
* @return string
* @throws SampleIDMissingException
*/
public static function associate($get_array, $sample_id)
{
global $session;
if ($get_array and is_numeric($sample_id)) {
$_GET = unserialize($get_array);
$post_array = array();
$post_array['keywords'] = $session->read_value("ADD_ITEM_TEMP_KEYWORDS_" . $_GET['idk_unique_id']);
$post_array['description'] = $session->read_value("ADD_ITEM_TEMP_DESCRIPTION_" . $_GET['idk_unique_id']);
$sample = new Sample($sample_id);
$item_add_event = new ItemAddEvent($sample->get_item_id(), $_GET, $post_array, true, "sample");
$event_handler = new EventHandler($item_add_event);
if ($event_handler->get_success() == true) {
if ($_GET['retrace']) {
$params = http_build_query(Retrace::resolve_retrace_string($_GET['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 {
return "0";
}
} else {
throw new SampleIDMissingException();
}
}
示例3: io_handler
//.........这里部分代码省略.........
throw new BaseModuleDialogMethodNotFoundException();
}
} else {
throw new BaseModuleDialogClassNotFoundException();
}
} else {
throw new BaseModuleDialogFileNotFoundException();
}
} else {
throw new BaseModuleDialogNotFoundException();
}
} else {
throw new BaseModuleDialogMissingException();
}
} else {
throw new SampleSecurityAccessDeniedException();
}
break;
// Sub Item Add
// Sub Item Add
case "sub_item_add":
case "sub_item_edit":
if ($sample_security->is_access(2, false) == true) {
if ($_GET['parent']) {
if (is_numeric($_GET['parent_id'])) {
if (is_numeric($_GET['key'])) {
$item_handling_class = Item::get_handling_class_by_type($_GET['parent']);
if (class_exists($item_handling_class)) {
$item_io_handling_class = $item_handling_class::get_item_add_io_handling_class();
if (file_exists("core/modules/" . $item_io_handling_class[0])) {
require_once "core/modules/" . $item_io_handling_class[0];
if (class_exists($item_io_handling_class[1])) {
if ($_GET['run'] == "sub_item_add") {
$item_io_handling_class[1]::item_add_edit_handler("add");
} else {
$item_io_handling_class[1]::item_add_edit_handler("edit");
}
} else {
throw new ItemAddIOClassNotFoundException();
}
} else {
throw new ItemAddIOFileNotFoundException();
}
} else {
throw new ItemHandlerClassNotFoundException();
}
} else {
throw new ItemPositionIDMissingException();
}
} else {
throw new ItemParentIDMissingException();
}
} else {
throw new ItemParentTypeMissingException();
}
} else {
throw new SampleSecurityAccessDeniedException();
}
break;
// Parent Item Lister
// Parent Item Lister
case "parent_item_list":
if ($sample_security->is_access(1, false) == true) {
if ($_GET['dialog']) {
$sample = new Sample($_GET['sample_id']);
$item_id = $sample->get_item_id();
$module_dialog = ModuleDialog::get_by_type_and_internal_name("parent_item_list", $_GET['dialog']);
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'])) {
$module_dialog['class']::$module_dialog['method']($item_id);
} else {
throw new BaseModuleDialogMethodNotFoundException();
}
} else {
throw new BaseModuleDialogClassNotFoundException();
}
} else {
throw new BaseModuleDialogFileNotFoundException();
}
} else {
throw new BaseModuleDialogMissingException();
}
} else {
throw new SampleSecurityAccessDeniedException();
}
break;
// Common Dialogs
// Common Dialogs
case "common_dialog":
require_once "core/modules/base/common.request.php";
CommonRequest::common_dialog();
break;
default:
require_once "io/sample.io.php";
SampleIO::list_user_related_samples();
break;
}
}
示例4: get_requirements
/**
* @see SampleInterface::get_requirements()
* @param boolean $get_fulfilled
* @return array
*/
public function get_requirements($get_fulfilled = true)
{
global $runtime_data;
if ($this->sample_id and $this->sample) {
if ($runtime_data->is_object_data($this, "SAMPLE_" . $this->sample_id . "_REQUIREMENT_ARRAY") == true) {
return $runtime_data->read_object_data($this, "SAMPLE_" . $this->sample_id . "_REQUIREMENT_ARRAY");
} else {
$sample_template = new SampleTemplate($this->sample->get_template_id());
$requirements_array = $sample_template->get_requirements();
$return_array = array();
$parent_item_array = array();
$counter = 0;
$type_counter = 0;
$category_counter = 0;
$fulfilled_counter = 0;
$filter_counter = 0;
$sub_item_counter = 0;
if (is_array($requirements_array) and count($requirements_array) >= 1) {
if ($runtime_data->is_object_data($this, "SAMPLE_" . $this->sample_id . "_FULFILLED_ITEM_TYPE_ARRAY") == true) {
$item_type_array = $runtime_data->read_object_data($this, "SAMPLE_" . $this->sample_id . "_FULFILLED_ITEM_TYPE_ARRAY");
} else {
$item_type_array = Item::list_types();
$runtime_data->write_object_data($this, "SAMPLE_" . $this->sample_id . "_FULFILLED_ITEM_TYPE_ARRAY", $item_type_array);
}
if ($runtime_data->is_object_data($this, "SAMPLE_" . $this->sample_id . "_FULFILLED_ITEM_ARRAY") == true) {
$item_array = $runtime_data->read_object_data($this, "SAMPLE_" . $this->sample_id . "_FULFILLED_ITEM_ARRAY");
} else {
$sample_item = new SampleItem($this->sample_id);
$item_array = $sample_item->get_sample_items_with_pos_id();
$runtime_data->write_object_data($this, "SAMPLE_" . $this->sample_id . "_FULFILLED_ITEM_ARRAY", $item_array);
}
foreach ($requirements_array as $key => $value) {
if ($value['xml_element'] == "item" and !$value['close']) {
$in_item = true;
$return_array[$counter]['element_type'] = "item";
$return_array[$counter]['display'] = true;
$return_array[$counter]['type'] = $value['type'];
$return_array[$counter]['name'] = $value['name'];
$return_array[$counter]['dialog'] = $value['dialog'];
$return_array[$counter]['handling_class'] = Item::get_handling_class_by_type($value['type']);
$return_array[$counter]['requirement'] = $value['requirement'];
if ($value['occurrence']) {
$return_array[$counter]['occurrence'] = $value['occurrence'];
} else {
$return_array[$counter]['occurrence'] = "once";
}
if ($value['pos_id']) {
$pos_id = $value['pos_id'];
$return_array[$counter]['pos_id'] = $value['pos_id'];
} else {
$pos_id = $counter;
$return_array[$counter]['pos_id'] = $counter;
}
if ($value['type'] != "parentsample") {
if (is_array($item_array) and count($item_array) >= 1) {
$item_instance_array = array();
foreach ($item_array as $item_key => $item_value) {
if (is_array($item_type_array) and count($item_type_array) >= 1) {
foreach ($item_type_array as $item_type => $item_handling_class) {
if (class_exists($item_handling_class)) {
if ($item_handling_class::is_kind_of($item_type, $item_value['item_id']) == true and $item_value['pos_id'] == $pos_id and $item_value['pos_id'] !== null and $pos_id !== null) {
$item_instance = $item_handling_class::get_instance_by_item_id($item_value['item_id'], true);
$return_array[$counter]['fulfilled'][$fulfilled_counter]['item_id'] = $item_value['item_id'];
$return_array[$counter]['fulfilled'][$fulfilled_counter]['id'] = $item_instance->get_item_object_id();
$return_array[$counter]['fulfilled'][$fulfilled_counter]['name'] = $item_instance->get_item_object_name();
$item_instance_array[$fulfilled_counter] = $item_instance;
$fulfilled_counter++;
break;
}
}
}
}
}
if ($value['inherit'] == "all" or $force_inherit == true) {
if (is_array($item_instance_array) and count($item_instance_array) >= 1 and $fulfilled_counter >= 1) {
foreach ($item_instance_array as $object_key => $object_value) {
if (is_object($object_value)) {
if ($object_value instanceof ItemHolderInterface) {
$return_array[$counter]['sub_items'][$object_key] = $object_value->get_item_add_information();
}
}
}
}
}
}
} else {
$parent_sample_array = SampleItem::list_sample_id_by_item_id_and_gid_and_parent($this->get_item_id(), $pos_id);
if (is_array($parent_sample_array) and count($parent_sample_array) >= 1) {
foreach ($parent_sample_array as $parent_sample_key => $parent_sample_value) {
$item_instance = new Sample($parent_sample_value);
$return_array[$counter]['fulfilled'][$fulfilled_counter]['item_id'] = $item_instance->get_item_id();
$return_array[$counter]['fulfilled'][$fulfilled_counter]['id'] = $parent_sample_value;
$return_array[$counter]['fulfilled'][$fulfilled_counter]['name'] = $item_instance->get_item_object_name();
$item_instance_array[$fulfilled_counter] = $item_instance;
$fulfilled_counter++;
//.........这里部分代码省略.........
示例5: 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, '', '&');
//.........这里部分代码省略.........
示例6: 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();
}
}