Exemplo n.º 1
0
 public function handleDelete($id)
 {
     if (($entity = $this->itemRepository->find($id)) === NULL) {
         throw new BadRequestException();
     }
     $this->itemRepository->delete($entity);
     if (!$this->presenter->isAjax()) {
         $this->redirect('this', array('id' => NULL));
     }
     $this->presenter->payload->url = $this->link('this', array('id' => NULL));
     $this->invalidateControl('view');
 }
 /**
  * @param AjaxFileUploaderControl $control
  * @param FileUpload $file
  */
 public function handleFileUpload(AjaxFileUploaderControl $control, $fileName)
 {
     /** @var FileEntity $fileEntity */
     $fileEntity = $this->fileRepository->createNew();
     $fileEntity->setFile(new \SplFileInfo($this->ajaxDir . '/' . $fileName));
     $this->fileRepository->save($fileEntity);
     $this->categoryEntity->items[] = $photoEntity = new ItemEntity($this->categoryEntity->extendedPage);
     $photoEntity->route->setPhoto($fileEntity);
     $photoEntity->route->setParent($this->categoryEntity->route);
     $photoEntity->setCategory($this->categoryEntity);
     $this->itemRepository->save($photoEntity);
 }
Exemplo n.º 3
0
 protected static function init()
 {
     $dbRows = self::_getDb()->getItems();
     $dbData = array();
     foreach ($dbRows as $row) {
         array_push($dbData, new Item($row['ID'], $row['Name'], $row['Type'], $row['OS'], $row['Display'], $row['Resolution'], $row['Home'], $row['Status'], $row['Date'], $row['Account'], $row['Comment'], $row['History'], $row['UDID']));
     }
     self::$items = $dbData;
 }
Exemplo n.º 4
0
 public function testSave()
 {
     $itemId = 1;
     $quoteItem = $this->getMock('\\Magento\\Sales\\Model\\Quote\\Item', ['getIsVirtual', '__wakeup'], [], '', false);
     $this->quoteMock->expects($this->once())->method('getItemById')->with($itemId)->will($this->returnValue($quoteItem));
     $quoteItem->expects($this->once())->method('getIsVirtual')->will($this->returnValue(0));
     $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock));
     $this->helperMock->expects($this->once())->method('getIsMessagesAvailable')->with('items', $this->quoteMock, $this->storeMock)->will($this->returnValue(true));
     $this->giftMessageManagerMock->expects($this->once())->method('setMessage')->with($this->quoteMock, 'quote_item', $this->messageMock, $itemId)->will($this->returnValue($this->giftMessageManagerMock));
     $this->assertTrue($this->itemRepository->save($this->cartId, $this->messageMock, $itemId));
 }
Exemplo n.º 5
0
<?php

require_once '../classes/ItemRepository.php';
$postdata = file_get_contents("php://input");
$id = json_decode($postdata);
ItemRepository::returnItem($id);
Exemplo n.º 6
0
<?php

require_once '../classes/ItemRepository.php';
$postdata = file_get_contents("php://input");
$data = json_decode($postdata, true);
return ItemRepository::updateComment($data['id'], $data['comment']);
Exemplo n.º 7
0
<?php

require_once '../classes/ItemRepository.php';
$postdata = file_get_contents("php://input");
$data = json_decode($postdata, true);
ItemRepository::addNewItem($data['item'], $data['username']);
Exemplo n.º 8
0
<?php

require_once '../classes/ItemRepository.php';
header('Content-type: application/json');
//For security reasons, will be automatically stripped by AngularJS
echo ")]}'\n";
$items = ItemRepository::getItems();
echo json_encode($items);
Exemplo n.º 9
0
<?php

require_once '../classes/ItemRepository.php';
$postdata = file_get_contents("php://input");
$data = json_decode($postdata, true);
return ItemRepository::takeItem($data['id'], $data['status']);