当前位置: 首页>>代码示例>>PHP>>正文


PHP UrlHelper::getCpUrl方法代码示例

本文整理汇总了PHP中UrlHelper::getCpUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlHelper::getCpUrl方法的具体用法?PHP UrlHelper::getCpUrl怎么用?PHP UrlHelper::getCpUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UrlHelper的用法示例。


在下文中一共展示了UrlHelper::getCpUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCpEditUrl

 /**
  * Returns the element's CP edit URL.
  *
  * @return string|false
  */
 public function getCpEditUrl()
 {
     $calendar = $this->getCalendar();
     if ($calendar) {
         return UrlHelper::getCpUrl('events/' . $calendar->handle . '/' . $this->id);
     }
 }
开发者ID:webremote,项目名称:Events,代码行数:12,代码来源:Events_EventModel.php

示例2: editEntry

 /**
  * Get all available entries to edit from a section.
  *
  * @param array $variables
  *
  * @return array
  */
 public function editEntry($variables)
 {
     if (!isset($variables['sectionHandle'])) {
         return false;
     }
     // Gather commands
     $commands = array();
     // Find entries
     $criteria = array('section' => $variables['sectionHandle'], 'locale' => craft()->language);
     $entries = craft()->amCommand_elements->getElements(ElementType::Entry, $criteria);
     if (!$entries) {
         craft()->amCommand->setReturnMessage(Craft::t('No entries in this section exist yet.'));
     } else {
         foreach ($entries as $entry) {
             // Get CP edit URL
             $url = UrlHelper::getCpUrl('entries/' . $variables['sectionHandle'] . '/' . $entry['id'] . ($entry['slug'] ? '-' . $entry['slug'] : ''));
             if (craft()->isLocalized()) {
                 $url .= '/' . craft()->language;
             }
             // Add command
             $commands[] = array('name' => $entry['title'], 'info' => Craft::t('URI') . ': ' . $entry['uri'], 'url' => $url);
         }
     }
     return $commands;
 }
开发者ID:transomdesign,项目名称:transom-craft-starter,代码行数:32,代码来源:AmCommand_EntriesService.php

示例3: getCpEditUrl

 /**
  * Returns the element's CP edit URL.
  *
  * @return string|false
  */
 public function getCpEditUrl()
 {
     $menu = $this->getMenu();
     if ($menu) {
         return UrlHelper::getCpUrl('menus/' . $menu->handle . '/' . $this->id);
     }
 }
开发者ID:daituzhang,项目名称:craft-starter,代码行数:12,代码来源:Menus_NodeModel.php

示例4: actionInstall

 /**
  * Install examples
  *
  * @return void
  */
 public function actionInstall()
 {
     $this->_installExampleTemplates();
     $this->_installExampleData();
     craft()->userSession->setNotice(Craft::t('Examples successfully installed.'));
     $this->redirect(UrlHelper::getCpUrl() . '/sproutemail');
 }
开发者ID:aladrach,项目名称:Bluefoot-Craft-Starter,代码行数:12,代码来源:SproutEmail_ExamplesController.php

示例5: addResources

 protected function addResources()
 {
     // Get revision manifest
     $manifestPath = dirname(__FILE__) . '/resources/rev-manifest.json';
     $manifest = file_exists($manifestPath) && ($manifest = file_get_contents($manifestPath)) ? json_decode($manifest) : false;
     // Get data
     $data = ['fields' => [], 'entryTypeIds' => [], 'baseEditFieldUrl' => rtrim(UrlHelper::getCpUrl('settings/fields/edit'), '/'), 'baseEditEntryTypeUrl' => rtrim(UrlHelper::getCpUrl('settings/sections/sectionId/entrytypes'), '/'), 'baseEditGlobalSetUrl' => rtrim(UrlHelper::getCpUrl('settings/globals'), '/'), 'baseEditCategoryGroupUrl' => rtrim(UrlHelper::getCpUrl('settings/categories'), '/')];
     $sectionIds = craft()->sections->allSectionIds;
     foreach ($sectionIds as $sectionId) {
         $entryTypes = craft()->sections->getEntryTypesBySectionId($sectionId);
         $data['entryTypeIds']['' . $sectionId] = [];
         foreach ($entryTypes as $entryType) {
             $data['entryTypeIds']['' . $sectionId][] = $entryType->id;
         }
     }
     $fields = craft()->fields->allFields;
     foreach ($fields as $field) {
         $data['fields'][$field->handle] = ['id' => $field->id, 'handle' => $field->handle, 'type' => $field->type];
     }
     $data = json_encode($data);
     craft()->templates->includeJs('window._CpFieldLinksData=' . $data . ';');
     // Include resources
     $cssFile = 'stylesheets/CpFieldLinks.css';
     $jsFile = 'javascripts/CpFieldLinks.js';
     craft()->templates->includeCssResource('cpfieldlinks/' . ($manifest ? $manifest->{$cssFile} : $cssFile));
     craft()->templates->includeJsResource('cpfieldlinks/' . ($manifest ? $manifest->{$jsFile} : $jsFile));
 }
开发者ID:todamoon,项目名称:lHenry,代码行数:27,代码来源:CpFieldLinksPlugin.php

示例6: _loadCodeMirror

    private function _loadCodeMirror()
    {
        if ($this->_actualSettingsPage()) {
            craft()->templates->includeCssResource('cpcss/css/codemirror.css');
            craft()->templates->includeCssResource('cpcss/css/blackboard.css');
            craft()->templates->includeJsResource('cpcss/js/codemirror-css.js');
            craft()->templates->includeJs('
$(function () {
    var $redirect = $("' . addslashes('input[type="hidden"][name="redirect"][value$="settings/plugins"]') . '"),
        $saveBtn = $("' . addslashes('input[type="submit"') . '").wrap("' . addslashes('<div class="btngroup" />') . '"),
        $menuBtn = $("' . addslashes('<div class="btn submit menubtn" />') . '").appendTo($saveBtn.parent()),
        $menu = $("' . addslashes('<div class="menu" />') . '").appendTo($saveBtn.parent()),
        $items = $("<ul />").appendTo($menu),
        $continueOpt = $("' . addslashes('<li><a class="formsubmit" data-redirect="' . UrlHelper::getCpUrl('settings/plugins/cpcss') . '">' . Craft::t('Save and continue editing') . '<span class="shortcut">' . (craft()->request->getClientOs() === 'Mac' ? '⌘' : 'Ctrl+') . 'S</span></a></li>') . '").appendTo($items);
    new Garnish.MenuBtn($menuBtn, {
        onOptionSelect : function (option) {
            Craft.cp.submitPrimaryForm();
        }
    });
    $saveBtn.on("click", function (e) { $redirect.attr("value", "' . UrlHelper::getCpUrl('settings/plugins') . '"); });
    $redirect.attr("value", "' . UrlHelper::getCpUrl('settings/plugins/cpcss') . '");
    CodeMirror.fromTextArea(document.getElementById("settings-additionalCss"), {
        indentUnit: 4,
        styleActiveLine: true,
        lineNumbers: true,
        lineWrapping: true,
        theme: "blackboard"
    });
});', true);
        }
    }
开发者ID:jimmylorunning,项目名称:acf,代码行数:31,代码来源:CpCssPlugin.php

示例7: getCpEditUrl

 /**
  * @inheritDoc BaseElementModel::getCpEditUrl()
  *
  * @return string|false
  */
 public function getCpEditUrl()
 {
     $group = $this->getGroup();
     if ($group) {
         return UrlHelper::getCpUrl('categories/' . $group->handle . '/' . $this->id . ($this->slug ? '-' . $this->slug : ''));
     }
 }
开发者ID:jmstan,项目名称:craft-website,代码行数:12,代码来源:CategoryModel.php

示例8: getCpEditUrl

 /**
  * Returns the element's CP edit URL.
  *
  * @return string|false
  */
 public function getCpEditUrl()
 {
     $app = $this->getApp();
     if ($app) {
         return UrlHelper::getCpUrl('pushnotifications/devices/' . $app->handle . '/' . $this->id);
     }
 }
开发者ID:webremote,项目名称:pushnotifications,代码行数:12,代码来源:PushNotifications_DeviceModel.php

示例9: getCpEditUrl

 public function getCpEditUrl()
 {
     $form = $this->getForm();
     if ($form) {
         return UrlHelper::getCpUrl('formerly/' . $form->handle . '/' . $this->id);
     }
 }
开发者ID:jeremyworboys,项目名称:Formerly,代码行数:7,代码来源:Formerly_SubmissionModel.php

示例10: getCpEditUrl

 /**
  * @inheritDoc BaseElementModel::getCpEditUrl()
  *
  * @return string|false
  */
 public function getCpEditUrl()
 {
     $group = $this->getGroup();
     if ($group) {
         return UrlHelper::getCpUrl('tagmanager/' . $group->handle . '/' . $this->id);
     }
 }
开发者ID:webremote,项目名称:tagmanager,代码行数:12,代码来源:TagManagerModel.php

示例11: _handleSuccessfulLogin

 /**
  * Process Successful Login
  */
 private function _handleSuccessfulLogin($setNotice)
 {
     // Get the current user
     $currentUser = craft()->userSession->getUser();
     // Were they trying to access a URL beforehand?
     $returnUrl = craft()->userSession->getReturnUrl(null, true);
     if ($returnUrl === null || $returnUrl == craft()->request->getPath()) {
         // If this is a CP request and they can access the control panel, send them wherever
         // postCpLoginRedirect tells us
         if (craft()->request->isCpRequest() && $currentUser->can('accessCp')) {
             $postCpLoginRedirect = craft()->config->get('postCpLoginRedirect');
             $returnUrl = UrlHelper::getCpUrl($postCpLoginRedirect);
         } else {
             // Otherwise send them wherever postLoginRedirect tells us
             $postLoginRedirect = craft()->config->get('postLoginRedirect');
             $returnUrl = UrlHelper::getSiteUrl($postLoginRedirect);
         }
     }
     // If this was an Ajax request, just return success:true
     if (craft()->request->isAjaxRequest()) {
         $this->returnJson(array('success' => true, 'returnUrl' => $returnUrl));
     } else {
         if ($setNotice) {
             craft()->userSession->setNotice(Craft::t('Logged in.'));
         }
         $this->redirectToPostedUrl($currentUser, $returnUrl);
     }
 }
开发者ID:roundhouse,项目名称:Members-Craft-CMS,代码行数:31,代码来源:MembersController.php

示例12: actionExport

 public function actionExport()
 {
     $attributes = craft()->httpSession->get('__exportJob');
     craft()->httpSession->remove('__exportJob');
     if ($attributes && ($recipients = craft()->elements->getCriteria('SproutEmail_DefaultMailerRecipient', $attributes)->find())) {
         $this->generateCsvExport($recipients);
         craft()->end();
     }
     craft()->userSession->setError(Craft::t('Nothing to export.'));
     craft()->request->redirect(UrlHelper::getCpUrl('sproutemail/recipients'));
 }
开发者ID:jackmcgreevy,项目名称:fast,代码行数:11,代码来源:SproutEmail_DefaultMailerController.php

示例13: getCpEditUrl

 /**
  * @inheritDoc BaseElementModel::getCpEditUrl()
  *
  * @return string|false
  */
 public function getCpEditUrl()
 {
     $group = $this->getGroup();
     if ($group) {
         $url = UrlHelper::getCpUrl('categories/' . $group->handle . '/' . $this->id . ($this->slug ? '-' . $this->slug : ''));
         if (craft()->isLocalized() && $this->locale != craft()->language) {
             $url .= '/' . $this->locale;
         }
         return $url;
     }
 }
开发者ID:codeforamerica,项目名称:oakland-beta,代码行数:16,代码来源:CategoryModel.php

示例14: getSettingsUrl

 /**
  * Returns the URL to the plugin's settings in the CP.
  *
  * @return string|null
  */
 public function getSettingsUrl()
 {
     // Is this plugin managing its own settings?
     $url = $this->component->getSettingsUrl();
     if (!$url) {
         // Check to see if they're using getSettingsHtml(), etc.
         if ($this->component->getSettingsHtml()) {
             $url = 'settings/plugins/' . mb_strtolower($this->component->getClassHandle());
         }
     }
     if ($url) {
         return UrlHelper::getCpUrl($url);
     }
 }
开发者ID:kentonquatman,项目名称:portfolio,代码行数:19,代码来源:PluginVariable.php

示例15: getSettingsHtml

 public function getSettingsHtml()
 {
     // If Craft Pro
     if (craft()->getEdition() == Craft::Pro) {
         $options = array();
         $userGroups = craft()->userGroups->getAllGroups();
         foreach ($userGroups as $group) {
             $options[] = array('label' => $group->name, 'value' => $group->id);
         }
         $checkboxes = craft()->templates->render('_includes/forms/checkboxGroup', array('name' => 'userGroups', 'options' => $options, 'values' => $this->getSettings()->userGroups));
         $noGroups = '<p class="error">No user groups exist. <a href="' . UrlHelper::getCpUrl('settings/users/groups/new') . '">Create one now...</a></p>';
         craft()->templates->includeCssResource('autoassignusergroup/css/settings.css');
         return craft()->templates->render('autoassignusergroup/_settings', array('userGroupsField' => TemplateHelper::getRaw(count($userGroups) ? $checkboxes : $noGroups)));
     } else {
         craft()->templates->includeJs('$(".btn.submit").val("Continue");');
         $output = '<h2>Craft Upgrade Required</h2>';
         $output .= '<p>In order to use this plugin, Craft Pro is required.</p>';
         return craft()->templates->renderString($output);
     }
 }
开发者ID:floodhelpers,项目名称:floodhelpers,代码行数:20,代码来源:AutoAssignUserGroupPlugin.php


注:本文中的UrlHelper::getCpUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。