widgetName = JText::translate('VBO_W_WEEKLYB_TITLE'); $this->widgetDescr = JText::translate('VBO_W_WEEKLYB_DESCR'); $this->widgetId = basename(__FILE__, '.php'); /** * Define widget and icon and style name. * * @since 1.15.0 (J) - 1.5.0 (WP) */ $this->widgetIcon = ''; $this->widgetStyleName = 'brown'; } public function render(VBOMultitaskData $data = null) { // increase widget's instance counter static::$instance_counter++; // check whether the widget is being rendered via AJAX when adding it through the customizer $is_ajax = $this->isAjaxRendering(); // widget instance identifier $widget_instance = $is_ajax ? -1 : static::$instance_counter; JFactory::getDocument()->addScript(VBO_ADMIN_URI.'resources/donutChart.js'); $wdaysmap = array( '0' => JText::translate('VBSUNDAY'), '1' => JText::translate('VBMONDAY'), '2' => JText::translate('VBTUESDAY'), '3' => JText::translate('VBWEDNESDAY'), '4' => JText::translate('VBTHURSDAY'), '5' => JText::translate('VBFRIDAY'), '6' => JText::translate('VBSATURDAY') ); $today_end_ts = mktime(23, 59, 59, date("n"), date("j"), date("Y")); $busy = VikBooking::getAdminWidgetsInstance()->loadBusyRecordsUnclosed(); $info_rooms = array( 'unpublished_rooms' => VikBooking::getAdminWidgetsInstance()->getRoomsData('unpublished_rooms'), 'tot_rooms_units' => VikBooking::getAdminWidgetsInstance()->getRoomsData('tot_rooms_units'), ); $no_av_rooms = false; if (!$info_rooms['tot_rooms_units']) { $no_av_rooms = true; $info_rooms['tot_rooms_units'] = 1; } // chart for rooms sold today and all week ?>

widgetIcon; ?>

0) { foreach ($busy as $idroom => $rbusy) { if (in_array($idroom, $info_rooms['unpublished_rooms'])) { continue; } foreach ($rbusy as $b) { $tmpone = getdate($b['checkin']); $ritts = mktime(0, 0, 0, $tmpone['mon'], $tmpone['mday'], $tmpone['year']); $tmptwo = getdate($b['checkout']); $conts = mktime(0, 0, 0, $tmptwo['mon'], $tmptwo['mday'], $tmptwo['year']); if ($today_ts >= $ritts && $today_ts < $conts) { $tot_booked_today++; } } } } $percentage_booked = $no_av_rooms ? 0 : round((100 * $tot_booked_today / $info_rooms['tot_rooms_units']), 2); $outer_color = '#ff4d4d'; //red if ($percentage_booked > 33 && $percentage_booked <= 66) { $outer_color = '#ffa64d'; //orange } elseif ($percentage_booked > 66 && $percentage_booked < 100) { $outer_color = '#2a762c'; //green } elseif ($percentage_booked >= 100) { $outer_color = '#2482b4'; //light-blue } ?>