本文整理汇总了PHP中collection::get_from_coll_id方法的典型用法代码示例。如果您正苦于以下问题:PHP collection::get_from_coll_id方法的具体用法?PHP collection::get_from_coll_id怎么用?PHP collection::get_from_coll_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collection
的用法示例。
在下文中一共展示了collection::get_from_coll_id方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processData
private function processData(Application $app, $row, $logsql)
{
$databox = $app['phraseanet.appbox']->get_databox($row['sbas_id']);
$rec = $databox->get_record($row['record_id']);
switch ($row['action']) {
case 'UPDATE':
// change collection ?
if (array_key_exists('coll', $row)) {
$coll = \collection::get_from_coll_id($app, $databox, $row['coll']);
$rec->move_to_collection($coll, $app['phraseanet.appbox']);
$app['phraseanet.SE']->updateRecord($rec);
if ($logsql) {
$this->log('debug', sprintf("on sbas %s move rid %s to coll %s \n", $row['sbas_id'], $row['record_id'], $coll->get_coll_id()));
}
}
// change sb ?
if (array_key_exists('sb', $row)) {
$status = str_split($rec->get_status());
foreach (str_split(strrev($row['sb'])) as $bit => $val) {
if ($val == '0' || $val == '1') {
$status[31 - $bit] = $val;
}
}
$rec->set_binary_status(implode('', $status));
$app['phraseanet.SE']->updateRecord($rec);
if ($logsql) {
$this->log('debug', sprintf("on sbas %s set rid %s status to %s \n", $row['sbas_id'], $row['record_id'], $status));
}
}
break;
case 'DELETE':
if ($row['deletechildren'] && $rec->is_grouping()) {
foreach ($rec->get_children() as $child) {
$child->delete();
$app['phraseanet.SE']->removeRecord($child);
if ($logsql) {
$this->log('debug', sprintf("on sbas %s delete (grp child) rid %s \n", $row['sbas_id'], $child->get_record_id()));
}
}
}
$rec->delete();
$app['phraseanet.SE']->removeRecord($rec);
if ($logsql) {
$this->log('debug', sprintf("on sbas %s delete rid %s \n", $row['sbas_id'], $rec->get_record_id()));
}
break;
}
return $this;
}
示例2: updateRecordUUID
/**
* Update a record with a UUID
*
* @param \databox $databox
* @param array $record
*/
protected function updateRecordUUID(\databox $databox, array $record)
{
$pathfile = \p4string::addEndSlash($record['path']) . $record['file'];
$uuid = Uuid::uuid4();
try {
$media = $this->app['mediavorus']->guess($pathfile);
$collection = \collection::get_from_coll_id($this->{$app}, $databox, (int) $record['coll_id']);
$file = new File($this->app, $media, $collection);
$uuid = $file->getUUID(true, true);
$sha256 = $file->getSha256();
$this->app['monolog']->addInfo(sprintf("Upgrading record %d with uuid %s", $record['record_id'], $uuid));
} catch (\Exception $e) {
$this->app['monolog']->addError(sprintf("Uuid upgrade for record %s failed", $record['record_id']));
}
$sql = 'UPDATE record SET uuid = :uuid, sha256 = :sha256 WHERE record_id = :record_id';
$params = [':uuid' => $uuid, 'sha256' => $sha256, ':record_id' => $record['record_id']];
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute($params);
$stmt->closeCursor();
}
示例3: archiveFileAndCaption
/**
*
* @param \DOMDOcument $dom
* @param \DOMElement $node
* @param \DOMElement $captionFileNode
* @param string $path
* @param string $path_archived
* @param string $path_error
* @param integer $grp_rid
* @param array $nodesToDel out, filled with files to delete
*/
private function archiveFileAndCaption(Application $app, \databox $databox, \DOMDocument $dom, \DOMElement $node, \DOMElement $captionFileNode = null, $path, $path_archived, $path_error, $grp_rid, array &$nodesToDel, $stat0, $stat1, $moveError, $moveArchived)
{
$file = $node->getAttribute('name');
$cid = $node->getAttribute('cid');
$captionFileName = $captionFileNode ? $captionFileNode->getAttribute('name') : null;
$this->log('debug', sprintf("Archiving file '%s'", $path . '/' . $file));
if ($captionFileName !== null) {
$this->log('debug', sprintf(' ' . " (caption in '%s')", $captionFileName));
}
if ($grp_rid !== 0) {
$this->log('debug', sprintf(' ' . " into GRP rid=%s", $grp_rid));
}
try {
$collection = \collection::get_from_coll_id($app, $databox, (int) $cid);
if ($captionFileName === null) {
$this->createRecord($app, $collection, $path . '/' . $file, null, $grp_rid, null, $stat0, $stat1);
} else {
$this->createRecord($app, $collection, $path . '/' . $file, $path . '/' . $captionFileName, $grp_rid, null, $stat0, $stat1);
}
$node->setAttribute('archived', '1');
if ($captionFileNode) {
$captionFileNode->setAttribute('archived', '1');
}
} catch (\Exception $e) {
$this->log('debug', "Error : can't insert record : " . $e->getMessage());
$node->setAttribute('error', '1');
if ($captionFileNode) {
$captionFileNode->setAttribute('error', '1');
}
}
if ($node->getAttribute('archived') && $moveArchived) {
$this->log('debug', sprintf('copy \'%s\' to \'archived\'', $path . '/' . $file));
try {
$app['filesystem']->mkdir($path_archived);
} catch (IOException $e) {
$this->log('debug', $e->getMessage());
}
try {
$app['filesystem']->copy($path . '/' . $file, $path_archived . '/' . $file, true);
} catch (IOException $e) {
$this->log('debug', $e->getMessage());
}
if ($captionFileName != $file && $captionFileName) {
$this->log('debug', sprintf('copy \'%s\' to \'archived\'', $path . '/' . $captionFileName));
try {
$app['filesystem']->copy($path . '/' . $captionFileName, $path_archived . '/' . $captionFileName, true);
} catch (IOException $e) {
$this->log('debug', $e->getMessage());
}
}
}
if ($node->getAttribute('error') && $moveError) {
$this->log('debug', sprintf('copy \'%s\' to \'error\'', $path . '/' . $file));
try {
$app['filesystem']->mkdir($path_error);
} catch (IOException $e) {
$this->log('debug', $e->getMessage());
}
try {
$app['filesystem']->copy($path . '/' . $file, $path_error . '/' . $file, true);
} catch (IOException $e) {
$this->log('debug', $e->getMessage());
}
if ($captionFileName != $file && $captionFileName) {
$this->log('debug', sprintf('copy \'%s\' to \'error\'', $path . '/' . $captionFileName));
try {
$app['filesystem']->copy($path . '/' . $captionFileName, $path_error . '/' . $captionFileName, true);
} catch (IOException $e) {
$this->log('debug', $e->getMessage());
}
}
}
if (!$node->getAttribute('keep')) {
$file = $node->getAttribute('name');
try {
$app['filesystem']->remove($path . '/' . $file);
} catch (IOException $e) {
$this->log('debug', $e->getMessage());
}
$nodesToDel[] = $node;
}
if ($captionFileNode && !$captionFileNode->getAttribute('keep')) {
$file = $captionFileNode->getAttribute('name');
try {
$app['filesystem']->remove($path . '/' . $file);
} catch (IOException $e) {
$this->log('debug', $e->getMessage());
}
$nodesToDel[] = $captionFileNode;
//.........这里部分代码省略.........
示例4: get_collections
public function get_collections()
{
$ret = [];
foreach ($this->get_available_collections() as $coll_id) {
try {
$ret[] = collection::get_from_coll_id($this->app, $this, $coll_id);
} catch (\Exception $e) {
}
}
return $ret;
}
示例5: testGet_from_coll_id
public function testGet_from_coll_id()
{
$temp_coll = collection::get_from_coll_id(self::$DI['app'], self::$object->get_databox(), self::$object->get_coll_id());
$this->assertEquals(self::$object->get_coll_id(), $temp_coll->get_coll_id());
$this->assertEquals(self::$object->get_base_id(), $temp_coll->get_base_id());
}
示例6: get_collection
/**
* Return record collection
*
* @return \collection
*/
public function get_collection()
{
return \collection::get_from_coll_id($this->app, $this->databox, $this->collection_id);
}