當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FileHelper::getParentId方法代碼示例

本文整理匯總了PHP中FileHelper::getParentId方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileHelper::getParentId方法的具體用法?PHP FileHelper::getParentId怎麽用?PHP FileHelper::getParentId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FileHelper的用法示例。


在下文中一共展示了FileHelper::getParentId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: url_for_parent_directory

 public function url_for_parent_directory($entry, $parent_id = null)
 {
     if (is_array($entry)) {
         $entry = reset($entry);
     }
     if (!is_object($entry)) {
         $entry = new DirectoryEntry($entry);
     }
     $parent_id = $parent_id ?: FileHelper::getParentId($entry->id) ?: $this->context_id;
     $parent_page = $this->getPageForIndex($entry->indexInparent());
     return $this->url_for('document/files/index/' . $parent_id . '/' . $parent_page);
 }
開發者ID:ratbird,項目名稱:hope,代碼行數:12,代碼來源:document_controller.php

示例2: delete_action

 /**
  * Deletes a file.
  *
  * @param String $id Directory entry id of the file to delete
  */
 public function delete_action($id)
 {
     if (!$this->full_access) {
         throw new AccessDeniedException();
     }
     $entry = DirectoryEntry::find($id);
     $parent_id = FileHelper::getParentId($id) ?: $this->context_id;
     $entry->checkAccess();
     if (!Request::isPost()) {
         $question = createQuestion2(_('Soll die Datei wirklich gelöscht werden?'), array(), array(), $this->url_for('document/files/delete/' . $id));
         $this->flash['question'] = $question;
     } elseif (Request::isPost() && Request::submitted('yes')) {
         File::get($entry->directory->id)->unlink($entry->name);
         PageLayout::postMessage(MessageBox::success(_('Die Datei wurde gelöscht.')));
     }
     $this->redirect('document/files/index/' . $parent_id);
 }
開發者ID:ratbird,項目名稱:hope,代碼行數:22,代碼來源:files.php

示例3: delete_action

 /**
  * Deletes a folder.
  *
  * @param String $folder_id Directory entry id of the folder
  */
 public function delete_action($folder_id)
 {
     if (!$this->full_access) {
         throw new AccessDeniedException();
     }
     FileHelper::checkAccess($folder_id);
     $parent_id = FileHelper::getParentId($folder_id) ?: $this->context_id;
     if (!Request::isPost()) {
         $message = $folder_id === 'all' ? _('Soll der gesamte Dateibereich inklusive aller Order und Dateien wirklich gelöscht werden?') : _('Soll der Ordner inklusive aller darin enthaltenen Dateien wirklich gelöscht werden?');
         $question = createQuestion2($message, array(), array(), $this->url_for('document/folder/delete/' . $folder_id));
         $this->flash['question'] = $question;
     } elseif (Request::isPost() && Request::submitted('yes')) {
         if ($folder_id === 'all') {
             $entry = RootDirectory::find($this->context_id);
             foreach ($entry->listFiles() as $file) {
                 $entry->unlink($file->name);
             }
             PageLayout::postMessage(MessageBox::success(_('Der Dateibereich wurde geleert.')));
         } else {
             $entry = DirectoryEntry::find($folder_id);
             $entry->directory->unlink($entry->name);
             PageLayout::postMessage(MessageBox::success(_('Der Ordner wurde gelöscht.')));
         }
     }
     $this->redirect('document/files/index/' . $parent_id);
 }
開發者ID:ratbird,項目名稱:hope,代碼行數:31,代碼來源:folder.php


注:本文中的FileHelper::getParentId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。