-
+148
- 1
- 2
- 3
- 4
if($line['orderstatus']==0) echo '<td title="Статус" bgcolor="red"><a href="/admin/changeorderstatus2.php?id='.$line['id'].'&sortorder='.$sortorder.'&start='.$start.'" class="gallery4">в обработке</a></td>';
if($line['orderstatus']==1) echo '<td title="Статус" bgcolor="yellow"><a href="/admin/changeorderstatus2.php?id='.$line['id'].'&sortorder='.$sortorder.'&start='.$start.'" class="gallery4">Не оплачен, отправлен</a></td>';
if($line['orderstatus']==2) echo '<td title="Статус" bgcolor="cyan"><a href="/admin/changeorderstatus2.php?id='.$line['id'].'&sortorder='.$sortorder.'&start='.$start.'" class="gallery4">Оплачен, отправлен</a></td>';
if($line['orderstatus']==3) echo '<td title="Статус" bgcolor="lightgreen"><a href="/admin/changeorderstatus2.php?id='.$line['id'].'&sortorder='.$sortorder.'&start='.$start.'" class="gallery4">Оплачен, получен</a></td>';
rockstar,
20 Апреля 2013
-
+136
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
if (best == null)
{
return null;
}
else
{
return best;
}
Psilon,
19 Апреля 2013
-
−105
- 1
- 2
- 3
Дана строка. Разрежьте ее на две равные части (если длина строки — четная, а если длина строки нечетная, то длина первой части должна быть на один символ больше). Переставьте эти две части местами, результат запишите в новую строку и выведите на экран.
При решении этой задачи не стоит пользоваться инструкцией if.
Вообще не разбираюсь в строках. Помогите пожалуйста.
alexsid13,
19 Апреля 2013
-
+151
- 1
- 2
- 3
- 4
<?php
// autoload.php generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInite3f5acf96d9ae66df74c4805c906a9e2::getLoader();
Господа, что-то вот не пойму, можно ли ругаться в таких случаях, когда код генерированный. Можно ли писать всякое говно в код, если при этом говорить: "ты не должен туда смотреть, это скрипт, написанный скриптом для скрипта." Я тут вижу говноконкатенацию строковой константы со строковой константой оператором '.' и говноимя, класса в последней строке. Лично моё мнение, что если бы я написал код, в котором вынужден был бы генерировать такие имена, я бы констатировал серьёзную ошибку проектирования на более ранних стадиях.
zasedanie,
19 Апреля 2013
-
+137
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
if (curMenu != null)
{
depth = curMenu.Depth;
Menu menuG = null;
if (depth == 1)
{
menuG = curMenu;
}
if (depth == 2)
{
menuG = curMenu.Menu2;
}
if (depth == 3)
{
menuG = curMenu.Menu2.Menu2;
}
if (depth == 4)
{
menuG = curMenu.Menu2.Menu2.Menu2;
}
if (depth == 5)
{
menuG = curMenu.Menu2.Menu2.Menu2.Menu2;
}
if (depth == 6)
{
menuG = curMenu.Menu2.Menu2.Menu2.Menu2.Menu2;
}
if (depth == 7)
{
menuG = curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2;
}
if (depth == 8)
{
menuG = curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2;
}
}
Nested set для петухов!
validol,
19 Апреля 2013
-
+132
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
<div class="breadcrumbs">
<ul>
<li>
@if (curMenu != null)
{
<a href="@Url.Action("index", "main")">Главная</a><span class="breadcrumbs__dash"> / </span>
if (depth == 1)
{
<span>@(curMenu.Title)</span>
}
else if (depth == 2)
{
<a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a> <span class="breadcrumbs__dash"> / </span>
<span>@(curMenu.Title)</span>
}
else if (depth == 3)
{
<a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<span>@(curMenu.Title)</span>
}
else if (depth == 4)
{
<a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<span>@(curMenu.Title)</span>
}
else if (depth == 5)
{
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<span>@(curMenu.Title)</span>
}
else if (depth == 6)
{
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<span>@(curMenu.Title)</span>
}
else if (depth == 7)
{
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<span>@(curMenu.Title)</span>
}
else if (depth == 8)
{
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<span>@(curMenu.Title)</span>
}
}
else if (ViewBag.Title != null && url!="/")
{
<a href="@Url.Action("index", "main")">Главная</a><span class="breadcrumbs__dash"> / </span>
<span>@ViewBag.Title</span>
}
</li>
</ul>
</div>
Хлебные крошки в каталоге "неограниченной" вложенности.
validol,
19 Апреля 2013
-
+159
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
$("#menu44").click(function () {
$("#menu111").hide();
$("#menu222").hide();
$("#menu333").hide();
$("#menu444").show();
$("#menu555").hide();
$("#menu666").hide();
$("#menu777").hide();
$(".selMenu_group").removeClass("selMenu_group");
$(this).children().addClass("selMenu_group");
});
$("#menu55").click(function () {
$("#menu111").hide();
$("#menu222").hide();
$("#menu333").hide();
$("#menu444").hide();
$("#menu555").show();
$("#menu666").hide();
$("#menu777").hide();
$(".selMenu_group").removeClass("selMenu_group");
$(this).children().addClass("selMenu_group");
});
$("#menu66").click(function () {
$("#menu111").hide();
$("#menu222").hide();
$("#menu333").hide();
$("#menu444").hide();
$("#menu555").hide();
$("#menu666").show();
$("#menu777").hide();
$(".selMenu_group").removeClass("selMenu_group");
$(this).children().addClass("selMenu_group");
});
$("#menu77").click(function () {
$("#menu111").hide();
$("#menu222").hide();
$("#menu333").hide();
$("#menu444").hide();
$("#menu555").hide();
$("#menu666").hide();
$("#menu777").show();
$(".selMenu_group").removeClass("selMenu_group");
$(this).children().addClass("selMenu_group");
});
Творение самого коммерчески эффективного разработчика студии.
validol,
19 Апреля 2013
-
+70
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
private String formatString(String input, int lenght){
String result = "";
int len = lenght - input.length();
int left = Math.round(len/2);
int right = len - left;
for(int i=0; i<left; i++){
result = " " + result;
}
result = result + input;
for(int i=0; i<right; i++){
result = result + " ";
}
return result;
}
выравнивание текста в центре пустой строки фиксированной ширины.
nafania217518,
19 Апреля 2013
-
+100
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
procedure print(RTK_select:boolean; RLK_select:boolen;MOLK_select:boolean)
begin
if (RTK_select and not RLK_select and not MOLK_select) then
Excel.ActiveWorkBook.WorkSheets[1].Range['B4'] := 'РТК';
if (not RTK_select and RLK_select and not MOLK_select) then
Excel.ActiveWorkBook.WorkSheets[1].Range['B4'] := 'РЛК';
if (not RTK_select and not RLK_select and MOLK_select) then
Excel.ActiveWorkBook.WorkSheets[1].Range['B4'] := 'МОЛК';
if (RTK_select and RLK_select and not MOLK_select) then
Excel.ActiveWorkBook.WorkSheets[1].Range['B4'] := 'РТК,РЛК';
if (not RTK_select and RLK_select and MOLK_select) then
Excel.ActiveWorkBook.WorkSheets[1].Range['B4'] := 'РЛК,МОЛК';
if (RTK_select and not RLK_select and MOLK_select) then
Excel.ActiveWorkBook.WorkSheets[1].Range['B4'] := 'РТК,МОЛК';
if (RTK_select and RLK_select and MOLK_select) then
Excel.ActiveWorkBook.WorkSheets[1].Range['B4'] := 'РТК,РЛК,МОЛК';
if (not RTK_select and not RLK_select and not MOLK_select) then
Excel.ActiveWorkBook.WorkSheets[1].Range['B4'] := '';
end
Обнаружено в недрах старинного проекта. Запись строчки по флажкам.
astamir,
19 Апреля 2013
-
+153
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
// проверка при дополнительных надстройках
if (
$this->struct[$num][$v]['changes'] && // если значение было изменено
array_key_exists($v, $this->values) && // и существуют альтернативно назначенные тип поля (select или radio)
isset( $this->values[$v]['vals'] ) && // и также существуют для них значения для значений...
!isset( $this->values[$v]['vals'][ $this->struct[$num][$v]['value'] ] ) // НО, пришедшее значение НЕ СООТВЕТСТВУЕТ
) {
$this->struct[$num][$v]['error'] = 'Неправильно указано значение';
}
Ёжкин кот. Вот чего он хотел этим сказать? И что мне теперь с этим делать теперь?
DoctorHouse,
19 Апреля 2013