本文整理汇总了PHP中Controller::join_links方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::join_links方法的具体用法?PHP Controller::join_links怎么用?PHP Controller::join_links使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller
的用法示例。
在下文中一共展示了Controller::join_links方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getColumnContent
public function getColumnContent($field, $record, $col)
{
if ($record->canView()) {
$data = new ArrayData(array('Link' => Controller::join_links('CapturedEmailController', 'view', $record->ID)));
return $data->renderWith('ViewEmailButton');
}
}
示例2: Link
function Link($action = null)
{
if ($this->isInDB()) {
return parent::Link($action);
}
return Controller::join_links(self::$url_segment, $action);
}
示例3: LinkWithSearch
public function LinkWithSearch($extraParamStr = '')
{
$params = array_diff_key($this->request->getVars(), array('url' => null));
parse_str($extraParamStr, $extraParams);
$params = array_merge($params, (array) $extraParams);
return Controller::join_links($this->Link(), '?' . http_build_query($params));
}
示例4: getEditForm
/**
* Gets the form used for viewing a time log
*/
public function getEditForm($id = null, $fields = null)
{
$record = $this->currentPage();
if ($this->action == 'view' && $record) {
$fields = new FieldList(new HeaderField('LogHeader', _t('KapostBridgeLogViewer.VIEWING_ENTRY', '_Viewing Log Entry: {datetime}', array('datetime' => $record->dbObject('Created')->FormatFromSettings())), 3), new ReadonlyField('UserAgent', _t('KapostBridgeLogViewer.USER_AGENT', '_Requestor User Agent')), new ReadonlyField('Method', _t('KapostBridgeLogViewer.METHOD', '_Method')), ToggleCompositeField::create('RequestData', _t('KapostBridgeLogViewer.KAPOST_REQUEST', '_Kapost Request'), new FieldList(ReadonlyField::create('RequestFormatted', '')->setTemplate('KapostBridgeLogField')->addExtraClass('log-contents cms-panel-layout')))->setHeadingLevel(3), ToggleCompositeField::create('ResponseData', _t('KapostBridgeLogViewer.SILVERSTRIPE_RESPONSE', '_SilverStripe Response'), new FieldList(ReadonlyField::create('ResponseFormatted', '')->setTemplate('KapostBridgeLogField')->addExtraClass('log-contents cms-panel-layout')))->setHeadingLevel(3));
$refObj = $record->ReferenceObject;
if (!empty($refObj) && $refObj !== false && $refObj->exists()) {
if (method_exists($refObj, 'CMSEditLink')) {
$fields->insertBefore(new KapostLogLinkField('CMSEditLink', _t('KapostBridgeLogViewer.REFERENCED_OBJECT', '_Referenced Object'), $refObj->CMSEditLink(), _t('KapostBridgeLogViewer.VIEW_REFERENCED_OBJECT', '_View Referenced Object')), 'RequestData');
} else {
if ($refObj instanceof File) {
$refObjLink = Controller::join_links(LeftAndMain::config()->url_base, AssetAdmin::config()->url_segment, 'EditForm/field/File/item', $refObj->ID, 'edit');
$fields->insertBefore(new KapostLogLinkField('CMSEditLink', _t('KapostBridgeLogViewer.REFERENCED_OBJECT', '_Referenced Object'), $refObjLink, _t('KapostBridgeLogViewer.VIEW_REFERENCED_OBJECT', '_View Referenced Object')), 'RequestData');
}
}
}
} else {
$fields = new FieldList();
}
$form = new CMSForm($this, 'EditForm', $fields, new FieldList());
$form->setResponseNegotiator($this->getResponseNegotiator());
$form->addExtraClass('cms-edit-form center');
$form->setAttribute('data-layout-type', 'border');
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
$form->setAttribute('data-pjax-fragment', 'CurrentForm');
$form->setHTMLID('Form_EditForm');
if ($record) {
$form->loadDataFrom($record);
}
return $form;
}
开发者ID:webbuilders-group,项目名称:silverstripe-kapost-bridge-logger,代码行数:34,代码来源:KapostBridgeLogViewer.php
示例5: ProfileLink
public function ProfileLink($action = null)
{
if ($directorypage = MembersDirectoryPage::get()->first()) {
return Controller::join_links($directorypage->Link(), "view", $this->owner->ID, $action);
}
return Controller::join_links(MemberProfilePage_Controller::config()->url_segment, $action);
}
示例6: GlobalNav
/**
* @param $key The nav key, e.g. "doc", "userhelp"
* @return HTMLText
*/
public static function GlobalNav($key)
{
$baseURL = GlobalNavSiteTreeExtension::get_toolbar_baseurl();
Requirements::css(Controller::join_links($baseURL, Config::inst()->get('GlobalNav', 'css_path')));
// If this method haven't been called before, get the toolbar and cache it
if (self::$global_nav_html === null) {
// Set the default to empty
self::$global_nav_html = '';
// Prevent recursion from happening
if (empty($_GET['globaltoolbar'])) {
$host = GlobalNavSiteTreeExtension::get_toolbar_hostname();
$path = Director::makeRelative(GlobalNavSiteTreeExtension::get_navbar_filename($key));
if (Config::inst()->get('GlobalNav', 'use_localhost')) {
self::$global_nav_html = file_get_contents(BASE_PATH . $path);
} else {
$url = Controller::join_links($baseURL, $path, '?globaltoolbar=true');
$connectionTimeout = Config::inst()->get('GlobalNavTemplateProvider', 'connection_timeout');
$transferTimeout = Config::inst()->get('GlobalNavTemplateProvider', 'transfer_timeout');
// Get the HTML and cache it
self::$global_nav_html = self::curl_call($url, $connectionTimeout, $transferTimeout);
}
}
}
$html = DBField::create_field('HTMLText', self::$global_nav_html);
$html->setOptions(array('shortcodes' => false));
return $html;
}
示例7: doAddMockData
/**
* A form action that handles populating the record with mock data
*
* @param array $data The data that as passed in from the form
* @param Form $form The Form object that was used
* @return SSViewer
*/
public function doAddMockData($data, $form)
{
$this->owner->record->fill(array('only_empty' => true, 'include_relations' => false, 'download_images' => false));
Controller::curr()->getResponse()->addHeader("X-Pjax", "Content");
$link = Controller::join_links($this->owner->gridField->Link(), "item", $this->owner->record->ID);
return Controller::curr()->redirect($link);
}
示例8: ItemEditForm
/**
* @return {Form}
*/
public function ItemEditForm()
{
//Timepicker
Requirements::css('calendar/thirdparty/timepicker/jquery.timepicker.css');
//Requirements::javascript('calendar/thirdparty/timepicker/jquery.timepicker.js');
//modification to allow timepicker and timeentry to work in tandem:
Requirements::javascript('calendar/thirdparty/timepicker/jquery.timepicker-timeentry.js');
//Timeentry
Requirements::javascript('calendar/thirdparty/timeentry/jquery.timeentry.js');
//CSS/JS Dependencies
Requirements::css("calendar/css/admin/CalendarEventGridFieldDetailForm.css");
Requirements::javascript("calendar/javascript/events/EventFields.js");
Requirements::javascript("calendar/javascript/admin/CalendarEventGridFieldDetailForm.js");
$form = parent::ItemEditForm();
if (!$form instanceof Form) {
return $form;
}
$form->addExtraClass('CalendarEventGridfieldDetailForm');
if ($this->record->ID !== 0) {
$actionFields = $form->Actions();
$link = Controller::join_links($this->gridField->Link('item'), 'new');
$actionFields->push(new LiteralField('addNew', '<a href="' . $link . '" class="action action-detail ss-ui-action-constructive ' . 'ss-ui-button ui-button ui-widget ui-state-default ui-corner-all new new-link" data-icon="add">Add new ' . $this->record->i18n_singular_name() . '</a>'));
}
return $form;
}
示例9: register
public function register(SS_HTTPRequest $request)
{
if ($request->isPOST()) {
try {
if (Customer::get()->filter('Email', $request->postVar('Email'))->count()) {
throw new ValidationException("Sorry a member with that email address already exists");
}
$password = Customer::create_new_password();
/** @var Customer $member */
$member = Injector::inst()->create('ProfiledMemberClass');
$member->changePassword($password);
// update member with cleansed posted variables
$updateData = array_merge(ProfiledMemberForm::update_models('register', array_merge($request->postVars(), ['Password' => $password]), $member));
/** @var CryptofierImplementation $crypto */
$crypto = Injector::inst()->get('CryptofierService');
$token = $crypto->friendly($crypto->encrypt($member->Email));
$member->{ProfiledMemberExtension::VerificationFieldName} = $token;
$member->write();
$member->addToGroupByCode(self::CustomerGroupCode);
// add verification link and HasRegisteredFlag
$updateData = array_merge(['Password' => $password, 'VerificationLink' => Controller::join_links(Director::absoluteBaseURL(), $this()->ActionLink("verify/{$token}"))], $updateData);
$this->sendEmail('Register', $member, $updateData);
Session::set(self::SessionEmailKey, $member->Email);
$url = CrackerjackModule::get_config_setting(__CLASS__, 'post_register_url') ?: $this()->ActionLink('thanks');
return $this()->redirect($url);
} catch (ValidationException $e) {
ProfiledMemberForm::set_form_message($e->getMessage(), CrackerjackForm::Bad);
return $this()->redirectBack();
}
} else {
return array();
}
}
示例10: placeOrder
public function placeOrder(SS_HTTPRequest $request)
{
$eventbrite_event_header = $request->getHeader('X-Eventbrite-Event');
if (!$eventbrite_event_header) {
return $this->httpError(403);
}
if ($eventbrite_event_header !== 'order.placed') {
return $this->httpError(403);
}
if (!$this->isJson()) {
return $this->httpError(403);
}
$json_request = $this->getJsonRequest();
if (!isset($json_request['config']) || !isset($json_request['api_url'])) {
return $this->httpError(403);
}
$config = $json_request['config'];
if (!isset($config['action']) || $config['action'] !== 'order.placed') {
return $this->httpError(403);
}
$current_local_url = Controller::join_links(Director::absoluteBaseURL(), $request->getURL());
if (!isset($config['endpoint_url']) || $config['endpoint_url'] !== $current_local_url) {
return $this->httpError(403);
}
try {
$this->manager->registerEvent('ORDER_PLACED', $json_request['api_url']);
} catch (Exception $ex) {
SS_Log::log($ex->getMessage(), SS_Log::ERR);
return $this->httpError(500);
}
return true;
}
示例11: Link
/**
* Return a Link to this field, if the list is an instance of StatefulGridFieldList the session key for the state is appended to the url
* @param {string} $action Action to append to the url
* @return {string} Relative link to this form field
*/
public function Link($action = null)
{
if ($this->list instanceof StatefulGridFieldList) {
return Controller::join_links(parent::Link($action), '?' . strtolower($this->name) . '_skey=' . $this->state->getSessionKey());
}
return parent::Link($action);
}
开发者ID:helpfulrobot,项目名称:webbuilders-group-silverstripe-statefulunsavedlist,代码行数:12,代码来源:StatefulGridField.php
示例12: getArchive
/**
* Returns a list of months where blog posts are present.
*
* @return DataList
**/
public function getArchive()
{
$query = $this->Blog()->getBlogPosts()->dataQuery();
if ($this->Type == "Yearly") {
$query->groupBy("DATE_FORMAT(PublishDate, '%Y')");
} else {
$query->groupBy("DATE_FORMAT(PublishDate, '%Y-%M')");
}
$articles = $this->Blog()->getBlogPosts()->setDataQuery($query);
if ($this->NumberToDisplay > 0) {
$articles = $articles->limit($this->NumberToDisplay);
}
$archive = new ArrayList();
if ($articles->count() > 0) {
foreach ($articles as $article) {
if ($this->Type == "Yearly") {
$year = date('Y', strtotime($article->PublishDate));
$month = null;
$title = $year;
} else {
$year = date('Y', strtotime($article->PublishDate));
$month = date('m', strtotime($article->PublishDate));
$title = date('F Y', strtotime($article->PublishDate));
}
$archive->push(new ArrayData(array("Title" => $title, "Link" => Controller::join_links($this->Blog()->Link("archive"), $year, $month))));
}
}
return $archive;
}
示例13: doContinue
public function doContinue($data)
{
Session::set('Checkout.PaymentMethodID', $data['PaymentMethodID']);
Session::set("Checkout.PostageID", $data["PostageID"]);
$url = Controller::join_links(Director::absoluteBaseUrl(), Payment_Controller::config()->url_segment);
return $this->controller->redirect($url);
}
示例14: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
//adding upload field - if item has already been saved
if ($this->ID && $this->AssetsFolderID != 0) {
//this is the default, for non multi-language sites
if (!class_exists('Translatable') || $this->Locale == Translatable::default_locale()) {
//Use SortableUploadField instead of UploadField!
//The upload directory is expected to have been set in {@see UploadDirRules},
//and should be something like: "assets/ID-Pagename"
//TODO: This could easily be configurable through yml files (to e.g. "assets/galleries/ID"),
//so this module could do without the upload dir rules
//
//read more about adding additinoal metadata to images here:
//http://doc.silverstripe.org/framework/en/reference/uploadfield
$imageField = new SortableUploadField('Images', '');
$fields->addFieldToTab('Root.Images', $imageField);
} else {
$orig = $this->getTranslation(Translatable::default_locale());
$html = sprintf('<a href="%s">%s</a>', Controller::join_links($orig->CMSEditLink(), '?locale=' . $orig->Locale), 'Images are administered through ' . i18n::get_locale_name($orig->Locale));
$fields->addFieldToTab('Root.Images', LiteralField::create('ImagesDesc', $html));
}
}
return $fields;
}
示例15: makeApiRequest
/**
* Perform an api request with the given options
*
* @param string $path the request path; can consist of resource name, identifier and GET params
* @param array $options
* * string `body` the data
* * int `code` the expected response code
* * string `method` the http method
* * ApiSession `session` the test session
* @return array
* @throws SS_HTTPResponse_Exception
*/
public function makeApiRequest($path, $options = [])
{
$settings = array_merge(['session' => null, 'token' => null, 'method' => 'GET', 'body' => null, 'code' => 200], $options);
$response = Director::test(Controller::join_links($this->namespace, $path), null, $settings['session'], $settings['method'], $settings['body'], ['Authorization' => $settings['token'], 'Accept' => 'application/json']);
$this->assertEquals($settings['code'], $response->getStatusCode(), "Wrong status code: {$response->getBody()}");
return json_decode($response->getBody(), true);
}