|
|
|
@@ -34,7 +34,9 @@ class AcareOffice{ |
|
|
|
add_shortcode( 'bts_staff_item', array($this, 'bts_staff_item')); |
|
|
|
add_shortcode( 'bts_client_item', array($this, 'bts_client_item')); |
|
|
|
add_shortcode( 'bts_job_item', array($this, 'bts_job_item')); |
|
|
|
add_shortcode( 'bts_tos_options', array($this, 'bts_tos_options')); |
|
|
|
add_shortcode( 'bts_hours_options', array($this, 'bts_hours_options')); |
|
|
|
add_shortcode( 'bts_select_staff', array($this, 'bts_select_staff')); |
|
|
|
add_shortcode( 'bts_select_client', array($this, 'bts_select_client')); |
|
|
|
|
|
|
|
add_action('wp_ajax_list_staff', array($this,'list_staff' )); |
|
|
|
add_action('wp_ajax_list_client', array($this,'list_client' )); |
|
|
|
@@ -138,7 +140,7 @@ class AcareOffice{ |
|
|
|
return $html; |
|
|
|
} |
|
|
|
|
|
|
|
public function bts_tos_options($attr){ |
|
|
|
public function bts_hours_options($attr){ |
|
|
|
$result = "<select> \n"; |
|
|
|
$options = get_option('bts_payitem_earnings_rate'); |
|
|
|
foreach($options as $o){ |
|
|
|
@@ -149,6 +151,25 @@ class AcareOffice{ |
|
|
|
return $result; |
|
|
|
} |
|
|
|
|
|
|
|
public function bts_select_staff($attr){ |
|
|
|
$result = "<select> \n"; |
|
|
|
$staff = $this->get_people_by_role('staff'); |
|
|
|
foreach ($staff as $u){ |
|
|
|
$result .= sprintf("<option value=%s> %s</option>", $u->user_login, $u->first_name . " " . $u->last_name); |
|
|
|
} |
|
|
|
$result .="</select>"; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
|
|
|
|
public function bts_select_client($attr){ |
|
|
|
$result = "<select> \n"; |
|
|
|
$staff = $this->get_people_by_role('client'); |
|
|
|
foreach ($staff as $u){ |
|
|
|
$result .= sprintf("<option value=%s> %s</option>", $u->user_login, $u->first_name . " " . $u->last_name); |
|
|
|
} |
|
|
|
$result .="</select>"; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
|
|
|
|
//generate template based on html file |
|
|
|
private function template($id, $file) |
|
|
|
@@ -201,6 +222,13 @@ class AcareOffice{ |
|
|
|
wp_die(); |
|
|
|
} |
|
|
|
|
|
|
|
private function get_people_by_role($role){ |
|
|
|
//search all users that are staff |
|
|
|
$staffq = new \WP_User_Query(array('role'=>$role)); |
|
|
|
$staff = $staffq->get_results(); |
|
|
|
return $staff; |
|
|
|
} |
|
|
|
|
|
|
|
//ajax get earnings rates |
|
|
|
function get_payitem_earnings_rate() |
|
|
|
{ |