public function addJobOpeningAction() { $request = $this->getRequest(); $form = new Application_Form_Job(); if ($request->isPost()) { $options = $request->getPost(); if ($form->isValid($options)) { $usersNs = new Zend_Session_Namespace("members"); $options['postedById'] = $usersNs->userId; $model = new Application_Model_Job($options); $id = $model->save(); if ($id) { $this->_flashMessenger->addMessage(array('success' => 'Job opening added successfully!')); $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/job/add-job-opening')); } else { $this->_flashMessenger->addMessage(array('error' => 'Failed to add job opening!')); $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/job/add-job-opening')); } $form->reset(); } else { $form->reset(); $form->populate($options); } } $this->view->form = $form; }
public function postAction() { $test = array('id' => 6, 'jobTitle' => 'Test', 'jobSalary' => 1000, 'location' => 'Test', 'contactEmail' => '*****@*****.**', 'endTime' => new MongoDate(strtotime("2010-01-15 00:00:00")), 'occupation' => 'Test', 'industry' => 'Test', 'createTime' => new MongoDate(), 'modifyTime' => new MongoDate(strtotime("2010-01-15 00:00:00"))); $job = new Application_Model_Job(); $job->setJson($test); $job->save(); $this->getResponse()->setBody('Resource created'); $this->getResponse()->setHttpResponseCode(201); }