[ Index ] |
|
Code source de WebCalendar 1.0.5 |
1 <?php 2 include_once 'includes/init.php'; 3 send_no_cache_header (); 4 5 if ( empty ( $user ) ) 6 $user = $login; 7 8 // Only admin user or assistant can specify a username other than his own. 9 if ( ! $is_admin && $user != $login && ! $is_assistant) 10 $user = $login; 11 12 $HeadX = ''; 13 if ( $auto_refresh == "Y" && ! empty ( $auto_refresh_time ) ) { 14 $refresh = $auto_refresh_time * 60; // convert to seconds 15 $HeadX = "<meta http-equiv=\"refresh\" content=\"$refresh; URL=list_unapproved.php\" />\n"; 16 } 17 $INC = array('js/popups.php'); 18 print_header($INC,$HeadX); 19 20 $key = 0; 21 22 // List all unapproved events for the user 23 // Exclude "extension" events (used when an event goes past midnight) 24 function list_unapproved ( $user ) { 25 global $temp_fullname, $key, $login; 26 //echo "Listing events for $user <br>"; 27 28 $sql = "SELECT webcal_entry.cal_id, webcal_entry.cal_name, " . 29 "webcal_entry.cal_description, " . 30 "webcal_entry.cal_priority, webcal_entry.cal_date, " . 31 "webcal_entry.cal_time, webcal_entry.cal_duration, " . 32 "webcal_entry_user.cal_status " . 33 "FROM webcal_entry, webcal_entry_user " . 34 "WHERE webcal_entry.cal_id = webcal_entry_user.cal_id " . 35 "AND ( webcal_entry.cal_ext_for_id IS NULL " . 36 "OR webcal_entry.cal_ext_for_id = 0 ) AND " . 37 "webcal_entry_user.cal_login = '$user' AND " . 38 "webcal_entry_user.cal_status = 'W' " . 39 "ORDER BY webcal_entry.cal_date"; 40 $res = dbi_query ( $sql ); 41 $count = 0; 42 $eventinfo = ""; 43 if ( $res ) { 44 while ( $row = dbi_fetch_row ( $res ) ) { 45 if ($count == 0 ) { echo "<ul>\n"; } 46 $key++; 47 $id = $row[0]; 48 $name = $row[1]; 49 $description = $row[2]; 50 $pri = $row[3]; 51 $date = $row[4]; 52 $time = $row[5]; 53 $duration = $row[6]; 54 $status = $row[7]; 55 $divname = "eventinfo-$id-$key"; 56 echo "<li><a title=\"" . 57 translate("View this entry") . "\" class=\"entry\" href=\"view_entry.php?id=$id&user=$user"; 58 echo "\" onmouseover=\"window.status='" . translate("View this entry") . 59 "'; show(event, '$divname'); return true;\" onmouseout=\"hide('$divname'); return true;\">"; 60 $timestr = ""; 61 if ( $time > 0 ) { 62 $timestr = display_time ( $time ); 63 if ( $duration > 0 ) { 64 // calc end time 65 $h = (int) ( $time / 10000 ); 66 $m = ( $time / 100 ) % 100; 67 $m += $duration; 68 $d = $duration; 69 while ( $m >= 60 ) { 70 $h++; 71 $m -= 60; 72 } 73 $end_time = sprintf ( "%02d%02d00", $h, $m ); 74 $timestr .= " - " . display_time ( $end_time ); 75 } 76 } 77 echo htmlspecialchars ( $name ); 78 echo "</a>"; 79 echo " (" . date_to_str ($date) . ")\n"; 80 //approve 81 echo ": <a title=\"" . 82 translate("Approve/Confirm") . "\" href=\"approve_entry.php?id=$id&ret=list&user=$user"; 83 if ( $user == "__public__" ) 84 echo "&public=1"; 85 echo "\" class=\"nav\" onclick=\"return confirm('" . 86 translate("Approve this entry?") . "');\">" . 87 translate("Approve/Confirm") . "</a>, "; 88 //reject 89 echo "<a title=\"" . 90 translate("Reject") . "\" href=\"reject_entry.php?id=$id&ret=list&user=$user"; 91 if ( $user == "__public__" ) 92 echo "&public=1"; 93 echo "\" class=\"nav\" onclick=\"return confirm('" . 94 translate("Reject this entry?") . "');\">" . 95 translate("Reject") . "</a>"; 96 //delete 97 echo ", <a title=\"" . 98 translate("Delete") . "\" href=\"del_entry.php?id=$id&ret=list"; 99 if ( $user != $login ) 100 echo "&user=$user"; 101 echo "\" class=\"nav\" onclick=\"return confirm('" . 102 translate("Are you sure you want to delete this entry?") . "');\">" . 103 translate("Delete") . "</a>"; 104 echo "\n</li>\n"; 105 $eventinfo .= build_event_popup ( $divname, $user, $description, 106 $timestr, site_extras_for_popup ( $id )); 107 $count++; 108 } 109 dbi_free_result ( $res ); 110 if ($count > 0 ) { echo "</ul>\n"; } 111 } 112 if ( $count == 0 ) { 113 user_load_variables ( $user, "temp_" ); 114 echo "<span class=\"nounapproved\">" . 115 translate("No unapproved events for") . " " . $temp_fullname . ".</span>\n"; 116 } else { 117 if ( ! empty ( $eventinfo ) ) echo $eventinfo; 118 } 119 } 120 ?> 121 122 <h2><?php 123 etranslate("Unapproved Events"); 124 if ( $user == '__public__' ) echo " - " . $PUBLIC_ACCESS_FULLNAME; 125 ?></h2> 126 <?php 127 // List unapproved events for this user. 128 list_unapproved ( ( $is_assistant || $is_nonuser_admin || $is_admin ) ? $user : $login ); 129 130 // Admin users can also approve Public Access events 131 if ( $is_admin && $public_access == "Y" && 132 ( empty ( $user ) || $user != '__public__' ) ) { 133 echo "\n<h3>" . translate ( "Public Access" ) . "</h3>\n"; 134 list_unapproved ( "__public__" ); 135 } 136 137 // NonUser calendar admins cal approve events on that specific NonUser 138 // calendar. 139 if ( $nonuser_enabled == 'Y' ) { 140 $admincals = get_nonuser_cals ( $login ); 141 for ( $i = 0; $i < count ( $admincals ); $i++ ) { 142 echo "\n<h3>" . $admincals[$i]['cal_fullname'] . "</h3>\n"; 143 list_unapproved ( $admincals[$i]['cal_login'] ); 144 } 145 } 146 ?> 147 148 <?php print_trailer(); ?> 149 </body> 150 </html>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Nov 30 19:09:19 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |