本文整理汇总了PHP中Sample::list_user_related_samples方法的典型用法代码示例。如果您正苦于以下问题:PHP Sample::list_user_related_samples方法的具体用法?PHP Sample::list_user_related_samples怎么用?PHP Sample::list_user_related_samples使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sample
的用法示例。
在下文中一共展示了Sample::list_user_related_samples方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
public static function search()
{
global $user, $session;
if ($_GET['nextpage']) {
if ($_GET['sortvalue'] and $_GET['sortmethod']) {
if ($_GET['nextpage'] == "2" and $_POST['string']) {
$string = $_POST['string'];
$item_type_array = $session->read_value("SEARCH_DATA_ITEM_TYPE");
$sample_id_array = $session->read_value("SEARCH_DATA_SAMPLE_ID");
} else {
$string = $session->read_value("SEARCH_DATA_STRING");
$item_type_array = $session->read_value("SEARCH_DATA_ITEM_TYPE");
$sample_id_array = $session->read_value("SEARCH_DATA_SAMPLE_ID");
}
} else {
if ($_GET['page']) {
$string = $session->read_value("SEARCH_DATA_STRING");
$item_type_array = $session->read_value("SEARCH_DATA_ITEM_TYPE");
$sample_id_array = $session->read_value("SEARCH_DATA_SAMPLE_ID");
} else {
if ($_GET['nextpage'] == "1") {
$string = $_POST['string'];
$session->delete_value("SEARCH_DATA_STRING");
$session->delete_value("SEARCH_DATA_ITEM_TYPE");
$session->delete_value("SEARCH_DATA_SAMPLE_ID");
} else {
$string = $_POST['string'];
$item_type_array = $session->read_value("SEARCH_DATA_ITEM_TYPE");
$sample_id_array = $session->read_value("SEARCH_DATA_SAMPLE_ID");
}
}
}
$no_error = true;
} else {
$no_error = false;
}
if ($no_error == false) {
$template = new HTMLTemplate("sample/search/data_search.html");
$template->set_var("error", "");
$paramquery = $_GET;
unset($paramquery['page']);
$paramquery['nextpage'] = "1";
$params = http_build_query($paramquery, '', '&');
$template->set_var("params", $params);
$result = array();
$counter = 0;
$sample_array = Sample::list_user_related_samples($user->get_user_id(), false);
if (is_array($sample_array)) {
foreach ($sample_array as $key => $value) {
$sample = new Sample($value);
$result[$counter]['value'] = $value;
$result[$counter]['content'] = $sample->get_name();
$result[$counter]['selected'] = "";
$counter++;
}
}
$template->set_var("sample_array", $result);
$result = array();
$counter = 0;
$item_type_array = Item::list_types();
if (is_array($item_type_array)) {
foreach ($item_type_array as $key => $value) {
if (class_exists($value)) {
if ($value::get_sql_select_array($key) != null) {
$result[$counter]['title'] = $value::get_generic_name($key, null);
$result[$counter]['name'] = "item-" . $key;
$result[$counter]['value'] = $key;
$result[$counter]['checked'] = "checked='checked'";
$counter++;
}
}
}
}
$template->set_var("item_type_array", $result);
$template->output();
} else {
if (!$sample_id_array) {
if ($_POST['sample_id'] == 0) {
$sample_id_array = array();
$tmp_id_array = Sample::list_user_related_samples($user->get_user_id(), false);
if (is_array($tmp_id_array) and count($tmp_id_array) >= 1) {
foreach ($tmp_id_array as $key => $value) {
array_push($sample_id_array, $value);
}
}
} else {
$sample_id_array = array();
$sample_id_array[0] = $_POST['sample_id'];
$sample = new Sample($_POST['sample_id']);
$search_name = $sample->get_name();
}
} else {
if (count($sample_id_array) == 1) {
$sample = new Sample($sample_id_array[0]);
$search_name = $sample->get_name();
} else {
$search_name = "All";
}
}
if (!$item_type_array) {
//.........这里部分代码省略.........
示例2: 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();
}
示例3: get_content
//.........这里部分代码省略.........
$is_value = false;
$is_sample = false;
foreach ($required_array as $key => $value) {
if ($value['xml_element'] == "item") {
if ($value['type'] == "value") {
$is_value = true;
} elseif ($value['type'] == "parentsample") {
$is_sample = true;
$sample_count++;
}
}
if ($value['xml_element'] == "type" and !$value['close'] and $is_value == true) {
$value_type_id = $value['id'];
}
}
if ($is_value == true xor $is_sample == true) {
if ($is_value == true) {
$template = new HTMLTemplate("sample/new_sample_page_4_value.html");
require_once "core/modules/data/io/value_form.io.php";
$value_form_io = new ValueFormIO(null, $value_type_id, null, $sample_template_data_array);
$value_form_io->set_field_class("SampleCreateAssistantField");
$template->set_var("content", $value_form_io->get_content());
$template->set_var("template_data_type_id", $value_type_id);
return $template->get_string();
} else {
$template = new HTMLTemplate("sample/new_sample_page_4_sample.html");
if ($sample_count > 0) {
$result = array();
if ($sample_add_role == "item" and is_numeric($sample_add_item_holder_id) and class_exists($sample_add_item_holder_class)) {
$item_holder_list_sql = $sample_add_item_holder_class::get_item_list_sql($sample_add_item_holder_id);
if ($item_holder_list_sql) {
$sample_array = Sample::list_samples_by_item_sql_list($item_holder_list_sql);
} else {
$sample_array = Sample::list_user_related_samples($user->get_user_id());
}
} else {
$sample_array = Sample::list_user_related_samples($user->get_user_id());
}
for ($i = 0; $i <= $sample_count - 1; $i++) {
$result[$i]['id'] = $i + 1;
if ($sample_template_data_type == "sample") {
if ($sample_template_data_array['sample-' . $result[$i]['id'] . '']) {
$selected_id = $sample_template_data_array['sample-' . $result[$i]['id'] . ''];
}
}
if (is_array($sample_array) and count($sample_array) >= 1) {
$counter = 0;
foreach ($sample_array as $key => $value) {
$sample = new Sample($value);
$result[$i][$counter]['value'] = $value;
$result[$i][$counter]['content'] = $sample->get_name();
if ($selected_id == $value) {
$result[$i][$counter]['selected'] = "selected";
} else {
$result[$i][$counter]['selected'] = "";
}
$counter++;
}
} else {
$result[$i][0]['value'] = 0;
$result[$i][0]['content'] = "You have no samples";
$result[$i][0]['selected'] = "";
}
unset($selected_id);
}
$template->set_var("sample", $result);