Messages::_updateMessageState PHP Method

_updateMessageState() private method

private _updateMessageState ( $state = '', $staff_id = '', $folder = '', $display_error = TRUE )
    private function _updateMessageState($state = '', $staff_id = '', $folder = '', $display_error = TRUE)
    {
        if (is_numeric($staff_id)) {
            if ($state === 'unread') {
                $alert = $this->lang->line('alert_mark_as_unread');
            } else {
                if ($state === 'read') {
                    $alert = $this->lang->line('alert_mark_as_read');
                } else {
                    if ($state === 'restore') {
                        $alert = $this->lang->line('alert_move_to_inbox');
                    } else {
                        if ($state === 'archive') {
                            $alert = $this->lang->line('alert_move_to_archive');
                        } else {
                            if ($state === 'trash') {
                                $alert = $this->lang->line('alert_move_to_trash');
                            }
                        }
                    }
                }
            }
            if ($state !== '' and $this->input->post('delete')) {
                if ($folder === 'draft') {
                    $this->Messages_model->deleteMessage($this->input->post('delete'), $staff_id);
                } else {
                    $this->Messages_model->updateState($this->input->post('delete'), $staff_id, $state, $folder);
                }
                $num = count($this->input->post('delete'));
                if ($num > 0) {
                    $alert_msg = $num == 1 ? 'Message ' . $alert : $num . ' messages ' . $alert;
                    if ($display_error === TRUE) {
                        $this->alert->set('success', $alert_msg);
                    }
                    return TRUE;
                }
            }
        }
        return FALSE;
    }