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


PHP collection::mount_collection方法代碼示例

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


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

示例1: mountCollection

 /**
  * Mount a collection on a databox
  *
  * @param  Application      $app           The silex application
  * @param  Request          $request       The current HTTP request
  * @param  integer          $databox_id    The requested databox
  * @param  integer          $collection_id The requested collection id
  * @return RedirectResponse
  */
 public function mountCollection(Application $app, Request $request, $databox_id, $collection_id)
 {
     $app['phraseanet.appbox']->get_connection()->beginTransaction();
     try {
         $baseId = \collection::mount_collection($app, $app['phraseanet.appbox']->get_databox($databox_id), $collection_id, $app['authentication']->getUser());
         $othCollSel = (int) $request->request->get("othcollsel") ?: null;
         if (null !== $othCollSel) {
             $query = $app['phraseanet.user-query'];
             $n = 0;
             while ($n < $query->on_base_ids([$othCollSel])->get_total()) {
                 $results = $query->limit($n, 50)->execute()->get_results();
                 foreach ($results as $user) {
                     $app['acl']->get($user)->duplicate_right_from_bas($othCollSel, $baseId);
                 }
                 $n += 50;
             }
         }
         $app['phraseanet.appbox']->get_connection()->commit();
         return $app->redirectPath('admin_database', ['databox_id' => $databox_id, 'mount' => 'ok']);
     } catch (\Exception $e) {
         $app['phraseanet.appbox']->get_connection()->rollBack();
         return $app->redirectPath('admin_database', ['databox_id' => $databox_id, 'mount' => 'ko']);
     }
 }
開發者ID:nlegoff,項目名稱:Phraseanet,代碼行數:33,代碼來源:Databox.php

示例2: mountCollection

 /**
  * Mount a collection on a databox
  *
  * @param  Request $request       The current HTTP request
  * @param  integer $databox_id    The requested databox
  * @param  integer $collection_id The requested collection id
  * @return RedirectResponse
  */
 public function mountCollection(Request $request, $databox_id, $collection_id)
 {
     $connection = $this->getApplicationBox()->get_connection();
     $connection->beginTransaction();
     try {
         /** @var Authenticator $authenticator */
         $authenticator = $this->app->getAuthenticator();
         $baseId = \collection::mount_collection($this->app, $this->findDataboxById($databox_id), $collection_id, $authenticator->getUser());
         $othCollSel = (int) $request->request->get("othcollsel") ?: null;
         if (null !== $othCollSel) {
             $query = $this->createUserQuery();
             $n = 0;
             /** @var ACLProvider $aclProvider */
             $aclProvider = $this->app['acl'];
             while ($n < $query->on_base_ids([$othCollSel])->get_total()) {
                 $results = $query->limit($n, 50)->execute()->get_results();
                 foreach ($results as $user) {
                     $aclProvider->get($user)->duplicate_right_from_bas($othCollSel, $baseId);
                 }
                 $n += 50;
             }
         }
         $connection->commit();
         return $this->app->redirectPath('admin_database', ['databox_id' => $databox_id, 'mount' => 'ok']);
     } catch (\Exception $e) {
         $connection->rollBack();
         return $this->app->redirectPath('admin_database', ['databox_id' => $databox_id, 'mount' => 'ko']);
     }
 }
開發者ID:luisbrito,項目名稱:Phraseanet,代碼行數:37,代碼來源:DataboxController.php


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