Esempio n. 1
0
 public function delete()
 {
     $app = JFactory::getApplication();
     $return = base64_decode($app->input->getBase64('return'));
     $success = parent::delete();
     if ($success) {
         $this->setRedirect($return, $this->message);
     } else {
         $errors = $this->getErrors();
         for ($i = 0; $i < count($errors); $i++) {
             $app->enqueueMessage($this->getError($i, true), 'error');
         }
         $this->setRedirect($return);
     }
     return true;
 }
Esempio n. 2
0
 public function save($key = null, $urlVar = null)
 {
     $app = JFactory::getApplication();
     $response = array('status' => 1, 'error' => false, 'error_message' => '', 'message' => '', 'object' => array());
     $success = parent::save($key, $urlVar);
     if (!$success) {
         $errors = $this->getErrors();
         for ($i = 0; $i < count($errors); $i++) {
             $response['error_message'] .= $this->getError($i, true) . '. ';
         }
         $response['status'] = 0;
         $response['error'] = true;
     }
     echo json_encode($response);
     $app->close();
     return true;
 }
Esempio n. 3
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;
 }