render_costs_tracker_widget_content(); ?>
clients_sites = array(); // get all sites of the $client_id. $cls_sites = MainWP_DB_Client::instance()->get_websites_by_client_ids( array( $client_id ) ); if ( is_array( $cls_sites ) ) { foreach ( $cls_sites as $cls_site ) { if ( ! empty( $cls_site->client_id ) && ! isset( $this->clients_sites[ $cls_site->client_id ] ) ) { $this->clients_sites[ $cls_site->client_id ] = array(); } $this->clients_sites[ $cls_site->client_id ][] = $cls_site->id; } } $client_costs = Cost_Tracker_DB::get_instance()->get_all_cost_trackers_by_clients( array( $client_id ), array( 'get_cost_sites' => true ) ); if ( is_array( $client_costs ) ) { $client_costs = current( $client_costs ); // for current client. } if ( ! is_array( $client_costs ) ) { $client_costs = array(); } ?> column_default( $item, $col, $client_id ); echo $row; // phpcs:ignore -- ok. } ?>
name ); break; case 'number_sites': // for client widget. $out = property_exists( $item, 'number_client_costs_sites' ) && is_array( $item->number_client_costs_sites ) ? count( $item->number_client_costs_sites ) : 0; break; case 'price': // for client widget. $array_costs = array( 'weekly' => 0, 'monthly' => 0, 'quarterly' => 0, 'yearly' => 0, 'lifetime' => 0, ); if ( 'active' === $item->cost_status && is_array( $item->cost_sites_ids ) ) { foreach ( $item->cost_sites_ids as $ct_siteid ) { // if site of cost tracker in the client's sites then calculate the site's cost/price. if ( is_array( $this->clients_sites[ $client_id ] ) && in_array( $ct_siteid, $this->clients_sites[ $client_id ] ) ) { $cost_val = 0; if ( 'single_site' === $item->license_type ) { $cost_val = $item->price; } elseif ( 'multi_site' === $item->license_type && ! empty( $item->count_sites ) ) { $cost_val = $item->price / $item->count_sites; } if ( 'lifetime' === $item->type ) { $array_costs['lifetime'] += $cost_val; } elseif ( isset( $array_costs[ $item->renewal_type ] ) ) { $array_costs[ $item->renewal_type ] += $cost_val; } $order_val += $cost_val; } } } $out = Cost_Tracker_Utility::get_separated_costs_price( $array_costs ); break; case 'actions': ob_start(); ?> ' . $out . ''; } else { $out = '' . $out . ''; } return $out; } }