本文整理汇总了PHP中Value::get_value_id_by_data_entity_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Value::get_value_id_by_data_entity_id方法的具体用法?PHP Value::get_value_id_by_data_entity_id怎么用?PHP Value::get_value_id_by_data_entity_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Value
的用法示例。
在下文中一共展示了Value::get_value_id_by_data_entity_id方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_description
/**
* @see ProjectInterface::get_description()
* @return string
*/
public function get_description()
{
if ($this->project_id) {
$project_item = new ProjectItem($this->project_id);
$item_array = $project_item->get_project_items();
if (is_array($item_array) and count($item_array) >= 1) {
foreach ($item_array as $item_key => $item_value) {
if (DataEntity::is_kind_of("value", $item_value) == true) {
$data_entity_id = DataEntity::get_entry_by_item_id($item_value);
$value_id = Value::get_value_id_by_data_entity_id($data_entity_id);
if (Value::is_entry_type_of($value_id, 2) == true) {
$description_id = $value_id;
}
}
}
}
$value = Value::get_instance($description_id);
if ($value->get_type_id() == 2) {
return unserialize($value->get_value());
}
} else {
return null;
}
}
示例2: edit_value_item
/**
* @throws ItemIDMissingException
*/
public static function edit_value_item($item_id)
{
if (is_numeric($item_id)) {
$data_entity_id = DataEntity::get_entry_by_item_id($item_id);
$value_id = Value::get_value_id_by_data_entity_id($data_entity_id);
$value = Value::get_instance($value_id);
if ($value->is_read_access()) {
self::detail($value, http_build_query(Retrace::resolve_retrace_string($_GET['retrace'])), false);
}
} else {
throw new ItemIDMissingException();
}
}
示例3: delete
/**
* @see FolderInterface::delete()
* @param bool $recursive
* @param bool $content
* @return bool
*/
public function delete($recursive, $content)
{
global $transaction;
if ($this->folder_id and $this->folder) {
$transaction_id = $transaction->begin();
$subfolder_array = $this->get_subfolder_array();
if (is_array($subfolder_array) and $recursive == false or $content == false and $recursive == true) {
return false;
} else {
if ($recursive == true and $content == true) {
if (is_array($subfolder_array)) {
foreach ($subfolder_array as $key => $value) {
$folder = Folder::get_instance($value);
if ($folder->delete(true, true) == false) {
if ($transaction_id != null) {
$transaction->rollback($transaction_id);
}
return false;
} else {
if ($transaction_id != null) {
// Avoids Ghost-Folders
$transaction->commit($transaction_id);
$transaction_id = $transaction->begin();
}
}
}
}
}
// Folder-Content
$data_entity_array = $this->get_children("without_linked");
if (is_array($data_entity_array) and count($data_entity_array) >= 1) {
foreach ($data_entity_array as $key => $value) {
// Files
if (($file_id = File::get_file_id_by_data_entity_id($value)) != null) {
$file = File::get_instance($file_id);
$file_delete = $file->delete();
if ($file_delete == false) {
if ($transaction_id != null) {
$transaction->rollback($transaction_id);
}
return false;
} else {
if ($transaction_id != null) {
// Avoids Ghost-Files
$transaction->commit($transaction_id);
$transaction_id = $transaction->begin();
}
}
}
// Values
if (($value_id = Value::get_value_id_by_data_entity_id($value)) != null) {
$value_obj = Value::get_instance($value_id);
if ($value_obj->delete() == false) {
if ($transaction_id != null) {
$transaction->rollback($transaction_id);
}
return false;
}
}
// Virtual Folders
if (($virtual_folder_id = VirtualFolder::get_virtual_folder_id_by_data_entity_id($value)) != null) {
$virtual_folder = new VirtualFolder($virtual_folder_id);
if ($virtual_folder->delete() == false) {
if ($transaction_id != null) {
$transaction->rollback($transaction_id);
}
return false;
}
}
}
}
// Linked Folder-Content (e.g. from sub-items)
$data_entity_array = $this->get_children("linked_only");
if (is_array($data_entity_array) and count($data_entity_array) >= 1) {
foreach ($data_entity_array as $key => $value) {
if ($this->unset_child($value) == false) {
if ($transaction_id != null) {
$transaction->rollback($transaction_id);
}
return false;
}
}
}
$path = constant("BASE_DIR") . "/" . $this->folder->get_path();
if (file_exists($path)) {
$garbage_file_array = scandir($path);
if (is_array($garbage_file_array) and count($garbage_file_array) >= 3) {
foreach ($garbage_file_array as $key => $value) {
if ($key != 0 and $key != 1) {
unlink($path . "/" . $value);
}
}
}
}
//.........这里部分代码省略.........
示例4: clone_sample
//.........这里部分代码省略.........
foreach ($source_sample_location_array as $key => $value) {
$current_sample_has_location_access = new SampleHasLocation_Access($value);
$sample_has_location_access = new SampleHasLocation_Access(null);
if ($sample_has_location_access->create($sample_id, $current_sample_has_location_access->get_location_id(), $user->get_user_id()) == null) {
throw new SampleCloneLocationException();
}
}
} else {
$add_new_location = true;
}
if (is_numeric($location_id) and $add_new_location == true and $location_id > 0) {
// Create First Location
$sample_has_location_access = new SampleHasLocation_Access(null);
if ($sample_has_location_access->create($sample_id, $location_id, $user->get_user_id()) == null) {
throw new SampleCloneCreateLocationException("Could not create location");
}
}
if (is_array($value_array) and count($item_array) >= 1) {
$value_item_array = array();
$value_data_array = array();
foreach ($value_array as $key => $value) {
$key = str_replace("value-", "", $key);
$key_array = explode("-", $key, 2);
if ($key_array[0] == "item") {
$value_item_array[$key_array[1]] = $value;
} elseif (is_numeric($key_array[0])) {
$value_data_array[$key_array[0]][$key_array[1]] = $value;
}
}
if (is_array($value_item_array) and count($value_item_array) >= 1) {
foreach ($value_item_array as $key => $value) {
$gid = SampleItem::get_gid_by_item_id_and_sample_id($value, $source_sample_id);
$data_entity_id = DataEntity::get_entry_by_item_id($value);
$value_id = Value::get_value_id_by_data_entity_id($data_entity_id);
if (is_numeric($value_id)) {
$value_obj = Value::get_instance($value_id);
$parent_folder_id = $value_obj->get_parent_folder_id();
$value_type_id = $value_obj->get_type_id();
if ($parent_folder_id == $source_sample_folder_id) {
$new_folder_id = $this->sample_folder_id;
} else {
$folder_name = Folder::get_name_by_id($parent_folder_id);
$new_folder_id = array_search(trim(strtolower($folder_name)), $sub_folder_name_array);
}
if (is_numeric($new_folder_id) and is_numeric($value_type_id)) {
$new_value_obj = Value::get_instance(null);
$new_value_obj->create($new_folder_id, $user->get_user_id(), $value_type_id, $value_data_array[$key]);
$new_value_item_id = $new_value_obj->get_item_id();
$sample_item = new SampleItem($sample_id);
$sample_item->set_gid($gid);
if ($sample_item->set_item_id($new_value_item_id) == false) {
throw new SampleCloneValueException();
}
if ($sample_item->link_item() == false) {
throw new SampleCloneValueException();
}
}
}
}
}
}
if (is_array($item_array) and count($item_array) >= 1) {
$item_type_array = array();
$item_data_array = array();
foreach ($item_array as $key => $value) {
if ($value[1] == "1") {
示例5: listen_events
/**
* @see EventListenerInterface::listen_events()
* @param object $event_object
* @return bool
*/
public static function listen_events($event_object)
{
if ($event_object instanceof ItemUnlinkEvent) {
if (($data_entity_id = DataEntityIsItem_Access::get_entry_by_item_id($event_object->get_item_id())) != null) {
if (($file_id = File::get_file_id_by_data_entity_id($data_entity_id)) != null) {
$file = File::get_instance($file_id);
if ($file->delete() == false) {
return false;
}
}
if (($value_id = Value::get_value_id_by_data_entity_id($data_entity_id)) != null) {
$value = Value::get_instance($value_id);
if ($value->delete() == false) {
return false;
}
}
if (($parameter_id = Parameter::get_parameter_id_by_data_entity_id($data_entity_id)) != null) {
$parameter = Parameter::get_instance($parameter_id);
if ($parameter->delete() == false) {
return false;
}
}
}
}
if ($event_object instanceof UserDeleteEvent) {
if (DataEntity_Access::set_owner_id_on_null($event_object->get_user_id()) == false) {
return true;
}
}
if ($event_object instanceof GroupDeleteEvent) {
if (DataEntity_Access::set_owner_group_id_on_null($event_object->get_group_id()) == false) {
return true;
}
}
return true;
}