Ejemplo n.º 1
0
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pipecode is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pipecode.  If not, see <http://www.gnu.org/licenses/>.
//
print_header("Menu");
writeln('<table class="fill">');
writeln('<tr>');
writeln('<td style="padding-right: 8px; vertical-align: text-top; width: 50%;">');
beg_tab();
print_row(array("caption" => "Feed", "description" => "View news feeds", "icon" => "news", "link" => "/"));
print_row(array("caption" => "Comments", "description" => "View your past comments", "icon" => "chat", "link" => "/comments"));
print_row(array("caption" => "Karma", "description" => "Monitor your karma rating", "icon" => "karma-good", "link" => "/karma/"));
end_tab();
writeln('</td>');
writeln('<td style="vertical-align: text-top; width: 50%;">');
beg_tab();
print_row(array("caption" => "Mail", "description" => "Send and receive mail", "icon" => "mail", "link" => "/mail/"));
print_row(array("caption" => "Settings", "description" => "Configure your account settings", "icon" => "tools", "link" => "/settings"));
end_tab();
writeln('</td>');
writeln('</tr>');
writeln('</table>');
print_footer();
Ejemplo n.º 2
0
    }
    print_row(get_string("firstaccess").":", $datestring);
}
if (!isset($hiddenfields['lastaccess'])) {
    if ($user->lastaccess) {
        $datestring = userdate($user->lastaccess)."&nbsp; (".format_time(time() - $user->lastaccess).")";
    } else {
        $datestring = get_string("never");
    }
    print_row(get_string("lastaccess").":", $datestring);
}

/// Printing tagged interests
if (!empty($CFG->usetags)) {
    if ($interests = tag_get_tags_csv('user', $user->id) ) {
        print_row(get_string('interests') .": ", $interests);
    }
}

echo "</table></div></div>";


echo $OUTPUT->blocks_for_region('content');

// Print messaging link if allowed
if (isloggedin() && has_capability('moodle/site:sendmessage', $context)
    && !empty($CFG->messaging) && !isguestuser() && !isguestuser($user) && ($USER->id != $user->id)) {
    echo '<div class="messagebox">';
    echo '<a href="'.$CFG->wwwroot.'/message/index.php?id='.$user->id.'">'.get_string('messageselectadd').'</a>';
    echo '</div>';
}
Ejemplo n.º 3
0
                        }
                        $class = 'class="dimmed"';
                    }
                    $courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&amp;course={$mycourse->id}\" {$class} >" . format_string($mycourse->fullname) . "</a>, ";
                } else {
                    $courselisting .= format_string($mycourse->fullname) . ", ";
                    $PAGE->navbar->add($mycourse->fullname);
                }
            }
            $shown++;
            if ($shown >= 20) {
                $courselisting .= "...";
                break;
            }
        }
        print_row(get_string('courseprofiles') . ':', rtrim($courselisting, ', '));
    }
}
echo "</table></div></div>";
// Print messaging link if allowed
if (isloggedin() && has_capability('moodle/site:sendmessage', $usercontext) && !empty($CFG->messaging) && !isguestuser() && !isguestuser($user) && $USER->id != $user->id) {
    echo '<div class="messagebox">';
    echo '<a href="' . $CFG->wwwroot . '/message/index.php?id=' . $user->id . '">' . get_string('messageselectadd') . '</a>';
    echo '</div>';
}
if ($currentuser || has_capability('moodle/user:viewdetails', $usercontext) || has_coursecontact_role($id)) {
    echo '<div class="fullprofilelink">';
    echo html_writer::link($CFG->wwwroot . '/user/profile.php?id=' . $id, get_string('fullprofile'));
    echo '</div>';
}
/// TODO Add more useful overview info for teachers here, see below
Ejemplo n.º 4
0
function profile_display_fields($userid)
{
    global $CFG, $USER;
    if ($categories = get_records_select('user_info_category', '', 'sortorder ASC')) {
        foreach ($categories as $category) {
            if ($fields = get_records_select('user_info_field', "categoryid={$category->id}", 'sortorder ASC')) {
                foreach ($fields as $field) {
                    require_once $CFG->dirroot . '/user/profile/field/' . $field->datatype . '/field.class.php';
                    $newfield = 'profile_field_' . $field->datatype;
                    $formfield = new $newfield($field->id, $userid);
                    if ($formfield->is_visible() and !$formfield->is_empty()) {
                        print_row(s($formfield->field->name . ':'), $formfield->display_data());
                    }
                }
            }
        }
    }
}
Ejemplo n.º 5
0
    $subject = http_post_string("subject", array("len" => 250, "valid" => "[ALL]"));
    $body = http_post_string("body", array("len" => 64000, "valid" => "[ALL]"));
    $in_reply_to = http_post_string("in_reply_to", array("required" => false, "len" => 250, "valid" => "[a-z][A-Z][0-9]-_.@+-"));
    send_web_mail($to, $subject, $body, $in_reply_to);
    header("Location: /mail/");
    die;
}
$to = http_get_string("to", array("required" => false, "len" => 250, "valid" => "[a-z][A-Z][0-9]-_.<>@+ "));
$mid = http_get_int("mid", array("required" => false));
if ($mid > 0) {
    $message = db_get_rec("mail", $mid);
    $in_reply_to = $message["message_id"];
    $to = $message["mail_from"];
    $subject = $message["subject"];
    if (substr($subject, 0, 4) != "Re: ") {
        $subject = "Re: {$subject}";
    }
} else {
    $in_reply_to = "";
    $subject = "";
}
print_header("Mail", array("Inbox"), array("inbox"), array("/mail/"));
writeln('<form method="post">');
writeln('<input name="in_reply_to" type="hidden" value="' . $in_reply_to . '"/>');
beg_tab();
print_row(array("caption" => "To", "text_key" => "to", "text_value" => $to));
print_row(array("caption" => "Subject", "text_key" => "subject", "text_value" => $subject));
print_row(array("caption" => "Body", "textarea_key" => "body", "textarea_height" => 500));
end_tab();
right_box("Send");
writeln('</form>');
Ejemplo n.º 6
0
    function print_row($field, $shownfields, $row, $object, $show_edit = true, $level = 0, $currentslug = '', $parenturl = '', $delete_limits = array())
    {
        if ($level == 0) {
            echo '<tbody data-id="' . $row->id . '">';
        }
        $user = FW4_User::get_user();
        $typemanager = FW4_Type_Manager::get_instance();
        ?>
		<tr<?php 
        echo $level > 0 ? ' data-root="' . $GLOBALS['root_id'] . '"' : '';
        ?>
 data-id="<?php 
        echo $row->id;
        ?>
" onclick="window.location='<?php 
        echo $parenturl . ($level > 0 ? $GLOBALS['recursive_name'] : $field['name']);
        ?>
/<?php 
        echo $row->id;
        ?>
/';">
			<?php 
        if (isset($field['sortable']) && $field['sortable']) {
            ?>
				<td valign="middle">
					<?php 
            if ($level == 0) {
                ?>
						<img class="sort-handle" src="<?php 
                echo url(ADMINRESOURCES . 'images/sort.png');
                ?>
" width="10" height="11"/><input type="hidden" name="sort-<?php 
                echo $row->id;
                ?>
" value="<?php 
                echo $row->_sort_order;
                ?>
" />
					<?php 
            }
            ?>
				</td>
			<?php 
        }
        $i = 0;
        foreach ($shownfields as $name => $subfield) {
            ?>
				<td<?php 
            if ($subfield->getName() == "price") {
                ?>
 align="right"<?php 
            }
            ?>
><div class="overflow">
					<?php 
            if ($i++ == 0 && $level > 0) {
                echo '&nbsp;&nbsp;';
                for ($s = 0; $s < $level - 1; $s++) {
                    echo '&nbsp;&nbsp;&nbsp;&nbsp;';
                }
                echo '<span style="opacity:0.5">&#9492;</span> ';
            }
            if ($subfield->getName() == "bool") {
                if ($row->{$name} == 1) {
                    ?>
							<img src="<?php 
                    echo url(ADMINRESOURCES . 'images/tick.png');
                    ?>
" class="bool" width="16" height="16"/>
						<?php 
                } else {
                    ?>
							<img src="<?php 
                    echo url(ADMINRESOURCES . 'images/cross.png');
                    ?>
" class="bool" width="16" height="16"/> 
						<?php 
                }
            } else {
                if ($subfield->getName() == "date") {
                    if ($row->{$name}) {
                        echo date('j/m/Y', $row->{$name});
                    }
                } else {
                    if ($subfield->getName() == "float") {
                        if ($row->{$name}) {
                            echo rtrim(rtrim(number_format($row->{$name}, 2, ',', '.'), '0'), ',');
                        }
                    } else {
                        if ($subfield->getName() == "timedate") {
                            if ($row->{$name}) {
                                if (date('H:i', $row->{$name}) == '00:00') {
                                    echo date('j/m/Y', $row->{$name});
                                } else {
                                    echo date('j/m/Y H:i', $row->{$name});
                                }
                            }
                        } else {
                            if ($subfield->getName() == "text") {
                                if (isset($row->{$name})) {
                                    if ($subfield['summary'] == 'bool') {
                                        if (trim($row->{$name})) {
                                            ?>
									<img src="<?php 
                                            echo url(ADMINRESOURCES . 'images/tick.png');
                                            ?>
" class="bool" width="16" height="16"/>
								<?php 
                                        } else {
                                            ?>
									<img src="<?php 
                                            echo url(ADMINRESOURCES . 'images/cross.png');
                                            ?>
" class="bool" width="16" height="16"/> 
								<?php 
                                        }
                                    } else {
                                        echo excerpt($row->{$name}, 50);
                                    }
                                }
                            } else {
                                if ($subfield->getName() == "slug") {
                                    foreach ($field->children() as $child) {
                                        $childname = strval($child['name']);
                                        if (is_numeric($row->{$childname}) && isset($subfield['format_' . $child['name'] . '_' . $row->{$childname}])) {
                                            if (!$name) {
                                                $name = 'slug';
                                            }
                                            $i = 0;
                                            foreach (languages() as $key => $lang) {
                                                $childlang = $name . '_' . $key;
                                                if ($i++ != 0) {
                                                    echo ' &bull; ';
                                                }
                                                $link = url((count(languages()) > 1 ? $key . '/' : '') . str_replace('$slug', $row->{$childlang}, $subfield['format_' . $child['name'] . '_' . $row->{$childname}]), false);
                                                if (count(languages()) > 1) {
                                                    echo '<a href="' . $link . '">' . strtoupper($key) . '</a>';
                                                } else {
                                                    echo '<a href="' . $link . '">' . $link . '</a>';
                                                }
                                            }
                                            $currentslug = str_replace('$slug', $row->{$name}, $subfield['format_' . $child['name'] . '_' . $row->{$childname}]) . '/';
                                        }
                                    }
                                } else {
                                    if ($type = $typemanager->get_type(strval($subfield->getName()))) {
                                        echo $type->summary($subfield, $row, $object);
                                    } else {
                                        echo htmlentities_all($row->{$name});
                                    }
                                }
                            }
                        }
                    }
                }
            }
            ?>
				</div></td>
			<?php 
        }
        ?>
			<?php 
        $deletable = true;
        ?>
			<?php 
        foreach ($delete_limits as $delete_limit_key => $delete_limit_value) {
            if (!isset($row->{$delete_limit_key}) || $row->{$delete_limit_key} != $delete_limit_value) {
                $deletable = false;
            }
        }
        ?>
			<td align="right">
				<?php 
        if ($deletable && !isset($field['delete_disabled'])) {
            ?>
					<div style="white-space:nowrap;">
						<?php 
            if ($field['name'] != 'user' || $row->id != $user->id) {
                ?>
							<a class="delete" href="<?php 
                echo $parenturl . ($level > 0 ? $GLOBALS['recursive_name'] : $field['name']);
                ?>
/<?php 
                echo $row->id;
                ?>
/delete/" onclick="event.stopPropagation();return confirm('<?php 
                echo l(array('nl' => 'Bent u zeker dat u dit item wilt verwijderen?', 'fr' => '&Ecirc;tes-vous s&ucirc;r de vouloir supprimer cet &eacute;l&eacute;ment?', 'en' => 'Are you sure you want to remove this item?'));
                ?>
');"><img alt="<?php 
                echo l(array('nl' => 'Verwijderen', 'fr' => 'Supprimer', 'en' => 'Delete'));
                ?>
" title="<?php 
                echo l(array('nl' => 'Verwijderen', 'fr' => 'Supprimer', 'en' => 'Delete'));
                ?>
" src="<?php 
                echo url(ADMINRESOURCES . 'images/del.png');
                ?>
" width="22" height="23"></a>
						<?php 
            }
            ?>
					</div>
				<?php 
        }
        ?>
			</td>
		</tr>
		<?php 
        if (isset($GLOBALS['recursive_name']) && $GLOBALS['recursive_name']) {
            if ($level == 0) {
                $GLOBALS['root_id'] = $row->id;
            }
            foreach ($row->{$GLOBALS}['recursive_name'] as $subrow) {
                print_row($field, $shownfields, $subrow, $object, $show_edit, $level + 1, $currentslug, $parenturl . ($level == 0 ? $field['name'] : $GLOBALS['recursive_name']) . '/' . $row->id . '/');
            }
        }
        if ($level == 0) {
            echo '</tbody>';
        }
    }
Ejemplo n.º 7
0
if ($isHTML) {
    print "<p>";
}
include HEURIST_DIR . 'admin/structure/crosswalk/usrTagsFields.inc';
// sets value of $flds
print "-- {$flds} \n";
$query = "select {$flds} from UsrTags";
$res = mysql_query($query);
$fmt = 'UsrTags';
// update format if fields added
if ($isHTML) {
    print "<p>";
}
print "\n{$startToken}\n";
while ($row = mysql_fetch_assoc($res)) {
    print_row($row, $fmt);
}
print "\n{$endToken}\n";
if ($isHTML) {
    print "<p>&nbsp;<p>&nbsp;<p>";
}
// --------------------------------------------------------------------------------------
print "\n{$endofFileToken}\n";
if ($isHTML) {
    print '</body></html>';
}
function print_row($row, $fmt)
{
    // Prints a formatted representation of the data retreived for one row in the query
    // Make sure that the query you passed in generates the fields you want to print
    // Specify fields with $row[fieldname] or $row['fieldname'] (in most cases the quotes
Ejemplo n.º 8
0
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pipecode.  If not, see <http://www.gnu.org/licenses/>.
//
if (!$auth_user["editor"] && !$auth_user["admin"]) {
    die("not an editor or admin");
}
print_header("Menu");
writeln('<table class="fill">');
writeln('<tr>');
writeln('<td style="padding-right: 8px; vertical-align: text-top; width: 50%;">');
beg_tab();
print_row(array("caption" => "Poll", "description" => "Create a new poll", "icon" => "heart", "link" => "/poll/create"));
if ($auth_user["admin"]) {
    print_row(array("caption" => "Topics", "description" => "Add and remove topics", "icon" => "chat", "link" => "/topic/list"));
}
end_tab();
writeln('</td>');
writeln('<td style="vertical-align: text-top; width: 50%;">');
beg_tab();
print_row(array("caption" => "Wiki", "description" => "Create a new wiki page", "icon" => "html", "link" => "/"));
if ($auth_user["admin"]) {
    print_row(array("caption" => "Links", "description" => "Manage server links", "icon" => "workgroup", "link" => "/link/"));
}
end_tab();
writeln('</td>');
writeln('</tr>');
writeln('</table>');
print_footer();
Ejemplo n.º 9
0
writeln('<img alt="Pipecode" src="/images/logo-top.png" style="margin-bottom: 8px"/>');
writeln('<form method="post">');
beg_tab();
print_row(array("caption" => "Server Name", "text_key" => "server_name", "text_value" => "example.com"));
print_row(array("caption" => "Server Title", "text_key" => "server_title", "text_value" => "Example Site"));
print_row(array("caption" => "Server Slogan", "text_key" => "server_slogan", "text_value" => "Nerd News Network"));
end_tab();
beg_tab();
print_row(array("caption" => "SMTP Server", "text_key" => "smtp_server", "text_value" => "mail.example.com"));
print_row(array("caption" => "SMTP Port", "text_key" => "smtp_port", "text_value" => "587"));
print_row(array("caption" => "SMTP Address", "text_key" => "smtp_address", "text_value" => "*****@*****.**"));
print_row(array("caption" => "SMTP Username", "text_key" => "smtp_username", "text_value" => "mailuser"));
print_row(array("caption" => "SMTP Password", "text_key" => "smtp_password", "text_value" => "password"));
end_tab();
beg_tab();
print_row(array("caption" => "SQL Server", "text_key" => "sql_server", "text_value" => "127.0.0.1"));
print_row(array("caption" => "SQL Username", "text_key" => "sql_user", "text_value" => "sql"));
print_row(array("caption" => "SQL Password", "text_key" => "sql_pass", "text_value" => "password"));
print_row(array("caption" => "SQL Database", "text_key" => "sql_database", "text_value" => "pipecode"));
end_tab();
beg_tab();
print_row(array("caption" => "CAPTCHA API Key", "text_key" => "captcha_key", "text_value" => ""));
end_tab();
beg_tab();
print_row(array("caption" => "Admin Username", "text_key" => "admin_username", "text_value" => "myname"));
print_row(array("caption" => "Admin Password", "text_key" => "admin_password", "text_value" => "crunchyfrog"));
end_tab();
right_box("Save");
writeln('</form>');
writeln('</body>');
writeln('</html>');
Ejemplo n.º 10
0
function promote($site_id)
{
    global $db, $globals, $output;
    SitesMgr::__init($site_id);
    $output = '';
    $min_karma_coef = $globals['min_karma_coef'];
    $links_queue = $db->get_var("SELECT SQL_NO_CACHE count(*) from sub_statuses WHERE id = {$site_id} and date > date_sub(now(), interval 24 hour) and status in ('published', 'queued')");
    $links_queue_all = $db->get_var("SELECT SQL_NO_CACHE count(*) from sub_statuses, links WHERE id = {$site_id} and date > date_sub(now(), interval 24 hour) and link_id = link and link_votes > 0");
    $pub_estimation = intval(max(min($links_queue * PUB_PERC, PUB_MAX), PUB_MIN));
    $interval = intval(86400 / $pub_estimation);
    $now = time();
    echo "BEGIN\n";
    $output .= "<p><b>BEGIN</b>: " . get_date_time($now) . "<br/>\n";
    $hours = intval($globals['time_enabled_votes'] / 3600);
    $from_time = "date_sub(now(), interval {$hours} hour)";
    $last_published = $db->get_var("SELECT SQL_NO_CACHE UNIX_TIMESTAMP(max(date)) from sub_statuses WHERE id = {$site_id} and status='published'");
    if (!$last_published) {
        $last_published = $now - 24 * 3600 * 30;
    }
    $links_published = (int) $db->get_var("select SQL_NO_CACHE count(*) from sub_statuses where id = {$site_id} and status = 'published' and date > date_sub(now(), interval 24 hour)");
    $links_published_projection = 4 * (int) $db->get_var("select SQL_NO_CACHE count(*) from sub_statuses where id = {$site_id} and status = 'published' and date > date_sub(now(), interval 6 hour)");
    $diff = $now - $last_published;
    // If published and estimation are lower than projection then
    // fasten decay
    if ($diff < $interval && ($links_published_projection < $pub_estimation * 0.9 && $links_published < $pub_estimation * 0.9)) {
        $diff = max($diff * 2, $interval);
    }
    $decay = min(MAX, MAX - $diff / $interval * (MAX - MIN));
    $decay = max($min_karma_coef, $decay);
    if ($diff > $interval * 2) {
        $must_publish = true;
        $output .= "Delayed! <br/>";
    }
    $output .= "Last published at: " . get_date_time($last_published) . "<br/>\n";
    $output .= "24hs queue: {$links_queue}/{$links_queue_all}, Published: {$links_published} -> {$links_published_projection} Published goal: {$pub_estimation}, Interval: {$interval} secs, difference: " . intval($now - $last_published) . " secs, Decay: {$decay}<br/>\n";
    $continue = true;
    $published = 0;
    $past_karma_long = intval($db->get_var("SELECT SQL_NO_CACHE avg(karma) from sub_statuses WHERE id = {$site_id} and date >= date_sub(now(), interval 7 day) and status='published'"));
    $past_karma_short = intval($db->get_var("SELECT SQL_NO_CACHE avg(karma) from sub_statuses WHERE id = {$site_id} and date >= date_sub(now(), interval 12 hour) and status='published'"));
    $past_karma = 0.5 * max(40, $past_karma_long) + 0.5 * max(20, $past_karma_short);
    $min_past_karma = (int) ($past_karma * $min_karma_coef);
    $last_resort_karma = (int) $past_karma * 0.8;
    //////////////
    $min_karma = round(max($past_karma * $decay, 20));
    if ($decay >= 1) {
        $max_to_publish = 3;
    } else {
        $max_to_publish = 1;
    }
    $min_votes = 3;
    /////////////
    $limit_karma = round(min($past_karma, $min_karma) * 0.4);
    $bonus_karma = round(min($past_karma, $min_karma) * 0.35);
    /// Get common votes links' averages
    $days = 7;
    // Balance metas
    if (empty($globals['sub_balance_metas']) || !in_array(SitesMgr::my_id(), $globals['sub_balance_metas'])) {
        $db_metas = array();
    } else {
        $db_metas = $db->get_results("select category, category_name, calculated_coef from sub_categories, categories where id = {$site_id} and category_id = category and category_parent = 0 and category_id in (select category_parent from sub_categories, categories where id = {$site_id} and category_id = category and category_parent > 0)");
    }
    $subs_coef = get_subs_coef($site_id, 2);
    $globals['users_karma_avg'] = (double) $db->get_var("select SQL_NO_CACHE avg(link_votes_avg) from links, sub_statuses where id = {$site_id} and status = 'published' and date > date_sub(now(), interval 72 hour) and link_id = link");
    $output .= "Karma average for each link: " . $globals['users_karma_avg'] . ", Past karma. Long term: {$past_karma_long}, Short term: {$past_karma_short}, Average: <b>{$past_karma}</b><br/>\n";
    $output .= "<b>Current MIN karma: {$min_karma}</b>, absolute min karma: {$min_past_karma}, analizing from {$limit_karma}<br/>\n";
    $output .= "</p>\n";
    $where = "id = {$site_id} AND date > {$from_time} AND status = 'queued' AND link_id = link AND link_votes>={$min_votes} AND (link_karma > {$limit_karma} or (date > date_sub(now(), interval 2 hour) and link_karma > {$bonus_karma})) and user_id = link_author ";
    $sort = "ORDER BY link_karma DESC, link_votes DESC";
    $thumbs_queue = array();
    $links = $db->get_results("SELECT SQL_NO_CACHE link_id, link_karma as karma from sub_statuses, links, users  where {$where} {$sort} LIMIT 30");
    $rows = $db->affected_rows;
    echo "SELECTED {$rows} ARTICLES\n";
    if (!$rows) {
        $output .= "There are no articles<br/>\n";
        $output .= "--------------------------<br/>\n";
        echo strip_tags($output) . "\n";
        if (!DEBUG) {
            $annotation = new Annotation("promote-{$site_id}");
            $annotation->text = $output;
            $annotation->store();
        } else {
            echo "OUTPUT:\n. " . strip_tags($output) . "\n";
        }
        return;
    }
    $max_karma_found = 0;
    $best_link = 0;
    $best_karma = 0;
    $output .= "<table>\n";
    if ($links) {
        $output .= "<tr class='thead'><th>votes</th><th>anon</th><th>neg.</th><th>coef</th><th>karma</th><th>sub</th><th>title</th><th>changes</th></tr>\n";
        $i = 0;
        foreach ($links as $dblink) {
            $link = Link::from_db($dblink->link_id);
            $changes = update_link_karma($site_id, $link);
            if (!DEBUG && $link->thumb_status == 'unknown' && $link->karma > $limit_karma) {
                echo "Adding {$link->id} to thumb queue\n";
                array_push($thumbs_queue, $link->id);
            }
            if (!empty($link->coef) && $link->coef > 1) {
                if ($decay > 1) {
                    $karma_threshold = $past_karma;
                } else {
                    $karma_threshold = $min_karma;
                }
            } else {
                // Otherwise use normal decayed min_karma
                $karma_threshold = $min_karma;
            }
            if ($link->votes >= $min_votes && $link->karma >= $karma_threshold && $published < $max_to_publish) {
                $published++;
                publish($site_id, $link);
                $changes = 3;
                // to show a "published" later
            } else {
                if (($must_publish || $link->karma > $min_past_karma) && $link->karma > $limit_karma && $link->karma > $last_resort_karma && $link->votes > $link->negatives * 20) {
                    $last_resort_id = $link->id;
                    $last_resort_karma = $link->karma;
                }
            }
            $output .= print_row($link, $changes);
            usleep(10000);
            $i++;
        }
        if (!DEBUG && $published == 0 && $links_published_projection < $pub_estimation * 0.9 && $must_publish && $last_resort_id > 0) {
            // Publish last resort
            $link = new Link();
            $link->id = $last_resort_id;
            if ($link->read()) {
                $link->message = "Last resort: selected with the best karma";
                $output .= print_row($link, 3);
                publish($site_id, $link);
                // Recheck for images, some sites add images after the article has been published
                if (!$link->has_thumb() && $link->thumb_status != 'deleted' && !in_array($link->id, $thumbs_queue)) {
                    echo "Adding {$link->id} to thumb queue\n";
                    array_push($thumbs_queue, $link->id);
                }
            }
        }
        //////////
    }
    $output .= "</table>\n";
    echo strip_tags($output) . "\n";
    if (!DEBUG) {
        $annotation = new Annotation("promote-{$site_id}");
        $annotation->text = $output;
        $annotation->store();
    } else {
        echo "OUTPUT:\n" . strip_tags($output) . "\n";
    }
    // Get THUMBS
    foreach ($thumbs_queue as $id) {
        $link = Link::from_db($id, null, false);
        if ($link && !$link->has_thumb() && $link->thumb_status != 'deleted') {
            echo "GETTING THUMB {$link->id}\n";
            $link->get_thumb(true);
            echo "DONE GETTING THUMB\n";
        }
    }
}
Ejemplo n.º 11
0
while ($row = mysql_fetch_assoc($res)) {
    print_row($row, $fmt, $flds);
}
print "</UserHyperlinkFilters>";
// ------------------------------------------------------------------------------------------
// usrTags
print "\n\n<UserTags>";
include HEURIST_DIR . 'admin/structure/crosswalk/usrTagsFields.inc';
// sets value of $flds
$query = "select {$flds} from UsrTags";
$res = mysql_query($query);
$fmt = 'UsrTags';
// update format if fields added
print "\n\n<!-- {$flds} -->";
while ($row = mysql_fetch_assoc($res)) {
    print_row($row, $fmt, $flds);
}
print "</UserTags>";
print '\\n</hml_structure>';
// end of file
// --------------------------------------------------------------------------------------
function html_escape($s)
{
    // TODO: 6/6/14 - we used mysql_real_escape_string because we were producing SQL.
    //       Now we are producing XML, we should revise this to appropriate escaping
    return htmlspecialchars(mysql_real_escape_string($s));
}
// html_escape
function print_row($row, $fmt, $flds)
{
    // Prints a formatted representation of the data retreived for one row in the query
Ejemplo n.º 12
0
writeln('<h1>Settings</h1>');
writeln('<form method="post">');
beg_tab("JavaScript");
print_row(array("caption" => "Enable JavaScript", "check_key" => "javascript_enabled", "checked" => $user_conf["javascript_enabled"]));
end_tab();
beg_tab("Date and Time");
print_row(array("caption" => "Time Zone", "option_key" => "time_zone", "option_list" => $zones, "option_value" => $user_conf["time_zone"]));
end_tab();
beg_tab("Comments");
$scores = array("-1", "0", "1", "2", "3", "4", "5");
print_row(array("caption" => "Hide Threshold", "option_key" => "hide_threshold", "option_list" => $scores, "option_value" => $user_conf["hide_threshold"]));
print_row(array("caption" => "Expand Threshold", "option_key" => "expand_threshold", "option_list" => $scores, "option_value" => $user_conf["expand_threshold"]));
end_tab();
beg_tab("Mailing List");
print_row(array("caption" => "Subscribe to Mailing List (list@{$server_name})", "check_key" => "list_enabled", "checked" => $user_conf["list_enabled"]));
print_row(array("caption" => "Real Name", "text_key" => "real_name", "text_value" => $user_conf["real_name"]));
end_tab();
//
// Eastern: America/New_York
// Central: America/Chicago
// Mountain: America/Denver
// Pacific: America/Los_Angeles
// British Summer Time: London
// Central Europe Time: Paris
// Eastern Europe Time: Athens
//
right_box("Save");
writeln('</form>');
writeln('</td>');
writeln('</tr>');
writeln('</table>');
function print_attendance_table($user, $course)
{
    $complete = get_attendance($user->id, $course);
    $percent = get_percent($user->id, $course) . '&nbsp;%';
    $grade = get_grade($user->id, $course);
    echo '<table border="0" cellpadding="0" cellspacing="0" class="list">';
    print_row(get_string('sessionscompleted', 'attforblock') . ':', "<strong>{$complete}</strong>");
    $statuses = get_statuses($course->id);
    foreach ($statuses as $st) {
        print_row($st->description . ': ', '<strong>' . get_attendance($user->id, $course, $st->id) . '</strong>');
    }
    print_row(get_string('attendancepercent', 'attforblock') . ':', "<strong>{$percent}</strong>");
    print_row(get_string('attendancegrade', 'attforblock') . ':', "<strong>{$grade}</strong> / " . get_maxgrade($user->id, $course));
    print_row('&nbsp;', '&nbsp;');
    echo '</table>';
}
Ejemplo n.º 14
0
}
//Added for subadmin
$context = get_context_instance(CONTEXT_SYSTEM);
$roles = get_user_roles($context, $USER->id, false);
$role = key($roles);
$rolename = $roles[$role]->shortname;
if ($rolename == 'subadmin') {
    $all_languages = get_string_manager()->get_list_of_translations();
    $get_lang_details = $DB->get_record('country_user', array('userid' => $USER->id));
    $langs = explode(",", $get_lang_details->lang);
    if ($langs) {
        foreach ($langs as $la) {
            $aUserAssignedLang[] = $all_languages[$la];
        }
        $sUserAssignedLang = implode(", ", $aUserAssignedLang);
        print_row(get_string('assignedlanguages') . ": ", $sUserAssignedLang);
    }
}
echo "</table></div></div>";
echo $OUTPUT->blocks_for_region('content');
// Print messaging link if allowed
if (isloggedin() && has_capability('moodle/site:sendmessage', $context) && !empty($CFG->messaging) && !isguestuser() && !isguestuser($user) && $USER->id != $user->id) {
    echo '<div class="messagebox">';
    echo '<a href="' . $CFG->wwwroot . '/message/index.php?id=' . $user->id . '">' . get_string('messageselectadd') . '</a>';
    echo '</div>';
}
if ($CFG->debugdisplay && debugging('', DEBUG_DEVELOPER) && $currentuser) {
    // Show user object
    echo '<br /><br /><hr />';
    echo $OUTPUT->heading('DEBUG MODE:  User session variables');
    print_object($USER);
Ejemplo n.º 15
0
// Pipecode is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pipecode.  If not, see <http://www.gnu.org/licenses/>.
//
print_header("Create Poll");
writeln('<table class="fill">');
writeln('<tr>');
writeln('<td class="left_col">');
print_left_bar("main", "poll");
writeln('</td>');
writeln('<td class="fill">');
writeln('<h1>Create Poll</h1>');
beg_tab("Question");
print_row(array("caption" => "Text", "text_key" => "question"));
print_row(array("caption" => "Type", "option_key" => "hide_threshold", "option_keys" => array(0, 1), "option_list" => array("Multiple Choice", "Approval Voting")));
end_tab();
beg_tab("Answers", array("colspan" => 2));
writeln('	<tr>');
writeln('		<td><input type="text"/></td>');
writeln('		<td style="text-align: right"><a href="delete" class="icon_16" style="background-image: url(/images/remove-16.png)">Remove</a></td>');
writeln('	</tr>');
end_tab();
writeln('<div class="right"><a href="add" class="icon_16" style="background-image: url(/images/add-16.png)">Add</a></div>');
writeln('		</td>');
writeln('	</tr>');
writeln('</table>');
print_footer();
Ejemplo n.º 16
0
function get_subsession($level, $parent_id, $details_to_view, $split, $extra)
{
    # get the subsession info for this parent_id
    $athlete_id = $GLOBALS['athlete_id'];
    $level++;
    $numcols = count($details_to_view);
    # put children rows into sub_rows array
    $sub_rows = do_sql("SELECT * from log WHERE athlete_id = '{$athlete_id}' and parent_session='{$parent_id}' ORDER BY start_date, start_time, stage ");
    #this session is a subsession so hide it
    $num = $numcols + 2;
    echo "<TR><TD class=firstcolumn > </TD>\n\t<TD class=subtable colspan={$num} align=right >\n\t<DIV ID='el{$parent_id}' CLASS='hiddentext' >\n";
    # Print Column headers and open sub-table
    $details_to_view = get_details_to_view($athlete_id);
    display_column_headers($details_to_view);
    # then print each subsession and check whether it has subsessions
    while ($sub_row = pg_fetch_array($sub_rows, null, PGSQL_ASSOC)) {
        # sub_row now holds 1 subsession
        # check whether this row has any subsessions
        $session_id = $sub_row['session_id'];
        $subtest = do_sql("SELECT * from log WHERE athlete_id = '{$athlete_id}' and parent_session='{$session_id}' ");
        $numsubs = pg_num_rows($subtest);
        #echo "NUMsubs: $numsubs <br> \n";
        // Start the row
        echo "\n<TR><TD class=firstcolumn></TD>\n";
        if ($numsubs > 0) {
            if ($split == $session_id) {
                print_row(1, $level, $sub_row, $details_to_view, $athlete_id, $split);
                #display_row_editor($session_id, $athlete_id, $extra );
            } else {
                print_row(1, $level, $sub_row, $details_to_view, $athlete_id, 0);
                #display_row_editor($session_id, $athlete_id, $extra );
            }
            # call self to get subs of this sub
            get_subsession($level, $sub_row['session_id'], $details_to_view, $split, $extra);
        } else {
            if ($split == $session_id) {
                print_row(0, $level, $sub_row, $details_to_view, $athlete_id, $split);
                #display_row_editor($session_id, $athlete_id, $extra );
            } else {
                print_row(0, $level, $sub_row, $details_to_view, $athlete_id, 0);
                #display_row_editor($session_id, $athlete_id, $extra );
            }
        }
    }
    echo "\n</TABLE>\n\t<font size=2  > <br> </font>\n\t</DIV>\n\n";
}
Ejemplo n.º 17
0
        print_row(mysql_query($stmt), "Monatsleistung", mysql_query($stmt2));
        /*************************************************************************/
    /*************************************************************************/
    case 'year':
        /*************************************************************************/
        $where_clause = " WHERE date_format( a.date , '%Y' ) = " . date('Y', $time);
        $stmt = $sql . $where_clause . " GROUP BY date_format( a.date , '%Y' ) ";
        $stmt2 = sprintf($m_stmt, $where_clause);
        print_row(mysql_query($stmt), "Jahresleistung", mysql_query($stmt2));
        /*************************************************************************/
    /*************************************************************************/
    default:
        /*************************************************************************/
        $stmt = $sql;
        $stmt2 = sprintf($m_stmt, "");
        print_row(mysql_query($stmt), "Gesamtleistung", mysql_query($stmt2));
}
echo '</table>';
$ok = mysql_query("select wert from parameter where feld='lmd'");
$lmd = mysql_result($ok, 0);
$ok = mysql_query("select max(timestamp) from solardata");
$lnd = mysql_result($ok, 0);
$flmd = format_date_gh($lmd);
$flnd = format_date_gh($lnd);
echo '<small>Letzte Daten vom: ' . $flnd . ' / LMD: ' . $flmd . '</small></div>';
function print_row($result1, $title, $result2)
{
    $units = array('ETotal' => 'kWh', 'ETotal_Soll' => 'kWh', 'ETotal_Diff' => 'kWh', 'Perc' => '%');
    if (is_resource($result1)) {
        echo '<tr><th class="left">' . $title . '</th>';
        $col1 = "";
Ejemplo n.º 18
0
    $INI_FAIL = ($INI_FAIL or $param < 16777216);
    /**
    
    	Sezione Moduli
    
    	**/
    echo '<tr class="Divider"><td colspan="3"></td></tr>';
    // moduli essenziali: mysqli, curl, gd, imagick, mbstring, iconv
    echo '<tr><th class="Title" colspan="3">' . get_text('Loaded modules', 'Install') . '</th></tr>';
    echo '<tr>';
    echo '<th>' . get_text('Module', 'Install') . '</th>';
    echo '<th>' . get_text('Required', 'Install') . '</th>';
    echo '<th>' . get_text('Status', 'Install') . '</th>';
    echo '</tr>';
    foreach ($ESS_EXT as $key) {
        print_row(in_array($key, $EXT_SET) ? get_text('installed', 'Install') : get_text('missing', 'Install'), get_text('installed', 'Install'), $key, !in_array($key, $EXT_SET), true);
        $MOD_FAIL = ($MOD_FAIL or !in_array($key, $EXT_SET));
    }
    if ($MOD_FAIL) {
        // manca roba essenziale... non si prosegue
        echo '<tr><td colspan="3">' . get_text('Missing modules', 'Install') . '<br/>' . get_text('Failing install', 'Install') . '</td></tr>';
    } else {
        // si va avanti... ma magari si può sistemare il php.ini
        if ($INI_FAIL) {
            echo '<tr><td colspan="3">' . get_text('Suboptimal', 'Install') . '</td></tr>';
        }
        echo '<tr><th colspan="3"><a href="?step=2">' . get_text('Continue') . '</a></th></tr>';
    }
}
function print_row($param, $min, $key, $test, $mandatory = false)
{
Ejemplo n.º 19
0
            if (($must_publish || $link->karma > $min_past_karma) && $link->karma > $limit_karma && $link->karma > $last_resort_karma && $link->votes > $link->negatives * 20) {
                $last_resort_id = $link->id;
                $last_resort_karma = $link->karma;
            }
        }
        print_row($link, $changes);
        usleep(10000);
        $i++;
    }
    if (!DEBUG && $published == 0 && $links_published_projection < $pub_estimation * 0.9 && $must_publish && $last_resort_id > 0) {
        // Publish last resort
        $link = new Link();
        $link->id = $last_resort_id;
        if ($link->read()) {
            $link->message = "Last resort: selected with the best karma";
            print_row($link, 3);
            publish($link);
            // Recheck for images, some sites add images after the article has been published
            if ($link->thumb_status != 'local' && $link->thumb_status != 'remote' && $link->thumb_status != 'deleted' && !in_array($link->id, $thumbs_queue)) {
                echo "Adding {$link->id} to thumb queue\n";
                array_push($thumbs_queue, $link->id);
            }
        }
    }
    //////////
}
$output .= "</table>\n";
echo $output;
echo "</body></html>\n";
if (!DEBUG) {
    $annotation = new Annotation('promote');
Ejemplo n.º 20
0
    }
}
writeln('<h1>Preview</h1>');
$a = array();
$a["title"] = $title;
$a["time"] = $story["time"];
$a["pid"] = $story["pid"];
$a["zid"] = $zid;
$a["topic"] = $topic;
$a["icon"] = $icon;
$a["story"] = $new_body;
print_article($a);
writeln('<h1>Edit</h1>');
beg_tab();
print_row(array("caption" => "Title", "text_key" => "title", "text_value" => $title));
print_row(array("caption" => "Topic", "option_key" => "tid", "option_value" => $tid, "option_list" => $topic_list, "option_keys" => $topic_keys));
print_row(array("caption" => "Icon", "option_key" => "icon", "option_value" => $icon, "option_list" => $icon_list));
print_row(array("caption" => "Story", "textarea_key" => "story", "textarea_value" => $body, "textarea_height" => "400"));
end_tab();
writeln('<table class="fill">');
writeln('	<tr>');
writeln('		<td><a href="/icons">Icons</a></td>');
writeln('		<td style="text-align: right"><input name="publish" type="submit" value="Publish"/> <input name="preview" type="submit" value="Preview"/></td>');
writeln('	</tr>');
writeln('</table>');
//right_box("Publish,Preview");
writeln('</form>');
writeln('</td>');
writeln('</tr>');
writeln('</table>');
print_footer();
Ejemplo n.º 21
0
    }
    print_row(get_string("lastaccess") . ":", $datestring);
}
/// printing roles
if ($rolestring = get_user_roles_in_context($id, $coursecontext)) {
    print_row(get_string('roles') . ':', format_string($rolestring, false));
}
/// Printing groups
$isseparategroups = ($course->groupmode == SEPARATEGROUPS and $course->groupmodeforce and !has_capability('moodle/site:accessallgroups', $coursecontext));
if (!$isseparategroups) {
    if ($usergroups = user_group($course->id, $user->id)) {
        $groupstr = '';
        foreach ($usergroups as $group) {
            $groupstr .= ' <a href="' . $CFG->wwwroot . '/user/index.php?id=' . $course->id . '&amp;group=' . $group->id . '">' . $group->name . '</a>,';
        }
        print_row(get_string("group") . ":", rtrim($groupstr, ', '));
    }
}
/// End of printing groups
echo "</table>";
echo "</td></tr></table>";
$userauth = get_auth_plugin($user->auth);
$passwordchangeurl = false;
if ($userauth->can_change_password()) {
    if ($userauth->change_password_url()) {
        $passwordchangeurl = $userauth->change_password_url();
    } else {
        if (empty($CFG->loginhttps)) {
            $passwordchangeurl = "{$CFG->wwwroot}/login/change_password.php";
        } else {
            $passwordchangeurl = str_replace('http:', 'https:', $CFG->wwwroot . '/login/change_password.php');
Ejemplo n.º 22
0
/**
 * Display the screen with entries.
 *
 * @param string $message
 */
function entries_screen($message = "")
{
    global $config_array, $Pivot_Vars, $Cfg, $absmax;
    PageHeader(lang('userbar', 'entries'), 1);
    PageAnkeiler(lang('userbar', 'entries') . ' &raquo; ' . lang('userbar', 'entries_title'));
    // display a message, if there is one..
    if ($message != "") {
        echo "<p><b>{$message}</b></p>";
    }
    // if there is an 'action' to do
    if (isset($Pivot_Vars['doaction']) && $Pivot_Vars['action'] != "") {
        if ($Pivot_Vars['action'] == "delete" && $Pivot_Vars['confirmed'] != 1) {
            $vars = array("action", $Pivot_Vars['action'], "check", serialize($Pivot_Vars['check']), "doaction", "1");
            if (count($Pivot_Vars['check']) == 1) {
                ConfirmPage("hmm ho hum", $vars, lang('entries', 'delete_one_confirm'));
            } else {
                ConfirmPage("hmm ho hum", $vars, lang('entries', 'delete_multiple_confirm'));
            }
        }
        entries_action($Pivot_Vars['action'], $Pivot_Vars['check']);
    }
    $db = new db();
    if (!isset($Cfg['overview_entriesperpage'])) {
        $Cfg['overview_entriesperpage'] = 20;
    }
    $absmax = $db->get_entries_count();
    $show = isset($Pivot_Vars['show']) ? $Pivot_Vars['show'] : $Cfg['overview_entriesperpage'];
    $offset = isset($Pivot_Vars['offset']) ? $Pivot_Vars['offset'] : 0;
    if (isset($Pivot_Vars['first'])) {
        $offset = $absmax - $show;
    }
    $myurl = sprintf("index.php?session=%s&amp;menu=entries", $Pivot_Vars['session']);
    //Sort entries change
    //set initial values for sort values
    $entry_sort = "";
    //goes in query string
    $sort = "date";
    //goes in the getlist method call
    if (isset($Pivot_Vars['sort'])) {
        $entry_sort = "&amp;sort=" . $Pivot_Vars['sort'];
        $sort = $Pivot_Vars['sort'];
        if (isset($Pivot_Vars['reverse'])) {
            $sort_order = TRUE;
            $entry_sort .= "&amp;reverse";
        } else {
            $sort_order = FALSE;
            $myurl .= "&amp;reverse";
        }
    }
    if (isset($Pivot_Vars['filtercat'])) {
        $overview_arr = $db->getlist(-$show, $offset, "", array($Pivot_Vars['filtercat']), $sort_order, $sort);
        $filter = "&amp;filtercat=" . $Pivot_Vars['filtercat'];
        $filtertitle = str_replace('%name%', $Pivot_Vars['filtercat'], lang('entries', 'filteron'));
    } else {
        if (isset($Pivot_Vars['filteruser'])) {
            $overview_arr = $db->getlist(-$show, $offset, $Pivot_Vars['filteruser'], "", $sort_order, $sort);
            $filter = "&amp;filteruser="******"modules/module_search.php";
                $overview_arr = search_entries($Pivot_Vars['search']);
                $filtertitle = str_replace('%name%', '&hellip;', lang('entries', 'filteron'));
                $offset = 0;
                $absmax = $show = 1;
            } else {
                $overview_arr = $db->getlist(-$show, $offset, "", "", $sort_order, $sort);
                $filter = "";
                $filtertitle = str_replace('%name%', '&hellip;', lang('entries', 'filteron'));
            }
        }
    }
    if ($offset < $absmax - $show) {
        $prev = $offset + $show;
        $prevlink = sprintf('<a href="%s&amp;offset=%s&amp;show=%s%s%s">&laquo; ' . lang('entries', 'first') . '</a>&nbsp;&nbsp;', $myurl, $absmax - $show, $show, $filter, $entry_sort);
        $prevlink .= sprintf('<a href="%s&amp;offset=%s&amp;show=%s%s%s">&lsaquo; ' . lang('entries', 'previous') . ' %s</a>', $myurl, $prev, $show, $filter, $entry_sort, $show);
    } else {
        $prevlink = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    }
    if ($offset > 0) {
        $next = max(0, $offset - $show);
        $nextlink = sprintf('<a href="%s&amp;offset=%s&amp;show=%s%s%s">&rsaquo; ' . lang('entries', 'next') . ' %s</a>&nbsp;&nbsp;', $myurl, $next, $show, $filter, $entry_sort, $show);
        $nextlink .= sprintf('<a href="%s&amp;show=%s%s%s">&raquo; ' . lang('entries', 'last') . '</a>', $myurl, $show, $filter, $entry_sort);
    } else {
        $nextlink = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    }
    // make the html for the paginator..
    $numofpages = (int) ceil($absmax / abs($show));
    if ($numofpages > 1) {
        for ($i = 0; $i < $numofpages; $i++) {
            $init = $i * abs($show);
            $pages_arr[] = sprintf("<option value=\"%s%s&amp;show=%s%s&amp;offset=%s\">%s</option>", $myurl, $entry_sort, abs($show), $filter, $init, $i + 1);
        }
        $title = str_replace('%num%', ceil($offset / abs($show)) + 1, lang('entries', 'jumptopage'));
        $pages = "<select name='selectedPage' onchange='changePage(this.form.selectedPage)' \tclass='input'>";
        $pages .= sprintf("<option value='' selected='selected'>%s</option>", $title);
        $pages .= implode("\n", $pages_arr);
        $pages .= "</select>";
    }
    // make the HTML for the filter box
    if (isset($Pivot_Vars['filtercat']) || isset($Pivot_Vars['filteruser'])) {
        $pages_arr = array(sprintf("<option value=\"%s%s&amp;show=%s\">%s</option>", $myurl, $entry_sort, abs($show), lang('entries', 'filteroff')));
    } else {
        $pages_arr = array();
    }
    $cats = cfg_cats();
    $pages_arr[] = "<option value=''>" . lang('entries', 'category') . "</option>";
    foreach ($cats as $cat) {
        $pages_arr[] = sprintf("<option value=\"%s%s&amp;show=%s&amp;filtercat=%s\"> - %s</option>", $myurl, $entry_sort, abs($show), $cat['name'], $cat['name']);
    }
    $users = explode("|", $Cfg['users']);
    $pages_arr[] = "<option value=''>" . lang('entries', 'author') . "</option>";
    foreach ($users as $user) {
        $pages_arr[] = sprintf("<option value=\"%s%s&amp;show=%s&amp;filteruser=%s\"> - %s</option>", $myurl, $entry_sort, abs($show), $user, $user);
    }
    $pages .= "<select name='selectedFilter' onchange='changePage(this.form.selectedFilter)' class='input'>";
    $pages .= sprintf("<option value='' selected='selected'>%s</option>", $filtertitle);
    $pages .= implode("\n", $pages_arr);
    $pages .= "</select>";
    $searchval = isset($Pivot_Vars['search']) ? $Pivot_Vars['search'] : 'search';
    $pages .= "<input type='text' name='search' value='" . $searchval . "' class='input' style='padding: 2px; height: 19px; width: 90px;' onfocus='this.select();' />";
    // Some JS for the paginator and filter menus
    echo "<scr" . "ipt language='JavaScript' type='text/JavaScript'>\nfun" . "ction changePage(newLoc)\n{\nnextPage = newLoc.options[newLoc.selectedIndex].value;\nif (nextPage != '') { document.location.href = nextPage; } }</scr" . "ipt>";
    printf("<form name='form1' method='post' action='%s&amp;doaction=1'>\n<table cellspacing='0' class='tabular_border' border='0'>\n", $myurl);
    echo "<tr class='tabular_nav'><td colspan='8'>\n";
    echo '<table cellspacing="0" cellpadding="0" class="tabular_border" style="border:0px;" border="0" width="100%"><tr>';
    printf('<td>%s&nbsp;</td>', $prevlink);
    printf('<td align="center">%s</td>', $pages);
    printf('<td align="right" class="tabular_nav">&nbsp;%s</td></tr></table>', $nextlink);
    echo "\n</td></tr><tr class='tabular_header'><td>&nbsp;</td>";
    echo '<td><a href="' . $myurl . '&amp;sort=status">' . lang('entries', 'status') . '</a></td>';
    echo '<td><a href="' . $myurl . '&amp;sort=title">' . lang('entries', 'title') . '</a></td>';
    echo '<td><a href="' . $myurl . '&amp;sort=category">' . lang('entries', 'category') . '</a></td>';
    echo '<td><a href="' . $myurl . '&amp;sort=user">' . lang('entries', 'author') . '</a></td>';
    echo '<td><a href="' . $myurl . '&amp;sort=date">' . lang('entries', 'date') . '</a></td>';
    echo '<td><a href="' . $myurl . '&amp;sort=commcount">' . lang('entries', 'comm') . '</a></td>';
    echo '<td><a href="' . $myurl . '&amp;sort=trackcount">' . lang('entries', 'track') . '</a></td>';
    echo '</tr>';
    //End Sort Entry Changes
    foreach ($overview_arr as $overview_line) {
        print_row($overview_line);
    }
    echo '<tr class="tabular_header"><td colspan="8"><img src="pics/arrow_ltr.gif" width="29" height="14" border="0" alt="" />';
    echo '<a href="#" onclick=\'setCheckboxes("form1", true); return false;\'>' . lang('forms', 'c_all') . '</a> / ';
    echo '<a href="#" onclick=\'setCheckboxes("form1", false); return false;\'>' . lang('forms', 'c_none') . '</a>';
    echo '&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;' . lang('forms', 'with_checked_entries');
    echo '<select name="action" class="input">
	<option value="" selected="selected">' . lang('forms', 'choose') . '</option>
	<option value="publish">' . lang('forms', 'publish') . '</option>
	<option value="hold" >' . lang('forms', 'hold') . '</option>
	<option value="delete">' . lang('forms', 'delete') . '</option>
	<option value="generate">' . lang('forms', 'generate') . '</option>
			</select>';
    echo '&nbsp;&nbsp;<input type="submit" value="' . lang('go') . '" class="button" /></td></tr>';
    echo '</table></form>';
    PageFooter();
}
Ejemplo n.º 23
0
function profile_display_fields($userid)
{
    global $CFG, $USER, $DB;
    if ($categories = $DB->get_records('user_info_category', null, 'sortorder ASC')) {
        foreach ($categories as $category) {
            if ($fields = $DB->get_records('user_info_field', array('categoryid' => $category->id), 'sortorder ASC')) {
                foreach ($fields as $field) {
                    require_once $CFG->dirroot . '/user/profile/field/' . $field->datatype . '/field.class.php';
                    $newfield = 'profile_field_' . $field->datatype;
                    $formfield = new $newfield($field->id, $userid);
                    if ($formfield->is_visible() and !$formfield->is_empty()) {
                        print_row(format_string($formfield->field->name . ':'), $formfield->display_data());
                    }
                }
            }
        }
    }
}
Ejemplo n.º 24
0
    ?>
</td>
	</tr>
<?php 
} else {
    $prev_row['grade_scale_id'] = 0;
    foreach ($rows_scales as $row) {
        if ($row['grade_scale_id'] != $prev_row['grade_scale_id']) {
            // print row
            if ($prev_row['grade_scale_id'] != 0) {
                print_row($prev_row['grade_scale_id'], $prev_row['scale_name'], $whole_scale_value, $prev_row['created_date'], $_POST['grade_scale_id'], false);
            }
            // initialize next $whole_scale_value
            $whole_scale_value = $row['scale_value'] . ' = ' . $row['percentage_from'] . ' to ' . $row['percentage_to'] . '%';
            $prev_row = $row;
        } else {
            $whole_scale_value .= '<br />' . $row['scale_value'] . ' = ' . $row['percentage_from'] . ' to ' . $row['percentage_to'] . '%';
        }
    }
    // print last row
    if ($prev_row['grade_scale_id'] != 0) {
        print_row($prev_row['grade_scale_id'], $prev_row['scale_name'], $whole_scale_value, $prev_row['created_date'], $_POST['grade_scale_id'], false);
    }
}
?>

</tbody>
</table>
</div>
<?php 
require AT_INCLUDE_PATH . 'footer.inc.php';
Ejemplo n.º 25
0
 } 	
 	.header {
 		border:thin solid; 
 		background:#ddeedd;
 	}
</style>
<?php 
function exec_query($gl_type, $sku)
{
    $query = "SELECT SUM(`qty`) FROM `journal_item` where `gl_type` = '" . $gl_type . "' and `sku` = '" . $sku . "'";
    $resu = mysql_query($query);
    $cant = mysql_fetch_row($resu);
    return $cant[0];
}
function print_row($row)
{
    echo $row ? "<tr> <td> " . $row['sku'] . "</td> <td class='descripcion'> " . $row['descripcion'] . "</td> \n \t\t\t\t\t<td> " . $row['Compras'] . "</td> <td> " . $row['Ventas'] . "</td>  \n \t\t\t\t\t<td> " . $row['Cantidad Ajustada'] . "</td> <td> " . $row['Stock actual'] . "</td> <td> " . ($row['Compras'] - $row['Ventas']) . "</td></tr>" : "<table> \n \t\t\t\t\t<tr class='header'> <td> sku </td> <td> Descripcion </td> \n \t\t\t\t\t<td> Cant. Comprada </td> <td> Cant. Vendida </td> \n \t\t\t\t\t<td> Cant. Ajustada </td> <td> Stock actual </td> <td> Stock sin ajustar</td></tr>";
}
$db = mysql_connect("localhost", "root", "root");
mysql_select_db("phreebooks2");
$query = "SELECT ji.`sku` AS  'sku',\n\t            i.`description_short` AS  'descripcion',\n\t\t    i.`quantity_on_hand` AS  'Stock actual',\n\t\t    SUM( ji.qty ) AS  'Cantidad Ajustada'\n\t      \tFROM  `inventory` i INNER JOIN  `journal_item` ji \n\t\t\tON i.sku = ji.sku\n\t\tWHERE  `gl_type` =  'adj'\n\t\tGROUP BY ji.`sku` \n\t\tORDER BY `sku` ASC";
$results = mysql_query($query);
echo "<p> Cant. total de resultados: " . mysql_num_rows($results) . "(<a href='#' onclick='javascript:window.location.reload();'>Volver a calcular</a>)</p>";
print_row(false);
while ($row = mysql_fetch_array($results)) {
    $sku = $row[0];
    $row['Compras'] = exec_query('por', $sku);
    $row['Ventas'] = exec_query('sos', $sku);
    print_row($row);
}
echo "</table>";
Ejemplo n.º 26
0
function do_dispreport($date_in, $func_in)
{
    // $frm_date, $mode as params - 6/8/11
    global $nature, $disposition, $patient, $incident, $incidents;
    // 12/3/10
    global $evenodd, $types;
    global $w_tiny, $w_small, $w_medium, $w_large;
    // 4/14/11
    function the_time($in_val)
    {
        return date("j H:i", (int) $in_val);
    }
    function print_row($ary_in, $_i)
    {
        //
        $_evenodd = array("even", "odd");
        $_priorities = array("typical", "high", "highest");
        $disp_str = empty($ary_in[6]) ? "" : the_time($ary_in[6]) . " <I>(" . round(($ary_in[6] - $ary_in[2]) / 60) . ")</I>";
        $enr_str = empty($ary_in[7]) ? "" : the_time($ary_in[7]) . " <I>(" . round(($ary_in[7] - $ary_in[2]) / 60) . ")</I>";
        $onsc_str = empty($ary_in[8]) ? "" : the_time($ary_in[8]) . " <I>(" . round(($ary_in[8] - $ary_in[2]) / 60) . ")</I>";
        $facen_str = empty($ary_in[9]) ? "" : the_time($ary_in[9]) . " <I>(" . round(($ary_in[9] - $ary_in[2]) / 60) . ")</I>";
        $facar_str = empty($ary_in[10]) ? "" : the_time($ary_in[10]) . " <I>(" . round(($ary_in[10] - $ary_in[2]) / 60) . ")</I>";
        $clr_str = empty($ary_in[11]) ? "" : the_time($ary_in[11]) . " <I>(" . round(($ary_in[11] - $ary_in[2]) / 60) . ")</I>";
        $res_str = empty($ary_in[12]) ? "" : the_time($ary_in[12]);
        $_class = isset($_priorities[$ary_in[3]]) ? $_priorities[$ary_in[3]] : $_priorities[0];
        $_shortname = empty($ary_in[1]) ? "[#{$ary_in[0]}]" : shorten($ary_in[1], 32);
        $_full_time = format_date((string) $ary_in[2]);
        echo "<TR CLASS='{$_evenodd[$_i % 2]}'>";
        echo "<TD class='{$_class}' onmouseout='UnTip()' onmouseover=\"Tip('{$ary_in[1]}');\" >{$_shortname}</TD>";
        //	ticket name
        echo "<TD  onmouseout='UnTip()' onmouseover=\"Tip('{$_full_time}');\">" . the_time($ary_in[2]) . "</TD>";
        //	ticket start
        $_unit_name = empty($ary_in[5]) ? "[#{$ary_in[4]}]" : $ary_in[5];
        echo "<TD>{$_unit_name}</TD>";
        //	unit name
        echo "<TD>{$disp_str}</TD>";
        //	dispatched
        echo "<TD>{$enr_str}</TD>";
        //	en route
        echo "<TD>{$onsc_str}</TD>";
        //	on scene
        echo "<TD>{$facen_str}</TD>";
        //	far enroute
        echo "<TD>{$facar_str}</TD>";
        //	fac arr
        echo "<TD>{$clr_str}</TD>";
        //	clear
        echo "<TD>{$res_str}</TD>";
        //	reset
        echo "</TR>\n";
    }
    // end function echo row()
    /*
    0	- ticket id
    1	- ticket name
    2	- ticket start
    3	- ticket severity
    4	- unit id
    5	- unit name
    6	- dispatched
    7	- en route
    8	- on scene
    9	- far enroute
    10	- fac arr
    11	- clear
    12	- reset
    */
    function initial($row_in)
    {
        $ary_out = array("", "", "", "", "", "", "", "", "", "", "", "", "");
        $ary_out[0] = $row_in['ticket_id'];
        $ary_out[1] = $row_in['scope'];
        $ary_out[2] = $row_in['problemstart'];
        $ary_out[3] = $row_in['severity'];
        $ary_out[4] = $row_in['responder_id'];
        $ary_out[5] = $row_in['handle'];
        return $ary_out;
    }
    $from_to = date_range($date_in, $func_in);
    // get date range as array
    $titles = array();
    $titles['dr'] = "Dispatch - Daily Report - ";
    $titles['cm'] = "Dispatch - Current Month-to-date - ";
    $titles['lm'] = "Dispatch - Last Month - ";
    $titles['cw'] = "Dispatch - Current Week-to-date - ";
    $titles['lw'] = "Dispatch - Last Week - ";
    $titles['cy'] = "Dispatch - Current Year-to-date - ";
    $titles['ly'] = "Dispatch - Last Year - ";
    $to_str = $func_in == "dr" ? "" : " to " . $from_to[3];
    print "\n<TABLE ALIGN='left' BORDER = 0 >\n<TR CLASS='even' style='height: 24px'>\n";
    print "<TH COLSPAN=99 ALIGN = 'center' border=1>" . $titles[$func_in] . $from_to[2] . $to_str . "</TH></TR>\n";
    $where = " WHERE `when` BETWEEN '" . $from_to[0] . "' AND '" . $from_to[1] . "'";
    $which_inc = $_POST['frm_tick_sel'] == 0 ? "" : " AND `ticket_id` = " . $_POST['frm_tick_sel'];
    // 2/7/09
    $which_unit = $_POST['frm_resp_sel'] == 0 ? "" : " AND `responder_id` = " . $_POST['frm_resp_sel'];
    // 6/4/11
    $codes = "{$GLOBALS['LOG_CALL_DISP']}, {$GLOBALS['LOG_CALL_RESP']}, {$GLOBALS['LOG_CALL_ONSCN']}, {$GLOBALS['LOG_CALL_CLR']}, {$GLOBALS['LOG_CALL_RESET']}, {$GLOBALS['LOG_CALL_U2FENR']}, {$GLOBALS['LOG_CALL_U2FARR']}";
    //		$codes = "{$GLOBALS['LOG_CALL_U2FENR']}, {$GLOBALS['LOG_CALL_U2FARR']}";
    $query = "SELECT *, \n\t\t\tUNIX_TIMESTAMP(`l`.`when`) AS `when_num`, \n\t\t\tUNIX_TIMESTAMP(`t`.`problemstart`) AS `problemstart`, \n\t\t\t`r`.`name` AS `unit_name`, \n\t\t\t`l`.`info` AS `status`\n\t\t\tFROM `{$GLOBALS['mysql_prefix']}log` `l`\n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}ticket` `t` ON (`t`.`id` = `l`.`ticket_id`)\n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}responder` `r` ON (`r`.`id` = `l`.`responder_id`)\n\t\t\t{$where} {$which_inc} {$which_unit}\n\t\t\tAND `l`.`code` IN ({$codes})\n\t\t\tORDER BY `l`.`ticket_id` ASC, `l`.`responder_id` ASC, `l`.`code` ASC";
    $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), __FILE__, __LINE__);
    //		dump($query);
    $normalize = array($GLOBALS['LOG_CALL_DISP'] => 6, $GLOBALS['LOG_CALL_RESP'] => 7, $GLOBALS['LOG_CALL_ONSCN'] => 8, $GLOBALS['LOG_CALL_U2FENR'] => 9, $GLOBALS['LOG_CALL_U2FARR'] => 10, $GLOBALS['LOG_CALL_CLR'] => 11, $GLOBALS['LOG_CALL_RESET'] => 12);
    $i = 0;
    $disp_start = "";
    $_data = $empty = array("", "", "", "", "", "", "", "", "", "", "", "", "");
    // incident, unit, start, dispatch time, responding time, on-scene time, fac-enr time, fac-arr time, clear, reset
    $counts = $minutes = $stats = array(0, 0, 0, 0, 0, 0, 0);
    // elapsed minutes and counts to dispatched, responding, on-scene, fac-enr, fac-arr, cleared - 2/6/09
    if (mysql_affected_rows() > 0) {
        // main loop - top
        $header = "<TR><TH ALIGN='left'>&nbsp;{$incident}&nbsp;</TH><TH ALIGN='left'>&nbsp;Start&nbsp;</TH><TH ALIGN='left'>&nbsp;" . get_text("Unit") . "&nbsp;</TH><TH ALIGN='left'>&nbsp;Dispatched&nbsp;</TH><TH ALIGN='left'>&nbsp;Responding&nbsp;</TH><TH ALIGN='left'>&nbsp;On-scene&nbsp;</TH><TH ALIGN='left'>&nbsp;Fac-enr&nbsp;</TH><TH ALIGN='left'>&nbsp;Fac-arr&nbsp;</TH><TH ALIGN='left'>&nbsp;Cleared&nbsp;</TH><TH ALIGN='left'>&nbsp;Reset&nbsp;</TH></TR>\n";
        echo $header;
        $i = 0;
        $initialized = FALSE;
        while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
            if (!$initialized) {
                $_data = initial($row);
                $initialized = TRUE;
            }
            $disp_event = $normalize[$row['code']];
            // normalize to column position
            // change in incident, unit, or code collision?
            if ($row['ticket_id'] != $_data[0] || !$row['responder_id'] == $_data[4] || !empty($_data[$disp_event])) {
                print_row($_data, $i);
                $i++;
                if ($i % 100 == 0) {
                    echo $header;
                }
                $_data = initial($row);
                $_data[$normalize[$row['code']]] = $row['when_num'];
            } else {
                $_data[$normalize[$row['code']]] = $row['when_num'];
            }
        }
        // end while ...
        // do the last line if any
        if (!empty($_data[6]) || !empty($_data[7]) || !empty($_data[8]) || !empty($_data[9]) || !empty($_data[10]) || !empty($_data[11]) || !empty($_data[12])) {
            print_row($_data, $i);
        }
    } else {
        // 10/31/09
        print "\n<TR CLASS='odd'><TD COLSPAN='99' ALIGN='center'><br /><I>No data for this period</I><BR /></TD></TR>\n";
    }
    print "<TR><TD COLSPAN=99 ALIGN='center'><HR STYLE = 'color: blue; size: 1; width: 50%'></TD></TR>";
    print "</TABLE>\n";
}
Ejemplo n.º 27
0
    $result = "Not installed, but only required if you want to be able to authenticate " . "with IMAP against using the exchange authenticator.  See <a href=\"http://www.php.net/imap/\">this page</a> for " . "more information about downloading the IMAP extensions to PHP, and " . "instructions for recompiling PHP with the --with-imap flag.";
    $status = WARN;
} else {
    if (preg_match("/IMAP c-Client Version.*?>([0-9]+)/si", $php_info, $match)) {
        $result = $match[1];
    } else {
        $result = "Unknown";
    }
    $status = OK;
}
print_row("IMAP library", $result, $status);
// BC
if (!function_exists("bcadd")) {
    $result = "Not installed.  This PHP extension is required in order to decode certain " . "types of URLs.  See <a href=\"http://www.php.net/bc/\">this page</a> " . "for more information about recompiling PHP with the --enable-bcmath flag.";
    $status = ERROR;
} else {
    $result = "";
    $status = OK;
}
print_row("BC math library", $result, $status);
// gd
if (!function_exists("gd_info")) {
    $result = "Not installed, but only required if you want to be able to generate charts " . "based on Maia's statistics.  See <a href=\"http://www.php.net/gd/\">this page</a> " . "for more information about recompiling PHP with the --with-gd flag.";
    $status = ERROR;
} else {
    $info = gd_info();
    $result = $info["GD Version"];
    $status = OK;
}
print_row("gd graphics library", $result, $status);
print "</table></div>\n";
Ejemplo n.º 28
0
if (!$isseparategroups) {
    if ($usergroups = groups_get_all_groups($course->id, $user->id)) {
        $groupstr = '';
        foreach ($usergroups as $group) {
            $groupstr .= ' <a href="' . $CFG->wwwroot . '/user/index.php?id=' . $course->id . '&amp;group=' . $group->id . '">' . format_string($group->name) . '</a>,';
        }
        print_row(get_string("group") . ":", rtrim($groupstr, ', '));
    }
}
/// End of printing groups
/// Printing Interests
if (!empty($CFG->usetags)) {
    $interests = get_item_tags('user', $user->id);
    $instereststr = tag_links_csv($interests);
    if ($interests) {
        print_row(get_string('interests') . ": ", rtrim($instereststr));
    }
}
/// End of Printing Interests
echo "</table>";
echo "</td></tr></table>";
$userauth = get_auth_plugin($user->auth);
$passwordchangeurl = false;
if ($currentuser and $userauth->can_change_password() and !isguestuser() and has_capability('moodle/user:changeownpassword', $systemcontext)) {
    if (!($passwordchangeurl = $userauth->change_password_url())) {
        if (empty($CFG->loginhttps)) {
            $passwordchangeurl = "{$CFG->wwwroot}/login/change_password.php";
        } else {
            $passwordchangeurl = str_replace('http:', 'https:', $CFG->wwwroot . '/login/change_password.php');
        }
    }
Ejemplo n.º 29
0
    if ($user->lastaccess) {
        $datestring = userdate($user->lastaccess) . "&nbsp; (" . format_time(time() - $user->lastaccess) . ")";
    } else {
        $datestring = get_string("never");
    }
    print_row(get_string("lastaccess") . ":", $datestring);
}
/// Printing tagged interests
if (!empty($CFG->usetags)) {
    if ($interests = tag_get_tags_csv('user', $user->id)) {
        print_row(get_string('interests') . ": ", $interests);
    }
}
if (!isset($hiddenfields['suspended'])) {
    if ($user->suspended) {
        print_row('', get_string('suspended', 'auth'));
    }
}
echo "</table></div></div>";
echo $OUTPUT->blocks_for_region('content');
// Print messaging link if allowed
if (isloggedin() && has_capability('moodle/site:sendmessage', $context) && !empty($CFG->messaging) && !isguestuser() && !isguestuser($user) && $USER->id != $user->id) {
    echo '<div class="messagebox">';
    echo '<a href="' . $CFG->wwwroot . '/message/index.php?id=' . $user->id . '">' . get_string('messageselectadd') . '</a>';
    echo '</div>';
}
if ($CFG->debugdisplay && debugging('', DEBUG_DEVELOPER) && $currentuser) {
    // Show user object
    echo '<br /><br /><hr />';
    echo $OUTPUT->heading('DEBUG MODE:  User session variables');
    print_object($USER);
Ejemplo n.º 30
0
    ?>
onds)</span><?php 
} else {
    ?>
) <?php 
}
?>
         </td>
         <td>CHASE<br/><?php 
echo $right;
?>
</td>
        </tr>
<?php 
for ($i = 0; $i < 6; ++$i) {
    print_row($i);
}
?>
      </table>
     </div>
   <div id="csr_photo">
    <a style="background: url(<?php 
echo $urls['connor'];
?>
) 50% 50%;
              background-repeat: no-repeat"
        href="http://www.flickr.com/photos/reedville/tags/connor">&nbsp;</a>
   </div>
   <div id="car_photo">
    <a style="background: url(<?php 
echo $urls['chase'];