本文整理汇总了PHP中array_orderby函数的典型用法代码示例。如果您正苦于以下问题:PHP array_orderby函数的具体用法?PHP array_orderby怎么用?PHP array_orderby使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了array_orderby函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array_orderby
/**
* 对二维数组进行按字段排序
* @param array $array 要排序的二维数组
* @param bool $orderby 根据该字段(二维数组单个元素中的键名)排序
* @param string $order 排序方式,asc:升序;desc:降序(默认)
* @param string $children 子元素字段(键名),当元素含有该字段时,进行递归排序
* @return array
*/
function array_orderby(&$array, $orderby = null, $order = 'desc', $children = false)
{
if ($orderby == null) {
return $array;
}
$key_value = $new_array = array();
foreach ($array as $k => $v) {
$key_value[$k] = $v[$orderby];
}
if ($order == 'asc') {
asort($key_value);
} else {
arsort($key_value);
}
reset($key_value);
foreach ($key_value as $k => $v) {
$new_array[$k] = $array[$k];
// 如果有children
if ($children && isset($new_array[$k][$children])) {
$new_array[$k][$children] = array_orderby($new_array[$k][$children], $orderby, $order, $children);
}
}
$new_array = array_values($new_array);
// 使键名为0,1,2,3...
$array = $new_array;
return $new_array;
}
示例2: searchWorksheets
function searchWorksheets($searchTerms)
{
$searchArray = convertSearchTerms($searchTerms);
if (count($searchArray) === 0) {
returnToPageNoResults();
}
$query = "SELECT `Version ID`, `WName` Name FROM `TWORKSHEETVERSION` WHERE ";
foreach ($searchArray as $key => $searchTerm) {
if ($key != 0) {
$query .= " OR ";
}
$query .= "`WName` LIKE '%{$searchTerm}%' ";
}
$query .= "ORDER BY `WName`";
try {
$worksheets = db_select_exception($query);
if (count($worksheets) === 0) {
returnToPageNoResults();
}
} catch (Exception $ex) {
returnToPageError($ex, "There was an error running the search query");
}
$fullSearchArray = getFullSearchArray($searchArray);
// Score the worksheets
foreach ($worksheets as $key => $worksheet) {
$worksheets[$key] = scoreWorksheet($worksheet, $fullSearchArray);
}
$sorted = array_orderby($worksheets, 'Score', SORT_DESC, 'Name', SORT_ASC);
$response = array("success" => TRUE, "vids" => $sorted);
echo json_encode($response);
exit;
}
示例3: getUnspentOutputsWith
public function getUnspentOutputsWith($minbitcoin, $minmastercoin, $mintestcoin)
{
$unspentoutputs = $this->getUnspentOutputs();
$filterbalanace = function ($var) use($minbitcoin, $minmastercoin, $mintestcoin) {
$bitcoin = floatval($var["amount"]);
$mastercoin = floatval($var["mastercoin"]);
$testcoin = floatval($var["testcoin"]);
return $minbitcoin <= $bitcoin && $minmastercoin <= $mastercoin && $mintestcoin <= $testcoin;
};
$unspentoutputs = array_orderby($unspentoutputs, "confirmations", ORDER_BY_DESC);
return array_filter($unspentoutputs, $filterbalanace);
}
示例4: returnOrderedFeed
function returnOrderedFeed($t, $s, $f, $c)
{
if ($t == -1 | $s == -1 | $c == -1) {
return "";
}
$service = DB::queryOneRow("SELECT id FROM categories WHERE id=%s", $s);
$companies = DB::query("SELECT name, id, category_id FROM category_items WHERE category_id=%s AND id=%d", $service["id"], $c);
$orders = array();
$now = new DateTime("now");
$addressCache = array();
foreach ($companies as $company) {
if ($company["name"]) {
$q = DB::query("SELECT * FROM orders WHERE service_id=%s AND category_id=%s", $company["category_id"], $company["id"]);
}
foreach ($q as $order) {
if (!array_key_exists($order["user_id"], $addressCache)) {
$addressCache[$order["user_id"]] = UserManager::getAddressFor($order["user_id"]);
}
$addr = refineArray(array($addressCache[$order["user_id"]]), array("street", "apartment", "city", "state", "zip"))[0];
$di = $now->diff(new DateTime($order["time"]));
if ($di->d <= $t) {
$items = UserManager::getItemsForCart($order["user_id"], $order["id"]);
//$order["cart_id"]);
$userdata = DB::queryOneRow("SELECT * FROM accounts WHERE uid=%s", $order["user_id"]);
$userdata = refineArray(array($userdata), array("name", "email", "phone"))[0];
$nonOrderedOrder = array_merge($order, array_merge(array("compName" => $company["name"], "items" => $items["html"], "price" => $items["price"]), $addr, $userdata));
$sortOrder = array("time", "compName", 5, 6, 7, 0, 1, 2, 3, 4, "items", "price");
$nonOrderedOrder_trimmed = refineArray(array($nonOrderedOrder), $sortOrder)[0];
// time, restname, username, email, phone, street, apt, city, state, zip, items, total
// array_multisort($nonOrderedOrder_trimmed, $sortOrder);
$orderedOrder = $nonOrderedOrder_trimmed;
$orderedOrder["category_id"] = $nonOrderedOrder["category_id"];
$orderedOrder["campus"] = $nonOrderedOrder["campus"];
$orderedOrder["timeSince"] = $di->d;
$orders[] = $orderedOrder;
}
}
}
$keys = array("category_id", "timeSince", "campus");
$orders = array_orderby($orders, $keys[$f - 1], SORT_ASC);
$orders = refineArrayReductively($orders, array("category_id", "campus", "timeSince"));
return $orders;
// t = time, s = service, f = filter, c = company
}
示例5: call_user_func_array
$tmp[$key] = $row[$field];
}
$args[$n] = $tmp;
}
}
$args[] =& $data;
call_user_func_array('array_multisort', $args);
return array_pop($args);
}
}
// ��� ����� � ����������� � ����...
$mSortBy = SORT_ASC;
if (strtolower($GLOBALS[$oSort->ord_name]) == "desc") {
$mSortBy = SORT_DESC;
}
$aFilteredCat = array_orderby($aFilteredCat, substr($GLOBALS[$oSort->by_name], 2), $mSortBy, 'GEM', SORT_ASC);
}
$rsData->InitFromArray($aFilteredCat);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
$lAdmin->NavText($rsData->GetNavPrint("BitrixGems"));
while ($arRes = $rsData->NavNext(true, "f_")) {
$row =& $lAdmin->AddRow($f_NAME, $arRes);
$bCanBeInstalled = BitrixGems::checkRequirements($arRes);
$row->AddViewField("TYPE", GetMessage('GEM_TYPE_' . $f_TYPE));
if (empty($f_PICTURE)) {
$f_PICTURE = '/bitrix/images/iv.bitrixgems/ruby.png';
}
$row->AddViewField("PICTURE", '<div style="text-align:center;"><img src="' . $f_PICTURE . '" alt="' . $f_NAME . '" title="' . $f_NAME . '"/></div>');
$row->AddViewField("DESCRIPTION", nl2br($f_DESCRIPTION));
$row->AddViewField("REQUIREMENTS", '<font style="color:' . ($bCanBeInstalled ? 'green' : 'red') . '">' . $f_REQUIREMENTS . GetMessage('TR_REQ_MODULE_VERSION') . $f_REQUIRED_MIN_MODULE_VERSION . (!empty($f_REQUIRED_MODULES) ? GetMessage('TR_REQ_MODULES') . implode(', ', $f_REQUIRED_MODULES) : '') . (!empty($f_REQUIRED_GEMS) ? GetMessage('TR_REQ_GEMS') . implode(', ', $f_REQUIRED_GEMS) : '') . '</font>');
示例6: array
$novoArray["campo7"] = 0;
$novoArray["campo8"] = 0;
$novoArray["campo9"] = 0;
$novoArray["campo10"] = 0;
$novoArray["campo11"] = 0;
$novoArray["campo12"] = 0;
$novoArray["sentimento"] = 0;
$novoArray["total"] = 0;
$novoArray["nome"] = $arrayCidadeSedes[$i];
$dadoAtual = array();
$dadoAtual[0] = $novoArray;
for ($j = 0; $j < count($dados); $j++) {
$dadoAtual[] = $dados[$j];
}
//var_dump($dadoAtual);
$dados = array_orderby($dadoAtual, 'nome', SORT_ASC);
}
}
}
foreach ($dados as $dado) {
//echo ucwords($dado["nome"]) . "<br>";
$key = array_search(ucwords(replaceChars($dado["nome"])), $arrayCidadeSedesLimpo);
//echo "<pre>";
//var_dump($key);
if ($key !== false) {
$total += (int) $dado["total"];
//print_r($total);
$arrayCampo1["valor"][] = $dado["campo1"];
$campo1 += $dado["campo1"];
$arrayCampo2["valor"][] = $dado["campo2"];
$campo2 += $dado["campo2"];
示例7: constrByMask
//.........这里部分代码省略.........
if ($this->report_XML) {
$this->arrPrintOut[$insertRow]['diametrs_tmp'] = $tmp_getDataQuery_arr['mind_pirms_red'];
$this->arrPrintOut[$insertRow]['garums_tmp'] = $tmp_getDataQuery_arr['garums'];
}
$this->arrPrintOut[$insertRow]['skaits'] += 1;
if ($this->arrPrintOut[$insertRow]['brakis_kods'] != '') {
$tilpums_skaits_brakis_KOPA += 1;
}
//-#007-FUNC-END-----------------------------------------------------------------------------------------------------
//-#008-FUNC-START--Dinamisko vērtību piešķiršana---------------------------------------------------------------------------------------------------
$this->arrPrintOut[$insertRow]['bruto'] += $tilpums_bruto;
$this->arrPrintOut[$insertRow]['virsmers'] += $tilpums_virsmers;
$this->arrPrintOut[$insertRow]['redukcija'] += $tilpums_redukcija;
$this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] += $tilpums_bruto - $tilpums_neto;
$this->arrPrintOut[$insertRow]['brakis'] += $tilpums_brakis;
$this->arrPrintOut[$insertRow]['neto'] += $tilpums_neto;
$this->arrPrintOut[$insertRow]['brakis_un_neto'] += $tilpums_neto + $tilpums_brakis;
//------------------------------------------------------------------------------------------------------
if ($this->arrPrintOut[$insertRow]['bruto'] != '') {
$this->arrPrintOut[$insertRow]['bruto'] = number_format($this->arrPrintOut[$insertRow]['bruto'], 3, '.', '');
} else {
$this->arrPrintOut[$insertRow]['bruto'] = '';
}
if ($this->arrPrintOut[$insertRow]['virsmers'] != '') {
$this->arrPrintOut[$insertRow]['virsmers'] = number_format($this->arrPrintOut[$insertRow]['virsmers'], 3, '.', '');
} else {
$this->arrPrintOut[$insertRow]['virsmers'] = '';
}
if ($this->arrPrintOut[$insertRow]['redukcija'] != '') {
$this->arrPrintOut[$insertRow]['redukcija'] = number_format($this->arrPrintOut[$insertRow]['redukcija'], 3, '.', '');
} else {
$this->arrPrintOut[$insertRow]['redukcija'] = '';
}
if ($this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] != '') {
$this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = number_format($this->arrPrintOut[$insertRow]['redukcija_un_virsmers'], 3, '.', '');
} else {
$this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = '';
}
if ($this->arrPrintOut[$insertRow]['brakis'] != '') {
$this->arrPrintOut[$insertRow]['brakis'] = number_format($this->arrPrintOut[$insertRow]['brakis'], 3, '.', '');
} else {
$this->arrPrintOut[$insertRow]['brakis'] = '';
}
if ($this->arrPrintOut[$insertRow]['neto'] != '') {
$this->arrPrintOut[$insertRow]['neto'] = number_format($this->arrPrintOut[$insertRow]['neto'], 3, '.', '');
} else {
$this->arrPrintOut[$insertRow]['neto'] = '';
}
if ($this->arrPrintOut[$insertRow]['brakis_un_neto'] != '') {
$this->arrPrintOut[$insertRow]['brakis_un_neto'] = number_format($this->arrPrintOut[$insertRow]['brakis_un_neto'], 3, '.', '');
} else {
$this->arrPrintOut[$insertRow]['brakis_un_neto'] = '';
}
//------------------------------------------------------------------------------------------------------
$tilpums_bruto_KOPA = $tilpums_bruto_KOPA + $tilpums_bruto;
$tilpums_virsmers_KOPA = $tilpums_virsmers_KOPA + $tilpums_virsmers;
$tilpums_redukcija_KOPA = $tilpums_redukcija_KOPA + $tilpums_redukcija;
$tilpums_neto_KOPA = $tilpums_neto_KOPA + $tilpums_neto;
$tilpums_brakis_KOPA = $tilpums_brakis_KOPA + $tilpums_brakis;
$tmp_balkuSkaits++;
$tmp_rowCount++;
}
// }
//-#008-FUNC-END-----------------------------------------------------------------------------------------------------
//-#009-FUNC-START--Rindu pārgrupēšana masīvā---------------------------------------------------------------------------------------------------
if (($this->firmCode == 16 || $this->firmCode == 20 || $this->isAllReport) && !$this->report_PDF && !$this->report_XML) {
$this->arrPrintOut = array_orderby($this->arrPrintOut, 'suga', SORT_ASC, 'skira', SORT_ASC, 'diametrs', SORT_ASC, 'garums', SORT_ASC, 'brakis_kods', SORT_ASC);
} else {
$this->arrPrintOut = array_orderby($this->arrPrintOut, 'suga', SORT_ASC, 'skira', SORT_ASC, 'diametrs', SORT_ASC, 'brakis_kods', SORT_ASC);
}
array_unshift($this->arrPrintOut, $tmp_arrCollName);
//-#009-FUNC-END-----------------------------------------------------------------------------------------------------
//-#010-FUNC-START--Kopsummas rindas pievienošana---------------------------------------------------------------------------------------------------
$this->arrPrintOut[$tmp_rowCount]['nosaukums'] = 1;
$this->arrPrintOut[$tmp_rowCount]['suga'] = "";
$this->arrPrintOut[$tmp_rowCount]['skira'] = "";
$this->arrPrintOut[$tmp_rowCount]['diametrs'] = "";
$this->arrPrintOut[$tmp_rowCount]['garums'] = "";
$this->arrPrintOut[$tmp_rowCount]['brakis_kods'] = "";
$this->arrPrintOut[$tmp_rowCount]['skaits'] = $tmp_balkuSkaits;
$this->arrPrintOut[$tmp_rowCount]['bruto'] = number_format($tilpums_bruto_KOPA, 3, '.', '') . "*";
$this->arrPrintOut[$tmp_rowCount]['virsmers'] = number_format($tilpums_virsmers_KOPA, 3, '.', '') . "*";
$this->arrPrintOut[$tmp_rowCount]['redukcija'] = number_format($tilpums_redukcija_KOPA, 3, '.', '') . "*";
$this->arrPrintOut[$tmp_rowCount]['redukcija_un_virsmers'] = number_format($tilpums_bruto_KOPA - $tilpums_neto_KOPA, 3, '.', '') . "*";
$this->arrPrintOut[$tmp_rowCount]['brakis'] = number_format($tilpums_brakis_KOPA, 3, '.', '') . "*";
$this->arrPrintOut[$tmp_rowCount]['neto'] = number_format($tilpums_neto_KOPA, 3, '.', '') . "*";
$this->arrPrintOut[$tmp_rowCount]['brakis_un_neto'] = number_format($tilpums_brakis_KOPA + $tilpums_neto_KOPA, 3, '.', '') . "*";
$this->regSuperSum['bruto'] = $tilpums_bruto_KOPA;
$this->regSuperSum['virsmers'] = $tilpums_virsmers_KOPA;
$this->regSuperSum['redukcija'] = $tilpums_redukcija_KOPA;
$this->regSuperSum['brakis'] = $tilpums_brakis_KOPA;
$this->regSuperSum['neto'] = $tilpums_neto_KOPA;
$this->regSuperSum['skaits'] = $tmp_balkuSkaits;
$this->regSuperSum['skaits_brakis'] = $tilpums_skaits_brakis_KOPA;
//-#010-FUNC-END-----------------------------------------------------------------------------------------------------
//-#011-FUNC-START-END-Rezultāts---------------------------------------------------------------------------------------------------
// fb($this->arrPrintOut,'arrPrintOut');
// break;
return true;
}
示例8: array
if (!isset($review_nl[0])) {
$temp = array();
$temp[] = $review_nl;
$review_nl = $temp;
}
$sorted = array_merge($sorted, $review_nl);
}
if (count($review_en) > 0) {
if (!isset($review_en[0])) {
$temp = array();
$temp[] = $review_en;
$review_en = $temp;
}
$sorted = array_merge($sorted, $review_en);
}
$sorted = array_orderby($sorted, 'reviewId', SORT_DESC);
$reviews = $sorted;
$result = file_get_contents('http://resto.fr/api/business/getDetails/v1/?apiToken=' . _apiToken . '&language=nl&businessId=' . $id_resto . '');
$xml = simplexml_load_string($result);
$xml = json_decode(json_encode((array) simplexml_load_string($result)), 1);
$details = $xml['businesses']['business'];
// print_r($details);
$businessName = $details['businessName'];
$cleanbusinessName = og_clean_url($businessName);
$businessType = $details['businessTypeId'];
switch ($businessType) {
case '1':
$businessTypeName = 'restaurant';
break;
case '2':
$businessTypeName = 'caterer';
示例9: elseif
}*/
if (!$export) {
$data[$i]["remarks"] = '<input type="text" name="remarks' . $course->id . '" size="" value="">';
} elseif ($export) {
if ($form = data_submitted()) {
$formarr = (array) $form;
$data[$i]["remarks"] = array_key_exists('remarks' . $course->id, $formarr) ? $formarr['remarks' . $course->id] : '';
}
}
$i++;
}
if ($fromform->{'c' . $course->id} == 'true' and !$export) {
$export_courses .= $course->id . ",";
}
}
$data = array_orderby($data, $sortby, constant($sortorder));
for ($i = 0; $i < sizeof($data); $i++) {
if ($data[$i]["totalmissed"] == 0) {
if (!$export) {
$data[$i]["totalmissed"] = '<div style="background: white;">' . $data[$i]["totalmissed"] . '</div>';
} else {
$data[$i]["totalmissed"] = '!!g' . $data[$i]["totalmissed"];
}
} elseif ($data[$i]["totalmissed"] <= -3) {
if (!$export) {
$data[$i]["totalmissed"] = '<div style="background: red;">' . $data[$i]["totalmissed"] . '</div>';
} else {
$data[$i]["totalmissed"] = '!!r' . $data[$i]["totalmissed"];
}
} elseif ($data[$i]["totalmissed"] < 0 && $data[$i]["totalmissed"] > -3) {
if (!$export) {
示例10: foreach
foreach ($album->showFiles() as $album => $musics) {
$albuns[] = array('id' => "parent_{$parent}", 'parent' => '#', 'text' => strtoupper($album));
if (is_array($musics) && count($musics)) {
foreach ($musics as $music) {
$albunsM["parent_{$parent}"][] = array('id' => "children_{$children}", 'parent' => "parent_{$parent}", 'text' => basename($music['music']), 'icon' => 'glyphicon glyphicon-music', 'a_attr' => array('href' => $music['music']));
$children++;
}
}
$parent++;
}
$albumSorted = array_orderby($albuns, 'text', SORT_ASC);
$cont = 0;
foreach ($albumSorted as $alb) {
$arrayzudo[] = $alb;
$t = $albunsM[$alb['id']];
$sorted = array_orderby($t, 'text', SORT_ASC);
foreach ($sorted as $sort) {
$sort['id'] = "children_{$cont}";
$arrayzudo[] = $sort;
$cont++;
}
}
$c->store($nameCache, $arrayzudo);
$response->body(json_encode($arrayzudo));
}
});
$app->get('/download/:music', function ($musica) {
$arquivo = $musica;
switch (strtolower(substr(strrchr(basename($arquivo), "."), 1))) {
case "mp3":
$tipo = "audio/mpeg";
示例11: switch
switch ($ext) {
case 'gif':
case 'jpg':
case 'jpeg':
case 'png':
$lightbox = ' data-lightbox="' . $idfile . '" data-title=" "';
break;
default:
$lightbox = '';
break;
}
}
$data[] = ['type' => $type, 'name_lowercase' => strtolower($name), 'name' => $name, 'path' => $path, 'link' => $link . $arg, 'size' => $size, 'thumb' => $thumb, 'ext' => $ext, 'lightbox' => $lightbox];
}
}
$data = array_orderby($data, 'type', SORT_DESC, 'name_lowercase', SORT_ASC);
require_once THEME_PATH . '/share/pages/tree.php';
break;
} while (0);
// fin de page des dossiers
echo '<script type="text/javascript" src="inc/js/qr.js"></script>' . "\n" . '<div class="dialog" id="qrcode">' . "\n" . '<figure>' . "\n" . '<a href="#" class="closemsg"></a>' . "\n" . '<figcaption>' . "\n" . '<h1>' . e('QR Code', false) . '</h1>' . "\n" . '<img src="null" id="qrcode_img" alt="" />' . "\n" . '</figcaption>' . "\n" . '</figure>' . "\n" . '</div>' . "\n" . '<div id="p2p">' . "\n" . '<p>' . e('Show Qrcode of the page:', false) . ' <a href="#qrcode" onclick="qrcode(\'' . $id . '\')"><img alt="" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAQABADAREAAhEBAxEB/8QAFgABAQEAAAAAAAAAAAAAAAAABgUH/8QAFAEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEAMQAAAB00IE8YH/xAAZEAEBAQADAAAAAAAAAAAAAAAGBQQCAwf/2gAIAQEAAQUCmSSvnwPZiOJAkXeJ1lTUzl2VP//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8BH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8BH//EACAQAAMAAgIDAAMAAAAAAAAAAAQFBgIDAQcSFRYAExf/2gAIAQEABj8CdN2+sfVq1J+r0Busjqar6+F17APW/WL3Np/MmNJVzF+0TbPfcNp4gXbrLGnj8gdtAHv/ADQPTHz6OjkV9pBU5VT1jiRmwb0LizlISneX3I9NxMeNcqaUNNUoaByk2WRjjWe3wMI1cbiHKpUPoqFkx0oGkLQdrnVbn9Z1XENC1S+QZ49mt5NPDW/qg+FBMs9KP48l68Xneblht1IabtRfhfEeGUh2UeFOUP0k/iRoGlY4LhruczhLAYxN1T3EON7DdX7/ALbPNfgvYuHNUw//xAAYEAEBAAMAAAAAAAAAAAAAAAABABARIf/aAAgBAQABPyE7jNuFps3j+56lqc9hKy4Nzamf9JrMw1YyO1gosYQE81J//9oADAMBAAIAAwAAABCAD//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8QH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8QH//EABUQAQEAAAAAAAAAAAAAAAAAABAR/9oACAEBAAE/EIMXHJa24g0MdY6ENOwF2VHGt8bENEEzwTJK2VtE5lIf/9k%3D" /></a></p>' . "\n";
if ($view_rss == true || $view_json == true) {
echo '<p>' . e('Show this page in:', false) . " \n";
}
if ($view_rss == true) {
echo '<a href="' . $_SESSION['home'] . '?f=' . $_GET['f'] . '&rss">Rss</a>' . "\n";
}
if ($view_rss == true && $view_json == true) {
echo ' | ' . "\n";
}
if ($view_json == true) {
示例12: array
$tmp = array();
foreach ($data as $key => $row) {
$tmp[$key] = $row[$field];
}
$args[$n] = $tmp;
}
}
$args[] =& $data;
call_user_func_array('array_multisort', $args);
return array_pop($args);
}
$counts = json_decode(json_encode($counts), true);
$total = array_sum(array_column($counts, 'count'));
$percent = intval($total) / 5;
$sortcount = $counts;
$sortcount = array_orderby($counts, 'count', SORT_DESC, 'role', SORT_ASC);
$full = $sortcount[0]['count'];
$barcount = count($counts);
$incr = 0;
ob_start();
?>
<ul id="wcp-role-distro">
<?php
foreach ($sortcount as $role) {
if (in_array($role['role'], $roles)) {
$role_img = explode('/', $role['role']);
$role_img = strtolower(trim(str_replace(' ', '-', $role_img[0])));
?>
<li style="height:<?php
echo round($role['count'] / $full * 100 * 3 / 4, 2);
?>
示例13: array
$m = array();
$m['filename'] = "{$az[$i]}:";
$m['isdir'] = '1';
array_push($mWinDisk, $m);
}
}
}
}
for ($i = 0, $max_i = count($dirfiles); $i < $max_i; $i++) {
$m = array();
$m['filename'] = $dirfiles[$i];
$m['isdir'] = is_dir($dirfiles[$i]) ? '1' : '0';
array_push($mDatas, $m);
}
$mSortedDatas = array();
$mDirs = array_orderby($mDatas, 'isdir', SORT_DESC, 'filename', SORT_ASC);
$mSortedDatas = array_merge($mWinDisk, $mDirs);
?>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<?php
for ($i = 0, $max_i = count($mSortedDatas); $i < $max_i; $i++) {
//echo realpath($mSortedDatas[$i]['filename'])."<br>";
$realpath = realpath($mSortedDatas[$i]['filename']);
//$realpath=$mSortedDatas[$i]['filename'];
if (substr(PHP_OS, 0, 3) == 'WIN') {
$b_realpath = str_replace("\\\\", "\\", $mSortedDatas[$i]['filename']);
$b_realpath = mb_convert_encoding($b_realpath, 'UTF-8', 'BIG5');
} else {
$b_realpath = $mSortedDatas[$i]['filename'];
}
$m_basename = explode(DIRECTORY_SEPARATOR, $b_realpath);
示例14: build
/**
* flush events, build pagination and sort items
*
* @return $this
*/
public function build()
{
BurpEvent::flush('dataset.sort');
BurpEvent::flush('dataset.page');
$this->paginator = Paginator::make($this->total_rows, $this->per_page, $this->page);
$offset = $this->paginator->offset();
$this->limit($this->per_page, $offset);
if (is_array($this->source)) {
//orderby
if (isset($this->orderby)) {
list($field, $direction) = $this->orderby;
array_orderby($this->source, $field, $direction);
}
//limit-offset
if (isset($this->limit)) {
$this->source = array_slice($this->source, $this->limit[1], $this->limit[0]);
}
$this->data = $this->source;
} else {
//orderby
if (isset($this->orderby)) {
$this->query = $this->query->orderBy($this->orderby[0], $this->orderby[1]);
}
//limit-offset
if (isset($this->per_page)) {
$this->query = $this->query->skip($offset)->take($this->per_page);
}
$this->data = $this->query->get();
}
return $this;
}
示例15: constrByMask
//.........这里部分代码省略.........
$mysqlGlobalSelect = mysql_query($mysqlGlobalSelect_text);
$insertRow = $tmp_rowCount;
while ($mysqlGlobalSelect_arr = mysql_fetch_assoc($mysqlGlobalSelect)) {
$this->arrPrintOut[$insertRow]['nosaukums'] = 0;
$this->arrPrintOut[$insertRow]['suga'] = $mysqlGlobalSelect_arr['group_suga'];
$this->arrPrintOut[$insertRow]['skira'] = $mysqlGlobalSelect_arr['group_skira'];
$this->arrPrintOut[$insertRow]['diametrs'] = $mysqlGlobalSelect_arr['group_diametrs'];
$this->arrPrintOut[$insertRow]['garums'] = $mysqlGlobalSelect_arr['group_garums'];
$this->arrPrintOut[$insertRow]['brakis_kods'] = $mysqlGlobalSelect_arr['group_brakis'];
$this->arrPrintOut[$insertRow]['skaits'] = $mysqlGlobalSelect_arr['skaits'];
$this->arrPrintOut[$insertRow]['bruto'] = $mysqlGlobalSelect_arr['bruto'];
$this->arrPrintOut[$insertRow]['virsmers'] = $mysqlGlobalSelect_arr['virsmers'];
$this->arrPrintOut[$insertRow]['redukcija'] = $mysqlGlobalSelect_arr['redukcija'];
$this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = $mysqlGlobalSelect_arr['redukcija'] + $mysqlGlobalSelect_arr['virsmers'];
$this->arrPrintOut[$insertRow]['brakis'] = $mysqlGlobalSelect_arr['brakis_tilp'];
$this->arrPrintOut[$insertRow]['neto'] = $mysqlGlobalSelect_arr['neto'];
$this->arrPrintOut[$insertRow]['brakis_un_neto'] = $mysqlGlobalSelect_arr['brakis'] + $mysqlGlobalSelect_arr['neto'];
if ($this->arrPrintOut[$insertRow]['bruto'] != '' && $this->arrPrintOut[$insertRow]['bruto'] != 0) {
$this->arrPrintOut[$insertRow]['bruto'] = number_format($this->arrPrintOut[$insertRow]['bruto'], 3, '.', '');
} else {
$this->arrPrintOut[$insertRow]['bruto'] = '';
}
if ($this->arrPrintOut[$insertRow]['virsmers'] != '' && $this->arrPrintOut[$insertRow]['virsmers'] != 0) {
$this->arrPrintOut[$insertRow]['virsmers'] = number_format($this->arrPrintOut[$insertRow]['virsmers'], 3, '.', '');
} else {
$this->arrPrintOut[$insertRow]['virsmers'] = '';
}
if ($this->arrPrintOut[$insertRow]['redukcija'] != '' && $this->arrPrintOut[$insertRow]['redukcija'] != 0) {
$this->arrPrintOut[$insertRow]['redukcija'] = number_format($this->arrPrintOut[$insertRow]['redukcija'], 3, '.', '');
} else {
$this->arrPrintOut[$insertRow]['redukcija'] = '';
}
if ($this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] != '' && $this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] != 0) {
$this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = number_format($this->arrPrintOut[$insertRow]['redukcija_un_virsmers'], 3, '.', '');
} else {
$this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = '';
}
if ($this->arrPrintOut[$insertRow]['brakis'] != '' && $this->arrPrintOut[$insertRow]['brakis'] != 0) {
$this->arrPrintOut[$insertRow]['brakis'] = number_format($this->arrPrintOut[$insertRow]['brakis'], 3, '.', '');
} else {
$this->arrPrintOut[$insertRow]['brakis'] = '';
}
if ($this->arrPrintOut[$insertRow]['neto'] != '' && $this->arrPrintOut[$insertRow]['neto'] != 0) {
$this->arrPrintOut[$insertRow]['neto'] = number_format($this->arrPrintOut[$insertRow]['neto'], 3, '.', '');
} else {
$this->arrPrintOut[$insertRow]['neto'] = '';
}
if ($this->arrPrintOut[$insertRow]['brakis_un_neto'] != '' && $this->arrPrintOut[$insertRow]['brakis_un_neto'] != 0) {
$this->arrPrintOut[$insertRow]['brakis_un_neto'] = number_format($this->arrPrintOut[$insertRow]['brakis_un_neto'], 3, '.', '');
} else {
$this->arrPrintOut[$insertRow]['brakis_un_neto'] = '';
}
$tilpums_bruto_KOPA = $tilpums_bruto_KOPA + $mysqlGlobalSelect_arr['bruto'];
$tilpums_virsmers_KOPA = $tilpums_virsmers_KOPA + $mysqlGlobalSelect_arr['virsmers'];
$tilpums_redukcija_KOPA = $tilpums_redukcija_KOPA + $mysqlGlobalSelect_arr['redukcija'];
$tilpums_neto_KOPA = $tilpums_neto_KOPA + $mysqlGlobalSelect_arr['neto'];
$tilpums_brakis_KOPA = $tilpums_brakis_KOPA + $mysqlGlobalSelect_arr['brakis_tilp'];
$tmp_balkuSkaits = $tmp_balkuSkaits + $mysqlGlobalSelect_arr['skaits'];
$tmp_rowCount++;
$insertRow++;
}
}
// }
//-#008-FUNC-END-----------------------------------------------------------------------------------------------------
//-#009-FUNC-START--Rindu pārgrupēšana masīvā---------------------------------------------------------------------------------------------------
if (($this->firmCode == 16 || $this->firmCode == 20 || $bbq_temp == true || $this->isAllReport) && !$this->report_PDF && !$this->report_XML) {
$this->arrPrintOut = array_orderby($this->arrPrintOut, 'suga', SORT_ASC, 'skira', SORT_ASC, 'diametrs', SORT_ASC, 'garums', SORT_ASC, 'brakis_kods', SORT_ASC);
} else {
$this->arrPrintOut = array_orderby($this->arrPrintOut, 'suga', SORT_ASC, 'skira', SORT_ASC, 'diametrs', SORT_ASC, 'brakis_kods', SORT_ASC);
}
array_unshift($this->arrPrintOut, $tmp_arrCollName);
//-#009-FUNC-END-----------------------------------------------------------------------------------------------------
//-#010-FUNC-START--Kopsummas rindas pievienošana---------------------------------------------------------------------------------------------------
$this->arrPrintOut[$tmp_rowCount]['nosaukums'] = 1;
$this->arrPrintOut[$tmp_rowCount]['suga'] = "";
$this->arrPrintOut[$tmp_rowCount]['skira'] = "";
$this->arrPrintOut[$tmp_rowCount]['diametrs'] = "";
$this->arrPrintOut[$tmp_rowCount]['garums'] = "";
$this->arrPrintOut[$tmp_rowCount]['brakis_kods'] = "";
$this->arrPrintOut[$tmp_rowCount]['skaits'] = $tmp_balkuSkaits;
$this->arrPrintOut[$tmp_rowCount]['bruto'] = number_format($tilpums_bruto_KOPA, 3, '.', '') . "*";
$this->arrPrintOut[$tmp_rowCount]['virsmers'] = number_format($tilpums_virsmers_KOPA, 3, '.', '') . "*";
$this->arrPrintOut[$tmp_rowCount]['redukcija'] = number_format($tilpums_redukcija_KOPA, 3, '.', '') . "*";
$this->arrPrintOut[$tmp_rowCount]['redukcija_un_virsmers'] = number_format($tilpums_bruto_KOPA - $tilpums_neto_KOPA, 3, '.', '') . "*";
$this->arrPrintOut[$tmp_rowCount]['brakis'] = number_format($tilpums_brakis_KOPA, 3, '.', '') . "*";
$this->arrPrintOut[$tmp_rowCount]['neto'] = number_format($tilpums_neto_KOPA, 3, '.', '') . "*";
$this->arrPrintOut[$tmp_rowCount]['brakis_un_neto'] = number_format($tilpums_brakis_KOPA + $tilpums_neto_KOPA, 3, '.', '') . "*";
$this->regSuperSum['bruto'] = $tilpums_bruto_KOPA;
$this->regSuperSum['virsmers'] = $tilpums_virsmers_KOPA;
$this->regSuperSum['redukcija'] = $tilpums_redukcija_KOPA;
$this->regSuperSum['brakis'] = $tilpums_brakis_KOPA;
$this->regSuperSum['neto'] = $tilpums_neto_KOPA;
$this->regSuperSum['skaits'] = $tmp_balkuSkaits;
$this->regSuperSum['skaits_brakis'] = $tilpums_skaits_brakis_KOPA;
//-#010-FUNC-END-----------------------------------------------------------------------------------------------------
//-#011-FUNC-START-END-Rezultāts---------------------------------------------------------------------------------------------------
// fb($this->arrPrintOut,'arrPrintOut');
// break;
return true;
}