コード例 #1
0
function create_multi(&$question, $qid, $varname, $scale_id = false, $free = false, $other = false)
{
    global $dom;
    global $dbprefix;
    global $connect;
    global $quexmllang;
    global $surveyid;
    global $qlang;
    $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
    $Query = "SELECT * FROM {$dbprefix}questions WHERE parent_qid = {$qid}  AND language='{$quexmllang}' ";
    if ($scale_id != false) {
        $Query .= " AND scale_id = {$scale_id} ";
    }
    $Query .= " ORDER BY question_order ASC";
    //$QueryResult = mysql_query($Query) or die ("ERROR: $QueryResult<br />".mysql_error());
    $QueryResult = db_execute_assoc($Query);
    $nextcode = "";
    while ($Row = $QueryResult->FetchRow()) {
        $response = $dom->create_element("response");
        if ($free == false) {
            $fixed = $dom->create_element("fixed");
            $category = $dom->create_element("category");
            $label = $dom->create_element("label");
            $label->set_content(cleanup($Row['question']));
            $value = $dom->create_element("value");
            //$value->set_content(cleanup($Row['title']));
            $value->set_content("1");
            $nextcode = $Row['title'];
            $category->append_child($label);
            $category->append_child($value);
            $st = skipto($qid, 'Y', " AND c.cfieldname LIKE '+{$surveyid}" . "X" . $Row['gid'] . "X" . $qid . $Row['title'] . "' ");
            if ($st !== false) {
                $skipto = $dom->create_element("skipTo");
                $skipto->set_content($st);
                $category->append_child($skipto);
            }
            $fixed->append_child($category);
            $response->append_child($fixed);
        } else {
            $response->append_child(create_free($free['f'], $free['len'], $Row['question']));
        }
        $response->set_attribute("varName", $varname . cleanup($Row['title']));
        $question->append_child($response);
    }
    if ($other && $free == false) {
        $response = $dom->create_element("response");
        $fixed = $dom->create_element("fixed");
        $category = $dom->create_element("category");
        $label = $dom->create_element("label");
        $label->set_content(get_length($qid, "other_replace_text", $qlang->gT("Other")));
        $value = $dom->create_element("value");
        //Get next code
        if (is_numeric($nextcode)) {
            $nextcode++;
        } else {
            if (is_string($nextcode)) {
                $nextcode = chr(ord($nextcode) + 1);
            }
        }
        $value->set_content(1);
        $category->append_child($label);
        $category->append_child($value);
        $contingentQuestion = $dom->create_element("contingentQuestion");
        $length = $dom->create_element("length");
        $text = $dom->create_element("text");
        $text->set_content(get_length($qid, "other_replace_text", $qlang->gT("Other")));
        $length->set_content(24);
        $contingentQuestion->append_child($text);
        $contingentQuestion->append_child($length);
        $contingentQuestion->set_attribute("varName", $varname . 'other');
        $category->append_child($contingentQuestion);
        $fixed->append_child($category);
        $response->append_child($fixed);
        $response->set_attribute("varName", $varname . cleanup($nextcode));
        $question->append_child($response);
    }
    return;
}
コード例 #2
0
        $_POST["tripid"] = $_GET["tripid"];
    }
    //Sends the product id to edit product
    if (isset($_GET["proid"])) {
        $_POST["proid"] = $_GET["proid"];
    }
    //Just a way to ensure that the product is loaded only once for editing
    if (isset($_GET["proid"])) {
        $_POST["busy"] = "No";
    }
    $_POST["setfocus"] = "clength";
    $OUTPUT = get_length($_POST);
} else {
    # Display default output
    $_POST["setfocus"] = "clength";
    $OUTPUT = get_length($_POST);
}
# get templete
require "template.php";
function get_length($_POST)
{
    $Out = "";
    # get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($id, "num", 1, 10, "Invalid client No.");
    # display errors, if any
    if ($v->isError()) {
        $confirmCust = "";
コード例 #3
0
         $response2 = $dom->create_element("response");
         $response2->set_attribute("varName", cleanup($RowQ['title']) . "_2");
         $response2->append_child(create_fixed($qid, false, false, 1));
         $question->append_child($response);
         $question->append_child($response2);
         break;
     case ":":
         //multi-flexi array numbers
         create_subQuestions(&$question, $qid, $RowQ['title']);
         //get multiflexible_checkbox - if set then each box is a checkbox (single fixed response)
         $mcb = get_length($qid, 'multiflexible_checkbox', -1);
         if ($mcb != -1) {
             create_multi(&$question, $qid, $RowQ['title'], 1);
         } else {
             //get multiflexible_max - if set then make boxes of max this width
             $mcm = strlen(get_length($qid, 'multiflexible_max', 1));
             create_multi(&$question, $qid, $RowQ['title'], 1, array('f' => 'integer', 'len' => $mcm, 'lab' => ''));
         }
         break;
     case ";":
         //multi-flexi array text
         create_subQuestions(&$question, $qid, $RowQ['title']);
         //foreach question where scale_id = 1 this is a textbox
         create_multi(&$question, $qid, $RowQ['title'], 1, array('f' => 'text', 'len' => 10, 'lab' => ''));
         break;
     case "^":
         //SLIDER CONTROL - not supported
         $response->append_child(fixed_array(array("NOT SUPPORTED:{$type}" => 1)));
         $question->append_child($response);
         break;
 }
コード例 #4
0
ファイル: index.php プロジェクト: blacker-hovse/nearer
EOF
);
}
if (array_key_exists('action', $_GET)) {
    $action = strtoupper($_GET['action']);
    switch ($action) {
        case 'SKIP':
        case 'STOP':
            nearer_record($action . ' ' . substr($play, -11), NULL);
        case 'PLAY':
            nearer_control($action);
            break;
    }
}
if (array_key_exists('url', $_POST)) {
    if (preg_match('/[\\w-]{11}/', $_POST['url'], $matches) and $length = get_length(get_url($matches[0]), true)) {
        $data = get_data(get_url($matches[0]));
        if (strpos(strtolower($data->title), 'valkyries') === false) {
            if (nearer_control("APPEND {$matches['0']} {$length}")) {
                nearer_record('PLAY ' . $matches[0], substr($_POST['note'], 0, 255));
                $success = 'Successfully added video to queue.';
            } else {
                $error = 'Failed to add video to queue.';
            }
        } else {
            $error = 'Ride detected. Nice try, punk.';
        }
    } else {
        $error = 'Invalid URL or video ID.';
    }
}