当前位置: 首页>>代码示例>>PHP>>正文


PHP cal函数代码示例

本文整理汇总了PHP中cal函数的典型用法代码示例。如果您正苦于以下问题:PHP cal函数的具体用法?PHP cal怎么用?PHP cal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cal

function cal($start)
{
    //转换为字符串
    $startone = chunk_split($start, 1, ",");
    //转换为数组
    $arrone = explode(",", $startone, -1);
    //数组排序并返回最大值和最小值
    $big = 0;
    $lit = 0;
    global $pass;
    global $result;
    //不用全局最后if语句中return $pass;自定义函数外$result=cal($start);不成功
    //return $big-$lit; 自定义函数外$pass=cal($start);可成功赋值
    /*
    <?php
    function cal($start){
    $startone=chunk_split($start,1,",");
    $arrone=explode(",",$startone,-1);
    $big=0;
    $lit=0;
    sort($arrone);
    foreach ($arrone as $key=>$value){
    	$big+=$value*pow(10,$key);
    	$key++;
    }
    rsort($arrone);
    foreach ($arrone as $key => $value){
    	$lit+=$value*pow(10,$key);
    	$key++;
    }
    return $big-$lit;
    }
    $pass=cal(675);			
    echo $pass.'<br />';
    ?>
    */
    sort($arrone);
    foreach ($arrone as $key => $value) {
        $big += $value * pow(10, $key);
        $key++;
    }
    rsort($arrone);
    foreach ($arrone as $key => $value) {
        $lit += $value * pow(10, $key);
        $key++;
    }
    $pass = $big - $lit;
    if ($pass == $start) {
        $result = $pass;
    } else {
        cal($pass);
    }
}
开发者ID:soontan,项目名称:allinone,代码行数:53,代码来源:day12.Kaprekar_constant.php

示例2: cal

function cal($path, $exclude = ".|..", $recursive = true)
{
    global $c, $s;
    $path = rtrim($path, "/") . "/";
    $folder_handle = opendir($path);
    $exclude_array = explode("|", $exclude);
    $result = array();
    while (false !== ($filename = readdir($folder_handle))) {
        if (!in_array(strtolower($filename), $exclude_array)) {
            if (is_dir($path . $filename . "/")) {
                if ($recursive) {
                    cal($path . $filename . "/", $exclude, true);
                }
            } else {
                $c++;
                $s += filesize($path . $filename);
            }
        }
    }
}
开发者ID:jinguanio,项目名称:david,代码行数:20,代码来源:read_dir.php

示例3: DAYOFMONTH

                $approve = " AND approve=1";
            }
            $sql = "SELECT DISTINCT DAYOFMONTH(date) as day FROM " . PREFIX . "_post WHERE date >= '{$year}-{$month}-01' AND date < '{$year}-{$month}-01' + INTERVAL 1 MONTH" . $approve . $where_date;
            $this_month = $month;
            $this_year = $year;
        } else {
            $sql = "SELECT DISTINCT DAYOFMONTH(date) as day FROM " . PREFIX . "_post WHERE date >= '{$this_year}-{$this_month}-01' AND date < '{$this_year}-{$this_month}-01' + INTERVAL 1 MONTH AND approve=1" . $where_date;
        }
        if ($sql != "") {
            $db->query($sql);
            while ($row = $db->get_row()) {
                $events[$row['day']] = strtotime($this_year . "-" . $this_month . "-" . $row['day']);
            }
            $db->free();
        }
        $tpl->result['calendar'] = cal($this_month, $this_year, $events);
        create_cache("calendar", $tpl->result['calendar'], $cache_id);
    }
}
# Выводим архивы
if ($config['allow_archives'] == "yes") {
    $tpl->result['archive'] = dle_cache("archives", $config['skin']);
    if (!$tpl->result['archive']) {
        $f2 = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
        $f3 = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
        if ($config['no_date'] and !$config['news_future']) {
            $thisdate = date("Y-m-d H:i:s", $_TIME);
            $where_date = " AND date < '" . $thisdate . "'";
        } else {
            $where_date = "";
        }
开发者ID:Zzepish,项目名称:IvanShikalovWebSIte,代码行数:31,代码来源:calendar.php

示例4: elseif

        }
        if (isset($_POST['jahr'])) {
            $year = $_POST['jahr'];
        } elseif (isset($_GET['y'])) {
            $year = $_GET['y'];
        } else {
            $year = date("Y");
        }
        for ($i = 1; $i <= 12; $i++) {
            if ($month == $i) {
                $sel = "selected=\"selected\"";
            } else {
                $sel = "";
            }
            $mname = array("1" => _jan, "2" => _feb, "3" => _mar, "4" => _apr, "5" => _mai, "6" => _jun, "7" => _jul, "8" => _aug, "9" => _sep, "10" => _okt, "11" => _nov, "12" => _dez);
            $month .= show(_select_field, array("value" => cal($i), "sel" => $sel, "what" => $mname[$i]));
        }
        for ($i = date("Y") - 5; $i < date("Y") + 3; $i++) {
            if ($year == $i) {
                $sel = "selected=\"selected\"";
            } else {
                $sel = "";
            }
            $year .= show(_select_field, array("value" => $i, "sel" => $sel, "what" => $i));
        }
        $min = mktime(0, 0, 0, $month, 1, $year);
        $max = mktime(23, 59, 59, $month + 1, -1, $year);
        $qry = db("SELECT * FROM " . $sql_prefix . "jokes WHERE status LIKE '1' AND date >= " . $min . " AND date <= " . $max . " ORDER BY date ASC");
        while ($get = _fetch($qry)) {
            ?>
<link rel="stylesheet" type="text/css" href="style.css">
开发者ID:BlueTeck,项目名称:dzcp-witze-addon,代码行数:31,代码来源:index.php

示例5: var_dump

echo '$y-----';
var_dump($y);
echo "<br>";
var_dump($z);
echo "<br>";
echo "<br>", '$x == $y ----->';
var_dump($x == $y);
echo "<br>", '$x === $y----->';
var_dump($x === $y);
echo "<br>", '$x != $y ----->';
var_dump($x != $y);
echo "<br>", '$x <> $y ----->';
var_dump($x != $y);
echo "<br>", '$x !== $y ----->';
var_dump($x !== $y);
echo "<hr>";
$t = date("H");
if ($t < "20") {
    echo "Have a good day!";
}
echo "<hr>";
function cal($num1, $num2)
{
    $num = $num1 + $num2;
    return $num;
}
echo cal(10, 20), "<hr>";
?>

</body>
</html>
开发者ID:443952248,项目名称:jiazhichao,代码行数:31,代码来源:test.php

示例6: date

    $where_date = " AND date < '" . $thisdate . "'";
} else {
    $where_date = "";
}
$this_month = date('m', $time);
$this_year = date('Y', $time);
$month = $db->safesql(sprintf("%02d", intval($_GET['month'])));
$year = intval($_GET['year']);
$sql = "";
if ($year != '' and $month != '') {
    if ($year == $this_year and $month < $this_month or $year < $this_year) {
        $where_date = "";
        $approve = "";
    } else {
        $approve = " AND approve=1";
    }
    $sql = "SELECT DISTINCT DAYOFMONTH(date) as day FROM " . PREFIX . "_post WHERE date >= '{$year}-{$month}-01' AND date < '{$year}-{$month}-01' + INTERVAL 1 MONTH" . $approve . $where_date;
    $this_month = $month;
    $this_year = $year;
} else {
    $sql = "SELECT DISTINCT DAYOFMONTH(date) as day FROM " . PREFIX . "_post WHERE date >= '{$this_year}-{$this_month}-01' AND date < '{$this_year}-{$this_month}-01' + INTERVAL 1 MONTH AND approve=1" . $where_date;
}
$db->query($sql);
while ($row = $db->get_row()) {
    $events[$row['day']] = strtotime($this_year . "-" . $this_month . "-" . $row['day']);
}
$db->free();
$db->close();
$buffer = cal($this_month, $this_year, $events);
header("Content-type: text/html; charset=" . $config['charset']);
echo $buffer;
开发者ID:Gordondalos,项目名称:union,代码行数:31,代码来源:calendar.php

示例7: error_reporting

<?php

error_reporting(0);
include 'lib/functions.php';
writeHello();
echo '<br>';
writeMsg('hello');
echo '<br>';
writeMsg('byebye');
echo '<br>';
writeMsgTo('stijn', 'how are you doing');
echo '<br>';
writeMsgTo('stijn');
echo '<br>';
cal(2, 2);
echo '<br>';
cal2(4, 6);
echo '<br>';
echo '<br>';
echo '<br>';
body();
开发者ID:stijnana,项目名称:function,代码行数:21,代码来源:index.php

示例8: utf8_encode

echo '<table class="table table-bordered">', PHP_EOL;
$n = Settings::get("begin_bookings");
$end_bookings = Settings::get("end_bookings");
$debligne = 1;
$month = utf8_encode(strftime("%m", Settings::get("begin_bookings")));
$year = strftime("%Y", Settings::get("begin_bookings"));
$inc = 0;
while ($n <= $end_bookings) {
    if ($debligne == 1) {
        echo '<tr>', PHP_EOL;
        $inc = 0;
        $debligne = 0;
    }
    $inc++;
    echo '<td>', PHP_EOL;
    echo cal($month, $year);
    echo '</td>', PHP_EOL;
    if ($inc == 3) {
        echo '</tr>', PHP_EOL;
        $debligne = 1;
    }
    $month++;
    if ($month == 13) {
        $year++;
        $month = 1;
    }
    $n = mktime(0, 0, 0, $month, 1, $year);
}
if ($inc < 3) {
    $k = $inc;
    while ($k < 3) {
开发者ID:Sirlefou1,项目名称:GRR2,代码行数:31,代码来源:admin_calend_ignore.php

示例9: events_content

function events_content(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $o = "";
    // tabs
    $o .= profile_tabs($a, True);
    $o .= '<h2>' . t('Events') . '</h2>';
    $mode = 'view';
    $y = 0;
    $m = 0;
    if ($a->argc > 1) {
        if ($a->argc > 2 && $a->argv[1] == 'event') {
            $mode = 'edit';
            $event_id = intval($a->argv[2]);
        }
        if ($a->argv[1] === 'new') {
            $mode = 'new';
            $event_id = 0;
        }
        if ($a->argc > 2 && intval($a->argv[1]) && intval($a->argv[2])) {
            $mode = 'view';
            $y = intval($a->argv[1]);
            $m = intval($a->argv[2]);
        }
    }
    if ($mode == 'view') {
        $thisyear = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y');
        $thismonth = datetime_convert('UTC', date_default_timezone_get(), 'now', 'm');
        if (!$y) {
            $y = intval($thisyear);
        }
        if (!$m) {
            $m = intval($thismonth);
        }
        // Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
        // An upper limit was chosen to keep search engines from exploring links millions of years in the future.
        if ($y < 1901) {
            $y = 1900;
        }
        if ($y > 2099) {
            $y = 2100;
        }
        $nextyear = $y;
        $nextmonth = $m + 1;
        if ($nextmonth > 12) {
            $nextmonth = 1;
            $nextyear++;
        }
        $prevyear = $y;
        if ($m > 1) {
            $prevmonth = $m - 1;
        } else {
            $prevmonth = 12;
            $prevyear--;
        }
        $dim = get_dim($y, $m);
        $start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
        $finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
        $start = datetime_convert('UTC', 'UTC', $start);
        $finish = datetime_convert('UTC', 'UTC', $finish);
        $adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
        $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
        $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,\n\t\t\t`item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` \n\t\t\tWHERE `event`.`uid` = %d\n\t\t\tAND (( `adjust` = 0 AND `start` >= '%s' AND `start` <= '%s' ) \n\t\t\tOR  (  `adjust` = 1 AND `start` >= '%s' AND `start` <= '%s' )) ", intval(local_user()), dbesc($start), dbesc($finish), dbesc($adjust_start), dbesc($adjust_finish));
        $links = array();
        if (count($r)) {
            $r = sort_by_date($r);
            foreach ($r as $rr) {
                $j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
                if (!x($links, $j)) {
                    $links[$j] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j;
                }
            }
        }
        $o .= '<div id="new-event-link"><a href="' . $a->get_baseurl() . '/events/new' . '" >' . t('Create New Event') . '</a></div>';
        $o .= '<div id="event-calendar-wrapper">';
        $o .= '<a href="' . $a->get_baseurl() . '/events/' . $prevyear . '/' . $prevmonth . '" class="prevcal"><div id="event-calendar-prev" class="icon prev" title="' . t('Previous') . '"></div></a>';
        $o .= cal($y, $m, $links, ' eventcal');
        $o .= '<a href="' . $a->get_baseurl() . '/events/' . $nextyear . '/' . $nextmonth . '" class="nextcal"><div id="event-calendar-next" class="icon next" title="' . t('Next') . '"></div></a>';
        $o .= '</div>';
        $o .= '<div class="event-calendar-end"></div>';
        $last_date = '';
        $fmt = t('l, F j');
        if (count($r)) {
            $r = sort_by_date($r);
            foreach ($r as $rr) {
                $j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
                $d = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], $fmt) : datetime_convert('UTC', 'UTC', $rr['start'], $fmt);
                $d = day_translate($d);
                if ($d !== $last_date) {
                    $o .= '<hr /><a name="link-' . $j . '" ><div class="event-list-date">' . $d . '</div></a>';
                }
                $last_date = $d;
                if ($rr['author-name']) {
                    $o .= '<a href="' . $rr['author-link'] . '" ><img src="' . $rr['author-avatar'] . '" height="32" width="32" />' . $rr['author-name'] . '</a>';
                }
                $o .= format_event_html($rr);
                $o .= !$rr['cid'] ? '<a href="' . $a->get_baseurl() . '/events/event/' . $rr['id'] . '" title="' . t('Edit event') . '" class="edit-event-link icon pencil"></a>' : '';
//.........这里部分代码省略.........
开发者ID:nphyx,项目名称:friendica,代码行数:101,代码来源:events.php

示例10: events_content

function events_content(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    if ($a->argc == 1) {
        $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
    }
    if ($a->argc > 2 && $a->argv[1] === 'ignore' && intval($a->argv[2])) {
        $r = q("update event set ignore = 1 where id = %d and uid = %d", intval($a->argv[2]), intval(local_user()));
    }
    if ($a->argc > 2 && $a->argv[1] === 'unignore' && intval($a->argv[2])) {
        $r = q("update event set ignore = 0 where id = %d and uid = %d", intval($a->argv[2]), intval(local_user()));
    }
    if ($a->theme_events_in_profile) {
        nav_set_selected('home');
    } else {
        nav_set_selected('events');
    }
    $editselect = 'none';
    if (feature_enabled(local_user(), 'richtext')) {
        $editselect = 'textareas';
    }
    // First day of the week (0 = Sunday)
    $firstDay = get_pconfig(local_user(), 'system', 'first_day_of_week');
    if ($firstDay === false) {
        $firstDay = 0;
    }
    $i18n = array("firstDay" => $firstDay, "Sun" => t("Sun"), "Mon" => t("Mon"), "Tue" => t("Tue"), "Wed" => t("Wed"), "Thu" => t("Thu"), "Fri" => t("Fri"), "Sat" => t("Sat"), "Sunday" => t("Sunday"), "Monday" => t("Monday"), "Tuesday" => t("Tuesday"), "Wednesday" => t("Wednesday"), "Thursday" => t("Thursday"), "Friday" => t("Friday"), "Saturday" => t("Saturday"), "Jan" => t("Jan"), "Feb" => t("Feb"), "Mar" => t("Mar"), "Apr" => t("Apr"), "May" => t("May"), "Jun" => t("Jun"), "Jul" => t("Jul"), "Aug" => t("Aug"), "Sep" => t("Sept"), "Oct" => t("Oct"), "Nov" => t("Nov"), "Dec" => t("Dec"), "January" => t("January"), "February" => t("February"), "March" => t("March"), "April" => t("April"), "May" => t("May"), "June" => t("June"), "July" => t("July"), "August" => t("August"), "September" => t("September"), "October" => t("October"), "November" => t("November"), "December" => t("December"), "today" => t("today"), "month" => t("month"), "week" => t("week"), "day" => t("day"));
    $htpl = get_markup_template('event_head.tpl');
    $a->page['htmlhead'] .= replace_macros($htpl, array('$baseurl' => $a->get_baseurl(), '$i18n' => $i18n, '$editselect' => $editselect));
    $etpl = get_markup_template('event_end.tpl');
    $a->page['end'] .= replace_macros($etpl, array('$baseurl' => $a->get_baseurl(), '$editselect' => $editselect));
    $o = "";
    // tabs
    if ($a->theme_events_in_profile) {
        $tabs = profile_tabs($a, True);
    }
    $mode = 'view';
    $y = 0;
    $m = 0;
    $ignored = x($_REQUEST, 'ignored') ? intval($_REQUEST['ignored']) : 0;
    if ($a->argc > 1) {
        if ($a->argc > 2 && $a->argv[1] == 'event') {
            $mode = 'edit';
            $event_id = intval($a->argv[2]);
        }
        if ($a->argv[1] === 'new') {
            $mode = 'new';
            $event_id = 0;
        }
        if ($a->argc > 2 && intval($a->argv[1]) && intval($a->argv[2])) {
            $mode = 'view';
            $y = intval($a->argv[1]);
            $m = intval($a->argv[2]);
        }
    }
    if ($mode == 'view') {
        $thisyear = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y');
        $thismonth = datetime_convert('UTC', date_default_timezone_get(), 'now', 'm');
        if (!$y) {
            $y = intval($thisyear);
        }
        if (!$m) {
            $m = intval($thismonth);
        }
        // Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
        // An upper limit was chosen to keep search engines from exploring links millions of years in the future.
        if ($y < 1901) {
            $y = 1900;
        }
        if ($y > 2099) {
            $y = 2100;
        }
        $nextyear = $y;
        $nextmonth = $m + 1;
        if ($nextmonth > 12) {
            $nextmonth = 1;
            $nextyear++;
        }
        $prevyear = $y;
        if ($m > 1) {
            $prevmonth = $m - 1;
        } else {
            $prevmonth = 12;
            $prevyear--;
        }
        $dim = get_dim($y, $m);
        $start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
        $finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
        if ($a->argv[1] === 'json') {
            if (x($_GET, 'start')) {
                $start = date("Y-m-d h:i:s", $_GET['start']);
            }
            if (x($_GET, 'end')) {
                $finish = date("Y-m-d h:i:s", $_GET['end']);
            }
        }
        $start = datetime_convert('UTC', 'UTC', $start);
//.........这里部分代码省略.........
开发者ID:vinzv,项目名称:friendica,代码行数:101,代码来源:events.php

示例11: events_content

function events_content(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $htpl = get_markup_template('event_head.tpl');
    $a->page['htmlhead'] .= replace_macros($htpl, array('$baseurl' => $a->get_baseurl()));
    $o = "";
    // tabs
    $tabs = profile_tabs($a, True);
    $mode = 'view';
    $y = 0;
    $m = 0;
    if ($a->argc > 1) {
        if ($a->argc > 2 && $a->argv[1] == 'event') {
            $mode = 'edit';
            $event_id = intval($a->argv[2]);
        }
        if ($a->argv[1] === 'new') {
            $mode = 'new';
            $event_id = 0;
        }
        if ($a->argc > 2 && intval($a->argv[1]) && intval($a->argv[2])) {
            $mode = 'view';
            $y = intval($a->argv[1]);
            $m = intval($a->argv[2]);
        }
    }
    if ($mode == 'view') {
        $thisyear = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y');
        $thismonth = datetime_convert('UTC', date_default_timezone_get(), 'now', 'm');
        if (!$y) {
            $y = intval($thisyear);
        }
        if (!$m) {
            $m = intval($thismonth);
        }
        // Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
        // An upper limit was chosen to keep search engines from exploring links millions of years in the future.
        if ($y < 1901) {
            $y = 1900;
        }
        if ($y > 2099) {
            $y = 2100;
        }
        $nextyear = $y;
        $nextmonth = $m + 1;
        if ($nextmonth > 12) {
            $nextmonth = 1;
            $nextyear++;
        }
        $prevyear = $y;
        if ($m > 1) {
            $prevmonth = $m - 1;
        } else {
            $prevmonth = 12;
            $prevyear--;
        }
        $dim = get_dim($y, $m);
        $start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
        $finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
        if ($a->argv[1] === 'json') {
            if (x($_GET, 'start')) {
                $start = date("Y-m-d h:i:s", $_GET['start']);
            }
            if (x($_GET, 'end')) {
                $finish = date("Y-m-d h:i:s", $_GET['end']);
            }
        }
        $start = datetime_convert('UTC', 'UTC', $start);
        $finish = datetime_convert('UTC', 'UTC', $finish);
        $adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
        $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
        if (x($_GET, 'id')) {
            $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,\n\t\t\t\t`item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` \n\t\t\t\tWHERE `event`.`uid` = %d AND `event`.`id` = %d", intval(local_user()), intval($_GET['id']));
        } else {
            $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,\n\t\t\t\t`item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` \n\t\t\t\tWHERE `event`.`uid` = %d\n\t\t\t\tAND (( `adjust` = 0 AND `start` >= '%s' AND `start` <= '%s' ) \n\t\t\t\tOR  (  `adjust` = 1 AND `start` >= '%s' AND `start` <= '%s' )) ", intval(local_user()), dbesc($start), dbesc($finish), dbesc($adjust_start), dbesc($adjust_finish));
        }
        $links = array();
        if (count($r)) {
            $r = sort_by_date($r);
            foreach ($r as $rr) {
                $j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
                if (!x($links, $j)) {
                    $links[$j] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j;
                }
            }
        }
        $events = array();
        $last_date = '';
        $fmt = t('l, F j');
        if (count($r)) {
            $r = sort_by_date($r);
            foreach ($r as $rr) {
                $j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
                $d = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], $fmt) : datetime_convert('UTC', 'UTC', $rr['start'], $fmt);
                $d = day_translate($d);
                $start = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'c') : datetime_convert('UTC', 'UTC', $rr['start'], 'c');
                if ($rr['nofinish']) {
//.........这里部分代码省略.........
开发者ID:nextgensh,项目名称:friendica,代码行数:101,代码来源:events.php

示例12: upd

 case 'upd':
     upd($diary->link);
     break;
 case 's':
     srch();
     break;
     // Not needed
 // Not needed
 case 'notes':
     notes();
     break;
 case 'ticker':
     ticker();
     break;
 case 'cal':
     cal($diary->link);
     break;
 case 'time':
     time2($d_date11);
     break;
 case 'events':
     events($diary->link, $d_date5, $d_date6, $d_date10);
     break;
 case 'eventsadd':
     eventsadd($diary->link);
     break;
 case 'eventsedit':
     eventsedit($diary->link);
     break;
 case 'tasks':
     tasks($diary->link);
开发者ID:bas2,项目名称:diary,代码行数:31,代码来源:tools2.php

示例13: kalender

/**
 * DZCP - deV!L`z ClanPortal 1.6 Final
 * http://www.dzcp.de
 * Menu: Kalender
 */
function kalender($month = "", $year = "")
{
    global $db, $sql_prefix;
    if (!empty($month) && !empty($year)) {
        $monat = cal($month);
        $jahr = $year;
    } else {
        $monat = date("m");
        $jahr = date("Y");
    }
    for ($i = 1; $i <= 12; $i++) {
        $mname = array("1" => _jan, "2" => _feb, "3" => _mar, "4" => _apr, "5" => _mai, "6" => _jun, "7" => _jul, "8" => _aug, "9" => _sep, "10" => _okt, "11" => _nov, "12" => _dez);
        if ($monat == $i) {
            $month = $mname[$i];
        }
    }
    $today = mktime(0, 0, 0, date("n"), date("d"), date("Y"));
    $i = 1;
    $show = '';
    while ($i <= 31 && checkdate($monat, $i, $jahr)) {
        $data = '';
        $event = '';
        $bdays = '';
        $cws = '';
        for ($iw = 1; $iw <= 7; $iw++) {
            unset($titlecw);
            unset($titlebd);
            unset($titleev);
            $datum = mktime(0, 0, 0, $monat, $i, $jahr);
            $wday = getdate($datum);
            $wday = $wday['wday'];
            if (!$wday) {
                $wday = 7;
            }
            if ($wday != $iw) {
                $data .= "<td class=\"navKalEmpty\"></td>";
            } else {
                $titlebd = '';
                $bdays = "";
                $qry = db("SELECT id,bday FROM " . $db['users'] . " WHERE bday LIKE '" . cal($i) . "." . $monat . ".____" . "'");
                if (_rows($qry)) {
                    while ($get = _fetch($qry)) {
                        $bdays = "set";
                        $titlebd .= '&lt;img src=../inc/images/bday.gif class=icon alt= /&gt;' . '&nbsp;' . jsconvert(_kal_birthday . rawautor($get['id'])) . '&lt;br />';
                    }
                }
                $cws = "";
                $titlecw = "";
                $qry = db("SELECT datum,gegner FROM " . $db['cw'] . " WHERE DATE_FORMAT(FROM_UNIXTIME(datum), '%d.%m.%Y') = '" . cal($i) . "." . $monat . "." . $jahr . "'");
                if (_rows($qry)) {
                    while ($get = _fetch($qry)) {
                        $cws = "set";
                        $titlecw .= '&lt;img src=../inc/images/cw.gif class=icon alt= /&gt;' . '&nbsp;' . jsconvert(_kal_cw . re($get['gegner'])) . '&lt;br />';
                    }
                }
                $event = "";
                $titleev = "";
                $qry = db("SELECT s1.*, s2.name as katname FROM " . $sql_prefix . "events_info as s1 JOIN " . $sql_prefix . "events_kat as s2\n                   WHERE s1.kat = s2.id AND DATE_FORMAT(FROM_UNIXTIME(start), '%d.%m.%Y') <= '" . cal($i) . "." . $monat . "." . $jahr . "' AND DATE_FORMAT(FROM_UNIXTIME(ende), '%d.%m.%Y') >= '" . cal($i) . "." . $monat . "." . $jahr . "' AND s1.show = 1");
                if (_rows($qry)) {
                    while ($get = _fetch($qry)) {
                        $pfadbild = "inc/images/eventkat/" . $get['kat'];
                        if (file_exists(basePath . "/" . $pfadbild . ".gif")) {
                            $bild = '<img src=../' . $pfadbild . '.gif class=icon  alt= />';
                        } elseif (file_exists(basePath . "/" . $pfadbild . ".jpg")) {
                            $bild = '<img src=../' . $pfadbild . '.jpg class=icon  alt= />';
                        } elseif (file_exists(basePath . "/" . $pfadbild . ".png")) {
                            $bild = '<img src=../' . $pfadbild . '.png class=icon  alt= />';
                        } else {
                            $bild = "<img src=../inc/images/event.gif class=icon alt= />";
                        }
                        $event = "set";
                        $titleev .= '<tr><td>' . $bild . jsconvert(re($get['katname']) . ': ' . re($get['name'])) . '</td></tr>';
                    }
                }
                $info = 'onmouseover="DZCP.showInfo(\'' . cal($i) . '.' . $monat . '.' . $jahr . '\', \'' . $titlebd . $titlecw . $titleev . '\')" onmouseout="DZCP.hideInfo()"';
                if ($event == "set" || $cws == "set" || $bdays == "set") {
                    $day = '<a class="navKal" href="../kalender/?m=' . $monat . '&amp;y=' . $jahr . '&amp;hl=' . $i . '" ' . $info . '>' . cal($i) . '</a>';
                } else {
                    $day = cal($i);
                }
                if (!checkdate($monat, $i, $jahr)) {
                    $data .= '<td class="navKalEmpty"></td>';
                } elseif ($datum == $today) {
                    $data .= show("menu/kal_day", array("day" => $day, "id" => "navKalToday"));
                } else {
                    $data .= show("menu/kal_day", array("day" => $day, "id" => "navKalDays"));
                }
                $i++;
            }
        }
        $show .= "<tr>" . $data . "</tr>";
    }
    if ($monat + 1 == 13) {
        $nm = 1;
        $ny = $jahr + 1;
//.........这里部分代码省略.........
开发者ID:BlueTeck,项目名称:dzcp-extended-calendar,代码行数:101,代码来源:kalender.php

示例14: cal

<?
  # Добавить подсветку сегодняшнего числа
  # Реализовать чтобы календарь выводило на любой указанный в $arg[1] год
  # Добавить поддержку многоязычности
  # и чтобы первым днём недели чтобы можно было указать воскресенье или другой день
  return cal($arg[1]);

  function cal($year) {
    return "Календарь на 2015 год:

       Январь               Февраль                 Март          
Вс Пн Вт Ср Чт Пт Сб  Вс Пн Вт Ср Чт Пт Сб  Вс Пн Вт Ср Чт Пт Сб  
             1  2  3   1  2  3  4  5  6  7   1  2  3  4  5  6  7  
 4  5  6  7  8  9 10   8  9 10 11 12 13 14   8  9 10 11 12 13 14  
11 12 13 14 15 16 17  15 16 17 18 19 20 21  15 16 17 18 19 20 21  
18 19 20 21 22 23 24  22 23 24 25 26 27 28  22 23 24 25 26 27 28  
25 26 27 28 29 30 31                        29 30 31              
                                                                  

       Апрель                 Май                   Июнь          
Вс Пн Вт Ср Чт Пт Сб  Вс Пн Вт Ср Чт Пт Сб  Вс Пн Вт Ср Чт Пт Сб  
          1  2  3  4                  1  2      1  2  3  4  5  6  
 5  6  7  8  9 10 11   3  4  5  6  7  8  9   7  8  9 10 11 12 13  
12 13 14 15 16 17 18  10 11 12 13 14 15 16  14 15 16 17 18 19 20  
19 20 21 22 23 24 25  17 18 19 20 21 22 23  21 22 23 24 25 26 27  
26 27 28 29 30        24 25 26 27 28 29 30  28 29 30              
                      31                                          

        Июль                 Август               Сентябрь        
Вс Пн Вт Ср Чт Пт Сб  Вс Пн Вт Ср Чт Пт Сб  Вс Пн Вт Ср Чт Пт Сб  
          1  2  3  4                     1         1  2  3  4  5  
开发者ID:Adeptx,项目名称:adeptx_core,代码行数:31,代码来源:cal.php

示例15: switch

<?php

//<!--Calaulator @YingZhou 03/14/2016-->
if (is_ajax()) {
    if (isset($_POST["action"]) && !empty($_POST["action"])) {
        //Checks if action value exists
        $action = $_POST["action"];
        switch ($action) {
            case "mul":
                cal($_POST["value1"], $_POST["value2"], $_POST["operate"]);
                break;
            case "=":
                cal($_POST["value1"], $_POST["value2"], $_POST["operate"]);
                break;
        }
    }
}
//Function to check if the request is an AJAX request
function is_ajax()
{
    return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
}
function cal($value1, $value2, $operate)
{
    $number1 = floatval($value1);
    $number2 = floatval($value2);
    if ($operate == "+") {
        echo $value1 + $value2;
    }
    if ($operate == "-") {
        echo $value1 - $value2;
开发者ID:JXHZY,项目名称:webDeveloper,代码行数:31,代码来源:calculator.php


注:本文中的cal函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。