if (isset($guideDetails['tags'])) { echo $guideDetails['tags']; } ?> "> </div> <div class="form-group"> <label>Type *</label> <select class="form-control " name="type" id="type" value="<?php if (isset($guideDetails['type'])) { echo $guideDetails['type']; } ?> " required> <?php echo createDataSelector(_db(), "guide_category", false); ?> </select> </div> <div class="form-group"> <label>Description *</label> <select id='changeEditor'> <option value=''>Change Editor</option> <option value='html'>HTML</option> <option value='markitup'>Markitup</option> </select> <div class='editorContainer'> <textarea class="form-control required" rows="3" name="guide_txt" id="guide_txt" required><?php if (isset($guideDetails['guide_txt'])) { echo $guideDetails['guide_txt']; }
</div> </div> <br/> <div class="form-inline"> <div class="form-group"> <label>Logiks Package</label> <select class="form-control" name="package_id" id="package_id" value="<?php if (isset($apiDetails['package_id'])) { echo $apiDetails['package_id']; } ?> "> <?php echo createDataSelector(_db(), "packages"); ?> </select> </div> </div> <div id='form-buttons-bar' class="form-group form-buttons"> <button type="reset" class="btn btn-danger" id="cancel">Cancel</button> <button type="submit" class="btn btn-default" id="submitApi">Submit</button> </div> </form> <div style="display:none"> <form id='api_upload_form' method="post" enctype="multipart/form-data" action="<?php echo SiteLocation; ?> services/?scmd=api&site=<?php
function generateSelectOptions($fieldinfo, $data, $dbKey = "app") { $html = ""; switch ($fieldinfo['type']) { case 'select': if (!isset($fieldinfo['options'])) { $fieldinfo['options'] = []; } foreach ($fieldinfo['options'] as $key => $value) { if (!$value) { continue; } if (is_array($value)) { $cx = []; if (isset($value['label'])) { $vx = $value['label']; unset($value['label']); foreach ($value as $key => $value) { $cx[] = "{$key}='{$value}"; } } else { $vx = ""; } if ($data == $key) { $html .= "<option value='{$key}' " . implode(" ", $cx) . " selected>" . _ling($vx) . "</option>"; } else { $html .= "<option value='{$key}' " . implode(" ", $cx) . ">" . _ling($vx) . "</option>"; } } else { $vx = $value; if ($data == $key) { $html .= "<option value='{$key}' selected>" . _ling($vx) . "</option>"; } else { $html .= "<option value='{$key}'>" . _ling($vx) . "</option>"; } } } break; case 'selectAJAX': $html .= "<option value=''>Loading ...</option>"; break; case 'dataMethod': if (isset($fieldinfo['method'])) { if (is_array($fieldinfo['method']) && isset($fieldinfo['method']['name'])) { if (isset($fieldinfo['method']['params'])) { if (isset($fieldinfo['method']['valuefield'])) { $fieldinfo['method']['params'][$fieldinfo['method']['valuefield']] = $data; } $html .= call_user_func_array($fieldinfo['method']['name'], $fieldinfo['method']['params']); } elseif (isset($fieldinfo['method']['valuefield'])) { $fieldinfo['method']['params'][$fieldinfo['method']['valuefield']] = $data; $html .= call_user_func_array($fieldinfo['method']['name'], $fieldinfo['method']['params']); } else { $html .= call_user_func($fieldinfo['method']['name']); } } else { $html .= call_user_func($fieldinfo['method']); } } break; case 'dataSelector': if (!isset($fieldinfo['orderBy'])) { $fieldinfo['orderBy'] = null; } $noOption = _ling("No Selection"); /*if(!array_key_exists("", $fieldinfo['options']) || $fieldinfo['options']['']===true) { $html.="<option value=''>{$noOption}</option>"; }*/ $html .= createDataSelector($fieldinfo['groupid'], $fieldinfo['orderBy'], $dbKey); break; case 'dataSelectorFromUniques': if (!isset($fieldinfo['col1'])) { if (isset($fieldinfo['columns'])) { $cols = explode(",", $fieldinfo['columns']); $fieldinfo['col1'] = $cols[0]; if (isset($cols[1])) { $fieldinfo['col2'] = $cols[1]; } } } if (!isset($fieldinfo['col2'])) { $fieldinfo['col2'] = $fieldinfo['col1']; } if (!isset($fieldinfo['where'])) { $fieldinfo['where'] = null; } if (!isset($fieldinfo['orderBy'])) { $fieldinfo['orderBy'] = null; } /*if(!array_key_exists("", $fieldinfo['options']) || $fieldinfo['options']['']===true) { $html.="<option value=''>{$noOption}</option>"; }*/ $html .= createDataSelectorFromUniques($fieldinfo['table'], $fieldinfo['col1'], $fieldinfo['col2'], $fieldinfo['where'], $fieldinfo['orderBy'], $dbKey); break; case "dataSelectorFromTable": if (!isset($fieldinfo['columns'])) { $fieldinfo['columns'] = $fieldinfo['col1']; } if (!isset($fieldinfo['where'])) { $fieldinfo['where'] = null; } if (!isset($fieldinfo['groupBy'])) { $fieldinfo['groupBy'] = null; } if (!isset($fieldinfo['orderBy'])) { $fieldinfo['orderBy'] = null; } /*if(!array_key_exists("", $fieldinfo['options']) || $fieldinfo['options']['']===true) { $html.="<option value=''>{$noOption}</option>"; }*/ $html .= createDataSelectorFromTable($fieldinfo['table'], $fieldinfo['columns'], $fieldinfo['where'], $fieldinfo['groupBy'], $fieldinfo['orderBy'], $dbKey); break; } return $html; }