public function testUrlBuilderCycleShard() { // generate a url for the number of domains in use ensure they're cycled through... $domains = array("jackangers.imgix.net", "jackangers2.imgix.net", "jackangers3.imgix.net"); $ub = new URLBuilder($domains, false, "", ShardStrategy::CRC, false); $ub->setShardStrategy(ShardStrategy::CYCLE); for ($i = 0; $i < 100; $i++) { $used = array(); foreach ($domains as $domain) { $url = $ub->createURL("chester.png"); $curDomain = parse_url($url)["host"]; $this->assertFalse(in_array($curDomain, $used)); $used[] = $curDomain; } } }
/** * Smarty plugin * @package Smarty * @subpackage plugins */ function smarty_function_URLBuilder($params, &$smarty) { $values = $params['values']; $script = $params['script']; $merge = strtolower(trim($params['merge'])); if ($merge == 'false') { $merge = FALSE; } else { $merge = TRUE; } /* if ( empty($script) ) { $smarty->trigger_error("URLBuilder: missing 'script' parameter"); } */ if (!empty($values)) { $values_arr = explode(",", $values); $url_builder_arr = array(); foreach ($values_arr as $value_pair) { $split_pairs = explode("=", $value_pair); $url_builder_arr[$split_pairs[0]] = $split_pairs[1]; } $retval = URLBuilder::getURL($url_builder_arr, $script, $merge); } else { $retval = URLBuilder::getURL(NULL, $script); } //Debug::Text('URL: '. $retval, __FILE__, __LINE__, __METHOD__, 10); return $retval; }
private function mainTreeRender(Tree &$tree, $selectedKey) { $li = new Li(); $mainDiv = new Div(); $mainDiv->addStyleClasses(["expand", "text_non_select", "tree_text_node", "input_hover"]); $table = new Table(); $tr = new Tr(); $nodeIcon = new Td(); $nodeText = new Td(); $nodeText->addStyleClass("tree_text"); $nodeSearchCount = new Td(); $nodeSearchCount->addStyleClass("tree_search_count"); if (count($tree->childrens) > 0) { $nodeIcon->addStyleClasses(["tree_btn"]); $icon = new Img(); $icon->addAttribute("style", "top: 2px; position: relative; margin: 0 5px;"); $icon->addAttribute("src", $this->treeLevel <= $this->DEFAULT_TREE_LEVEL_TO_SHOW || $tree->show ? "images/arrow90.png" : "images/arrow00.png"); $nodeIcon->addChild($icon); } else { $nodeIcon->addStyleClass("tree_empty"); } $link = new A(); $link->addAttribute("href", URLBuilder::getCatalogLinkForTree($tree->key)); $link->addChild($tree->value); $link->addStyleClass("input_hover"); $nodeSelected = new Div(); $nodeSelected->addStyleClass($tree->key == $selectedKey ? 'selected' : 'tree_empty'); $link->addChild($nodeSelected); $nodeText->addChild($link); return $li->addChild($mainDiv->addChild($table->addChild($tr->addChildList([$nodeIcon, $nodeText, $nodeSearchCount])))); }
public function getLink($pageNumber, $num) { $mainTag = new A(); $mainTag->addStyleClasses(["link_style", "cursor_pointer", "text_non_select", "f-15", "input_hover"]); $mainTag->addAttribute("href", URLBuilder::getCatalogLinkNumeric($pageNumber, $num)); $mainTag->addChild($pageNumber); return $mainTag; }
public function getPaginationLinks($pageNumber, $num, $totalCount, $topBottom) { $mainTag = new Div(); $catalogLink = new CatalogLink(); $dots = false; $topBottomStyle = $topBottom == 'bottom' ? 'link_next_prev_bottom' : ''; if ($totalCount != 0) { $amountPages = ceil($totalCount / $num); if ($pageNumber > 0 && $pageNumber <= $amountPages) { $mainTag->addStyleClasses(["pagination_bar", "right_top_bar", $topBottomStyle]); $brokerTag = new Div(); $mainTag->addChild($brokerTag); $tagCenterContainer = new Span(); if ($pageNumber != 1) { $tagPrevious = new A(); $tagPrevious->addStyleClasses(["f-16", "text_non_select", "link_style", "link_next_prev", "input_hover", "prev_link"]); $tagPrevious->addAttribute("href", URLBuilder::getCatalogLinkPrev($pageNumber, $num)); $text = new Div(); $text->addStyleClass("text"); $text->addChild("назад"); $arrow = new Div(); $arrow->addStyleClass("arrow"); $tagCenterContainer->addChild($tagPrevious->addChildList([$arrow, $text])); } $brokerTag->addChild($tagCenterContainer); $tagCenterContainer->addStyleClasses(["numeric_links", "f-15"]); for ($currentRenderPage = 1; $currentRenderPage <= $amountPages; $currentRenderPage++) { if ($currentRenderPage < 2 || $currentRenderPage > $pageNumber - $this->linksGroupCount && $currentRenderPage < $pageNumber + $this->linksGroupCount || $currentRenderPage > $amountPages - 1) { $dots = false; if ($currentRenderPage != $pageNumber) { $tagCenterContainer->addChild($catalogLink->getLink($currentRenderPage, $num)); } else { $emptyLinkView = $catalogLink->getEmptyLink($pageNumber); $emptyLinkView->addStyleClass("f-16"); $tagCenterContainer->addChild($emptyLinkView); } } else { if (!$dots) { $dots = true; $tagCenterContainer->addChild($catalogLink->get3dots()); } } } if ($pageNumber != $amountPages) { $tagNext = new A(); $tagNext->addStyleClasses(["f-16", "text_non_select", "link_style", "input_hover", "link_next_prev", "next_link"]); $tagNext->addAttribute("href", URLBuilder::getCatalogLinkNext($pageNumber, $num)); $text = new Div(); $text->addStyleClass("text"); $text->addChild("вперед"); $arrow = new Div(); $arrow->addStyleClass("arrow"); $tagCenterContainer->addChild($tagNext->addChildList([$text, $arrow])); } } } return $mainTag; }
static function setURL($script, $array = NULL) { //Debug::Arr(self::$data, 'Before: ', __FILE__, __LINE__, __METHOD__, 10); if (is_array($array) and count($array) > 0) { self::$data = array_merge(self::$data, $array); } //Debug::Arr(self::$data, 'After: ', __FILE__, __LINE__, __METHOD__, 10); self::$script = $script; return TRUE; }
/** * Smarty plugin * @package Smarty * @subpackage plugins */ function smarty_function_EmbeddedDocumentAttachmentList($params, &$smarty) { $object_type_id = $params['object_type_id']; $object_id = $params['object_id']; $height = $params['height']; if (empty($height)) { $height = 75; } $url = URLBuilder::getURL(array('object_type_id' => $object_type_id, 'object_id' => $object_id), Environment::getBaseURL() . '/document/EmbeddedDocumentAttachmentList.php'); $retval = '<iframe style="width:100%; height:' . $height . 'px; border: 5px" id="DocumentAttachmentFactory" name="DocumentAttachmentFactory" src="' . $url . '"></iframe>'; return $retval; }
/** * Smarty plugin * @package Smarty * @subpackage plugins */ function smarty_function_EmbeddedMessageList($params, &$smarty) { $object_type_id = $params['object_type_id']; $object_id = $params['object_id']; $height = $params['height']; if (empty($height)) { $height = 250; } //urlbuilder script="../message/EmbeddedMessageList.php" values="object_type_id=10,object_id=$default_schedule_control_id" merge="FALSE"} $url = URLBuilder::getURL(array('object_type_id' => $object_type_id, 'object_id' => $object_id), Environment::getBaseURL() . '/message/EmbeddedMessageList.php'); //$retval = '<iframe style="width:100%; height:'.$height.'px; border: 0px" id="MessageFactory" name="MessageFactory" src="'.$url.'#form_start"></iframe>'; $retval = '<iframe style="width:100%; height:' . $height . 'px; border: 5px" id="MessageFactory" name="MessageFactory" src="' . $url . '"></iframe>'; return $retval; }
private function bottomTreeRender(Tree &$tree, $isRoot) { $children = count($tree->childrens); $span = new Li(); $mainDiv = new Div(); $span->addStyleClass($isRoot); /*if ($children == 0) {*/ $mainDiv = new A(); $span->addChild($mainDiv); $mainDiv->addStyleClasses(["f-17", "cursor_pointer", "bottom_tree_hover", "label"]); $mainDiv->addAttribute(TagLabels::HREF, URLBuilder::getCatalogLinkForTree($tree->key)); /*} else { $span->addChild($mainDiv); $mainDiv->addStyleClasses(["f-17", "label"]); }*/ $mainDiv->addChild($tree->value); return $span; }
private function renderCheckBoxes() { $checkFiz = 'chekbox_check'; $onclickFiz = "onclick=\"window.location='" . URLBuilder::storeModeFiz(YesNoType::YES) . "'\""; $checkUr = 'chekbox_check'; $onclickUr = "onclick=\"window.location='" . URLBuilder::storeModeUr(YesNoType::YES) . "'\""; if (!array_key_exists(Labels::CHECK_UR, $_GET) && array_key_exists(Labels::CHECK_FIZ, $_GET)) { $onclickFiz = ''; $checkUr = ''; } elseif (array_key_exists(Labels::CHECK_UR, $_GET) && !array_key_exists(Labels::CHECK_FIZ, $_GET)) { $onclickUr = ''; $checkFiz = ''; } elseif (array_key_exists(Labels::CHECK_UR, $_GET) && array_key_exists(Labels::CHECK_FIZ, $_GET)) { $onclickFiz = "onclick=\"window.location='" . URLBuilder::storeModeFiz(YesNoType::NO) . "'\""; $onclickUr = "onclick=\"window.location='" . URLBuilder::storeModeUr(YesNoType::NO) . "'\""; } echo "\r\n <div class='float_left chekbox_control font_arial'>\r\n <div id='" . Labels::CHECK_UR . "' class='chekbox float_left cursor_pointer " . $checkUr . "' " . $onclickUr . "></div>\r\n <div class='chekbox_label'>" . Labels::STORE_MODE_UR . "</div>\r\n </div>\r\n <div class='float_left chekbox_control font_arial'>\r\n <div id='" . Labels::CHECK_FIZ . "' class='chekbox float_left cursor_pointer " . $checkFiz . "' " . $onclickFiz . "></div>\r\n <div class='chekbox_label'>" . Labels::STORE_MODE_FIZ . "</div>\r\n </div>\r\n "; }
/** * Smarty plugin * @package Smarty * @subpackage plugins */ function smarty_function_LayerMessageList($params, &$smarty) { $object_type_id = $params['object_type_id']; $object_id = $params['object_id']; $height = $params['height']; if ($object_type_id == '') { return FALSE; } if ($object_id == '') { return FALSE; } if (empty($height)) { $height = 335; } $url = URLBuilder::getURL(array('template' => 1, 'object_type_id' => $object_type_id, 'object_id' => $object_id), Environment::getBaseURL() . '/message/EmbeddedMessageList.php'); $retval = ' <div id="MessageFactoryLayer" style="background:#000000;visibility:hidden; position: absolute; left: 5000px; top: 130px; width: 90%; height:' . $height . 'px"> <div id="rowContent"> <div id="titleTab"><div class="textTitle"><span class="textTitleSub">Messages</span></div></div> </div> <div id="rowContentInner"> <div id="contentBoxTwoEdit"> <table class="tblList"> <tr> <td> '; $retval .= '<iframe style="width:100%; height:' . $height . 'px; border: 5px" id="LayerMessageFactoryFrame" name="LayerMessageFactoryFrame" src="' . $url . '"></iframe>'; $retval .= ' </td> </tr> </table> </div> </div> </div> '; return $retval; }
case 'submit': //Debug::setVerbosity(11); Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10); $fail_transaction = FALSE; if (TTDate::getDayDifference($data['start_date_stamp'], $data['end_date_stamp']) > 31) { Debug::Text('Date Range Exceeds 31 days, truncating', __FILE__, __LINE__, __METHOD__, 10); $sf->Validator->isTrue('date_stamp', FALSE, TTi18n::getText('Date range exceeds the maximum of 31 days')); } if (!(isset($filter_user_id) and is_array($filter_user_id) and count($filter_user_id) > 0)) { $sf->Validator->isTrue('user_id', FALSE, TTi18n::getText('Please select at least one employee')); } if (!($data['start_full_time_stamp'] != '' and $data['end_full_time_stamp'] != '' and $data['start_full_time_stamp'] >= time() - 86400 * 365 and $data['end_full_time_stamp'] <= time() + 86400 * 365)) { $sf->Validator->isTrue('date_stamp', FALSE, TTi18n::getText('Start or End dates are invalid')); } if ($sf->Validator->isValid()) { Redirect::Page(URLBuilder::getURL(array('action' => 'add_mass_schedule', 'filter_user_id' => $filter_user_id, 'data' => $data), '../progress_bar/ProgressBarControl.php')); } default: if ($action != 'submit' and !is_array($data)) { Debug::Text(' ID was NOT passed: ' . $id, __FILE__, __LINE__, __METHOD__, 10); $user_id = NULL; $user_date_id = NULL; $user_full_name = NULL; $user_default_branch = NULL; $user_default_department = NULL; $pay_period_is_locked = FALSE; $time_stamp = $start_date_stamp = $end_date_stamp = TTDate::getBeginDayEpoch(TTDate::getTime()) + 3600 * 12; //Noon $data = array('start_date_stamp' => $start_date_stamp, 'end_date_stamp' => $end_date_stamp, 'start_time' => strtotime('08:00 AM'), 'parsed_start_time' => strtotime('08:00 AM'), 'end_time' => strtotime('05:00 PM'), 'parsed_end_time' => strtotime('05:00 PM'), 'total_time' => 3600 * 9, 'branch_id' => $user_default_branch, 'department_id' => $user_default_department, 'dow' => array(1 => TRUE, 2 => TRUE, 3 => TRUE, 4 => TRUE, 5 => TRUE)); } //var_dump($data);
$pgf->setMealPolicy(array()); } if (isset($data['break_policy_ids'])) { $pgf->setBreakPolicy($data['break_policy_ids']); } else { $pgf->setBreakPolicy(array()); } if (isset($data['holiday_policy_ids'])) { $pgf->setHolidayPolicy($data['holiday_policy_ids']); } else { $pgf->setHolidayPolicy(array()); } if ($pgf->isValid()) { $pgf->Save(); $pgf->CommitTransaction(); Redirect::Page(URLBuilder::getURL(NULL, 'PolicyGroupList.php')); break; } } $pgf->FailTransaction(); default: if (isset($id)) { BreadCrumb::setCrumb($title); $pglf = new PolicyGroupListFactory(); $pglf->getByIdAndCompanyID($id, $current_company->getID()); foreach ($pglf as $pg_obj) { //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10); $data = array('id' => $pg_obj->getId(), 'name' => $pg_obj->getName(), 'meal_policy_ids' => $pg_obj->getMealPolicy(), 'break_policy_ids' => $pg_obj->getBreakPolicy(), 'holiday_policy_ids' => $pg_obj->getHolidayPolicy(), 'exception_policy_control_id' => $pg_obj->getExceptionPolicyControlID(), 'user_ids' => $pg_obj->getUser(), 'over_time_policy_ids' => $pg_obj->getOverTimePolicy(), 'premium_policy_ids' => $pg_obj->getPremiumPolicy(), 'round_interval_policy_ids' => $pg_obj->getRoundIntervalPolicy(), 'accrual_policy_ids' => $pg_obj->getAccrualPolicy(), 'created_date' => $pg_obj->getCreatedDate(), 'created_by' => $pg_obj->getCreatedBy(), 'updated_date' => $pg_obj->getUpdatedDate(), 'updated_by' => $pg_obj->getUpdatedBy(), 'deleted_date' => $pg_obj->getDeletedDate(), 'deleted_by' => $pg_obj->getDeletedBy()); } } $none_array_option = array('0' => TTi18n::gettext('-- None --'));
require_once Environment::getBasePath() . 'includes/Interface.inc.php'; require_once Environment::getBasePath() . 'classes/misc/arr_multisort.class.php'; //Debug::setVerbosity(11); if (!$permission->Check('schedule', 'enabled') or !($permission->Check('schedule', 'view') or $permission->Check('schedule', 'view_own') or $permission->Check('schedule', 'view_child'))) { $permission->Redirect(FALSE); //Redirect } $smarty->assign('title', TTi18n::gettext($title = 'My Schedule')); // See index.php //BreadCrumb::setCrumb($title); BreadCrumb::setCrumb($title, str_replace('ViewScheduleWeek.php', 'ViewSchedule.php', $_SERVER['REQUEST_URI'])); /* * Get FORM variables */ extract(FormVariables::GetVariables(array('do', 'page', 'sort_column', 'sort_order', 'filter_data'))); URLBuilder::setURL($_SERVER['SCRIPT_NAME'], array('sort_column' => $sort_column, 'sort_order' => $sort_order, 'page' => $page)); if (isset($filter_data['start_date']) and $filter_data['start_date'] != '') { $filter_data['start_date'] = TTDate::parseDateTime($filter_data['start_date']); } else { $filter_data['start_date'] = time(); } if (!isset($filter_data['show_days']) or isset($filter_data['show_days']) and $filter_data['show_days'] == '') { $filter_data['show_days'] = 1; } $filter_data['show_days'] = $filter_data['show_days'] * 7; //Get Permission Hierarchy Children first, as this can be used for viewing, or editing. $hlf = TTnew('HierarchyListFactory'); $permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($current_company->getId(), $current_user->getId()); if ($permission->Check('schedule', 'view') == FALSE) { if ($permission->Check('schedule', 'view_child') == FALSE) { $permission_children_ids = array();
if (strtolower($action) == 'delete') { $delete = TRUE; } else { $delete = FALSE; } $pplf = TTnew('PremiumPolicyListFactory'); foreach ($ids as $id) { $pplf->getByIdAndCompanyId($id, $current_company->getId()); foreach ($pplf as $pp_obj) { $pp_obj->setDeleted($delete); if ($pp_obj->isValid()) { $pp_obj->Save(); } } } Redirect::Page(URLBuilder::getURL(NULL, 'PremiumPolicyList.php')); break; default: BreadCrumb::setCrumb($title); $pplf = TTnew('PremiumPolicyListFactory'); $pplf->getByCompanyId($current_company->getId()); $pager = new Pager($pplf); $type_options = $pplf->getOptions('type'); $show_no_policy_group_notice = FALSE; foreach ($pplf as $pp_obj) { if ((int) $pp_obj->getColumn('assigned_policy_groups') == 0) { $show_no_policy_group_notice = TRUE; } $policies[] = array('id' => $pp_obj->getId(), 'name' => $pp_obj->getName(), 'type_id' => $pp_obj->getType(), 'type' => $type_options[$pp_obj->getType()], 'assigned_policy_groups' => (int) $pp_obj->getColumn('assigned_policy_groups'), 'deleted' => $pp_obj->getDeleted()); } $smarty->assign_by_ref('policies', $policies);
} if ($ppsf->isValid()) { //Pay Period schedule has to be saved before users can be assigned to it, so //do it this way. $ppsf->Save(FALSE); $ppsf->setEnableInitialPayPeriods(FALSE); if (isset($pay_period_schedule_data['user_ids'])) { $ppsf->setUser($pay_period_schedule_data['user_ids']); } else { $ppsf->setUser(array()); } if ($ppsf->isValid()) { $ppsf->Save(TRUE); //$ppsf->FailTransaction(); $ppsf->CommitTransaction(); Redirect::Page(URLBuilder::getURL(NULL, 'PayPeriodScheduleList.php')); break; } } $ppsf->FailTransaction(); default: if (isset($id)) { BreadCrumb::setCrumb($title); $ppslf = TTnew('PayPeriodScheduleListFactory'); $ppslf->GetByIdAndCompanyId($id, $current_company->getId()); foreach ($ppslf as $pay_period_schedule) { //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10); $pay_period_schedule_data = array('id' => $pay_period_schedule->getId(), 'company_id' => $pay_period_schedule->getCompany(), 'name' => $pay_period_schedule->getName(), 'description' => $pay_period_schedule->getDescription(), 'type' => $pay_period_schedule->getType(), 'start_week_day_id' => $pay_period_schedule->getStartWeekDay(), 'start_day_of_week' => $pay_period_schedule->getStartDayOfWeek(), 'transaction_date' => $pay_period_schedule->getTransactionDate(), 'primary_day_of_month' => $pay_period_schedule->getPrimaryDayOfMonth(), 'secondary_day_of_month' => $pay_period_schedule->getSecondaryDayOfMonth(), 'primary_transaction_day_of_month' => $pay_period_schedule->getPrimaryTransactionDayOfMonth(), 'secondary_transaction_day_of_month' => $pay_period_schedule->getSecondaryTransactionDayOfMonth(), 'transaction_date_bd' => $pay_period_schedule->getTransactionDateBusinessDay(), 'anchor_date' => $pay_period_schedule->getAnchorDate(), 'annual_pay_periods' => $pay_period_schedule->getAnnualPayPeriods(), 'day_start_time' => $pay_period_schedule->getDayStartTime(), 'time_zone' => $pay_period_schedule->getTimeZone(), 'new_day_trigger_time' => $pay_period_schedule->getNewDayTriggerTime(), 'maximum_shift_time' => $pay_period_schedule->getMaximumShiftTime(), 'shift_assigned_day_id' => $pay_period_schedule->getShiftAssignedDay(), 'timesheet_verify_type_id' => $pay_period_schedule->getTimeSheetVerifyType(), 'timesheet_verify_before_end_date' => $pay_period_schedule->getTimeSheetVerifyBeforeEndDate(), 'timesheet_verify_before_transaction_date' => $pay_period_schedule->getTimeSheetVerifyBeforeTransactionDate(), 'timesheet_verify_notice_before_transaction_date' => $pay_period_schedule->getTimeSheetVerifyNoticeBeforeTransactionDate(), 'timesheet_verify_notice_email' => $pay_period_schedule->getTimeSheetVerifyNoticeEmail(), 'user_ids' => $pay_period_schedule->getUser(), 'deleted' => $pay_period_schedule->getDeleted(), 'created_date' => $pay_period_schedule->getCreatedDate(), 'created_by' => $pay_period_schedule->getCreatedBy(), 'updated_date' => $pay_period_schedule->getUpdatedDate(), 'updated_by' => $pay_period_schedule->getUpdatedBy(), 'deleted_date' => $pay_period_schedule->getDeletedDate(), 'deleted_by' => $pay_period_schedule->getDeletedBy()); } } elseif ($action != 'submit') { $pay_period_schedule_data = array('anchor_date' => TTDate::getBeginMonthEpoch(time()), 'day_start_time' => 0, 'new_day_trigger_time' => 3600 * 4, 'maximum_shift_time' => 3600 * 16, 'time_zone' => $current_user_prefs->getTimeZone(), 'type' => 20, 'timesheet_verify_type_id' => 10, 'timesheet_verify_before_end_date' => 0, 'timesheet_verify_before_transaction_date' => 0, 'annual_pay_periods' => 0);
$cdf->setIncludePayStubEntryAccount(array()); } if (isset($data['exclude_pay_stub_entry_account_ids'])) { $cdf->setExcludePayStubEntryAccount($data['exclude_pay_stub_entry_account_ids']); } else { $cdf->setExcludePayStubEntryAccount(array()); } if (isset($data['user_ids'])) { $cdf->setUser($data['user_ids']); } else { $cdf->setUser(array()); } if ($cdf->isValid()) { $cdf->Save(TRUE); $cdf->CommitTransaction(); Redirect::Page(URLBuilder::getURL(NULL, 'CompanyDeductionList.php')); break; } } default: if (isset($id)) { BreadCrumb::setCrumb($title); $cdlf = TTnew('CompanyDeductionListFactory'); $cdlf->getByCompanyIdAndId($current_company->getId(), $id); foreach ($cdlf as $cd_obj) { //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10); $data = array('id' => $cd_obj->getId(), 'company_id' => $cd_obj->getCompany(), 'status_id' => $cd_obj->getStatus(), 'type_id' => $cd_obj->getType(), 'name' => $cd_obj->getName(), 'start_date' => $cd_obj->getStartDate(), 'end_date' => $cd_obj->getEndDate(), 'minimum_length_of_service' => $cd_obj->getMinimumLengthOfService(), 'minimum_length_of_service_unit_id' => $cd_obj->getMinimumLengthOfServiceUnit(), 'maximum_length_of_service' => $cd_obj->getMaximumLengthOfService(), 'maximum_length_of_service_unit_id' => $cd_obj->getMaximumLengthOfServiceUnit(), 'minimum_user_age' => $cd_obj->getMinimumUserAge(), 'maximum_user_age' => $cd_obj->getMaximumUserAge(), 'calculation_id' => $cd_obj->getCalculation(), 'calculation_order' => $cd_obj->getCalculationOrder(), 'country' => $cd_obj->getCountry(), 'province' => $cd_obj->getProvince(), 'district' => $cd_obj->getDistrict(), 'company_value1' => $cd_obj->getCompanyValue1(), 'company_value2' => $cd_obj->getCompanyValue2(), 'user_value1' => $cd_obj->getUserValue1(), 'user_value2' => $cd_obj->getUserValue2(), 'user_value3' => $cd_obj->getUserValue3(), 'user_value4' => $cd_obj->getUserValue4(), 'user_value5' => $cd_obj->getUserValue5(), 'user_value6' => $cd_obj->getUserValue6(), 'user_value7' => $cd_obj->getUserValue7(), 'user_value8' => $cd_obj->getUserValue8(), 'user_value9' => $cd_obj->getUserValue9(), 'user_value10' => $cd_obj->getUserValue10(), 'lock_user_value1' => $cd_obj->getLockUserValue1(), 'lock_user_value2' => $cd_obj->getLockUserValue2(), 'lock_user_value3' => $cd_obj->getLockUserValue3(), 'lock_user_value4' => $cd_obj->getLockUserValue4(), 'lock_user_value5' => $cd_obj->getLockUserValue5(), 'lock_user_value6' => $cd_obj->getLockUserValue6(), 'lock_user_value7' => $cd_obj->getLockUserValue7(), 'lock_user_value8' => $cd_obj->getLockUserValue8(), 'lock_user_value9' => $cd_obj->getLockUserValue9(), 'lock_user_value10' => $cd_obj->getLockUserValue10(), 'pay_stub_entry_account_id' => $cd_obj->getPayStubEntryAccount(), 'include_pay_stub_entry_account_ids' => $cd_obj->getIncludePayStubEntryAccount(), 'exclude_pay_stub_entry_account_ids' => $cd_obj->getExcludePayStubEntryAccount(), 'include_account_amount_type_id' => $cd_obj->getIncludeAccountAmountType(), 'exclude_account_amount_type_id' => $cd_obj->getExcludeAccountAmountType(), 'user_ids' => $cd_obj->getUser(), 'created_date' => $cd_obj->getCreatedDate(), 'created_by' => $cd_obj->getCreatedBy(), 'updated_date' => $cd_obj->getUpdatedDate(), 'updated_by' => $cd_obj->getUpdatedBy(), 'deleted_date' => $cd_obj->getDeletedDate(), 'deleted_by' => $cd_obj->getDeletedBy()); } } elseif ($action != 'submit') { $data = array('country' => 0, 'province' => 0, 'district' => 0, 'user_value1' => 0, 'user_value2' => 0, 'user_value3' => 0, 'user_value4' => 0, 'user_value5' => 0, 'user_value6' => 0, 'user_value7' => 0, 'user_value8' => 0, 'user_value9' => 0, 'user_value10' => 0, 'minimum_length_of_service' => 0, 'maximum_length_of_service' => 0, 'minimum_user_age' => 0, 'maximum_user_age' => 0, 'calculation_order' => 100); }
} else { $delete = FALSE; } $aplf = TTnew('AccrualPolicyListFactory'); foreach ($ids as $id) { $aplf->getByIdAndCompanyId($id, $current_company->getId()); $aplf->StartTransaction(); foreach ($aplf as $ap_obj) { $ap_obj->setDeleted($delete); if ($ap_obj->isValid()) { $ap_obj->Save(); } } $aplf->CommitTransaction(); } Redirect::Page(URLBuilder::getURL(NULL, 'AccrualPolicyList.php')); break; default: $aplf = TTnew('AccrualPolicyListFactory'); $aplf->getByCompanyId($current_company->getId()); $pager = new Pager($aplf); $type_options = $aplf->getOptions('type'); $show_no_policy_group_notice = FALSE; foreach ($aplf as $ap_obj) { if ((int) $ap_obj->getColumn('assigned_policy_groups') == 0) { $show_no_policy_group_notice = TRUE; } $policies[] = array('id' => $ap_obj->getId(), 'name' => $ap_obj->getName(), 'type_id' => $ap_obj->getType(), 'type' => $type_options[$ap_obj->getType()], 'assigned_policy_groups' => (int) $ap_obj->getColumn('assigned_policy_groups'), 'deleted' => $ap_obj->getDeleted()); } $smarty->assign_by_ref('policies', $policies); $smarty->assign_by_ref('show_no_policy_group_notice', $show_no_policy_group_notice);
} else { //Delete week if ($week_row_id > 0) { $rstf->setID($week_row_id); $rstf->setDeleted(TRUE); $rstf->Save(); } else { unset($week_row[$week_row_id]); } } } } if ($redirect == 0) { $rstcf->CommitTransaction(); //$rstcf->FailTransaction(); Redirect::Page(URLBuilder::getURL(NULL, 'RecurringScheduleTemplateControlList.php')); break; } } $rstcf->FailTransaction(); case 'delete': if (count($ids) > 0) { foreach ($ids as $rst_id) { if ($rst_id > 0) { Debug::Text('Deleting Week Row ID: ' . $rst_id, __FILE__, __LINE__, __METHOD__, 10); $rstlf = TTnew('RecurringScheduleTemplateListFactory'); $rstlf->getById($rst_id); if ($rstlf->getRecordCount() == 1) { foreach ($rstlf as $rst_obj) { $rst_obj->setDeleted(TRUE); if ($rst_obj->isValid()) {
} else { $utf->setSocialSecurityExempt(FALSE); } if (isset($tax_data['ui_exempt'])) { $utf->setUIExempt($tax_data['ui_exempt']); } else { $utf->setUIExempt(FALSE); } if (isset($tax_data['medicare_exempt'])) { $utf->setMedicareExempt($tax_data['medicare_exempt']); } else { $utf->setMedicareExempt(FALSE); } if ($utf->isValid()) { $utf->Save(); Redirect::Page(URLBuilder::getURL(array('user_id' => $tax_data['user_id'], 'data_saved' => TRUE), 'EditUserTax.php')); //Redirect::Page( URLBuilder::getURL( NULL , 'UserList.php') ); break; } default: if (isset($user_id) and $action != 'submit') { unset($tax_data); BreadCrumb::setCrumb($title); Debug::Text('User ID: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10); $ulf = new UserListFactory(); $ulf->getByIdAndCompanyId($user_id, $current_company->getId()); if ($ulf->getRecordCount() > 0) { $user_obj = $ulf->getCurrent(); } $utlf = new UserTaxListFactory(); //$uwlf->GetByUserIdAndCompanyId($current_user->getId(), $current_company->getId() );
} $ppf->setStartDate($data['start_date']); $ppf->setEndDate($data['end_date'] + 59); $ppf->setTransactionDate($data['transaction_date'] + 59); if (isset($data['advance_end_date'])) { $ppf->setAdvanceEndDate($data['advance_end_date']); } if (isset($data['advance_transaction_date'])) { $ppf->setAdvanceTransactionDate($data['advance_transaction_date']); } $ppf->setEnableImportData(TRUE); //Import punches when creating new pay periods. if ($ppf->isValid()) { $ppf->Save(); $ppf->CommitTransaction(); Redirect::Page(URLBuilder::getURL(array('id' => $data['pay_period_schedule_id']), 'PayPeriodList.php')); break; } $ppf->FailTransaction(); default: if (isset($id)) { BreadCrumb::setCrumb($title); $pplf = TTnew('PayPeriodListFactory'); $pplf->getByIdAndCompanyId($id, $current_company->getId()); foreach ($pplf as $pp_obj) { //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10); $data = array('id' => $pp_obj->getId(), 'company_id' => $pp_obj->getCompany(), 'pay_period_schedule_id' => $pp_obj->getPayPeriodSchedule(), 'pay_period_schedule_type_id' => $pp_obj->getPayPeriodScheduleObject()->getType(), 'start_date' => $pp_obj->getStartDate(), 'end_date' => $pp_obj->getEndDate(), 'transaction_date' => $pp_obj->getTransactionDate(), 'advance_end_date' => $pp_obj->getAdvanceEndDate(), 'advance_transaction_date' => $pp_obj->getAdvanceTransactionDate(), 'deleted' => $pp_obj->getDeleted(), 'created_date' => $pp_obj->getCreatedDate(), 'created_by' => $pp_obj->getCreatedBy(), 'updated_date' => $pp_obj->getUpdatedDate(), 'updated_by' => $pp_obj->getUpdatedBy(), 'deleted_date' => $pp_obj->getDeletedDate(), 'deleted_by' => $pp_obj->getDeletedBy()); } } else { if (isset($pay_period_schedule_id) and $pay_period_schedule_id != '') { $ppslf = TTnew('PayPeriodScheduleListFactory');
} else { $delete = FALSE; } $udlf = new UserDeductionListFactory(); if (isset($ids) and is_array($ids)) { foreach ($ids as $id) { $udlf->getByCompanyIdAndId($current_company->getId(), $id, $current_company->getId()); foreach ($udlf as $ud_obj) { $ud_obj->setDeleted($delete); if ($ud_obj->isValid()) { $ud_obj->Save(); } } } } Redirect::Page(URLBuilder::getURL(array('user_id' => $user_id), 'UserDeductionList.php')); break; default: BreadCrumb::setCrumb($title); //Get Permission Hierarchy Children first, as this can be used for viewing, or editing. $hlf = new HierarchyListFactory(); $permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($current_company->getId(), $current_user->getId()); $udlf = new UserDeductionListFactory(); $udlf->getByCompanyIdAndUserId($current_company->getId(), $user_id); $pager = new Pager($udlf); $ulf->getByIdAndCompanyId($user_id, $current_company->getId()); if ($ulf->getRecordCount() > 0) { $user_obj = $ulf->getCurrent(); if (is_object($user_obj)) { $is_owner = $permission->isOwner($user_obj->getCreatedBy(), $user_obj->getID()); $is_child = $permission->isChild($user_obj->getId(), $permission_children_ids);
$cj_obj = $cjlf->getCurrent(); if (PRODUCTION == TRUE and DEMO_MODE == FALSE and $cj_obj->getLastRunDate() < time() - 172800 and $cj_obj->getCreatedDate() < time() - 172800) { $cron_out_of_date = 1; } else { $cron_out_of_date = 0; } } unset($cjlf, $cj_obj); } else { Debug::text('User NOT! Authenticated', __FILE__, __LINE__, __METHOD__, 10); if (isset($enable_wap) and $enable_wap == TRUE) { Redirect::Page(URLBuilder::getURL(NULL, Environment::GetBaseURL() . 'wap/wap_login.php')); } elseif (isset($enable_iphone) and $enable_iphone == TRUE) { Redirect::Page(URLBuilder::getURL(NULL, Environment::GetBaseURL() . 'iphone/login/login.php')); } else { Redirect::Page(URLBuilder::getURL(NULL, Environment::GetBaseURL() . 'Login.php')); } //exit; } } require_once Environment::getBasePath() . 'classes' . DIRECTORY_SEPARATOR . 'smarty' . DIRECTORY_SEPARATOR . 'libs' . DIRECTORY_SEPARATOR . 'Smarty.class.php'; $smarty = new Smarty(); $smarty->compile_check = TRUE; $smarty->template_dir = Environment::getTemplateDir(); $smarty->compile_dir = Environment::getTemplateCompileDir(); $smarty->assign('css_file', 'global.css.php'); $smarty->assign('IMAGES_URL', Environment::getImagesURL()); $smarty->assign('BASE_PATH', Environment::getBasePath()); $smarty->assign('APPLICATION_NAME', APPLICATION_NAME); $smarty->assign('APPLICATION_VERSION', APPLICATION_VERSION); $smarty->assign('DEPLOYMENT_ON_DEMAND', DEPLOYMENT_ON_DEMAND);
if (strtolower($action) == 'delete') { $delete = TRUE; } else { $delete = FALSE; } $otplf = TTnew('OverTimePolicyListFactory'); foreach ($ids as $id) { $otplf->getByIdAndCompanyId($id, $current_company->getId()); foreach ($otplf as $otp_obj) { $otp_obj->setDeleted($delete); if ($otp_obj->isValid()) { $otp_obj->Save(); } } } Redirect::Page(URLBuilder::getURL(NULL, 'OverTimePolicyList.php')); break; default: $otplf = TTnew('OverTimePolicyListFactory'); $otplf->getByCompanyId($current_company->getId()); $pager = new Pager($otplf); $type_options = $otplf->getOptions('type'); $show_no_policy_group_notice = FALSE; foreach ($otplf as $otp_obj) { if ((int) $otp_obj->getColumn('assigned_policy_groups') == 0) { $show_no_policy_group_notice = TRUE; } $policies[] = array('id' => $otp_obj->getId(), 'name' => $otp_obj->getName(), 'type_id' => $otp_obj->getType(), 'type' => $type_options[$otp_obj->getType()], 'trigger_time' => $otp_obj->getTriggerTime(), 'assigned_policy_groups' => (int) $otp_obj->getColumn('assigned_policy_groups'), 'deleted' => $otp_obj->getDeleted()); } $smarty->assign_by_ref('policies', $policies); $smarty->assign_by_ref('show_no_policy_group_notice', $show_no_policy_group_notice);
} else { echo TTi18n::gettext("No Data To Export!") . "<br>\n"; } } else { $smarty->assign_by_ref('generated_time', TTDate::getTime()); $smarty->assign_by_ref('pay_period_options', $pay_period_options); $smarty->assign_by_ref('filter_data', $filter_data); $smarty->assign_by_ref('columns', $filter_columns); $smarty->assign_by_ref('rows', $rows); $smarty->display('report/TimesheetSummaryReport.tpl'); } break; case 'delete': case 'save': Debug::Text('Action: ' . $action, __FILE__, __LINE__, __METHOD__, 10); $generic_data['id'] = UserGenericDataFactory::reportFormDataHandler($action, $filter_data, $generic_data, URLBuilder::getURL(NULL, $_SERVER['SCRIPT_NAME'])); unset($generic_data['name']); default: BreadCrumb::setCrumb($title); if ($action == 'load') { Debug::Text('Loading Report!', __FILE__, __LINE__, __METHOD__, 10); extract(UserGenericDataFactory::getReportFormData($generic_data['id'])); } elseif ($action == '') { //Check for default saved report first. $ugdlf->getByUserIdAndScriptAndDefault($current_user->getId(), $_SERVER['SCRIPT_NAME']); if ($ugdlf->getRecordCount() > 0) { Debug::Text('Found Default Report!', __FILE__, __LINE__, __METHOD__, 10); $ugd_obj = $ugdlf->getCurrent(); $filter_data = $ugd_obj->getData(); $generic_data['id'] = $ugd_obj->getId(); } else {
$action = Misc::findSubmitButton(); switch ($action) { case 'phpinfo': phpinfo(); exit; break; case 'back': Debug::Text('Back', __FILE__, __LINE__, __METHOD__, 10); Redirect::Page(URLBuilder::getURL(NULL, 'install.php')); break; case 'next': Debug::Text('Next', __FILE__, __LINE__, __METHOD__, 10); if ($external_installer == 1) { Redirect::Page(URLBuilder::getURL(array('external_installer' => $external_installer), 'DatabaseSchema.php')); } else { Redirect::Page(URLBuilder::getURL(NULL, 'DatabaseConfig.php')); } break; default: break; } $handle = @fopen('http://www.timetrex.com/' . URLBuilder::getURL(array_merge(array('v' => $install_obj->getFullApplicationVersion(), 'page' => 'require'), $install_obj->getFailedRequirements()), 'pre_install.php'), "r"); @fclose($handle); $check_all_requirements = $install_obj->checkAllRequirements(); if ($external_installer == 1 and $check_all_requirements == 0 and $install_obj->checkTimeTrexVersion() == 0) { //Using external installer and there is no missing requirements, automatically send to next page. Redirect::Page(URLBuilder::getURL(array('external_installer' => $external_installer, 'action:next' => 'next'), $_SERVER['SCRIPT_NAME'])); } $smarty->assign_by_ref('install_obj', $install_obj); $smarty->assign_by_ref('external_installer', $external_installer); $smarty->display('install/Requirements.tpl');
} if ($cf->isNew() == TRUE) { $cf->setEnableAddCurrency(TRUE); $cf->setEnableAddPermissionGroupPreset(TRUE); $cf->setEnableAddStation(TRUE); $cf->setEnableAddPayStubEntryAccountPreset(TRUE); $cf->setEnableAddRecurringHolidayPreset(TRUE); } if ($cf->isValid()) { $cf->Save(); //$cf->FailTransaction(); $cf->CommitTransaction(); if ($permission->Check('company', 'edit')) { Redirect::Page(URLBuilder::getURL(NULL, 'CompanyList.php')); } else { Redirect::Page(URLBuilder::getURL(NULL, '../index.php')); } break; } $cf->FailTransaction(); default: if (isset($id)) { BreadCrumb::setCrumb($title); $clf = new CompanyListFactory(); if ($permission->Check('company', 'edit')) { $clf->GetByID($id); } else { $id = $current_company->getId(); $clf->GetByID($id); } foreach ($clf as $company) {
case 'search_form_search': Debug::Text('Action: ' . $action, __FILE__, __LINE__, __METHOD__, 10); $saved_search_id = UserGenericDataFactory::searchFormDataHandler($action, $filter_data, URLBuilder::getURL(NULL, 'RecurringScheduleControlList.php')); default: BreadCrumb::setCrumb($title); extract(UserGenericDataFactory::getSearchFormData($saved_search_id, $sort_column)); Debug::Text('Sort Column: ' . $sort_column, __FILE__, __LINE__, __METHOD__, 10); Debug::Text('Saved Search ID: ' . $saved_search_id, __FILE__, __LINE__, __METHOD__, 10); if (isset($filter_template_id) and $filter_template_id != '') { $filter_data['template_id'] = array($filter_template_id); } $sort_array = NULL; if ($sort_column != '') { $sort_array = array(Misc::trimSortPrefix($sort_column) => $sort_order); } URLBuilder::setURL($_SERVER['SCRIPT_NAME'], array('sort_column' => Misc::trimSortPrefix($sort_column), 'sort_order' => $sort_order, 'saved_search_id' => $saved_search_id, 'page' => $page)); $rsclf = new RecurringScheduleControlListFactory(); $ulf = new UserListFactory(); if ($permission->Check('recurring_schedule', 'view') == FALSE) { if ($permission->Check('recurring_schedule', 'view_child')) { $filter_data['permission_children_ids'] = $permission_children_ids; } if ($permission->Check('recurring_schedule', 'view_own')) { $filter_data['permission_children_ids'][] = $current_user->getId(); } } $rsclf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data, $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array); $pager = new Pager($rsclf); $utlf = new UserTitleListFactory(); $utlf->getByCompanyId($current_company->getId()); $title_options = $utlf->getArrayByListFactory($utlf, FALSE, TRUE);
$rf->setId($data['id']); $rf->setUserDate($data['user_id'], $data['date_stamp']); $rf->setType($data['type_id']); $rf->setStatus(30); if ($rf->isNew()) { Debug::Text('Object is NEW!', __FILE__, __LINE__, __METHOD__, 10); $rf->setMessage($data['message']); } else { Debug::Text('Object is NOT new!', __FILE__, __LINE__, __METHOD__, 10); } if ($rf->isValid()) { $request_id = $rf->Save(); $rf->CommitTransaction(); //$rf->FailTransaction(); //Redirect::Page( URLBuilder::getURL( array('refresh' => FALSE ), '../CloseWindow.php') ); Redirect::Page(URLBuilder::getURL(array('refresh' => TRUE), '../CloseWindow.php')); } $rf->FailTransaction(); default: if ((int) $id > 0) { Debug::Text(' ID was passed: ' . $id, __FILE__, __LINE__, __METHOD__, 10); $rlf = new RequestListFactory(); $rlf->getByIDAndCompanyID($id, $current_company->getId()); foreach ($rlf as $r_obj) { //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10); $data = array('id' => $r_obj->getId(), 'user_date_id' => $r_obj->getId(), 'user_id' => $r_obj->getUserDateObject()->getUser(), 'user_full_name' => $r_obj->getUserDateObject()->getUserObject()->getFullName(), 'date_stamp' => $r_obj->getUserDateObject()->getDateStamp(), 'type_id' => $r_obj->getType(), 'status_id' => $r_obj->getStatus(), 'created_date' => $r_obj->getCreatedDate(), 'created_by' => $r_obj->getCreatedBy(), 'updated_date' => $r_obj->getUpdatedDate(), 'updated_by' => $r_obj->getUpdatedBy(), 'deleted_date' => $r_obj->getDeletedDate(), 'deleted_by' => $r_obj->getDeletedBy()); } } elseif ($action != 'submit') { Debug::Text(' ID was NOT passed: ' . $id, __FILE__, __LINE__, __METHOD__, 10); //UserID has to be set at minimum $data = array('user_id' => $current_user->getId(), 'user_full_name' => $current_user->getFullName(), 'date_stamp' => TTDate::getTime());
} else { Debug::Text(' Skipping Day Of Week: (' . TTDate::getDayOfWeek($time_stamp) . ') ' . TTDate::getDate('DATE+TIME', $time_stamp), __FILE__, __LINE__, __METHOD__, 10); $x++; } $time_stamp = $time_stamp + 86400; } //$sf->FailTransaction(); $sf->CommitTransaction(); $ugsf = TTnew('UserGenericStatusFactory'); $ugsf->setUser($current_user->getId()); $ugsf->setBatchID($ugsf->getNextBatchId()); $ugsf->setQueue(UserGenericStatusFactory::getStaticQueue()); $ugsf->saveQueue(); $progress_bar->setValue(100); $progress_bar->display(); $next_page = URLBuilder::getURL(array('batch_id' => $ugsf->getBatchID(), 'batch_title' => 'Mass Schedule', 'batch_next_page' => urlencode(URLBuilder::getURL(array('data' => $data, 'filter_user_id' => $filter_user_id), '../schedule/AddMassSchedule.php'))), '../users/UserGenericStatusList.php'); } break; case 'recalculate_accrual_policy': //Debug::setVerbosity(11); if (isset($data['accrual_policy_id']) and isset($data['start_date']) and isset($data['end_date'])) { if ($data['start_date'] <= $data['end_date']) { $start_date = TTDate::getMiddleDayEpoch($data['start_date']); $end_date = TTDate::getMiddleDayEpoch($data['end_date']); $total_days = TTDate::getDays($end_date - $start_date); $offset = 86400 / 2; $init_progress_bar = TRUE; if ($init_progress_bar == TRUE) { InitProgressBar(); $init_progress_bar = FALSE; }