[Devel] r299 - branches/dui

svn at agendadulibre.org svn at agendadulibre.org
Mar 2 Oct 23:53:45 CEST 2007


Author: ldayot
Date: Tue Oct  2 23:52:53 2007
New Revision: 299

Log:
Rendre le sous titre optionnel.



Modified:
   branches/dui/funcs.inc.php

Modified: branches/dui/funcs.inc.php
==============================================================================
--- branches/dui/funcs.inc.php	(original)
+++ branches/dui/funcs.inc.php	Tue Oct  2 23:52:53 2007
@@ -120,7 +120,8 @@
   }
   echo "<div class=\"main\">\n";
   echo "<h1><a href=\"index.php\">$adl_title</a></h1>\n";
-  echo "<p id=\"subtitle\"><em>$adl_subtitle</em></p>\n";
+  if ($adl_subtitle>"")
+    echo "<p id=\"subtitle\"><em>$adl_subtitle</em></p>\n";
 
 } // end function put_header
 
@@ -1079,7 +1080,7 @@
 {
   $oTags = selectCategoryTags($aTags, 0, $fieldName="tags[tag]", $multiple=false);
   $return = "<strong>". _("Tags"). "</strong> : {$oTags->HTML}<br />\n";
-  $aCategoryTags = selectWithCategoryTags($aTags, $multiple=false);
+  $aCategoryTags = selectWithCategoryTags($aTags, $multiple=true);
   foreach ($aCategoryTags->HTML as $category_id=>$aSelect)
   {
     $return .= "<strong>{$aSelect['categoryName']}</strong> : ". $aSelect['HTMLSelect'].
@@ -1113,7 +1114,7 @@
   while ($row = $db->fetchObject($ret))
   {
     $oneline = selectCategoryTags($aTags, $row->id, 
-      $fieldName="tags[". ($multiple ? $row->id : $row->name) ."]", $multiple);
+      $fieldName="tags[". $row->name. "]", $multiple, $row->name);
     $tagsSelect .= " ". $oneline->tagsSelect;
 
     $return[$row->id]["categoryName"] = $row->name;
@@ -1142,7 +1143,7 @@
 // Function to choose tags
 // $aTags is an array (tag_name) of tags to be selected/checked
 // output if HTML string select/checkboxes part of form
-function selectCategoryTags($aTags=array(), $categoryId=0, $fieldName="tags[0]", $multiple=false)
+function selectCategoryTags($aTags=array(), $categoryId=0, $fieldName="tags[0]", $multiple=false, $categoryName="")
 {
   global $db;
   // TODO Select only tags used twice or more.
@@ -1167,7 +1168,8 @@
   while ($row = $db->fetchObject($ret))
   {
     // is this tag in $aTags = checked/selected
-    $inArray = in_array($row->name, $aTags);
+    $inArray = in_array($row->name, is_array($aTags[$categoryName]) ? $aTags[$categoryName] : $aTags);
+
     // only tags used twice or more
     if ($categoryId>0 || $row->n>1)
     {


Plus d'informations sur la liste de diffusion Devel