public static function show($params = null) { // Init libs $CustomerRequests = new Structures\CustomerRequests(); $Properties = new Structures\Properties(); // Get requests $requests = $CustomerRequests->get(); // Attach info about properties foreach ($requests as &$request) { $request->property = $Properties->get($request->property_id); } // Do the regular action parent::show(['requests' => $requests]); }
public static function show($params = null) { // Init libs $ProcessingProperties = new Structures\ProcessingProperties(); // Define timezone $timezone = new \DateTimeZone(get_option("timezone_string")); // Add info about unprocessed properties $unprocessed_qty = $ProcessingProperties->getNumberOfUnprocessed(); if ($unprocessed_qty > 0) { self::$positive_messages[] = "There is {$unprocessed_qty} unprocessed properties"; } // Add info about fetched today properties $fetched_today_qty = $ProcessingProperties->getNumberOfFetched((new \Datetime("now", $timezone))->format("Y-m-d")); if ($fetched_today_qty > 0) { self::$positive_messages[] = "There is {$fetched_today_qty} fetched properties today"; } // Add info about processed today properties $processed_today_qty = $ProcessingProperties->getNumberOfProcessed((new \Datetime("now", $timezone))->format("Y-m-d")); if ($processed_today_qty > 0) { self::$positive_messages[] = "There is {$processed_today_qty} processed properties today"; } // Do the regular action parent::show(['class' => !empty($_POST['class']) ? $_POST['class'] : null]); }