Пример #1
0
 print '<br><table class="ff" border="0">' . "\n";
 print '<tr class="main_s"><td colspan="1" style="text-align:left;">' . $main_date[$lang] . '</td>';
 if ($tslice) {
     print '<td>' . $talks[$lang] . '</td>';
 }
 if ($talker) {
     print '<td>' . $thread[$lang] . '</td>';
 }
 print '<tr>' . "\n";
 // list of available chats (general)
 print '<td valign="top"><table border="0" class="ff">' . "\n";
 print '<tr>' . "\n";
 print '<td rowspan="3" valign="top">' . "\n";
 print '<ul id="treemenu2" class="treeview" style="padding: 0px;">' . "\n";
 while ($entry = mysql_fetch_array($result)) {
     $cl_entry = pl_znaczki(verbose_mo($entry[verb], $lang));
     if ($entry[at_m] == substr($tslice, 0, 7)) {
         $rel = "open";
         $bop = "<b>";
         $bcl = "</b>";
     } else {
         $rel = "";
         $bop = "";
         $bcl = "";
     }
     // ugly hack...
     print '<li>' . $bop . $cl_entry . $bcl . '' . "\n";
     // folder - begin
     print '<ul rel="' . $rel . '">' . "\n";
     // folder content
     $query = "select distinct(at) from `logdb_stats_{$xmpp_host}` where owner_id = '{$user_id}' and substring(at,1,7) = '{$entry['at_m']}' order by str_to_date(at,'%Y-%m-%d') desc";
Пример #2
0
    $float = "none;";
}
print '<div style="text-align: center; width: 200px; float: ' . $float . '">' . "\n";
// lets generate quick jump list
print '<form id="t_jump" action="calendar_view.php" method="post" name="t_jump">' . "\n";
print '<select style="text-align: center; border: 0px; background-color: #6daae7; color:#fff; font-size: x-small;" name="jump_box" size="0" onchange="javascript:document.t_jump.submit();">' . "\n";
print '<option value="jump">' . $jump_to_l[$lang] . '</option>' . "\n";
while ($mo_sel = mysql_fetch_array($ch_mo)) {
    list($s_y, $s_m) = split("-", $mo_sel[at_send]);
    $sym = "{$s_y}-{$s_m}";
    if ($jump_to != "" and $sym == $mo) {
        $sel_box = "selected";
    } else {
        $sel_box = "";
    }
    print '<option value="' . $sym . '" ' . $sel_box . '>' . pl_znaczki(verbose_mo($mo_sel[at], $lang)) . '</option>' . "\n";
}
print '</select>' . "\n";
print '</form>' . "\n";
// now generate claendar, the peer_name_id is hard-coded - this avoids of displaying chats with no-username
$query_days = "select distinct(substring(at,8,9)) as days from `logdb_stats_{$xmpp_host}` where owner_id = '{$user_id}' and at like '{$mo}%' and peer_name_id!='{$ignore_id}' order by str_to_date(at,'%Y-%m-%d') desc";
$result_for_days = mysql_query($query_days);
$i = 0;
// array of days
while ($row_d = mysql_fetch_array($result_for_days)) {
    $i++;
    $days[$i] = str_replace("-", "", $row_d[days]);
    // hack for bad parsing
}
// display calendar
list($y, $m) = split("-", $mo);
Пример #3
0
function calendar($user_id, $xmpp_host, $y, $m, $days, $token, $url_key, $months_name_eng, $left, $right, $selected, $lang, $view_type, $c_type, $name_peer = 0, $server_peer = 0, $cal_days = 0)
{
    $days = $days;
    $month = $m;
    $year = $y;
    //create arrays for the calendar
    $months_days = array("31", "28", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31");
    $days_array = array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun");
    //removes the 0 from start of month - can't find array key with 0
    if (strlen($month) == 1) {
        $month = str_replace("0", "", $month);
    } else {
        $month = $month;
    }
    //reset month to the array key match (array starts at 0)
    $month = $month - 1;
    //find the days in the month
    $days_in_month = $months_days[$month];
    //And convert the month number to name
    $month_name = $months_name_eng[$month];
    //$m is used to find month
    $m = $month + 1;
    //find the first day of the month
    $time = date("M D Y H:i:s", mktime(0, 0, 0, $m, 1, $year));
    $first_day = explode(" ", $time);
    $time = $first_day[1];
    //create the links to next and previous months
    $next = $month + 2;
    $x = $year;
    //if month is 13 then new year
    if ($next == 13) {
        $next = 1;
        $x = $x + 1;
    }
    $prev = $month;
    $y = $year;
    //if month is 0, then previous year
    if ($prev == 0) {
        $prev = 12;
        $y = $y - 1;
    }
    $calendar = "";
    //Build the calendar with css
    //links to next and previous month only for browser
    if ($c_type == "1") {
        // encode links
        $link_left = encode_url("{$y}-{$prev}", $token, $url_key);
        $link_right = encode_url("{$x}-{$next}", $token, $url_key);
        // check if we have chats in prev and next mo
        $is_left = "select at from `logdb_stats_{$xmpp_host}` where owner_id='{$user_id}' and at like '{$y}-{$prev}%' limit 1";
        $is_right = "select at from `logdb_stats_{$xmpp_host}` where owner_id='{$user_id}' and at like '{$x}-{$next}%' limit 1";
        $i_left = mysql_num_rows(mysql_query($is_left));
        $i_right = mysql_num_rows(mysql_query($is_right));
    } else {
        $i_left = 0;
        $i_right = 0;
    }
    $calendar .= '
	<table width="200"  border="0" cellpadding="0" cellspacing="0" class="calbck">
      	<tr>
        <td><img src="img/cal_corn_11.png" width="15" height="7"></td>
        <td background="img/cal_bck_top.gif"></td>
        <td><img src="img/cal_corn_12.png" width="14" height="7"></td>
      	</tr>
      	<tr>
        <td width="15" valign="top" class="calbckleft"><img src="img/cal_bck_left.png" width="15" height="116">
      	</td>
        <td width="100%" valign="top">
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
        <td height="15" align="center" class="caldays">
	';
    if ($i_left != 0) {
        $calendar .= '<a href="?left=' . $link_left . '"><<<</a>';
    }
    $verb_date = "{$year}-{$m}-1";
    $calendar .= '
	    	
		&nbsp;</td>
            	<td colspan="5" align="center" class="calhead">' . verbose_mo($verb_date, $lang) . '</td>
            	<td align="center" class="caldays">&nbsp;
		
		';
    if ($i_right != 0) {
        $calendar .= '<a href="?right=' . $link_right . '">>>></a>';
    }
    $calendar .= '

	    	</td>
	  	</tr>
          	<tr align="center" class="calweek">
            	<td width="14%" height="15">' . $cal_days[$lang][1] . '</td>
            	<td width="14%">' . $cal_days[$lang][2] . '</td>
            	<td width="14%">' . $cal_days[$lang][3] . '</td>
            	<td width="14%">' . $cal_days[$lang][4] . '</td>
            	<td width="14%">' . $cal_days[$lang][5] . '</td>
            	<td width="14%">' . $cal_days[$lang][6] . '</td>
            	<td width="14%">' . $cal_days[$lang][7] . '</td>
          	</tr>
	    
	    ';
    //checks for leap years and add 1 to February
    if ($year % 4 == "" && $month == 1) {
        $days_in_month = $days_in_month + 1;
    } else {
        $days_in_month = $days_in_month;
    }
    $new_time = "";
    //find how many blank spaces at beginning of the month
    foreach ($days_array as $key => $value) {
        if ($value == $time) {
            $new_time .= $key + 1;
        } else {
            $new_time .= "";
        }
    }
    //loop through the days in the month
    $c = 0;
    for ($k = 1; $k < $days_in_month + $new_time; $k++) {
        $c++;
        if ($c == 1) {
            $calendar .= '<tr align="center" class="caldays">';
        }
        //blank space
        if ($k < $new_time) {
            $calendar .= '<td height="15">&nbsp;</td>
            ';
            continue;
        }
        //start the actual days
        $n = $k - $new_time + 1;
        if (in_array($n, $days)) {
            if ($c_type == "1") {
                $to_base = "{$year}-{$m}-{$n}@";
                $loc_orign = "";
            } elseif ($c_type == "2") {
                $to_base = "{$year}-{$m}-{$n}@{$name_peer}@{$server_peer}@";
                $loc_orign = "&loc=2";
            }
            $to_base = encode_url($to_base, $token, $url_key);
            if ($selected == $n) {
                $bgcolor = 'bgcolor="#6daae7"';
            } else {
                $bgcolor = "";
            }
            $calendar .= '<td height="15" ' . $bgcolor . ' onclick="window.location=\'' . $view_type . '?a=' . $to_base . $loc_orign . '\'"><b><a class="caldays2" href="' . $view_type . '?a=' . $to_base . $loc_orign . '">' . $n . '</a></b></td>
                         ';
        } else {
            $calendar .= '<td height="15">' . $n . '</td>
                         ';
        }
        if ($c == 7) {
            $calendar .= '</tr>';
            $c = 0;
        }
    }
    $calendar .= '

	</table>
        </td>
        <td width="14" valign="top" class="calbckright"><img src="img/cal_bck_right.png" width="14" height="116"></td>
      	</tr>
      	<tr>
        <td><img src="img/cal_corn_21.png" width="15" height="16"></td>
        <td background="img/cal_bck_bot.png"></td>
        <td><img src="img/cal_corn_22.png" width="14" height="16"></td>
      	</tr>
    	</table>
        
	';
    return $calendar;
}