Пример #1
0
 public function editNameAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $ajaxRes = array('success' => 0, 'info' => null);
     $request = $this->getRequest();
     $testName = $request->getParam('name', null);
     $testId = $request->getParam('testId', null);
     $user = PR_Session::getSession(PR_Session::SESSION_USER);
     $companyId = $user['CompanyID'];
     if (!empty($testName) && is_numeric($testId)) {
         $core = new PR_Api_Core_TestClass();
         $arrResult = $core->updateTest($testId, $companyId, $testName);
         if ($arrResult['success']) {
             $ajaxRes = array('success' => 1);
         }
     }
     $response = $this->getResponse();
     $response->clearAllHeaders()->clearBody();
     $ajaxRes = json_encode($ajaxRes);
     $response->setHeader('Content-type', 'application/json');
     $response->setHeader('Content-Length', strlen($ajaxRes), true)->setBody($ajaxRes);
 }