Adds the possibility to have a link in a tableeditor.
authorAnne Limoges <anne.limoges_git@polytechnique.org>
Wed, 13 Feb 2013 15:16:36 +0000 (16:16 +0100)
committerAnne Limoges <anne.limoges_git@polytechnique.org>
Mon, 18 Feb 2013 08:43:36 +0000 (09:43 +0100)
classes/pltableeditor.php
templates/table-editor.tpl

index 89c0b14..28ca26f 100644 (file)
@@ -234,6 +234,11 @@ class PLTableEditor
         }
     }
 
+    // add a link on a field, the field value will be added at the end of the url
+    public function addLink($field, $url) {
+        $this->vars[$field]['url'] = $url;
+    }
+
     // force the value of a field in select and add
     public function force_field_value($field, $value)
     {
index 80b6caa..5a847a6 100644 (file)
@@ -69,6 +69,8 @@
       <input type="checkbox" disabled="disabled"{if $myrow.$myfield} checked="checked"{/if}/>
     {elseif $myval.Type eq 'ip_address'}
       {$myrow.$myfield|uint_to_ip}
+    {elseif $myval.url}
+      <a href="{$platal->ns}{$myval.url}{$myrow.$myfield}">{$myrow.$myfield}</a>
     {else}
       {$myrow.$myfield}
     {/if}
 {/if}{/foreach}
   {if !$hideactions}
   <td class="action">
-    {if !$readonly and !$deleteonly}
+    {if !$readonly and !$deleteonly and !addonly}
     <a href="{$t->pl}/edit/{$idval}">{icon name=page_edit title='éditer'}</a>
     {/if}
-    {if !$readonly}
+    {if !$readonly and !$addonly}
     <a href="{$t->pl}/delete/{$idval}{if t($idval2)}/{$idval2}{/if}?token={xsrf_token}">{icon name=delete title='supprimer'}</a>
     {/if}
   </td>