Esempio n. 1
0
function options__save_item_order($item_type, $order_array, $details = array())
{
    $pars = array(':item_type' => $item_type);
    $query = "DELETE FROM " . table('objects') . "\n            WHERE item_type= :item_type";
    $done = or_query($query, $pars);
    $pars = array();
    foreach ($order_array as $k => $v) {
        if (isset($details[$v]) && is_array($details[$v])) {
            $detstr = property_array_to_db_string($details[$v]);
        } else {
            $detstr = '';
        }
        $pars[] = array(':item_type' => $item_type, ':item_name' => $v, ':order_number' => $k, ':item_details' => $detstr);
    }
    $query = "INSERT INTO " . table('objects') . "\n            SET order_number = :order_number,\n            item_type = :item_type,\n            item_name = :item_name,\n            item_details = :item_details";
    $done = or_query($query, $pars);
    return $done;
}
    $subpool = orsee_db_load_array("subpools", $subpool_id, "subpool_id");
    if (!$subpool['subpool_id']) {
        $subpool = orsee_db_load_array("subpools", 1, "subpool_id");
    }
}
if ($proceed) {
    if (isset($_REQUEST['edit']) && $_REQUEST['edit']) {
        $t['item_details']['current_draft'] = $_REQUEST['current_draft'];
        $t['item_details'] = property_array_to_db_string($t['item_details']);
        $done = orsee_db_save_array($t, "objects", $t['item_id'], "item_id");
        log__admin("pform_templates_edit", "item_name:" . $t['item_name']);
        message(lang('changes_saved'));
        redirect('admin/options_profile_template_edit.php?item_name=' . $item_name . '&subpool_id=' . $subpool_id);
    } elseif (isset($_REQUEST['activate']) && $_REQUEST['activate']) {
        $t['item_details']['current_template'] = $t['item_details']['current_draft'];
        $t['item_details'] = property_array_to_db_string($t['item_details']);
        $done = orsee_db_save_array($t, "objects", $t['item_id'], "item_id");
        log__admin("pform_templates_activate", "item_name:" . $t['item_name']);
        message(lang('template_draft_activated'));
        redirect('admin/options_profile_template_edit.php?item_name=' . $item_name . '&subpool_id=' . $subpool_id);
    }
}
if ($proceed) {
    if (!isset($t['item_details']['current_template'])) {
        $t['item_details']['current_template'] = '';
    }
    if (!isset($t['item_details']['current_draft'])) {
        $t['item_details']['current_draft'] = $t['item_details']['current_template'];
    }
    echo '<center>
			<TABLE class="or_page_subtitle" style="background: ' . $color['page_subtitle_background'] . '; color: ' . $color['page_subtitle_textcolor'] . '; width: 98%">
Esempio n. 3
0
function query__save_query($json_query, $type, $experiment_id = 0, $properties = array(), $permanent = false)
{
    // type can be participants_search_active, participants_search_all, assign, deassign
    global $expadmin;
    $now = time();
    if ($experiment_id && $permanent) {
        // if this query is supposed to be permanent, then reset current permanent query if any
        $done = query__reset_permanent($experiment_id);
        // for new query
        $properties['is_permanent'] = 1;
        $properties['permanent_start_time'] = time();
        $properties['assigned_count'] = 0;
        $addquery = ", permanent=1";
        $addmessage = lang('activated_as_permanent_query');
    } else {
        $addquery = ", permanent=0";
    }
    $properties_string = property_array_to_db_string($properties);
    $continue = true;
    if ($experiment_id == 0) {
        // check if we already know this query, and if so, just update the record
        $pars = array(':json_query' => $json_query);
        $query = "SELECT * FROM " . table('queries') . "\n                WHERE json_query= :json_query LIMIT 1";
        $line = orsee_query($query, $pars);
        if (isset($line['query_id'])) {
            $pars = array(':query_time' => $now, ':query_id' => $line['query_id']);
            $query = "UPDATE " . table('queries') . "\n                    SET query_time= :query_time\n                    WHERE query_id= :query_id";
            $done = or_query($query, $pars);
            message(lang('query_existed_now_updated'));
            $continue = false;
        }
    }
    // otherwise, save the query
    if ($continue) {
        if (isset($expadmindata['admin_id'])) {
            $admin_id = $expadmindata['admin_id'];
        } else {
            $admin_id = '';
        }
        $pars = array(':query_time' => $now, ':json_query' => $json_query, ':query_type' => $type, ':experiment_id' => $experiment_id, ':properties' => $properties_string, ':admin_id' => $admin_id);
        $query = "INSERT INTO " . table('queries') . "\n                SET query_time=:query_time,\n                json_query=:json_query,\n                query_type=:query_type,\n                experiment_id=:experiment_id,\n                admin_id=:admin_id,\n                properties=:properties " . $addquery;
        $done = or_query($query, $pars);
        message(lang('query_saved'));
        if (isset($addmessage)) {
            message($addmessage);
        }
    }
    return $done;
}
Esempio n. 4
0
function email__attachment_array_to_dbstring($attachments = array())
{
    $atts = array();
    foreach ($attachments as $k => $attachment) {
        // $attachment['data']=base64_encode($attachment['data']); already comes base64 encoded ...
        $atts[] = property_array_to_db_string($attachment);
    }
    $data_string = implode('|-!nextatt!-|', $atts);
    return $data_string;
}
                            if ($tv) {
                                $_REQUEST[$k][$tk] = trim($tv);
                            } else {
                                unset($_REQUEST[$k][$tk]);
                            }
                        }
                        $prop_array[$k] = implode(',', $_REQUEST[$k]);
                    } else {
                        $prop_array[$k] = trim($_REQUEST[$k]);
                    }
                } else {
                    $prop_array[$k] = $field[$k];
                }
            }
        }
        $pform_field['properties'] = property_array_to_db_string($prop_array);
        $done = orsee_db_save_array($pform_field, "profile_fields", $field_name, "mysql_column_name");
        message(lang('changes_saved'));
        redirect('admin/' . thisdoc() . '?mysql_column_name=' . $field_name);
    }
}
if ($proceed) {
    echo '<center>';
    javascript__tooltip_prepare();
    echo '<FORM action="' . thisdoc() . '" method="POST">';
    echo '<INPUT type="hidden" name="mysql_column_name" value="' . $field_name . '">';
    echo '<TABLE class="or_formtable">
			<TR><TD colspan="2">
				<TABLE width="100%" border=0 class="or_panel_title"><TR>
					<TD style="background: ' . $color['panel_title_background'] . '; color: ' . $color['panel_title_textcolor'] . '" align="center">
							' . lang('configure_participant_profile_field') . ' ' . $field_name . '