Example #1
0
function make_calendar_html($calendar = array(), $options = array())
{
    $start_day = !empty($options['start_day']) ? $options['start_day'] : 1;
    if (empty($calendar)) {
        $calendar = make_calendar($options);
    }
    foreach ($calendar as $week) {
        $row = '<tr>';
        foreach ($week as $date => $day) {
            if (!empty($day['diff'])) {
                $day['class'] .= ' month';
            }
            if (!empty($day['today'])) {
                $day['class'] .= ' today';
            }
            $row .= '<td' . (!empty($day['class']) ? ' class="' . $day['class'] . '"' : '') . ' data-date="' . $date . '"' . html_data($day['data']) . '>' . $day['content'] . '</td>';
        }
        $row .= '</tr>';
        $tbody .= $row;
    }
    $tbody = '<tbody>' . $tbody . '</tbody>';
    $days = arr_day();
    for ($n = $start_day; $i < 7; $i++) {
        $thead .= '<th>' . $days[$n] . '</th>';
        $n = $n == 7 ? 1 : $n + 1;
    }
    $thead = '<thead><tr class="head">' . $thead . '</tr></thead>';
    // we use the class `head` here for legacy compatability
    $html = '<table class="calendar">' . $thead . $tbody . '</table>';
    return $html;
}
Example #2
0
        $jj = $j + 1;
        $d = normDate("{$jj}.{$m}.{$y}");
        $calendar .= "<td data-thedate=" . $d . " class=hgsacc >" . ($j + 1) . "</td>";
        $br++;
        $br = $br % 7;
        if ($br == 1) {
            $calendar .= "</tr><tr>";
        }
    }
    /*
     *  trailing days into next month
     */
    for ($i = 1; $br > 1 && $br < 8; $br++) {
        $d = normDate("{$i}.{$mn}.{$yn}");
        $calendar .= "<td data-thedate=" . $d . "  class=hgspcc>" . $i++ . "</td>";
    }
    /*
     * close calendar table
     */
    $calendar .= '</tr></table>';
    return $calendar;
}
///////////////////////////////////////
/////////////////  MAIN ///////////////
///////////////////////////////////////
$json = json_decode(file_get_contents('php://input'), true);
$y = $json['y'];
$m = $json['m'];
$target = $json['target'];
$json['result'] = make_calendar($m, $y, $target);
echo json_encode($json);
Example #3
0
<form action="add_articles.php" method="post" enctype="multipart/form-data" name="addarticle">	
<p><b>Article title:</b> <input type="text" name="title" size="60" maxlength="120" value="<?php 
if (isset($_POST['title'])) {
    echo $_POST['title'];
}
?>
" /></p>

<p><b>Document to upload:</b> <input type="hidden" name="MAX_FILE_SIZE" value="524288" />
<input type="file" name="upload" /></p>

	<p><b>Submission date:</b>

<?php 
$dates = getdate();
make_calendar($dates['mon'], $dates['mday'], $dates['year']);
?>
	
	
	<p><b>Article number:</b> <input type="text" name="articlenumber" size="4" maxlength="12" value="<?php 
if (isset($_POST['articlenumber'])) {
    echo $_POST['articlenumber'];
} else {
    // Grab the latest arbitrary article number for suggestion
    $query = "SELECT articlenumber FROM articles ORDER BY articlenumber DESC LIMIT 1";
    $result = mysqli_query($dbc, $query);
    $recnum = mysqli_fetch_array($result, MYSQL_NUM);
    $recnum = $recnum[0] + 1;
    echo $recnum;
}
?>
Example #4
0
#---------------------------------------------#
if (!defined('BASEDIR')) {
    exit(header('Location: /index.php'));
}
$cal_den = date_fixed(SITETIME, "j");
$cal_mon = date_fixed(SITETIME, "m");
$cal_year = date_fixed(SITETIME, "Y");
$array_news = array();
$array_komm = array();
$querynews = DB::run()->query("SELECT `news_id`, `news_time` FROM `news` WHERE EXTRACT(YEAR_MONTH FROM FROM_UNIXTIME(`news_time`))=EXTRACT(YEAR_MONTH FROM NOW());");
while ($data = $querynews->fetch()) {
    $arrday = date_fixed($data['news_time'], 'j');
    $array_news[] = $arrday;
    $array_komm[$arrday] = $data['news_id'];
}
$calend = make_calendar($cal_mon, $cal_year);
echo '<table><caption><b>' . date_fixed(SITETIME, 'j F Y') . '</b></caption>';
echo '<thead><tr>';
echo '<th>Пн</th><th>Вт</th><th>Ср</th><th>Чт</th><th>Пт</th><th><span style="color:#ff6666">Сб</span></th><th><span style="color:#ff6666">Вс</span></th>';
echo '</tr></thead><tbody>';
foreach ($calend as $valned) {
    echo '<tr>';
    foreach ($valned as $keyday => $valday) {
        if ($cal_den == $valday) {
            echo '<td><b><span style="color:#ff0000">' . $valday . '</span></b></td>';
            continue;
        }
        if (in_array($valday, $array_news)) {
            echo '<td><a href="/news/index.php?act=read&amp;id=' . $array_komm[$valday] . '"><span style="color:#ff0000">' . $valday . '</span></a></td>';
            continue;
        }
            <th width="14%"><?php 
echo strtoupper(substr(CALENDAR_DAY_4, 0, 1));
?>
</th>
            <th width="14%"><?php 
echo strtoupper(substr(CALENDAR_DAY_5, 0, 1));
?>
</th>
            <th width="14%"><?php 
echo strtoupper(substr(CALENDAR_DAY_6, 0, 1));
?>
</th>
          </tr>
          
<?php 
$month_res = make_calendar($curmonth, $curyear);
//$fasce= get_fasce($day_app, 2);
foreach ($month_res as $row) {
    print '<tr align="center" valign="middle">';
    foreach ($row as $key => $bday) {
        list($day, $month) = explode("/", $bday);
        if ($month != $curmonth) {
            print '<td width="14%">&nbsp;</td>';
        } else {
            if ($curday == $day) {
                $class = 'cal-giorno-attuale';
            } elseif ($day_app[$curyear . '-' . $month . '-' . $day][tot] > 0) {
                $class = 'cal-giorno-appunt';
            } elseif ($key > 4) {
                $class = 'cal-giorno-non-lav';
            } else {
Example #6
0
         $ne_hour = $smarray['hours'];
         $ne_minute = $smarray['minutes'];
         $end_hour = $smarray['hours'];
         $end_minute = $smarray['minutes'];
         $ne_enddate = $ecal_class->full_date($qs[1]);
         $recurring = 0;
         $caption = EC_LAN_28;
         // Enter New Event
     // Enter New Event
     default:
         $caption = EC_LAN_83;
 }
 $text = "\n\t\t<script type=\"text/javascript\">\n\t\t<!--\n\t\tfunction check_mult(val)\n\t\t{\n\t\t  if (val == true)\n\t\t  {\n\t\t    alert('" . EC_LAN_87 . "');\n\t\t  }\n\t\t}\n\t\t\n\t\tfunction proc_recur(rec_value)\n\t\t{\n\t\t  if(document.getElementById('rec_week_sel')) \n\t\t  {\n\t\t\ttarget=document.getElementById('rec_week_sel').style;\n\t\t\tif (rec_value >= 100)\n\t\t    {\n\t\t\t  target.display = '';\n//\t\t      alert('show');\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t  target.display = 'none';\n//\t\t      alert('hide');\n\t\t\t}\n\t\t  }\n\t\t  if(document.getElementById('gen_multiple')) \n\t\t  {\n\t\t\ttarget=document.getElementById('gen_multiple').style;\n\t\t\tif (rec_value > 0)\n\t\t    {\n\t\t\t  target.display = '';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t  target.display = 'none';\n\t\t\t}\n\t\t  }\n\t\t}\n\t\t\n\t\tfunction calcheckform(thisform, submitted,arrstr)\n\t\t{\n\t\t\tvar testresults=true;\n\n\t\t\tfunction calcdate(thisval)\n\t\t\t{\n\t\t\t  var temp1;\n\t\t\t  temp1 = thisval.split(\"{$ecal_class->date_separator}\");\n\t\t\t  switch (arrstr)\n\t\t\t  {\n\t\t\t    case 2 : return temp1[2]+temp1[1]+temp1[0];\n\t\t\t    case 3 : return temp1[2]+temp1[0]+temp1[1];\n\t\t\t    default : return temp1[0]+temp1[1]+temp1[2];\n\t\t\t  }\n\t\t\t  return 'Error';\n\t\t\t}\n\t\t\t//event check - dates are text strings\n\t\t\tvar sdate = calcdate(thisform.start_date.value);\n\t\t\tvar edate = calcdate(thisform.end_date.value);\n\t\t\tif (edate < sdate)\n\t\t\t{  // Update end date if its before start date\n\t\t\t  thisform.end_date.value = thisform.start_date.value;\n//\t\t\t  alert('End date changed');\n\t\t\t}\n\t\t\tsdate = calcdate(thisform.start_date.value) + thisform.ne_hour.options[thisform.ne_hour.selectedIndex].value + thisform.ne_minute.options[thisform.ne_minute.selectedIndex].value;\n\t\t\tedate = calcdate(thisform.end_date.value) + thisform.end_hour.options[thisform.end_hour.selectedIndex].value + thisform.end_minute.options[thisform.end_minute.selectedIndex].value;\n//\t\t\talert('Format: ' + arrstr + '    Start date: '+ sdate + '    End date: ' + edate);\n\t\t\t\n\t\t\ttestresults=true;\n\n\t\t\tif (edate <= sdate && !thisform.allday.checked && testresults )\n\t\t\t{\n\t\t\t\talert('" . EC_LAN_99 . "');\n\t\t\t\ttestresults=false;\n\t\t\t}\n\t\t\tif ((thisform.ne_title.value=='' || thisform.ne_event.value=='') && testresults)\n\t\t\t{\n\t\t\t\talert('" . EC_LAN_98 . "');\n\t\t\t\ttestresults=false;\n\t\t\t}\n\n\t\t\tif (testresults)\n\t\t\t{\n\t\t\t\tif (thisform.subbed.value=='no')\n\t\t\t\t{\n\t\t\t\t\tthisform.subbed.value='yes';\n\t\t\t\t\ttestresults=true;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\t\talert('" . EC_LAN_113 . "');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn testresults;\n\t\t}\n\t\t-->\n\t\t</script>";
 $text .= "\n\t\t<form method='post' action='" . e_SELF . "' id='linkform' onsubmit='return calcheckform(this, submitted,{$ecal_class->java_format_code})'>\n\t\t<table style='width:98%' class='fborder' ><colgroup><col style='width:20%' /><col style='width:80%' /></colgroup>";
 $text .= "\n\t\t<tr><td class='forumheader3'>" . EC_LAN_72 . " </td><td class='forumheader3'> " . EC_LAN_67 . " ";
 $text .= make_calendar("start_date", $ne_startdate) . "&nbsp;&nbsp;&nbsp;" . EC_LAN_73 . " " . make_calendar("end_date", $ne_enddate);
 $text .= "</td></tr>\n\t\t<tr><td class='forumheader3'>" . EC_LAN_71 . " </td><td class='forumheader3'>" . EC_LAN_67;
 $text .= make_hourmin("ne_", $ne_hour, $ne_minute) . "&nbsp;&nbsp;" . EC_LAN_73 . make_hourmin('end_', $end_hour, $end_minute);
 $text .= "<br /><input type='checkbox' name='allday' value='1' " . (isset($allday) && $allday == 1 ? "checked='checked'" : "") . " />";
 $text .= EC_LAN_64 . "\n\t\t</td></tr>\n\n\t\t<tr><td class='forumheader3'>" . EC_LAN_65 . "</td><td class='forumheader3'>";
 $text .= recur_week_select($recurring) . "&nbsp;&nbsp;" . recur_select($recurring);
 $disp = $recurring && $action == 'ne' ? '' : " style='display:none;'";
 $text .= "<span id='gen_multiple'{$disp}><input type='checkbox' name='ec_gen_multiple' value='1' onchange=\"check_mult(this.checked);\"/>" . EC_LAN_86 . "</span>";
 $text .= "<br /><span class='smalltext'>" . EC_LAN_63 . "</span>\n\t\t</td></tr>\n\t\t<tr><td class='forumheader3'>" . EC_LAN_70 . " *</td><td class='forumheader3'>\n\t\t<input class='tbox' type='text' name='ne_title' size='75' value='" . (isset($ne_title) ? $ne_title : "") . "' maxlength='200' style='width:95%' />\n\t\t</td></tr>\n\n\t\t<tr><td class='forumheader3'>" . EC_LAN_52 . " </td><td class='forumheader3'>\n\t\t<select name='ne_category' class='tbox'>";
 // Check if supervisor, if so get all categories, otherwise just get those the user is allowed to see
 // Always exclude the default categories
 $cal_arg = $ecal_class->cal_super ? "" : "find_in_set(event_cat_addclass,'" . USERCLASS_LIST . "') AND ";
 $cal_arg .= "(event_cat_name != '" . EC_DEFAULT_CATEGORY . "') ";
 if ($sql->db_Select('event_cat', 'event_cat_id, event_cat_name', $cal_arg)) {
     while ($row = $sql->db_Fetch()) {
         $text .= "<option value='{$row['event_cat_id']}' " . (isset($ne_category) && $ne_category == $row['event_cat_id'] ? "selected='selected'" : '') . " >" . $row['event_cat_name'] . "</option>";