?> <tr<?php echo !$user['active'] ? ' class="inactive_user"' : ''; ?> > <td class="icon"><img src="<?php echo get_avatar($user['id']); ?> " width="25" height="25"></td> <td class="first_field"><div class="wrap"><?php echo in_array($user['id'], $users_online) ? '<strong>' . $user['first_name'] . ' ' . $user['last_name'] . '</strong>' : $user['first_name'] . ' ' . $user['last_name']; echo $user['id'] == $cms_user['id'] && $cms_user['editable'] == '1' || $cms_user['admin'] ? '<a class="badge edit_user" href="user_settings.php?u=' . $user['id'] . '" style="display:none;">Edit</a>' : ''; ?> </div></td> <td><div class="wrap"><?php echo in_array($user['id'], $users_online) ? 'Now' : ucwords(contextual_time(strtotime($user['last_login']))); ?> </div></td> <td><div class="wrap"><a href="<?php echo $user['last_page']; ?> "><?php echo $describe_page_on; ?> </a></div></td> <td><div class="wrap"><a href="mailto:<?php echo $user['email']; ?> "><?php echo $user['email']; ?>
function generate_media_item($id, $title, $extension, $source, $height, $width, $file_size, $uploaded, $user, $caption, $search = false, $tags = '', $modal = false) { global $cms_all_users; global $cms_user; $click_type = $modal ? 'checkable' : 'editable'; ?> <tr class="media_item" id="media_<?php echo $id; ?> "> <td class="check" raw="X"><?php if ($cms_user['media'] || $modal) { ?> <input class="status_action_check" type="checkbox" name="media_ids_checked[]" value="<?php echo $id; ?> " id="<?php echo $id; ?> "><?php } ?> </td> <td class="thumb <?php echo $click_type; ?> " raw="X"> <?php if (!$modal) { ?> <input name="media_ids[]" type="hidden" value="<?php echo $id; ?> " /> <?php } generate_media_image($extension, $source, $height, $width, $file_size); $extension = strtoupper($extension); $file_size_text = $extension == 'YOUTUBE' || $extension == 'VIMEO' ? seconds_convert($file_size) : byte_convert($file_size); ?> </td> <td class="field_title first_field <?php echo $click_type; ?> "><div class="wrap"><?php echo $title; ?> </div></td> <td class="field_type <?php echo $click_type; ?> "><div class="wrap"><?php echo $extension; ?> </div></td> <td class="field_size <?php echo $click_type; ?> "><div class="wrap"><?php echo $file_size_text; ?> </div></td> <td class="field_caption <?php echo $click_type; ?> "><div class="wrap" title="<?php echo $tags; ?> "><?php echo $caption; ?> <span class="hide"><?php echo $tags; ?> </span></div></td> <td class="field_user <?php echo $click_type; ?> "><div class="wrap"><?php echo $user == $cms_user['id'] ? '<strong>' . $cms_all_users[$user]['username'] . '</strong>' : $cms_all_users[$user]['username']; ?> </div></td> <td class="field_date <?php echo $click_type; ?> "><div class="wrap" title="<?php echo date('Y-m-d H:i:s', strtotime($uploaded)); ?> "><?php echo contextual_time(strtotime($uploaded)); ?> </div></td> </tr> <?php }
function get_activity($activity_array) { foreach ($activity_array as $activity) { ?> <tr<?php echo $activity['type'] == 'error' ? ' class="error"' : ''; ?> > <td class="activity_action"> <?php // no need for if's, give activity a default class and set based on type if ($activity['table'] == 'directus_media') { echo '<span class="activity media">' . ucwords($activity['type']) . '</span>'; } elseif ($activity['type'] == 'edited') { echo '<span class="activity edited">Edited</span>'; } elseif ($activity['type'] == 'added') { echo '<span class="activity added">Added</span>'; } elseif ($activity['type'] == 'activated') { echo '<span class="activity activated">Activated</span>'; } elseif ($activity['type'] == 'deactivated') { echo '<span class="activity deactivated">Deactivated</span>'; } elseif ($activity['type'] == 'deleted') { echo '<span class="activity deleted">Deleted</span>'; } elseif ($activity['type'] == 'backed up') { echo '<span class="activity backedup">Back Up</span>'; } elseif ($activity['type'] == 'reverted') { echo '<span class="activity reverted">Reverted</span>'; } elseif ($activity['type'] == 'uploaded') { echo '<span class="activity uploaded">Uploaded</span>'; } elseif ($activity['type'] == 'swapped') { echo '<span class="activity swapped">Swapped</span>'; } elseif ($activity['type'] == 'installed') { echo '<span class="activity backedup">Installed</span>'; } elseif ($activity['type'] == 'error') { echo '<span class="activity error">Error</span>'; } else { echo '<span class="activity default">' . ucwords($activity['type']) . '</span>'; } ?> </td> <td class="activity_description"> <div class="wrap"> <?php echo get_item_description($activity); ?> </div> </td> <td class="activity_user text_right"> by <?php echo get_username($activity['user']); ?> </td> <td class="activity_date" title="<?php echo date('M jS Y, g:i:s a', strtotime($activity['datetime'])); ?> "> <?php echo contextual_time(strtotime($activity['datetime'])); ?> </td> </tr> <?php } }
function show_browse_rows() { global $dbh; global $table_rows; global $allow; global $settings; $item_count = 0; foreach ($table_rows['rows'] as $key => $row) { // Cutoff for active items if ($item_count++ >= MAX_TABLE_ITEMS) { break; } // if there is an active field, set the classes if (!$table_rows['active']) { $status = 'status_active'; } else { if ($row['active'] == 0) { $status = 'status_deleted'; } else { if ($row['active'] == 1) { $status = 'status_active'; } else { $status = 'status_inactive'; } } } ?> <tr id="item_<?php echo $row['id']; ?> " class="item <?php echo $status; ?> "> <?php // Only show the handles if this table has an sort field if ($table_rows['sort'] && $allow['reorder']) { ?> <td class="order handle" title="#<?php echo $row['sort']; ?> "><span class="order_field"><img src="media/site/icons/ui-splitter-horizontal.png" width="16" height="16" /></span></td><?php } // Only show the checkboxes if this table has an active field if ($table_rows['active'] && $allow['delete']) { ?> <td class="check"><input class="status_action_check" id="<?php echo $row['id']; ?> " type="checkbox" name="" value=""></td><?php } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Loop through all field in this item foreach ($table_rows['fields'] as $key => $field) { $type = $table_rows['info'][$field]['type_lengthless']; $value = $row[$field]; $field_format = $settings["field_format"][$table_rows['name'] . "," . $field]; $browse_media = $field_format == 'media' && intval($settings['field_option'][$table_rows['name'] . "," . $field]['media']["browse_media"]) > 0 ? true : false; // Check if field is hidden by admin if ($settings['field_hidden'][$table_rows['name'] . ',' . $field] != 'true') { // Need no spaces here for proper DOM sorting ?> <td class="<?php echo $allow['edit'] ? 'editable' : ''; ?> field_<?php echo $field; ?> <?php echo $key == 0 ? 'first_field' : ''; ?> <?php echo $browse_media ? 'thumb' : ''; ?> " <?php echo !$table_rows['header_fields'] && $key < 8 || $settings['field_primary'][$table_rows['name']] == $field || strpos($table_rows['header_fields'], ',' . $field . ',') !== false ? '' : 'style="display:none;"'; ?> ><div <?php echo $browse_media || $field_format == 'rating' ? '' : 'class="wrap"'; ?> ><?php // If there is an active field, enable status badges if ($table_rows['active']) { if ($row['active'] == 2 && $key == 0) { ?> <span class="status">Inactive</span><?php } elseif ($row['active'] == 0 && $key == 0) { ?> <span class="status deleted">Deleted</span><?php } } ////////////////////////////////////////////////////////////////////////////// // Check if field is relational $is_relational = $settings['field_format'][$table_rows['name'] . "," . $field] == 'relational' ? true : false; $row_relational = $settings['field_option'][$table_rows['name'] . ',' . $field]['relational']; $field_settings = $settings['field_option'][$table_rows['name'] . ',' . $field]; //print_r($field_settings); if ($is_relational) { // Get options $echo_relational = array(); $option_fields = explode(",", $row_relational["option"]); $sth = $dbh->query($row_relational["sql"]); while ($row_options = $sth->fetch()) { // Get the saved field $option_value = $row_options[$row_relational["value"]]; // Loop through visible fields (field1,field2) unset($option_array); foreach ($option_fields as $temp) { $option_array[] = $row_options[$temp]; } // Check if this value is selected if ($row_relational["multiple"] || $row_relational['style'] == 'fancy') { $found = strpos($value, "," . $option_value . ",") !== false ? true : false; } else { $found = $value == $option_value || $value == ',' . $option_value . ',' ? true : false; } // If found then add this item to printed array if ($found !== false) { $echo_relational[] = implode($row_relational["option_glue"], $option_array); } } echo implode(', ', $echo_relational); } elseif ($field_format == 'media') { unset($array_media); $array_media = explode(',', $value); $array_media = array_filter($array_media); if (count($array_media) > 0 && $browse_media) { $sth = $dbh->prepare("SELECT * FROM `directus_media` WHERE `active` = '1' AND `id` = :id "); $media_allowed_visible = 0; foreach ($array_media as $media) { if ($media_allowed_visible++ < $field_settings['media']["browse_media"]) { $sth->bindParam(':id', $media); $sth->execute(); if ($browse_media = $sth->fetch()) { generate_media_image($browse_media['extension'], $browse_media['source'], $browse_media['height'], $browse_media['width'], $browse_media['file_size']); } } } } else { echo count($array_media) . ' Files'; } } elseif ($type == 'date') { echo $value == "0000-00-00" ? "No date" : date('M j, Y', strtotime($value)); } elseif ($type == 'time') { ?> <span title="and <?php echo ltrim(date('s', strtotime($value)), '0'); ?> seconds"><?php echo date('g:i A', strtotime($value)); ?> </span><?php } elseif ($type == 'datetime') { ?> <span title="<?php echo contextual_time(strtotime($value)); ?> "><?php echo date('M j, Y - g:i A', strtotime($value)); ?> </span><?php } elseif ($field_format == 'tags') { echo str_replace(',', ', ', substr($value, 1, -1)); } elseif ($field_format == 'password') { echo str_repeat("*", strlen($value)); } elseif ($field_format == 'checkbox') { ?> <input type="checkbox" name="" value="1" disabled="disabled" <?php echo $value == '1' ? 'checked="checked"' : ''; ?> ><?php } elseif ($field_format == 'histogram') { //$histogram_table = get_rows_info($data['name']); //$histogram_sql = ($histogram_table['active'] == true)? "AND `active` = '1' " : ""; //$sth = $dbh->query("SELECT max($key) as peak_amount FROM `".$data['name']."` WHERE id != '".$data['item_id']."' $histogram_sql"); //$peak_amount = ($peak = $sth->fetch())? ($peak["peak_amount"]) : 0; ?> <span class="histogram_bar" peak_amount="calculate"><span field="<?php echo $field; ?> " title="<?php echo $value; ?> " this_amount="<?php echo $value; ?> "></span></span> <span class="histogram_percent">0%</span><?php } elseif ($field_format == 'rating') { $max = $settings['field_option'][$table_rows['name'] . "," . $field]['rating']["max"]; ?> <div class="rating_system" style="width:<?php echo 16 * $max; ?> px;"> <div class="rating_bar" style="width:<?php echo 16 * $value; ?> px;"> </div><?php for ($i = 1; $i <= $max; $i++) { ?> <span class="star" alt="<?php echo $i; ?> " count="<?php echo $i; ?> "></span><?php } ?> </div><?php } else { echo strip_tags($value); } ?> </div></td><?php // Need no spaces here for proper DOM sorting } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ?> </tr> <?php } ////////////////////////////////////////////////////////////////////////////// // Get number of visible fields $num_fields_shown = 0; foreach ($table_rows['fields'] as $key => $field) { if ($settings['field_hidden'][$table_rows['name'] . ',' . $field] != 'true') { $num_fields_shown++; } } ?> <tr class="item no_rows"><td colspan="<?php echo $num_fields_shown + 3; ?> ">No items</td></tr><?php if (count($table_rows['rows']) > MAX_TABLE_ITEMS) { ?> <tr class="item"><td colspan="<?php echo $num_fields_shown + 3; ?> "><b>The table "<?php echo $table_rows['name_uc']; ?> " has reached the maximum allowed number of items (<?php echo MAX_TABLE_ITEMS; ?> )</b><br>Please have your admin remove some items from your trash or raise this limit</td></tr><?php } }
echo $view ? '' : 'hide'; ?> "> <td width="180"> <div> <img class="user_avatar" src="<?php echo get_avatar($message['last_from']); ?> " width="50" height="50"> <div> <span class="user"><?php echo $_GET["m"] == "sent" ? 'To: ' . implode(', ', get_usernames($message['to'])) : get_username($message['last_from']); ?> </span> <span class="date"><?php echo contextual_time(strtotime($message['last_datetime'])); ?> <?php echo $_GET["m"] != "sent" ? $to : ''; ?> </span> </div> </div> </td> <td> <div class="pad_right"> <span class="subject"><a href="?id=<?php echo $message['id']; ?> "><?php echo $subject;
<td class="media_modal_thumb"> <a href="<?php echo $link; ?> " target="_blank"> <?php echo generate_media_image($extension, $media_detail["source"], $media_detail["height"], $media_detail["width"], $media_detail["file_size"], 100); ?> </a> </td> <?php } ?> <td> <?php echo 'Uploaded by ' . $cms_all_users[$media_detail['user']]['username'] . ' ' . contextual_time(strtotime($media_detail['uploaded'])) . '<br>'; echo $dimensions . $extension . ' - ' . $length_size . '<br>'; echo $link_text ? $link_text . '<br>' : ''; // If user is allowed to manage media then enable swapping and deleting if ($cms_user['media']) { ?> <a id="media_modal_swap" href="#">Swap</a> or <a id="media_modal_delete" class="delete" media_id="<?php echo $media_detail["id"]; ?> " href="#">Delete</a><?php } ?> </td> </tr> </table> </div>