public static function formListing() { $forms = forms::getObjectForms(); $output = '<option value="NULL">-- Select a Form --</option>'; foreach ($forms as $form) { $output .= sprintf('<option value="%s" %s>%s</option>', $form['ID'], $form['ID'] == sessionGet("lastSearchForm") ? "selected" : "", $form['title']); } return $output; }
public static function generateFormSelectListForFormCreator($metadata = TRUE) { if ($metadata === TRUE) { if (($forms = forms::getMetadataForms()) === FALSE) { errorHandle::errorMsg("Error getting Metadata Forms"); return FALSE; } } else { if ($metadata === FALSE) { if (($forms = forms::getObjectForms()) === FALSE) { errorHandle::errorMsg("Error getting Object Forms"); return FALSE; } } } $formList = '<ul class="pickList">'; foreach ($forms as $form) { if (!mfcsPerms::isViewer($form['ID'])) { continue; } $formList .= sprintf('<li><a href="index.php?id=%s" class="btn">%s</a></li>', htmlSanitize($form['ID']), forms::title($form['ID'])); } $formList .= "<ul>"; return $formList; }
<?php include "../header.php"; log::insert("Form Creator: Copy: View"); try { // Get list of forms for choices dropdown if (($objectForms = forms::getObjectForms()) === FALSE) { throw new Exception("Errer retreiving metadata forms"); } if (is_array($objectForms)) { $tmp = ''; foreach ($objectForms as $form) { $tmp .= sprintf('<option value="%s">%s</option>', $form['ID'], $form['title']); } localVars::add("formsOptions", $tmp); unset($tmp); } if (isset(mfcs::$engine->cleanPost['MYSQL']['submitCopy'])) { if (!isset(mfcs::$engine->cleanPost['MYSQL']['newTitle']) || is_empty(mfcs::$engine->cleanPost['MYSQL']['newTitle'])) { throw new Exception("New Form Title is required."); } // Get all fields from the forms table except the primary key $fields = mfcs::$engine->openDB->listFields("forms", FALSE); // Remove unique field foreach ($fields as $I => $field) { if ($field == 'title') { unset($fields[$I]); } } mfcs::$engine->openDB->transBegin(); log::insert("Form Creator: Copy: ", 0, mfcs::$engine->cleanPost['MYSQL']['formSelect'], mfcs::$engine->cleanPost['MYSQL']['newTitle']);