Files
old-new-wiaas/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php
2018-10-30 17:20:56 +01:00

85 lines
1.6 KiB
PHP

<?php
class Wiaas_Delivery_Process_Action {
public static function init() {
}
/**
* @param Wiaas_Delivery_Process_Step $step
*/
public static function get_step_action_form(Wiaas_Delivery_Process_Step $step) {
if (empty($step->target_form_id)) {
return null;
}
$action_form = GFAPI::get_form($step->target_form_id);
if (! $action_form) {
return null;
}
}
public static function get_step_action_entries(Wiaas_Delivery_Process_Step $step) {
$action_form = self::get_step_action_form($step);
if (!$action_form) {
return array();
}
$search_criteria = array(
'status' => 'active',
'field_filters' => array(
array( 'key' => 'wiaas_delivery_process_id',
'value' => $step->get_entry_id()
),
),
);
$sorting = array( 'key' => 'date_created', 'direction' => 'DESC' );
return GFAPI::get_entries( $action_form, $search_criteria, $sorting );
}
public static function get_action_forms() {
$forms = GFAPI::get_forms();
$action_forms = array();
foreach ( $forms as $form ) {
$delivery_settings = rgar($form, 'wiaas_delivery_process');
if ( ! empty($delivery_settings) && $delivery_settings['delivery_form_type'] === 'action'){
$action_forms[] = $form;
}
}
return $action_forms;
}
public static function is_action_form($form) {
$delivery_settings = rgar($form, 'wiaas_delivery_process');
return ! empty($delivery_settings) && $delivery_settings['delivery_form_type'] === 'action';
}
public static function get_customer_step_actions(Wiaas_Delivery_Process_Step $step) {
}
}
Wiaas_Delivery_Process_Action::init();