public function addAction() { $request = $this->getRequest(); $dataResponse = array(); if ($request->isPost()) { $pipelineId = $request->getParam('pipelineId'); $propertyId = $request->getParam('propertyId'); $propertyValue = $request->getParam('propertyValue'); $propertyMapper = new Pipeline_Model_Mapper_PipelineProperty(); $property = $propertyMapper->find($propertyId, new Pipeline_Model_PipelineProperty()); $newPropertyValue = $this->_createPropertyValue($pipelineId, $propertyId, $propertyValue); if (!is_null($newPropertyValue) && !is_null($property)) { $dataResponse['property'] = array('propertyValueId' => $newPropertyValue->getId(), 'propertyName' => $property->getName(), 'propertyValue' => $newPropertyValue->getValue()); } else { $alert = 'Ошибка! Обратитесь к администратору сайта.'; $dataResponse['errorMessage'] = $alert; } } echo $this->_helper->json($dataResponse); }
public function enableAction() { $request = $this->getRequest(); $itemId = $request->getParam('id'); if (is_null($itemId)) { $this->_redirector->gotoRouteAndExit(array('module' => 'admin', 'controller' => 'pipeline-property', 'action' => 'index'), 'adminEdit', true); } $pipelinePropertyMapper = new Pipeline_Model_Mapper_PipelineProperty(); $pipelineProperty = $pipelinePropertyMapper->find($itemId, new Pipeline_Model_PipelineProperty()); if (is_null($pipelineProperty)) { throw new Zend_Controller_Action_Exception("Страница не найдена", 404); } $active = $pipelineProperty->getActive() != 0 ? 0 : 1; $pipelineProperty->setActive($active); $pipelinePropertyMapper->save($pipelineProperty); $this->_redirector->gotoRouteAndExit(array('module' => 'admin', 'controller' => 'pipeline-property', 'action' => 'index'), 'adminEdit', true); }
public function selectAddPropertyAction() { $request = $this->getRequest(); if ($request->getParam('propertyId')) { $propertyId = $request->getParam('propertyId'); $pipelinePropertyMapper = new Pipeline_Model_Mapper_PipelineProperty(); $pipelineProperty = $pipelinePropertyMapper->find($propertyId, new Pipeline_Model_PipelineProperty()); $this->view->property = $pipelineProperty; } }
function getPropertyPipeline($property_id) { $pipelineMapper = new Pipeline_Model_Mapper_PipelineProperty(); $property = $pipelineMapper->find($property_id, new Pipeline_Model_PipelineProperty()); return $property; }