コード例 #1
0
function core_cleanArray($Array)
{
    $List = array();
    if (!is_array($Array)) {
        return $Array;
    }
    foreach ($Array as $Key => $Value) {
        if (!empty($Value)) {
            if (is_array($Value)) {
                $Value = core_cleanArray($Value);
            }
            if (!empty($Value)) {
                $List[$Key] = $Value;
            }
        }
    }
    if (!empty($List)) {
        return $List;
    }
}
コード例 #2
0
ファイル: input.php プロジェクト: aoloe/wordpress-db-toolkit
         $concatvalues[] = $outValue;
     }
     $outString = 'CONCAT(' . implode(',\' \',', $concatvalues) . ') as outValue';
     $Query = "SELECT " . $Config['_Linkedfields'][$Field]['ID'] . ", " . $outString . " FROM `" . $Config['_Linkedfields'][$Field]['Table'] . "` ORDER BY `" . $Config['_Linkedfields'][$Field]['Value'][0] . "` ASC;";
     $Res = mysql_query($Query);
     //$Return = '<select name="dataForm['.$Element['ID'].']['.$Field.']" id="entry_'.$Element['ID'].'_'.$Field.'" class="'.$Req.'">';
     //if(empty($Defaults[$Field])){
     //$Return .= '<option value=""></option>';
     //}
     $checkindex = 0;
     //$Return = 'Listed: <select name="multiselect_'.$Field.'" id="selector_'.$Element['ID'].'_'.$Field.'" class="'.$Req.'">';
     $Return = '';
     while ($lrow = mysql_fetch_assoc($Res)) {
         $Sel = '';
         if (!empty($Defaults[$Field])) {
             $DefaultArray = core_cleanArray(explode('|', $Defaults[$Field]));
             if (in_array($lrow[$Config['_Linkedfields'][$Field]['ID']], $DefaultArray)) {
                 $Sel = 'checked="checked"';
             }
         }
         //$Return .= '<option value="'.$lrow[$Config['_Linkedfields'][$Field]['ID']].'" '.$Sel.' >'.$lrow['outValue'].'</option>';
         $Return .= '<label class="checkbox" for="entry_' . $Element['ID'] . '_' . $Field . '_' . $checkindex . '"><input type="checkbox" value="' . $lrow[$Config['_Linkedfields'][$Field]['ID']] . '" name="dataForm[' . $Element['ID'] . '][' . $Field . '][]" id="entry_' . $Element['ID'] . '_' . $Field . '_' . $checkindex . '" class="' . $Req . '" ' . $Sel . ' />' . $lrow['outValue'] . '</label>';
         $checkindex++;
     }
     //$Return .= '</select> <input type="button" name="button" id="button" value="Add" onclick="linked_addOption(\''.$Element['ID'].'_'.$Field.'\')" />';
     //$Return .= 'Selected: <select name="dataForm['.$Element['ID'].']['.$Field.'][]" id="entry_'.$Element['ID'].'_'.$Field.'" class="'.$Req.'">';
     //$Return .= '</select>';
     break;
 case "dropdown":
     $Ordering = " ORDER BY `" . $Config['_Linkedfields'][$Field]['Value'][0] . "` ASC";
     if (!empty($Config['_Linkedfields'][$Field]['_Sort'])) {