Пример #1
0
 public function ImgPath($params)
 {
     $mapper = new ImageMapper();
     if (!empty($params['id'])) {
         $response = array($mapper->ImgPath($params['id']));
     } else {
         $response = FALSE;
     }
     return $response;
 }
Пример #2
0
 public function add($params)
 {
     $row = (array) json_decode($params['data']);
     $imageMapper = new ImageMapper();
     $imageObj = $imageMapper->upload($_FILES['file'], time());
     $imageObj->setAlt('Picture of ' . $row['product_name']);
     $imageObj->setTitle('Picture of ' . $row['product_name']);
     $imageObj->setWidth('');
     $imageObj->setHeight('');
     $imageObj = $imageMapper->save($imageObj);
     $product = new Product();
     $product->setProductName($row['product_name'])->setTeaser($row['teaser'])->setDescription($row['description'])->setImageId($imageObj->getId())->setCategoryId($row['category_id'])->setPrice($row['price']);
     $response = $this->save($product);
     return $response;
 }
Пример #3
0
 public function deleteUser($id)
 {
     if (empty($id)) {
         return;
     }
     $user = $this->find($id);
     $imageMapper = new ImageMapper();
     $imageMapper->deleteImage($user->getImageId());
     $this->delete($id);
     return array('success' => true);
 }