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


PHP record_adapter::get_children方法代码示例

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


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

示例1: testChangeStatus

 /**
  * @covers Alchemy\Phrasea\Controller\Prod\Property::changeStatus
  */
 public function testChangeStatus()
 {
     $file = new File(self::$DI['app'], self::$DI['app']['mediavorus']->guess(__DIR__ . '/../../../../../files/cestlafete.jpg'), self::$DI['collection']);
     $record = \record_adapter::createFromFile($file, self::$DI['app']);
     $record2 = \record_adapter::createFromFile($file, self::$DI['app']);
     $story = \record_adapter::createStory(self::$DI['app'], self::$DI['collection']);
     $story->appendChild($record2);
     self::$DI['client']->request('POST', '/prod/records/property/status/', ['apply_to_children' => [$story->get_sbas_id() => true], 'status' => [$record->get_sbas_id() => [6 => true, 8 => true, 11 => true]], 'lst' => implode(';', [$record->get_serialize_key(), $story->get_serialize_key()])]);
     $response = self::$DI['client']->getResponse();
     $datas = (array) json_decode($response->getContent());
     $this->assertArrayHasKey('success', $datas);
     $this->assertTrue($datas['success']);
     $this->assertArrayHasKey('updated', $datas);
     $record = new \record_adapter(self::$DI['app'], $record->get_sbas_id(), $record->get_record_id());
     $story = new \record_adapter(self::$DI['app'], $story->get_sbas_id(), $story->get_record_id());
     $recordStatus = strrev($record->get_status());
     $storyStatus = strrev($story->get_status());
     $this->assertEquals(1, substr($recordStatus, 6, 1));
     $this->assertEquals(1, substr($recordStatus, 8, 1));
     $this->assertEquals(1, substr($recordStatus, 11, 1));
     $this->assertEquals(1, substr($storyStatus, 6, 1));
     $this->assertEquals(1, substr($storyStatus, 8, 1));
     $this->assertEquals(1, substr($storyStatus, 11, 1));
     foreach ($story->get_children() as $child) {
         $childStatus = strrev($child->get_status());
         $this->assertEquals(1, substr($childStatus, 6, 1));
         $this->assertEquals(1, substr($childStatus, 8, 1));
         $this->assertEquals(1, substr($childStatus, 11, 1));
     }
     $record->delete();
     $record2->delete();
     $story->delete();
     unset($response, $datas, $story, $record, $record2, $story, $file);
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:37,代码来源:PropertyTest.php

示例2: testChangeStatus

 /**
  * @covers Alchemy\Phrasea\Controller\Prod\Property::changeStatus
  */
 public function testChangeStatus()
 {
     $file = new File(self::$DI['app'], self::$DI['app']['mediavorus']->guess(__DIR__ . '/../../../../../files/cestlafete.jpg'), self::$DI['collection']);
     $record = \record_adapter::createFromFile($file, self::$DI['app']);
     $record2 = \record_adapter::createFromFile($file, self::$DI['app']);
     $story = \record_adapter::createStory(self::$DI['app'], self::$DI['collection']);
     $story->appendChild($record2);
     $acl = $this->getMockBuilder('ACL')->disableOriginalConstructor()->getMock();
     $acl->expects($this->any())->method('has_access_to_record')->with($this->isInstanceOf('\\record_adapter'))->will($this->returnValue(true));
     $acl->expects($this->any())->method('has_right_on_base')->with($this->isType(\PHPUnit_Framework_Constraint_IsType::TYPE_INT), $this->equalTo('chgstatus'))->will($this->returnValue(true));
     $acl->expects($this->any())->method('has_right_on_sbas')->with($this->isType(\PHPUnit_Framework_Constraint_IsType::TYPE_INT), $this->equalTo('chgstatus'))->will($this->returnValue(true));
     $aclProvider = $this->getMockBuilder('Alchemy\\Phrasea\\Authentication\\ACLProvider')->disableOriginalConstructor()->getMock();
     $aclProvider->expects($this->any())->method('get')->will($this->returnValue($acl));
     self::$DI['app']['acl'] = $aclProvider;
     self::$DI['client']->request('POST', '/prod/records/property/status/', ['apply_to_children' => [$story->get_sbas_id() => true], 'status' => [$record->get_sbas_id() => [6 => true, 8 => true, 11 => true]], 'lst' => implode(';', [$record->get_serialize_key(), $story->get_serialize_key()])]);
     $response = self::$DI['client']->getResponse();
     $datas = (array) json_decode($response->getContent());
     $this->assertArrayHasKey('success', $datas);
     $this->assertTrue($datas['success']);
     $this->assertArrayHasKey('updated', $datas);
     $record = new \record_adapter(self::$DI['app'], $record->get_sbas_id(), $record->get_record_id());
     $story = new \record_adapter(self::$DI['app'], $story->get_sbas_id(), $story->get_record_id());
     $recordStatus = strrev($record->get_status());
     $storyStatus = strrev($story->get_status());
     $this->assertEquals(1, substr($recordStatus, 6, 1));
     $this->assertEquals(1, substr($recordStatus, 8, 1));
     $this->assertEquals(1, substr($recordStatus, 11, 1));
     $this->assertEquals(1, substr($storyStatus, 6, 1));
     $this->assertEquals(1, substr($storyStatus, 8, 1));
     $this->assertEquals(1, substr($storyStatus, 11, 1));
     foreach ($story->get_children() as $child) {
         $childStatus = strrev($child->get_status());
         $this->assertEquals(1, substr($childStatus, 6, 1));
         $this->assertEquals(1, substr($childStatus, 8, 1));
         $this->assertEquals(1, substr($childStatus, 11, 1));
     }
     $record->delete();
     $record2->delete();
     $story->delete();
     unset($response, $datas, $story, $record, $record2, $story, $file);
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:44,代码来源:PropertyTest.php

示例3: load_list

 /**
  *
  * @param array   $lst
  * @param Boolean $flatten_groupings
  *
  * @return set_selection
  */
 public function load_list(array $lst, $flatten_groupings = false)
 {
     foreach ($lst as $basrec) {
         $basrec = explode('_', $basrec);
         if (count($basrec) == 2) {
             try {
                 $record = new record_adapter($this->app, (int) $basrec[0], (int) $basrec[1], count($this->elements));
             } catch (\Exception $e) {
                 continue;
             }
             if ($record->isStory() && $flatten_groupings === true) {
                 foreach ($record->get_children() as $rec) {
                     $this->add_element($rec);
                 }
             } else {
                 $this->add_element($record);
             }
         }
     }
     return $this;
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:28,代码来源:selection.php

示例4: __construct

 /**
  *
  * @param  Application $app
  * @param  string      $lst
  * @param  integer     $sstid
  * @param  integer     $storyWZid
  * @return set_export
  */
 public function __construct(Application $app, $lst, $sstid, $storyWZid = null)
 {
     $this->app = $app;
     $download_list = [];
     $remain_hd = [];
     if ($storyWZid) {
         $repository = $app['EM']->getRepository('\\Entities\\StoryWZ');
         $storyWZ = $repository->findByUserAndId($this->app, $app['authentication']->getUser(), $storyWZid);
         $lst = $storyWZ->getRecord($this->app)->get_serialize_key();
     }
     if ($sstid != "") {
         $repository = $app['EM']->getRepository('Phraseanet:Basket');
         /* @var $repository Alchemy\Phrasea\Model\Repositories\BasketRepository */
         $Basket = $repository->findUserBasket($sstid, $app['authentication']->getUser(), false);
         $this->exportName = str_replace([' ', '\\', '/'], '_', $Basket->getName()) . "_" . date("Y-n-d");
         foreach ($Basket->getElements() as $basket_element) {
             $base_id = $basket_element->getRecord($this->app)->get_base_id();
             $record_id = $basket_element->getRecord($this->app)->get_record_id();
             if (!isset($remain_hd[$base_id])) {
                 if ($app['acl']->get($app['authentication']->getUser())->is_restricted_download($base_id)) {
                     $remain_hd[$base_id] = $app['acl']->get($app['authentication']->getUser())->remaining_download($base_id);
                 } else {
                     $remain_hd[$base_id] = false;
                 }
             }
             $current_element = $download_list[] = new record_exportElement($app, $basket_element->getRecord($this->app)->get_sbas_id(), $record_id, $Basket->getName(), $remain_hd[$base_id]);
             $remain_hd[$base_id] = $current_element->get_remain_hd();
         }
     } else {
         $this->exportName = "Export_" . date("Y-n-d") . '_' . mt_rand(100, 999);
         $tmp_lst = explode(';', $lst);
         $n = 1;
         foreach ($tmp_lst as $basrec) {
             $basrec = explode('_', $basrec);
             if (count($basrec) != 2) {
                 continue;
             }
             try {
                 $record = new record_adapter($this->app, $basrec[0], $basrec[1]);
             } catch (\Exception_Record_AdapterNotFound $e) {
                 continue;
             }
             if ($record->is_grouping()) {
                 foreach ($record->get_children() as $child_basrec) {
                     $base_id = $child_basrec->get_base_id();
                     $record_id = $child_basrec->get_record_id();
                     if (!isset($remain_hd[$base_id])) {
                         if ($app['acl']->get($app['authentication']->getUser())->is_restricted_download($base_id)) {
                             $remain_hd[$base_id] = $app['acl']->get($app['authentication']->getUser())->remaining_download($base_id);
                         } else {
                             $remain_hd[$base_id] = false;
                         }
                     }
                     $current_element = $download_list[] = new record_exportElement($app, $child_basrec->get_sbas_id(), $record_id, $record->get_title(null, null, true) . '_' . $n, $remain_hd[$base_id]);
                     $remain_hd[$base_id] = $current_element->get_remain_hd();
                 }
             } else {
                 $base_id = $record->get_base_id();
                 $record_id = $record->get_record_id();
                 if (!isset($remain_hd[$base_id])) {
                     if ($app['acl']->get($app['authentication']->getUser())->is_restricted_download($base_id)) {
                         $remain_hd[$base_id] = $app['acl']->get($app['authentication']->getUser())->remaining_download($base_id);
                     } else {
                         $remain_hd[$base_id] = false;
                     }
                 }
                 $current_element = $download_list[$basrec[0] . '_' . $basrec[1]] = new record_exportElement($app, $record->get_sbas_id(), $record_id, '', $remain_hd[$base_id]);
                 $remain_hd[$base_id] = $current_element->get_remain_hd();
             }
             $n++;
         }
     }
     $this->elements = $download_list;
     $display_download = [];
     $display_orderable = [];
     $this->total_download = 0;
     $this->total_order = 0;
     $this->total_ftp = 0;
     $this->businessFieldsAccess = false;
     foreach ($this->elements as $download_element) {
         if ($app['acl']->get($app['authentication']->getUser())->has_right_on_base($download_element->get_base_id(), 'canmodifrecord')) {
             $this->businessFieldsAccess = true;
         }
         foreach ($download_element->get_downloadable() as $name => $properties) {
             if (!isset($display_download[$name])) {
                 $display_download[$name] = ['size' => 0, 'total' => 0, 'available' => 0, 'refused' => []];
             }
             $display_download[$name]['total']++;
             if ($properties !== false) {
                 $display_download[$name]['available']++;
                 $display_download[$name]['label'] = $properties['label'];
                 $display_download[$name]['class'] = $properties['class'];
//.........这里部分代码省略.........
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:101,代码来源:export.php

示例5: list_story

 /**
  * Retrieve detailled informations about one story
  *
  * @param \record_adapter $story
  *
  * @return array
  */
 public function list_story(Application $app, Request $request, \record_adapter $story)
 {
     if (!$story->is_grouping()) {
         return Result::createError($request, 404, 'Story not found')->createResponse();
     }
     $that = $this;
     $records = array_map(function (\record_adapter $record) use($that, $app) {
         return $that->list_record($app, $record);
     }, array_values($story->get_children()->get_elements()));
     $caption = $story->get_caption();
     $format = function (\caption_record $caption, $dcField) {
         $field = $caption->get_dc_field($dcField);
         if (!$field) {
             return null;
         }
         return $field->get_serialized_values();
     };
     return ['@entity@' => self::OBJECT_TYPE_STORY, 'databox_id' => $story->get_sbas_id(), 'story_id' => $story->get_record_id(), 'updated_on' => $story->get_modification_date()->format(DATE_ATOM), 'created_on' => $story->get_creation_date()->format(DATE_ATOM), 'collection_id' => \phrasea::collFromBas($app, $story->get_base_id()), 'thumbnail' => $this->list_embedable_media($app, $story, $story->get_thumbnail()), 'uuid' => $story->get_uuid(), 'metadatas' => ['@entity@' => self::OBJECT_TYPE_STORY_METADATA_BAG, 'dc:contributor' => $format($caption, \databox_Field_DCESAbstract::Contributor), 'dc:coverage' => $format($caption, \databox_Field_DCESAbstract::Coverage), 'dc:creator' => $format($caption, \databox_Field_DCESAbstract::Creator), 'dc:date' => $format($caption, \databox_Field_DCESAbstract::Date), 'dc:description' => $format($caption, \databox_Field_DCESAbstract::Description), 'dc:format' => $format($caption, \databox_Field_DCESAbstract::Format), 'dc:identifier' => $format($caption, \databox_Field_DCESAbstract::Identifier), 'dc:language' => $format($caption, \databox_Field_DCESAbstract::Language), 'dc:publisher' => $format($caption, \databox_Field_DCESAbstract::Publisher), 'dc:relation' => $format($caption, \databox_Field_DCESAbstract::Relation), 'dc:rights' => $format($caption, \databox_Field_DCESAbstract::Rights), 'dc:source' => $format($caption, \databox_Field_DCESAbstract::Source), 'dc:subject' => $format($caption, \databox_Field_DCESAbstract::Subject), 'dc:title' => $format($caption, \databox_Field_DCESAbstract::Title), 'dc:type' => $format($caption, \databox_Field_DCESAbstract::Type)], 'records' => $records];
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:26,代码来源:V1.php


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