activity_model.php
3 months ago
agent_meta_model.php
3 months ago
agent_model.php
3 months ago
booking_meta_model.php
3 months ago
booking_model.php
3 months ago
bundle_meta_model.php
3 months ago
bundle_model.php
3 months ago
cart_item_model.php
3 months ago
cart_meta_model.php
3 months ago
cart_model.php
3 months ago
connector_model.php
3 months ago
customer_meta_model.php
3 months ago
customer_model.php
3 months ago
invoice_model.php
3 months ago
join_bundles_services_model.php
3 months ago
location_category_model.php
3 months ago
location_model.php
3 months ago
meta_model.php
3 months ago
model.php
3 months ago
off_period_model.php
3 months ago
order_intent_meta_model.php
3 months ago
order_intent_model.php
3 months ago
order_item_model.php
3 months ago
order_meta_model.php
3 months ago
order_model.php
3 months ago
otp_model.php
3 months ago
payment_request_model.php
3 months ago
process_job_model.php
3 months ago
process_model.php
3 months ago
recurrence_model.php
3 months ago
service_category_model.php
3 months ago
service_meta_model.php
3 months ago
service_model.php
3 months ago
session_model.php
3 months ago
settings_model.php
3 months ago
step_settings_model.php
3 months ago
transaction_intent_model.php
3 months ago
transaction_model.php
3 months ago
transaction_refund_model.php
3 months ago
work_period_model.php
3 months ago
step_settings_model.php
60 lines
| 1 | <?php |
| 2 | |
| 3 | class OsStepSettingsModel extends OsModel { |
| 4 | var $id, |
| 5 | $name, |
| 6 | $value, |
| 7 | $step; |
| 8 | |
| 9 | |
| 10 | function __construct( $id = false ) { |
| 11 | parent::__construct(); |
| 12 | $this->table_name = LATEPOINT_TABLE_STEP_SETTINGS; |
| 13 | $this->nice_names = array(); |
| 14 | |
| 15 | if ( $id ) { |
| 16 | $this->load_by_id( $id ); |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | |
| 21 | public function get_step_value_by_name( $step, $name ) { |
| 22 | $query = $this->db->prepare( 'SELECT * FROM ' . $this->table_name . ' WHERE name = %s AND step = %s LIMIT 1', array( $name, $step ) ); |
| 23 | $result_row = $this->db->get_row( $query, ARRAY_A ); |
| 24 | if ( $result_row ) { |
| 25 | return $result_row['value']; |
| 26 | } else { |
| 27 | return false; |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | |
| 32 | protected function allowed_params( $role = 'admin' ) { |
| 33 | $allowed_params = array( |
| 34 | 'name', |
| 35 | 'value', |
| 36 | 'step', |
| 37 | ); |
| 38 | return $allowed_params; |
| 39 | } |
| 40 | |
| 41 | |
| 42 | protected function params_to_save( $role = 'admin' ) { |
| 43 | $params_to_save = array( |
| 44 | 'name', |
| 45 | 'value', |
| 46 | 'step', |
| 47 | ); |
| 48 | return $params_to_save; |
| 49 | } |
| 50 | |
| 51 | protected function properties_to_validate() { |
| 52 | $validations = array( |
| 53 | 'name' => array( 'presence' ), |
| 54 | 'value' => array( 'presence' ), |
| 55 | 'step' => array( 'presence' ), |
| 56 | ); |
| 57 | return $validations; |
| 58 | } |
| 59 | } |
| 60 |