Exemplo n.º 1
0
function log__link()
{
    $post = $_REQUEST;
    unset($post['SID']);
    unset($post['PHPSESSID']);
    $arg_list = func_get_args();
    foreach ($arg_list as $arg) {
        $var = explode("=", $arg);
        $post[$var[0]] = $var[1];
    }
    $link = '<A HREF="' . thisdoc() . '?';
    foreach ($post as $key => $value) {
        $link .= $key . '=' . urlencode($value) . '&';
    }
    $link .= '">';
    return $link;
}
Exemplo n.º 2
0
 if ($mode == 'inbox') {
     echo lang('mailbox_inbox');
 } elseif ($mode == 'experiment') {
     echo lang('experiment') . ': ' . $experiment['experiment_name'];
 } elseif ($mode == 'session') {
     echo lang('session') . ': ' . $experiment['experiment_name'] . ', ' . session__build_name($session);
 } elseif ($mode == 'participant') {
     echo lang('participant') . ': ' . $participant['email'];
 } elseif ($mode == 'mailbox') {
     echo lang('email_mailbox') . ': ' . $mailboxes[$id];
 } elseif ($mode == 'listmailboxes') {
     echo lang('all_mailboxes');
 } elseif ($mode == 'trash') {
     echo lang('mailbox_trash');
     if (check_allow('emails_trash_empty')) {
         echo button_link(thisdoc() . '?mode=trash&empty_trash=true', lang('email_empty_trash'), 'trash') . '<BR>';
     }
 }
 echo '
         </TD></TR></TABLE>
     </TD></TR>
     <TR><TD align="center">';
 // list emails
 if ($mode == 'listmailboxes') {
     // show mail boxes
     email__show_mail_boxes();
 } elseif ($mode == 'search') {
     // search for emails and list them
 } else {
     echo javascript__email_popup();
     email__list_emails($mode, $id, $rmode, $url_string);
Exemplo n.º 3
0
        } else {
            $style = 'orsee';
        }
    }
}
if ($proceed) {
    echo '<center>';
    echo '<TABLE class="or_page_subtitle" style="background: ' . $color['page_subtitle_background'] . '; color: ' . $color['page_subtitle_textcolor'] . '; width: 80%;">
            <TR><TD align="center">
            ' . lang('style') . ' ' . $style . '
            </TD>
            </TR></TABLE>';
    echo '
            <TABLE style="width: 80%;">
            <TR><TD align="right">
            <FORM id="styleform" action="' . thisdoc() . '" method="GET">' . lang('edit_colors_for_style') . survey__render_select_list(array('submitvarname' => 'style', 'option_values' => $styles, 'option_values_lang' => $styles, 'value' => $style, 'include_none_option' => 'n')) . '<INPUT class="button" type="submit" value="' . lang('go') . '"></FORM>
            </TD>
            </TR></TABLE>';
    $pars = array(':style' => $style);
    $query = "select * from " . table('options') . "\n            where option_type='color'\n            and option_style= :style\n            order by option_name";
    $result = or_query($query, $pars);
    $mycolors = array();
    while ($line = pdo_fetch_assoc($result)) {
        $mycolors[$line['option_name']] = $line['option_value'];
    }
    if (check_allow('settings_edit_colors') && isset($_REQUEST['change']) && $_REQUEST['change']) {
        $newcolors = $_REQUEST['mycolors'];
        $now = time();
        $pars_new = array();
        $pars_update = array();
        foreach ($newcolors as $oname => $ovalue) {
Exemplo n.º 4
0
function experiment__current_experiment_summary($experimenter = "", $finished = "n", $show_filter = false, $addbutton = true)
{
    global $lang, $expadmindata, $color;
    $experimentclasses = experiment__load_experimentclassnames();
    $experimenters = experiment__load_experimenters();
    $pars = array();
    $experimenter_arr = array();
    if (isset($_REQUEST['experimenter_search']) && $_REQUEST['experimenter_search']) {
        $experimenter_arr = multipicker_json_to_array($_REQUEST['experimenter_search']);
    }
    if ($experimenter && count($experimenter_arr) == 0) {
        $experimenter_arr = array($experimenter);
    }
    $exp_clause = query__get_experimenter_or_clause($experimenter_arr);
    if ($exp_clause['clause']) {
        $expq = ' AND ' . $exp_clause['clause'];
        foreach ($exp_clause['pars'] as $k => $v) {
            $pars[$k] = $v;
        }
    } else {
        $expq = "";
    }
    $class_arr = array();
    if (isset($_REQUEST['class_search']) && $_REQUEST['class_search']) {
        $class_arr = multipicker_json_to_array($_REQUEST['class_search']);
    }
    $class_clause = query__get_class_or_clause($class_arr);
    if ($class_clause['clause']) {
        $classq = ' AND ' . $class_clause['clause'];
        foreach ($class_clause['pars'] as $k => $v) {
            $pars[$k] = $v;
        }
    } else {
        $classq = "";
    }
    $finq = " " . table('experiments') . ".experiment_finished= :finished";
    $pars[':finished'] = $finished;
    $aquery = $finq . $expq . $classq;
    $query = "SELECT " . table('experiments') . ".*,\n\t\t\t\tcount(*) as num_sessions,\n\t\t\t\tif(session_start IS NULL, 1,0) as no_sessions,\n\t\t\t\tmin(if(session_start > date_format(now(),'%Y%m%d%H%i'), \n\t\t\t\tsession_start,NULL)) as time,\n      \t\t\tmin(session_start) as first_session_date,\n      \t\t\tmax(session_start) as last_session_date\n      \t\t\tFROM " . table('experiments') . "\n      \t\t\tLEFT JOIN " . table('sessions') . " ON " . table('experiments') . ".experiment_id=" . table('sessions') . ".experiment_id \n      \t\t\tWHERE " . table('experiments') . ".experiment_id IS NOT NULL \n      \t\t\tAND " . $aquery . " \n      \t\t\tGROUP BY experiment_id \n      \t\t\tORDER BY no_sessions, time, last_session_date DESC, experiment_id";
    $result = or_query($query, $pars);
    $experiments = array();
    $eids = array();
    while ($line = pdo_fetch_assoc($result)) {
        $line['sessions'] = array();
        $experiments[$line['experiment_id']] = $line;
        $eids[] = $line['experiment_id'];
    }
    if (count($eids) > 0) {
        $query = "SELECT * \n\t      \t\t\tFROM " . table('sessions') . " \n\t\t\t\t\tWHERE (session_status='planned' OR session_status='live') \n\t\t\t\t\tAND experiment_id IN (" . implode(',', $eids) . ") \n\t\t\t\t\tORDER BY session_start, session_id";
        $result = or_query($query);
        $sids = array();
        while ($line = pdo_fetch_assoc($result)) {
            $experiments[$line['experiment_id']]['sessions'][$line['session_id']] = $line;
            $sids[] = $line['session_id'];
        }
        // get counts at experiment level
        // performance is better if doing this separately
        $query = "SELECT experiment_id, \n\t\t\t\t\tcount(*) as num_assigned \n\t\t\t\t\tFROM " . table('participate_at') . "  \n\t\t\t\t\tWHERE experiment_id IN (" . implode(',', $eids) . ")\n\t\t\t\t\tGROUP BY experiment_id";
        $result = or_query($query);
        while ($line = pdo_fetch_assoc($result)) {
            $experiments[$line['experiment_id']]['num_assigned'] = $line['num_assigned'];
        }
        $query = "SELECT experiment_id, \n\t\t\t\t\tcount(*) as num_registered \n\t\t\t\t\tFROM " . table('participate_at') . "  \n\t\t\t\t\tWHERE session_id!=0 \n\t\t\t\t\tAND experiment_id IN (" . implode(',', $eids) . ")\n\t\t\t\t\tGROUP BY experiment_id";
        $result = or_query($query);
        while ($line = pdo_fetch_assoc($result)) {
            $experiments[$line['experiment_id']]['num_registered'] = $line['num_registered'];
        }
        $participated_clause = expregister__get_pstatus_query_snippet("participated");
        $query = "SELECT experiment_id, \n\t\t\t\t\tcount(*) as num_participated \n\t\t\t\t\tFROM " . table('participate_at') . "  \n\t\t\t\t\tWHERE " . $participated_clause . " \n\t\t\t\t\tAND experiment_id IN (" . implode(',', $eids) . ")\n\t\t\t\t\tGROUP BY experiment_id";
        $result = or_query($query);
        while ($line = pdo_fetch_assoc($result)) {
            $experiments[$line['experiment_id']]['num_participated'] = $line['num_participated'];
        }
        //
        if ($finished == 'y') {
            $noshow_clause = expregister__get_pstatus_query_snippet("noshow");
            // get showup counts at session level
            // couldn't get much better performance if separating counts
            $query = "SELECT " . table('participate_at') . ".experiment_id, \n\t\t\t\t\t\tcount(*) as comp_num_registered,\n\t\t\t\t\t\tsum(if(" . $noshow_clause . ",1,0)) as comp_num_noshow  \n\t\t\t\t\t\tFROM " . table('participate_at') . ", " . table('sessions') . " \n\t\t\t\t\t\tWHERE " . table('participate_at') . ".session_id=" . table('sessions') . ".session_id \n\t\t\t\t\t\tAND (" . table('sessions') . ".session_status='completed' OR " . table('sessions') . ".session_status='balanced') \n\t\t\t\t\t\tAND " . table('participate_at') . ".experiment_id IN (" . implode(',', $eids) . ")\n\t\t\t\t\t\tGROUP BY " . table('participate_at') . ".experiment_id";
            $result = or_query($query);
            while ($line = pdo_fetch_assoc($result)) {
                $experiments[$line['experiment_id']]['comp_num_registered'] = $line['comp_num_registered'];
                $experiments[$line['experiment_id']]['comp_num_noshow'] = $line['comp_num_noshow'];
            }
        }
        if (count($sids) > 0) {
            $query = "SELECT experiment_id, session_id, \n\t\t\t\t\t\tcount(*) as num_registered \n\t\t\t\t\t\tFROM " . table('participate_at') . " \n\t\t\t\t\t\tWHERE session_id IN (" . implode(',', $sids) . ")\n\t\t\t\t\t\tGROUP BY experiment_id, session_id";
            $result = or_query($query);
            while ($line = pdo_fetch_assoc($result)) {
                $experiments[$line['experiment_id']]['sessions'][$line['session_id']]['num_registered'] = $line['num_registered'];
            }
        }
    }
    echo '
 		
 		<center>
		<BR>
		<table class="or_panel">';
    if ($show_filter) {
        echo '<TR><TD colspan=2>
					<FORM action="' . thisdoc() . '"><TABLE border=0><TR><TD>' . lang('restrict_list_to_experiments_of_class') . '</TD><TD>';
        echo experiment__experiment_class_select_field('class_search', $class_arr, true, array('cols' => 30, 'picker_maxnumcols' => 3));
        echo '	</TD><TD rowspan=2 valign=middle>
					<INPUT class="button" style="font-size: 8pt; margin: 0;" type=submit name="show" value="' . lang('show') . '">
					</TD></TR><TR><TD>' . lang('restrict_list_to_experimenters') . '</TD><TD>';
        echo experiment__experimenters_select_field("experimenter_search", $experimenter_arr, true, array('cols' => 30, 'tag_color' => '#f1c06f', 'picker_color' => '#c58720', 'picker_maxnumcols' => 3));
        echo '	</TD></TR></TABLE></FORM>
			</TD></TR>';
    }
    echo '
		<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'] . '">';
    if ($finished == "y") {
        echo lang('finished_experiments');
    } elseif ($experimenter) {
        echo lang('my_experiments');
    } else {
        echo lang('experiments');
    }
    echo '</TD><TD style="background: ' . $color['panel_title_background'] . '; color: ' . $color['panel_title_textcolor'] . '">';
    if ($addbutton && check_allow('experiment_edit')) {
        echo button_link("experiment_edit.php?addit=true", lang('register_new_experiment'), 'plus-circle');
    }
    if (!$experimenter) {
        if ($finished == "n") {
            echo button_link("experiment_old.php", lang('finished_experiments'), 'fast-backward');
        } else {
            echo button_link("experiment_main.php", lang('current_experiments'), 'fast-forward');
        }
    }
    echo '</TD></TR>
			</TABLE>
		</TD></TR>
		<TR><TD colspan=2>';
    echo count($experiments) . ' ';
    if ($finished == "n") {
        echo lang('xxx_current_experiments');
    } else {
        echo lang('xxx_finished_experiments');
    }
    echo '
		</TD></TR>
		<TR><TD width="5%">&nbsp;&nbsp;&nbsp;</TD>
		<TD width="95%" colspan=2>

			<TABLE border=0 width="100%" cellspacing="0">';
    foreach ($experiments as $id => $exp) {
        if ($finished == "n") {
            experiment__experiments_format_alist($exp);
        } else {
            experiment__old_experiments_format_alist($exp);
        }
    }
    echo '</TABLE>
		</TD></TR>
		</TABLE>
		</center>
		<BR><BR>
		';
}
Exemplo n.º 5
0
						<TD style="background: ' . $color['panel_title_background'] . '; color: ' . $color['panel_title_textcolor'] . '">
							' . lang('do_you_agree_rules_privacy') . '
						</TD>
						</TR></TABLE>
					</TD></TR>
						<TR><TD align=center>
							<INPUT class="button" type="submit" name="accept_rules" value="' . lang('yes') . '">&nbsp;&nbsp;&nbsp;
							<INPUT class="button" type="submit" name="notaccept_rules" value="' . lang('no') . '">
						</TD></TR>
					</TABLE>
					</FORM>
					</center>';
            }
        } else {
            $_SESSION['rules'] = true;
            redirect("public/" . thisdoc());
        }
        $proceed = false;
    }
}
if ($proceed) {
    echo '<center>';
    $form = true;
    $errors__dataform = array();
    if (isset($_REQUEST['add'])) {
        $continue = true;
        if (!isset($_REQUEST['captcha']) || !isset($_SESSION['captcha_string']) || $_REQUEST['captcha'] != $_SESSION['captcha_string']) {
            if (!isset($_REQUEST['subscriptions']) || !is_array($_REQUEST['subscriptions'])) {
                $_REQUEST['subscriptions'] = array();
            }
            $_REQUEST['subscriptions'] = id_array_to_db_string($_REQUEST['subscriptions']);
Exemplo n.º 6
0
function html__build_menu($menu, $logged_in, $current_user_data_box, $orientation = "vertical")
{
    global $settings__root_url, $color, $lang, $menu__area, $settings;
    $addp = "";
    $ignore_p = array('participant_create.php', 'participant_confirm.php', 'participant_forgot.php');
    if (in_array($settings['subject_authentication'], array('token', 'migration'))) {
        if (isset($_REQUEST['p']) && !in_array(thisdoc(), $ignore_p)) {
            $addp = "?p=" . urlencode($_REQUEST['p']);
        }
    }
    $list = '';
    $final_menu = array();
    foreach ($menu as $item) {
        $continue = true;
        if ($continue && $item['entrytype'] != 'space') {
            $continue = false;
            if ($item['show_if_not_logged_in'] && !$logged_in) {
                $continue = true;
            }
            if ($item['show_if_logged_in'] && $logged_in) {
                $continue = true;
            }
        }
        if ($continue && $item['entrytype'] != 'space') {
            if ($item['menu_area'] == 'calendar' && $settings['show_public_calendar'] != 'y') {
                $continue = false;
            } elseif ($item['menu_area'] == 'rules' && $settings['show_public_rules_page'] != 'y') {
                $continue = false;
            } elseif ($item['menu_area'] == 'privacy' && $settings['show_public_privacy_policy'] != 'y') {
                $continue = false;
            } elseif ($item['menu_area'] == 'faqs' && $settings['show_public_faqs'] != 'y') {
                $continue = false;
            } elseif ($item['menu_area'] == 'impressum' && $settings['show_public_legal_notice'] != 'y') {
                $continue = false;
            } elseif ($item['menu_area'] == 'contact' && $settings['show_public_contact'] != 'y') {
                $continue = false;
            }
        }
        if ($continue) {
            if ($item['entrytype'] == 'space') {
                $item['entrytype'] = 'head';
                $item['menu_area'] = '';
                $item['content'] = '';
                $item['bg'] = '';
            } elseif ($item['menu_area'] == 'current_user_data_box') {
                $item['entrytype'] = 'head';
                $item['content'] = '<FONT class="menu_title" color="' . $color['menu_title'] . '">' . $current_user_data_box . '</FONT>';
                $item['bg'] = '';
            } else {
                if (preg_match("/^" . $item['menu_area'] . "/i", $menu__area)) {
                    $item['bg'] = ' bgcolor="' . $color['menu_item_highlighted_background'] . '"';
                } else {
                    $item['bg'] = "";
                }
                if (!isset($item['link'])) {
                    $link = '';
                } elseif (substr($item['link'], 0, 1) == '/') {
                    $link = $settings__root_url . $item['link'] . $addp;
                } else {
                    $link = $item['link'];
                }
                if ($item['entrytype'] == 'link') {
                    $item['content'] = '<A HREF="' . $link . '" class="menu_item"><FONT color="' . $color['menu_item'] . '">';
                } elseif ($item['entrytype'] == 'headlink') {
                    $item['content'] = '<A HREF="' . $link . '" class="menu_title"><FONT color="' . $color['menu_title'] . '">';
                } elseif ($item['entrytype'] == 'head') {
                    $item['content'] = '<FONT class="menu_title" color="' . $color['menu_title'] . '">';
                }
                $item['content'] .= lang($item['lang_item']);
                if ($item['entrytype'] == 'link') {
                    $item['content'] .= '</FONT></A>';
                } elseif ($item['entrytype'] == 'headlink') {
                    $item['content'] .= '</FONT></A>';
                } elseif ($item['entrytype'] == 'head') {
                    $item['content'] .= '</FONT>';
                }
                if ($item['entrytype'] != 'link') {
                    $item['entrytype'] = 'head';
                }
            }
        }
        if ($continue) {
            $final_menu[] = $item;
        }
    }
    if ($orientation == "vertical") {
        $list .= '<TABLE border=0>';
        foreach ($final_menu as $item) {
            if (!isset($item['link'])) {
                $link = '';
            } elseif (substr($item['link'], 0, 1) == '/') {
                $link = $settings__root_url . $item['link'] . $addp;
            } else {
                $link = $item['link'];
            }
            if ($item['entrytype'] == 'head') {
                $list .= '<tr><td colspan="3">&nbsp;</td></tr>';
            }
            $list .= '<TR>';
            if ($item['entrytype'] != 'head') {
                $list .= '<TD>&nbsp;</TD>';
            }
            if (isset($item['icon']) && $item['icon']) {
                $list .= '<TD ' . $item['bg'] . '>' . micon($item['icon'], $link) . '</TD>';
            } else {
                $list .= '<TD></TD>';
            }
            $list .= '<TD ' . $item['bg'];
            if ($item['entrytype'] == 'head') {
                $list .= ' colspan="2"';
            }
            $list .= '>' . $item['content'] . '</TD></TR>';
        }
        $list .= '</TABLE>';
    } else {
        $user_data_box = '';
        $list1 = '';
        $list2 = '';
        $head_up = false;
        foreach ($final_menu as $item) {
            if (!isset($item['link'])) {
                $link = '';
            } elseif (substr($item['link'], 0, 1) == '/') {
                $link = $settings__root_url . $item['link'] . $addp;
            } else {
                $link = $item['link'];
            }
            if ($item['menu_area'] == 'current_user_data_box') {
                //				if ($head_up) $list2.='<TD colspan=2></TD>';
                //				$head_up=false;
                //				$list1.='<TD rowspan="2">'.$item['content'].'</TD>';
                $user_data_box = str_replace('<BR>', '&nbsp;&nbsp;', $item['content']);
            } elseif ($item['entrytype'] == 'head') {
                if ($head_up) {
                    $list2 .= '<TD colspan=2></TD>';
                }
                $list1 .= '<TD>&nbsp;&nbsp;&nbsp;</TD>';
                $list2 .= '<TD>&nbsp;&nbsp;&nbsp;</TD>';
                if (isset($item['icon']) && $item['icon']) {
                    $list1 .= '<TD ' . $item['bg'] . '>' . micon($item['icon'], $link) . '</TD>';
                } else {
                    $list1 .= '<TD></TD>';
                }
                $list1 .= '<TD ' . $item['bg'] . '>' . $item['content'] . '</TD>';
                $head_up = true;
            } else {
                if (!$head_up) {
                    $list1 .= '<TD colspan=2></TD>';
                }
                if (isset($item['icon']) && $item['icon']) {
                    $list2 .= '<TD ' . $item['bg'] . '>' . micon($item['icon'], $link) . '</TD>';
                } else {
                    $list2 .= '<TD></TD>';
                }
                $list2 .= '<TD ' . $item['bg'] . '>' . $item['content'] . '</TD>';
                $head_up = false;
            }
        }
        $list .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $user_data_box . '<BR>';
        $list .= '<TABLE border=0>';
        $list .= '<TR>' . $list1 . '</TR><TR>' . $list2 . '</TR>';
        $list .= '</TABLE>';
    }
    return $list;
}
    if (isset($_REQUEST['delete_redundant']) && $_REQUEST['delete_redundant']) {
        $pars = array();
        foreach ($redundant as $r) {
            $pars[] = array(':mysql_column_name' => $r);
        }
        $query = "DELETE FROM " . table('profile_fields') . " WHERE mysql_column_name = :mysql_column_name";
        $done = or_query($query, $pars);
        message(lang('redundant_configurations_deleted'));
        redirect('admin/' . thisdoc());
    }
}
if ($proceed) {
    echo '<center>';
    if (count($redundant) > 0) {
        $m = lang('pfields_redundant_configurations_message') . '<BR><B>' . implode(", ", $redundant) . '</B>';
        $m .= '<BR><FORM action="' . thisdoc() . '" method="POST">
                <INPUT class="button" type="submit" name="delete_redundant" value="' . lang('yes') . '">
                </FORM>
            </p>';
        show_message($m);
        echo '<BR><BR>';
    }
    echo '<TABLE class="or_listtable" style="width: 80%;"><thead>';
    echo '<TR style="background: ' . $color['list_header_background'] . '; color: ' . $color['list_header_textcolor'] . ';">';
    echo '<TD>' . lang('mysql_column_name') . '</TD>';
    echo '<TD>' . lang('mysql_column_type') . '</TD>';
    echo '<TD>' . lang('mysql_column_is_indexed') . '</TD>';
    echo '<TD>' . lang('orsee_is_configured') . '</TD>';
    echo '<TD>' . lang('enabled?') . '</TD>';
    echo '<TD>' . lang('profile_field_type') . '</TD>';
    echo '<TD></TD>';
Exemplo n.º 8
0
        echo '
			<TD>
						' . button_link('lang_lang_add.php', lang('add_language'), 'plus') . '
                        </TD>';
    }
    if (check_allow('lang_lang_delete')) {
        echo '
			<TD>
					' . button_link('lang_lang_delete.php', lang('delete_language'), 'times') . '
                        </TD>';
    }
    echo '		</TR>
		</TABLE><BR><BR>
		';
    // show languages
    echo '<FORM action="' . thisdoc() . '">';
    echo '<TABLE class="or_listtable" style="width: 80%;"><thead>
			<TR style="background: ' . $color['list_header_background'] . '; color: ' . $color['list_header_textcolor'] . ';">
				<TD colspan=2>' . lang('installed_languages') . '</TD>
				<TD>' . lang('available_in_public_area') . '</TD>
				<TD>' . lang('available_for_participants') . '</TD>
				<TD></TD>
				<TD></TD>
			</TR></thead>
			<tbody>';
    $shade = false;
    foreach ($languages as $language) {
        echo '<TR';
        if ($shade) {
            echo ' bgcolor="' . $color['list_shade1'] . '"';
            $shade = false;
             echo '<BR>' . lang('found_active_permanent_query');
         }
     }
     echo '</TD></TR></TABLE>';
     echo '<BR><BR>';
     $query_array = query__get_query_array($posted_query['query']);
     $active_clause = array('query' => participant_status__get_pquery_snippet("eligible_for_experiments"), 'pars' => array());
     $exptype_clause = array('query' => "subscriptions LIKE (:experiment_ext_type)", 'pars' => array(':experiment_ext_type' => "%|" . $experiment['experiment_ext_type'] . "|%"));
     $notyetassigned_clause = array('query' => "participant_id NOT IN (SELECT participant_id FROM " . table('participate_at') . " WHERE experiment_id= :experiment_id)", 'pars' => array(':experiment_id' => $experiment_id));
     $additional_clauses = array($active_clause, $exptype_clause, $notyetassigned_clause);
     $query = query__get_query($query_array, $query_id, $additional_clauses, $sort);
     //echo '<TABLE width="70%" border=0><TR><TD><B>Query:</B></TD></TR><TR><TD>';
     //echo $query['query'];
     //echo '</TD></TR></TABLE>';
     //dump_array($query['pars'],"Parameters");
     echo '<FORM name="part_list" method="POST" action="' . thisdoc() . '">
             <INPUT type=hidden name=experiment_id value="' . $experiment_id . '">';
     // show list of results
     $assign_ids = query_show_query_result($query, "assign");
     $_SESSION['assign_ids_' . $experiment_id] = $assign_ids;
     echo '</FORM>';
 } else {
     if (!isset($_SESSION['lastquery_assign_' . $experiment_id])) {
         $_SESSION['lastquery_assign_' . $experiment_id] = '';
     }
     $load_query = $_SESSION['lastquery_assign_' . $experiment_id];
     if (!$load_query) {
         $load_query = query__load_default_query('assign', $experiment_id);
     }
     $hide_modules = array('statusids');
     $status_query = participant_status__get_pquery_snippet("eligible_for_experiments");
Exemplo n.º 10
0
                 </TR>';
     }
 }
 if ($settings['allow_permanent_queries'] == 'y') {
     $perm_queries = query__get_permanent($experiment_id);
     if (count($perm_queries) > 0) {
         $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
         echo '<TR><TD colspan=3><B>' . lang('found_active_permanent_query') . '</B></TD></TR>';
         echo '<TR><TD colspan=3><TABLE width="100%" border="0">';
         foreach ($perm_queries as $pquery) {
             $posted_query = $json->decode($pquery['json_query']);
             $pseudo_query_array = query__get_pseudo_query_array($posted_query['query']);
             $pseudo_query_display = query__display_pseudo_query($pseudo_query_array, false);
             echo '<TR><TD>' . $pseudo_query_display . '</TD><TD>';
             if (check_allow('experiment_assign_query_permanent_deactivate')) {
                 echo button_link(thisdoc() . '?experiment_id=' . $experiment_id . '&permanent_deactivate=true', lang('deactivate_permanent_query'), 'toggle-off');
             }
             echo '</TD></TR>';
         }
         '</TABLE></TD></TR>';
     }
 }
 echo '          <TR><TD colspan=3>
         <TABLE class="or_option_buttons_box" style="background: ' . $color['options_box_background'] . ';">';
 $buttons = array();
 if (check_allow('experiment_assign_participants')) {
     $buttons[] = button_link('experiment_add_participants.php?experiment_id=' . $experiment['experiment_id'], lang('assign_subjects'), 'plus-square');
     $buttons[] = button_link('experiment_drop_participants.php?experiment_id=' . $experiment['experiment_id'], lang('delete_assigned_subjects'));
 }
 if (check_allow('experiment_invitation_edit')) {
     $buttons[] = button_link('experiment_mail_participants.php?experiment_id=' . $experiment['experiment_id'], lang('send_invitations'), 'envelope');
Exemplo n.º 11
0
        $type = $_REQUEST['type'];
    } else {
        redirect('admin/options_main.php');
    }
}
if ($proceed) {
    if (isset($_REQUEST['search_submit'])) {
        $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
        if (isset($_REQUEST['form'])) {
            $posted_query = $_REQUEST['form'];
        } else {
            $posted_query = array('query' => array());
        }
        $posted_query_json = $json->encodeUnsafe($posted_query);
        $done = query__save_default_query($posted_query_json, 'default_' . $type);
        redirect('admin/' . thisdoc() . '?type=' . $type);
    }
}
if ($proceed) {
    $titles = array('assign' => 'default_search_for_assigning_participants_to_experiment', 'deassign' => 'default_search_for_deassigning_participants_from_experiment', 'participants_search_active' => 'default_search_for_active_participants', 'participants_search_all' => 'default_search_for_all_participants');
    echo '<center>';
    show_message();
    $load_query = query__load_default_query($type);
    if ($type == 'participants_search_active') {
        $hide_modules = array('statusids');
    } else {
        $hide_modules = array();
    }
    $formextra = '<INPUT type="hidden" name="type" value="' . $type . '">';
    echo '<TABLE class="or_formtable" style="min-width: 80%">
            <TR><TD>
Exemplo n.º 12
0
function participant__show_admin_form($edit, $button_title = "", $errors, $extra = "")
{
    global $lang, $settings, $color;
    $out = array();
    if (!isset($edit['participant_id'])) {
        $edit['participant_id'] = '';
    }
    if (!isset($edit['subpool_id'])) {
        $edit['subpool_id'] = 1;
    }
    $subpool = orsee_db_load_array("subpools", $edit['subpool_id'], "subpool_id");
    if (!$subpool['subpool_id']) {
        $subpool = orsee_db_load_array("subpools", 1, "subpool_id");
    }
    $edit['subpool_id'] = $subpool['subpool_id'];
    $pools = subpools__get_subpools();
    foreach ($pools as $p => $pool) {
        $out['is_subjectpool_' . $p] = false;
    }
    $out['is_subjectpool_' . $subpool['subpool_id']] = true;
    echo '<FORM action="' . thisdoc() . '" method="POST">';
    echo '<table border="0">';
    echo '<TR><TD valign="top">';
    echo '<TABLE class="or_formtable" style="width: 100%; height: 100%; max-width: 100%"><TR><TD>';
    // get the participant form
    participant__show_inner_form($edit, $errors, true);
    echo '</TD></TR></TABLE>';
    echo '</TD><TD valign="top">';
    echo '<TABLE class="or_formtable" style="width: 100%; height: 100%; max-width: 100%; background: ' . $color['list_shade2'] . '"><TR><TD>';
    echo '<INPUT type="hidden" name="participant_id" value="' . $edit['participant_id'] . '">';
    global $hide_header;
    if (isset($hide_header) && $hide_header) {
        echo '<INPUT type="hidden" name="hide_header" value="true">';
    }
    $adminformoutput = participant__get_inner_admin_form($edit, $errors);
    if ($adminformoutput) {
        echo '<TABLE width="100%">
                <TR><TD valign="top" bgcolor="' . $color['list_shade1'] . '">';
        echo $adminformoutput;
        echo '</TD></TR></TABLE>';
    }
    echo '<BR>';
    // then show the rest
    // initialize
    if (!isset($edit['participant_id'])) {
        $edit['participant_id'] = '???';
    }
    if (!isset($edit['participant_id_crypt'])) {
        $edit['participant_id_crypt'] = '???';
    }
    if (isset($edit['creation_time'])) {
        $tout['creation_time'] = ortime__format($edit['creation_time'], '', lang('lang'));
    } else {
        $tout['creation_time'] = '';
    }
    if (!isset($edit['rules_signed'])) {
        $edit['rules_signed'] = '';
    }
    if (!isset($edit['session_id'])) {
        $edit['session_id'] = '';
    }
    if (!isset($edit['remarks'])) {
        $edit['remarks'] = '';
    }
    echo '<table width="100%">';
    echo '  <tr><td>' . lang('subpool') . '</td>
            <td>' . subpools__select_field("subpool_id", $edit['subpool_id']) . '</td></tr>';
    echo '<tr><td colspan=2>&nbsp;</td></tr>';
    echo '  <tr><td>' . lang('id') . '</td>
            <td>' . $edit['participant_id'] . ' (' . $edit['participant_id_crypt'] . ')</td></tr>
        <tr><td>' . lang('creation_time') . '</td>
            <td>';
    if (isset($edit['creation_time'])) {
        echo ortime__format($edit['creation_time'], '', lang('lang'));
    } else {
        echo '???';
    }
    echo '  </td></tr>';
    if ($settings['enable_rules_signed_tracking'] == 'y') {
        echo '<tr><td>' . lang('rules_signed') . '</td>
            <td>' . participant__rules_signed_form_field($edit['rules_signed']) . '</td></tr>';
    }
    echo '<tr><td valign="top">' . lang('remarks') . '</td>
            <td>' . participant__remarks_form_field($edit['remarks']) . '</td></tr>';
    echo '<tr><td colspan=2>&nbsp;</td></tr>';
    echo '<tr><td colspan=2 align=left>
                ' . participant__add_to_session_checkbox() . ' ' . lang('register_sub_for_session') . '<BR>
                ' . participant__add_to_session_select($edit['session_id'], $edit['participant_id']) . '
            </td></tr>';
    echo '</td></tr></table>';
    echo '</TD></TR><TR><TD valign="bottom"  bgcolor="' . $color['list_shade2'] . '">';
    echo '<table>
            <tr style="outline: 2px solid red;">
            <td>
                <B>' . lang('participant_status') . '</B>: ';
    if (check_allow('participants_change_status')) {
        if (!isset($_REQUEST['status_id'])) {
            $_REQUEST['status_id'] = "";
        }
        if ($_REQUEST['status_id'] == '0') {
            $hide = array();
        } else {
            $hide = array('0');
        }
        echo '<INPUT type="hidden" name="old_status_id" value="' . $_REQUEST['status_id'] . '">' . participant_status__select_field('status_id', $_REQUEST['status_id'], $hide);
    } elseif (!$edit['participant_id']) {
        $default_status = participant_status__get("is_default_active");
        $statuses = participant_status__get_statuses();
        echo '<INPUT type="hidden" name="status_id" value="' . $default_status . '">' . $statuses[$default_status]['name'];
    } else {
        echo participant_status__get_name($_REQUEST['status_id']);
    }
    echo '</td></tr></table>';
    echo '</td></tr></table>';
    echo '</td></tr>';
    if (!$button_title) {
        $button_title = lang('change');
    }
    echo '<tr><td colspan="2" align="center">
            <INPUT class="button" name="add" type="submit" value="' . $button_title . '">
            </td></tr>';
    echo '</table></form>';
}
Exemplo n.º 13
0
<?php

// part of orsee. see orsee.org
if ($proceed) {
    echo '
            <br><BR><BR>
            <center>';
    if (!preg_match("(admin_login|admin_logout|index.php)", thisdoc())) {
        echo '
                ' . icon('home', 'index.php') . '<A href="index.php">' . lang('mainpage') . '</a>
                <BR><BR>
                ';
    }
    if (!preg_match("(admin_login|admin_logout)", thisdoc())) {
        echo '<A href="admin_logout.php">' . icon('logout') . '<FONT COLOR=RED>' . lang('logout') . '</FONT></A>';
    }
    echo '<BR><BR></center>';
    debug_output();
    html__show_style_footer('admin');
    html__footer();
}
Exemplo n.º 14
0
function headcell($value, $sort = "", $focus = "")
{
    global $color;
    if (!isset($_REQUEST['focus'])) {
        $_REQUEST['focus'] = "";
    }
    if (!isset($_REQUEST['experiment_id'])) {
        $_REQUEST['experiment_id'] = "";
    }
    if (!isset($_REQUEST['session_id'])) {
        $_REQUEST['session_id'] = "";
    }
    echo '
        <TD class=small';
    if ($_REQUEST['focus'] == $focus && $focus) {
        echo ' style="background: ' . $color['list_header_highlighted_background'] . '; color: ' . $color['list_header_highlighted_textcolor'] . ';"';
    }
    echo '>';
    if ($sort) {
        echo '<A HREF="' . thisdoc() . '?sort=' . urlencode($sort) . '&show=true';
        if ($_REQUEST['experiment_id']) {
            echo '&experiment_id=' . $_REQUEST['experiment_id'];
        }
        if ($_REQUEST['session_id']) {
            echo '&session_id=' . $_REQUEST['session_id'];
        }
        if ($_REQUEST['focus']) {
            echo '&focus=' . $_REQUEST['focus'];
        }
        echo '">';
    }
    echo '<FONT class="small"';
    if ($_REQUEST['focus'] == $focus && $focus) {
        echo ' color="' . $color['list_header_highlighted_textcolor'] . '"';
    }
    echo '>';
    echo $value;
    echo '</FONT>';
    if ($sort) {
        echo '</A>';
    }
    echo '</TD>';
}
Exemplo n.º 15
0
                        $thispar = array(':participant_id' => $pid, ':pending_profile_update_request' => $_REQUEST['new_profile_update_status'], ':profile_update_request_new_pool' => $new_pool);
                        $pars[] = $thispar;
                        $target = "participant_id: " . $pid . ", update_request: " . $_REQUEST['new_profile_update_status'];
                        if ($new_pool) {
                            $target .= ", new_pool: " . $new_pool;
                        }
                        log__admin("bulk_set_profile_update_request", $target);
                    }
                    $query = "UPDATE " . table('participants') . "\n                            SET pending_profile_update_request= :pending_profile_update_request,\n                                profile_update_request_new_pool = :profile_update_request_new_pool\n                                WHERE participant_id = :participant_id";
                    $done = or_query($query, $pars);
                    message($num_participants . ' ' . lang('xxx_participants_were_assigned_a_new_profile_update_status'));
                    redirect('admin/' . thisdoc() . '?active=' . $active . '&search_sort=' . $search_sort);
                }
            } else {
                // redirect to same page
                redirect('admin/' . thisdoc() . '?active=' . $active . '&search_sort=' . $search_sort);
            }
        } else {
            message(lang('no_participants_selected'));
            $_REQUEST['search_sort'] = $search_sort;
        }
    }
}
if ($proceed) {
    echo '<center>';
    show_message();
}
if ($proceed) {
    if (isset($_REQUEST['search_submit']) || isset($_REQUEST['search_sort'])) {
        $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
        if (isset($_REQUEST['search_sort'])) {
			<TR><TD align="center">
			' . $experiment['experiment_name'];
    if ($session_id) {
        echo ', ' . lang('session') . ' ' . session__build_name($session);
    }
    echo ', ' . $title . '		
			</TD>';
    echo '</TR></TABLE>';
    if ($display != 'enrol') {
        echo '<P align=right><A class="small" HREF="experiment_participants_show_pdf.php' . $thiscgis . '" target="_blank">' . lang('print_version') . '</A></P>';
    }
    // show query
    //echo '	<P class="small">Query: '.$query.'</P>';
    // form
    echo '
		<FORM name="part_list" method=post action="' . thisdoc() . '">
	
		<BR>
		<table class="or_listtable" style="width: 95%"><thead>
			<TR style="background: ' . $color['list_header_background'] . '; color: ' . $color['list_header_textcolor'] . ';">';
    echo participant__get_result_table_headcells($cols);
    echo '		</TR></thead>
				<tbody>';
    $shade = false;
    if (check_allow('experiment_edit_participants')) {
        $disabled = false;
    } else {
        $disabled = true;
    }
    $pnr = 0;
    foreach ($participants as $p) {
Exemplo n.º 17
0
        if (in_array($_REQUEST['language'], $langarray)) {
            $_SESSION['pauthdata']['language'] = $_REQUEST['language'];
        }
    }
    $lang = load_language($_SESSION['pauthdata']['language']);
}
if ($proceed) {
    if (!in_array(thisdoc(), array('participant_create.php', 'captcha.php'))) {
        unset($_SESSION['subpool_id']);
        unset($_SESSION['rules']);
    }
}
if ($proceed) {
    // require participant login for the following pages
    $part_load = array("participant_edit.php", "participant_delete.php", "participant_show.php", "participant_show_mob.php", "participant_change_pw.php", "participant_logout.php");
    if (in_array(thisdoc(), $part_load)) {
        $token_string = '';
        // if already logged in, just load participant data
        if (isset($_SESSION['pauthdata']['user_logged_in']) && $_SESSION['pauthdata']['user_logged_in'] && isset($_SESSION['pauthdata']['participant_id']) && $_SESSION['pauthdata']['participant_id']) {
            $participant = orsee_db_load_array("participants", $_SESSION['pauthdata']['participant_id'], "participant_id");
            $participant_id = $participant['participant_id'];
        } else {
            if ($settings['subject_authentication'] == 'token') {
                // if we work with tokens, check whether we are logged in and load participant data
                if ($participant_id) {
                    $participant = orsee_db_load_array("participants", $participant_id, "participant_id");
                    $token_string = "?p=" . urlencode($participant['participant_id_crypt']);
                } else {
                    redirect("public/");
                }
            } elseif ($settings['subject_authentication'] == 'migration') {
Exemplo n.º 18
0
<?php

// part of orsee. see orsee.org
$debug__script_started = microtime();
include "../config/settings.php";
include "../config/system.php";
include "../config/requires.php";
$proceed = true;
if ($proceed) {
    $document = thisdoc();
    if ($settings__stop_admin_site == "y" && $document != "error_temporaly_disabled.php") {
        redirect("errors/error_temporaly_disabled.php");
    }
}
if ($proceed) {
    site__database_config();
    $settings = load_settings();
    $settings['style'] = $settings['orsee_admin_style'];
    $color = load_colors();
    session_set_save_handler("orsee_session_open", "orsee_session_close", "orsee_session_read", "orsee_session_write", "orsee_session_destroy", "orsee_session_gc");
    session_start();
    if (isset($_SESSION['expadmindata'])) {
        $expadmindata = $_SESSION['expadmindata'];
    } else {
        $expadmindata = array();
    }
    // Check for login
    if (!(isset($expadmindata['adminname']) && $expadmindata['adminname']) && $document != "admin_login.php") {
        redirect("admin/admin_login.php");
        $proceed = false;
    }
    if (!check_allow('experiment_restriction_override')) {
        check_experiment_allowed($experiment, "admin/experiment_show.php?experiment_id=" . $experiment_id);
    }
}
if ($proceed) {
    $alllangs = get_languages();
    if (isset($_REQUEST['replang']) && in_array($_REQUEST['replang'], $alllangs) && $_REQUEST['replang'] != lang('lang')) {
        $replang = $_REQUEST['replang'];
    } else {
        $replang = lang('lang');
    }
    $lang_names = lang__get_language_names();
    $switchlang_text = '';
    foreach ($alllangs as $thislang) {
        if ($thislang != $replang) {
            $switchlang_text .= '<A HREF="' . thisdoc() . '?experiment_id=' . $experiment_id . '&replang=' . $thislang . '"><span class="languageicon langicon-' . $thislang . '">';
            if (isset($lang_names[$thislang]) && $lang_names[$thislang]) {
                $switchlang_text .= $lang_names[$thislang];
            } else {
                $switchlang_text .= $thislang;
            }
            $switchlang_text .= '</span></A>&nbsp;&nbsp;&nbsp;';
        }
    }
    if ($switchlang_text) {
        $switchlang_text = '<P align="right">' . lang('this_report_in_language') . ' ' . $switchlang_text . '</P>';
    }
    if ($replang != lang('lang')) {
        $switched_lang = true;
        $mylang = $lang;
        $lang = load_language($_REQUEST['replang']);
Exemplo n.º 20
0
    $_SESSION['stats_data'] = $stats_data;
    echo '<center>';
    if ($browsable) {
        echo '<FORM action="' . thisdoc() . '" METHOD="POST">';
        echo '<INPUT type="hidden" name="all" value="' . urlencode($all) . '">';
    }
    echo '<TABLE border=0 cellspacing="0" width="100%">';
    echo '<TR><TD align="center">';
    echo '<TABLE class="or_page_subtitle" style="background: ' . $color['page_subtitle_background'] . '; color: ' . $color['page_subtitle_textcolor'] . '"><TR><TD>
			' . lang('subject_pool_statistics') . ' ' . $title_add . '
			</TD>';
    echo '<TD>';
    if ($all) {
        echo '<P align="right">' . button_link(thisdoc(), lang('stats_show_for_active'), 'dot-circle-o') . '</p>';
    } else {
        echo '<P align="right">' . button_link(thisdoc() . '?all=true', lang('stats_show_for_all'), 'circle-o') . '</p>';
    }
    echo '</TD>';
    echo '</TR></TABLE>';
    echo '  </TD></TR>';
    if ($browsable) {
        echo '<TR><TD align="center"><BR><INPUT class="button" type="submit" name="filter" value="' . lang('apply_filter') . '"><BR></TD></TR>';
    }
    foreach ($stats_data as $k => $table) {
        if (isset($table['data']) && is_array($table['data']) && count($table['data']) > 0) {
            $show = true;
        } else {
            $show = false;
        }
        if ($show) {
            $out = stats__stats_display_table($table, $browsable, $restrict);
Exemplo n.º 21
0
            $done = or_query($query, $pars);
            $done = experimentmail__send_bulk_mail_to_queue($bulk_id, $plist_ids);
            message($number . ' ' . lang('xxx_bulk_mails_sent_to_mail_queue'));
            log__admin("bulk_mail", "recipients:" . $number);
            redirect('admin/');
        }
    }
}
if ($proceed) {
    echo '<center>
			<TABLE class="or_page_subtitle" style="background: ' . $color['page_subtitle_background'] . '; color: ' . $color['page_subtitle_textcolor'] . '; width: 80%">
				<TR><TD align="center">' . $number . ' ' . lang('recipients') . '</TD></TR></TABLE>
			';
    show_message();
    // form
    echo '<FORM action="' . thisdoc() . '" method="post">
		<TABLE class="or_formtable" style="width: 80%">';
    foreach ($inv_langs as $inv_lang) {
        if (count($inv_langs) > 1) {
            echo '<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'] . '">
							' . $inv_lang . ':
					</TD>
					</TR></TABLE>
				</TD></TR>';
        }
        if (!isset($_REQUEST[$inv_lang . '_subject'])) {
            $_REQUEST[$inv_lang . '_subject'] = "";
        }
        if (!isset($_REQUEST[$inv_lang . '_body'])) {
Exemplo n.º 22
0
function query__resulthead_assign($type = 'assign')
{
    echo '<TABLE border="0" width="95%">';
    echo '<TR><TD>';
    // assign/deassign
    echo '<TABLE border="0" style="outline: 1px solid black;"><TR>';
    if ($type == 'assign') {
        echo '<TD><INPUT class="button" type=submit name="addselected" value="' . lang('assign_only_marked_participants') . '"></TD>';
        echo '<TD><INPUT class="button" type=submit name="addall" value="' . lang('assign_all_participants_in_list') . '"></TD>';
    } else {
        echo '<TD><INPUT class="button" type=submit name="dropselected" value="' . lang('remove_only_marked_participants') . '"></TD>';
        echo '<TD><INPUT class="button" type=submit name="dropall" value="' . lang('remove_all_participants_in_list') . '"></TD>';
    }
    echo '</TR>';
    echo '</TABLE>';
    echo '</TD>';
    echo '<TD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>';
    // back to query form button
    $cgivars = array();
    if (isset($_REQUEST['active']) && $_REQUEST['active']) {
        $cgivars[] = 'active=true';
    }
    if (isset($_REQUEST['experiment_id']) && $_REQUEST['experiment_id']) {
        $cgivars[] = 'experiment_id=' . $_REQUEST['experiment_id'];
    }
    echo '<TD><A HREF="' . thisdoc();
    if (count($cgivars) > 0) {
        echo '?' . implode("&", $cgivars);
    }
    echo '" class="button fa-backward" style="font-size: 8pt">Back to query form</A>';
    echo '</TD>';
    echo '</TR></TABLE>';
}
Exemplo n.º 23
0
 $field_names = array();
 foreach ($pform_fields as $f) {
     $field_names[$f['mysql_column_name']] = lang($f['name_lang']);
 }
 // sanitize search_for
 $columns = array();
 if (isset($_REQUEST['search_for']) && is_array($_REQUEST['search_for'])) {
     foreach ($_REQUEST['search_for'] as $k => $v) {
         if (in_array($k, $fields)) {
             $columns[] = $k;
         }
     }
 }
 if (count($columns) == 0) {
     message(lang('no_data_columns_selected'));
     redirect('admin/' . thisdoc());
 } else {
     $query = "SELECT count(*) as num_matches, " . implode(', ', $columns) . "\n                    FROM " . table('participants') . "\n                    GROUP BY " . implode(', ', $columns) . "\n                    HAVING num_matches>1\n                    ORDER BY num_matches DESC";
     $result = or_query($query);
     $dupvals = array();
     while ($line = pdo_fetch_assoc($result)) {
         $dupvals[] = $line;
     }
     if (check_allow('participants_edit')) {
         echo javascript__edit_popup();
     }
     $part_statuses = participant_status__get_statuses();
     $cols = participant__get_result_table_columns('result_table_search_duplicates');
     echo '<TABLE class="or_listtable"><thead>';
     echo '<TR style="background: ' . $color['list_header_background'] . '; color: ' . $color['list_header_textcolor'] . ';">';
     echo '<TD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>';
Exemplo n.º 24
0
function email__list_emails($mode = 'inbox', $id = '', $rmode = 'assigned', $url_string = '', $show_refresh = true)
{
    global $color, $lang, $settings;
    if (substr($url_string, 0, 1) == '?') {
        $url_string = substr($url_string, 1);
    }
    $conditions = array();
    $pars = array();
    if ($mode == 'trash') {
        $conditions[] = ' flag_deleted=1 ';
    } else {
        $conditions[] = ' flag_deleted=0 ';
    }
    if ($mode == 'inbox') {
        $conditions[] = ' flag_processed=0 ';
    } elseif ($mode == 'mailbox') {
        $conditions[] = ' mailbox=:mailbox ';
        $pars[':mailbox'] = $id;
    } elseif ($mode == 'experiment') {
        $conditions[] = ' experiment_id=:experiment_id ';
        $pars[':experiment_id'] = $id;
    } elseif ($mode == 'session') {
        $conditions[] = ' session_id=:session_id ';
        $pars[':session_id'] = $id;
    } elseif ($mode == 'participant') {
        $conditions[] = ' participant_id=:participant_id ';
        $pars[':participant_id'] = $id;
    }
    if ($rmode == 'assigned') {
        global $expadmindata;
        $ass_clause = query__get_experimenter_or_clause(array($expadmindata['admin_id']), 'emails', 'assigned_to');
        $conditions[] = $ass_clause['clause'];
        foreach ($ass_clause['pars'] as $k => $v) {
            $pars[$k] = $v;
        }
    } elseif ($rmode == 'experiments') {
        global $expadmindata;
        $likelist = query__make_like_list($expadmindata['admin_id'], 'assigned_to');
        $conditions[] = " experiment_id IN (SELECT experiment_id as id\n                        FROM " . table('experiments') . " WHERE (" . $likelist['par_names'] . ") ) ";
        foreach ($likelist['pars'] as $k => $v) {
            $pars[$k] = $v;
        }
    }
    $query = "SELECT * FROM " . table('emails') . "\n            WHERE " . implode(" AND ", $conditions) . "\n            ORDER BY thread_time DESC, thread_id, if (thread_id=message_id,0,1), timestamp";
    $result = or_query($query, $pars);
    $emails = array();
    $experiment_ids = array();
    $session_ids = array();
    while ($email = pdo_fetch_assoc($result)) {
        $emails[] = $email;
        if ($mode != 'experiment' && $email['experiment_id']) {
            $experiment_ids[] = $email['experiment_id'];
        }
        if ($mode != 'session' && $email['session_id']) {
            $session_ids[] = $email['session_id'];
        }
    }
    $mailboxes = email__load_mailboxes();
    $shade = false;
    $related_experiments = experiment__load_experiments_for_ids($experiment_ids);
    $related_sessions = sessions__load_sessions_for_ids($session_ids);
    echo '<table style="max-width: 90%;">';
    if ($show_refresh) {
        echo '
         <tr><td align="right">
            ' . icon('refresh', thisdoc() . '?' . $url_string, 'fa-2x', 'color: green;', 'refresh list'), '
          </td></tr>';
    }
    echo '    <tr><td>
          <table class="or_listtable"><thead>
          <tr style="background: ' . $color['list_header_background'] . ';  color: ' . $color['list_header_textcolor'] . ';">';
    echo '<td>&nbsp;&nbsp;&nbsp;</td>';
    // is thread head
    echo '<td>' . lang('email_subject') . '</td>';
    // type: incoming, note, reply && subject
    echo '<td>' . lang('email_from') . '</td>';
    // from
    echo '<td>' . lang('date') . '</td>';
    // date
    echo '<td></td>';
    // read // assigned_to_read
    echo '<td></td>';
    // processed - check and background of row
    echo '<td></td>';
    // view email button
    echo '</tr>
            </thead><tbody>';
    $cols = 7;
    $shade = false;
    $style_unprocessed = ' style="font-weight: bold;"';
    foreach ($emails as $email) {
        $second_row = '';
        if ($email['thread_id'] == $email['message_id']) {
            if ($shade) {
                $shade = false;
            } else {
                $shade = true;
            }
            $second_row = "";
            // experiment or mailbox - not if experiment or session or mailbox
            if (!in_array($mode, array('experiment', 'session', 'mailbox'))) {
                if ($email['experiment_id']) {
                    if (isset($related_experiments[$email['experiment_id']])) {
                        $second_row .= $related_experiments[$email['experiment_id']]['experiment_name'];
                    }
                } elseif ($email['mailbox']) {
                    $second_row .= '<b>' . lang('email_mailbox') . ':</b> ' . $mailboxes[$email['mailbox']];
                }
            }
            // session - not if session or mailbox
            if (!in_array($mode, array('session', 'mailbox'))) {
                if ($email['session_id']) {
                    if ($second_row) {
                        $second_row .= ', ';
                    }
                    $second_row .= session__build_name($related_sessions[$email['session_id']]);
                }
            }
            // assigned to
            if ($settings['email_module_allow_assign_emails'] == 'y' && $email['assigned_to']) {
                if ($second_row) {
                    $second_row .= ', ';
                }
                $second_row .= experiment__list_experimenters($email['assigned_to'], false, true);
            }
        }
        echo '<tr';
        if ($shade) {
            echo ' bgcolor="' . $color['list_shade1'] . '"';
        } else {
            echo ' bgcolor="' . $color['list_shade2'] . '"';
        }
        if (!$email['flag_processed'] && $mode != 'inbox') {
            echo $style_unprocessed;
        }
        echo '>';
        // thread head and subject
        if ($email['message_id'] == $email['thread_id']) {
            echo '<TD colspan=2>';
        } else {
            echo '<TD></TD><TD>';
        }
        echo '<A name="' . $email['message_id'] . '"></A>';
        $linktext = '';
        if ($email['message_type'] == 'reply') {
            $linktext .= icon('reply', '', '', ' color: #666666;', 'reply');
        } elseif ($email['message_type'] == 'note') {
            $linktext .= icon('file-text-o', '', '', ' color: #666666;', 'internal note');
        } elseif ($email['message_type'] == 'incoming') {
            $linktext .= icon('envelope-square', '', '', ' color: #666666;', 'incoming');
        }
        $linktext .= '&nbsp;&nbsp;&nbsp;';
        if ($email['message_type'] == 'note') {
            $linktext .= lang('email_internal_note');
        } else {
            $linktext .= $email['subject'];
        }
        echo $linktext;
        if ($email['has_attachments']) {
            echo icon('paperclip');
        }
        echo '</TD>';
        // from
        echo '<td>';
        if ($email['message_type'] == 'reply') {
            echo experiment__list_experimenters($email['admin_id'], false, true) . ' &lt;' . $email['from_address'] . '&gt;';
        } elseif ($email['message_type'] == 'note') {
            echo experiment__list_experimenters($email['admin_id'], false, true);
        } else {
            if ($email['from_name']) {
                echo $email['from_name'] . ' &lt;' . $email['from_address'] . '&gt;';
            } else {
                echo $email['from_address'];
            }
        }
        if ($email['message_type'] == 'incoming' && $email['participant_id']) {
            echo icon('check-circle-o', '', '', ' font-size: 8pt; color: #666666;', 'checked');
        }
        echo '</td>';
        // date
        echo '<td>' . ortime__format($email['timestamp']) . '</td>';
        if ($email['thread_id'] == $email['message_id']) {
            // read // assigned_to_read
            echo '<td align=center valign=middle>';
            echo '<A HREF="' . thisdoc() . '?' . $url_string . '&switch_read=true&message_id=' . urlencode($email['message_id']) . '">';
            if ($email['flag_read']) {
                echo icon('circle-o', '', '', ' color: #666666;');
            } else {
                echo icon('dot-circle-o', '', '', ' color: #008000;');
            }
            echo '</A>';
            if ($settings['email_module_allow_assign_emails'] == 'y' && $email['assigned_to']) {
                echo '<A HREF="' . thisdoc() . '?' . $url_string . '&switch_assigned_to_read=true&message_id=' . urlencode($email['message_id']) . '">';
                if ($email['flag_assigned_to_read']) {
                    echo icon('circle-o', '', '', ' color: #666666;');
                } else {
                    echo icon('dot-circle-o', '', '', ' color: #000080;');
                }
                echo '</A>';
            }
            echo '</td>';
            // processed - check and background of row
            echo '<td>';
            if ($email['flag_processed']) {
                echo icon('check', '', '', ' color: #008000;');
            }
            echo '</td>';
            // view email button
            echo '<td valign="top"';
            if ($second_row) {
                echo ' rowspan="2"';
            }
            echo '>';
            echo javascript__email_popup_button_link($email['message_id']);
            echo '</td>';
        } else {
            echo '<td colspan="3"></td>';
        }
        echo '</tr>';
        if ($second_row) {
            echo '<tr';
            if ($shade) {
                echo ' bgcolor="' . $color['list_shade1'] . '"';
            } else {
                echo ' bgcolor="' . $color['list_shade2'] . '"';
            }
            if (!$email['flag_processed'] && $mode != 'inbox') {
                echo $style_unprocessed;
            }
            echo '>';
            echo '<TD></TD>';
            echo '<TD colspan="' . ($cols - 2) . '">';
            echo '<i>' . $second_row . '</i>';
            echo '</TD>';
            echo '</TR>';
        }
    }
    echo '</tbody></table>
            </td></tr>
            </table>';
}
Exemplo n.º 25
0
         }
         echo '</SELECT></TD></TR>';
         echo '<TR><TD colspan="2" align="center">
                 <INPUT type="submit" class="button" name="submit1" value="Next">
             </TD></TR>';
         echo '</TABLE>';
         echo '</FORM>';
     }
 }
 if ($continue) {
     $old_version = $_REQUEST['old_version'];
     $old_database = $_REQUEST['old_database'];
     /////////////////////////
     if ($old_version == "orsee2") {
         if (isset($_REQUEST['submit1'])) {
             echo '<FORM action="' . thisdoc() . '" method="POST">';
             echo '<INPUT type="hidden" name="old_version" value="' . $old_version . '">';
             echo '<INPUT type="hidden" name="old_database" value="' . $old_database . '">';
             echo '<TABLE class="or_formtable" style="max-width: 90%;">';
             echo '      <TR><TD colspan=2>Do you want to import
                         <UL><LI><B>all data</B> (admins, admin types, experiment types, faqs, language items, subpools, files, plus all what\'s listed below)</LI>
                             <LI>or only <B>participation data</B> (participants, experiments, sessions, participations, lab bookings, admin log, cron log, participant log)?</LI>
                         </UL>
                              </TD></TR>
                         <TD colspan=2 align="center"><SELECT name="import_type">
                         <OPTION value="all">all data</OPTION>
                         <OPTION value="participation">participation data</OPTION>
                         </SELECT></TD></TR>';
             echo '      <TR><TD colspan=2><hr></TD></TR>';
             $statuses = participant_status__get_statuses();
             echo '<TR><TD colspan=2>There are ' . count($statuses) . ' participant statuses defined in this system.<BR>
}
if ($proceed) {
    if (isset($_REQUEST['mysql_column_name'])) {
        $mysql_column_name = trim($_REQUEST['mysql_column_name']);
    } else {
        $mysql_column_name = '';
    }
    if (isset($_REQUEST['mysql_column_type'])) {
        $mysql_column_type = trim($_REQUEST['mysql_column_type']);
    } else {
        $mysql_column_type = 1;
    }
    echo '<center>';
    show_message();
    javascript__tooltip_prepare();
    echo '<FORM id="columnform" action="' . thisdoc() . '" method="POST">';
    echo '<TABLE class="or_formtable">';
    echo '<TR class="tooltip" title="Name of the new MySQL column. Name must start and end with a lowercase letter, and can only contain lower case letters and underscore (_).">
			<TD>MySQL column name (a-z_):</TD>
			<TD><INPUT type="text" name="mysql_column_name" size="30" maxlength="50" value="' . $mysql_column_name . '"></TD></TR>';
    echo '<TR class="tooltip" title="Type of the new MySQL column. &quot;varchar(250)&quot; is the most versatile type 
			for numbers or shorter text. Must be chosen for &quot;select_lang&quot; and &quot;radioline_lang&quot; lists.
			If the field needs to store longer text, then &quot;mediumtext&quot; might be appropriate. 
			&quot;integer&quot; can be chosen if the field will only hold integer numbers (but &quot;varchar(250)&quot; 
			is recommended also in this case).">
			<TD>MySQL column type:</TD>
			<TD><SELECT name="mysql_column_type">';
    foreach ($type_specs as $k => $arr) {
        echo '<OPTION value="' . $k . '"';
        if ($k == $mysql_column_type) {
            echo ' SELECTED';