OEModule\OphCiExamination\controllers\AdminController::actionSortNoTreatmentReasons PHP Method

actionSortNoTreatmentReasons() public method

* sorts the no treatment reasons into the provided order (NOTE does not support a paginated list of reasons)
    public function actionSortNoTreatmentReasons()
    {
        if (!empty($_POST['order'])) {
            foreach ($_POST['order'] as $i => $id) {
                if ($drug = models\OphCiExamination_InjectionManagementComplex_NoTreatmentReason::model()->findByPk($id)) {
                    $drug->display_order = $i + 1;
                    if (!$drug->save()) {
                        throw new \Exception('Unable to save drug: ' . print_r($drug->getErrors(), true));
                    }
                }
            }
        }
    }