本文整理汇总了PHP中URLBuilder类的典型用法代码示例。如果您正苦于以下问题:PHP URLBuilder类的具体用法?PHP URLBuilder怎么用?PHP URLBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了URLBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUrlBuilderCycleShard
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;
}
}
}
示例2: smarty_function_URLBuilder
/**
* 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;
}
示例3: mainTreeRender
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]))));
}
示例4: getLink
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;
}
示例5: getPaginationLinks
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;
}
示例6: smarty_function_EmbeddedDocumentAttachmentList
/**
* 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;
}
示例7: smarty_function_EmbeddedMessageList
/**
* 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;
}
示例8: bottomTreeRender
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;
}
示例9: renderCheckBoxes
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 ";
}
示例10: smarty_function_LayerMessageList
/**
* 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;
}
示例11: array
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);
示例12: PolicyGroupListFactory
$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 --'));
示例13: str_replace
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();
示例14: TTnew
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);
示例15: TTnew
}
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);