コード例 #1
0
ファイル: SaveAjax.php プロジェクト: rcrrich/UpdatePackages
 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();
 }
コード例 #2
0
ファイル: SaveAjax.php プロジェクト: rcrrich/UpdatePackages
 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();
 }
コード例 #3
0
 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);
 }
コード例 #4
0
ファイル: Colors.php プロジェクト: JeRRimix/YetiForceCRM
 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);
 }
コード例 #5
0
ファイル: UserColors.php プロジェクト: rcrrich/UpdatePackages
 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);
 }
コード例 #6
0
 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;
     }
 }