function splitAction() { $version = new Elite_Vafinstall_Migrate(); if ($version->needsUpgrade()) { echo 'Please run the upgrade-vaf.php script as per the documentation. Your database is out of date.'; exit; } $this->loadLayout(); $this->_setActiveMenu('vaf'); $this->block = $this->getLayout()->createBlock('adminhtml/vaf_definitions', 'vaf'); $this->block->setTemplate('vf/vaf/split.phtml'); if (isset($_POST['submit'])) { $titles = explode(',', $_POST['new_titles']); $vehicle = $this->vehicleFinder()->findOneByLevelIds($this->requestLevels(), VF_Vehicle_Finder::INCLUDE_PARTIALS); $split = new Elite_Vaf_Model_Split($vehicle, $_POST['entity'], $titles); $split->execute(); header('location:' . $this->getListUrl2($_REQUEST['entity'])); exit; } $params = $this->requestLevels(); $params[$this->getRequest()->getParam('entity')] = $this->getRequest()->getParam('id'); $this->block->vehicle = $this->vehicleFinder()->findOneByLevelIds($params, VF_Vehicle_Finder::INCLUDE_PARTIALS); if (!$this->block->vehicle) { header('location:' . $this->getListUrl2($_REQUEST['entity'])); } $this->_addContent($this->block); $this->renderLayout(); }
function split($vehicle, $grain, $newTitles) { $split = new Elite_Vaf_Model_Split($vehicle, $grain, $newTitles); $split->execute(); }