/**
  *	Method for creating a product
  *	@param \model\Product $p
  *	@param \model\Image $image
  */
 public function createProduct(\model\Product $p, \model\Image $image)
 {
     if ($this->productDAL->checkUniqueExists($p->getUnique())) {
         throw new \PDOUniqueExistsException("Unique already exists in database.");
     }
     $this->productDAL->addProduct($p);
     $image->uploadImage();
     $image->createSquareImage(self::$thumbSide, self::$thumbPath);
     $image->createSquareImage(self::$mediumSide, self::$mediumPath);
 }
Пример #2
0
 public function __construct()
 {
     parent::__construct();
     $this->user = MUser::app();
     $this->image = Image::app();
     $this->role = MRole::app();
     $this->check_access('edit_users');
 }
Пример #3
0
 public function __construct()
 {
     parent::__construct();
     $this->left = View::template('v_left.php');
     $this->post = MPost::app();
     $this->image = MImage::app();
     $this->tag = MTag::app();
     $this->comment = MComment::app();
 }
Пример #4
0
 public function __construct()
 {
     parent::__construct();
     $this->post = MPost::app();
     //$this->left = View::template('post/v_left.php');
     $this->image = Image::app();
     $this->tag = Tag::app();
     $this->check_access('edit_posts');
 }
Пример #5
0
 public function action_gallery_upload()
 {
     $this->check_access('edit_posts');
     $id_image = Image::app()->upload_base64($_POST['name'], $_POST['value']);
     if ($id_image != false) {
         Gallery::app()->add_image($_POST['id_gallery'], $id_image);
         $this->content = $_POST['name'] . ':1';
     } else {
         $this->content = $_POST['name'] . ':0';
     }
 }
Пример #6
0
 public function upload()
 {
     $view = Input::get('view', 'uploader');
     if ($view === 'list' || $view === 'list-content') {
         //need fix
         $part = Input::get('part');
         $list = Image::get(Input::get('model'), Input::get('model_id', 0))->images($part)->orderBy('sort', 'asc')->get();
     } else {
         $list = Image::orderBy('sort', 'asc')->get();
     }
     return view($this->templatePath() . '.' . $view, array('list' => $list));
 }