Пример #1
0
function showratings($rating_type, $rating_item_id, $rating_link)
{
    global $locale, $userdata;
    $settings = \fusion_get_settings();
    if ($settings['ratings_enabled'] == "1") {
        if (iMEMBER) {
            $d_rating = dbarray(dbquery("SELECT rating_vote,rating_datestamp FROM " . DB_RATINGS . " WHERE rating_item_id='" . $rating_item_id . "' AND rating_type='" . $rating_type . "' AND rating_user='******'user_id'] . "'"));
            if (isset($_POST['post_rating'])) {
                // Rate
                if (isnum($_POST['rating']) && $_POST['rating'] > 0 && $_POST['rating'] < 6 && !isset($d_rating['rating_vote'])) {
                    $result = dbquery("INSERT INTO " . DB_RATINGS . " (rating_item_id, rating_type, rating_user, rating_vote, rating_datestamp, rating_ip, rating_ip_type) VALUES ('{$rating_item_id}', '{$rating_type}', '" . $userdata['user_id'] . "', '" . $_POST['rating'] . "', '" . time() . "', '" . USER_IP . "', '" . USER_IP_TYPE . "')");
                    if ($result) {
                        defender::unset_field_session();
                    }
                }
                redirect($rating_link);
            } elseif (isset($_POST['remove_rating'])) {
                // Unrate
                $result = dbquery("DELETE FROM " . DB_RATINGS . " WHERE rating_item_id='{$rating_item_id}' AND rating_type='{$rating_type}' AND rating_user='******'user_id'] . "'");
                if ($result) {
                    defender::unset_field_session();
                }
                redirect($rating_link);
            }
        }
        $ratings = array(5 => $locale['r120'], 4 => $locale['r121'], 3 => $locale['r122'], 2 => $locale['r123'], 1 => $locale['r124']);
        if (!iMEMBER) {
            $message = str_replace("[RATING_ACTION]", "<a href='" . BASEDIR . "login.php'>" . $locale['login'] . "</a>", $locale['r104']);
            if (fusion_get_settings("enable_registration") == TRUE) {
                $message = str_replace("[RATING_ACTION]", "<a href='" . BASEDIR . "login.php'>" . $locale['login'] . "</a> " . $locale['or'] . " <a href='" . BASEDIR . "register.php'>" . $locale['register'] . "</a>", $locale['r104']);
            }
            echo "<div class='text-center'>" . $message . "</div>\n";
        } elseif (isset($d_rating['rating_vote'])) {
            echo "<div class='display-block'>\n";
            echo openform('removerating', 'post', $rating_link, array('class' => 'display-block text-center'));
            echo sprintf($locale['r105'], $ratings[$d_rating['rating_vote']], showdate("longdate", $d_rating['rating_datestamp'])) . "<br /><br />\n";
            echo form_button('remove_rating', $locale['r102'], $locale['r102'], array('class' => 'btn-default', 'icon' => 'fa fa-times m-r-10'));
            echo closeform();
            echo "</div>\n";
        } else {
            echo "<div class='display-block'>\n";
            echo openform('postrating', 'post', $rating_link, array('max_tokens' => 1, 'notice' => 0, 'class' => 'm-b-20 text-center'));
            echo form_select('rating', $locale['r106'], '', array('options' => $ratings, 'class' => 'display-block text-center'));
            echo form_button('post_rating', $locale['r103'], $locale['r103'], array('class' => 'btn-primary btn-sm', 'icon' => 'fa fa-thumbs-up m-r-10'));
            echo closeform();
            echo "</div>\n";
        }
        $rating_votes = dbarray(dbquery("\n\t\tSELECT\n\t\tSUM(IF(rating_vote='5', 1, 0)) as r120,\n\t\tSUM(IF(rating_vote='4', 1, 0)) as r121,\n\t\tSUM(IF(rating_vote='3', 1, 0)) as r122,\n\t\tSUM(IF(rating_vote='2', 1, 0)) as r123,\n\t\tSUM(IF(rating_vote='1', 1, 0)) as r124\n\t\tFROM " . DB_RATINGS . " WHERE rating_type='" . $rating_type . "' and rating_item_id='" . intval($rating_item_id) . "'\n\t\t"));
        if (!empty($rating_votes)) {
            echo "<div id='ratings' class='rating_container'>\n";
            foreach ($rating_votes as $key => $num) {
                echo progress_bar($num, $locale[$key], FALSE, '10px', TRUE, FALSE);
            }
            echo "</div>\n";
        } else {
            echo "<div class='text-center'>" . $locale['r101'] . "</div>\n";
        }
    }
}
Пример #2
0
function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source, $user_shift_admin, $admin_rooms, $admin_shifttypes, $user_shifts, $signed_up)
{
    $parsedown = new Parsedown();
    $angeltypes = [];
    foreach ($angeltypes_source as $angeltype) {
        $angeltypes[$angeltype['id']] = $angeltype;
    }
    $needed_angels = '';
    foreach ($shift['NeedAngels'] as $needed_angeltype) {
        $class = 'progress-bar-warning';
        if ($needed_angeltype['taken'] == 0) {
            $class = 'progress-bar-danger';
        }
        if ($needed_angeltype['taken'] >= $needed_angeltype['count']) {
            $class = 'progress-bar-success';
        }
        $needed_angels .= '<div class="list-group-item">';
        $needed_angels .= '<div class="pull-right">' . Shift_signup_button_render($shift, $angeltypes[$needed_angeltype['TID']]) . '</div>';
        $needed_angels .= '<h3>' . AngelType_name_render($angeltypes[$needed_angeltype['TID']]) . '</h3>';
        $needed_angels .= progress_bar(0, $needed_angeltype['count'], min($needed_angeltype['taken'], $needed_angeltype['count']), $class, $needed_angeltype['taken'] . ' / ' . $needed_angeltype['count']);
        $angels = [];
        foreach ($shift['ShiftEntry'] as $shift_entry) {
            if ($shift_entry['TID'] == $needed_angeltype['TID']) {
                $entry = User_Nick_render(User($shift_entry['UID']));
                if ($shift_entry['freeloaded']) {
                    $entry = '<strike>' . $entry . '</strike>';
                }
                if ($user_shift_admin) {
                    $entry .= ' <div class="btn-group">';
                    $entry .= button_glyph(page_link_to('user_myshifts') . '&edit=' . $shift_entry['id'] . '&id=' . $shift_entry['UID'], 'pencil', 'btn-xs');
                    $entry .= button_glyph(page_link_to('user_shifts') . '&entry_id=' . $shift_entry['id'], 'trash', 'btn-xs');
                    $entry .= '</div>';
                }
                $angels[] = $entry;
            }
        }
        $needed_angels .= join(', ', $angels);
        $needed_angels .= '</div>';
    }
    $shiftManagers = getShiftManagers($shift['SID']);
    return page_with_title($shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', [msg(), Shift_collides($shift, $user_shifts) ? info(_('This shift collides with one of your shifts.'), true) : '', $signed_up ? info(_('You are signed up for this shift.'), true) : '', $shift_admin || $admin_shifttypes || $admin_rooms ? buttons([$shift_admin ? button(shift_edit_link($shift), glyph('pencil') . _('edit')) : '', $shift_admin ? button(shift_delete_link($shift), glyph('trash') . _('delete')) : '', $admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '', $admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : '']) : '', div('row', [div('col-sm-3 col-xs-6', ['<h4>' . _('Title') . '</h4>', '<p class="lead">' . ($shift['URL'] != '' ? '<a href="' . $shift['URL'] . '">' . $shift['title'] . '</a>' : $shift['title']) . '</p>']), div('col-sm-3 col-xs-6', ['<h4>' . _('Start') . '</h4>', '<p class="lead' . (time() >= $shift['start'] ? ' text-success' : '') . '">', glyph('calendar') . date('Y-m-d', $shift['start']), '<br />', glyph('time') . date('H:i', $shift['start']), '</p>']), div('col-sm-3 col-xs-6', ['<h4>' . _('End') . '</h4>', '<p class="lead' . (time() >= $shift['end'] ? ' text-success' : '') . '">', glyph('calendar') . date('Y-m-d', $shift['end']), '<br />', glyph('time') . date('H:i', $shift['end']), '</p>']), div('col-sm-3 col-xs-6', ['<h4>' . _('Location') . '</h4>', '<p class="lead">' . glyph('map-marker') . $room['Name'] . '</p>'])]), div('row', [div('col-sm-6', ['<h2>' . _('Needed angels') . '</h2>', '<div class="list-group">' . $needed_angels . '</div>']), div('col-sm-6', [!empty($shiftManagers) ? '<h2>' . _('Shift Manager') . '</h2>' : '', !empty($shiftManagers) ? implode('<br>', array_map(function ($manager) {
        return $manager['Vorname'] . ' ' . $manager['Name'];
    }, $shiftManagers)) : '', '<h2>' . _('Description') . '</h2>', $parsedown->parse($shifttype['description'])])]), $shift_admin ? Shift_editor_info_render($shift) : '']);
}
Пример #3
0
function print_solved_graph($user_id)
{
    validate_id($user_id);
    $challenges = db_query_fetch_all('
        SELECT
           ca.title,
           (SELECT SUM(ch.points) FROM challenges AS ch JOIN submissions AS s ON s.challenge = ch.id AND s.user_id = :user_id AND s.correct = 1 WHERE ch.category = ca.id GROUP BY ch.category) AS points,
           (SELECT SUM(ch.points) FROM challenges AS ch WHERE ch.category = ca.id GROUP BY ch.category) AS category_total
        FROM categories AS ca
        WHERE
          ca.available_from < UNIX_TIMESTAMP() AND
          ca.exposed = 1
        ORDER BY ca.title ASC', array('user_id' => $user_id));
    $user_total = 0;
    $ctf_total = 0;
    foreach ($challenges as $challenge) {
        echo '<strong>', htmlspecialchars($challenge['title']), '</strong>, ', number_format($challenge['points']), ' / ', number_format($challenge['category_total']), ' (', round($challenge['points'] / max(1, $challenge['category_total']) * 100), '%)';
        progress_bar($challenge['points'] / max(1, $challenge['category_total']) * 100);
        $user_total += $challenge['points'];
        $ctf_total += $challenge['category_total'];
    }
    echo lang_get('total_solves'), ' ', number_format($user_total), ' / ', number_format($ctf_total), ' (', round($user_total / $ctf_total * 100, 1), '%)';
}
Пример #4
0
  function RenderPopularity() {
    $pop = (int)calculate_popularity( $this->prod->views );
    echo "popularity : ".$pop."%<br/>\n";
    echo progress_bar( $pop, $pop."%" );

    $year = substr($this->prod->releaseDate,0,4);
    echo "<div class='awards'>";
    foreach($this->awards as $award)
    {
    	printf("<a href='./awards.php#%s'><img src='".POUET_CONTENT_URL."gfx/sceneorg/%s.gif' title='%s' alt='%s'/></a>",
        $award->type == "viewingtip" ? $year : $year . str_replace(" ","",$award->category),
        $award->type,
        $award->category,
        $award->category);
    }
    echo "</div>";
  }
Пример #5
0
function show_stores()
{
    page_head("Stores");
    table_start();
    table_header(array("Name<br><small>Click for details</small>", "Files<br><small>Click to view</small>", "Capacity", "Used", "% used", "Available"));
    $stores = store_enum();
    foreach ($stores as $store) {
        $nfiles = file_count("store_id={$store->id}");
        table_row(array("<a href=hl.php?action=store&id={$store->id}>{$store->name}</a>", "<a href=hl.php?action=file_search_action&store_id={$store->id}>{$nfiles}</a>", size_str($store->capacity), size_str($store->used), progress_bar(100 * $store->used / $store->capacity), $store->unavailable ? "No" : "Yes"));
    }
    table_end();
    echo '
        <a href="hl.php?action=edit_store_form">
        <button type="button" class="btn btn-default">
        Add store
        </button>
        </a>
    ';
    page_tail();
}
Пример #6
0
$table->column_style('progress', 'text-align', 'center');
$table->no_sorting('picture');
$table->no_sorting('progressbar');
$table->define_baseurl($PAGE->url);
$table->setup();
// Build table of progress bars as they are marked
for ($i = 0; $i < $numberofusers; $i++) {
    $picture = $OUTPUT->user_picture($users[$i], array('course' => $course->id));
    $name = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $users[$i]->id . '&course=' . $course->id . '">' . fullname($users[$i]) . '</a>';
    if ($users[$i]->lastaccess == 0) {
        $lastonline = get_string('never');
    } else {
        $lastonline = userdate($users[$i]->lastaccess);
    }
    $attempts = get_attempts($modules, $config, $events, $users[$i]->id, $course->id);
    $progressbar = progress_bar($modules, $config, $events, $users[$i]->id, $course->id, $attempts, true);
    $progressvalue = get_progess_percentage($events, $attempts);
    $progress = $progressvalue . '%';
    $rows[] = array('firstname' => $users[$i]->firstname, 'lastname' => strtoupper($users[$i]->lastname), 'picture' => $picture, 'fullname' => $name, 'lastonlinetime' => $users[$i]->lastaccess, 'lastonline' => $lastonline, 'progressbar' => $progressbar, 'progressvalue' => $progressvalue, 'progress' => $progress);
    //Inserting the values into created table
    $result = $DB->get_records_sql('SELECT * FROM {progress_percent} WHERE uid = ? AND cid = ?', array($users[$i]->id, $course->id));
    $val = array_values($result);
    $record = new stdClass();
    $record->uid = $users[$i]->id;
    $record->cid = $course->id;
    $record->progress_percentage = $progressvalue;
    if (count($result) != 0) {
        $record->id = $val[0]->id;
    }
    count($result) == 0 ? $DB->insert_record('progress_percent', $record, false) : $DB->update_record('progress_percent', $record, false);
}
</div>
<div class="col-md-6">
	<h2>Most Connected Documents</h2>
	<p>Top 100 documents with the lowest average Helsinger distance to other documents. 
		These tend to have low topic entropy.</p>
	<?php 
foreach ($connectors as $doc) {
    $doc_url = base_url('doc/item/' . $doc['doc_id']);
    $dist = round($doc['distance'], 3);
    print "<div class='data-item'>";
    print "<a href='{$doc_url}'>" . $doc['title'] . "</a>";
    print progress_bar('success', $dist, 0, 1.4, $dist);
    print "</div>";
}
?>
</div>
<div class="col-md-6">
	<h2>Most Lonely (Least Connected) Documents</h2>
	<p>Top 100 documents with the highest average Helsinger distance to other documents.
		These tend to have high topic entropy.</p>
	<?php 
foreach ($loners as $doc) {
    $doc_url = base_url('doc/item/' . $doc['doc_id']);
    $dist = round($doc['distance'], 3);
    print "<div class='data-item'>";
    print "<a href='{$doc_url}'>" . $doc['title'] . "</a>";
    print progress_bar('success', $dist, 0, 1.4, $dist);
    print "</div>";
}
?>
</div>
Пример #8
0
 section_head(htmlspecialchars($user['team_name']), country_flag_link($user['country_name'], $user['country_code'], true), false);
 if (!$user['competing']) {
     message_inline_blue('This user is listed as a non-competitor.');
 }
 $challenges = db_query_fetch_all('
     SELECT
        ca.title,
        (SELECT SUM(ch.points) FROM challenges AS ch JOIN submissions AS s ON s.challenge = ch.id AND s.user_id = :user_id AND s.correct = 1 WHERE ch.category = ca.id GROUP BY ch.category) AS points,
        (SELECT SUM(ch.points) FROM challenges AS ch WHERE ch.category = ca.id GROUP BY ch.category) AS category_total
     FROM categories AS ca
     ORDER BY ca.title ASC', array('user_id' => $_GET['id']));
 $user_total = 0;
 $ctf_total = 0;
 foreach ($challenges as $challenge) {
     echo '<strong>', htmlspecialchars($challenge['title']), '</strong>, ', number_format($challenge['points']), ' / ', number_format($challenge['category_total']), ' (', round($challenge['points'] / max(1, $challenge['category_total']) * 100), '%)';
     progress_bar($challenge['points'] / max(1, $challenge['category_total']) * 100);
     $user_total += $challenge['points'];
     $ctf_total += $challenge['category_total'];
 }
 echo 'Total: ', number_format($user_total), ' / ', number_format($ctf_total), ' (', round($user_total / $ctf_total * 100, 1), '%)';
 section_head('Solved challenges');
 $submissions = db_query_fetch_all('
     SELECT
        s.added,
        ((SELECT COUNT(*) FROM submissions AS ss WHERE ss.correct = 1 AND ss.added < s.added AND ss.challenge=s.challenge)+1) AS pos,
        ch.id AS challenge_id,
        ch.available_from,
        ch.title,
        ch.points,
        ca.title AS category_title
     FROM submissions AS s
    #$w = round($topic['word_count']/$max,2) * 100;
    $vnow = $topic['word_count'];
    $topic_url = base_url('topic/item/' . $topic['topic_id']);
    print "<div class='data-item'>";
    print "<a href='{$topic_url}'>";
    print $topic['topic_words'];
    print "</a>";
    print progress_bar('success', $vnow, 0, $max_words, $vnow);
    print "</div>";
}
?>
</div>

<div class="col-md-7">
    <h2>Related Documents</h2>
    <div><p>Documents in which this word is the most frequent word.</p></div>
    <?php 
$vmin = 0;
$vmax = $max_docwords;
foreach ($docs as $doc) {
    $vnow = $doc['word_count'];
    $doc_url = base_url('doc/item/' . $doc['doc_id']);
    print "<div class='data-item'>";
    print "<a href='{$doc_url}'>" . $doc['title'] . "</a>";
    print progress_bar('success', $vnow, $vmin, $vmax, $vnow);
    print "</div>";
}
?>
  	
</div>
Пример #10
0
			$info_general .= "<tr>";
			//$info_general .= "<td class='no_border size_min'></td>";
			// Project name
			$info_general .= "<td><a href='index.php?sec=projects&sec2=operation/projects/project_detail&id_project=".$project["id"]."'>".$project["name"]."</a></td>";
		
			// Manager
			$info_general .= "<td>".$project['id_owner']."</a></td>";
			
			// Completion
			if ($project["start"] == $project["end"]) {
				$info_general .= '<td>'.__('Unlimited');
			}
			else {
				$completion = format_numeric (calculate_project_progress ($project['id']));
				$info_general .= "<td>";
				$info_general .= progress_bar($completion, 90, 20);
			}
			$info_general .= "</td>";
			
			// Last update time
			$sql = sprintf ('SELECT tworkunit.timestamp FROM ttask, tworkunit_task, tworkunit
							 WHERE ttask.id_project = %d AND ttask.id = tworkunit_task.id_task
							 AND tworkunit_task.id_workunit = tworkunit.id
							 ORDER BY tworkunit.timestamp DESC LIMIT 1', $project['id']);
			$timestamp = get_db_sql ($sql);
			$timestamp = explode(" ", $timestamp);
			if ($timestamp[0] != "")
				$info_general .= "<td><span style='font-size: 10px'>".$timestamp[0]."</span></td>";
			else
				$info_general .= "<td>".__('Never')."</td>";
			
Пример #11
0
	echo "</ul></div>";
}
echo "</h4>";


// Project info

//Name
$project_info .= '<tr><td colspan="2"><b>'.__('Name').':</b></td></tr>';
$project_info .= '<tr><td colspan="2">'.$name.'</td></tr>';

//Only show project progress if there is a project created
if ($id_project) {
	$project_info .= '<tr><td colspan="2"><b>'.__('Current progress').':</b></td></tr>';
	$completion =  format_numeric(calculate_project_progress ($id_project));
	$project_info .= '<tr><td colspan="2">'.progress_bar($completion, 90, 20, $graph_ttl).'</td></tr>';
}

//start and end date
$project_info .= '<tr><td colspan="2"><b>'.__('Start').':</b></td></tr>';
$project_info .= '<tr><td colspan="2">'.$start_date.'</td></tr>';
$project_info .= '<tr><td colspan="2"><b>'.__('End').':</b></td></tr>';
$project_info .= '<tr><td colspan="2">'.$end_date.'</td></tr>';

//owner
$id_owner = get_db_value ( 'id_owner', 'tproject', 'id', $id_project);
$project_info .= '<tr><td colspan="2"><b>'.__('Project manager').':</b></td></tr>';
$project_info .= '<tr><td colspan="2">'.get_db_value ("nombre_real", "tusuario", "id_usuario", $owner).'</td></tr>';

//Project Group
$project_info .= '<tr><td colspan="2"><b>'.__('Project group').':</b></td></tr>';
?>
<div class="col-md-12">
	<h2>Documents by Title</h2>
  <table data-page-length='25' class="table data-table">
    <thead>
      <tr>
        <th>Entropy</th>
        <th>Year</th>
        <th>Title</th>				
      </tr>
    </thead>
    <tbody>
   <?php 
$vmin = 0;
$vmax = $entropy['max'];
foreach ($docs as $doc) {
    $doc_url = base_url('doc/item/' . $doc['doc_id']);
    $vnow = round($doc['topic_entropy'], 3);
    print "<tr>";
    print "<td>";
    print progress_bar('info', $vnow, $vmin, $vmax, $vnow);
    print "</td>";
    print "<td>{$doc['year']}</td>";
    print "<td style='font-size:110%;'><a href='{$doc_url}'>{$doc['title']}</a></td>";
    print "</tr>";
}
?>
	
    </tbody>
  </table>
</div>
<h1>Playground</h1>
<?php 
print progress_bar('info', 5, 0, 20, 30, 'Testing');
Пример #14
0
function tasks_print_tree($id_project, $sql_search = '')
{
    global $config;
    global $pdf_output;
    if ($pdf_output) {
        $graph_ttl = 2;
    } else {
        $graph_ttl = 1;
    }
    echo "<table class='blank' style='width:98%'>";
    echo "<tr><td style='width:60%' valign='top'>";
    $sql = "SELECT t.*\n\t\t\tFROM ttask t\n\t\t\tWHERE t.id_parent_task=0\n\t\t\t\tAND t.id>0\n\t\t\t\tAND t.id_project={$id_project}\n\t\t\t\t{$sql_search}\n\t\t\tORDER BY t.name";
    //$sql_search = base64_encode($sql_search);
    $sql_count = "SELECT COUNT(*) AS num\n\t\t\tFROM ttask t\n\t\t\tWHERE t.id_parent_task=0\n\t\t\t\tAND t.id>0\n\t\t\t\tAND t.id_project={$id_project}\n\t\t\t\t{$sql_search}";
    $countRows = process_sql($sql_count);
    if ($countRows === false) {
        $countRows = 0;
    } else {
        $countRows = (int) $countRows[0]['num'];
    }
    if ($countRows == 0) {
        echo '<h3 class="error">' . __('No tasks found') . '</h3>';
        return;
    }
    $new = true;
    $count = 0;
    echo "<ul style='margin: 0; margin-top: 20px; padding: 0;'>\n";
    $first = true;
    while ($task = get_db_all_row_by_steps_sql($new, $result, $sql)) {
        $new = false;
        $count++;
        echo "<li style='margin: 0; padding: 0;'>";
        echo "<span style='display: inline-block;'>";
        $branches = array();
        if ($first) {
            if ($count != $countRows) {
                $branches[] = true;
                $img = print_image("images/tree/first_closed.png", true, array("style" => 'vertical-align: middle;', "id" => "tree_image" . $task['id'] . "_task_" . $task['id'], "pos_tree" => "0"));
                $first = false;
            } else {
                $branches[] = false;
                $img = print_image("images/tree/one_closed.png", true, array("style" => 'vertical-align: middle;', "id" => "tree_image" . $task['id'] . "_task_" . $task['id'], "pos_tree" => "1"));
            }
        } else {
            if ($count != $countRows) {
                $branches[] = true;
                $img = print_image("images/tree/closed.png", true, array("style" => 'vertical-align: middle;', "id" => "tree_image" . $task['id'] . "_task_" . $task['id'], "pos_tree" => "2"));
            } else {
                $branches[] = false;
                $img = print_image("images/tree/last_closed.png", true, array("style" => 'vertical-align: middle;', "id" => "tree_image" . $task['id'] . "_task_" . $task['id'], "pos_tree" => "3"));
            }
        }
        $task_access = get_project_access($config["id_user"], $id_project, $task["id"], false, true);
        if ($task_access["read"]) {
            // Background color
            if ($task["completion"] < 40) {
                $background_color = "background: #FFFFFF;";
            } else {
                if ($task["completion"] < 90) {
                    $background_color = "background: #FFE599;";
                } else {
                    if ($task["completion"] < 100) {
                        $background_color = "background: #A4BCFA;";
                    } else {
                        if ($task["completion"] == 100) {
                            $background_color = "background: #B6D7A8;";
                        } else {
                            $background_color = "";
                        }
                    }
                }
            }
            // Priority
            $priority = print_priority_flag_image($task['priority'], true);
            // Task name
            $name = safe_output($task['name']);
            if (strlen($name) > 30) {
                $name = substr($name, 0, 30) . "...";
                $name = "<a title='" . safe_output($task['name']) . "' href='index.php?sec=projects&sec2=operation/projects/task_detail\n\t\t\t\t\t&id_project=" . $task['id_project'] . "&id_task=" . $task['id'] . "&operation=view'>" . $name . "</a>";
            } else {
                $name = "<a href='index.php?sec=projects&sec2=operation/projects/task_detail\n\t\t\t\t\t&id_project=" . $task['id_project'] . "&id_task=" . $task['id'] . "&operation=view'>" . $name . "</a>";
            }
            if ($task["completion"] == 100) {
                $name = "<s>{$name}</s>";
            }
            // Completion
            $progress = progress_bar($task['completion'], 70, 20, $graph_ttl);
            // Estimation
            $imghelp = "Estimated hours = " . $task['hours'];
            $taskhours = get_task_workunit_hours($task['id']);
            $imghelp .= ", Worked hours = {$taskhours}";
            $a = round($task["hours"]);
            $b = round($taskhours);
            $mode = 2;
            if ($a > 0) {
                $estimation = histogram_2values($a, $b, __("Planned"), __("Real"), $mode, 60, 18, $imghelp, $graph_ttl);
            } else {
                $estimation = "--";
            }
            // Time used on all child tasks + this task
            $recursive_timeused = task_duration_recursive($task["id"]);
            $time_used = _('Time used') . ": ";
            if ($taskhours == 0) {
                $time_used .= "--";
            } elseif ($taskhours == $recursive_timeused) {
                $time_used .= $taskhours;
            } else {
                $time_used .= $taskhours . "<span title='Subtasks WU/HR'> (" . $recursive_timeused . ")</span>";
            }
            $wu_incidents = get_incident_task_workunit_hours($task["id"]);
            if ($wu_incidents > 0) {
                $time_used .= "<span title='" . __("Time spent in related tickets") . "'> ({$wu_incidents})</span>";
            }
            // People
            $people = combo_users_task($task['id'], 1, true);
            $people .= ' ';
            $people .= get_db_value('COUNT(DISTINCT(id_user))', 'trole_people_task', 'id_task', $task['id']);
            // Branches
            $branches_json = json_encode($branches);
            // New WO / Incident
            $wo_icon = print_image("images/paste_plain.png", true, array("style" => 'vertical-align: middle;', "id" => "wo_icon", "title" => __('Work order')));
            $incident_icon = print_image("images/incident.png", true, array("style" => 'vertical-align: middle; height:19px; width:20px;', "id" => "incident_icon", "title" => __('Ticket')));
            $wo_icon = "<a href='index.php?sec=projects&sec2=operation/workorders/wo&operation=create&id_task=" . $task['id'] . "'>{$wo_icon}</a>";
            $incident_icon = "<a href='index.php?sec=incidents&sec2=operation/incidents/incident_detail&id_task=" . $task['id'] . "'>{$incident_icon}</a>";
            $launch_icons = $wo_icon . "&nbsp;" . $incident_icon;
            echo "<a onfocus='JavaScript: this.blur()' href='javascript: loadTasksSubTree(" . $task['id_project'] . "," . $task['id'] . ",\"" . $branches_json . "\", " . $task['id'] . ",\"" . $sql_search . "\")'>";
            echo "<script type=\"text/javascript\">\n\t\t\t\t\t  \$(document).ready (function () {\n\t\t\t\t\t\t  loadTasksSubTree(" . $task['id_project'] . "," . $task['id'] . ",\"" . $branches_json . "\", " . $task['id'] . ",\"" . $sql_search . "\");\n\t\t\t\t\t  });\n\t\t\t\t  </script>";
            echo $img;
            echo "</a>";
            echo "<span style='" . $background_color . " padding: 4px;'>";
            echo "<span style='vertical-align:middle; display: inline-block;'>" . $priority . "</span>";
            echo "<span style='margin-left: 5px; min-width: 250px; vertical-align:middle; display: inline-block;'>" . $name . "</span>";
            echo "<span title='" . __('Progress') . "' style='margin-left: 15px; vertical-align:middle; display: inline-block;'>" . $progress . "</span>";
            echo "<span style='margin-left: 15px; min-width: 70px; vertical-align:middle; display: inline-block;'>" . $estimation . "</span>";
            echo "<span style='margin-left: 15px; vertical-align:middle; display: inline-block;'>" . $people . "</span>";
            echo "<span style='margin-left: 15px; min-width: 200px; display: inline-block;'>" . $time_used . "</span>";
            echo "<span style='margin-left: 15px; vertical-align:middle; display: inline-block;'>" . __('New') . ": " . $launch_icons . "</span>";
            echo "</span>";
        } else {
            // Task name
            $name = safe_output($task['name']);
            if (strlen($name) > 60) {
                $name = substr($name, 0, 60) . "...";
                $name = "<div title='" . safe_output($task['name']) . "'>" . $name . "</a>";
            }
            if ($task["completion"] == 100) {
                $name = "<s>{$name}</s>";
            }
            // Priority
            $priority = print_priority_flag_image($task['priority'], true);
            // Branches
            $branches_json = json_encode($branches);
            echo "<a onfocus='JavaScript: this.blur()' href='javascript: loadTasksSubTree(" . $task['id_project'] . "," . $task['id'] . ",\"" . $branches_json . "\", " . $task['id'] . ",\"" . $sql_search . "\")'>";
            echo "<script type=\"text/javascript\">\n\t\t\t\t\t  \$(document).ready (function () {\n\t\t\t\t\t\t  loadTasksSubTree(" . $task['id_project'] . "," . $task['id'] . ",\"" . $branches_json . "\", " . $task['id'] . ",\"" . $sql_search . "\");\n\t\t\t\t\t  });\n\t\t\t\t  </script>";
            echo $img;
            echo "</a>";
            echo "<span title='" . __('You are not assigned to this task') . "' style='padding: 4px;'>";
            echo "<span style='vertical-align:middle; display: inline-block;'>" . $priority . "</span>";
            echo "<span style='color: #D8D8D8; margin-left: 5px; display: inline-block;'>" . $name . "</span>";
            echo "</span>";
        }
        echo "<div hiddenDiv='1' loadDiv='0' style='display: none; margin: 0px; padding: 0px;' class='tree_view tree_div_" . $task['id'] . "' id='tree_div" . $task['id'] . "_task_" . $task['id'] . "'></div>";
        echo "</li>";
    }
    echo "</ul>";
    echo "</td></tr>";
    echo "</table>";
    return;
}
Пример #15
0
 echo "</div>\n";
 echo "<h4 class='m-t-10 m-b-0'><strong>" . $userdata['user_name'] . "</strong></h4>\n";
 echo "<small>" . getuserlevel($userdata['user_level']) . "</small>\n<br/>";
 echo "</div>\n";
 echo "<ul class='user-info-bar'>\n";
 echo $msg_count ? "<li><a href='" . BASEDIR . "messages.php?folder=inbox' title='" . sprintf($locale['UM085'], $msg_count) . ($msg_count == 1 ? $locale['UM086'] : $locale['UM087']) . "' ><i class='entypo icomment'></i><label style='position:absolute; margin-left:-20px;' class='pointer label label-danger'>{$msg_count}</label></a>\n</li>\n" : "";
 echo "</ul>\n";
 $inbox_cfg = user_pm_settings($userdata['user_id'], "user_inbox");
 $inbox_percent = $inbox_cfg > 1 ? number_format($inbox_count / $inbox_cfg * 99, 0) : number_format(0 * 99, 0);
 echo progress_bar($inbox_percent, $locale['UM098'], FALSE, FALSE, FALSE, TRUE, $inbox_cfg == 0 ? TRUE : FALSE);
 $outbox_cfg = user_pm_settings($userdata['user_id'], "user_outbox");
 $outbox_percent = $outbox_cfg > 1 ? number_format($outbox_count / $outbox_cfg * 99, 0) : number_format(0 * 99, 0);
 echo progress_bar($outbox_percent, $locale['UM099'], FALSE, FALSE, FALSE, TRUE, $inbox_cfg == 0 ? TRUE : FALSE);
 $archive_cfg = user_pm_settings($userdata['user_id'], "user_archive");
 $archive_percent = $archive_cfg > 1 ? number_format($archive_count / $archive_cfg * 99, 0) : number_format(0 * 99, 0);
 echo progress_bar($archive_percent, $locale['UM100'], FALSE, FALSE, FALSE, TRUE, $inbox_cfg == 0 ? TRUE : FALSE);
 echo "<div id='navigation-user'>\n";
 echo "<h5><strong>" . $locale['UM097'] . "</strong></h5>\n";
 echo "<hr class='side-hr'>\n";
 echo "<ul>\n";
 echo "<li><a class='side' href='" . BASEDIR . "edit_profile.php'>" . $locale['UM080'] . " <i class='pull-right entypo suitcase'></i></a></li>\n";
 echo "<li><a class='side' href='" . BASEDIR . "messages.php'>" . $locale['UM081'] . " <i class='pull-right entypo mail'></i></a></li>\n";
 if (db_exists(DB_FORUM_THREADS)) {
     echo "<li><a class='side' href='" . INFUSIONS . "forum_threads_list_panel/my_tracked_threads.php'>" . $locale['UM088'] . " <i class='pull-right entypo eye'></i></a></li>\n";
 }
 echo "<li><a class='side' href='" . BASEDIR . "members.php'>" . $locale['UM082'] . " <i class='pull-right entypo users'></i></a></li>\n";
 echo iADMIN ? "<li><a class='side' href='" . ADMIN . "index.php" . $aidlink . "&amp;pagenum=0'>" . $locale['UM083'] . " <i class='pull-right entypo cog'></i></a></li>\n" : '';
 if ($installedModules) {
     echo "<li><a class='side' href=\"javascript:show_hide('ShowHide001')\">" . $locale['UM089'] . " <i class='pull-right entypo upload-cloud'></i></a></li>\n";
     echo "<li>\n";
     echo "<div id='ShowHide001' style='display:none'>\n";
        	<a href="<?php 
print base_url('topic/item/' . $topic_id_x);
?>
"><?php 
print $topic_info_y['topic_words'];
?>
</a>
        </div>
	</p>
	<h3><var>&alpha;</var></h3>
	<p>
        <?php 
print progress_bar('success', $topic_info_x['topic_alpha'], 0, $alpha_stats['max'], $topic_info_x['topic_alpha']);
?>
        <?php 
print progress_bar('success', $topic_info_y['topic_alpha'], 0, $alpha_stats['max'], $topic_info_y['topic_alpha']);
?>
    </p>
    <p>
    	<?php 
print img($img_x);
?>
	    <?php 
print img($img_y);
?>
    </p>
</div>

<div class="col-md-4">
   <h2>Common Docs</h2>
   <?php 
Пример #17
0
 echo "</div>\n";
 echo "<h4 class='m-t-10 m-b-0'><strong>" . $userdata['user_name'] . "</strong></h4>\n";
 echo "<small>" . getuserlevel($userdata['user_level']) . "</small>\n<br/>";
 echo "</div>\n";
 echo "<ul class='user-info-bar'>\n";
 echo $msg_count ? "<li><a href='" . BASEDIR . "messages.php?folder=inbox' title='" . sprintf($locale['UM085'], $msg_count) . ($msg_count == 1 ? $locale['UM086'] : $locale['UM087']) . "' ><i class='entypo icomment'></i><label style='position:absolute; margin-left:-20px;' class='pointer label label-danger'>{$msg_count}</label></a>\n</li>\n" : "";
 echo "</ul>\n";
 $inbox_cfg = user_pm_settings($userdata['user_id'], "user_inbox");
 $inbox_percent = $inbox_cfg > 1 ? number_format($inbox_count / $inbox_cfg * 99, 0) : number_format(0 * 99, 0);
 echo progress_bar($inbox_percent, $locale['UM098']);
 $outbox_cfg = user_pm_settings($userdata['user_id'], "user_outbox");
 $outbox_percent = $outbox_cfg > 1 ? number_format($outbox_count / $outbox_cfg * 99, 0) : number_format(0 * 99, 0);
 echo progress_bar($outbox_percent, $locale['UM099']);
 $archive_cfg = user_pm_settings($userdata['user_id'], "user_archive");
 $archive_percent = $archive_cfg > 1 ? number_format($archive_count / $archive_cfg * 99, 0) : number_format(0 * 99, 0);
 echo progress_bar($archive_percent, $locale['UM100']);
 echo "<div id='navigation-user'>\n";
 echo "<h5><strong>" . $locale['UM097'] . "</strong></h5>\n";
 echo "<hr class='side-hr'>\n";
 echo "<ul>\n";
 echo "<li><a class='side' href='" . BASEDIR . "edit_profile.php'>" . $locale['UM080'] . " <i class='pull-right entypo suitcase'></i></a></li>\n";
 echo "<li><a class='side' href='" . BASEDIR . "messages.php'>" . $locale['UM081'] . " <i class='pull-right entypo mail'></i></a></li>\n";
 if (db_exists(DB_FORUM_THREADS)) {
     echo "<li><a class='side' href='" . INFUSIONS . "forum_threads_list_panel/my_tracked_threads.php'>" . $locale['UM088'] . " <i class='pull-right entypo eye'></i></a></li>\n";
 }
 echo "<li><a class='side' href='" . BASEDIR . "members.php'>" . $locale['UM082'] . " <i class='pull-right entypo users'></i></a></li>\n";
 echo iADMIN ? "<li><a class='side' href='" . ADMIN . "index.php" . $aidlink . "&amp;pagenum=0'>" . $locale['UM083'] . " <i class='pull-right entypo cog'></i></a></li>\n" : '';
 if ($installedModules) {
     echo "<li><a class='side' href=\"javascript:show_hide('ShowHide001')\">" . $locale['UM089'] . " <i class='pull-right entypo upload-cloud'></i></a></li>\n";
     echo "<li>\n";
     echo "<div id='ShowHide001' style='display:none'>\n";
Пример #18
0
function show_task_row ($table, $id_project, $task, $level) {
	global $config;
	global $graph_ttl;
	
	$data = array ();

	// Task  name
	$data[0] = '';
	
	for ($i = 0; $i < $level; $i++)
		$data[0] .= '<img src="images/small_arrow_right_green.gif" style="position: relative; top: 5px;"> ';
		
	
	$data[0] .= '<a href="index.php?sec=projects&sec2=operation/projects/task_detail&id_project='. $id_project.'&id_task='.$task['id'].'&operation=view">'. $task['name'].'</a>';

	// Priority
    $data[1] = print_priority_flag_image ($task['priority'], true);
	
	// Completion
	
	$data[2] = progress_bar($task["completion"], 70, 20, $graph_ttl);
	
	// Estimation
	$imghelp = "Estimated hours = ".$task["hours"];
	$taskhours = get_task_workunit_hours ($task["id"]);

	$imghelp .= ", Worked hours = $taskhours";
	$a = round ($task["hours"]);
	$b = round ($taskhours);
	$mode = 2;

	if ($a > 0)
		$data[3] = histogram_2values($a, $b, __("Planned"), __("Real"), $mode, 60, 18, $imghelp, $graph_ttl);
	else
		$data[3] = '--';

	// Time used on all child tasks + this task
	$recursive_timeused = task_duration_recursive ($task["id"]);
	
	if ($taskhours == 0)
		$data[4] = "--";
	elseif ($taskhours == $recursive_timeused)
		$data[4] = $taskhours;
	else
		$data[4] = $taskhours . "<span title='Subtasks WU/HR'> (".$recursive_timeused. ")</span>";
		
	$wu_incidents = get_incident_task_workunit_hours ($task["id"]);
	
	
	if ($wu_incidents > 0)
	$data[4] .= "<span title='".__("Time spent in related tickets")."'> ($wu_incidents) </span>";

	// People
	$data[5] = combo_users_task ($task['id'], 1, true);
	$data[5] .= ' ';
	$data[5] .= get_db_value ('COUNT(DISTINCT(id_user))', 'trole_people_task', 'id_task', $task['id']);

	if ($task["start"] == $task["end"]){
		$data[6] = date ('Y-m-d', strtotime ($task['start'])) . "<br>";
		$data[6] .= __('Recurrence').': '.get_periodicity ($task['periodicity']);
	} else {
		// Start
		$start = strtotime ($task['start']);
		$end = strtotime ($task['end']);
		$now = time ();
		
		$data[6] = date ('Y-m-d', $start) ."<br>";
		
		if ($task['completion'] == 100) {
			$data[6] .= '<span style="color: green">';
		} else {
			if ($now > $end)
				$data[6] .= '<span style="color: red">';
			else
				$data[6] .= '<span>';
		}
		$data[6] .= date ('Y-m-d', $end);
		$data[6] .= '</span>';
	}

	array_push ($table->data, $data);
}
Пример #19
0
	//echo print_container('project_info', __('Project info'), $project_info, 'open', false, '10px', '', '', 5, 'no_border_bottom');

}

if ($id_project) {

// Project info
echo '<div class="divform">';
echo '<table class="search-table">';
	//progress bar
	echo "<tr>";
		echo '<td colspan=2><b>'.__('Current progress').' </b></td>';
	echo "</tr><tr>";
		echo '<td colspan=2><span>';
		$completion =  format_numeric(calculate_project_progress ($id_project));
		echo progress_bar($completion, 218, 20, $graph_ttl);
		echo "</span></td>";
	echo "</tr>";
	
	// Name
	echo '<tr>';
		echo '<td colspan=2><b>'.__('Name').' </b></td>';
	echo "</tr><tr>";
		echo '<td colspan=2><input type="text" name="name" value="'.$name.'"></td>';
	echo '</tr>';
	
	// Owner
	$id_owner = get_db_value ( 'id_owner', 'tproject', 'id', $id_project);
	echo '<tr>';
		echo "<td colspan=2><b>".__('Manager')." </b></td>";
	echo "</tr><tr>";
?>
</div>

<div class="col-md-4">
    <h2>Nearest Documents</h2>
    <div>
        <p>These are documents are similar to the current
        document by virtue of their distribution over topics.
        This similarity is calculated as the Helinger Distance, 
        which is roughly proportional to the Jensen-Shannon Divergence,
        but much less expensive to compute. Note that the average 
        distance between documents in this corpus is 
        <b><?php 
print round($avg_distance, 3);
?>
</b>.</p>
    </div>
    <?php 
$vmin = 0;
$vmax = 1;
foreach ($related_docs as $doc) {
    $vnow = round($doc['distance'], 3);
    $doc_url = base_url('doc/item/' . $doc['doc_id_2']);
    print "<div class='data-item'>";
    print "<a href='{$doc_url}'>" . $doc['title'] . "</a>";
    print progress_bar('success', $vnow, 0, 1.4, $vnow);
    print "</div>";
}
?>
</div>
Пример #21
0
$table->style = array();
$table->data = array();
$table->style[0] = "vertical-align: top;";
$table->style[1] = "vertical-align: top";
// Project info
$project_info = '<table class="search-table-button" style="margin-top: 0px;">';
// Name
$project_info .= '<tr><td class="datos" colspan=3><b>' . __('Name') . ' </b><br>';
$project_info .= $name;
$project_info .= '<td colspan=1>';
//Only show project progress if there is a project created
if ($id_project) {
    $project_info .= '<b>' . __('Current progress') . ' </b><br>';
    $project_info .= '<span style="vertical-align:bottom">';
    $completion = format_numeric(calculate_project_progress($id_project));
    $project_info .= progress_bar($completion, 90, 20, $graph_ttl);
    $project_info .= "</span>";
}
$project_info .= "</td>";
$project_info .= "</tr>";
// start and end date
$project_info .= '<tr><td width="25%"><b>' . __('Start') . ' </b><br>';
$project_info .= $start_date;
$project_info .= '<td width="25%"><b>' . __('End') . ' </b><br>';
$project_info .= $end_date;
$id_owner = get_db_value('id_owner', 'tproject', 'id', $id_project);
$project_info .= '<td width="25%">';
$project_info .= "<b>" . __('Project manager') . " </b><br>";
$project_info .= get_db_value("nombre_real", "tusuario", "id_usuario", $owner);
$project_info .= '<td width="25%"><b>';
$project_info .= __('Project group') . "</b><br>";
Пример #22
0
 /**
  * Thread Class constructor - This builds all essential data on load.
  */
 public function __construct()
 {
     global $locale, $userdata, $settings, $forum_settings;
     // exit no.1
     if (!isset($_GET['thread_id']) && !isnum($_GET['thread_id'])) {
         redirect(INFUSIONS . 'forum/index.php');
     }
     $thread_data = \PHPFusion\Forums\Functions::get_thread($_GET['thread_id']);
     // fetch query and define iMOD
     if (!empty($thread_data)) {
         $thread_stat = self::get_thread_stats($_GET['thread_id']);
         // get post_count, lastpost_id, first_post_id.
         if ($thread_data['forum_type'] == 1) {
             redirect(INFUSIONS . 'forum/index.php');
         }
         if ($thread_stat['post_count'] < 1) {
             redirect(INFUSIONS . 'forum/index.php');
         }
         // Set meta
         add_to_meta($locale['forum_0000']);
         if ($thread_data['forum_description'] !== '') {
             add_to_meta('description', $thread_data['forum_description']);
         }
         if ($thread_data['forum_meta'] !== '') {
             add_to_meta('keywords', $thread_data['forum_meta']);
         }
         add_to_title($thread_data['thread_subject']);
         // Set Forum Breadcrumbs
         $this->forum_index = dbquery_tree(DB_FORUMS, 'forum_id', 'forum_cat');
         add_breadcrumb(array('link' => INFUSIONS . 'forum/index.php', 'title' => $locale['forum_0000']));
         forum_breadcrumbs($this->forum_index, $thread_data['forum_id']);
         add_breadcrumb(array('link' => INFUSIONS . 'forum/viewthread.php?forum_id=' . $thread_data['forum_id'] . '&amp;thread_id=' . $thread_data['thread_id'], 'title' => $thread_data['thread_subject']));
         $this->setThreadPermission($thread_data);
         // Sanitizes $_GETs
         $_GET['forum_id'] = $thread_data['forum_id'];
         /**
          * Generate User Tracked Buttons
          */
         $this->thread_info['buttons']['notify'] = array();
         if ($this->getThreadPermission("can_access")) {
             // only member can track the thread
             if ($thread_data['user_tracked']) {
                 $this->thread_info['buttons']['notify'] = array('link' => INFUSIONS . "forum/postify.php?post=off&amp;forum_id=" . $thread_data['forum_id'] . "&amp;thread_id=" . $thread_data['thread_id'], 'title' => $locale['forum_0174']);
             } else {
                 $this->thread_info['buttons']['notify'] = array('link' => INFUSIONS . "forum/postify.php?post=on&amp;forum_id=" . $thread_data['forum_id'] . "&amp;thread_id=" . $thread_data['thread_id'], 'title' => $locale['forum_0175']);
             }
         }
         /**
          * Generate Quick Reply Form
          */
         $qr_form = "";
         if ($this->getThreadPermission("can_reply") == TRUE && $thread_data['forum_quick_edit'] == TRUE) {
             $qr_form = "<!--sub_forum_thread-->\n";
             $form_url = INFUSIONS . "forum/viewthread.php?thread_id=" . $thread_data['thread_id'];
             $qr_form .= openform('quick_reply_form', 'post', $form_url, array('class' => 'm-b-20 m-t-20'));
             $qr_form .= "<h4 class='m-t-20 pull-left'>" . $locale['forum_0168'] . "</h4>\n";
             $qr_form .= form_textarea('post_message', $locale['forum_0601'], '', array('bbcode' => true, 'required' => true, 'autosize' => true, 'preview' => true, 'form_name' => 'quick_reply_form'));
             $qr_form .= "<div class='m-t-10 pull-right'>\n";
             $qr_form .= form_button('post_quick_reply', $locale['forum_0172'], $locale['forum_0172'], array('class' => 'btn-primary btn-sm m-r-10'));
             $qr_form .= "</div>\n";
             $qr_form .= "<div class='overflow-hide'>\n";
             $qr_form .= form_checkbox('post_smileys', $locale['forum_0169'], '', array('class' => 'm-b-0'));
             if (array_key_exists("user_sig", $userdata) && $userdata['user_sig']) {
                 $qr_form .= form_checkbox('post_showsig', $locale['forum_0170'], '1', array('class' => 'm-b-0'));
             }
             if ($forum_settings['thread_notify']) {
                 $qr_form .= form_checkbox('notify_me', $locale['forum_0171'], $thread_data['user_tracked'], array('class' => 'm-b-0'));
             }
             $qr_form .= "</div>\n";
             $qr_form .= closeform();
         }
         /**
          * Generate Poll Form
          */
         $poll = array();
         $poll_form = "";
         if ($this->getThreadPermission("can_access") && $thread_data['thread_poll'] == TRUE) {
             $poll_result = dbquery("SELECT\n\t\t\t\tpoll_opts.*, poll.forum_poll_title, poll.forum_poll_votes\n\t\t\t\tFROM " . DB_FORUM_POLL_OPTIONS . " poll_opts\n\t\t\t\tINNER JOIN " . DB_FORUM_POLLS . " poll using (thread_id)\n\t\t\t\tWHERE poll.thread_id='" . intval($thread_data['thread_id']) . "'\n\t\t\t\t");
             if (dbrows($poll_result) > 0) {
                 $i = 0;
                 // Construct poll data - model
                 while ($pdata = dbarray($poll_result)) {
                     if ($i == 0) {
                         $poll['forum_poll_title'] = $pdata['forum_poll_title'];
                         $poll['forum_poll_votes'] = $pdata['forum_poll_votes'];
                         $poll['forum_poll_max_options'] = dbrows($poll_result);
                     }
                     $poll['forum_poll_options'][$pdata['forum_poll_option_id']] = $pdata;
                     $i++;
                 }
                 // SQL cast poll vote
                 if (isset($_POST['poll_option']) && isnum($_POST['poll_option']) && $_POST['poll_option'] <= $poll['forum_poll_max_options']) {
                     if ($this->getThreadPermission("can_vote_poll") == TRUE) {
                         $pollInput['poll_option_id'] = stripinput($_POST['poll_option']);
                         global $defender;
                         if ($defender->safe()) {
                             dbquery("UPDATE " . DB_FORUM_POLL_OPTIONS . " SET forum_poll_option_votes=forum_poll_option_votes+1 WHERE thread_id='" . intval($thread_data['thread_id']) . "' AND forum_poll_option_id='" . intval($pollInput['poll_option_id']) . "'");
                             dbquery("UPDATE " . DB_FORUM_POLLS . " SET forum_poll_votes=forum_poll_votes+1 WHERE thread_id='" . intval($thread_data['thread_id']) . "'");
                             dbquery("INSERT INTO " . DB_FORUM_POLL_VOTERS . " (thread_id, forum_vote_user_id, forum_vote_user_ip, forum_vote_user_ip_type) VALUES ('" . $thread_data['thread_id'] . "', '" . $userdata['user_id'] . "', '" . USER_IP . "', '" . USER_IP_TYPE . "')");
                             addNotice('success', $locale['forum_0614']);
                             redirect(INFUSIONS . "forum/viewthread.php?forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id']);
                         } else {
                             addNotice("danger", "You are not eligible to cast a vote in the poll.");
                         }
                     }
                 }
                 $poll_form_start = "";
                 $poll_form_end = "";
                 if ($this->getThreadPermission("can_vote_poll")) {
                     $poll_form_start = openform("poll_vote_form", "post", INFUSIONS . "forum/viewthread.php?thread_id=" . $thread_data['thread_id']);
                     $poll_form_end = form_button('vote', $locale['forum_2010'], 'vote', array('class' => 'btn btn-sm btn-primary m-l-20 '));
                     $poll_form_end .= closeform();
                 }
                 // need to fix security.
                 if ($this->getThreadPermission("can_edit_poll")) {
                     $poll_form .= "<div class='pull-right btn-group'>\n";
                     $poll_form .= "<a class='btn btn-sm btn-default' href='" . INFUSIONS . "forum/viewthread.php?action=editpoll&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id'] . "'>" . $locale['forum_0603'] . "</a>\n";
                     $poll_form .= "<a class='btn btn-sm btn-default' href='" . INFUSIONS . "forum/viewthread.php?action=deletepoll&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id'] . "' onclick='confirm('" . $locale['forum_0616'] . "');'>" . $locale['delete'] . "</a>\n";
                     $poll_form .= "</div>\n";
                 }
                 $poll_form .= $poll_form_start;
                 $poll_form .= "<h3 class='strong m-b-10'><i class='fa fa-fw fa-pie-chart fa-lg'></i>" . $locale['forum_0377'] . " : " . $poll['forum_poll_title'] . "</h3>\n";
                 $poll_form .= "<ul class='p-l-20 p-t-0'>\n";
                 if (!empty($poll['forum_poll_options'])) {
                     $i = 1;
                     $vote_options = $poll['forum_poll_options'];
                     foreach ($vote_options as $poll_option) {
                         if ($this->getThreadPermission("can_vote_poll") == TRUE) {
                             $poll_form .= "<li><label for='opt-" . $i . "'><input id='opt-" . $i . "' type='radio' name='poll_option' value='" . $i . "' class='m-r-20'> <span class='m-l-10'>" . $poll_option['forum_poll_option_text'] . "</span>\n</label></li>\n";
                         } else {
                             $option_votes = $poll['forum_poll_votes'] ? number_format(100 / $poll['forum_poll_votes'] * $poll_option['forum_poll_option_votes']) : 0;
                             $poll_form .= progress_bar($option_votes, $poll_option['forum_poll_option_text'], '', '10px');
                         }
                         $i++;
                     }
                 }
                 $poll_form .= "</ul>\n";
                 $poll_form .= $poll_form_end;
             }
         }
         /**
          * Generate Attachment
          */
         $attachments = array();
         if ($this->getThreadPermission("can_download_attach") == TRUE) {
             $a_result = dbquery("SELECT * FROM " . DB_FORUM_ATTACHMENTS . " WHERE thread_id='" . intval($thread_data['thread_id']) . "' ORDER BY post_id ASC");
             if (dbrows($a_result) > 0) {
                 while ($a_data = dbarray($a_result)) {
                     if (file_exists(INFUSIONS . "forum/attachments/" . $a_data['attach_name'])) {
                         //$this->thread_info['attachments'][$a_data['post_id']][] = $a_data;
                         $attachments[$a_data['post_id']][] = $a_data;
                     }
                 }
             }
         }
         /**
          * Generate Mod Form
          */
         if (iMOD) {
             // need to wrap with issets?
             $mod = new Moderator();
             $mod->setForumId($thread_data['forum_id']);
             $mod->setThreadId($thread_data['thread_id']);
             $mod->set_modActions();
             /**
              * Thread moderation form template
              */
             $this->thread_info['mod_options'] = array('renew' => $locale['forum_0207'], 'delete' => $locale['forum_0201'], $thread_data['thread_locked'] ? "unlock" : "lock" => $thread_data['thread_locked'] ? $locale['forum_0203'] : $locale['forum_0202'], $thread_data['thread_sticky'] ? "nonsticky" : "sticky" => $thread_data['thread_sticky'] ? $locale['forum_0205'] : $locale['forum_0204'], 'move' => $locale['forum_0206']);
             $addition = isset($_GET['rowstart']) ? "&amp;rowstart=" . intval($_GET['rowstart']) : "";
             $this->thread_info['form_action'] = INFUSIONS . "forum/viewthread.php?thread_id=" . intval($thread_data['thread_id']) . $addition;
             $this->thread_info['open_post_form'] = openform('moderator_menu', 'post', $this->thread_info['form_action']);
             $this->thread_info['close_post_form'] = closeform();
             /*
             * <a id='check' class='btn button btn-sm btn-default text-dark' href='#' onclick=\"javascript:setChecked('mod_form','delete_post[]',1);return false;\">".$locale['forum_0080']."</a>\n
             						<a id='uncheck' class='btn button btn-sm btn-default text-dark' href='#' onclick=\"javascript:setChecked('mod_form','delete_post[]',0);return false;\">".$locale['forum_0081']."</a>\n
             */
             $this->thread_info['mod_form'] = "\n\t\t\t\t<div class='list-group-item'>\n\n\t\t\t\t\t<div class='btn-group m-r-10'>\n\n\t\t\t\t\t\t" . form_button("check_all", $locale['forum_0080'], $locale['forum_0080'], array('class' => 'btn-default btn-sm', "type" => "button")) . "\n\t\t\t\t\t\t" . form_button("check_none", $locale['forum_0081'], $locale['forum_0080'], array('class' => 'btn-default btn-sm', "type" => "button")) . "\n\t\t\t\t\t</div>\n\n\t\t\t\t\t" . form_button('move_posts', $locale['forum_0176'], $locale['forum_0176'], array('class' => 'btn-default btn-sm m-r-10')) . "\n\t\t\t\t\t" . form_button('delete_posts', $locale['forum_0177'], $locale['forum_0177'], array('class' => 'btn-default btn-sm')) . "\n\t\t\t\t\t<div class='pull-right'>\n\t\t\t\t\t\t" . form_button('go', $locale['forum_0208'], $locale['forum_0208'], array('class' => 'btn-default pull-right btn-sm m-t-0 m-l-10')) . "\n\t\t\t\t\t\t" . form_select('step', '', '', array('options' => $this->thread_info['mod_options'], 'placeholder' => $locale['forum_0200'], 'width' => '250px', 'allowclear' => 1, 'class' => 'm-b-0 m-t-5', 'inline' => 1)) . "\n\t\t\t\t\t</div>\n\n\t\t\t\t</div>\n";
             add_to_jquery("\n\t\t\t\t\$('#check_all').bind('click', function() {\n\t\t\t\t    var thread_posts = \$('#moderator_menu input:checkbox').prop('checked', true);\n\t\t\t\t});\n\t\t\t\t\$('#check_none').bind('click', function() {\n\t\t\t\t    var thread_posts = \$('#moderator_menu input:checkbox').prop('checked', false); });\n\t\t\t\t");
         }
         $this->thread_info += array("thread" => $thread_data, "thread_id" => $thread_data['thread_id'], "forum_id" => $thread_data['forum_id'], "forum_cat" => isset($_GET['forum_cat']) && verify_forum($_GET['forum_cat']) ? $_GET['forum_cat'] : 0, "forum_branch" => isset($_GET['forum_branch']) && verify_forum($_GET['forum_branch']) ? $_GET['forum_branch'] : 0, "forum_link" => array("link" => INFUSIONS . "forum/index.php?viewforum&amp;forum_id=" . $thread_data['forum_id'] . "&amp;forum_cat=" . $thread_data['forum_cat'] . "&amp;forum_branch=" . $thread_data['forum_branch'], "title" => $thread_data['forum_name']), "post_id" => isset($_GET['post_id']) && verify_post($_GET['post_id']) ? $_GET['post_id'] : 0, "pid" => isset($_GET['pid']) && isnum($_GET['pid']) ? $_GET['pid'] : 0, "section" => isset($_GET['section']) ? $_GET['section'] : '', "forum_moderators" => Functions::parse_forumMods($thread_data['forum_mods']), "max_post_items" => $thread_stat['post_count'], "post_firstpost" => $thread_stat['first_post_id'], "post_lastpost" => $thread_stat['last_post_id'], "posts_per_page" => $forum_settings['posts_per_page'], "threads_per_page" => $forum_settings['threads_per_page'], "lastvisited" => isset($userdata['user_lastvisit']) && isnum($userdata['user_lastvisit']) ? $userdata['user_lastvisit'] : time(), "allowed_post_filters" => array('oldest', 'latest', 'high'), "attachtypes" => explode(",", $forum_settings['forum_attachtypes']), "quick_reply_form" => $qr_form, "poll_form" => $poll_form, "post-filters" => "", 'mod_options' => array(), 'form_action' => '', 'open_post_form' => '', 'close_post_form' => '', 'mod_form' => '');
         /**
          * Generate All Thread Buttons
          */
         $this->thread_info['buttons'] += array("print" => array("link" => BASEDIR . "print.php?type=F&amp;item_id=" . $thread_data['thread_id'] . "&amp;rowstart=" . $_GET['rowstart'], "title" => $locale['forum_0178']), "newthread" => $this->getThreadPermission("can_post") == TRUE ? array("link" => INFUSIONS . "forum/newthread.php?forum_id=" . $thread_data['forum_id'], "title" => $locale['forum_0264']) : array(), "reply" => $this->getThreadPermission("can_reply") == TRUE ? array("link" => INFUSIONS . "forum/viewthread.php?action=reply&amp;forum_id=" . $thread_data['forum_id'] . "&amp;thread_id=" . $thread_data['thread_id'], "title" => $locale['forum_0360']) : array(), "poll" => $this->getThreadPermission("can_create_poll") == TRUE ? array("link" => INFUSIONS . "forum/viewthread.php?action=newpoll&amp;forum_id=" . $thread_data['forum_id'] . "&amp;thread_id=" . $thread_data['thread_id'], "title" => $locale['forum_0366']) : array());
         /**
          * Generate Post Filters
          */
         $this->thread_info['post-filters'][0] = array('value' => INFUSIONS . 'forum/viewthread.php?thread_id=' . $thread_data['thread_id'] . '&amp;section=oldest', 'locale' => $locale['forum_0180']);
         $this->thread_info['post-filters'][1] = array('value' => INFUSIONS . 'forum/viewthread.php?thread_id=' . $thread_data['thread_id'] . '&amp;section=latest', 'locale' => $locale['forum_0181']);
         if ($this->getThreadPermission("can_rate") == TRUE) {
             $this->thread_info['allowed-post-filters'][2] = 'high';
             $this->thread_info['post-filters'][2] = array('value' => INFUSIONS . 'forum/viewthread.php?thread_id=' . $this->thread_info['thread_id'] . '&amp;section=high', 'locale' => $locale['forum_0182']);
         }
         $this->handle_quick_reply();
         $this->get_thread_post();
         //self::set_ThreadJs();
         // execute in the end.
         //self::set_ForumPostDB();
     } else {
         redirect(FORUM . 'index.php');
     }
 }
Пример #23
0
	
	$project_permission = get_project_access ($config['id_user'], $project['id']);
	if (!$project_permission['read']) {
		continue;
	}
	$data = array ();
	
	// Project name
	$data[0] = '<a href="index.php?sec=projects&sec2=operation/projects/project_detail&id_project='.$project['id'].'">'.$project['name'].'</a>';
	$data[1] = $project["id_owner"];

	if ($project["start"] == $project["end"]) {
		$data[2] = __('Unlimited');
	} else {
		$completion = format_numeric (calculate_project_progress ($project['id']));
		$data[2] = progress_bar($completion, 90, 20);
	}

	// Last update time
	$sql = sprintf ('SELECT tworkunit.timestamp
		FROM ttask, tworkunit_task, tworkunit
		WHERE ttask.id_project = %d
		AND ttask.id = tworkunit_task.id_task
		AND tworkunit_task.id_workunit = tworkunit.id
		ORDER BY tworkunit.timestamp DESC LIMIT 1',
		$project['id']);
	$timestamp = get_db_sql ($sql);
	if ($timestamp != "")
		$data[3] = "<span style='font-size: 10px'>".human_time_comparation ($timestamp)."</span>";
	else
		$data[3] = __('Never');
Пример #24
0
                 $queryanswer = DB::run()->query("SELECT `answer_option`, `answer_result` FROM `voteanswer` WHERE `answer_vote_id`=? ORDER BY `answer_result` DESC;", array($id));
                 $answer = $queryanswer->fetchAssoc();
                 $total = count($answer);
                 $sum = $votes['vote_count'];
                 $max = max($answer);
                 if (empty($sum)) {
                     $sum = 1;
                 }
                 if (empty($max)) {
                     $max = 1;
                 }
                 foreach ($answer as $key => $data) {
                     $proc = round($data * 100 / $sum, 1);
                     $maxproc = round($data * 100 / $max);
                     echo '<b>' . $key . '</b> (Голосов: ' . $data . ')<br />';
                     progress_bar($maxproc, $proc . '%') . '<br /><br />';
                 }
                 echo 'Вариантов: <b>' . $total . '</b><br /><br />';
                 if (!empty($_GET['result'])) {
                     echo '<img src="/images/img/stat.gif" alt="image" /> <a href="index.php?act=poll&amp;id=' . $id . '">К вариантам</a><br />';
                 }
                 echo '<img src="/images/img/users.gif" alt="image" /> <a href="index.php?act=voters&amp;id=' . $id . '">Проголосовавшие</a><br />';
             }
         } else {
             show_error('Ошибка! Для данного голосования не созданы варианты ответов!');
         }
     } else {
         show_error('Ошибка! Данный опрос закрыт для голосования!');
     }
 } else {
     show_error('Ошибка! Данного голосования не существует!');
Пример #25
0
 lue_data_echo($lue_data_output_text, true);
 $lue_data_output_text = "";
 $rivilaskuri = 1;
 $puun_alkio_index_plus = 0;
 // REST-api ei salli etenemispalkkia
 if ((!$cli or $lue_data_output_file != "") and !isset($api_kentat)) {
     $bar = new ProgressBar();
     $bar->initialize($rivimaara);
 }
 $lisatyt_indeksit = array();
 for ($eriviindex = 0; $eriviindex < $rivimaara + $puun_alkio_index_plus; $eriviindex++) {
     // Komentorivillä piirretään progressbar, ellei ole output loggaus päällä
     // REST-api skippaa
     if (!isset($api_kentat)) {
         if ($cli and $lue_data_output_file == "") {
             progress_bar($eriviindex, $max_rivit);
         } elseif (!$cli or $lue_data_output_file != "") {
             $bar->increase();
         }
     }
     $hylkaa = 0;
     $tila = "";
     $tee = "";
     $epakurpvm = "";
     $eilisataeikamuuteta = "";
     $rivilaskuri++;
     //asiakashinta/asiakasalennus/toimittajahinta/toimittajaalennus spessuja
     $chasiakas_ryhma = '';
     $chytunnus = '';
     $chryhma = '';
     $chtuoteno = '';
Пример #26
0
 * @subpackage Installer
*/
if (!defined('ROSTER_INSTALLED')) {
    exit('Detected invalid access to this file!');
}
include_once 'lib_progressbar.php';
$query = "SELECT *\n\tFROM `" . $roster->db->table('Quest', 'Key_BC') . "` P\n\tWHERE P.`id` = '" . $tmpKey['id'] . "'\n\tAND P.`lang` = '" . $row['clientLocale'] . "'\n\tAND P.`Faction` = '" . $Faction . "'\n\t\n\t";
$result_tt = $roster->db->query($query) or die_quietly($roster->db->error(), 'Database Error', basename(__FILE__), __LINE__, $query);
$current = 0;
$max = 100;
if ($row3 = $roster->db->fetch($result_tt)) {
    $tmp2 = explode('|', $row3['part']);
    $Aff = $roster->locale->act['Objective'] . ' : ' . $tmp2[0] . ' => ' . $tmp2[1] . '<br/>';
    $query = "SELECT *\n\t\tFROM `" . $roster->db->table('reputation') . "` r\n\t\tWHERE r.`member_id` = '" . $row['member_id'] . "'\n\t\tAND r.`name` = '" . addslashes($tmp2[0]) . "'\n\t\t";
    $result_rep = $roster->db->query($query) or die_quietly($roster->db->error(), 'Database Error', basename(__FILE__), __LINE__, $query);
    if ($row4 = $roster->db->fetch($result_rep)) {
        $Aff .= $roster->locale->act['Current'] . ' : ';
        $Aff .= '<span style="color:#' . $colorcur . '">';
        $Aff .= $row4['Standing'] . ' ' . $row4['curr_rep'] . '/' . $row4['max_rep'];
        $Aff .= '</span>';
        $current = $row4['curr_rep'];
        $max = $row4['max_rep'];
        $tt = makeOverlib($Aff, $tmpKey['key_name'], '', 0, '', '');
    } else {
        $tt = '';
    }
} else {
    $tt = '';
}
$tab_key[$i] = '<a href="#" ' . $tt . '>' . $roster->locale->act['Reputation'] . '<br/>' . progress_bar($current, $max, 40, 2) . '</a>';
Пример #27
0
 /**
  * Creates the blocks main content
  *
  * @return string
  */
 public function get_content()
 {
     // Access to settings needed
     global $USER, $COURSE, $CFG, $DB, $OUTPUT;
     // If content has already been generated, don't waste time generating it again
     if ($this->content !== null) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     // Check if any activities/resources have been created
     $modules = modules_in_use();
     if (empty($modules)) {
         if (has_capability('moodle/block:edit', $this->context)) {
             $this->content->text .= get_string('no_events_config_message', 'block_progress');
         }
         return $this->content;
     }
     // Check if activities/resources have been selected in config
     $events = event_information($this->config, $modules);
     $attempts = get_attempts($modules, $this->config, $events, $USER->id, $this->instance->id);
     $this->content->text = progress_bar($modules, $this->config, $events, $USER->id, $this->instance->id, $attempts);
     // Organise access to JS
     $jsmodule = array('name' => 'block_progress', 'fullpath' => '/blocks/progress/module.js', 'requires' => array(), 'strings' => array(array('time_expected', 'block_progress')));
     $displaydate = !isset($this->config->displayNow) || $this->config->displayNow == 1;
     $arguments = array($CFG->wwwroot, array_keys($modules), $displaydate);
     $this->page->requires->js_init_call('M.block_progress.init', $arguments, false, $jsmodule);
     return $this->content;
 }
Пример #28
0
echo "<th>" . __('Project');
echo "<th>" . __('Task');
echo "<th>" . __('Progress');
echo "<th>" . __('Worked hours');
echo "<th>" . __('Last update');
echo "<th>" . __('Operation');
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
    echo "<tr>";
    echo "<td>" . print_priority_flag_image($row['priority'], true);
    echo "<td>" . $row[2];
    $id_proj = $row[4];
    $id_task = $row[5];
    echo "<td><a href='index.php?sec=projects&sec2=operation/projects/task_detail&id_project={$id_proj}&id_task={$id_task}&operation=view'>" . $row[1] . "</a>";
    echo "<td >";
    echo progress_bar($row[3], 70, 20);
    echo "<td align=center>" . get_task_workunit_hours_user($row[0], $id_user);
    echo "<td class='f9'>";
    $time1 = get_db_sql("SELECT timestamp\n\t\tFROM tworkunit_task, tworkunit\n\t\tWHERE tworkunit.id_user = '******'\n\t\tAND tworkunit_task.id_task = " . $row[0] . ' AND tworkunit.id = tworkunit_task.id_workunit
		ORDER BY timestamp DESC LIMIT 1');
    echo substr($time1, 0, 10);
    echo "<td>";
    if (give_acl($config["id_user"], 0, "PM")) {
        echo "<a href='index.php?sec=users&sec2=operation/users/user_task_assigment&op=fin&id_task={$id_task}&id_user={$id_user}'><img src='images/upd.png' title='" . __("Finish this task") . "'></a>";
        echo "&nbsp;&nbsp;";
        echo "<a href='index.php?sec=users&sec2=operation/users/user_task_assigment&op=deas&id_task={$id_task}&id_user={$id_user}'><img src='images/delete.png' title='" . __("Deassign this task") . "'></a>";
    }
}
echo "</table>";
?>
<script type="text/javascript" src="include/js/jquery.ui.autocomplete.js"></script>
Пример #29
0
     $form_action = FUSION_SELF . (FUSION_QUERY ? "?" . FUSION_QUERY : "");
     echo openform('voteform', 'post', $form_action, array('max_tokens' => 1));
     echo "<strong>" . $poll_title . "</strong><br /><br />\n" . $poll;
     echo "<div style='text-align:center'><input type='hidden' name='poll_id' value='" . $data['poll_id'] . "' />\n";
     echo form_button("cast_vote", $locale['global_131'], $locale['global_131'], array('class' => 'btn-primary m-r-10'));
     echo "</div>\n";
     echo closeform();
 } else {
     $poll = "";
     $i = 0;
     $num_opts = count($poll_option);
     $poll_votes = dbcount("(vote_opt)", DB_POLL_VOTES, "poll_id='" . $data['poll_id'] . "'");
     while ($i < $num_opts) {
         $num_votes = dbcount("(vote_opt)", DB_POLL_VOTES, "vote_opt='{$i}' AND poll_id='" . $data['poll_id'] . "'");
         $opt_votes = $poll_votes ? number_format(100 / $poll_votes * $num_votes) : 0;
         $poll .= progress_bar($opt_votes, $poll_option[$i]);
         $poll .= "<div>" . $opt_votes . "% [" . (empty($num_votes) ? 0 : $num_votes) . ($num_votes == 1 ? $locale['global_133'] : $locale['global_134']) . "]</div><br />\n";
         $i++;
     }
     echo "<strong>" . $poll_title . "</strong><br /><br />\n" . $poll;
     echo "<div style='text-align:center'>" . $locale['global_135'] . $poll_votes . "<br />\n";
     if (!iMEMBER) {
         echo $locale['global_132'] . "<br />";
     }
     echo $locale['global_136'] . showdate("shortdate", $data['poll_started']);
     if ($data['poll_ended'] > 0) {
         echo "<br />\n" . $locale['global_137'] . showdate("shortdate", $data['poll_ended']) . "\n";
     }
     $result = dbcount("(poll_id)", DB_POLLS);
     if ($result > 1) {
         echo "<br /><br /><a href='" . INFUSIONS . "member_poll_panel/polls_archive.php' class='side'>" . $locale['global_138'] . "</a>\n";
Пример #30
0
 /**
  * Creates the blocks main content
  *
  * @return string
  */
 public function get_content()
 {
     // Access to settings needed
     global $USER, $COURSE, $CFG, $DB, $OUTPUT;
     // If content has already been generated, don't waste time generating it again
     if ($this->content !== null) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     // Check if any activities/resources have been created
     $modules = modules_in_use();
     if (empty($modules)) {
         if (has_capability('moodle/block:edit', $this->context)) {
             $this->content->text .= get_string('no_events_config_message', 'block_progress');
         }
         return $this->content;
     }
     // Check if activities/resources have been selected in config
     $events = event_information($this->config, $modules);
     if ($events === null || $events === 0) {
         if (has_capability('moodle/block:edit', $this->context)) {
             $this->content->text .= get_string('no_events_message', 'block_progress');
             if ($USER->editing) {
                 $parameters = array('id' => $COURSE->id, 'sesskey' => sesskey(), 'bui_editid' => $this->instance->id);
                 $url = new moodle_url('/course/view.php', $parameters);
                 $label = get_string('selectitemstobeadded', 'block_progress');
                 $this->content->text .= $OUTPUT->single_button($url, $label);
                 if ($events === 0) {
                     $url->param('turnallon', '1');
                     $label = get_string('addallcurrentitems', 'block_progress');
                     $this->content->text .= $OUTPUT->single_button($url, $label);
                 }
             }
         }
         return $this->content;
     } else {
         if (empty($events)) {
             if (has_capability('moodle/block:edit', $this->context)) {
                 $this->content->text .= get_string('no_visible_events_message', 'block_progress');
             }
             return $this->content;
         } else {
             $attempts = get_attempts($modules, $this->config, $events, $USER->id, $this->instance->id);
             $this->content->text = progress_bar($modules, $this->config, $events, $USER->id, $this->instance->id, $attempts);
         }
     }
     // Organise access to JS
     $jsmodule = array('name' => 'block_progress', 'fullpath' => '/blocks/progress/module.js', 'requires' => array(), 'strings' => array(array('time_expected', 'block_progress')));
     $displaydate = !isset($this->config->displayNow) || $this->config->displayNow == 1;
     $arguments = array($CFG->wwwroot, array_keys($modules), $displaydate);
     $this->page->requires->js_init_call('M.block_progress.init', $arguments, false, $jsmodule);
     // Allow teachers to access the overview page
     if (has_capability('block/progress:overview', $this->context)) {
         $parameters = array('id' => $this->instance->id, 'courseid' => $COURSE->id);
         $url = new moodle_url('/blocks/progress/overview.php', $parameters);
         $label = get_string('overview', 'block_progress');
         $this->content->text .= $OUTPUT->single_button($url, $label);
     }
     return $this->content;
 }