Code Duplication    Length = 22-24 lines in 2 locations

application/modules/callbacks/admin.php 2 locations

@@ 299-322 (lines=24) @@
296
        }
297
    }
298
299
    public function changeStatus() {
300
        $callbackId = (int) $this->input->post('CallbackId');
301
        $statusId = (int) $this->input->post('StatusId');
302
303
        $model = SCallbacksQuery::create()
304
            ->findPk($callbackId);
305
306
        $newStatusId = SCallbackStatusesQuery::create()->setComment(__METHOD__)->joinWithI18n(MY_Controller::defaultLocale())->findOneById((int) $statusId);
307
308
        if ($newStatusId && $model) {
309
            $model->setStatusId($statusId);
310
            $model->setUserId($this->dx_auth->get_user_id());
311
            $model->save();
312
313
            $message = lang('Callback status changed to', 'callbacks') . ' ' . $newStatusId->getText() . '. '
314
                . lang('Id:', 'callbacks') . ' '
315
                . $callbackId;
316
            $this->lib_admin->log($message);
317
318
            showMessage(lang("Callback's status was changed", 'callbacks'));
319
            pjax('/admin/components/run/callbacks#callbacks_' . $this->input->post('StatusId'));
320
321
        }
322
    }
323
324
    public function reorderThemes() {
325
        $positions = $this->input->post('positions');
@@ 336-357 (lines=22) @@
333
        }
334
    }
335
336
    public function changeTheme() {
337
        $callbackId = (int) $this->input->post('CallbackId');
338
        $themeId = (int) $this->input->post('ThemeId');
339
340
        $model = SCallbacksQuery::create()
341
            ->findPk($callbackId);
342
343
        if ($model !== null) {
344
            $model->setThemeId($themeId);
345
            $model->setUserId($this->dx_auth->get_user_id());
346
            $model->save();
347
348
            $theme = SCallbackThemesI18nQuery::create()->setComment(__METHOD__)->filterById($themeId)->filterByLocale(MY_Controller::defaultLocale())->findOne();
349
350
            $message = lang('Callback theme changed to', 'callbacks') . ' ' . ($theme ? $theme->getText() : lang('Does not have', 'callbacks')) . '. '
351
                . lang('Id:', 'callbacks') . ' '
352
                . $callbackId;
353
            $this->lib_admin->log($message);
354
355
            showMessage(lang('Callback theme is changed', 'callbacks'));
356
        }
357
    }
358
359
    /**
360
     * Delete callback