示例#1
0
 /**
  * Edit an order
  * @return void
  */
 public function edit()
 {
     if (!userHasPermission('admin:order:order:edit')) {
         unauthorised();
     }
     // --------------------------------------------------------------------------
     $this->data['order'] = $this->oOrderModel->get_by_id($this->uri->segment(5));
     if (!$this->data['order']) {
         show_404();
     }
     // --------------------------------------------------------------------------
     //  Page Title
     $this->data['page']->title = 'Edit Order › ' . $this->data['order']->ref;
     // --------------------------------------------------------------------------
     if ($this->input->post()) {
         if ($this->validatePost()) {
             if ($this->oOrderModel->update($this->data['order']->id, $this->getObjectFromPost())) {
                 $this->session->set_flashdata('success', lang('orders_edit_ok'));
                 redirect('admin/order/order/index');
             } else {
                 $this->data['error'] = 'Failed to update order. ' . $this->oOrderModel->last_error();
             }
         } else {
             $this->data['error'] = lang('fv_there_were_errors');
         }
     }
     // --------------------------------------------------------------------------
     //  Load views
     Helper::loadView('edit');
 }
示例#2
0
 /**
  * Edit a faq
  * @return void
  */
 public function edit()
 {
     if (!userHasPermission('admin:faq:faq:edit')) {
         unauthorised();
     }
     // --------------------------------------------------------------------------
     $this->data['faq'] = $this->faq_model->get_by_id($this->uri->segment(5));
     if (!$this->data['faq']) {
         $this->session->set_flashdata('error', lang('faqs_common_bad_id'));
         redirect('admin/faq/faq/index');
     }
     // --------------------------------------------------------------------------
     //  Page Title
     $this->data['page']->title = lang('faqs_edit_title');
     // --------------------------------------------------------------------------
     if ($this->input->post()) {
         $this->load->library('form_validation');
         $this->form_validation->set_rules('quote', '', 'xss_clean|required');
         $this->form_validation->set_rules('quote_by', '', 'xss_clean|required');
         $this->form_validation->set_message('required', lang('fv_required'));
         if ($this->form_validation->run()) {
             $data = array();
             $data['quote'] = $this->input->post('quote');
             $data['quote_by'] = $this->input->post('quote_by');
             if ($this->faq_model->update($this->data['faq']->id, $data)) {
                 $this->session->set_flashdata('success', lang('faqs_edit_ok'));
                 redirect('admin/faq/faq/index');
             } else {
                 $this->data['error'] = lang('faqs_edit_fail');
             }
         } else {
             $this->data['error'] = lang('fv_there_were_errors');
         }
     }
     // --------------------------------------------------------------------------
     //  Load views
     \Nails\Admin\Helper::loadView('edit');
 }
示例#3
0
                            </td>
                            <td class="actions">
                                <?php 
        if (userHasPermission('admin:payment:payment:edit')) {
            echo anchor('admin/order/payment/edit/' . $oPayment->id, lang('action_edit'), 'class="awesome small"');
        }
        if (userHasPermission('admin:payment:payment:delete')) {
            echo anchor('admin/order/payment/delete/' . $oPayment->id, lang('action_delete'), 'class="awesome red small confirm" data-body="You cannot undo this action"');
        }
        ?>
                            </td>
                        <tr>
                        <?php 
    }
} else {
    ?>
                    <tr>
                        <td colspan="2" class="no-data">
                            No Payments Found
                        </td>
                    </tr>
                    <?php 
}
?>
            </tbody>
        </table>
    </div>
    <?php 
echo \Nails\Admin\Helper::loadPagination($pagination);
?>
</div>