- Timestamp:
- Nov 20, 2009, 2:52:16 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/XPressMU/xpressme_integration_kit/blocks/block_common.php
r63 r451 18 18 endif; 19 19 20 if(!function_exists(" dropdown_cats_options")):21 function dropdown_cats_options($sort_column = 'ID', $sort_order = 'asc', $selected=array())20 if(!function_exists("categorie_select")): 21 function categorie_select($option_name = '',$value='',$row_num=0 ,$sort_column = 'ID', $sort_order = 'asc') 22 22 { 23 23 $mydirpath = dirname(dirname(__FILE__)); … … 30 30 $xoopsDB =& Database::getInstance(); 31 31 $myts =& MyTextSanitizer::getInstance(); 32 $selected = is_array($selected)?$selected:array($selected); 32 $selected = explode(',' , $value); 33 $isAll = (count($selected)==0||empty($selected[0]))?true:false; 33 34 $sort_column = 'cat_'.$sort_column; 35 if (empty($row_num)) $size = ''; else $size = 'size="' . $row_num . '"'; 34 36 include $mydirpath.'/wp-includes/version.php'; 35 37 if ($wp_db_version < 6124) { … … 53 55 } 54 56 $res = $xoopsDB->query($query, 0, 0); 57 $option = "\t<option value=\"0\" "; 58 if ($isAll) $option .= " selected=\"selected\""; 59 $option .= ">"._MB_XP2_ALL ."</option>\n"; 60 55 61 if ($res !== false){ 56 62 while($row = $xoopsDB->fetchArray($res)){ 57 63 $cat_name = $row['cat_name']; 58 64 $cat_ID = $row['cat_ID']; 59 echo"\t<option value=\"".$cat_ID."\"";65 $option .= "\t<option value=\"".$cat_ID."\""; 60 66 if (in_array($cat_ID, $selected)) 61 echo' selected="selected"';62 echo'>';63 echo$myts->htmlspecialchars($cat_name);64 echo"</option>\n";67 $option .= ' selected="selected"'; 68 $option .= '>'; 69 $option .= $myts->htmlspecialchars($cat_name); 70 $option .= "</option>\n"; 65 71 } 66 72 } 67 return; 73 $output = _MB_XP2_CATS_SELECT ."<br />\n"; 74 $output .= "<input type='hidden' name='$option_name' value='$value' />\n"; 75 $output .= ' <select name="categorie" '.$size.' multiple="multiple" onclick="CatSelect()">' ."\n"; 76 $output .= $option; 77 $output .= '</select><br />'; 78 $output .= ' 79 <script type="text/javascript"> 80 function CatSelect(){ 81 var idx=new Array(); 82 var sel=document.forms["blockform"].elements["categorie"].options; 83 for(var i=0, n=0; i<sel.length; i++){ 84 if(sel[i].selected){ idx[n++]=sel[i].value; } 85 } 86 if(idx.length>0){ 87 document.forms["blockform"].elements["' .$option_name . '"].value = idx; 88 } 89 } 90 </script> 91 '; 92 93 return $output; 94 95 } 96 endif; 97 98 if(!function_exists("comment_type_select")): 99 function comment_type_select($option_name = '',$value='') 100 { 101 $selected = explode(',' , $value); 102 $isAll = (count($selected)==0||empty($selected[0]))?true:false; 103 104 $option = "<option value=\"0\" "; 105 if ($isAll) $form .= " selected=\"selected\""; 106 $option .= ">"._MB_XP2_ALL ."</option>"; 107 108 $option .= "<option value=\"1\" "; 109 if (in_array(1, $selected)) 110 $option .= " selected=\"selected\""; 111 $option .= ">"._MB_XP2_COMMENT ."</option>"; 112 113 $option .= "<option value=\"2\" "; 114 if (in_array(2, $selected)) 115 $option .= " selected=\"selected\""; 116 $option .= ">"._MB_XP2_TRUCKBACK ."</option>"; 117 118 $option .= "<option value=\"3\" "; 119 if (in_array(3, $selected)) 120 $option .= " selected=\"selected\""; 121 $option .= ">"._MB_XP2_PINGBACK ."</option>"; 122 123 $output = _MB_XP2_COM_TYPE . "<br />\n"; 124 $output .= "<input type='hidden' name='$option_name' value='$value' />\n"; 125 $output .= ' <select name="com_type" multiple="multiple" onclick="ComTypeSelect()">' ."\n"; 126 $output .= $option; 127 $output .= '</select><br />'; 128 $output .= ' 129 <script type="text/javascript"> 130 function ComTypeSelect(){ 131 var idx=new Array(); 132 var sel=document.forms["blockform"].elements["com_type"].options; 133 for(var i=0, n=0; i<sel.length; i++){ 134 if(sel[i].selected){ idx[n++]=sel[i].value; } 135 } 136 if(idx.length>0){ 137 document.forms["blockform"].elements["' .$option_name . '"].value = idx; 138 } 139 } 140 </script> 141 '; 142 143 return $output; 144 68 145 } 69 146 endif; 70 147 71 148 72 73 149 ?>
Note: See TracChangeset
for help on using the changeset viewer.