Ejemplo n.º 1
0
 /**
  * save()
  * @param integer $intElementId
  * @param string $strType
  * @param string $strElementId
  * @param integet $intVersion
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 public function save($intElementId, $strType, $strElementId = null, $intVersion = null)
 {
     try {
         $this->strType = $strType;
         $this->getModel();
         $intVideoTypeId = 0;
         if (array_key_exists($this->objElement->name . 'TypeId', $_POST)) {
             $intVideoTypeId = $_POST[$this->objElement->name . 'TypeId'];
         }
         $strVideoUserId = '';
         if (array_key_exists($this->objElement->name . 'User', $_POST)) {
             $strVideoUserId = $_POST[$this->objElement->name . 'User'];
         }
         $strVideoThumb = '';
         if (array_key_exists($this->objElement->name . 'Thumb', $_POST)) {
             $strVideoThumb = $_POST[$this->objElement->name . 'Thumb'];
         }
         if ($intVideoTypeId > 0 && $strVideoThumb != '') {
             $this->objModel->addVideo($intElementId, $this->objElement->getValue(), $intVideoTypeId, $strVideoUserId, $strVideoThumb);
             $this->objElement->intVideoTypeId = $intVideoTypeId;
             $this->objElement->strVideoUserId = $strVideoUserId;
         } else {
             $this->objModel->removeVideo($intElementId);
         }
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }