문제

So, here's my little problem: I have generated an admin with the Symfony admin generator, but I need to display a link (or a button for that matter) that can be click to open a C.V. file.

As of now, i have:

generator:
  class: sfDoctrineGenerator
  param:
    model_class:           Client
    theme:                 admin
    non_verbose_templates: true
    with_show:             false
    singular:              ~
    plural:                ~
    route_prefix:          client
    with_doctrine_route:   true
    actions_base_class:    sfActions

    config:
      actions: ~
      fields:
         job_titles_list: { label: Emplois disponnibles }
         created_at:      { label: Cree le }
         updated_at:      { label: Mis a jour le }
      list:    
         display: [=name, firstname, experience, connexe, formation, created_at, cv_file]
         title: Gestion des prospects      
      filter: 
         display: [name, firstname, phone, cellphone, postalcode, experience, connexe, formation, job_titles_list, created_at, updated_at]
      form:    ~
      edit:  
         fields:
            formation: { label: Formation }
            experience: { label: Experience }
            connexe: { label: Connexe }
      new:     ~

As you can see, in list/display, i have a cv_file, which gives me a link (from the DB). I need to render this column with a link.

By the way, I know nothing about Symfony, so be gentle ;)

Thanks a lot!

도움이 되었습니까?

해결책

You can use a virtual field in your list, say _curriculum:

display: [=name, firstname, experience, connexe, formation, created_at, _curriculum]

So Symfony will read a partial named _curriculum.php by the template folder of your module. Finally you have to create _curriculum.php in the template folder and write inside this partial the code to create the link tag:

<?php echo link_to('Download CV', $Client->getCvFile()); ?>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top