当前位置: 首页>>代码示例>>PHP>>正文


PHP collection::get_databox方法代码示例

本文整理汇总了PHP中collection::get_databox方法的典型用法代码示例。如果您正苦于以下问题:PHP collection::get_databox方法的具体用法?PHP collection::get_databox怎么用?PHP collection::get_databox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在collection的用法示例。


在下文中一共展示了collection::get_databox方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addStampConf

    private function addStampConf(\collection $coll)
    {
        $domprefs = new DOMDocument();
        $domprefs->loadXML($coll->get_prefs());
        $prefs = '<?xml version="1.0" encoding="UTF-8"?>
<baseprefs>
    <status>0</status>

    <stamp>
        <logo position="left" width="25%"/>
        <text size="50%">Date: <var name="date"/></text>
        <text size="50%">Record_id: <var name="record_id"/></text>';
        foreach ($coll->get_databox()->get_meta_structure() as $databox_field) {
            $name = $databox_field->get_name();
            $prefs .= '<text size="50%">' . $name . ': <field name="' . $name . '"/></text>' . "\n";
        }
        $prefs .= '</stamp>
    <caninscript>1</caninscript>
    <sugestedValues>
    </sugestedValues>
</baseprefs>';
        $newdom = new DOMDocument();
        $newdom->loadXML($prefs);
        $coll->set_prefs($newdom);
    }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:25,代码来源:imageTest.php

示例2: isCollectionAvailable

 /**
  * Returns true if a collection is available given a configuration.
  *
  * @param \collection $collection
  *
  * @return Boolean
  */
 public function isCollectionAvailable(\collection $collection)
 {
     if (!$this->isRestricted()) {
         return true;
     }
     $availableCollections = $this->cache->fetch('available_collections_' . $collection->get_databox()->get_sbas_id()) ?: [];
     return in_array($collection->get_base_id(), $availableCollections, true);
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:15,代码来源:AccessRestriction.php

示例3: set_collection_order

 /**
  *
  * @param  collection $collection
  * @param  <type>     $ordre
  * @return appbox
  */
 public function set_collection_order(collection $collection, $ordre)
 {
     $sqlupd = "UPDATE bas SET ord = :ordre WHERE base_id = :base_id";
     $stmt = $this->get_connection()->prepare($sqlupd);
     $stmt->execute([':ordre' => $ordre, ':base_id' => $collection->get_base_id()]);
     $stmt->closeCursor();
     $collection->get_databox()->delete_data_from_cache(\databox::CACHE_COLLECTIONS);
     return $this;
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:15,代码来源:appbox.php

示例4: createRecord

 /**
  * Creates a record
  *
  * @param  \collection     $collection  The destination collection
  * @param  string          $pathfile    The file to archive
  * @param  string|null     $captionFile The Phrasea XML caption file or null if no caption file
  * @param  integer         $grp_rid     Add the record to a story
  * @param  integer         $force       Force lazaret or record ; use \Alchemy\Phrasea\Border\Manager::FORCE_* constants
  * @return \record_adapter
  */
 public function createRecord(Application $app, \collection $collection, $pathfile, $captionFile, $grp_rid, $force, $stat0, $stat1)
 {
     $status = \databox_status::operation_or($stat0, $stat1);
     $media = $app->getMediaFromUri($pathfile);
     $databox = $collection->get_databox();
     $metadatasStructure = $databox->get_meta_structure();
     $metadatas = $this->getIndexByFieldName($metadatasStructure, $media->getMetadatas());
     $metaFields = [];
     if ($captionFile !== null && true === $app['filesystem']->exists($captionFile)) {
         $metaFields = $this->readXMLForDatabox($app, $metadatasStructure, $captionFile);
         $captionStatus = $this->parseStatusBit(@simplexml_load_file($captionFile));
         if ($captionStatus) {
             $status = \databox_status::operation_mask($status, $captionStatus);
         }
     }
     $file = new File($app, $media, $collection);
     $file->addAttribute(new BorderAttribute\Status($app, $status));
     $file->addAttribute(new BorderAttribute\Metadata(new Metadata(new PhraseaTag\TfFilepath(), new MonoValue($media->getFile()->getRealPath()))));
     $file->addAttribute(new BorderAttribute\Metadata(new Metadata(new PhraseaTag\TfDirname(), new MonoValue(dirname($media->getFile()->getRealPath())))));
     $file->addAttribute(new BorderAttribute\Metadata(new Metadata(new PhraseaTag\TfAtime(), new MonoValue($media->getFile()->getATime()))));
     $file->addAttribute(new BorderAttribute\Metadata(new Metadata(new PhraseaTag\TfMtime(), new MonoValue($media->getFile()->getMTime()))));
     $file->addAttribute(new BorderAttribute\Metadata(new Metadata(new PhraseaTag\TfCtime(), new MonoValue($media->getFile()->getCTime()))));
     foreach ($metadatas as $meta) {
         $file->addAttribute(new BorderAttribute\Metadata($meta));
     }
     foreach ($metaFields as $metaField) {
         $file->addAttribute($metaField);
     }
     if ($grp_rid) {
         $file->addAttribute(new BorderAttribute\Story(new \record_adapter($app, $databox->get_sbas_id(), $grp_rid)));
     }
     $record = null;
     $postProcess = function ($element, $visa, $code) use(&$record) {
         $record = $element;
     };
     $app['border-manager']->process($this->getLazaretSession($app), $file, $postProcess, $force);
     return $record;
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:48,代码来源:ArchiveJob.php

示例5: testGet_sbas_id

 public function testGet_sbas_id()
 {
     $this->assertTrue(is_int(self::$object->get_sbas_id()));
     $this->assertEquals(self::$object->get_sbas_id(), self::$object->get_databox()->get_sbas_id());
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:5,代码来源:collectionTest.php

示例6: createStory

 /**
  *
  * @param Application $app
  * @param \collection $collection
  *
  * @return \record_adapter
  */
 public static function createStory(Application $app, \collection $collection)
 {
     $databox = $collection->get_databox();
     $sql = 'INSERT INTO record
           (coll_id, record_id, parent_record_id, moddate, credate
             , type, sha256, uuid, originalname, mime)
         VALUES
           (:coll_id, null, :parent_record_id, NOW(), NOW()
           , :type, :sha256, :uuid
           , :originalname, :mime)';
     $stmt = $databox->get_connection()->prepare($sql);
     $stmt->execute([':coll_id' => $collection->get_coll_id(), ':parent_record_id' => 1, ':type' => 'unknown', ':sha256' => null, ':uuid' => \uuid::generate_v4(), ':originalname' => null, ':mime' => null]);
     $story_id = $databox->get_connection()->lastInsertId();
     $story = new self($app, $databox->get_sbas_id(), $story_id);
     try {
         $log_id = $app['phraseanet.logger']($databox)->get_id();
         $sql = 'INSERT INTO log_docs (id, log_id, date, record_id, action, final, comment)
         VALUES (null, :log_id, now(),
           :record_id, "add", :coll_id,"")';
         $stmt = $databox->get_connection()->prepare($sql);
         $stmt->execute([':log_id' => $log_id, ':record_id' => $story_id, ':coll_id' => $collection->get_coll_id()]);
         $stmt->closeCursor();
     } catch (\Exception $e) {
         unset($e);
     }
     return $story;
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:34,代码来源:adapter.php


注:本文中的collection::get_databox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。