示例#1
0
    // Output to view
    $smarty->assign('values', $values);
}
if (isset($_POST['experiment_create'])) {
    $eid = (int) safeString($_POST['id']);
    $values = array('name' => safeString($_POST['experiment_name']), 'description' => safeString($_POST['experiment_description']));
    updateExperiment($eid, $values);
    // Something busted here, also need to account for checkboxes
    $tags = getTagsForExperiment($eid);
    $tag_list = array();
    $new_tags = array();
    foreach ($tags as $tag) {
        $tag_list[] = $tag['tag'];
    }
    $tag_submit = safeString($_POST['experiment_tags']);
    $tag_submit = explode(",", $tag_submit);
    foreach ($tag_submit as $tag) {
        if (!in_array($tag, $tag_list) && !in_array($tag, $tag_list)) {
            $new_tags[] = array('value' => $tag, 'weight' => 2);
        }
    }
    addTagsToExperiment($eid, $new_tags);
    $created = true;
    $title = "Successfully Edited Experiment";
}
$smarty->assign('eid', $eid);
$smarty->assign('created', $created);
$smarty->assign('user', $session->getUser());
$smarty->assign('title', 'Edit Experiment');
$smarty->assign('content', $smarty->fetch('experiment-edit.tpl'));
$smarty->display('skeleton.tpl');
示例#2
0
文件: create.php 项目: nickavv/iSENSE
         $tag_list[] = array('value' => $val, 'weight' => 2);
     }
 }
 // Add user specified subject tags to experiment
 $add_tags = array('math' => 'Mathematics', 'phys' => 'Physics', 'chem' => 'Chemistry', 'bio' => 'Biology', 'earth' => 'Earth Science');
 foreach ($add_tags as $k => $t) {
     $name = 'add_tag_' . $k;
     if ($_POST[$name] == 'yes') {
         $val = safeString(str_replace(",", "", $t));
         if (strlen($val) > 0) {
             $tag_list[] = array('value' => $val, 'weight' => 2);
         }
     }
 }
 // Push experiment tags to the db
 addTagsToExperiment($exp['experiment_id'], $tag_list);
 // Create empty session with propper fields
 $session_id = createSession($session->generateSessionToken(), $exp['experiment_id']);
 // Add fields to empty session
 $limit = (int) safeString($_POST['number_of_fields']);
 $limit += 1;
 for ($i = 1; $i < $limit; $i++) {
     $name = 'field_label_' . $i;
     $type = 'field_type_' . $i;
     $unit = 'field_unit_' . $i;
     if (isset($_POST[$name]) && isset($_POST[$type])) {
         $fieldName = safeString($_POST[$name]);
         $fieldType = safeString($_POST[$type]);
         $fieldUnit = safeString($_POST[$unit]);
         if ($fieldType == 7 && $fieldUnit != 28) {
             $fieldName = 'Time';