Factory->includeClassFile('kDBEventHandler'); class kCatDBEventHandler extends InpDBEventHandler { function OnCopy(&$event) { $object = $event->getObject(); $this->StoreSelectedIDs($event); $ids = $this->getSelectedIDs($event); $this->Application->StoreVar($this->getPrefixSpecial().'_clipboard', implode(',', $ids)); $this->Application->StoreVar($this->getPrefixSpecial().'_clipboard_mode', 'copy'); $this->Application->StoreVar('clipboard', 'COPY-0.'.TABLE_PREFIX.'Products.ResourceId=0'); $event->redirect_params = Array('opener' => 's', 'pass_events'=>true); //do not go up - STAY } function OnCut(&$event) { $object = $event->getObject(); $this->StoreSelectedIDs($event); $ids = $this->getSelectedIDs($event); $this->Application->StoreVar($this->getPrefixSpecial().'_clipboard', implode(',', $ids)); $this->Application->StoreVar($this->getPrefixSpecial().'_clipboard_mode', 'cut'); $this->Application->StoreVar('clipboard', 'CUT-0.'.TABLE_PREFIX.'Products.ResourceId=0'); $event->redirect_params = Array('opener' => 's', 'pass_events'=>true); //do not go up - STAY } function OnPaste(&$event) { $ids = $this->Application->RecallVar($this->getPrefixSpecial().'_clipboard'); if ($ids == '') { $event->redirect = false; return; } //recalling by different name, because we may get kDBList, if we recall just by prefix $object =& $this->Application->recallObject($event->getPrefixSpecial().'.item', $event->Prefix); $this->prepareObject(&$object,&$event); if ($this->Application->RecallVar($this->getPrefixSpecial().'_clipboard_mode') == 'copy') { $ids_arr = explode(',', $ids); $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); if($ids_arr) { $temp->CloneItems($event->Prefix, $event->Special, $ids_arr); } } else { // mode == cut $ids_arr = explode(',', $ids); foreach ($ids_arr as $id) { $object->Load($id); $object->MoveToCat(); } } $event->redirect = true; } } ?>