本文整理汇总了PHP中Path::get_path_string方法的典型用法代码示例。如果您正苦于以下问题:PHP Path::get_path_string方法的具体用法?PHP Path::get_path_string怎么用?PHP Path::get_path_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path::get_path_string方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_sub_folder
/**
* @see ProjectInterface::get_sub_folder()
* @param integer $folder_id Folder-ID
* @param integer $gid
* @param integer $status_id
* @return string Sub-Folder-Path
*/
public function get_sub_folder($gid, $status_id)
{
if ($this->project_id and $this->project) {
if (is_numeric($gid) and is_numeric($status_id)) {
$folder_id = ProjectStatusFolder::get_folder_by_project_id_and_project_status_id($this->project_id, $status_id);
$folder = Folder::get_instance($folder_id);
$project_template = new ProjectTemplate($this->project->get_template_id());
$attribute_array = $project_template->get_gid_attributes($gid, $status_id);
if ($attribute_array['folder']) {
$folder_name = strtolower(trim($attribute_array['folder']));
$folder_name = str_replace(" ", "-", $folder_name);
$folder_path = new Path($folder->get_path());
$folder_path->add_element($folder_name);
return Folder::get_folder_by_path($folder_path->get_path_string());
} else {
return null;
}
} else {
return null;
}
} else {
return null;
}
}
示例2: add_folder
/**
* @param integer $folder_id
* @param string $folder_name
* @return string
* @throws DataSecurityAccessDeniedException
*/
private static function add_folder($folder_id, $folder_name)
{
global $session;
$internal_name = trim(strtolower(str_replace(" ", "_", $folder_name)));
$base_folder = Folder::get_instance($folder_id);
if ($base_folder->can_add_folder()) {
$path = new Path($base_folder->get_path());
$path->add_element($internal_name);
$folder = Folder::get_instance(null);
if (($folder_id = $folder->create($folder_name, $folder_id, $path->get_path_string(), $session->get_user_id(), null)) == null) {
return "1";
} else {
return "0";
}
} else {
throw new DataSecurityAccessDeniedException();
}
}
示例3: 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;
}
}
示例4: get_sub_folder
/**
* @see SampleInterface::get_sub_folder()
* @param integer $folder_id Folder-ID
* @param integer $gid
* @return string Sub-Folder-Path
*/
public function get_sub_folder($folder_id, $gid)
{
if ($this->sample_id and $this->sample) {
if (is_numeric($folder_id) and is_numeric($gid)) {
$sample_folder_id = SampleFolder::get_folder_by_sample_id($this->sample_id);
if ($folder_id == $sample_folder_id) {
$folder = Folder::get_instance($folder_id);
$sample_template = new SampleTemplate($this->sample->get_template_id());
$attribute_array = $sample_template->get_gid_attributes($gid);
if ($attribute_array['folder']) {
$folder_name = strtolower(trim($attribute_array['folder']));
$folder_name = str_replace(" ", "-", $folder_name);
$folder_path = new Path($folder->get_path());
$folder_path->add_element($folder_name);
return Folder::get_folder_by_path($folder_path->get_path_string());
} else {
return null;
}
} else {
return null;
}
} else {
return null;
}
} else {
return null;
}
}
示例5: create
/**
* Creates a new Project Folder including Folder
* @param integer $project_id
* @return integer
*/
public function create($project_id, $base_folder_id)
{
if (is_numeric($project_id)) {
$project = new Project($project_id);
// Folder
if ($base_folder_id == null) {
$project_folder_id = constant("PROJECT_FOLDER_ID");
} else {
$project_folder_id = $base_folder_id;
}
$folder = new Folder($project_folder_id);
$path = new Path($folder->get_path());
$path->add_element($project_id);
if (($folder_id = parent::create($project->get_name(), $project_folder_id, $path->get_path_string(), $project->get_owner_id(), null)) != null) {
$project_has_folder_access = new ProjectHasFolder_Access(null);
if ($project_has_folder_access->create($project_id, $folder_id) == null) {
return null;
}
// Virtual Folder
$project_folder_create_event = new ProjectFolderCreateEvent($folder_id);
$event_handler = new EventHandler($project_folder_create_event);
if ($event_handler->get_success() == false) {
$this->delete();
return false;
} else {
return $folder_id;
}
} else {
return null;
}
} else {
return null;
}
}
示例6: create
/**
* @param integer $group_id
* @return bool
*/
public function create($group_id)
{
global $transaction;
if (is_numeric($group_id)) {
$group = new Group($group_id);
// Folder
$group_folder_id = constant("GROUP_FOLDER_ID");
$folder = new Folder($group_folder_id);
$path = new Path($folder->get_path());
$path->add_element($group_id);
$folder = new Folder(null);
if (($folder_id = parent::create($group->get_name(), $group_folder_id, $path->get_path_string(), 1, $group_id)) != null) {
$folder_is_group_folder_access = new FolderIsGroupFolder_Access(null);
if ($folder_is_group_folder_access->create($group_id, $folder_id) == null) {
return false;
}
// Virtual Folders (Event)
$group_folder_create_event = new GroupFolderCreateEvent($folder_id);
$event_handler = new EventHandler($group_folder_create_event);
if ($event_handler->get_success() == false) {
$this->delete();
return false;
} else {
return true;
}
} else {
return false;
}
} else {
return false;
}
}
示例7: create
/**
* @param integer $organisation_unit_id
* @return bool
*/
public function create($organisation_unit_id)
{
if (is_numeric($organisation_unit_id)) {
$organisation_unit = new OrganisationUnit($organisation_unit_id);
// Folder
$organisation_unit_folder_id = constant("ORGANISATION_UNIT_FOLDER_ID");
$folder = new Folder($organisation_unit_folder_id);
$path = new Path($folder->get_path());
$path->add_element($organisation_unit_id);
$folder = new Folder(null);
if (($folder_id = parent::create($organisation_unit->get_name(), $organisation_unit_folder_id, $path->get_path_string(), $organisation_unit->get_master_owner_id(), null)) != null) {
$folder_is_organisation_unit_folder_access = new FolderIsOrganisationUnitFolder_Access(null);
if ($folder_is_organisation_unit_folder_access->create($organisation_unit_id, $folder_id) == null) {
return false;
}
// Virtual Folders (Event)
$organisation_unit_folder_create_event = new OrganisationUnitFolderCreateEvent($folder_id);
$event_handler = new EventHandler($organisation_unit_folder_create_event);
if ($event_handler->get_success() == false) {
$this->delete();
return false;
} else {
return true;
}
} else {
$this->delete(true, true);
return false;
}
} else {
return false;
}
}
示例8: move_folder
/**
* @see FolderInterface::move_folder()
* @param integer $destination_id
* @param bool $force_exist_check
* @return bool
*/
public function move_folder($destination_id, $force_exist_check)
{
global $session, $transaction;
if ($this->folder_id and $this->folder and is_numeric($destination_id)) {
$destination_folder = Folder::get_instance($destination_id);
if ($destination_folder->exist_subfolder_name($this->get_name()) == false or $force_exist_check == true) {
$transaction_id = $transaction->begin();
$current_path = new Path($this->get_path());
$destination_path = new Path($destination_folder->get_path());
$destination_path->add_element($current_path->get_last_element());
$new_path = $destination_path->get_path_string();
// create new folder
if (mkdir(constant("BASE_DIR") . "/" . $new_path) == false) {
if ($transaction_id != null) {
$transaction->rollback($transaction_id);
}
return false;
}
// change database
if ($this->folder->set_path($new_path) == false) {
if ($transaction_id != null) {
$transaction->rollback($transaction_id);
}
rmdir(constant("BASE_DIR") . "/" . $new_path);
return false;
}
if ($this->unset_child_of($this->get_parent_folder()) == false) {
if ($transaction_id != null) {
$transaction->rollback($transaction_id);
}
rmdir(constant("BASE_DIR") . "/" . $new_path);
return false;
}
if ($this->set_as_child_of($destination_folder->get_data_entity_id()) == false) {
if ($transaction_id != null) {
$transaction->rollback($transaction_id);
}
rmdir(constant("BASE_DIR") . "/" . $new_path);
return false;
}
// subfolder filesystem move
if (($subfolder_array = $this->get_subfolder_array()) != null) {
if (is_array($subfolder_array) and count($subfolder_array) >= 1) {
foreach ($subfolder_array as $key => $value) {
$folder = Folder::get_instance($value);
if ($folder->move_folder($this->folder_id, true) == false) {
if ($transaction_id != null) {
$transaction->rollback($transaction_id);
}
return false;
}
}
}
}
// Move Files
$handle = opendir(constant("BASE_DIR") . "/" . $current_path->get_path_string());
while (($file_name = readdir($handle)) !== false) {
if ($file_name != "." and $file_name != "..") {
$current_file = constant("BASE_DIR") . "/" . $current_path->get_path_string() . "/" . $file_name;
$destination_file = constant("BASE_DIR") . "/" . $new_path . "/" . $file_name;
copy($current_file, $destination_file);
unlink($current_file);
}
}
closedir($handle);
rmdir(constant("BASE_DIR") . "/" . $current_path->get_path_string());
// Delete Folder Stack
$session->delete_value("stack_array");
if ($transaction_id != null) {
$transaction->commit($transaction_id);
}
return true;
} else {
return false;
}
} else {
return false;
}
}
示例9: create
/**
* Creates a new Project Folder including Folder
* @param integer $project_id
* @return integer
*/
public function create($project_id, $project_status_id)
{
if (is_numeric($project_id) and is_numeric($project_status_id)) {
$project_status = new ProjectStatus($project_status_id);
$project = new Project($project_id);
$project_folder_id = ProjectFolder::get_folder_by_project_id($project_id);
$folder = new Folder($project_folder_id);
$path = new Path($folder->get_path());
$path->add_element("status-" . $project_status_id);
if (($folder_id = parent::create($project_status->get_name(), $project_folder_id, $path->get_path_string(), $project->get_owner_id(), null)) != null) {
$project_status_has_folder_access = new ProjectStatusHasFolder_Access(null);
if ($project_status_has_folder_access->create($project_id, $project_status_id, $folder_id) == null) {
return null;
}
return $folder_id;
} else {
return null;
}
} else {
return null;
}
}
示例10: create
/**
* @param integer $user_id
* @return bool
*/
public function create($user_id)
{
if (is_numeric($user_id)) {
$user = new User($user_id);
// Folder
$user_folder_id = constant("USER_FOLDER_ID");
$folder = new Folder($user_folder_id);
$path = new Path($folder->get_path());
$path->add_element($user_id);
if (($folder_id = parent::create($user->get_username(), $user_folder_id, $path->get_path_string(), $user_id, null)) != null) {
$folder_is_user_folder_access = new FolderIsUserFolder_Access(null);
if ($folder_is_user_folder_access->create($user_id, $folder_id) == null) {
return false;
}
// _Public
$public_path = new Path($path->get_path_string());
$public_path->add_element("_public");
$public_folder = new Folder(null);
if ($public_folder->create("_public", $folder_id, $public_path->get_path_string(), $user_id, null) == null) {
$this->delete();
return false;
}
// _Private
$private_path = new Path($path->get_path_string());
$private_path->add_element("_private");
$private_folder = new Folder(null);
if ($private_folder->create("_private", $folder_id, $private_path->get_path_string(), $user_id, null) == null) {
$this->delete();
return false;
}
// Virtual Folders (Event)
$user_folder_create_event = new UserFolderCreateEvent($folder_id);
$event_handler = new EventHandler($user_folder_create_event);
if ($event_handler->get_success() == false) {
$this->delete();
return false;
} else {
return true;
}
} else {
return false;
}
} else {
return false;
}
}