/** * Formats date using current date format. * * @param Date $date in YYYY-MM-DD format * @return formatted date. */ function set_datepicker_date_format($date) { if (sfContext::hasInstance()) { $dateFormat = sfContext::getInstance()->getUser()->getDateFormat(); } else { $configService = new ConfigService(); $dateFormat = $configService->getAdminLocalizationDefaultDateFormat(); } if (empty($date)) { $formattedDate = null; } else { $dateArray = explode('-', $date); $dateTime = new DateTime(); $year = $dateArray[0]; $month = $dateArray[1]; $day = $dateArray[2]; // For timestamp fields, clean time part from $day (day will look like "21 00:00:00" $day = trim($day); $spacePos = strpos($day, ' '); if ($spacePos !== FALSE) { $day = substr($day, 0, $spacePos); } $dateTime->setDate($year, $month, $day); $formattedDate = $dateTime->format($dateFormat); } return $formattedDate; }
/** * Listens for the context.load_factories event. By this time, all core * classes are loaded, and we can add any initialization which needs to * run after classes are loaded. * * @param sfEvent $event */ public function loadFactoriesListener(sfEvent $event) { // Create key cache for hs_hr_config values $ohrmConfigCache = new ohrmKeyValueCache('config', function () { $configService = new ConfigService(); return $configService->getAllValues(); }); sfContext::getInstance()->setOhrmConfigCache($ohrmConfigCache); // use csrf_secret from hs_hr_config (overrides value in settings.yml) $csrfSecret = $ohrmConfigCache->get('csrf_secret'); if (!empty($csrfSecret)) { sfForm::enableCSRFProtection($csrfSecret); } }
function getPagina($id){ global $buscarPorItem; if($buscarPorItem){ return buscarPorItem($id); } $url = "http://".$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $paginaService = new PaginaService(); $pagina = $paginaService->buscarPorUrl($url, $id); $configService = new ConfigService(); $config = new Config(); $config->id = 1; $config = $configService->buscar($config); @$pagina->titulo .= " - " . $config->nome; return $pagina; }
break; case "time": $arrRights = $arrAllRights[TimeM]; break; case "recruit": $arrRights = $arrAllRights[Recruit]; break; case "perform": $arrRights = $arrAllRights[Perform]; break; } $_SESSION['localRights'] = $arrRights; $styleSheet = CommonFunctions::getTheme(); $authorizeObj = new authorize($_SESSION['empID'], $_SESSION['isAdmin']); // Default leave home page $configService = new ConfigService(); $leavePeriodDefined = $configService->isLeavePeriodDefined(); if (!$leavePeriodDefined) { if ($authorizeObj->isAdmin()) { $leaveHomePage = './symfony/web/index.php/leave/defineLeavePeriod'; } else { $leaveHomePage = './symfony/web/index.php/leave/showLeavePeriodNotDefinedWarning'; } } else { if ($authorizeObj->isAdmin()) { $leaveHomePage = './symfony/web/index.php/leave/viewLeaveList/reset/1'; } else { if ($authorizeObj->isSupervisor()) { if ($authorizeObj->isAdmin()) { $leaveHomePage = './symfony/web/index.php/leave/viewLeaveList/reset/1'; } else {