Welcome Guest, Not a member yet? Register   Sign In
Add the edit option
#1

Hi guys, I'm working on a codeigniter template ( https://codecanyon.net/item/class-ease-e...m/29109477 )

This template is for a school and I have a problem :



I must have the possibility to modify the fees owed by the students, the fact of being able to edit is available for most objects (courses, teachers, students etc ...). But you cannot edit the payments due. So I started to set this system up, I added the edit button but the data is not saved, do you know where I can change that?





StudentsDues Controller
PHP Code:
public function save()
    {
        $this->checkIfDemo();
        $this->form_validation->set_rules('amount''Amount''trim|required|numeric');
        $this->form_validation->set_rules('description''Description''trim|required|min_length[2]|max_length[50]');

        $edit $this->xssCleanInput('student_due_id') ? $this->xssCleanInput('student_due_id') : false;

        if ($edit && $this->form_validation->run() === FALSE) {
            echo json_encode(array(
                'success' => 'false',
                'messages' => $this->ajaxErrorMessage(array('error' => validation_errors()))
            ));
        } else {
            $data $this->AdminStudentDueModel->storeStudentDue();
            echo json_encode(array(
                'success' => 'true',
                'messages' => $this->ajaxErrorMessage(array('success' => lang('student_due') . ($edit lang('updated') : lang('created')))),
                'data' => $data.' '.lang('student_dues_created'),
            ));

        }
    



Courses Controller

PHP Code:
public function save()
    {
        $this->checkIfDemo();
        $this->form_validation->set_rules('title''Title''trim|required|min_length[2]|max_length[50]');
        $this->form_validation->set_rules('code''Code''trim|required|min_length[2]|max_length[50]');
        $this->form_validation->set_rules('description''Description''trim|required|min_length[10]|max_length[5000]');

        $edit $this->xssCleanInput('course_id') ? $this->xssCleanInput('course_id') : false;

        if ($this->form_validation->run() === FALSE) {
            echo json_encode(array(
                'success' => 'false',
                'messages' => $this->ajaxErrorMessage(array('error' => validation_errors()))
            ));
        } elseif ($this->AdminCourseModel->valueExist('code'$this->xssCleanInput('code'), $edit)) {
            echo json_encode(array(
                'success' => 'false',
                'messages' => $this->ajaxErrorMessage(array('error' => lang('code_already_exist')))
            ));
        } else {
            $data $this->AdminCourseModel->storeCourse($edit);
            echo json_encode(array(
                'success' => 'true',
                'messages' => $this->ajaxErrorMessage(array('success' => lang('course') . ($edit lang('updated') : lang('created')))),
                'data' => $data
            
));
        }
    


Thanks !
Reply


Messages In This Thread
Add the edit option - by Mfn_ofc - 01-07-2021, 02:26 AM
RE: Add the edit option - by nicojmb - 01-07-2021, 07:15 AM
RE: Add the edit option - by Mfn_ofc - 01-07-2021, 08:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB