Esempio n. 1
0
 public function edit($key = null, $urlVar = null)
 {
     $app = JFactory::getApplication();
     $recordId = $app->input->getInt('id', 0);
     $response = array('status' => 1, 'error' => false, 'error_message' => '', 'message' => '', 'object' => array());
     try {
         parent::edit($key, $urlVar);
     } catch (Exception $e) {
         $response['status'] = 0;
         $response['error'] = true;
         $response['error_message'] = $e->getMessage();
         echo json_encode($response);
         $app->close();
     }
     $model = $this->getModel();
     $item = $model->getItem($recordId);
     if (empty($item) || empty($item->id)) {
         $response['status'] = 0;
         $response['error'] = true;
         $response['error_message'] = JText::_('COM_DJREVIEWS_ERROR_REVIEW_NOT_EXIST');
     } else {
         $response['object'] = JArrayHelper::fromObject($item, true);
     }
     echo json_encode($response);
     $app->close();
 }
Esempio n. 2
0
 public function edit($key = null, $urlVar = null)
 {
     $app = JFactory::getApplication();
     $recordId = $app->input->getInt('id', 0);
     try {
         parent::edit($key, $urlVar);
     } catch (Exception $e) {
         $app->close();
     }
     $model = $this->getModel();
     $item = $model->getItem($recordId);
     if (empty($item) || empty($item->id)) {
         return false;
     }
     $this->setRedirect('index.php?option=com_djreviews&view=reviewform&id=' . $recordId . '&format=raw');
     return true;
 }