public function updateNotWorkingDays(Vtiger_Request $request) { $params = $request->get('param'); Settings_Calendar_Module_Model::updateNotWorkingDays($params); $response = new Vtiger_Response(); $response->setResult(array('success' => true, 'message' => vtranslate('LBL_SAVE_ACTIVE_TYPE', $request->getModule(false)))); $response->emit(); }
public function UpdateColor(Vtiger_Request $request) { $params = $request->get('params'); Settings_Calendar_Module_Model::updateColor($params); $response = new Vtiger_Response(); $response->setResult(array('success' => true, 'message' => vtranslate('LBL_SAVE_COLOR', $request->getModule(false)))); $response->emit(); }
public function process(Vtiger_Request $request) { $moduleName = $request->getModule(); $qualifiedModuleName = $request->getModule(false); $moduleModel = Settings_Calendar_Module_Model::getInstance($qualifiedModuleName); $viewer = $this->getViewer($request); $viewer->assign('MODULE_MODEL', $moduleModel); $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName); $viewer->assign('MODULE', $moduleName); $viewer->view('ActivityTypes.tpl', $qualifiedModuleName); }
public function process(Vtiger_Request $request) { $tablesAll = Users_Colors_Model::getTablesAll(); $moduleName = $request->getModule(); $qualifiedModuleName = $request->getModule(false); $moduleModel = Settings_Calendar_Module_Model::getInstance($qualifiedModuleName); $viewer = $this->getViewer($request); $viewer->assign('MODULE_MODEL', $moduleModel); $viewer->assign('TABLES_ALL', $tablesAll); $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName); $viewer->assign('MODULE', $moduleName); $viewer->view('Colors.tpl', $qualifiedModuleName); }
public function process(Vtiger_Request $request) { $moduleName = $request->getModule(); $qualifiedModuleName = $request->getModule(false); $moduleModel = Settings_Calendar_Module_Model::getInstance($qualifiedModuleName); $notWorkDays = Settings_Calendar_Module_Model::getNotWorkingDays(); $viewer = $this->getViewer($request); $viewer->assign('MODULE_MODEL', $moduleModel); $viewer->assign('NOTWORKINGDAYS', $notWorkDays); $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName); $viewer->assign('MODULE', $moduleName); $viewer->view('UserColors.tpl', $qualifiedModuleName); }
public function getDays($startDate, $endDate) { $holidayDays = Settings_PublicHoliday_Module_Model::getHolidays([$startDate, $endDate]); $notWorkingDaysType = Settings_Calendar_Module_Model::getNotWorkingDays(); $begin = strtotime($startDate); $end = strtotime($endDate); $workDays = 0; if ($begin > $end) { return 0; } else { $days = 0; $weekends = 0; while ($begin <= $end) { $days++; $whatDay = date("N", $begin); $day = date('Y-m-d', $begin); $isWorkDay = TRUE; $isHolidayNotInWeekend = TRUE; foreach ($holidayDays as $key => $value) { if ($day == $value['date']) { $isWorkDay = FALSE; if ($whatDay > 5) { $isHolidayNotInWeekend = FALSE; } unset($holidayDays[$key]); } } foreach ($notWorkingDaysType as $key => $value) { if ($whatDay == $value) { $isWorkDay = FALSE; } } if ($isWorkDay) { $workDays++; } if ($whatDay > 5 && !$isWorkDay && $notWorkingDaysType) { $weekends++; } $begin += 86400; } $workingDays = $days - $weekends; $result = ['workDays' => $workDays, 'weekends' => $weekends, 'days' => $days]; return $result; } }