Ejemplo n.º 1
0
 /**
  * Assign a new position to an existing record
  * @param boolean
  */
 public function cut($blnDoNotRedirect = false)
 {
     if ($this->intId > 0) {
         $time = time();
         // Empty clipboard
         $arrClipboard = $this->Session->get('CLIPBOARD');
         $arrClipboard[$this->strTable] = array();
         $this->Session->set('CLIPBOARD', $arrClipboard);
         $objRecord = $this->Database->prepare("SELECT pid FROM {$this->strTable} WHERE id=?")->limit(1)->execute($this->intId);
         // Update only the variant
         if ($objRecord->pid > 0) {
             $this->Database->prepare("UPDATE {$this->strTable} SET tstamp=?, gid=?, pid=? WHERE id=?")->execute($time, $this->intGroupId, \Input::get('pid'), $this->intId);
         } else {
             $this->Database->prepare("UPDATE {$this->strTable} SET tstamp=?, gid=? WHERE id=? OR pid=?")->execute($time, $this->intGroupId, $this->intId, $this->intId);
         }
         // Call the oncut_callback
         if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['oncut_callback'])) {
             foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['oncut_callback'] as $callback) {
                 if (is_array($callback)) {
                     $this->import($callback[0]);
                     $this->{$callback}[0]->{$callback}[1]($this);
                 } elseif (is_callable($callback)) {
                     call_user_func($callback, $this);
                 }
             }
         }
         if (!$blnDoNotRedirect) {
             \Controller::redirect(\System::getReferer());
         }
         return;
     }
     parent::cut($blnDoNotRedirect);
 }
Ejemplo n.º 2
0
 /**
  * Assign a new position to an existing record
  * @param boolean
  */
 public function cut($blnDoNotRedirect = false)
 {
     // ID and GID tell about paste into a group
     if ($this->intId > 0 && $this->Input->get('gid') != '') {
         // Empty clipboard
         $arrClipboard = $this->Session->get('CLIPBOARD');
         $arrClipboard[$this->strTable] = array();
         $this->Session->set('CLIPBOARD', $arrClipboard);
         // Update the record
         $this->Database->prepare("UPDATE {$this->strTable} SET tstamp=?, gid=? WHERE id=?")->execute(time(), $this->Input->get('gid'), $this->intId);
         if (!$blnDoNotRedirect) {
             $this->redirect($this->getReferer());
         }
         // Do not call parent function
         return;
     }
     parent::cut($blnDoNotRedirect);
 }