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


PHP link_to函数代码示例

本文整理汇总了PHP中link_to函数的典型用法代码示例。如果您正苦于以下问题:PHP link_to函数的具体用法?PHP link_to怎么用?PHP link_to使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: adminIndex

 /**
  * Comments index for admin page
  * @return mixed
  */
 public function adminIndex()
 {
     $comments = Comment::with('user', 'likes', 'user')->orderBy('updated_at', 'desc')->paginate();
     return View::make('admin.dicts.list', ['columns' => ['ID', 'Пользователь', 'Текст', 'Пост', 'Лайки', '', ''], 'data' => $comments->transform(function ($comment) {
         return ['id' => $comment->id, 'user' => link_to("admin/users/{$comment->user->id}", $comment->user->name), 'text' => link_to("admin/comments/{$comment->id}/edit", $comment->text), 'post_text' => link_to("admin/posts/{$comment->post_id}/edit", $comment->post->text), 'likes' => $comment->likes->count(), 'edit' => link_to("admin/comments/{$comment->id}/edit", 'редактировать'), 'delete' => link_to("admin/comments/{$comment->id}/delete", 'удалить')];
     }), 'actions' => [['link' => 'admin/comments/delete', 'text' => 'Удалить выбранное']], 'title' => 'Комментарии', 'links' => $comments->links()]);
 }
开发者ID:SenhorBardell,项目名称:yol,代码行数:11,代码来源:CommentsController.php

示例2: forum_breadcrumb

function forum_breadcrumb($params, $options = array())
{
    if (!$params) {
        return;
    }
    $first = true;
    $title = '';
    $id = isset($options['id']) ? $options['id'] : 'forum_navigation';
    $html = '<ul id="' . $id . '">';
    foreach ($params as $step) {
        $separator = $first ? '' : sfConfig::get('app_sfSimpleForumPlugin_breadcrumb_separator', ' » ');
        $first = false;
        $html .= '<li>' . $separator;
        $title .= $separator;
        if (is_array($step)) {
            $html .= link_to($step[0], $step[1]);
            $title .= $step[0];
        } else {
            $html .= $step;
            $title .= $step;
        }
        $html .= '</li>';
    }
    $html .= '</ul>';
    sfContext::getInstance()->getResponse()->setTitle($title);
    return $html;
}
开发者ID:kriswallsmith,项目名称:sfSimpleForumPlugin,代码行数:27,代码来源:sfSimpleForumHelper.php

示例3: getH1Txt

 /**
  * Method to return text for <h1> tag on parts landing page 
  * PRECONDITION: $this->fetchDetails() must be called first.
  */
 public function getH1Txt()
 {
     $sep = sfConfig::get('app_seo_word_sep_h1');
     $cat_crumb = link_to('Busway', '@busway');
     $manuf_crumb = link_to($this->_details['manuf'], "@bu_manuf?manuf_slug={$this->_details['manuf_slug']}");
     return "<strong>{$this->_part_no}</strong> {$sep} {$cat_crumb} {$sep} {$manuf_crumb}";
 }
开发者ID:morganney,项目名称:livewire,代码行数:11,代码来源:BUPart.class.php

示例4: linkToDelete

 public function linkToDelete($object, $params)
 {
     if ($object->isNew()) {
         return '';
     }
     return link_to(__($params['label'], array(), 'sf_admin'), $this->getUrlForAction('delete'), $object, array_merge($params['params'], array('method' => 'delete', 'confirm' => !empty($params['confirm']) ? __($params['confirm'], array(), 'sf_admin') : $params['confirm'])));
 }
开发者ID:anvaya,项目名称:nckids,代码行数:7,代码来源:clientGeneratorHelper.class.php

示例5: getDatatable

 public function getDatatable()
 {
     $query = DB::table('users')->where('users.account_id', '=', Auth::user()->account_id);
     if (!Session::get('show_trash:user')) {
         $query->where('users.deleted_at', '=', null);
     }
     $query->where('users.public_id', '>', 0)->select('users.public_id', 'users.first_name', 'users.last_name', 'users.email', 'users.confirmed', 'users.public_id', 'users.deleted_at');
     return Datatable::query($query)->addColumn('first_name', function ($model) {
         return link_to('users/' . $model->public_id . '/edit', $model->first_name . ' ' . $model->last_name);
     })->addColumn('email', function ($model) {
         return $model->email;
     })->addColumn('confirmed', function ($model) {
         return $model->deleted_at ? trans('texts.deleted') : ($model->confirmed ? trans('texts.active') : trans('texts.pending'));
     })->addColumn('dropdown', function ($model) {
         $actions = '<div class="btn-group tr-action" style="visibility:hidden;">
           <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
             ' . trans('texts.select') . ' <span class="caret"></span>
           </button>
           <ul class="dropdown-menu" role="menu">';
         if ($model->deleted_at) {
             $actions .= '<li><a href="' . URL::to('restore_user/' . $model->public_id) . '">' . uctrans('texts.restore_user') . '</a></li>';
         } else {
             $actions .= '<li><a href="' . URL::to('users/' . $model->public_id) . '/edit">' . uctrans('texts.edit_user') . '</a></li>';
             if (!$model->confirmed) {
                 $actions .= '<li><a href="' . URL::to('send_confirmation/' . $model->public_id) . '">' . uctrans('texts.send_invite') . '</a></li>';
             }
             $actions .= '<li class="divider"></li>
             <li><a href="javascript:deleteUser(' . $model->public_id . ')">' . uctrans('texts.delete_user') . '</a></li>';
         }
         $actions .= '</ul>
       </div>';
         return $actions;
     })->orderColumns(['first_name', 'email', 'confirmed'])->make();
 }
开发者ID:GhDj,项目名称:erp-fac-fin,代码行数:34,代码来源:UserController.php

示例6: op_smt_diary_get_post_image_form

function op_smt_diary_get_post_image_form($diaryImages)
{
    $html = array();
    if (!sfConfig::get('app_diary_is_upload_images')) {
        return $html;
    }
    $html[] = '<table class="file_list">';
    $max = sfConfig::get('app_diary_max_image_file_num', 3);
    for ($i = 1; $i <= $max; $i++) {
        $tagName = 'diary_photo_' . $i;
        $html[] = '<tr>';
        $label = label_for(__('Photo') . $i, $tagName);
        $html[] = content_tag('td', $label, array('class' => 'file_label'));
        $html[] = '<td>';
        if (isset($diaryImages[$i])) {
            $diaryImage = op_api_diary_image($diaryImages[$i], '48x48');
            $html[] = content_tag('p', link_to($diaryImage['imagetag'], $diaryImage['filename'], array('rel' => 'lightbox[image]')));
            $html[] = content_tag('input', '', array('type' => 'checkbox', 'name' => $tagName . '_photo_delete', 'id' => $tagName . '_photo_delete'));
            $html[] = label_for('&nbsp;' . __('remove the current photo'), $tagName . '_photo_delete');
        }
        $attr = array('type' => 'file', 'name' => $tagName, 'id' => $tagName);
        $html[] = content_tag('input', '', $attr);
        $html[] = '</td></tr>';
    }
    $html[] = '</table>';
    return $html;
}
开发者ID:te-koyama,项目名称:openpne,代码行数:27,代码来源:opSmtDiaryHelper.php

示例7: process

 public function process()
 {
     $invoice = $this->invoice();
     $message = trans('texts.' . $invoice->getEntityType()) . ' ' . $invoice->invoice_number;
     $message = link_to('/download/' . $invoice->invitations[0]->invitation_key, $message);
     return SkypeResponse::message($message);
 }
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:7,代码来源:DownloadInvoiceIntent.php

示例8: photo_link_to_add

function photo_link_to_add($entity, $entity_id, $options = array())
{
    // Convert options string to option array
    if (is_string($options)) {
        $options = _convert_string_option($options);
    }
    $label = 'Add photo';
    // CUSTOMIZE LABEL TEXT
    if (isset($options['label'])) {
        $label = $options['label'];
    }
    // ICON
    if (isset($options['icon']) && $options['icon'] == 'true') {
        use_helper('sfIcon');
        $label = icon_tag('image_add') . ' ' . $label;
    }
    $url = "sfPhotoGallery/create?entity={$entity}&entity_id={$entity_id}";
    $url = "@create_photo?entity={$entity}&entity_id={$entity_id}";
    // swicth link to with or without modalBox
    if (isset($options['modalbox']) && $options['modalbox'] == 'true') {
        use_helper('ModalBox');
        return m_link_to($label, $url, array('title' => 'upload photo'));
    } else {
        return link_to($label, $url);
    }
}
开发者ID:sgrove,项目名称:cothinker,代码行数:26,代码来源:sfPhotoGalleryHelper.php

示例9: getDataTable

 /**
  * @return mixed
  */
 public function getDataTable()
 {
     $articles = $this->articlesEntity->select(['id', 'topic', 'created_at', 'updated_at']);
     return Datatables::of($articles)->addColumn('edit', function ($article) {
         return link_to(route('backend.articles.edit', ['articles' => $article->id]), 'Edit', ['data-target-model' => $article->id, 'class' => 'btn btn-xs btn-primary']);
     })->make(true);
 }
开发者ID:muhamadsyahril,项目名称:ecommerce-1,代码行数:10,代码来源:ArticlesController.php

示例10: depp_omnibus_selector

/**
 * Return the HTML code for an unordered list showing opinions that can be voted (no AJAX)
 * If the user has already voted, then a message appears
 * 
 * @param  BaseObject  $object   Propel object instance to vote
 * @param  string      $message  a message string to be displayed in the voting-message block
 * @param  array       $options  Array of HTML options to apply on the HTML list
 * @return string
 **/
function depp_omnibus_selector($object, $message = '', $options = array())
{
    if (is_null($object)) {
        sfLogger::getInstance()->debug('A NULL object cannot be flagged as Omnibus');
        return '';
    }
    $user_id = sfContext::getInstance()->getUser()->getId();
    try {
        $options = _parse_attributes($options);
        if (!isset($options['id'])) {
            $options = array_merge($options, array('id' => 'omnibus-flag'));
        }
        $object_is_omnibus = $object->getIsOmnibus();
        $object_will_be_omnibus = !$object_is_omnibus;
        $selector = '';
        if ($object_is_omnibus) {
            $status = "Questo atto &egrave; Omnibus";
            $label = "Marcalo come non-Omnibus";
        } else {
            $status = "Questo atto non &egrave; Omnibus";
            $label = "Marcalo come Omnibus";
        }
        $selector .= link_to($label, sprintf('atto/setOmnibusStatus?id=%d&status=%d', $object->getId(), $object_will_be_omnibus), array('post' => true));
        return content_tag('div', $status) . content_tag('div', $selector, $options);
    } catch (Exception $e) {
        sfLogger::getInstance()->err('Exception catched from deppOmnibus helper: ' . $e->getMessage());
    }
}
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:37,代码来源:deppOmnibusHelper.php

示例11: op_activity_body_filter

/**
 * op_activity_body_filter
 *
 * @param Activity $activity
 * @param boolean  $is_auto_link
 * @return string
 */
function op_activity_body_filter($activity, $is_auto_link = true)
{
    $body = $activity->getBody();
    if ($activity->getTemplate()) {
        $config = $activity->getTable()->getTemplateConfig();
        if (!isset($config[$activity->getTemplate()])) {
            return '';
        }
        $params = array();
        foreach ($activity->getTemplateParam() as $key => $value) {
            $params[$key] = $value;
        }
        $body = __($config[$activity->getTemplate()], $params);
        $event = sfContext::getInstance()->getEventDispatcher()->filter(new sfEvent(null, 'op_activity.template.filter_body'), $body);
        $body = $event->getReturnValue();
    }
    $event = sfContext::getInstance()->getEventDispatcher()->filter(new sfEvent(null, 'op_activity.filter_body'), $body);
    $body = $event->getReturnValue();
    if (false === strpos($body, '<a') && $activity->getUri()) {
        return link_to($body, $activity->getUri());
    }
    if ($is_auto_link) {
        if ('mobile_frontend' === sfConfig::get('sf_app')) {
            return op_auto_link_text_for_mobile($body);
        }
        return op_auto_link_text($body);
    }
    return $body;
}
开发者ID:te-koyama,项目名称:openpne,代码行数:36,代码来源:opActivityHelper.php

示例12: link_to_sympal_comment_website

/**
 * Returns the anchor tag to a comment's website
 * 
 * @param   string $url     The url of the website to link to
 * @param   string $label   The text to include inside the link
 * @param   array  $options An array of link options
 * @return  string
 */
function link_to_sympal_comment_website($comment, $options = array())
{
    if (sfSympalConfig::get('sfSympalCommentsPlugin', 'websites_no_follow')) {
        $options['rel'] = 'nofollow';
    }
    return link_to($comment['author_name'], $comment['website'], $options);
}
开发者ID:slemoigne,项目名称:sympal,代码行数:15,代码来源:CommentsHelper.php

示例13: linkToPublish

 public function linkToPublish($object, $params)
 {
     if (!$object->isPublished()) {
         return '<li class="sf_admin_action_publish">' . link_to(__('Publish', array(), 'messages'), 'zsBlogAdmin/ListPublish?id=' . $object->getId(), $object) . '</li>';
     }
     return;
 }
开发者ID:kbond,项目名称:zsBlogPlugin,代码行数:7,代码来源:zsBlogAdminGeneratorHelper.class.php

示例14: getH1Txt

 /**
  * Method to return text for <h1> tag on parts landing page 
  * PRECONDITION: $this->fetchDetails() must be called first.
  */
 public function getH1Txt()
 {
     $sep = sfConfig::get('app_seo_word_sep_h1');
     $cat_crumb = link_to('Circuit Breaker', '@circuit_breakers');
     $manuf_crumb = link_to($this->_details['manuf'], "@cb_manuf?manuf_slug={$this->_details['manuf_slug']}");
     return "<strong>{$this->_part_no}</strong> {$sep} {$cat_crumb} {$sep} {$manuf_crumb}";
 }
开发者ID:morganney,项目名称:livewire,代码行数:11,代码来源:CBPart.class.php

示例15: getDatatableColumns

 protected function getDatatableColumns($entityType, $hideClient)
 {
     return [['vendor_name', function ($model) {
         if ($model->vendor_public_id) {
             return link_to("vendors/{$model->vendor_public_id}", $model->vendor_name);
         } else {
             return '';
         }
     }], ['client_name', function ($model) {
         if ($model->client_public_id) {
             return link_to("clients/{$model->client_public_id}", Utils::getClientDisplayName($model));
         } else {
             return '';
         }
     }], ['expense_date', function ($model) {
         return link_to("expenses/{$model->public_id}/edit", Utils::fromSqlDate($model->expense_date));
     }], ['amount', function ($model) {
         // show both the amount and the converted amount
         if ($model->exchange_rate != 1) {
             $converted = round($model->amount * $model->exchange_rate, 2);
             return Utils::formatMoney($model->amount, $model->expense_currency_id) . ' | ' . Utils::formatMoney($converted, $model->invoice_currency_id);
         } else {
             return Utils::formatMoney($model->amount, $model->expense_currency_id);
         }
     }], ['public_notes', function ($model) {
         return $model->public_notes != null ? substr($model->public_notes, 0, 100) : '';
     }], ['invoice_id', function ($model) {
         return self::getStatusLabel($model->invoice_id, $model->should_be_invoiced);
     }]];
 }
开发者ID:gauravvaidya11,项目名称:invoiceninja,代码行数:30,代码来源:ExpenseService.php


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