本文整理汇总了PHP中ordinal函数的典型用法代码示例。如果您正苦于以下问题:PHP ordinal函数的具体用法?PHP ordinal怎么用?PHP ordinal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ordinal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _dependency
function _dependency($pool)
{
if (!empty($pool['dependency_pool_id'])) {
if (!array_key_exists('DependencyPool', $pool)) {
trigger_error('Missing dependency information', E_USER_ERROR);
}
if ($pool['DependencyPool']['type'] == 'crossover') {
return ($pool['dependency_id'] == 1 ? 'winner' : 'loser') . ' of ' . $pool['DependencyPool']['name'];
} else {
return ordinal($pool['dependency_id']) . ' in pool ' . $pool['DependencyPool']['name'];
}
} else {
if (!empty($pool['dependency_ordinal'])) {
return ordinal($pool['dependency_id']) . ' among ' . ordinal($pool['dependency_ordinal']) . ' place teams';
} else {
return sprintf(__('%s seed', true), ordinal($pool['dependency_id']));
}
}
}
示例2: PDO
$username = "w-menu";
$dbname = "w_menu";
$conn = new PDO("mysql:host={$dbserver};dbname={$dbname}", $username, $password);
$conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare('SELECT * FROM allGroupUsers;');
$stmt->execute();
$result = $stmt->fetchAll();
$temp_user_array = [];
$temp_group_array = [];
$final_array = [];
$i = 0;
foreach ($result as $row) {
if ($row['user'] == NULL) {
$i++;
$temp = array('place' => ordinal($i), 'group' => $row['groupName'], 'user' => '', 'total' => $row['total']);
array_push($temp_group_array, $temp);
} else {
$temp1 = array('place' => '', 'group' => $row['groupName'], 'user' => $row['user'], 'total' => $row['total']);
array_push($temp_user_array, $temp1);
}
}
asort($temp_user_array);
asort($temp_group_array);
foreach ($temp_group_array as $tg) {
array_push($final_array, $tg);
foreach ($temp_user_array as $tu) {
if ($tu['group'] == $tg['group']) {
$temp = array('place' => '', 'group' => '', 'user' => $tu['user'], 'total' => $tu['total']);
array_push($final_array, $temp);
}
示例3: ordinal
case 5:
# friday
$style_wd = ' style="border-bottom:1px solid #aaa;"';
break;
case 0:
# sunday
$style_wd = ' style="border-bottom:1px solid #666;"';
break;
default:
$style_wd = '';
}
echo '<tr class="', $is_weekend ? 'even' : 'odd', '">', "\n";
# day
#
echo '<td class="r"', $style_wd, '>';
echo ordinal($day, $lang_2, true);
echo '</td>', "\n";
# inbound calls
#
$num_entered = (int) @$CDR_DB->executeGetOne('SELECT COUNT(DISTINCT(`ast_call_id`)) FROM `queue_log` WHERE
`queue_id`=' . $queue_id . '
AND `event`=\'_ENTER\'
AND ' . $sql_time);
echo '<td class="r"', $style_wd, '>', $num_entered, '</td>', "\n";
$totals['num_entered'] += $num_entered;
# connected to an agent
#
$num_connected = (int) @$CDR_DB->executeGetOne('SELECT COUNT(*) FROM `queue_log` WHERE
`queue_id`=' . $queue_id . '
AND `event`=\'_CONNECT\'
AND ' . $sql_time);
示例4: _e
if ($camp->action == 3) {
/*
* When new content is added
*/
_e('Scheduled to post when new content is added:<br/>', 'sola');
if ($type == 1) {
_e('Daily at ' . $time, 'sola');
} else {
if ($type == 2) {
_e('Weekly on ' . $day . ' at ' . $time, 'sola');
} else {
if ($type == 3) {
/*
* fix 1st 2nd 3rd
*/
_e('Monthly on the ' . $daynum . ordinal($daynum) . ' at ' . $time, 'sola');
} else {
if ($type == 4) {
/*
* Do nothing for this type
*/
} else {
if ($type == 5) {
_e('Immediately', 'sola');
}
}
}
}
}
} else {
if ($camp->action == 4) {
示例5: count
$stmt = $db->query("SELECT * FROM users WHERE id={$uid}");
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
include $_SERVER['DOCUMENT_ROOT'] . "/pdc.php";
$stmt = $db->query('SELECT * FROM user_stats WHERE stat_id=14 AND value > 100 ORDER BY value DESC');
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
$j = count($results);
?>
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8 table-responsive">
<h1>Flashcard Rankings</h1>
<p>Increase your rank by answering more flashcards correctly.</p>
<table class="table table-striped table-hover">
<?php
echo ($_GET['player'] != $_SESSION['username'] ? "<a href='http://www.JPVocab.com/player.php?player=" . $_GET['player'] . "&report=summary'>" . $_GET['player'] . '</a> is ' : 'You are ') . 'ranked <b>' . ordinal($ranktfca) . '</b>';
?>
<tr>
<th class="text-center">Rank</th>
<th>User</th>
<th class="text-center">#</th>
</tr><?php
$n = $ranktfca - 4 <= 0 ? 0 : $ranktfca - 4;
$j = $n + 5;
for ($n; $n < $j; $n++) {
try {
$user = getUN($results[$n]['user_id'], $db);
} catch (PDOException $ex) {
//echo "Username error <br />";
}
if ($results[$n + 1]['value'] == $results[$n]['value']) {
示例6: datetimeToText
function datetimeToText($datetime = "", $includeTime = false)
{
$unixdatetime = strtotime($datetime);
$day = ordinal(strftime("%d", $unixdatetime));
if (!$includeTime) {
return stripZerosFromDate(strftime("%B *{$day}, %Y", $unixdatetime));
}
return stripZerosFromDate(strftime("%B *{$day}, %Y at *%I:%M %p", $unixdatetime));
}
示例7: render_option
private function render_option($sv, $o)
{
global $Conf;
if ($o) {
$id = $o->id;
} else {
$o = PaperOption::make(array("id" => $o, "name" => "(Enter new option)", "description" => "", "type" => "checkbox", "position" => count(PaperOption::nonfixed_option_list()) + 1, "display" => "default"));
$id = "n";
}
if ($sv->use_req() && isset($sv->req["optn{$id}"])) {
$o = PaperOption::make(array("id" => $id, "name" => $sv->req["optn{$id}"], "description" => get($sv->req, "optd{$id}"), "type" => get($sv->req, "optvt{$id}", "checkbox"), "visibility" => get($sv->req, "optp{$id}", ""), "position" => get($sv->req, "optfp{$id}", 1), "display" => get($sv->req, "optdt{$id}")));
if ($o->has_selector()) {
$o->selector = explode("\n", rtrim(defval($sv->req, "optv{$id}", "")));
}
}
echo "<table><tr><td><div class='f-contain'>\n", " <div class='f-i'>", "<div class='f-c'>", $sv->label("optn{$id}", $id === "n" ? "New option name" : "Option name"), "</div>", "<div class='f-e'>", Ht::entry("optn{$id}", $o->name, $sv->sjs("optn{$id}", array("placeholder" => "(Enter new option)", "size" => 50))), "</div>\n", " </div><div class='f-i'>", "<div class='f-c'>", $sv->label("optd{$id}", "Description"), "</div>", "<div class='f-e'>", Ht::textarea("optd{$id}", $o->description, array("rows" => 2, "cols" => 50, "id" => "optd{$id}")), "</div>\n", " </div></div></td>";
echo '<td style="padding-left:1em">';
if ($id !== "n" && ($examples = $o->example_searches())) {
echo '<div class="f-i"><div class="f-c">Example ' . pluralx($examples, "search") . "</div>";
foreach ($examples as &$ex) {
$ex = "<a href=\"" . hoturl("search", array("q" => $ex[0])) . "\">" . htmlspecialchars($ex[0]) . "</a>";
}
echo '<div class="f-e">', join("<br/>", $examples), "</div></div>";
}
echo "</td></tr>\n <tr><td colspan='2'><table id='foldoptvis{$id}' class='fold2c fold3o'><tr>";
echo "<td class='pad'><div class='f-i'><div class='f-c'>", $sv->label("optvt{$id}", "Type"), "</div><div class='f-e'>";
$optvt = $o->type;
if ($optvt == "text" && $o->display_space > 3) {
$optvt .= ":ds_" . $o->display_space;
}
if ($o->final) {
$optvt .= ":final";
}
$show_final = $Conf->collectFinalPapers();
foreach (PaperOption::nonfixed_option_list() as $ox) {
$show_final = $show_final || $ox->final;
}
$otypes = array();
if ($show_final) {
$otypes["xxx1"] = array("optgroup", "Options for submissions");
}
$otypes["checkbox"] = "Checkbox";
$otypes["selector"] = "Selector";
$otypes["radio"] = "Radio buttons";
$otypes["numeric"] = "Numeric";
$otypes["text"] = "Text";
if ($o->type == "text" && $o->display_space > 3 && $o->display_space != 5) {
$otypes[$optvt] = "Multiline text";
} else {
$otypes["text:ds_5"] = "Multiline text";
}
$otypes["pdf"] = "PDF";
$otypes["slides"] = "Slides";
$otypes["video"] = "Video";
$otypes["attachments"] = "Attachments";
if ($show_final) {
$otypes["xxx2"] = array("optgroup", "Options for accepted papers");
$otypes["pdf:final"] = "Alternate final version";
$otypes["slides:final"] = "Final slides";
$otypes["video:final"] = "Final video";
$otypes["attachments:final"] = "Final attachments";
}
echo Ht::select("optvt{$id}", $otypes, $optvt, array("onchange" => "do_option_type(this)", "id" => "optvt{$id}")), "</div></div></td>\n";
$Conf->footerScript("do_option_type(\$\$('optvt{$id}'),true)");
echo "<td class='fn2 pad'><div class='f-i'><div class='f-c'>", $sv->label("optp{$id}", "Visibility"), "</div><div class='f-e'>", Ht::select("optp{$id}", array("admin" => "Administrators only", "rev" => "Visible to PC and reviewers", "nonblind" => "Visible if authors are visible"), $o->visibility, array("id" => "optp{$id}")), "</div></div></td>\n";
echo "<td class='pad'><div class='f-i'><div class='f-c'>", $sv->label("optfp{$id}", "Form order"), "</div><div class='f-e'>";
$x = array();
// can't use "foreach (PaperOption::nonfixed_option_list())" because caller
// uses cursor
for ($n = 0; $n < count(PaperOption::nonfixed_option_list()); ++$n) {
$x[$n + 1] = ordinal($n + 1);
}
if ($id === "n") {
$x[$n + 1] = ordinal($n + 1);
} else {
$x["delete"] = "Delete option";
}
echo Ht::select("optfp{$id}", $x, $o->position, array("id" => "optfp{$id}")), "</div></div></td>\n";
echo "<td class='pad fn3'><div class='f-i'><div class='f-c'>", $sv->label("optdt{$id}", "Display"), "</div><div class='f-e'>";
echo Ht::select("optdt{$id}", ["default" => "Default", "prominent" => "Prominent", "topics" => "With topics", "submission" => "Near submission"], $o->display_name(), array("id" => "optdt{$id}")), "</div></div></td>\n";
if (isset($otypes["pdf:final"])) {
echo "<td class='pad fx2'><div class='f-i'><div class='f-c'> </div><div class='f-e hint' style='margin-top:0.7ex'>(Set by accepted authors during final version submission period)</div></div></td>\n";
}
echo "</tr></table>";
$rows = 3;
if (PaperOption::type_has_selector($optvt) && count($o->selector)) {
$value = join("\n", $o->selector) . "\n";
$rows = max(count($o->selector), 3);
} else {
$value = "";
}
echo "<div id='foldoptv{$id}' class='", PaperOption::type_has_selector($optvt) ? "foldo" : "foldc", "'><div class='fx'>", "<div class='hint' style='margin-top:1ex'>Enter choices one per line. The first choice will be the default.</div>", Ht::textarea("optv{$id}", $value, $sv->sjs("optv{$id}", array("rows" => $rows, "cols" => 50))), "</div></div>";
echo "</td></tr></table>\n";
}
示例8: prepareVariables
function prepareVariables($variables, $userid = NULL)
{
if ($userid == NULL) {
if (isset($_SESSION["userinfo"]["id"])) {
$userid = $_SESSION["userinfo"]["id"];
}
}
if ($variables["id"]) {
//i.e. only on update
unset($this->fields["type"]);
if ($variables["typeCheck"] == "TS" && isset($variables["repeating"]) && $variables["lastrepeat"]) {
$variables["lastrepeat"] = NULL;
$variables["firstrepeat"] = NULL;
$variables["timesrepeated"] = NULL;
if (isset($variables["completed"])) {
$variables["completedChange"] = 0;
}
$this->resetRepeating($variables["id"]);
}
//end if
}
//end if
if (isset($variables["thetype"])) {
$variables["type"] = $variables["thetype"];
}
if (!isset($variables["completed"])) {
$variables["completeddate"] = NULL;
}
if ($variables["enddate"] == "") {
$variables["enddate"] = NULL;
$variables["endtime"] = NULL;
}
if ($variables["startdate"] == "") {
$variables["startdate"] = NULL;
$variables["starttime"] = NULL;
}
if (isset($variables["repeating"])) {
$thename = "Every ";
switch ($variables["repeattype"]) {
case "Daily":
if ($variables["repeatevery"] != 1) {
$thename .= $variables["repeatevery"] . " days";
} else {
$thename .= " day ";
}
$variables["repeatechlist"] = NULL;
$variables["repeatontheday"] = NULL;
$variables["repeatontheweek"] = NULL;
break;
case "Weekly":
if ($variables["repeatevery"] != 1) {
$thename .= $variables["repeatevery"] . " weeks on";
} else {
$thename .= "week on";
}
foreach (explode("::", $variables["eachlist"]) as $dayNum) {
$tempday = $dayNum != 7 ? $dayNum + 1 : 1;
$thename .= " " . nl_langinfo(constant("ABDAY_" . $tempday)) . ", ";
}
$thename = substr($thename, 0, strlen($thename) - 2);
if (strpos($thename, ",") != false) {
$thename = strrev(preg_replace("/,/", "dna ", strrev($thename), 1));
}
$variables["repeateachlist"] = $variables["eachlist"];
$variables["repeatontheday"] = NULL;
$variables["repeatontheweek"] = NULL;
break;
case "Monthly":
if ($variables["repeatevery"] != 1) {
$thename .= $variables["repeatevery"] . " months";
} else {
$thename .= "month";
}
$thename .= " on the";
if ($variables["monthlyWhat"] == 1) {
foreach (explode("::", $variables["eachlist"]) as $dayNum) {
$thename .= " " . ordinal($dayNum) . ", ";
}
$thename = substr($thename, 0, strlen($thename) - 2);
if (strpos($thename, ",") != false) {
$thename = strrev(preg_replace("/,/", "dna ", strrev($thename), 1));
}
$variables["repeateachlist"] = $variables["eachlist"];
$variables["repeatontheday"] = NULL;
$variables["repeatontheweek"] = NULL;
} else {
foreach ($this->weekArray as $key => $value) {
if ($value == $variables["monthlyontheweek"]) {
$thename .= " " . strtolower($key);
}
}
foreach ($this->dayOfWeekArray as $key => $value) {
if ($value == $variables["monthlyontheday"]) {
$thename .= " " . $key;
}
}
$variables["repeateachlist"] = NULL;
$variables["repeatontheday"] = $variables["monthlyontheday"];
$variables["repeatontheweek"] = $variables["monthlyontheweek"];
}
//.........这里部分代码省略.........
示例9: _l
<?php
if (module_config::c('ticket_allow_priority', 0)) {
?>
<tr>
<th class="width1">
<?php
echo _l('Priority Support');
?>
</th>
<td>
<?php
module_template::init_template('ticket_priority_support', '<em>New!</em> Need a <strong>fast</strong> reply? Priority support will place your ticket at the front of the support queue. <br/>Priority Support Cost: {COST}<br/>{CHECKBOX} <label for="do_priority">Yes, upgrade to <strong>priority support</strong> and move my ticket to position: {TICKET_POSITION}</label>', 'Displayed at the bottom of ticket support signup', 'code', array('cost' => 'Cost as defined by ticket_priority_code advanced setting', 'TICKET_POSITION' => 'displays the string (example) "1st out of 44"'));
$template = module_template::get_template_by_key('ticket_priority_support');
$template->assign_values(array('cost' => dollar(module_config::c('ticket_priority_cost', 10), true, module_config::c('ticket_priority_currency', 1)), 'TICKET_POSITION' => _l('%s out of %s', ordinal(module_ticket::ticket_count('priority') + 1), $ticket['total_pending']), 'CHECKBOX' => '<input type="checkbox" name="do_priority" id="do_priority" value="1">'));
echo $template->replace_content();
?>
</td>
</tr>
<?php
}
?>
<?php
if (module_config::c('ticket_turn_around_days_show', 1)) {
?>
<tr>
示例10: toString
public function toString()
{
global $app;
// lack of quoted attributes prevents weird double escaping errors
$m = "<div class=bdp>";
foreach ($this->combos as $combo) {
if ($combo->vendorName == 'Bookstore' && $combo->numItems != 1) {
$bookstoreMulti = 'true';
} else {
$bookstoreMulti = 'false';
}
$vendorName = $combo->vendorName == 'Bookstore' ? 'the bookstore' : $combo->vendorName;
$m .= "<p><span class=vendor data-bookstore={$bookstoreMulti}>";
$m .= "{$combo->numItems} book" . ($combo->numItems != 1 ? 's' : '');
$m .= " from {$vendorName}</span>";
if ($bookstoreMulti == 'false') {
$url = $app->urlFor('redirect', array('url' => '', 'type' => 'bdp', 'vendor' => $combo->vendorName)) . $combo->url;
$label = $combo->vendorName == 'Chegg' ? 'Rent' : 'Buy';
$m .= "<button data-url={$url}>{$label}</button></p>";
} else {
$m .= "</span></p>";
foreach (array_values($combo->prices) as $i => $price) {
$num = ordinal($i + 1);
$url = $app->urlFor('redirect', array('url' => '', 'type' => 'bdp', 'vendor' => $price->vendorName)) . $price->url;
$m .= "<p><span class=aBookstoreBook>{$num} Book</span>" . "<button data-url={$url}>Buy</button></p>";
}
}
}
$m .= "</div>";
return $m;
}
示例11: get_grade_name
function get_grade_name($grade_id)
{
return ordinal($grade_id) . " " . "Grade";
}
示例12: _l
<tr>
<th>
<?php
echo _l('Status');
?>
</th>
<td>
<?php
//echo print_select_box(module_ticket::get_statuses(),'status_id',$ticket['status_id'],'',true,false,true);
$s = module_ticket::get_statuses();
echo $s[$ticket['status_id']];
if ($ticket['status_id'] == 2 || $ticket['status_id'] == 3 || $ticket['status_id'] == 5) {
if (module_config::c('ticket_show_position', 1)) {
echo ' ';
echo _l('(%s out of %s tickets)', ordinal($ticket['position']), module_ticket::ticket_count('pending'));
}
}
?>
</td>
</tr>
</tbody>
</table>
<?php
$fieldset_data = array('heading' => array('title' => _l('Ticket Details'), 'type' => 'h3'), 'elements_before' => ob_get_clean());
echo module_form::generate_fieldset($fieldset_data);
unset($fieldset_data);
if (file_exists(dirname(__FILE__) . '/../inc/ticket_priority_sidebar.php')) {
include dirname(__FILE__) . '/../inc/ticket_priority_sidebar.php';
示例13: date
$newDateMonth = date("M", strtotime($date));
$content = $_POST['nowcontent'];
$CTA = $_POST['nowCTA'];
?>
<?php
function ordinal($number)
{
$ends = array('<span class="ord">th</span>', '<span class="ord">st</span>', '<span class="ord">nd</span>', '<span class="ord">rd</span>', '<span class="ord">th</span>', '<span class="ord">th</span>', '<span class="ord">th</span>', '<span class="ord">th</span>', '<span class="ord">th</span>', '<span class="ord">th</span>');
if ($number % 100 >= 11 && $number % 100 <= 13) {
return $number . '<span class="ord">th</span>';
} else {
return $number . $ends[$number % 10];
}
}
$newDateDayPrint = ordinal($newDateDay);
?>
<div class="container">
<div class="date">
<?php
echo $newDateDayPrint;
?>
<?php
echo htmlspecialchars($newDateMonth);
?>
<br/>
Right Now
</div>
<div class="now-content">
<?php
示例14: ordinal
$notificationMessage = "For some reason, the reset email could not be sent.<br>Please try again later.";
break;
case "couldnotsetresetlink":
$notificationMessage = "The email address specified for password reset does not have an account.";
break;
case "emailresetinvalid":
$notificationMessage = "The email address specified for password reset didn't work.<br>Please try again.";
break;
case "resetemailblank":
$notificationMessage = "The password reset form somehow got submitted without some essential information.<br>Please try filling it out again.";
break;
case "loginfailed":
$notificationMessage = "We couldn't log you in because your email or password was incorrect.<br>";
$_SESSION['loginfailures'] += 1;
if ($_SESSION['loginfailures'] < 10) {
$notificationMessage .= "This is your <strong>" . ordinal($_SESSION['loginfailures']) . "</strong> failed attempt.<br>After 10 failures, you will not be able to log in for 1 hour.<br>Please try again.";
} else {
$_SESSION['loginlockouttime'] = time();
$notificationMessage .= "Since you failed to log in successfully 10 times, you may not try again for 1 hour.";
}
break;
case "emaildoesnotexist":
$notificationMessage = "The email address you entered doesn't have an account.<br>Would you like to <span class='clickable' onclick='ShowInfo(\"loginForm\")'>create an account</span>?";
break;
case "emailinvalid":
$notificationMessage = "The email address you entered didn't work.<br>Please try another.";
break;
case "resetlinkfailed":
$notificationMessage = "The reset link used is not valid. Please make sure you have copied it correctly.";
break;
case "resetlinkinvalid":
示例15: if
<td class="text-right"><b>Total</b></td>
<td><?php
echo $sumcfc;
?>
</td>
</tr>
<tr>
<td colspan="2" class="text-center active"><h4>Ranking</h4></td>
</tr><?
if($ranktfca == 1){
$ranktfcaGlyph = '<abbr title="The King of flashcards!"><span class="glyphicon glyphicon-king" aria-hidden="true"></span></abbr>';
}else if($ranktfca == 2){
$ranktfcaGlyph = '<abbr title="This player is ranked #2 for Flashcards!"><span class="glyphicon glyphicon-knight" aria-hidden="true"></span></abbr>';
}else if($ranktfca == 3){
$ranktfcaGlyph = '<abbr title="This player is ranked #3 for Flashcards!"><span class="glyphicon glyphicon-bishop" aria-hidden="true"></span></abbr>';
}else{ $ranktfcaGlyph = '';}?>
<tr >
<td>Flashcard Rank</td>
<td><a href='http://www.JPVocab.com/player.php?player=<?php
echo $_GET['player'];
?>
&report=flashcardrank'><?php
echo ordinal($ranktfca) . " <span class='pull-right'>" . $ranktfcaGlyph . '</span>';
?>
</a></td>
</tr>
</table>
</div>
<div class="col-md-2"></div>
</div><!-- end .row-->