@@ -59,6 +59,61 @@ function add() {
59
59
$ data ['timezones ' ] = $ this ->user_model ->timezones ();
60
60
$ data ['language ' ] = 'english ' ;
61
61
62
+ // Set defaults
63
+ $ data ['dashboard_upcoming_dx_card ' ] = false ;
64
+ $ data ['dashboard_qslcard_card ' ] = false ;
65
+ $ data ['dashboard_eqslcard_card ' ] = false ;
66
+ $ data ['dashboard_lotw_card ' ] = false ;
67
+ $ data ['dashboard_vuccgrids_card ' ] = false ;
68
+
69
+ $ dashboard_options = $ this ->user_options_model ->get_options ('dashboard ' )->result ();
70
+
71
+ foreach ($ dashboard_options as $ item ) {
72
+ $ option_name = $ item ->option_name ;
73
+ $ option_key = $ item ->option_key ;
74
+ $ option_value = $ item ->option_value ;
75
+
76
+ if ($ option_name == 'dashboard_upcoming_dx_card ' && $ option_key == 'enabled ' ) {
77
+ if ($ item ->option_value == 'true ' ) {
78
+ $ data ['dashboard_upcoming_dx_card ' ] = true ;
79
+ } else {
80
+ $ data ['dashboard_upcoming_dx_card ' ] = false ;
81
+ }
82
+ }
83
+
84
+ if ($ option_name == 'dashboard_qslcards_card ' && $ option_key == 'enabled ' ) {
85
+ if ($ item ->option_value == 'true ' ) {
86
+ $ data ['dashboard_qslcard_card ' ] = true ;
87
+ } else {
88
+ $ data ['dashboard_qslcard_card ' ] = false ;
89
+ }
90
+ }
91
+
92
+ if ($ option_name == 'dashboard_eqslcards_card ' && $ option_key == 'enabled ' ) {
93
+ if ($ item ->option_value == 'true ' ) {
94
+ $ data ['dashboard_eqslcard_card ' ] = true ;
95
+ } else {
96
+ $ data ['dashboard_eqslcard_card ' ] = false ;
97
+ }
98
+ }
99
+
100
+ if ($ option_name == 'dashboard_lotw_card ' && $ option_key == 'enabled ' ) {
101
+ if ($ item ->option_value == 'true ' ) {
102
+ $ data ['dashboard_lotw_card ' ] = true ;
103
+ } else {
104
+ $ data ['dashboard_lotw_card ' ] = false ;
105
+ }
106
+ }
107
+
108
+ if ($ option_name == 'dashboard_vuccgrids_card ' && $ option_key == 'enabled ' ) {
109
+ if ($ item ->option_value == 'true ' ) {
110
+ $ data ['dashboard_vuccgrids_card ' ] = true ;
111
+ } else {
112
+ $ data ['dashboard_vuccgrids_card ' ] = false ;
113
+ }
114
+ }
115
+ }
116
+
62
117
if ($ this ->form_validation ->run () == FALSE ) {
63
118
$ data ['page_title ' ] = "Add User " ;
64
119
$ data ['measurement_base ' ] = $ this ->config ->item ('measurement_base ' );
@@ -757,6 +812,37 @@ function profile() {
757
812
$ this ->load ->view ('interface_assets/footer ' );
758
813
}
759
814
815
+
816
+ /**
817
+ * Deletes a user by their ID.
818
+ *
819
+ * This function first loads the 'user_model'. It then checks if the current user has the authorization level of 99.
820
+ * If not, it sets a flash message and redirects the user to the dashboard.
821
+ *
822
+ * If the user is authorized, it gets the user to be deleted by their ID from the URI segment 3.
823
+ * It then calls the 'delete' function from the 'user_model' with the user ID as a parameter.
824
+ *
825
+ * If the 'delete' function executes successfully, it sets the HTTP status code to 200.
826
+ * If the 'delete' function fails, it sets the HTTP status code to 500.
827
+ *
828
+ * @param int $id The ID of the user to delete.
829
+ */
830
+ function delete_new ($ id ) {
831
+ $ this ->load ->model ('user_model ' );
832
+ if (!$ this ->user_model ->authorize (99 )) { $ this ->session ->set_flashdata ('notice ' , 'You \'re not allowed to do that! ' ); redirect ('dashboard ' ); }
833
+ $ query = $ this ->user_model ->get_by_id ($ this ->uri ->segment (3 ));
834
+
835
+ // call $this->user_model->delete and if no errors return true
836
+ if ($ this ->user_model ->delete ($ id )) {
837
+ // request responds with a 200 status code and empty content
838
+ $ this ->output ->set_status_header (200 );
839
+ } else {
840
+ // request responds with a 500 status code and empty content
841
+ $ this ->output ->set_status_header (500 );
842
+ }
843
+
844
+ }
845
+
760
846
function delete () {
761
847
$ this ->load ->model ('user_model ' );
762
848
if (!$ this ->user_model ->authorize (99 )) { $ this ->session ->set_flashdata ('notice ' , 'You \'re not allowed to do that! ' ); redirect ('dashboard ' ); }
0 commit comments