コード例 #1
0
function display_small_tasks($cat_id)
{
    global $caturl, $DATE_FORMAT_TASK, $eventinfo, $is_assistant, $login, $task_filter, $user;
    static $key = 0;
    if (!empty($user) && $user != $login && !$is_assistant) {
        return false;
    }
    $SORT_TASKS = 'Y';
    $pri[1] = translate('High');
    $pri[2] = translate('Medium');
    $pri[3] = translate('Low');
    $task_user = $login;
    $u_url = '';
    if ($user != $login && !empty($user)) {
        $u_url = 'user='******'&';
        $task_user = $user;
    }
    $ajax = array();
    $dueSpacer = ' ';
    $task_cat = empty($cat_id) ? -99 : $cat_id;
    if ($SORT_TASKS == 'Y') {
        for ($i = 0; $i < 4; $i++) {
            $ajax[$i] = '
        <td class="sorter" onclick="sortTasks( ' . $i . ', ' . $task_cat . ', this )"><img src="images/up.png" style="vertical-align:bottom" /></td>';
            $ajax[$i + 4] = '
        <td  class="sorter sorterbottom" onclick="sortTasks( ' . ($i + 4) . ', ' . $task_cat . ', this )"><img src="images/down.png" style="vertical-align:top" /></td>';
        }
    } else {
        $dueSpacer = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        $ajax = array_pad($ajax, 8, '
        <td></td>');
    }
    $priorityStr = translate('Priority');
    $dateFormatStr = $DATE_FORMAT_TASK;
    $task_list = query_events($task_user, false, empty($task_filter) ? '' : $task_filter, $cat_id, true);
    $row_cnt = 1;
    $task_html = '
    <table class="minitask" cellspacing="0" cellpadding="2">
      <tr class="header">
        <th colspan="6">' . translate('TASKS') . '</th>
        <th align="right" colspan="2"><a href="edit_entry.php?' . $u_url . 'eType=task' . $caturl . '"><img src="images/new.png" alt="+" class="new" /></a></th>
      </tr>
      <tr class="header">
        <td rowspan="2" class="sorterbottom">!&nbsp;</td>' . $ajax[0] . '
        <td rowspan="2" width="20%" class="sorterbottom">' . translate('Task_Title') . '&nbsp;</td>' . $ajax[1] . '
        <td rowspan="2" class="sorterbottom">' . translate('Due') . $dueSpacer . '</td>' . $ajax[2] . '
        <td rowspan="2" class="sorterbottom">%</td>' . $ajax[3] . '
      </tr>
      <tr class="header">' . $ajax[4] . $ajax[5] . $ajax[6] . $ajax[7] . '
      </tr>';
    foreach ($task_list as $E) {
        // Check UAC.
        $task_owner = $E->getLogin();
        if (access_is_enabled()) {
            $can_access = access_user_calendar('view', $task_owner, '', $E->getCalType(), $E->getAccess());
            if ($can_access == 0) {
                continue;
            }
        }
        $cal_id = $E->getId();
        // Generate popup info.
        $linkid = 'pop' . "{$cal_id}-{$key}";
        $key++;
        $link = '<a href="view_entry.php?' . ($task_owner != $login ? 'user='******'&amp;' : '') . 'id=' . $cal_id . '"';
        $task_html .= '
      <tr class="task" id="' . $linkid . '" style="background-color:' . rgb_luminance($GLOBALS['BGCOLOR'], $E->getPriority()) . '">
        <td colspan="2">' . $link . ' title="' . $priorityStr . '">' . $E->getPriority() . '</a></td>
        <td class="name" colspan="2" width="50%">&nbsp;' . $link . ' title="' . translate('Task Name') . ': ' . $E->getName() . '">' . substr($E->getName(), 0, 15) . (strlen($E->getName()) > 15 ? '...' : '') . '</a></td>
        <td colspan="2">' . $link . ' title="' . translate('Task Due Date') . '">' . date_to_str($E->getDueDate(), $dateFormatStr, false, false) . '</a>' . '</td>
        <td class="pct" colspan="2">' . $link . ' title="% ' . translate('Completed') . '">' . $E->getPercent() . '</a></td>
      </tr>';
        $row_cnt++;
        // Build special string to pass to popup.
        // TODO:  Move this logic into build_entry_popup ().
        $eventinfo .= build_entry_popup('eventinfo-' . $linkid, $E->getLogin(), $E->getDescription(), translate('Due Time') . ':' . display_time('', 0, $E->getDueDateTimeTS()) . '</dd><dd>' . translate('Due Date') . ':' . date_to_str($E->getDueDate(), '', false) . "</dd>\n<dt>" . $priorityStr . ":</dt>\n<dd>" . $E->getPriority() . '-' . $pri[ceil($E->getPriority() / 3)] . "</dd>\n<dt>" . translate('Percent Complete') . ":</dt>\n<dd>" . $E->getPercent() . '%', '', $E->getLocation(), $E->getName(), $cal_id);
    }
    for ($i = 7; $i > $row_cnt; $i--) {
        $task_html .= '<tr><td colspan="8" class="filler">&nbsp;</td></tr>' . "\n";
    }
    $task_html .= "</table>\n";
    return $task_html;
}
コード例 #2
0
 function print_upcoming_event($e, $date)
 {
     global $display_link, $link_target, $SERVER_URL, $charset, $login, $display_tzid, $showTime, $showPopups, $eventinfo, $username, $hcalendar_output, $UPCOMING_DISPLAY_CAT_ICONS;
     $popupid = 'pop' . $e->getId() . '-' . $date;
     $private = $confidential = false;
     // Access: P=Public, R=Private, C=Confidential
     if ($e->getAccess() == 'R') {
         // not a public event, so we will just display "Private"
         $private = true;
     } else {
         if ($e->getAccess() == 'C') {
             // not a public event, so we will just display "Confidential"
             $confidential = true;
         }
     }
     if (!empty($SERVER_URL) && !$private && !$confidential) {
         echo "<div class=\"vevent\">\n";
         if ($display_link) {
             if ($showPopups) {
                 $timestr = '';
                 if ($e->isAllDay()) {
                     $timestr = translate('All day event');
                 } else {
                     if ($e->getTime() >= 0) {
                         $timestr = display_time($e->getDatetime());
                         if ($e->getDuration() > 0) {
                             $timestr .= ' - ' . display_time($e->getEndDateTime());
                         }
                     }
                 }
                 $eventinfo .= build_entry_popup('eventinfo-' . $popupid, $username, $e->getDescription(), $timestr, site_extras_for_popup($e->getId()), $e->getLocation(), $e->getName(), $e->getId());
             }
             $link = "<a class=\"entry\" id=\"{$popupid}\" title=\"" . htmlspecialchars($e->getName()) . '" href="' . $SERVER_URL . 'view_entry.php?id=' . $e->getID() . "&amp;date={$date}&amp;user="******"\" target=\"{$link_target}\"";
             }
             $link .= '>';
             if (empty($UPCOMING_DISPLAY_CAT_ICONS) || $UPCOMING_DISPLAY_CAT_ICONS != 'N') {
                 $catNum = abs($e->getCategory());
                 if ($catNum > 0) {
                     $catIcon = 'icons/cat-' . $catNum . '.gif';
                     if (file_exists($catIcon)) {
                         echo $link . '<img src="' . $catIcon . '" alt="category icon" border="0"/></a>';
                     }
                 }
             }
             echo $link;
         }
     }
     if ($private) {
         echo '[' . translate('Private') . ']';
     } else {
         if ($confidential) {
             echo '[' . translate('Confidential') . ']';
         } else {
             echo '<span class="summary">' . htmlspecialchars($e->getName()) . '</span>';
         }
     }
     if ($display_link && !empty($SERVER_URL) && !$private) {
         echo '</a>';
     }
     //added for hCalendar
     if ($hcalendar_output) {
         echo '<abbr class="dtstart" title="' . export_ts_utc_date($e->getDateTimeTS()) . '">' . $e->getDateTime() . "</abbr>\n";
         echo '<abbr class="dtend" title="' . export_ts_utc_date($e->getEndDateTimeTS()) . '">' . $e->getEndDateTimeTS() . "</abbr>\n";
         echo '<span class="description">' . $e->getDescription() . "</span>\n";
         if (strlen($e->getLocation()) > 0) {
             echo '<span class="location">' . $e->getLocation() . "</span>\n";
         }
         $categories = get_categories_by_id($e->getId(), $username);
         $category = implode(', ', $categories);
         if (strlen($category) > 0) {
             echo '<span class="categories">' . htmlentities($category) . "</span>\n";
         }
         if (strlen($e->getUrl()) > 0) {
             echo '<span class="url">' . $e->getUrl() . "</span>\n";
         }
         $rrule = export_recurrence_ical($e->getId());
         if (strlen($rrule) > 6) {
             echo '<span class="rrule">' . substr($rrule, 6) . "</span>\n";
         }
     }
     if ($showTime) {
         //show event time if requested (default=don't show)
         if ($e->isAllDay()) {
             echo ' (' . translate('All day event') . ")\n";
         } else {
             if ($e->getTime() != -1) {
                 echo ' (' . display_time($e->getDateTime(), $display_tzid) . ")\n";
             }
         }
     }
     echo "</div>\n";
 }
コード例 #3
0
ファイル: list_unapproved.php プロジェクト: rhertzog/lcs
function list_unapproved($user)
{
    global $eventinfo, $key, $login, $NONUSER_ENABLED, $noret, $temp_fullname;
    user_load_variables($user, 'temp_');
    $rssLink = '<a href="rss_unapproved.php?user='******'"><img src="images/rss.png" width="14" height="14" alt="RSS 2.0 - ' . htmlspecialchars($temp_fullname) . '" border="0"/></a>';
    $count = 0;
    $ret = '';
    $sql = 'SELECT we.cal_id, we.cal_name, we.cal_description, weu.cal_login,
    we.cal_priority, we.cal_date, we.cal_time, we.cal_duration,
    weu.cal_status, we.cal_type
    FROM webcal_entry we, webcal_entry_user weu
    WHERE we.cal_id = weu.cal_id AND weu.cal_login = ? AND weu.cal_status = \'W\'
    ORDER BY weu.cal_login, we.cal_date';
    $rows = dbi_get_cached_rows($sql, array($user));
    if ($rows) {
        $allDayStr = translate('All day event');
        $appConStr = translate('Approve/Confirm');
        $appSelStr = translate('Approve Selected');
        $checkAllStr = translate('Check All');
        $deleteStr = translate('Delete');
        $emailStr = translate('Emails Will Not Be Sent');
        $rejectSelStr = translate('Reject Selected');
        $rejectStr = translate('Reject');
        $uncheckAllStr = translate('Uncheck All');
        $viewStr = translate('View this entry');
        for ($i = 0, $cnt = count($rows); $i < $cnt; $i++) {
            $row = $rows[$i];
            $key++;
            $id = $row[0];
            $name = $row[1];
            $description = $row[2];
            $cal_user = $row[3];
            $pri = $row[4];
            $date = $row[5];
            $time = sprintf("%06d", $row[6]);
            $duration = $row[7];
            $status = $row[8];
            $type = $row[9];
            $view_link = 'view_entry';
            $entryID = 'entry' . $type . $id;
            $linkid = "pop{$id}-{$key}";
            $timestr = '';
            if ($time > 0 || $time == 0 && $duration != 1440) {
                $eventstart = date_to_epoch($date . $time);
                $eventstop = $eventstart + $duration;
                $eventdate = date_to_str(date('Ymd', $eventstart));
                $timestr = display_time('', 0, $eventstart) . ($duration > 0 ? ' - ' . display_time('', 0, $eventstop) : '');
            } else {
                // Don't shift date if All Day or Untimed.
                $eventdate = date_to_str($date);
                // If All Day display in popup.
                if ($time == 0 && $duration == 1440) {
                    $timestr = $allDayStr;
                }
            }
            $ret .= ($count == 0 ? '
      <tr>
        <td colspan="5"><h3>' . $temp_fullname . '&nbsp;' . $rssLink . '</h3></td>
      </tr>' : '') . '
      <tr ' . ($count % 2 == 0 ? '' : 'class="odd"') . '>
        <td width="5%" align="right"><input type="checkbox" name="' . $entryID . '" value="' . $user . '"/></td>
        <td><a title="' . $viewStr . '" class="entry" id="' . $linkid . '" href="' . $view_link . '.php?id=' . $id . '&amp;user='******'">' . htmlspecialchars($name) . '</a> (' . $eventdate . '):</td>' . '
        <td align="center"><input type="image" src="images/check.gif" title="' . $appConStr . '" onclick="return do_confirm( \'approve\', \'' . $cal_user . '\', \'' . $entryID . '\' );" /></td>' . '
        <td align="center"><input type="image" src="images/rejected.gif" title="' . $rejectStr . '" onclick="return do_confirm( \'reject\', \'' . $cal_user . '\', \'' . $entryID . '\' );" /></td>' . (!access_is_enabled() || access_user_calendar('edit', $user) ? '
        <td align="center"><input type="image" src="images/delete.png" title="' . $deleteStr . '" onclick="return do_confirm( \'delete\', \'' . $cal_user . '\', \'' . $entryID . '\' );\\" /></td>' : '') . '
      </tr>';
            $eventinfo .= build_entry_popup('eventinfo-' . $linkid, $cal_user, $description, $timestr, site_extras_for_popup($id));
            $count++;
        }
        if ($count > 1) {
            $ret .= '
      <tr>
        <td colspan="5" nowrap="nowrap">&nbsp;
          <img src="images/select.gif" border="0" alt="" />
          <label><a title="' . $checkAllStr . '" onclick="check_all( \'' . $user . '\' );">' . $checkAllStr . '</a> / <a title="' . $uncheckAllStr . '" onclick="uncheck_all( \'' . $user . '\' );">' . $uncheckAllStr . '</a></label>&nbsp;&nbsp;&nbsp;
          <input type="image" src="images/check.gif" title="' . $appSelStr . '" onclick="return do_confirm( \'approveSelected\', \'' . $cal_user . '\' );" />&nbsp;&nbsp;&nbsp;
          <input type="image" src="images/rejected.gif" title="' . $rejectSelStr . '" onclick="return do_confirm( \'rejectSelected\', \'' . $cal_user . '\' );" />&nbsp;&nbsp;&nbsp;( ' . $emailStr . ' )
        </td>
      </tr>';
        }
    }
    if ($count == 0) {
        $noret .= '
      <tr>
        <td colspan="5" class="nounapproved">' . str_replace('XXX', $temp_fullname, translate('No unapproved entries for XXX.')) . '&nbsp;' . $rssLink . '</td>
      </tr>';
    }
    return $ret;
}
コード例 #4
0
ファイル: week_details.php プロジェクト: rhertzog/lcs
function print_detailed_entry($event, $date)
{
    global $eventinfo, $layers, $login, $user;
    static $key = 0;
    $descStr = $event->getDescription();
    $evAccessStr = $event->getAccess();
    $evPri = $event->getPriority() < 4;
    $getExtStr = $event->getExtForID();
    $loginStr = $event->getLogin();
    $name = $event->getName();
    $class = ($login != $loginStr && strlen($loginStr) ? 'layer' : ($event->getStatus() == 'W' ? 'unapproved' : '')) . 'entry';
    if ($getExtStr != '') {
        $id = $getExtStr;
        $name .= ' (' . translate('cont.') . ')';
    } else {
        $id = $event->getID();
    }
    $linkid = 'pop' . "{$id}-{$key}";
    $key++;
    echo ($evPri ? '
            <strong>' : '') . '
            <a title="' . translate('View this entry') . '" class="' . $class . '" id="' . $linkid . '" href="view_entry.php?id=' . $id . '&amp;date=' . $date;
    if (strlen($user) > 0) {
        echo '&amp;user='******'layerentry') {
            echo '&amp;user='******'<img src="images/circle.gif" class="bullet" alt="view icon" />';
    if ($login != $loginStr && strlen($loginStr)) {
        if ($layers) {
            foreach ($layers as $layer) {
                if ($layer['cal_layeruser'] == $loginStr) {
                    $in_span = true;
                    echo '
              <span style="color:#' . $layer['cal_color'] . ';">';
                }
            }
        }
    }
    $timestr = '';
    if ($event->isAllDay()) {
        $timestr = translate('All day event');
    } else {
        if ($event->getDuration() > 0) {
            $timestr = display_time($event->getDateTime()) . ' - ' . display_time($event->getEndDateTime());
            echo $timestr . '&raquo;&nbsp;';
        }
    }
    if ($login != $user && $evAccessStr == 'R' && strlen($user)) {
        $PN = $PD = '(' . translate('Private') . ')';
    } elseif ($login != $loginStr && $evAccessStr == 'R' && strlen($loginStr)) {
        $PN = $PD = '(' . translate('Private') . ')';
    } elseif ($login != $loginStr && strlen($loginStr)) {
        $PN = htmlspecialchars($name);
        $PD = activate_urls(htmlspecialchars($descStr));
    } else {
        $PN = htmlspecialchars($name);
        $PD = activate_urls(htmlspecialchars($descStr));
    }
    if (!empty($in_span)) {
        $PN .= '</span>';
    }
    echo $PN . '</a>' . ($evPri ? '
            </strong>' : '') . ($PN != $PD ? ' - ' . $PD : '') . '<br />';
    $eventinfo .= build_entry_popup('eventinfo-' . $linkid, $loginStr, $descStr, $timestr, site_extras_for_popup($id));
}