public function process(Vtiger_Request $request) { $params = $request->get('param'); $moduleModel = Settings_TimeControlProcesses_Module_Model::getCleanInstance(); $response = new Vtiger_Response(); $response->setResult(array('success' => $moduleModel->setConfig($params), 'message' => vtranslate('LBL_SAVE_CONFIG', $request->getModule(false)))); $response->emit(); }
public function process(Vtiger_Request $request) { $log = vglobal('log'); $log->debug('Start ' . __CLASS__ . ':' . __FUNCTION__); $qualifiedModule = $request->getModule(false); $moduleModel = Settings_TimeControlProcesses_Module_Model::getCleanInstance(); $currentUser = Users_Record_Model::getCurrentUserModel(); $viewer = $this->getViewer($request); $viewer->assign('QUALIFIED_MODULE', $qualifiedModule); $viewer->assign('USER_MODEL', $currentUser); $viewer->assign('MODULE_MODEL', $moduleModel->getConfigInstance()); $viewer->view('Index.tpl', $qualifiedModule); $log->debug('End ' . __CLASS__ . ':' . __FUNCTION__); }
public function process(Vtiger_Request $request) { $currentUser = Users_Record_Model::getCurrentUserModel(); $loggedUserId = $currentUser->get('id'); $viewer = $this->getViewer($request); $moduleName = $request->getModule(); $linkId = $request->get('linkid'); $user = $request->get('user'); $time = $request->get('time'); if ($time == NULL) { $time['start'] = date('Y-m-d', strtotime("-1 week")); $time['end'] = date("Y-m-d"); } else { // date parameters passed, convert them to YYYY-mm-dd $time['start'] = Vtiger_Functions::currentUserDisplayDate($time['start']); $time['end'] = Vtiger_Functions::currentUserDisplayDate($time['end']); } if ($user == NULL) { $user = $loggedUserId; } $moduleModel = Vtiger_Module_Model::getInstance($moduleName); $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId()); $data = $this->getWidgetTimeControl($user, $time); $daysAmount = count($data['ticks']); $listViewUrl = 'index.php?module=OSSTimeControl&view=List'; for ($i = 0; $i < $daysAmount; $i++) { $data['links'][$i][0] = $i; $data['links'][$i][1] = $listViewUrl . $this->getSearchParams($user, $data['days'][$i]); } $publicHolidays = Settings_PublicHoliday_Module_Model::getHolidayGroupType([$time['start'], $time['end']]); if ($publicHolidays) { foreach ($publicHolidays as $key => $value) { $upperCase = strtoupper($key); $viewer->assign($upperCase, $value); } } $TCPModuleModel = Settings_TimeControlProcesses_Module_Model::getCleanInstance(); $viewer->assign('TCPMODULE_MODEL', $TCPModuleModel->getConfigInstance()); $viewer->assign('USERID', $user); $viewer->assign('DTIME', $time); $viewer->assign('WORKDAYS', $data['workDays']); $viewer->assign('WORKEDDAYS', $data['daysWorked']); $viewer->assign('HOLIDAYDAYS', $data['holiayDays']); $viewer->assign('AVERAGEBREAKTIME', $data['sumBreakTime']); $viewer->assign('WORKINGDAYS', $data['workingDays']); $viewer->assign('WEEKENDDAYS', $data['weekends']); $viewer->assign('AVERAGEWORKTIME', $data['averageWorkingTime']); $viewer->assign('ALLDAYS', $data['allDays']); $viewer->assign('DATA', $data); $viewer->assign('WIDGET', $widget); $viewer->assign('MODULE_NAME', $moduleName); $viewer->assign('CURRENTUSER', $currentUser); $viewer->assign('LOGGEDUSERID', $loggedUserId); $content = $request->get('content'); if (!empty($content)) { $viewer->view('dashboards/TimeControlContents.tpl', $moduleName); } else { $viewer->view('dashboards/TimeControl.tpl', $moduleName); } }