Пример #1
0
	/**
	 * Store an entry of a mediaItem, this means in end effect every media file in the shop
	 * images, videos, pdf, zips, exe, ...
	 *
	 * @author Max Milbers
	 */
	public function store(&$data,$type) {

		//if(empty($data['media_action'])) return $table->virtuemart_media_id;
		if (!class_exists('VmMediaHandler')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'mediahandler.php');

		$table = $this->getTable('medias');

		$table->bind($data);
		$data = VmMediaHandler::prepareStoreMedia($table,$data,$type); //this does not store the media, it process the actions and prepares data

		// workarround for media published and product published two fields in one form.

		if (isset($data['media_published'])){
			$data['published'] = $data['media_published'];
			//vmdebug('$data["published"]',$data['published']);
		}

		$table->bindChecknStore($data);
		$errors = $table->getErrors();
		foreach($errors as $error){
			vmError('store medias '.$error);
		}
// 		vmdebug('store media $table->virtuemart_media_id '.$table->virtuemart_media_id);
		return $table->virtuemart_media_id;
	}
Пример #2
0
 /**
  * Store an entry of a mediaItem, this means in end effect every media file in the shop
  * images, videos, pdf, zips, exe, ...
  *
  * @author Max Milbers
  */
 public function store(&$data, $type)
 {
     VmConfig::loadJLang('com_virtuemart_media');
     //if(empty($data['media_action'])) return $table->virtuemart_media_id;
     if (!class_exists('VmMediaHandler')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'mediahandler.php';
     }
     $table = $this->getTable('medias');
     /*	$a = trim($data['file_url_thumb']);
     		$b = trim(JText::sprintf('COM_VIRTUEMART_DEFAULT_URL',$data['file_url_thumb']));
     		vmdebug(' the miese Assi',$a,$b);
     		if( $a == $b ){
     			vmdebug('Unset the miese Assi');
     			unset($data['file_url_thumb']);
     		}*/
     //unset($data['file_url_thumb']);
     $table->bind($data);
     $data = VmMediaHandler::prepareStoreMedia($table, $data, $type);
     //this does not store the media, it process the actions and prepares data
     // workarround for media published and product published two fields in one form.
     $tmpPublished = false;
     if (isset($data['media_published'])) {
         $tmpPublished = $data['published'];
         $data['published'] = $data['media_published'];
         //vmdebug('$data["published"]',$data['published']);
     }
     $table->bindChecknStore($data);
     $errors = $table->getErrors();
     foreach ($errors as $error) {
         vmError('store medias ' . $error);
     }
     if ($tmpPublished) {
         $data['published'] = $tmpPublished;
     }
     // 		vmdebug('store media $table->virtuemart_media_id '.$table->virtuemart_media_id);
     return $table->virtuemart_media_id;
 }
Пример #3
0
 /**
  * Store an entry of a mediaItem, this means in end effect every media file in the shop
  * images, videos, pdf, zips, exe, ...
  *
  * @author Max Milbers
  */
 public function store(&$data)
 {
     VmConfig::loadJLang('com_virtuemart_media');
     if (!class_exists('VmMediaHandler')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'mediahandler.php';
     }
     $table = $this->getTable('medias');
     $data['virtuemart_media_id'] = $this->getId();
     $table->bind($data);
     $data = VmMediaHandler::prepareStoreMedia($table, $data, $data['file_type']);
     //this does not store the media, it process the actions and prepares data
     // workarround for media published and product published two fields in one form.
     $tmpPublished = false;
     if (isset($data['media_published'])) {
         $tmpPublished = $data['published'];
         $data['published'] = $data['media_published'];
     }
     $table->bindChecknStore($data);
     if ($tmpPublished) {
         $data['published'] = $tmpPublished;
     }
     return $table->virtuemart_media_id;
 }
Пример #4
0
 /**
  * Store an entry of a mediaItem, this means in end effect every media file in the shop
  * images, videos, pdf, zips, exe, ...
  *
  * @author Max Milbers
  */
 public function store(&$data)
 {
     $data['tsmart_media_id'] = $this->getId();
     if (!vmAccess::manager('media.edit')) {
         vmWarn('Insufficient permission to store media');
         return false;
     } else {
         if (empty($data['tsmart_media_id']) and !vmAccess::manager('media.create')) {
             vmWarn('Insufficient permission to create media');
             return false;
         }
     }
     tsmConfig::loadJLang('com_tsmart_media');
     if (!class_exists('VmMediaHandler')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'mediahandler.php';
     }
     $table = $this->getTable('medias');
     $table->bind($data);
     $data = VmMediaHandler::prepareStoreMedia($table, $data, $data['file_type']);
     //this does not store the media, it process the actions and prepares data
     if ($data === false) {
         return $table->tsmart_media_id;
     }
     // workarround for media published and product published two fields in one form.
     $tmpPublished = false;
     if (isset($data['media_published'])) {
         $tmpPublished = $data['published'];
         $data['published'] = $data['media_published'];
     }
     $table->bindChecknStore($data);
     if ($tmpPublished) {
         $data['published'] = $tmpPublished;
     }
     return $table->tsmart_media_id;
 }