本文整理匯總了PHP中print_row函數的典型用法代碼示例。如果您正苦於以下問題:PHP print_row函數的具體用法?PHP print_row怎麽用?PHP print_row使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了print_row函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: print_header
// 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();
示例2: print_row
}
print_row(get_string("firstaccess").":", $datestring);
}
if (!isset($hiddenfields['lastaccess'])) {
if ($user->lastaccess) {
$datestring = userdate($user->lastaccess)." (".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>';
}
示例3: format_string
}
$class = 'class="dimmed"';
}
$courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&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
示例4: profile_display_fields
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());
}
}
}
}
}
}
示例5: http_post_string
$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>');
示例6: print_row
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 ' ';
for ($s = 0; $s < $level - 1; $s++) {
echo ' ';
}
echo '<span style="opacity:0.5">└</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})) {
//.........這裏部分代碼省略.........
示例7: mysql_query
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> <p> <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
示例8: die
// 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();
示例9: writeln
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" => "mailuser@example.com"));
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>');
示例10: promote
//.........這裏部分代碼省略.........
}
$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";
}
}
}
示例11: while
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
示例12: writeln
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>');
示例13: print_attendance_table
function print_attendance_table($user, $course)
{
$complete = get_attendance($user->id, $course);
$percent = get_percent($user->id, $course) . ' %';
$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(' ', ' ');
echo '</table>';
}
示例14: get_context_instance
}
//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);
示例15: print_header
// 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();