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


PHP Sample::get_owner_id方法代码示例

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


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

示例1: is_access

 /**
  * @see SampleSecurityInterface::is_access()
  * @param integer $intention 1 = Read, 2 = Write
  * @param bool $ignore_admin_status
  * @return bool
  */
 public function is_access($intention, $ignore_admin_status = false)
 {
     global $user;
     if ($this->sample_id) {
         if ($user->is_admin() and $ignore_admin_status == false) {
             return true;
         } else {
             $sample = new Sample($this->sample_id);
             $sample_folder_id = SampleFolder::get_folder_by_sample_id($this->sample_id);
             $sample_folder_data_entity = new DataEntity(Folder::get_data_entity_id_by_folder_id($sample_folder_id));
             if ($sample->get_owner_id() == $user->get_user_id()) {
                 return true;
             } else {
                 $pk = SampleHasUser_Access::get_entry_by_sample_id_and_user_id($this->sample_id, $user->get_user_id());
                 $sample_has_user = new SampleHasUser_Access($pk);
                 if ($intention == 1) {
                     if ($sample_has_user->get_read() == true) {
                         return true;
                     } else {
                         $organisation_unit_array = OrganisationUnit::list_entries_by_user_id($user->get_user_id());
                         if (is_array($organisation_unit_array) and count($organisation_unit_array) >= 1) {
                             foreach ($organisation_unit_array as $key => $value) {
                                 $pk = SampleHasOrganisationUnit_Access::get_entry_by_sample_id_and_organisation_unit_id($this->sample_id, $value);
                                 if (is_numeric($pk)) {
                                     return true;
                                 }
                             }
                         }
                         /*
                         	    					$parent_virtual_folder_array = $sample_folder_data_entity->get_parent_virtual_folder_ids();
                         	    					
                         	    					if (is_array($parent_virtual_folder_array) and count($parent_virtual_folder_array) >= 1)
                         	    					{
                         	    						foreach($parent_virtual_folder_array as $key => $value)
                         	    						{
                         	    							$virtual_folder = new VirtualFolder($value);
                         	    							$parent_folder_id = $virtual_folder->get_parent_folder_id();
                         	    							$folder = Folder::get_instance($parent_folder_id);
                         	    							if ($folder->is_read_access() == true)
                         	    							{
                         	    								return true;
                         	    							}
                         	    						}
                         	    					} */
                         return false;
                     }
                 } else {
                     if ($sample_has_user->get_write() == true) {
                         return true;
                     } else {
                         return false;
                     }
                 }
             }
         }
     } else {
         return null;
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:65,代码来源:sample_security.class.php

示例2: create

 /**
  * Creates a new Sample Folder including Folder
  * @param integer $sample_id
  * @return integer
  */
 public function create($sample_id)
 {
     if (is_numeric($sample_id)) {
         $sample = new Sample($sample_id);
         // Folder
         $sample_folder_id = constant("SAMPLE_FOLDER_ID");
         $folder = new Folder($sample_folder_id);
         $path = new Path($folder->get_path());
         $path->add_element($sample_id);
         $name = $sample->get_name() . " (" . $sample->get_formatted_id() . ")";
         if (($folder_id = parent::create($name, $sample_folder_id, $path->get_path_string(), $sample->get_owner_id(), null)) != null) {
             $sample_has_folder_access = new SampleHasFolder_Access(null);
             if ($sample_has_folder_access->create($sample_id, $folder_id) == null) {
                 return null;
             }
             // Virtual Folders (Event)
             $sample_folder_create_event = new SampleFolderCreateEvent($folder_id);
             $event_handler = new EventHandler($sample_folder_create_event);
             if ($event_handler->get_success() == false) {
                 $this->delete();
                 return false;
             } else {
                 return $folder_id;
             }
         } else {
             return null;
         }
     } else {
         return null;
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:36,代码来源:sample_folder.class.php

示例3: list_organisation_unit_permissions

 /**
  * @param string $json_column_array
  * @param string $json_argument_array
  * @param string $get_array
  * @param string $css_page_id
  * @param string $css_row_sort_id
  * @param string $entries_per_page
  * @param string $page
  * @param string $sortvalue
  * @param string $sortmethod
  * @return string
  * @throws SampleIDMissingException
  * @throws SampleSecurityAccessDeniedException
  */
 public static function list_organisation_unit_permissions($json_column_array, $json_argument_array, $get_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     global $user;
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     $argument_array = json_decode($json_argument_array);
     $sample_id = $argument_array[1];
     if (is_numeric($sample_id)) {
         $sample = new Sample($sample_id);
         if ($sample->get_owner_id() == $user->get_user_id() or $user->is_admin() == true) {
             $list_request = new ListRequest_IO();
             $list_request->set_column_array($json_column_array);
             if (!is_numeric($entries_per_page) or $entries_per_page < 1) {
                 $entries_per_page = 20;
             }
             $list_array = Sample_Wrapper::list_sample_organisation_units($sample_id, $sortvalue, $sortmethod, $page * $entries_per_page - $entries_per_page, $page * $entries_per_page);
             if (is_array($list_array) and count($list_array) >= 1) {
                 foreach ($list_array as $key => $value) {
                     $list_array[$key]['symbol'] = "<img src='images/icons/organisation_unit.png' alt='' style='border:0;' />";
                     if ($list_array[$key]['organisation_unit_id']) {
                         $organisation_unit = new OrganisationUnit($list_array[$key]['organisation_unit_id']);
                     } else {
                         $organisation_unit = new OrganisationUnit(1);
                     }
                     $list_array[$key]['name'] = $organisation_unit->get_name();
                     $delete_paramquery = $_GET;
                     $delete_paramquery['run'] = "admin_permission_ou_delete";
                     $delete_paramquery['id'] = $list_array[$key]['organisation_unit_id'];
                     unset($delete_paramquery['sure']);
                     $delete_params = http_build_query($delete_paramquery, '', '&#38;');
                     $list_array[$key]['delete']['link'] = $delete_params;
                     $list_array[$key]['delete']['content'] = "delete";
                 }
             } else {
                 $list_request->empty_message("<span class='italic'>No results found!</span>");
             }
             $list_request->set_array($list_array);
             return $list_request->get_page($page);
         } else {
             throw new SampleSecurityAccessDeniedException();
         }
     } else {
         throw new SampleIDMissingException();
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:60,代码来源:sample_admin.ajax.php

示例4: 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, '', '&#38;');
             $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, '', '&#38;');
             $template->set_var("location_history_params", $location_history_params);
             $template->output();
         }
     } else {
         throw new SampleIDMissingException();
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:74,代码来源:sample.ajax.php

示例5: ou_permission_delete

 /**
  * @throws SampleIDMissingException
  * @throws SampleSecurityAccessDeniedException
  * @throws SamplePermissionOrganisationUnitIDMissingException
  */
 public static function ou_permission_delete()
 {
     global $user;
     if ($_GET['sample_id']) {
         if ($_GET['id']) {
             $sample_id = $_GET['sample_id'];
             $sample = new Sample($sample_id);
             $sample_security = new SampleSecurity($sample_id);
             if ($sample->get_owner_id() == $user->get_user_id() or $user->is_admin() == true) {
                 if ($_GET['sure'] != "true") {
                     $template = new HTMLTemplate("sample/int_admin/ou_permission_delete.html");
                     $paramquery = $_GET;
                     $paramquery['sure'] = "true";
                     $params = http_build_query($paramquery);
                     $template->set_var("yes_params", $params);
                     $paramquery = $_GET;
                     unset($paramquery['nextpage']);
                     unset($paramquery['sure']);
                     $paramquery['nav'] = "sample";
                     $paramquery['run'] = "admin_permission_ou";
                     $params = http_build_query($paramquery);
                     $template->set_var("no_params", $params);
                     $template->output();
                 } else {
                     $paramquery = $_GET;
                     unset($paramquery['nextpage']);
                     unset($paramquery['sure']);
                     $paramquery['nav'] = "sample";
                     $paramquery['run'] = "admin_permission_ou";
                     $params = http_build_query($paramquery);
                     $entry_id = $sample_security->get_entry_by_organisation_unit_id($_GET['id']);
                     if ($sample_security->delete_organisation_unit($entry_id)) {
                         Common_IO::step_proceed($params, "Delete Sample", "Operation Successful", null);
                     } else {
                         Common_IO::step_proceed($params, "Delete Sample", "Operation Failed", null);
                     }
                 }
             } else {
                 throw new SampleSecurityAccessDeniedException();
             }
         } else {
             throw new SamplePermissionOrganisationUnitIDMissingException();
         }
     } else {
         throw new SampleIDMissingException();
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:52,代码来源:sample_admin.io.php

示例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("&nbsp;", " ", $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_owner_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。