/** Possible actions for a testinvite: edit, view scores, delete */
 function testinvite_actions($testinvite_id)
 {
     $CI =& get_instance();
     $testinvite = $CI->testInviteModel->get_testinvite_by_id($testinvite_id);
     $scores = $CI->scoreModel->get_scores_by_testinvite($testinvite_id);
     $reminder_available = !$testinvite->datecompleted && $testinvite->datereminder;
     $reminder_link = anchor('testinvite/manual_reminder/' . $testinvite_id, img_email(lang('manual_reminder'), FALSE));
     $score_link = anchor('score/testinvite/' . $testinvite_id, img_scores(empty($scores)));
     $reminder_link = $reminder_available ? $reminder_link : img_email('', TRUE);
     $delete_link = anchor('testinvite/delete/' . $testinvite_id, img_delete(), warning(lang('sure_delete_testinvite')));
     if (is_caller()) {
         $actions = array($reminder_link, $delete_link);
     }
     if (is_leader()) {
         $actions = array($score_link, $reminder_link);
     }
     if (is_admin()) {
         $actions = array($score_link, $reminder_link, $delete_link);
     }
     return implode(' ', $actions);
 }
function accept_pending()
{
    global $uid;
    global $faid;
    if (has_alliance_lock($uid)) {
        show_message("You can't use any alliance options due to an alliance lock!");
        return false;
    }
    $aid = get_alliance($uid);
    if (!is_leader($uid, $aid)) {
        show_message("Be aware of the dark side!");
        return 0;
    }
    $pending_status = get_pending_diplomacy_change($faid, $aid);
    if (!$pending_status) {
        show_message("fu! ;)");
        return 0;
    }
    if (!drop_pending_diplomatic_request($faid, $aid)) {
        show_error("Database failure!");
        return 0;
    }
    if (!change_diplomatic_status($aid, $faid, $pending_status)) {
        show_error("Database failure2!");
        return 0;
    }
    $f_leader = get_leader($faid);
    $f_allies = get_allied_ids($f_leader);
    ticker($f_leader, "*lcommunication.php?act=show_diplomacy*Alliance " . get_alliance_name($aid) . " has accepted your request to change status to " . get_diplomatic_status_text($pending_status), "w");
    for ($i = 0; $i < sizeof($f_allies); $i++) {
        ticker($f_allies[$i], "Alliance " . get_alliance_name($aid) . " has accepted your leaders request to change status to " . get_diplomatic_status_text($pending_status), "w");
    }
    $allies = get_allied_ids(get_leader($aid));
    for ($i = 0; $i < sizeof($allies); $i++) {
        ticker($allies[$i], "Your leader accepted a request from Alliance " . get_alliance_name($faid) . " to change status to " . get_diplomatic_status_text($pending_status), "w");
    }
    show_message("Status changed!");
}
create_leader_table('leaders');
$leaders['id'] = 'leaders';
$leaders['ajax_source'] = 'leader/table_by_experiment/' . $experiment->id;
$this->load->view('templates/list_view', $leaders);
?>
	</div>

	<!-- Participations -->
	<?php 
echo heading(lang('participations') . ' (' . $nr_participations . ')', 3);
?>
	<div>
		<?php 
is_leader() ? create_participation_leader_table('participations') : create_participation_table('participations');
$participations['id'] = 'participations';
$participations['ajax_source'] = is_leader() ? 'participation/table_by_leader/' . $experiment->id : 'participation/table/0/' . $experiment->id;
$this->load->view('templates/list_view', $participations);
?>
		<?php 
echo anchor('participation/download/' . $experiment->id, lang('download_participations'));
?>
	</div>

	<!-- Relations -->
	<?php 
echo heading(lang('relations'), 3);
?>
	<div>
		<?php 
create_relation_table('relations');
$relations['id'] = 'relations';
示例#4
0
 /** Specifies the contents of the edit experiment page */
 public function edit($experiment_id)
 {
     if (is_leader() && !$this->leaderModel->is_leader_for_experiment(current_user_id(), $experiment_id)) {
         show_error("You are not a leader for this experiment.");
     }
     $experiment = $this->experimentModel->get_experiment_by_id($experiment_id);
     $leaders = array_merge($this->userModel->get_all_leaders(), $this->userModel->get_all_admins());
     $callers = $this->userModel->get_all_users();
     $experiments = $this->experimentModel->get_all_experiments(TRUE, $experiment_id);
     $data['page_title'] = lang('edit_experiment');
     $data['action'] = 'experiment/edit_submit/' . $experiment_id;
     $data = add_fields($data, 'experiment', $experiment);
     $data['date_start'] = output_date($experiment->date_start, TRUE);
     $data['date_end'] = output_date($experiment->date_end, TRUE);
     $data['locations'] = $this->locationModel->get_all_locations();
     $data['callers'] = caller_options($callers);
     $data['leaders'] = leader_options($leaders);
     $data['experiments'] = experiment_options($experiments);
     $data['location_id'] = $this->locationModel->get_location_by_experiment($experiment)->id;
     $data['current_caller_ids'] = $this->callerModel->get_caller_ids_by_experiment($experiment_id);
     $data['current_leader_ids'] = $this->leaderModel->get_leader_ids_by_experiment($experiment_id);
     $data['current_prerequisite_ids'] = $this->relationModel->get_relation_ids_by_experiment($experiment_id, RelationType::Prerequisite);
     $data['current_exclude_ids'] = $this->relationModel->get_relation_ids_by_experiment($experiment_id, RelationType::Excludes);
     $data['current_combination_ids'] = $this->relationModel->get_relation_ids_by_experiment($experiment_id, RelationType::Combination);
     $this->load->view('templates/header', $data);
     $this->load->view('experiment_edit_view', $data);
     $this->load->view('templates/footer');
 }
示例#5
0
		<?php 
if (current_user_id() > 0) {
    ?>
		<div id="welcome">
		<?php 
    echo "<em>" . current_username() . " (" . strtolower(lang(current_role())) . ")" . "</em>";
    echo " | ";
    echo anchor('user/edit/' . current_user_id(), lang('edit_user_profile'));
    echo " | ";
    echo anchor('user/change_password/' . current_user_id(), lang('change_password'));
    echo " | ";
    if (user_role() === UserRole::Admin && !is_admin()) {
        echo anchor('login/switch_to/admin', lang('login_admin'));
        echo " | ";
    }
    if ((user_role() === UserRole::Admin || user_role() === UserRole::Leader) && !is_leader()) {
        echo anchor('login/switch_to/leader', lang('login_leader'));
        echo " | ";
    }
    if ((user_role() === UserRole::Admin || user_role() === UserRole::Leader) && !is_caller()) {
        echo anchor('login/switch_to/caller', lang('login_caller'));
        echo " | ";
    }
    echo anchor('login/logout', lang('logout'));
    ?>
		</div>
		<?php 
}
?>

		<?php 
</th>
			<td><?php 
    echo $participation->part_number;
    ?>
</td>
		</tr>
		<?php 
}
?>
	</table>
	
</div>

<!-- Calls -->
<?php 
if (!is_leader()) {
    ?>
	<?php 
    echo heading(lang('calls'), 3);
    ?>
	<div>
		<?php 
    create_call_table('calls');
    $calls['id'] = 'calls';
    $calls['sort_column'] = 5;
    $calls['sort_order'] = 'desc';
    $calls['ajax_source'] = 'call/table_by_participation/' . $participation->id;
    echo $this->load->view('templates/list_view', $calls);
    ?>
	</div>
<?php 
 /**
  * Generates HTML Output for the calender tooltip
  * @param Participation $participation ID
  * @param Participant $participant
  * @param Experiment $experiment
  */
 private function generate_tooltip($participation, $participant, $experiment)
 {
     $exp_link = lang('experiment') . ': ';
     $exp_link .= experiment_get_link($experiment);
     $exp_link .= br();
     $part_link = lang('participant') . ': ';
     $part_link .= participant_get_link($participant);
     $part_link .= br();
     $loc_link = lang('location') . ': ';
     $loc_link .= location_get_link_by_id($experiment->location_id);
     $loc_link .= br();
     $user_link = '';
     if ($participation->user_id_leader) {
         $user_link .= lang('leader') . ': ';
         $user_link .= user_get_link_by_id($participation->user_id_leader);
         $user_link .= br();
     }
     $comment = '';
     if ($participation->calendar_comment) {
         $comment .= lang('comment') . ': ';
         $comment .= $participation->calendar_comment;
         $comment .= br();
     }
     // Show actions only if user the leader of this participation (or if user is admin/caller)
     $current_user_is_leader = is_leader() && $participation->user_id_leader != current_user_id();
     $participation_actions = $current_user_is_leader ? '' : '<center>' . participation_actions($participation->id) . '</center>';
     return addslashes($exp_link . $part_link . $loc_link . $user_link . $comment . $participation_actions);
 }