Options::set_sections()
Source
File: classes/Options.php
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | public function set_sections() { $pages = dozent_get_pages(); array_walk ( $pages , function ( & $page , $page_id ) { $page = $page . " (" . __( 'id' , 'dozent' ) . ":{$page_id})" ; } ); $sections = []; $sections [ 'general' ] = [ 'title' => __( 'General' , 'dozent' ), 'icon' => 'dicon-home' , 'field_groups' => [ 'general' => [ 'title' => __( 'General' , 'dozent' ), 'desc' => __( 'General Settings' , 'dozent' ), 'fields' => [ 'delete_on_uninstall' => [ 'type' => 'checkbox' , 'title' => __( 'Erase upon uninstallation' , 'dozent' ), 'label_title' => __( 'Enable' , 'dozent' ), 'desc' => __( 'Delete all data during uninstallation' , 'dozent' ), ], 'redirect_back_after_logout' => [ 'type' => 'checkbox' , 'title' => __( 'Redirect back after logout' , 'dozent' ), 'label_title' => __( 'Enable' , 'dozent' ), 'desc' => __( 'This option enable redirect to previous page after logout' , 'dozent' ), ], 'enable_focus_mode' => [ 'type' => 'switch' , 'title' => __( 'Focus mode' , 'dozent' ), //'label_title' => __('Enable', 'dozent'), 'desc' => __( 'Distraction-free experience while study at the course.' , 'dozent' ), ], 'enable_discussion' => [ 'type' => 'switch' , 'title' => __( 'Discussion' , 'dozent' ), 'desc' => __( 'Discussion allows you to ask questions directly to the instructor.' , 'dozent' ), ], 'auto_approve_instructor' => [ 'type' => 'switch' , 'title' => __( 'Auto Approve Instructor' , 'dozent' ), 'desc' => __( 'Approve instructor automatically right after signup.' , 'dozent' ), ], 'pagination_per_page' => [ 'type' => 'number' , 'title' => __( 'Pagination' , 'dozent' ), 'default' => '20' , 'desc' => __( 'How many results you would like to show per page' , 'dozent' ), ], 'hide_admin_bar_for_users' => [ 'type' => 'checkbox' , 'title' => __( 'Frontend Admin Bar' , 'dozent' ), 'label_title' => __( 'Hide' , 'dozent' ), 'default' => '0' , 'desc' => __( 'Hide admin bar option allow you to hide WordPress admin bar entirely from the frontend. It will still show to administrator roles user' , 'dozent' ), ], 'show_accept_terms_checkbox' => [ 'type' => 'checkbox' , 'title' => __( 'Show Checkbox to accept terms' , 'dozent' ), 'label_title' => __( 'Show' , 'dozent' ), 'default' => '0' , 'desc' => __( 'Show checkbox to accept terms at required forms' , 'dozent' ), ], 'login_error_message' => [ 'type' => 'text' , 'title' => __( 'Error message for wrong login credentials' , 'dozent' ), 'default' => 'Incorrect username or password.' , 'desc' => __( 'Login error message displayed when the user puts wrong login credentials.' , 'dozent' ), ], 'site_logo_id' => [ 'type' => 'media' , 'title' => __( 'Site Logo' , 'dozent' ), 'btn_text' => __( 'Upload Logo' , 'dozent' ), 'attr' => [ 'media_type' => 'image' ], //image,file 'desc' => __( 'Upload your site brand logo.' , 'dozent' ), ], ], ], ], ]; $sections [ 'permalinks' ] = [ 'title' => __( 'Permalinks' , 'dozent' ), 'icon' => 'dicon-link' , 'field_groups' => [ 'permalinks' => [ 'title' => __( 'Dozent permalinks' , 'dozent' ), 'fields' => [ 'course_base_slug' => [ 'type' => 'text' , 'title' => __( 'Course base slug' , 'dozent' ), 'default' => 'courses' , 'desc' => __( 'Enter a course base base to use' , 'dozent' ), ], 'course_category_base_slug' => [ 'type' => 'text' , 'title' => __( 'Course category base slug' , 'dozent' ), 'default' => 'course-category' , 'desc' => __( 'Enter a course category base base to use' , 'dozent' ), ], 'lecture_base_slug' => [ 'type' => 'text' , 'title' => __( 'Lecture base slug' , 'dozent' ), 'default' => 'lecture' , 'desc' => __( 'Enter a lecture base base to use' , 'dozent' ), ], 'assignment_base_slug' => [ 'type' => 'text' , 'title' => __( 'Assignments base slug' , 'dozent' ), 'default' => 'assignment' , 'desc' => __( 'Enter an assignment base base to use' , 'dozent' ), ], 'quiz_base_slug' => [ 'type' => 'text' , 'title' => __( 'Quiz base slug' , 'dozent' ), 'default' => 'quiz' , 'desc' => __( 'Enter a quiz base base to use' , 'dozent' ), ], ], ], ], ]; $sections [ 'pages' ] = [ 'title' => __( 'Pages' , 'dozent' ), 'icon' => 'dicon-book' , 'field_groups' => array ( 'permalinks' => array ( 'title' => __( 'Dozent Pages' , 'dozent' ), 'fields' => array ( 'dozent_dashboard_page_id' => array ( 'type' => 'select' , 'title' => __( 'Dashboard Page' , 'dozent' ), 'default' => '0' , 'options' => $pages , 'desc' => __( 'This page will be used for student and instructor dashboard' , 'dozent' ), ), 'dozent_user_signup_page_id' => array ( 'type' => 'select' , 'title' => __( 'User Signup Page' , 'dozent' ), 'default' => '0' , 'options' => $pages , 'desc' => __( 'Selected page contains a form to signup user' , 'dozent' ), ), 'course_archive_page_id' => array ( 'type' => 'select' , 'title' => __( 'Course Archive Page' , 'dozent' ), 'default' => '0' , 'options' => $pages , 'desc' => __( 'This page will be used as course archive' , 'dozent' ), ), 'terms_and_condition_page_id' => array ( 'type' => 'select' , 'title' => __( 'Terms and Condition Page' , 'dozent' ), 'default' => '0' , 'options' => $pages , 'desc' => __( 'Select a terms and condition page' , 'dozent' ), ), 'privacy_policy_page_id' => array ( 'type' => 'select' , 'title' => __( 'Privacy Policy Page' , 'dozent' ), 'default' => '0' , 'options' => $pages , 'desc' => __( 'Select a privacy policy page' , 'dozent' ), ), ), ) ), ]; $sections [ 'course' ] = [ 'title' => __( 'Course' , 'dozent' ), 'icon' => 'dicon-graduation-cap' , 'field_groups' => array ( 'general' => array ( 'title' => __( 'Course' , 'dozent' ), 'desc' => __( 'Course Settings' , 'dozent' ), 'fields' => array ( 'enable_course_post_type_rest_api' => array ( 'type' => 'checkbox' , 'title' => __( 'Show in rest' , 'dozent' ), 'label_title' => __( 'Enable' , 'dozent' ), 'desc' => __( 'Whether to expose this post type in the REST API. Must be true to enable the Gutenberg editor.' , 'dozent' ), ), 'hide_course_from_shop_page' => array ( 'type' => 'checkbox' , 'title' => __( 'Hide course products' , 'dozent' ), 'label_title' => __( 'Hide course products from shop page' , 'dozent' ), 'desc' => __( 'Enabling this feature will be removed course products from the shop page.' , 'dozent' ), ), 'instructor_can_publish_course' => array ( 'type' => 'checkbox' , 'title' => __( 'Publish Course' , 'dozent' ), 'label_title' => __( 'Can instructor publish a course directly' , 'dozent' ), 'desc' => __( 'Enabling this option allow instructor to publish their course directly, else they course require a review by the admin.' , 'dozent' ), ), /* 'course_completion_process' => array( 'type' => 'radio', 'title' => __( 'Course Completion Process', 'dozent' ), 'default' => 'flexible', 'select_options' => false, 'options' => array( 'flexible' => __( 'Flexible', 'dozent' ), 'strict' => __( 'Strict Mode', 'dozent' ), ), 'desc' => __( 'Students can complete courses anytime in the Flexible mode. In the Strict mode, students have to complete, pass all the lectures and quizzes (if any) to mark a course as complete.', 'dozent' ), ), */ ), ), 'archive' => array ( 'title' => __( 'Archive' , 'dozent' ), 'desc' => __( 'Course Archive Settings' , 'dozent' ), 'fields' => array ( 'course_archive_page' => array ( 'type' => 'select' , 'title' => __( 'Course Archive Page' , 'dozent' ), 'default' => '0' , 'options' => $pages , 'desc' => __( 'The course archive page containing all courses.' , 'dozent' ), ), 'courses_col_per_row' => array ( 'type' => 'slider' , 'title' => __( 'Column Per Row' , 'dozent' ), 'default' => '4' , 'options' => array ( 'min' => 1, 'max' => 6, 'step' => 1 ), 'desc' => __( 'Total column per row.' , 'dozent' ), ), 'courses_per_page' => array ( 'type' => 'slider' , 'title' => __( 'Courses Per Page' , 'dozent' ), 'default' => '12' , 'options' => array ( 'min' => 1, 'max' => 50 ), 'desc' => __( 'How many course you would like to see at the course per page.' , 'dozent' ), ), ), ), ), ]; /* $sections[ 'selling_platform' ] = [ 'title' => __( 'Selling Platform', 'dozent' ), 'icon' => 'dicon-cart', 'field_groups' => array( 'general' => [ 'title' => __( 'Selling Platforms', 'dozent' ), 'desc' => __( 'You can sell the courses via any of the available platforms below.', 'dozent' ), 'fields' => [ 'selling_platform' => [ 'type' => 'radio', 'title' => __( 'Platforms', 'dozent' ), 'default' => 'none', 'select_options' => false, 'options' => dozent_get_selling_platforms(), 'desc' => sprintf( __( 'Select a platform to to start selling courses. Supports: %s', 'dozent' ), 'WooCommerce, Easy Digital Downloads, Paid Memberships Pro' ), ], ], ], ), ];*/ $sections [ 'dozent_earning' ] = [ 'title' => __( 'Earning' , 'dozent' ), 'icon' => 'dicon-money' , 'field_groups' => array ( 'general' => array ( 'title' => __( 'Earning and commission allocation' , 'dozent' ), 'desc' => __( 'Enable Disable Option to on/off notification on various event' , 'dozent' ), 'fields' => array ( 'enable_dozent_earning' => array ( 'type' => 'checkbox' , 'title' => __( 'Earning' , 'dozent' ), 'label_title' => __( 'Enable' , 'dozent' ), 'default' => '0' , 'desc' => __( 'If disabled, the Admin will receive 100% of the earning' , 'dozent' ), ), 'earning_admin_commission' => array ( 'type' => 'number' , 'title' => __( 'Admin Commission Percentage' , 'dozent' ), 'default' => '0' , 'desc' => __( 'Define the commission of the Admin from each sale.(after deducting fees)' , 'dozent' ), ), 'earning_instructor_commission' => array ( 'type' => 'number' , 'title' => __( 'Instructor Commission Percentage' , 'dozent' ), 'default' => '0' , 'desc' => __( 'Define the commission for instructors from each sale.(after deducting fees)' , 'dozent' ), ), 'dozent_earning_fees' => array ( 'type' => 'group_fields' , 'title' => __( 'Fee Deduction' , 'dozent' ), 'desc' => __( 'Fees are charged from the entire sales amount. The remaining amount will be divided among admin and instructors.' , 'dozent' ), 'group_fields' => array ( 'enable_fees_deducting' => array ( 'type' => 'checkbox' , 'title' => __( 'Enable' , 'dozent' ), 'default' => '0' , ), 'fees_name' => array ( 'type' => 'text' , 'title' => __( 'Fees Name' , 'dozent' ), 'default' => '' , ), 'fees_amount' => array ( 'type' => 'number' , 'title' => __( 'Fees Amount' , 'dozent' ), 'default' => '' , ), 'fees_type' => array ( 'type' => 'select' , 'default' => 'minutes' , 'select_options' => false, 'options' => array ( '' => __( 'Select Fees Type' , 'dozent' ), 'percent' => __( 'Percent' , 'dozent' ), 'fixed' => __( 'Fixed' , 'dozent' ), ), ), ), ), 'statement_show_per_page' => array ( 'type' => 'number' , 'title' => __( 'Show Statement Per Page' , 'dozent' ), 'default' => '20' , 'desc' => __( 'Define the number of statements to show.' , 'dozent' ), ), ), ), ), ]; $sections [ 'dozent_withdraw' ] = [ 'title' => __( 'Withdrawal' , 'dozent' ), 'icon' => 'dicon-wallet' , 'field_groups' => [ 'general' => [ 'title' => __( 'Withdrawal Settings' , 'dozent' ), 'fields' => [ 'min_withdraw_amount' => [ 'type' => 'number' , 'title' => __( 'Minimum Withdraw Amount' , 'dozent' ), 'default' => '80' , 'desc' => __( 'Instructors should earn equal or above this amount to make a withdraw request.' , 'dozent' ), ], ], ], 'withdraw_methods' => [ 'title' => __( 'Withdraw Methods' , 'dozent' ), 'desc' => __( 'Set withdraw settings' , 'dozent' ), ], ], ]; $sections = apply_filters( 'dozent/options/attr' , $sections ); $extends = apply_filters( 'dozent/options/extend/attr' , [] ); if ( dozent_count( $extends ) ) { foreach ( $extends as $extend_key => $extend_option ) { if ( isset( $sections [ $extend_key ] ) && dozent_count( $extend_option [ 'field_groups' ] ) ) { $sections = $sections [ $extend_key ][ 'field_groups' ]; $sections = array_merge ( $sections , $extend_option [ 'field_groups' ] ); $sections [ $extend_key ][ 'field_groups' ] = $sections ; } } } return $sections ; } |