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


PHP record_adapter::get_status方法代码示例

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


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

 public function serialize(\record_adapter $record)
 {
     $technicalInformation = $caption = $business = $status = [];
     foreach ($record->get_technical_infos() as $name => $value) {
         $technicalInformation[$name] = $value;
     }
     foreach ($record->get_caption()->get_fields(null, true) as $field) {
         $isDate = $field->get_databox_field()->get_type() === \databox_field::TYPE_DATE;
         $isBusiness = $field->get_databox_field()->isBusiness();
         $vi = $field->get_values();
         if ($field->is_multi()) {
             $values = [];
             foreach ($vi as $value) {
                 $values[] = $this->sanitizeSerializedValue($value->getValue());
             }
             $value = implode(' ' . $field->get_databox_field()->get_separator(false) . ' ', $values);
         } else {
             $value = $this->sanitizeSerializedValue(array_pop($vi)->getValue());
         }
         if ($isDate) {
             try {
                 $date = new \DateTime($value);
                 $value = $date->format(DATE_ATOM);
             } catch (\Exception $e) {
                 continue;
             }
         }
         if ($isBusiness) {
             $business[$field->get_databox_field()->get_name()] = $value;
         }
         $caption[$field->get_databox_field()->get_name()] = $value;
     }
     $i = 0;
     foreach (preg_split('//', strrev($record->get_status()), -1, PREG_SPLIT_NO_EMPTY) as $val) {
         $status['status-' . $i] = (int) $val;
         $i++;
     }
     return ['databox_id' => $record->get_sbas_id(), 'record_id' => $record->get_record_id(), 'collection_id' => $record->get_collection()->get_coll_id(), 'base_id' => $record->get_base_id(), 'mime_type' => $record->get_mime(), 'title' => $record->get_title(), 'original_name' => $record->get_original_name(), 'updated_on' => $record->get_modification_date()->format(DATE_ATOM), 'created_on' => $record->get_creation_date()->format(DATE_ATOM), 'sha256' => $record->get_sha256(), 'technical_informations' => $technicalInformation, 'phrasea_type' => $record->get_type(), 'type' => $record->is_grouping() ? 'story' : 'record', 'uuid' => $record->get_uuid(), 'caption' => $caption, 'status' => $status, 'caption-business' => $business];
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:39,代码来源:ESRecordSerializer.php

示例4: has_status_access_to_record

 public function has_status_access_to_record(record_adapter $record)
 {
     return 0 === ((bindec($record->get_status()) ^ $this->get_mask_xor($record->get_base_id())) & $this->get_mask_and($record->get_base_id()));
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:4,代码来源:ACL.php

示例5: evaluateRecordsStatusResponse

 protected function evaluateRecordsStatusResponse(\record_adapter $record, $content)
 {
     $statusStructure = $record->get_databox()->getStatusStructure();
     $r_status = strrev($record->get_status());
     $this->assertArrayHasKey('status', $content['response']);
     $this->assertEquals(count((array) $content['response']['status']), count($statusStructure->toArray()));
     foreach ($content['response']['status'] as $status) {
         $this->assertTrue(is_array($status));
         $this->assertArrayHasKey('bit', $status);
         $this->assertArrayHasKey('state', $status);
         $this->assertTrue(is_int($status['bit']));
         $this->assertTrue(is_bool($status['state']));
         $retrieved = !!substr($r_status, $status['bit'], 1);
         $this->assertEquals($retrieved, $status['state']);
     }
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:16,代码来源:ApiTestCase.php

示例6: addRecord

 /**
  * {@inheritdoc}
  */
 public function addRecord(\record_adapter $record)
 {
     if (!$this->rt_conn) {
         throw new RuntimeException('Unable to connect to sphinx real-time index');
     }
     $all_datas = [];
     $status = [];
     $binStatus = strrev($record->get_status());
     for ($i = 4; $i < 32; $i++) {
         if ($binStatus[$i]) {
             $status[] = sprintf("%u", crc32($record->get_databox()->get_sbas_id() . '_' . $i));
         }
     }
     $sql_date_fields = $this->getSqlDateFields($record);
     $indexes = ["metas_realtime" . $this->CRCdatabox($record->get_databox()), "metas_realtime_stemmed_fr_" . $this->CRCdatabox($record->get_databox()), "metas_realtime_stemmed_nl_" . $this->CRCdatabox($record->get_databox()), "metas_realtime_stemmed_de_" . $this->CRCdatabox($record->get_databox()), "metas_realtime_stemmed_en_" . $this->CRCdatabox($record->get_databox())];
     foreach ($record->get_caption()->get_fields(null, true) as $field) {
         if (!$field->is_indexable()) {
             continue;
         }
         if (!$field->get_databox_field()->isBusiness()) {
             $all_datas[] = $field->get_serialized_values();
         }
         foreach ($field->get_values() as $value) {
             foreach ($indexes as $index) {
                 $this->rt_conn->exec("REPLACE INTO " . $index . " VALUES (\n                        '" . $value->getId() . "'\n                        ,'" . str_replace("'", "\\'", $value->getValue()) . "'\n                        ,'" . $value->getDatabox_field()->get_id() . "'\n                        ," . $record->get_record_id() . "\n                        ," . $record->get_sbas_id() . "\n                        ," . $record->get_collection()->get_coll_id() . "\n                        ," . (int) $record->is_grouping() . "\n                        ," . sprintf("%u", crc32($record->get_sbas_id() . '_' . $value->getDatabox_field()->get_id())) . "\n                        ," . sprintf("%u", crc32($record->get_sbas_id() . '_' . $record->get_collection()->get_coll_id())) . "\n                        ," . sprintf("%u", crc32($record->get_sbas_id() . '_' . $record->get_record_id())) . "\n                        ," . sprintf("%u", crc32($record->get_type())) . "\n                        ,0\n                        ," . (int) $value->getDatabox_field()->isBusiness() . "\n                        ," . sprintf("%u", crc32($record->get_collection()->get_coll_id() . '_' . (int) $value->getDatabox_field()->isBusiness())) . "\n                        ," . $record->get_creation_date()->format('U') . "\n                        " . $sql_date_fields . "\n                        ,(" . implode(',', $status) . ")\n                        )");
             }
         }
     }
     $indexes = ["docs_realtime" . $this->CRCdatabox($record->get_databox()), "docs_realtime_stemmed_fr_" . $this->CRCdatabox($record->get_databox()), "docs_realtime_stemmed_nl_" . $this->CRCdatabox($record->get_databox()), "docs_realtime_stemmed_en_" . $this->CRCdatabox($record->get_databox()), "docs_realtime_stemmed_de_" . $this->CRCdatabox($record->get_databox())];
     foreach ($indexes as $index) {
         $this->rt_conn->exec("REPLACE INTO " . $index . " VALUES (\n                '" . $record->get_record_id() . "'\n                ,'" . str_replace("'", "\\'", implode(' ', $all_datas)) . "'\n                ," . $record->get_record_id() . "\n                ," . $record->get_sbas_id() . "\n                ," . $record->get_collection()->get_coll_id() . "\n                ," . (int) $record->is_grouping() . "\n                ," . sprintf("%u", crc32($record->get_sbas_id() . '_' . $record->get_collection()->get_coll_id())) . "\n                ," . sprintf("%u", crc32($record->get_sbas_id() . '_' . $record->get_record_id())) . "\n                ," . sprintf("%u", crc32($record->get_type())) . "\n                ,0\n                ," . $record->get_creation_date()->format('U') . "\n                " . $sql_date_fields . "\n                ,(" . implode(',', $status) . ")\n            )");
     }
     return $this;
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:37,代码来源:SphinxSearchEngine.php

示例7: updateRecordStatus

 /**
  * Set new status to selected record
  *
  * @param  \record_adapter $record
  * @param  array           $postStatus
  * @return array|null
  */
 private function updateRecordStatus(\record_adapter $record, array $postStatus)
 {
     $sbasId = $record->get_databox()->get_sbas_id();
     if (isset($postStatus[$sbasId]) && is_array($postStatus[$sbasId])) {
         $postStatus = $postStatus[$sbasId];
         $currentStatus = strrev($record->get_status());
         $newStatus = '';
         foreach (range(0, 31) as $i) {
             $newStatus .= isset($postStatus[$i]) ? $postStatus[$i] ? '1' : '0' : $currentStatus[$i];
         }
         $record->set_binary_status(strrev($newStatus));
         return ['current_status' => $currentStatus, 'new_status' => $newStatus];
     }
     return null;
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:22,代码来源:Property.php

示例8: testUploadRecordStatus

 /**
  * @covers Alchemy\Phrasea\Controller\Prod\Upload::upload
  */
 public function testUploadRecordStatus()
 {
     self::$DI['app']['phraseanet.SE'] = $this->createSearchEngineMock();
     $params = ['base_id' => self::$DI['collection']->get_base_id(), 'forceAction' => Manager::FORCE_RECORD, 'status' => [self::$DI['collection']->get_base_id() => [4 => 1]]];
     $files = ['files' => [new UploadedFile($this->tmpFile, 'KIKOO.JPG')]];
     self::$DI['client']->request('POST', '/prod/upload/', $params, $files, ['HTTP_Accept' => 'application/json']);
     $response = self::$DI['client']->getResponse();
     $this->checkJsonResponse($response);
     $datas = json_decode($response->getContent(), true);
     $this->assertTrue($datas['success']);
     $this->assertEquals('record', $datas['element']);
     $this->assertEquals(Manager::RECORD_CREATED, $datas['code']);
     $id = explode('_', $datas['id']);
     $record = new \record_adapter(self::$DI['app'], $id[0], $id[1]);
     $this->assertFalse($record->isStory());
     $this->assertEquals(1, substr(strrev($record->get_status()), 4, 1));
     $this->assertEquals([], $datas['reasons']);
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:21,代码来源:UploadTest.php

示例9: testSetStatus

 public function testSetStatus()
 {
     $record_1 = $this->getRecord1();
     $record = new \record_adapter($this->getApplication(), $record_1->get_sbas_id(), $record_1->get_record_id());
     $record->set_binary_status('1001001001010101');
     $this->assertSame('00000000000000001001001001010101', $record->get_status());
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:7,代码来源:adapterTest.php

示例10: testSetStatus

 public function testSetStatus()
 {
     $record = new \record_adapter(self::$DI['app'], self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_record_id());
     $record->set_binary_status('1001001001010101');
     $this->assertSame('00000000000000001001001001010101', $record->get_status());
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:6,代码来源:adapterTest.php

示例11: updateRecord

 /**
  * {@inheritdoc}
  */
 public function updateRecord(\record_adapter $record)
 {
     $record->set_binary_status(\databox_status::dec2bin($this->app, bindec($record->get_status()) & ~7 | 4));
     return $this;
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:8,代码来源:PhraseaEngine.php


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