Changeset View
Changeset View
Standalone View
Standalone View
src/applications/pholio/controller/PholioMockEditController.php
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | if ($request->isFormPost()) { | ||||
$existing_image = idx($mock_images, $file_phid); | $existing_image = idx($mock_images, $file_phid); | ||||
$title = (string)$request->getStr('title_'.$file_phid); | $title = (string)$request->getStr('title_'.$file_phid); | ||||
$description = (string)$request->getStr('description_'.$file_phid); | $description = (string)$request->getStr('description_'.$file_phid); | ||||
$sequence = $sequence_map[$file_phid]; | $sequence = $sequence_map[$file_phid]; | ||||
if ($replaces_image_phid) { | if ($replaces_image_phid) { | ||||
$replace_image = PholioImage::initializeNewImage() | $replace_image = PholioImage::initializeNewImage() | ||||
->setAuthorPHID($viewer->getPHID()) | |||||
->setReplacesImagePHID($replaces_image_phid) | ->setReplacesImagePHID($replaces_image_phid) | ||||
->setFilePhid($file_phid) | ->setFilePhid($file_phid) | ||||
->attachFile($file) | ->attachFile($file) | ||||
->setName(strlen($title) ? $title : $file->getName()) | ->setName(strlen($title) ? $title : $file->getName()) | ||||
->setDescription($description) | ->setDescription($description) | ||||
->setSequence($sequence); | ->setSequence($sequence); | ||||
$xactions[] = id(new PholioTransaction()) | $xactions[] = id(new PholioTransaction()) | ||||
->setTransactionType( | ->setTransactionType( | ||||
PholioImageReplaceTransaction::TRANSACTIONTYPE) | PholioImageReplaceTransaction::TRANSACTIONTYPE) | ||||
->setNewValue($replace_image); | ->setNewValue($replace_image); | ||||
$posted_mock_images[] = $replace_image; | $posted_mock_images[] = $replace_image; | ||||
} else if (!$existing_image) { // this is an add | } else if (!$existing_image) { // this is an add | ||||
$add_image = PholioImage::initializeNewImage() | $add_image = PholioImage::initializeNewImage() | ||||
->setAuthorPHID($viewer->getPHID()) | |||||
->setFilePhid($file_phid) | ->setFilePhid($file_phid) | ||||
->attachFile($file) | ->attachFile($file) | ||||
->setName(strlen($title) ? $title : $file->getName()) | ->setName(strlen($title) ? $title : $file->getName()) | ||||
->setDescription($description) | ->setDescription($description) | ||||
->setSequence($sequence); | ->setSequence($sequence); | ||||
$xactions[] = id(new PholioTransaction()) | $xactions[] = id(new PholioTransaction()) | ||||
->setTransactionType(PholioImageFileTransaction::TRANSACTIONTYPE) | ->setTransactionType(PholioImageFileTransaction::TRANSACTIONTYPE) | ||||
->setNewValue( | ->setNewValue( | ||||
▲ Show 20 Lines • Show All 207 Lines • Show Last 20 Lines |