Ejemplo n.º 1
0
function display_widget($info)
{
    $widget = array(2 => "display_cam", 4 => "display_lampe", 5 => "display_commande", 7 => "display_warming", 9 => "display_warming", 10 => "display_shutter", 11 => "display_shutter", 15 => "display_audio", 16 => 'display_videoplayer', 17 => "display_audio", 18 => "display_garden", 20 => "display_furnace", 22 => "display_garden", 23 => "display_garden", 24 => "display_warming", 25 => "display_fan", 28 => "display_spa", 30 => "display_alarm", 31 => "display_portal", 33 => "display_furnace", 35 => 'display_webpage_internal', 37 => 'display_webpage_external', 38 => "display_commande", 43 => "display_commande", 47 => "display_consumption", 49 => "display_warming", 50 => "display_audio", 51 => "display_commande", 52 => "display_portal", 54 => "display_portal", 60 => "display_commande", 61 => "display_commande", 68 => "display_clim", 85 => "display_lampe", 86 => 'display_generic');
    $widgeticon = 'fa fa-question';
    if (!empty(getIcon($info->device_id))) {
        $widgeticon = getIcon($info->device_id);
    }
    $dir = '/templates/default/custom/device/';
    $display = '<div class="display-widget col-xs-12 col-sm-6 col-lg-4 room-' . $info->room_id . ' app-' . $info->application_id . '">
					<div class="box">
						<div class="icon">
							<div id="image-widget-' . $info->room_device_id . '" class="image">
								<i id="icon-image-widget-' . $info->room_device_id . '" class="' . $widgeticon . '"></i>
							</div>
							<div class="info col-sm-12 col-xs-12 widget-content">';
    //display device
    if (!empty($widget[$info->device_id])) {
        $display .= $widget[$info->device_id]($info);
    }
    $display .= '
							</div>';
    if (!empty($info->device_bgimg)) {
        $display .= '
								<div class="info-bg"
								     style="background-image: url(\'' . $dir . $info->device_bgimg . '\')">
								</div>';
    }
    $display .= '
						</div>
					</div>
				</div>';
    return $display;
}
Ejemplo n.º 2
0
function parserArray($array_xml)
{
    $_level_key_name = $_SESSION['_level_key_name'];
    $image_url = "../../pixmaps/theme/";
    foreach ($array_xml as $key => $value) {
        $size = count($array_xml);
        if (is_array($value) && !isset($value['@attributes']) && $key !== '@attributes') {
            $json .= parserArray($value, '');
            continue;
        } elseif (is_array($value) && isset($value['@attributes'])) {
            $icon = $image_url . getIcon($key, $value);
            $title = getTitle($key, $value);
            $json .= "{title: '{$title}', addClass: 'size10', key:'" . $value['@attributes'][$_level_key_name] . "', isFolder:'true', icon:'{$icon}'";
            $aux = parserArray($value);
            $json .= !empty($aux) ? ", children:  [" . $aux . "]" : '';
            $json .= "},\n";
        } elseif (is_array($value) && $key === '@attributes') {
            $keys = array_keys($value);
            if (!(count($keys) == 1 && $keys[0] == $_level_key_name)) {
                $json .= "{title: '<span>" . _("Attributes") . "</span>', addClass: 'size10', key:'attr_" . $value[$_level_key_name] . "', icon:'" . $image_url . "gear-small.png', children: [";
                foreach ($value as $k => $v) {
                    if ($k !== $_level_key_name) {
                        $json .= "{title: '<span>" . clean_string($k) . "</span>=" . clean_string($v) . "', addClass: 'size10', key:'" . $value[$_level_key_name] . "', icon:'" . $image_url . "ticket-small.png'},\n";
                    }
                }
                $json = preg_replace('/,$/', '', $json);
                $json .= "]";
                $json .= "},\n";
            }
        }
    }
    return $json;
}
Ejemplo n.º 3
0
						</td>
					</tr>
					<?php 
    } else {
        $reason = isset($data->motif) ? $data->motif : "Aucun motif fourni.";
        $reason = preg_replace("#(^|[\n ])([\\w]+?://[\\w\\#\$%&~/.\\-;:=,?@\\[\\]+]*)#is", "\\1<a href=\"\\2\" target=\"_blank\" rel=\"nofollow\">\\2</a>", $reason);
        $reason = preg_replace("#(^|[\n ])((www|ftp)\\.[\\w\\#\$%&~/.\\-;:=,?@\\[\\]+]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\" rel=\"nofollow\">\\2</a>", $reason);
        ?>
					<tr>
						<td <?php 
        if (!isset($data->duration)) {
            echo 'colspan="2" style="text-align: center;"';
        }
        ?>
><?php 
        echo getIcon($data->type);
        ?>
 <?php 
        echo $data->type;
        ?>
</td>
						<?php 
        if (isset($data->duration)) {
            ?>
<td><?php 
            echo $data->duration;
            ?>
</td><?php 
        }
        ?>
						<td><?php 
Ejemplo n.º 4
0
                    ?>
?getimage=blank" alt="" width="7" height="16" style="vertical-align:middle;"/>
					<?php 
                } else {
                    ?>
						<a href="<?php 
                    echo $PHP_SELF;
                    ?>
?path=<?php 
                    echo rawurlencode($path);
                    ?>
&amp;download=<?php 
                    echo rawurlencode($files[$i]["name"]);
                    ?>
"><img src="<?php 
                    echo getIcon("download");
                    ?>
" alt="<?php 
                    echo translate("download");
                    ?>
" title="<?php 
                    echo translate("download");
                    ?>
" width="7" height="16" style="vertical-align:middle;"/></a>
					<?php 
                }
                echo "</td>";
                break;
            case "icon":
                echo "<td class=\"littlepadding\">";
                ?>
Ejemplo n.º 5
0
/**
* Recursively iterates a mailboxes object to build a data structure that is
* easy for template authors to work with.
FIXME: well.... why not document that data structure here?
* 
* @param object $boxes Object of the class mailboxes
* @author Steve Brown
* @since 1.5.2
*/
function getBoxStructure($boxes)
{
    global $data_dir, $username, $icon_theme_path;
    // Stop condition
    if (empty($boxes)) {
        return array();
    }
    $mailbox = $boxes->mailboxname_full;
    $mailboxURL = urlencode($mailbox);
    $box = array();
    $box['MailboxFullName'] = $mailbox;
    $box['MailboxName'] = $boxes->mailboxname_sub;
    $box['MessageCount'] = !empty($boxes->total) ? $boxes->total : 0;
    $box['UnreadCount'] = !empty($boxes->unseen) ? $boxes->unseen : 0;
    // Needed in case user enables cummulative message counts
    $box['CummulativeMessageCount'] = getMessageCount($boxes, 'total');
    $box['CummulativeUnreadCount'] = getMessageCount($boxes, 'unseen');
    $box['ViewLink'] = array('Target' => 'right', 'URL' => 'right_main.php?PG_SHOWALL=0&amp;startMessage=1&amp;mailbox=' . $mailboxURL);
    $box['IsRecent'] = isset($boxes->recent) && $boxes->recent;
    $box['IsSpecial'] = isset($boxes->is_special) && $boxes->is_special;
    $box['IsRoot'] = isset($boxes->is_root) && $boxes->is_root;
    $box['IsNoSelect'] = isset($boxes->is_noselect) && $boxes->is_noselect;
    $box['IsInbox'] = isset($boxes->is_inbox) && $boxes->is_inbox;
    $box['IsSent'] = isset($boxes->is_sent) && $boxes->is_sent;
    $box['IsTrash'] = isset($boxes->is_trash) && $boxes->is_trash;
    $box['IsDraft'] = isset($boxes->is_draft) && $boxes->is_draft;
    $box['IsNoInferiors'] = isset($boxes->is_noinferiors) && $boxes->is_noinferiors;
    $collapse = getPref($data_dir, $username, 'collapse_folder_' . $mailbox);
    $collapse = $collapse == '' ? SM_BOX_UNCOLLAPSED : $collapse;
    $collapse = (int) $collapse == SM_BOX_COLLAPSED;
    $box['IsCollapsed'] = $collapse;
    /*
     * Check for an image needed here.  If the file exists in $icon_theme_path
     * assume the template provides all icons.  If not, we will use the 
     * SQM default images.  If icons have been disabled, $icon_theme_path
     * will be NULL.
     */
    $text_icon = $box['IsCollapsed'] ? '+' : '-';
    $icon_file = $box['IsCollapsed'] ? 'plus.png' : 'minus.png';
    $icon_alt = $box['IsCollapsed'] ? 'Expand Box' : 'Collapse Box';
    $icon = getIcon($icon_theme_path, $icon_file, $text_icon, $icon_alt);
    $box['CollapseLink'] = array('Target' => 'left', 'URL' => 'left_main.php?' . ($box['IsCollapsed'] ? 'unfold' : 'fold') . '=' . $mailboxURL, 'Icon' => $icon . '&nbsp;');
    $box['ChildBoxes'] = array();
    for ($i = 0; $i < count($boxes->mbxs); $i++) {
        $box['ChildBoxes'][] = getBoxStructure($boxes->mbxs[$i]);
    }
    // if plugins want to add some text or link after the folder name in
    // the folder list, they should add to the "ExtraOutput" array element
    // in $box (remember, it's passed through the hook by reference) -- making
    // sure to play nice with other plugins by *concatenating* to "ExtraOutput"
    // and NOT by overwriting it
    //
    // known users of this hook:
    // empty_folders
    //
    do_hook('left_main_after_each_folder', $box);
    return $box;
}
Ejemplo n.º 6
0
<?
for ($i = $args['start']; $i < $args['end']; $i++)
{
	$object = $args['objects'][$i];
	?>
	<div class="sub_title">
		<a class="right" href="javascript:void(null)" onclick="toggleSidebarContainer('<?php 
echo $object->getNodeId();
?>
')"><?php 
echo img(imgpath("1downarrow.png"), "", "", $object->getNodeId() . "_arrow");
?>
</a>
		<?php 
echo cmd(img(getIcon($object->getIcon())) . "&nbsp;" . $object->getName(), "exec=show&node_id=" . $object->getNodeId());
?>
		<div class="clear"></div>
	</div>
	<div id="<?php 
echo $object->getNodeId();
?>
_container">
		<?php 
echo compiletpl("scripts/show/data", array(), $object);
?>
		<?php 
echo compiletpl("scripts/show/children", array(), $object);
?>
	</div>
<?
}
Ejemplo n.º 7
0
        echo $AppUI->_('Size');
        ?>
</th>
		<th nowrap="nowrap"><?php 
        echo $AppUI->_('Type');
        ?>
</th>
		<th nowrap="nowrap"><?php 
        echo $AppUI->_('Date');
        ?>
</th>
	</tr>
<?php 
        foreach ($file_versions as $file) {
            if ($file['file_version_id'] == $latest_file['file_version_id']) {
                $file_icon = getIcon($file['file_type']);
                $hdate = new Date($file['file_date']);
                ?>
	<tr>
		<td nowrap="nowrap" width="20">&nbsp;<?php 
                if ($canEdit && $dPconfig['files_show_versions_edit']) {
                    ?>
			<a href="./index.php?m=files&amp;a=addedit&amp;file_id=<?php 
                    echo $file['file_id'];
                    ?>
">
			<?php 
                    echo dPshowImage(DP_BASE_URL . '/modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
                    ?>
			</a><?php 
                }
Ejemplo n.º 8
0
<?php

/**
 * Copyright (C) 2011 Ulteo SAS
 * http://www.ulteo.com
 * Author Julien LANGLOIS <*****@*****.**>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; version 2
 * of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 **/
require_once 'config.inc.php';
require_once 'functions.inc.php';
if (!array_key_exists('id', $_REQUEST)) {
    die;
}
$icon = getIcon($_REQUEST['id']);
header('Content-Type: ' . $icon['content_type']);
die($icon['data']);
Ejemplo n.º 9
0
    }
    //BACK BUTTON
    if (strpos($c, '..') !== false) {
        $n_link = explode("/", $redir);
        array_pop($n_link);
        array_pop($n_link);
        $n_link = implode($n_link, "/");
        $n_link = rtrim($n_link, '/') . '/';
        if (!empty($n_link)) {
            $create_link = $now . "?redir=" . $n_link;
        } else {
            $create_link = $now;
        }
        $create_link = str_replace(" ", "%20", $create_link);
        $goto = "goto('{$create_link}')";
        echo "<div data-mylink = {$create_link} ondblclick= {$goto} class='file'><div class='icon' style='background-image:url(design/images/back_ico.png);'></div><span class='file_data'> {$c} </span></div></br>";
        continue;
    }
    //FILES
    $current_link = str_replace(" ", "%20", $current_link);
    $goto = "goto('{$current_link}')";
    $add = getIcon($current_link);
    echo "<div data-mylink = {$current_link} ondblclick= {$goto} class='file'><div class='icon' {$add}></div><span class='file_data'> {$c} </span></div></br>";
}
echo "</br><div class='btn_download' onclick='downloadSelected()'>Download</div>";
echo "</div>";
echo "<iframe id='my_iframe' style='display:none;'></iframe>";
?>
</body>
</html>
/**
 * Define the shortcode: [res_map] and its attributes
 */
function responsive_map_shortcode($atts)
{
    // Extract the attributes user gave in the shortcode
    $atts = shortcode_atts(array('width' => '', 'height' => '500px', 'maptype' => 'roadmap', 'zoom' => 14, 'address' => 'usa', 'description' => '', 'popup' => 'false', 'pancontrol' => 'false', 'zoomcontrol' => 'false', 'draggable' => 'true', 'scrollwheel' => 'false', 'typecontrol' => 'false', 'scalecontrol' => 'false', 'streetcontrol' => 'false', 'directionstext' => '', 'center' => '', 'icon' => 'green', 'color' => '', 'refresh' => 'false'), $atts);
    // Enque the neccessary jquery files
    wp_enqueue_script("jquery");
    wp_enqueue_script('geogooglemap');
    wp_enqueue_script('jquerygmap');
    // Generate an unique identifier for the map
    $mapid = rand();
    // Extract the map type
    $atts['maptype'] = strtoupper($atts['maptype']);
    // If width or height were specified in the shortcode, extract them too
    $dimensions = 'height:' . $atts['height'];
    if ($atts['width']) {
        $dimensions .= ';width:' . $atts['width'];
    }
    // If color is not set, show the default map style. If color is set to 'bw' show black&white map. Otherwise, if color given, set the map color to the given color.
    if (isset($atts['color']) && $atts['color'] == 'bw') {
        $style = '[ { "stylers": [ { "featureType": "all" }, { "saturation": -100 }, { "gamma": 0.50 }, {"lightness": 30 } ] } ]';
    } else {
        if (isset($atts['color']) && $atts['color'] == 'classic') {
            $style = '[]';
        } else {
            $style = '[ { "stylers": [ { "hue": "' . $atts['color'] . '" } ] } ]';
        }
    }
    // Clean the html code in the directionstext or set the default value if directionstext was not specified in the shortcode
    if (isset($atts['directionstext']) && strlen(trim($atts['directionstext'])) != 0) {
        $atts['directionstext'] = $atts['directionstext'];
    }
    // Extract the langitude and longitude for the map center
    if (trim($atts['center']) != "") {
        sscanf($atts['center'], '%f, %f', $lat, $long);
    } else {
        $lat = 'null';
        $long = 'null';
    }
    // Split the addresses and descriptions (by | delimiter) and build markers JSON list
    if ($atts['address'] != '') {
        $addresses = explode("|", $atts['address']);
        $descriptions = explode("|", $atts['description']);
        $icons = explode("|", $atts['icon']);
        // Build a marker for each address
        $markers = '[';
        for ($i = 0; $i < count($addresses); $i++) {
            $address = cleanHtml($addresses[$i]);
            // If multiple markers, hide popup, else show popup according to parameter from shortcode
            if (count($addresses) > 1) {
                $atts['popup'] = "no";
            }
            // if it's empty, set the default description equal to the the address
            if (isset($descriptions[$i]) && strlen(trim($descriptions[$i])) != 0) {
                $html = $descriptions[$i];
            } else {
                $html = $address;
            }
            // Add the directions link to the description
            $directions = 'http://maps.google.com/?daddr=' . urlencode($address);
            $html .= '<strong><br><a target=\'_blank\' href="' . $directions . '">' . $atts['directionstext'] . '</a></strong>';
            // Prepare the description html
            $html = cleanHtml($html);
            // Get the correct icon image based on icon color/url given in the shortcode
            $icon = getIcon($icons[$i]);
            // Extract the langitude and longitude for the map center
            $marker_latitude = null;
            $marker_longitude = null;
            if (trim($address) != "") {
                sscanf($address, '%f, %f', $marker_latitude, $marker_longitude);
            }
            // If more markers, add the neccessary "," delimiter between markers
            if ($i > 0) {
                $markers .= ",";
            }
            // Build markers list based on given address or latitude/longitude
            if ($marker_latitude == '' || $marker_longitude == '') {
                $markers .= '{
                    address: \'' . $address . '\', 
                    html:\'' . $html . '\',
                    popup: ' . toBool($atts['popup']) . ',
                    flat: true,
                    icon: {
                        image: \'' . $icon . '\',
                        iconsize: [50, 50],
                        iconanchor: null,
                        shadow: \'' . plugins_url('/includes/icons/shadow.png', __FILE__) . '\',
                        shadowsize: [50, 50],
                        shadowanchor: null}}';
            } else {
                $markers .= '{
                    latitude:' . $marker_latitude . ', 
                    longitude:' . $marker_longitude . ', 
                    html:"' . $html . '",
                    popup: ' . toBool($atts['popup']) . ',
                    flat: true,
                    icon: {
                        image: \'' . $icon . '\',
                        iconsize: [50, 50],
                        iconanchor: [0, 0],
                        infowindowanchor:[0,0],
                        shadow: \'' . plugins_url('/includes/icons/shadow.png', __FILE__) . '\',
                        shadowsize: [50, 50],
                        shadowanchor: null}}';
            }
        }
        $markers .= ']';
    }
    // Tell PHP to start output buffering
    ob_start();
    ?>
    <script type="text/javascript">
    jQuery(document).ready(function($) {
    var mapdiv = jQuery("#responsive_map_<?php 
    echo $mapid;
    ?>
");
    mapdiv.gMapResp({
      maptype: google.maps.MapTypeId.<?php 
    echo $atts['maptype'];
    ?>
,
      zoom: <?php 
    echo $atts['zoom'];
    ?>
,
      markers: <?php 
    echo $markers;
    ?>
,
      panControl: <?php 
    echo toBool($atts['pancontrol']);
    ?>
,
      zoomControl: <?php 
    echo toBool($atts['zoomcontrol']);
    ?>
,
      draggable: <?php 
    echo toBool($atts['draggable']);
    ?>
,
      scrollwheel: <?php 
    echo toBool($atts['scrollwheel']);
    ?>
,
      mapTypeControl: <?php 
    echo toBool($atts['typecontrol']);
    ?>
,
      scaleControl: <?php 
    echo toBool($atts['scalecontrol']);
    ?>
,
      streetViewControl: <?php 
    echo toBool($atts['streetcontrol']);
    ?>
,
      overviewMapControl: true,
      styles: <?php 
    echo $style;
    ?>
,
      latitude: <?php 
    echo $lat;
    ?>
,
      longitude: <?php 
    echo $long;
    ?>
     });
  });
  <?php 
    if (isset($atts['refresh']) && $atts['refresh'] == 'yes') {
        ?>
  window.onresize = function() {
        jQuery('.responsive-map').each(function(i, obj) {
            var gmap = jQuery(this).data('gmap').gmap;
            google.maps.event.trigger(gmap, 'resize');
            jQuery(this).gMapResp('fixAfterResize');
        });
  };
  <?php 
    }
    ?>
  </script>
  <div id="responsive_map_<?php 
    echo $mapid;
    ?>
" class="responsive-map" style="<?php 
    echo $dimensions;
    ?>
;"></div>
  <?php 
    return ob_get_clean();
}
				</div>
				<ul id="roomList-' . $floor->floor_id . '" hidden="hidden" class="nav">';
    foreach ($floor->room as $room) {
        echo '
							<div id="room-' . $room->room_id . '" class="">
								<div href="#" onclick="ShowDeviceList(' . $room->room_id . ')" class="box-scenar-rooms cursor">
									' . $room->room_name . '
								</div>
								<ul id="deviceList-' . $room->room_id . '" hidden class="nav">';
        foreach ($room->devices as $device) {
            echo '
										<li class="list-item">
											<div href="#" id="device-' . $device->room_device_id . '"
												 class="box-scenar-devices cursor"
												 onclick="selectDevice(' . $id_trigger . ',' . $device->room_device_id . ')">
												<i class="margin-right ' . getIcon($device->device_id) . '"></i>
												' . $device->name . '
											</div>
											<ul id="optionList-' . $device->room_device_id . '" hidden="hidden" class="nav"></ul>
										</li>';
        }
        echo '
								</ul>
							</div>';
    }
    echo '
				</ul>
			</div>';
}
echo '</div>
	</div>';
Ejemplo n.º 12
0
/**
 * Function to retrieve correct attchment icon based on user prefs
 * 
 * @param boolean $attach TRUE if the message has an attachment
 * @param string $icon_theme_path path to user's currently selected icon theme.
 * @return string $icon full HTML img tag or text icon, depending on of user prefs
 * @author Steve Brown
 */
function getAttachmentIcon($attach, $icon_theme_path)
{
    $icon = '';
    $icon_file = $attach ? 'attach.png' : 'transparent.png';
    $alt_text = $attach ? _("Attachment") : _("No attachment");
    $text = $attach ? '+' : '';
    $icon = getIcon($icon_theme_path, $icon_file, $text, $alt_text);
    return $icon;
}
Ejemplo n.º 13
0
function addHintIcon()
{
    $question_icon = getIcon('question', 'icon_inform');
    return '<span class="mini_btn">' . $question_icon . '</span>';
}
Ejemplo n.º 14
0
    $request->add_request('getTriggerElems', array($_GET['id_trigger']));
    $result = $request->send_request();
    $trigger_info = $result->getTriggerElems;
    echo '
		<div id="listTriggerElems" class="listTrigger">
			<div id="triggerElemDrop-0" class="col-xs-12 triggerElemDrop">
			</div>';
    if (!empty($trigger_info)) {
        $count = 0;
        foreach ($trigger_info as $elem) {
            echo '
					<div class="col-xs-5 triggerElem">
						<div id="triggerElem-' . $elem->condition_id . '" class="">';
            echo '
							<div class="center trigger-device-name">
								<i class="' . getIcon($elem->device_id) . '"></i>
								' . $elem->device_name . '
							</div>
							<div id="triggerElemOption-' . $elem->condition_id . '" class="center">';
            echo display_option($elem->condition_id, $elem->option_id, $elem->option_value, $elem->room_device_id, $elem->operator);
            echo '
							</div>
						</div>';
            echo displayBtns($elem->trigger_id, $elem->condition_id, $elem->room_device_id, $elem->option_id);
            echo '</div>';
            if ($count % 2 == 1 || $elem === end($trigger_info)) {
                echo '<div id="triggerElemDrop-' . $elem->condition_id . '" class="col-xs-12 triggerElemDrop">
							</div>';
            } else {
                echo '<div id="triggerElemDrop-' . $elem->condition_id . '" class="col-xs-2 triggerElemDrop">
							</div>';
Ejemplo n.º 15
0
function detail()
{
    global $s, $inp, $par, $tab, $arrTitle, $fFile, $dFile, $arrParameter, $menuAccess;
    $sql = "select * from dta_supplier where kodeSupplier='{$par['kodeSupplier']}'";
    $res = db($sql);
    $r = mysql_fetch_array($res);
    if (empty($r[kodeTipe])) {
        $r[kodeTipe] = $par[kodeTipe];
    }
    if ($r[statusSupplier] == "p") {
        $statusSupplier = "Prospect";
    } else {
        if ($r[statusSupplier] == "t") {
            $statusSupplier = "Active";
        } else {
            $statusSupplier = "Not Active";
        }
    }
    $dAddress = " style=\"display: none;\"";
    $dProduct = " style=\"display: none;\"";
    $dIdentity = " style=\"display: none;\"";
    $dContact = " style=\"display: none;\"";
    $dBanking = " style=\"display: none;\"";
    $dGeneral = " style=\"display: none;\"";
    if ($tab == 1) {
        $tAddress = "class=\"current\"";
        $dAddress = " style=\"display: block;\"";
    } else {
        if ($tab == 2) {
            $tProduct = "class=\"current\"";
            $dProduct = " style=\"display: block;\"";
        } else {
            if ($tab == 3) {
                $tIdentity = "class=\"current\"";
                $dIdentity = " style=\"display: block;\"";
            } else {
                if ($tab == 4) {
                    $tContact = "class=\"current\"";
                    $dContact = " style=\"display: block;\"";
                } else {
                    if ($tab == 5) {
                        $tBanking = "class=\"current\"";
                        $dBanking = " style=\"display: block;\"";
                    } else {
                        $tGeneral = "class=\"current\"";
                        $dGeneral = " style=\"display: block;\"";
                    }
                }
            }
        }
    }
    $text .= "<div class=\"pageheader\">\n\t<h1 class=\"pagetitle\">" . $arrTitle[$s] . "</h1>\n\t" . getBread(ucwords("detail data")) . "\n\t<ul class=\"hornav\">\n\t\t<li {$tGeneral}><a href=\"#general\">General</a></li>\n\t\t<li {$tAddress}><a href=\"#address\">Address</a></li>\n\t\t<li {$tProduct}><a href=\"#product\">Product</a></li>\n\t\t<li {$tIdentity}><a href=\"#identity\">Identity</a></li>\n\t\t<li {$tContact}><a href=\"#contact\">Contact</a></li>\n\t\t<li {$tBanking}><a href=\"#banking\">Banking</a></li>\n\t</div>\n\t<div id=\"contentwrapper\" class=\"contentwrapper\">\n\t\t<form id=\"form\" name=\"form\" method=\"post\" class=\"stdform\" action=\"?_submit=1" . getPar($par) . "\" onsubmit=\"return validation(document.form);\" enctype=\"multipart/form-data\">\n\t\t\t<div style=\"top:70px; right:35px; position:absolute\">\n\t\t\t\t<input type=\"button\" class=\"cancel radius2\" style=\"float:right;\" value=\"Back\" onclick=\"window.location='?" . getPar($par, "mode, kodeSupplier") . "';\"/>\n\t\t\t</div>";
    # TAB GENERAL
    $text .= "<div id=\"general\" class=\"subcontent\" {$dGeneral} >\t\t\t\t\t\n\t\t\t<p>\n\t\t\t\t<label class=\"l-input-small\">No Akun</label>\n\t\t\t\t<span class=\"field\">{$r['nomorSupplier']}&nbsp;</span>\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t<label class=\"l-input-small\">Nama Supplier</label>\n\t\t\t\t<span class=\"field\">{$r['namaSupplier']}&nbsp;</span>\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t<label class=\"l-input-small\">Alias</label>\n\t\t\t\t<span class=\"field\">{$r['aliasSupplier']}&nbsp;</span>\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t<label class=\"l-input-small\">Logo</label>\n\t\t\t\t<div class=\"field\">";
    $text .= empty($r[logoSupplier]) ? "" : "<img src=\"" . $fFile . "/" . $r[logoSupplier] . "\" align=\"left\" style=\"padding-right:5px; padding-bottom:5px; max-width:50px; max-height:50px;\">\n\t\t\t\t\t<br clear=\"all\">";
    $text .= "</div>\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\t<label class=\"l-input-small\">Alamat</label>\n\t\t\t\t\t<span class=\"field\">" . nl2br($r[alamatSupplier]) . "&nbsp;</span>\n\t\t\t\t</p>\n\t\t\t\t<table style=\"width:100%\">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td style=\"width:50%\">\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t<label class=\"l-input-small2\">Propinsi</label>\n\t\t\t\t\t\t\t\t<span class=\"fieldA\">" . getField("select namaData from mst_data where kodeData='{$r['kodePropinsi']}'") . "&nbsp;</span>\n\t\t\t\t\t\t\t</p>\t\t\t\t\t\t\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t<label class=\"l-input-small2\">Telepon</label>\n\t\t\t\t\t\t\t\t<span class=\"fieldA\">{$r['teleponSupplier']}&nbsp;</span>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t<label class=\"l-input-small2\">Email</label>\n\t\t\t\t\t\t\t\t<span class=\"fieldA\">{$r['emailSupplier']}&nbsp;</span>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t<label class=\"l-input-small2\">Status</label>\n\t\t\t\t\t\t\t\t<span class=\"fieldA\">{$statusSupplier}&nbsp;</span>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td style=\"width:50%\">\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t<label class=\"l-input-small2\">Kota</label>\n\t\t\t\t\t\t\t\t<span class=\"fieldA\">" . getField("select namaData from mst_data where kodeData='{$r['kodeKota']}'") . "&nbsp;</span>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t<label class=\"l-input-small2\">Fax</label>\n\t\t\t\t\t\t\t\t<span class=\"fieldA\">{$r['faxSupplier']}&nbsp;</span>\n\t\t\t\t\t\t\t</p>\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t<label class=\"l-input-small2\">Website</label>\n\t\t\t\t\t\t\t\t<span class=\"fieldA\">{$r['webSupplier']}&nbsp;</span>\n\t\t\t\t\t\t\t</p>\t\t\t\t\t\t\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t</div>";
    # TAB ADDRESS
    $text .= "<div id=\"address\" class=\"subcontent\" {$dAddress} >\n\t\t\t<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"stdtable stdtablequick\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th width=\"20\">No.</th>\n\t\t\t\t\t\t<th width=\"200\">Kategori</th>\t<th>Alamat</th>\n\t\t\t\t\t\t<th width=\"200\">Kota</th>\t<th width=\"150\">Telepon</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>";
    $sql = "select * from dta_supplier_address t1 join mst_data t2 on (t1.kodeKota=t2.kodeData) where t1.kodeSupplier='{$par['kodeSupplier']}' order by t1.kodeAddress";
    $res = db($sql);
    $no = 1;
    while ($r = mysql_fetch_array($res)) {
        $text .= "<tr>\n\t\t\t\t\t\t<td>{$no}.</td>\n\t\t\t\t\t\t<td>{$r['kategoriAddress']}</td>\n\t\t\t\t\t\t<td>{$r['alamatAddress']}</td>\n\t\t\t\t\t\t<td>{$r['namaData']}</td>\n\t\t\t\t\t\t<td>{$r['teleponAddress']}</td>\n\t\t\t\t\t</tr>";
        $no++;
    }
    if ($no == 1) {
        $text .= "<tr>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t</tr>";
    }
    $text .= "</tbody>\n\t\t</table>\n\t</div>";
    # TAB PRODUCT
    $text .= "<div id=\"product\" class=\"subcontent\" {$dProduct} >\n\t<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"stdtable stdtablequick\">\n\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th width=\"20\">No.</th>\n\t\t\t\t<th>Product</th>\n\t\t\t\t<th width=\"125\">Harga</th>\n\t\t\t\t<th width=\"50\">File</th>\n\t\t\t</tr>\n\t\t</thead>\n\t\t<tbody>";
    $sql = "select * from dta_supplier_produk t1 join dta_produk_kategori t2 on (t1.kodeProduk=t2.kodeProduk and t1.kodeKategori=t2.kodeKategori) where t1.kodeSupplier='{$par['kodeSupplier']}' order by t1.kodeProduk, t1.kodeKategori";
    $res = db($sql);
    $no = 1;
    while ($r = mysql_fetch_array($res)) {
        $text .= "<tr>\n\t\t\t\t<td>{$no}.</td>\n\t\t\t\t<td>{$r['tipeKategori']} -- {$r['namaKategori']}</td>\n\t\t\t\t<td align=\"right\">" . getAngka($r[hargaProduk]) . "</td>\n\t\t\t\t<td align=\"center\">";
        if (!empty($r[fileProduk])) {
            $text .= "<a href=\"download.php?d=supp&f=" . $r[kodeSupplier] . "." . $r[kodeProduk] . "." . $r[kodeKategori] . "\"><img src=\"" . getIcon($dFile . "/" . $r[fileProduk]) . "\" style=\"padding-right:5px; padding-bottom:5px;\"></a>";
        }
        $text .= "</td>\n\t\t\t\t</tr>";
        $no++;
    }
    if ($no == 1) {
        $text .= "<tr>\n\t\t\t\t<td>&nbsp;</td>\t\t\t\t\t\t\t\t\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>";
    }
    $text .= "</tbody>\n\t</table>\n</div>";
    # TAB IDENTITY
    $sql = "select * from dta_supplier_identity where kodeSupplier='{$par['kodeSupplier']}'";
    $res = db($sql);
    $r = mysql_fetch_array($res);
    $text .= "<div id=\"identity\" class=\"subcontent\" {$dIdentity} >\n<table width=\"100%\">\n\t<tr>\n\t\t<td width=\"50%\" nowrap=\"nowrap\" style=\"vertical-align:top\">\n\t\t\t<p>\n\t\t\t\t<label class=\"l-input-small\">SIUP</label>\n\t\t\t\t<span class=\"field\">{$r['siupIdentity']}&nbsp;</span>\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t<label class=\"l-input-small\">TDP</label>\n\t\t\t\t<span class=\"field\">{$r['tdpIdentity']}&nbsp;</span>\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t<label class=\"l-input-small\">ID</label>\n\t\t\t\t<span class=\"field\">{$r['idIdentity']}&nbsp;</span>\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t<label class=\"l-input-small\">NPWP</label>\n\t\t\t\t<span class=\"field\">{$r['npwpIdentity']}&nbsp;</span>\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t<label class=\"l-input-small\">Alamat</label>\n\t\t\t\t<span class=\"field\">" . nl2br($r[alamatIdentity]) . "&nbsp;</span>\n\t\t\t</p>\n\t\t</td>\n\t\t<td width=\"50%\" nowrap=\"nowrap\" style=\"vertical-align:top\">\n\t\t\t<p>\n\t\t\t\t<label class=\"l-input-small\">File</label>\n\t\t\t\t<div class=\"field\">";
    $text .= empty($r[siupIdentity_file]) ? "" : "<a href=\"download.php?d=sup&f=siup.{$r['kodeSupplier']}\"><img src=\"" . getIcon($dFile . "/" . $r[siupIdentity_file]) . "\" align=\"left\" style=\"padding-right:5px; padding-bottom:5px; max-width:50px; max-height:50px;\"></a>";
    $text .= "</div>\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\t<label class=\"l-input-small\">File</label>\n\t\t\t\t\t<div class=\"field\">";
    $text .= empty($r[tdpIdentity_file]) ? "" : "<a href=\"download.php?d=sup&f=tdp.{$r['kodeSupplier']}\"><img src=\"" . getIcon($dFile . "/" . $r[tdpIdentity_file]) . "\" align=\"left\" style=\"padding-right:5px; padding-bottom:5px; max-width:50px; max-height:50px;\"></a>";
    $text .= "</div>\n\t\t\t\t\t</p>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t<label class=\"l-input-small\">File</label>\n\t\t\t\t\t\t<div class=\"field\">";
    $text .= empty($r[idIdentity_file]) ? "" : "<a href=\"download.php?d=sup&f=id.{$r['kodeSupplier']}\"><img src=\"" . getIcon($dFile . "/" . $r[idIdentity_file]) . "\" align=\"left\" style=\"padding-right:5px; padding-bottom:5px; max-width:50px; max-height:50px;\"></a>";
    $text .= "</div>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t<label class=\"l-input-small\">File</label>\n\t\t\t\t\t\t\t<div class=\"field\">";
    $text .= empty($r[npwpIdentity_file]) ? "" : "<a href=\"download.php?d=sup&f=id.{$r['kodeSupplier']}\"><img src=\"" . getIcon($dFile . "/" . $r[npwpIdentity_file]) . "\" align=\"left\" style=\"padding-right:5px; padding-bottom:5px; max-width:50px; max-height:50px;\"></a>";
    $text .= "</div>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</div>";
    # TAB CONTACT
    $text .= "<div id=\"contact\" class=\"subcontent\" {$dContact} >\n\t\t\t<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"stdtable stdtablequick\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th width=\"20\">No.</th>\n\t\t\t\t\t\t<th style=\"min-width:175px;\">Posisi</th>\n\t\t\t\t\t\t<th style=\"min-width:175px;\">Nama</th>\n\t\t\t\t\t\t<th width=\"150\">Email</th>\n\t\t\t\t\t\t<th width=\"100\">HP</th>\n\t\t\t\t\t\t<th width=\"100\">Tlp Kantor</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>";
    $sql = "select * from dta_supplier_contact where kodeSupplier='{$par['kodeSupplier']}' order by kodeContact";
    $res = db($sql);
    $no = 1;
    while ($r = mysql_fetch_array($res)) {
        $text .= "<tr>\n\t\t\t\t\t\t<td>{$no}.</td>\n\t\t\t\t\t\t<td>{$r['jabatanContact']}</td>\n\t\t\t\t\t\t<td>{$r['namaContact']}</td>\n\t\t\t\t\t\t<td>{$r['emailContact']}</td>\n\t\t\t\t\t\t<td>{$r['teleponContact']}</td>\n\t\t\t\t\t\t<td>{$r['kantorContact']}</td>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>";
        $no++;
    }
    if ($no == 1) {
        $text .= "<tr>\n\t\t\t\t<td>&nbsp;</td>\t\t\t\t\t\t\t\t\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td>&nbsp;</td>\t\t\t\t\t\t\t\t\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>";
    }
    $text .= "</tbody>\n\t</table>\n</div>";
    # TAB BANKING
    $text .= "<div id=\"banking\" class=\"subcontent\" {$dBanking} >\n<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"stdtable stdtablequick\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"20\">No.</th>\n\t\t\t<th>Nama Bank</th>\n\t\t\t<th width=\"150\">No Akun</th>\t\t\t\t\t\t\t\n\t\t\t<th>Nama Akun</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>";
    $sql = "select * from dta_supplier_bank t1 join mst_data t2 on (t1.kodeBank=t2.kodeData) where t1.kodeSupplier='{$par['kodeSupplier']}' order by t1.kodeBank";
    $res = db($sql);
    $no = 1;
    while ($r = mysql_fetch_array($res)) {
        $text .= "<tr>\n\t\t\t<td>{$no}.</td>\n\t\t\t<td>{$r['namaBank']}</td>\n\t\t\t<td>{$r['rekeningBank']}</td>\n\t\t\t<td>{$r['pemilikBank']}</td>\n\t\t</tr>";
        $no++;
    }
    if ($no == 1) {
        $text .= "<tr>\n\t\t<td>&nbsp;</td>\n\t\t<td>&nbsp;</td>\n\t\t<td>&nbsp;</td>\n\t\t<td>&nbsp;</td>\n\t</tr>";
    }
    $text .= "</tbody>\n</table>\n</div>\n</form>";
    return $text;
}
Ejemplo n.º 16
0
                    echo "Skipping {$currentSpell}, already converted as #{$durability}, new id#{$currentDurability}\n";
                    $iconMap[$currentDurability] = $currentSpell;
                    $currentSpell = null;
                    $outputFile .= $iconIndent . "icon: {$iconType}:{$currentDurability}\n";
                    $currentSpellConfig = $currentSpellConfigNoIcon;
                    $currentDurability++;
                    continue;
                }
            }
            if (strpos($currentIcon, ':http') !== FALSE) {
                $pieces = explode(':', $currentIcon, 2);
                $currentURL = $pieces[1];
            }
            if ($currentURL != null) {
                echo "Converting {$currentSpell}\n";
                $outputFile .= getIcon($currentSpell, $currentURL, $iconIndent);
                $outputFile .= $currentSpellConfigNoIcon;
                $currentSpellConfig = '';
                $currentSpell = null;
            }
            continue;
        }
        $currentSpellConfigNoIcon .= $line;
    }
    $outputFile .= $currentSpellConfig;
    fclose($handle);
} else {
    die("Error opening file: {$spellConfig}\n");
}
file_put_contents($spellConfigOut, $outputFile);
echo "Wrote config to {$spellConfigOut}\n";
Ejemplo n.º 17
0
        <th>Acciones</th>
        </thead>
        <tbody>
        <?php 
foreach ($games as $game) {
    ?>
        <tr id="<?php 
    echo $game->getId();
    ?>
">
            <td><?php 
    echo $game->getName();
    ?>
</td>
            <td><?php 
    echo getIcon($game) . "&nbsp;" . $game->getGameType();
    ?>
</td>
            <?php 
    if (!$onlyImportantColumns) {
        ?>
            <td><?php 
        echo $game->getRating();
        ?>
</td>
            <td><?php 
        echo $game->getCompany();
        ?>
</td>
            <td><?php 
        echo $game->getYear();
Ejemplo n.º 18
0
 /**
  * createColumn is handy because it can take any input $fieldName and use
  *   its suffix to determine how the field should be displayed.
  *
  * This allows us to treat project_description, task_description,
  *   company_description, or even some_other_crazy_wacky_description in
  *   exactly the same way without additional lines of code or configuration.
  *   If you want to do your own, feel free... but this is probably easier.
  * 
  * Examples: _budget, _date, _name, _owner
  * 
  * This may not work for things like company_type or project_type which are
  *   actually just references to look up tables, ... but should work on
  *   fields like project_company, dept_company because we still have a 
  *   common suffix.
  *
  * @note I'm kind of annoyed about the complexity and sheer number of
  *   paths of this method but overall I think it's laid out reasonably
  *   well. I think the more important part is that I've been able to
  *   encapsulate it all here instead of spreading it all over the modules
  *   and views.
  */
 public function createCell($fieldName, $value, $custom = array())
 {
     $additional = '';
     if ('' == $value) {
         return '<td>-</td>';
     }
     $pieces = explode('_', $fieldName);
     $prefix = $pieces[0];
     $suffix = '_' . end($pieces);
     if ($fieldName == 'project_actual_end_date') {
         $suffix = '_actual';
     }
     switch ($suffix) {
         //BEGIN: object-based linkings
         /*
          * TODO: The following cases are likely to change once we have an approach to 
          *   handle module-level objects and their proper mapping/linkings.
         */
         case '_company':
         case '_contact':
         case '_task':
             $module = substr($suffix, 1);
             $class = 'C' . ucfirst($module);
             $obj = new $class();
             $obj->load($value);
             $link = '?m=' . w2p_pluralize($module) . '&a=view&' . $module . '_id=' . $value;
             $cell = '<a href="' . $link . '">' . $obj->{"{$module}" . '_name'} . '</a>';
             $suffix .= ' _name';
             break;
         case '_department':
             $module = substr($suffix, 1);
             $class = 'C' . ucfirst($module);
             $obj = new $class();
             $obj->load($value);
             /**
              * This is a branch separate from _company, _contact, etc above because although the module is called
              *   departments, the fields are dept_id and dept_name. :(
              *                                                              ~ caseydk, Dec 11 2013
              */
             $link = '?m=' . w2p_pluralize($module) . '&a=view&dept_id=' . $value;
             $cell = '<a href="' . $link . '">' . $obj->dept_name . '</a>';
             $suffix .= ' _name';
             break;
         case '_folder':
             $obj = new CFile_Folder();
             $obj->load($value);
             $foldername = $value ? $obj->file_folder_name : 'Root';
             $image = '<img src="' . w2PfindImage('folder5_small.png', 'files') . '" />';
             $link = '?m=files&tab=4&folder=' . (int) $value;
             $cell = '<a href="' . $link . '">' . $image . ' ' . $foldername . '</a>';
             $suffix .= ' _name';
             break;
         case '_user':
         case '_username':
             $obj = new CContact();
             $obj->findContactByUserid($this->tableRowData['user_id']);
             $link = '?m=users&a=view&user_id=' . $this->tableRowData['user_id'];
             $cell = '<a href="' . $link . '">' . $obj->user_username . '</a>';
             break;
             //END: object-based linkings
             /*
              * TODO: These two prefix adjustments are an ugly hack because our departments 
              *   table doesn't follow the same convention as every other table we have. 
              *   This needs to be fixed in v4.0 - caseydk 13 Feb 2012
              *
              * TODO: And unfortunately, the forums module is screwy using 'viewer' instead 
              *   of our standard 'view' for the page. ~ caseydk 16 Feb 2012
             */
         //END: object-based linkings
         /*
          * TODO: These two prefix adjustments are an ugly hack because our departments 
          *   table doesn't follow the same convention as every other table we have. 
          *   This needs to be fixed in v4.0 - caseydk 13 Feb 2012
          *
          * TODO: And unfortunately, the forums module is screwy using 'viewer' instead 
          *   of our standard 'view' for the page. ~ caseydk 16 Feb 2012
         */
         case '_name':
             $prefix = $prefix == 'project_short' ? 'project' : $prefix;
             $prefix = $prefix == 'dept' ? 'department' : $prefix;
             $page = $prefix == 'forum' || $prefix == 'message' ? 'viewer' : 'view';
             $link = '?m=' . w2p_pluralize($prefix) . '&a=' . $page . '&';
             $link = $prefix == 'message' ? '?m=forums&a=' . $page . '&' : $link;
             $prefix = $prefix == 'department' ? 'dept' : $prefix;
             $link .= $prefix . '_id=' . $this->tableRowData[$prefix . '_id'];
             $link .= $prefix == 'task_log' ? '&tab=1&task_id=' . $this->tableRowData['task_id'] : '';
             $icon = $fieldName == 'file_name' ? '<img src="' . w2PfindImage(getIcon($this->tableRowData['file_type']), 'files') . '" />&nbsp;' : '';
             $cell = '<a href="' . $link . '">' . $icon . $value . '</a>';
             //TODO: task_logs are another oddball..
             $cell = $prefix == 'task_log' ? str_replace('task_logs', 'tasks', $cell) : $cell;
             break;
         case '_author':
         case '_creator':
         case '_owner':
         case '_updator':
             if ((int) $value) {
                 $obj = new CContact();
                 $obj->findContactByUserid($value);
                 $suffix .= ' nowrap';
                 $link = '?m=users&a=view&user_id=' . $value;
                 $cell = '<a href="' . $link . '">' . $obj->contact_display_name . '</a>';
             } else {
                 $cell = $value;
             }
             break;
             // The above are all contact/user display names, the below are numbers.
         // The above are all contact/user display names, the below are numbers.
         case '_count':
         case '_hours':
             $cell = $value;
             break;
         case '_duration':
             $durnTypes = w2PgetSysVal('TaskDurationType');
             $cell = $value . ' ' . $this->AppUI->_($durnTypes[$this->tableRowData['task_duration_type']]);
             break;
         case '_size':
             $cell = file_size($value);
             break;
         case '_budget':
             $cell = w2PgetConfig('currency_symbol');
             $cell .= formatCurrency($value, $this->AppUI->getPref('CURRENCYFORM'));
             break;
         case '_url':
             $value = str_replace(array('"', '"', '<', '>'), '', $value);
             $cell = w2p_url($value);
             break;
         case '_email':
             $cell = w2p_email($value);
             break;
         case '_birthday':
         case '_date':
             $myDate = intval($value) ? new w2p_Utilities_Date($value) : null;
             $cell = $myDate ? $myDate->format($this->df) : '-';
             break;
         case '_actual':
             $end_date = intval($this->tableRowData['project_end_date']) ? new w2p_Utilities_Date($this->tableRowData['project_end_date']) : null;
             $actual_end_date = intval($this->tableRowData['project_actual_end_date']) ? new w2p_Utilities_Date($this->tableRowData['project_actual_end_date']) : null;
             $style = $actual_end_date < $end_date && !empty($end_date) ? 'style="color:red; font-weight:bold"' : '';
             if ($actual_end_date) {
                 $cell = '<a href="?m=tasks&a=view&task_id=' . $this->tableRowData['project_last_task'] . '" ' . $style . '>' . $actual_end_date->format($this->df) . '</a>';
             } else {
                 $cell = '-';
             }
             break;
         case '_created':
         case '_datetime':
         case '_update':
         case '_updated':
             $myDate = intval($value) ? new w2p_Utilities_Date($this->AppUI->formatTZAwareTime($value, '%Y-%m-%d %T')) : null;
             $cell = $myDate ? $myDate->format($this->dtf) : '-';
             break;
         case '_description':
             $cell = w2p_textarea($value);
             break;
         case '_priority':
             $mod = $value > 0 ? '+' : '-';
             $image = '<img src="' . w2PfindImage('icons/priority' . $mod . abs($value) . '.gif') . '" width="13" height="16" alt="">';
             $cell = $value != 0 ? $image : '';
             break;
         case '_complete':
         case '_assignment':
         case '_allocated':
         case '_allocation':
             $cell = round($value) . '%';
             break;
         case '_password':
             $cell = '(' . $this->AppUI->_('hidden') . ')';
             break;
         case '_version':
             $value = (int) (100 * $value);
             $cell = number_format($value / 100, 2);
             break;
         case '_identifier':
             $additional = 'style="background-color:#' . $value . '; color:' . bestColor($value) . '" ';
             $cell = $this->tableRowData['project_percent_complete'] . '%';
             break;
         case '_project':
             $module = substr($suffix, 1);
             $class = 'C' . ucfirst($module);
             $obj = new $class();
             $obj->load($value);
             $color = $obj->project_color_identifier;
             $link = '?m=' . w2p_pluralize($module) . '&a=view&' . $module . '_id=' . $value;
             $cell = '<span style="background-color:#' . $color . '; padding: 3px"><a href="' . $link . '" style="color:' . bestColor($color) . '">' . $obj->{"{$module}" . '_name'} . '</a></span>';
             $suffix .= ' _name';
             break;
         case '_assignees':
             $cell = $value;
             break;
         case '_problem':
             if ($value) {
                 $cell = '<a href="?m=tasks&a=index&f=all&project_id=' . $this->tableRowData['project_id'] . '">';
                 $cell .= w2PshowImage('icons/dialog-warning5.png', 16, 16, 'Problem', 'Problem');
                 $cell .= '</a>';
             } else {
                 $cell = '-';
             }
             break;
         default:
             $value = isset($custom[$fieldName]) ? $custom[$fieldName][$value] : $value;
             $cell = htmlspecialchars($value, ENT_QUOTES);
     }
     $begin = '<td ' . $additional . 'class="' . $suffix . '">';
     $end = '</td>';
     return $begin . $cell . $end;
 }
Ejemplo n.º 19
0
$class = "sidebar";
?>
<div class="title">
	<a class="right" href="javascript:void(null)" onclick="toggleSidebarContainer('menu')"><?php 
echo img(imgpath("1downarrow.png"), "", "", "menu_arrow");
?>
</a>
	<?php 
echo ucf(i18n("menu"));
?>
</div>
<div id="menu_container" class="container">
<?
	echo cmd(img(getIcon("console"))." ".ucf(i18n("console")), "exec=console", $class);
	echo cmd(img(getIcon("date"))." ".ucf(i18n("calendar")), "exec=calendar", $class);
	echo cmd(img(getIcon("search"))." ".ucf(i18n("search")), "exec=search", $class);
	if (!empty($_SESSION['murrix']['user']->password))
		echo cmd(img(geticon("password"))." ".ucf(i18n("change password")), "exec=console&initcmd=upass", $class);
?>
</div>
<?
$home_id = $_SESSION['murrix']['user']->home_id;
	
if ($home_id > 0)
{
	$home = new mObject($home_id);
	
	$children = fetch("FETCH node WHERE link:node_top='$home_id' AND link:type='sub' AND !property:class_name='comment' NODESORTBY property:version SORTBY property:name");
	
	?>
	<div class="title">
Ejemplo n.º 20
0
function displayFiles($AppUI, $folder_id, $task_id, $project_id, $company_id)
{
    global $m, $a, $tab, $xpg_min, $xpg_pagesize, $showProject, $file_types, $cfObj, $xpg_totalrecs, $xpg_total_pages, $page, $company_id, $allowed_companies, $current_uri, $w2Pconfig, $canEdit, $canRead;
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    // SETUP FOR FILE LIST
    $q = new w2p_Database_Query();
    $q->addQuery('f.*, max(f.file_id) as latest_id, count(f.file_version) as file_versions, round(max(file_version), 2) as file_lastversion');
    $q->addQuery('ff.*');
    $q->addTable('files', 'f');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
    $q->addJoin('projects', 'p', 'p.project_id = file_project');
    $q->addJoin('tasks', 't', 't.task_id = file_task');
    $q->leftJoin('project_departments', 'project_departments', 'p.project_id = project_departments.project_id OR project_departments.project_id IS NULL');
    $q->leftJoin('departments', 'departments', 'departments.dept_id = project_departments.department_id OR dept_id IS NULL');
    //TODO: apply permissions properly
    $project = new CProject();
    $deny1 = $project->getDeniedRecords($AppUI->user_id);
    if (count($deny1) > 0) {
        $q->addWhere('file_project NOT IN (' . implode(',', $deny1) . ')');
    }
    //TODO: apply permissions properly
    $task = new CTask();
    $deny2 = $task->getDeniedRecords($AppUI->user_id);
    if (count($deny2) > 0) {
        $q->addWhere('file_task NOT IN (' . implode(',', $deny2) . ')');
    }
    if ($project_id) {
        $q->addWhere('file_project = ' . (int) $project_id);
    }
    if ($task_id) {
        $q->addWhere('file_task = ' . (int) $task_id);
    }
    if ($company_id) {
        $q->addWhere('project_company = ' . (int) $company_id);
    }
    $q->setLimit($xpg_pagesize, $xpg_min);
    $q->addWhere('file_folder = ' . (int) $folder_id);
    $q->addGroup('file_version_id DESC');
    $qv = new w2p_Database_Query();
    $qv->addTable('files');
    $qv->addQuery('file_id, file_version, file_project, file_name, file_task,
		file_description, u.user_username as file_owner, file_size, file_category,
		task_name, file_version_id,  file_checkout, file_co_reason, file_type,
		file_date, cu.user_username as co_user, project_name,
		project_color_identifier, project_owner, con.contact_first_name,
		con.contact_last_name, co.contact_first_name as co_contact_first_name,
		co.contact_last_name as co_contact_last_name ');
    $qv->addJoin('projects', 'p', 'p.project_id = file_project');
    $qv->addJoin('users', 'u', 'u.user_id = file_owner');
    $qv->addJoin('contacts', 'con', 'con.contact_id = u.user_contact');
    $qv->addJoin('tasks', 't', 't.task_id = file_task');
    $qv->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
    if ($project_id) {
        $qv->addWhere('file_project = ' . (int) $project_id);
    }
    if ($task_id) {
        $qv->addWhere('file_task = ' . (int) $task_id);
    }
    if ($company_id) {
        $qv->addWhere('project_company = ' . (int) $company_id);
    }
    $qv->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
    $qv->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
    $qv->addWhere('file_folder = ' . (int) $folder_id);
    $files = array();
    $file_versions = array();
    $files = $q->loadList();
    $file_versions = $qv->loadHashList('file_id');
    $q->clear();
    $qv->clear();
    if ($files === array()) {
        return 0;
    }
    $s = '
		<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
		<tr>
			<th nowrap="nowrap">' . $AppUI->_('File Name') . '</th>
			<th>' . $AppUI->_('Description') . '</th>
			<th>' . $AppUI->_('Versions') . '</th>
		    <th>' . $AppUI->_('Category') . '</th>
			<th nowrap="nowrap">' . $AppUI->_('Task Name') . '</th>
			<th>' . $AppUI->_('Owner') . '</th>
			<th>' . $AppUI->_('Size') . '</th>
			<th>' . $AppUI->_('Type') . '</a></th>
			<th>' . $AppUI->_('Date') . '</th>
	    	<th nowrap="nowrap">' . $AppUI->_('co Reason') . '</th>
	    	<th>' . $AppUI->_('co') . '</th>
			<th nowrap="nowrap" width="5%"></th>
			<th nowrap="nowrap" width="1"></th>
		</tr>';
    $fp = -1;
    $file_date = new w2p_Utilities_Date();
    $id = 0;
    foreach ($files as $row) {
        $latest_file = $file_versions[$row['latest_id']];
        $file_date = new w2p_Utilities_Date($latest_file['file_date']);
        if ($fp != $latest_file['file_project']) {
            if (!$latest_file['file_project']) {
                $latest_file['project_name'] = $AppUI->_('Not attached to a project');
                $latest_file['project_color_identifier'] = 'f4efe3';
            }
            if ($showProject) {
                $style = 'background-color:#' . $latest_file['project_color_identifier'] . ';color:' . bestColor($latest_file['project_color_identifier']);
                $s .= '<tr>';
                $s .= '<td colspan="20" style="border: outset 2px #eeeeee;' . $style . '">';
                if ($latest_file['file_project'] > 0) {
                    $href = './index.php?m=projects&a=view&project_id=' . $latest_file['file_project'];
                } else {
                    $href = './index.php?m=projects';
                }
                $s .= '<a href="' . $href . '">';
                $s .= '<span style="' . $style . '">' . $latest_file['project_name'] . '</span></a>';
                $s .= '</td></tr>';
            }
        }
        $fp = $latest_file['file_project'];
        $s .= '<tr>
				<td nowrap="8%">
                    <form name="frm_remove_file_' . $latest_file['file_id'] . '" action="?m=files" method="post" accept-charset="utf-8">
                        <input type="hidden" name="dosql" value="do_file_aed" />
                        <input type="hidden" name="del" value="1" />
                        <input type="hidden" name="file_id" value="' . $latest_file['file_id'] . '" />
                        <input type="hidden" name="redirect" value="' . $current_uri . '" />
                    </form>
                    <form name="frm_duplicate_file_' . $latest_file['file_id'] . '" action="?m=files" method="post" accept-charset="utf-8">
                        <input type="hidden" name="dosql" value="do_file_aed" />
                        <input type="hidden" name="duplicate" value="1" />
                        <input type="hidden" name="file_id" value="' . $latest_file['file_id'] . '" />
                        <input type="hidden" name="redirect" value="' . $current_uri . '" />
                    </form>
                ';
        $junkFile = new CFile();
        // TODO: This is just to get getIcon included..
        $file_icon = getIcon($row['file_type']);
        $s .= '<a href="./fileviewer.php?file_id=' . $latest_file['file_id'] . '"><img border="0" width="16" heigth="16" src="' . w2PfindImage($file_icon, 'files') . '" alt="" />&nbsp;' . $latest_file['file_name'] . '</a></td>';
        $s .= '<td width="20%">' . w2p_textarea($latest_file['file_description']) . '</td><td width="5%" nowrap="nowrap" align="right">';
        $hidden_table = '';
        $s .= $row['file_lastversion'];
        if ($row['file_versions'] > 1) {
            $s .= ' <a href="javascript: void(0);" onClick="expand(\'versions_' . $latest_file['file_id'] . '\'); ">(' . $row['file_versions'] . ')</a>';
            $hidden_table = '<tr><td colspan="20">
							<table style="display: none" id="versions_' . $latest_file['file_id'] . '" width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
							<tr>
							        <th nowrap="nowrap">' . $AppUI->_('File Name') . '</th>
							        <th>' . $AppUI->_('Description') . '</th>
							        <th>' . $AppUI->_('Versions') . '</th>
							        <th>' . $AppUI->_('Category') . '</th>
									<th>' . $AppUI->_('Folder') . '</th>
							        <th>' . $AppUI->_('Task Name') . '</th>
							        <th>' . $AppUI->_('Owner') . '</th>
							        <th>' . $AppUI->_('Size') . '</th>
							        <th>' . $AppUI->_('Type') . '</a></th>
							        <th>' . $AppUI->_('Date') . '</th>
							</tr>';
            foreach ($file_versions as $file) {
                if ($file['file_version_id'] == $latest_file['file_version_id']) {
                    $file_icon = getIcon($file['file_type']);
                    $hdate = new w2p_Utilities_Date($file['file_date']);
                    $hidden_table .= '<tr><td nowrap="8%"><a href="./fileviewer.php?file_id=' . $file['file_id'] . '" title="' . $file['file_description'] . '">' . '<img border="0" width="16" heigth="16" src="' . w2PfindImage($file_icon, 'files') . '" alt="" />&nbsp;' . $file['file_name'] . '
					  </a></td>
					  <td width="20%">' . $file['file_description'] . '</td>
					  <td width="5%" nowrap="nowrap" align="right">' . $file['file_version'] . '</td>
					  <td nowrap="nowrap" align="left">' . $file_types[$file['file_category']] . '</td>
					  <td nowrap="nowrap" align="left">' . ($file['file_folder_name'] != '' ? '<a href="' . W2P_BASE_URL . '/index.php?m=files&tab=' . (count($file_types) + 1) . '&folder=' . $file['file_folder_id'] . '">' . w2PshowImage('folder5_small.png', '16', '16', 'folder icon', 'show only this folder', 'files') . $file['file_folder_name'] . '</a>' : 'Root') . '</td>
					  <td nowrap="nowrap" align="left"><a href="./index.php?m=tasks&a=view&task_id=' . $file['file_task'] . '">' . $file['task_name'] . '</a></td>
					  <td nowrap="nowrap">' . $file['contact_first_name'] . ' ' . $file['contact_last_name'] . '</td>
					  <td width="5%" nowrap="nowrap" align="right">' . file_size(intval($file['file_size'])) . '</td>
					  <td nowrap="nowrap">' . $file['file_type'] . '</td>
					  <td width="5%" nowrap="nowrap" align="center">' . $AppUI->formatTZAwareTime($file['file_date'], $df . ' ' . $tf) . '</td>';
                    if ($canEdit && $w2Pconfig['files_show_versions_edit']) {
                        $hidden_table .= '<a href="./index.php?m=files&a=addedit&file_id=' . $file['file_id'] . '">' . w2PshowImage('kedit.png', '16', '16', 'edit file', 'edit file', 'files') . "</a>";
                    }
                    $hidden_table .= '</td><tr>';
                }
            }
            $hidden_table .= '</table>';
        }
        $s .= '</td>
				<td width="10%" nowrap="nowrap" align="left">' . $file_types[$file['file_category']] . '</td>
				<td nowrap="nowrap" align="left"><a href="./index.php?m=tasks&a=view&task_id=' . $latest_file['file_task'] . '">' . $latest_file['task_name'] . '</a></td>
				<td nowrap="nowrap">' . $latest_file['contact_first_name'] . ' ' . $latest_file['contact_last_name'] . '</td>
				<td width="5%" nowrap="nowrap" align="right">' . intval($latest_file['file_size'] / 1024) . ' kb</td>
				<td nowrap="nowrap">' . $latest_file['file_type'] . '</td>
				<td nowrap="nowrap" align="center">' . $AppUI->formatTZAwareTime($latest_file['file_date'], $df . ' ' . $tf) . '</td>
				<td width="10%">' . $latest_file['file_co_reason'] . '</td>
				<td nowrap="nowrap">';
        if (empty($row['file_checkout'])) {
            $s .= '<a href="?m=files&a=co&file_id=' . $latest_file['file_id'] . '">' . w2PshowImage('up.png', '16', '16', 'checkout', 'checkout file', 'files') . '</a>';
        } elseif ($row['file_checkout'] == $AppUI->user_id) {
            $s .= '<a href="?m=files&a=addedit&ci=1&file_id=' . $latest_file['file_id'] . '">' . w2PshowImage('down.png', '16', '16', 'checkin', 'checkin file', 'files') . '</a>';
        } else {
            if ($latest_file['file_checkout'] == 'final') {
                $s .= 'final';
            } else {
                $s .= $latest_file['co_contact_first_name'] . ' ' . $latest_file['co_contact_last_name'] . '<br>(' . $latest_file['co_user'] . ')';
            }
        }
        $s .= '</td><td nowrap="nowrap" width="50">';
        if ($canEdit && (empty($latest_file['file_checkout']) || $latest_file['file_checkout'] == 'final' && ($canEdit || $latest_file['project_owner'] == $AppUI->user_id))) {
            $s .= '<a style="float: left;" href="./index.php?m=files&a=addedit&file_id=' . $latest_file['file_id'] . '">' . w2PshowImage('kedit.png', '16', '16', 'edit file', 'edit file', 'files') . '</a>';
            $s .= '<a style="float: left;" href="javascript: void(0);" onclick="document.frm_duplicate_file_' . $latest_file['file_id'] . '.submit()">' . w2PshowImage('duplicate.png', '16', '16', 'duplicate file', 'duplicate file', 'files') . '</a>';
            $s .= '<a style="float: left;" href="javascript: void(0);" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_remove_file_' . $latest_file['file_id'] . '.submit()}">' . w2PshowImage('remove.png', '16', '16', 'delete file', 'delete file', 'files') . '</a>';
        }
        $s .= '</td>';
        $s .= '<td nowrap="nowrap" align="center" width="1">';
        if ($canEdit && (empty($latest_file['file_checkout']) || $latest_file['file_checkout'] == 'final' && ($canEdit || $latest_file['project_owner'] == $AppUI->user_id))) {
            $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $latest_file['file_id'] . ') : removeBulkComponent(' . $latest_file['file_id'] . ')"';
            $s .= '<input type="checkbox" ' . $bulk_op . ' name="chk_sel_file_' . $latest_file['file_id'] . '" />';
        }
        $s .= '</td></tr>';
        $s .= $hidden_table;
        $hidden_table = '';
    }
    return $s;
}
Ejemplo n.º 21
0
function getServiceIcon($params, &$smarty)
{
    return getIcon($params['from_service']);
}
Ejemplo n.º 22
0
function displayFiles($folder_id)
{
    global $AppUI, $m, $a, $tab, $page;
    global $current_uri;
    global $canAccess, $canRead, $canEdit, $canAuthor, $canDelete;
    global $canAccess_folders, $canRead_folders, $canEdit_folders;
    global $canAuthor_folders, $canDelete_folders;
    global $company_id, $project_id, $task_id;
    global $allowedCompanies, $allowedProjects, $allowedTasks, $allowedFolders;
    global $showProject, $cfObj, $dPconfig;
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    $file_types = dPgetSysVal('FileType');
    $xpg_pagesize = 30;
    //TODO?: Set by System Config Value ...
    $xpg_totalrecs = countFiles($folder_id);
    //get file count for folder
    $xpg_total_pages = $xpg_totalrecs > $xpg_pagesize ? ceil($xpg_totalrecs / $xpg_pagesize) : 1;
    $xpg_min = $xpg_pagesize * ($page - 1);
    // This is where we start our record set from
    $q = new DBQuery();
    // most recent version info per file_project and file_version_id
    $q->createTemp('files_count_max' . $folder_id);
    $q->addTable('files', 'f');
    $q->addQuery('DISTINCT count(f.file_id) as file_versions' . ', max(f.file_version) as file_lastversion' . ', file_version_id, f.file_project');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $q->addGroup('f.file_version_id');
    $q->addGroup('f.file_project');
    $file_version_max_counts = $q->exec();
    $q->clear();
    // most recent version
    $q->addTable('files', 'f');
    $q->addQuery('f.*, fmc.file_versions, round(fmc.file_lastversion, 2) as file_lastversion' . ', u.user_username as file_owner, ff.file_folder_name' . ', ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner' . ', cc.contact_first_name as checkout_first_name' . ', cc.contact_last_name as checkout_last_name');
    $q->addJoin('files_count_max' . $folder_id, 'fmc', '(fmc.file_lastversion=f.file_version AND fmc.file_version_id=f.file_version_id' . ' AND fmc.file_project=f.file_project)', 'inner');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('users', 'u', 'u.user_id = f.file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->leftJoin('users', 'cu', 'cu.user_id = f.file_checkout');
    $q->leftJoin('contacts', 'cc', 'cc.contact_id = cu.user_contact');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($project_id) {
        $q->addWhere('f.file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('f.file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $q->addOrder('p.project_name');
    $q->setLimit($xpg_pagesize, $xpg_min);
    $files_sql = $q->prepare();
    $q->clear();
    // all versions
    $q->addTable('files', 'f');
    $q->addQuery('f.*, ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('users', 'u', 'u.user_id = f.file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($project_id) {
        $q->addWhere('f.file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('f.file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $file_versions_sql = $q->prepare();
    $q->clear();
    //file arrays
    $files = array();
    $file_versions = array();
    if ($canRead) {
        $files = db_loadList($files_sql);
        $file_versions = db_loadHashList($file_versions_sql, 'file_id');
    }
    $q->dropTemp('files_count_max' . $folder_id);
    $q->exec();
    if ($files == array()) {
        return;
    }
    ?>
	<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('File Name');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Description');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Versions');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Category');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Task Name');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Owner');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Size');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Date');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('co Reason');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('co');
    ?>
</th>
		<th nowrap width="1"></th>
		<th nowrap width="1"></th>
	</tr>
<?php 
    $fp = -1;
    $file_date = new CDate();
    $id = 0;
    foreach ($files as $row) {
        $file_date = new CDate($row['file_date']);
        $canEdit_file = getPermission('files', 'edit', $row['file_id']);
        //single file
        if ($fp != $row['file_project']) {
            if (!$row['file_project']) {
                $row['project_name'] = $AppUI->_('Not associated to projects');
                $row['project_color_identifier'] = 'f4efe3';
            }
            if ($showProject) {
                $style = 'background-color:#' . $row['project_color_identifier'] . ';color:' . bestColor($row['project_color_identifier']);
                ?>
<tr>
	<td colspan="20" style="border: outset 2px #eeeeee;<?php 
                echo $style;
                ?>
">
	<a href="?m=projects&a=view&project_id=<?php 
                echo $row['file_project'];
                ?>
">
	<span style="<?php 
                echo $style;
                ?>
"><?php 
                echo $row['project_name'];
                ?>
</span></a>
	</td>
</tr>
<?php 
            }
        }
        $fp = $row['file_project'];
        ?>
	<form name="frm_remove_file_<?php 
        echo $row['file_id'];
        ?>
" action="?m=files" 
	 method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="del" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $row['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<form name="frm_duplicate_file_<?php 
        echo $row['file_id'];
        ?>
" action="?m=files" 
	 method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="duplicate" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $row['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<tr>
		<td nowrap="8%">
<?php 
        $file_icon = getIcon($row['file_type']);
        ?>
		  <a href="./fileviewer.php?file_id=<?php 
        echo $row['file_id'];
        ?>
" 
		   title="<?php 
        echo $row['file_description'];
        ?>
"> 
		  <?php 
        echo dPshowImage(DP_BASE_URL . '/modules/files/images/' . $file_icon, '16', '16');
        ?>
		  &nbsp;<?php 
        echo $row['file_name'];
        ?>
 
		  </a>
		</td>
		<td width="20%"><?php 
        echo $row['file_description'];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="center">
<?php 
        $hidden_table = '';
        echo $row['file_lastversion'];
        if ($row['file_versions'] > 1) {
            ?>
	  <a href="#" onClick="expand('versions_<?php 
            echo $row['file_id'];
            ?>
');">
	  (<?php 
            echo $row['file_versions'];
            ?>
)
	  </a>
<?php 
        }
        ?>
		</td>
		<td width="10%" nowrap="nowrap" align="center">
		  <?php 
        echo $file_types[$row['file_category']];
        ?>
		</td>
		<td width="5%" align="center">
		  <a href="./index.php?m=tasks&a=view&task_id=<?php 
        echo $row['file_task'];
        ?>
">
		  <?php 
        echo $row['task_name'];
        ?>
		  </a>
		</td>
		<td width="15%" nowrap="nowrap">
		  <?php 
        echo $row["contact_first_name"] . ' ' . $row["contact_last_name"];
        ?>
		</td>
		<td width="5%" nowrap="nowrap" align="right">
		  <?php 
        echo file_size(intval($row['file_size']));
        ?>
		</td>
		<td width="15%" nowrap="nowrap" align="right">
		  <?php 
        echo $file_date->format($df . ' ' . $tf);
        ?>
		</td>
		<td width="10%"><?php 
        echo $row['file_co_reason'];
        ?>
</td>
		<td nowrap="nowrap" align="center">
		  
<?php 
        if ($canEdit && empty($row['file_checkout'])) {
            ?>
			  <a href="?m=files&a=co&file_id=<?php 
            echo $row['file_id'];
            ?>
">
			  <?php 
            echo dPshowImage(DP_BASE_URL . '/modules/files/images/up.png', '16', '16', 'checkout', 'checkout file');
            ?>
			  </a>
<?php 
        } else {
            if ($row['file_checkout'] == $AppUI->user_id) {
                ?>
			  <a href="?m=files&a=addedit&ci=1&file_id=<?php 
                echo $row['file_id'];
                ?>
">
			  <?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/down.png', '16', '16', 'checkin', 'checkin file');
                ?>
			  </a>
<?php 
            } else {
                if ($file['file_checkout'] == 'final') {
                    echo '			  ' . $AppUI->_('final');
                } else {
                    echo '	  ' . $row['checkout_first_name'] . ' ' . $row['checkout_last_name'] . '<br />(' . $row['co_user'] . ')';
                }
            }
        }
        ?>
		</td>
		<td nowrap="nowrap" align="right" width="48">
		  <?php 
        if (empty($row['file_checkout']) || $row['file_checkout'] == 'final') {
            // Edit File
            if ($canEdit || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="./index.php?m=files&a=addedit&file_id=<?php 
                echo $row['file_id'];
                ?>
">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
                ?>
		  </a>
<?php 
            }
            // Duplicate File
            if ($canAuthor || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="#" 
		   onclick="document.frm_duplicate_file_<?php 
                echo $row['file_id'];
                ?>
.submit()">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file');
                ?>
		  </a>
<?php 
            }
            // Delete File
            if ($canDelete || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="#" 
		   onclick="if (confirm('Are you sure you want to delete this file?')) {document.frm_remove_file_<?php 
                echo $row['file_id'];
                ?>
.submit()}">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/remove.png', '16', '16', 'delete file', 'delete file');
                ?>
		  </a>
<?php 
            }
        }
        ?>
		</td>
		<td nowrap="nowrap" align="center" width="1">
<?php 
        if ((empty($row['file_checkout']) || $row['file_checkout'] == 'final') && ($canEdit || $row['project_owner'] == $AppUI->user_id)) {
            $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $row['file_id'] . ') : removeBulkComponent(' . $row['file_id'] . ')"';
            ?>
			<input type="checkbox" <?php 
            echo $bulk_op;
            ?>
 
			 name="chk_sub_sel_file_<?php 
            echo $file_row['file_id'];
            ?>
" />
<?php 
        }
        ?>
		</td>
</tr>



<?php 
        if ($row['file_versions'] > 1) {
            ?>

	  <tr><td colspan="20">
		<table style="display: none" id="versions_<?php 
            echo $row['file_id'];
            ?>
" 
		 width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
		  <tr>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('File Name');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Description');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Versions');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Category');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Task Name');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Owner');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Size');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Type');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Date');
            ?>
</th>
			<th nowrap="nowrap"width="1">&nbsp;</th>
			<th nowrap="nowrap"width="1">&nbsp;</th>
		  </tr>
<?php 
            foreach ($file_versions as $file) {
                if ($file['file_version_id'] == $row['file_version_id']) {
                    $file_icon = getIcon($file['file_type']);
                    $file_version_date = new Date($file['file_date']);
                    ?>

		  <form name="frm_delete_sub_file_<?php 
                    echo $file['file_id'];
                    ?>
" 
		   action="?m=files" method="post">
		  <input type="hidden" name="dosql" value="do_file_aed" />
		  <input type="hidden" name="del" value="1" />
		  <input type="hidden" name="file_id" value="<?php 
                    echo $file['file_id'];
                    ?>
" />
		  <input type="hidden" name="redirect" value="<?php 
                    echo $current_uri;
                    ?>
" />
		  </form>		
		  <form name="frm_duplicate_sub_file_<?php 
                    echo $file['file_id'];
                    ?>
" 
		   action="?m=files" method="post">
		  <input type="hidden" name="dosql" value="do_file_aed" />
		  <input type="hidden" name="duplicate" value="1" />
		  <input type="hidden" name="file_id" value="<?php 
                    echo $file['file_id'];
                    ?>
" />
		  <input type="hidden" name="redirect" value="<?php 
                    echo $current_uri;
                    ?>
" />
		  </form>
		  <tr>
			<td nowrap="8%">
			  <a href="./fileviewer.php?file_id=<?php 
                    echo $file['file_id'];
                    ?>
" 
			   title="<?php 
                    echo $file['file_description'];
                    ?>
">
			  <?php 
                    echo dPshowImage(DP_BASE_URL . '/modules/files/images/' . $file_icon, '16', '16');
                    ?>
			  <?php 
                    echo $file['file_name'];
                    ?>
 
			  </a>
			</td>
			<td width="20%"><?php 
                    echo $file['file_description'];
                    ?>
</td>
			<td width="5%" nowrap="nowrap" align="center"><?php 
                    echo $file['file_version'];
                    ?>
</td>
			<td width="10%" nowrap="nowrap" align="center">
			  <?php 
                    echo $file_types[$file['file_category']];
                    ?>
			</td>
			<td width="5%" align="center">
			  <a href="./index.php?m=tasks&a=view&task_id=<?php 
                    echo $file['file_task'];
                    ?>
">
			  <?php 
                    echo $file['task_name'];
                    ?>
			  </a>
			</td>
			<td width="15%" nowrap="nowrap">
			  <?php 
                    echo $file["contact_first_name"] . ' ' . $file["contact_last_name"];
                    ?>
			</td>
			<td width="5%" nowrap="nowrap" align="right">
			  <?php 
                    echo file_size(intval($file['file_size']));
                    ?>
			</td>
			<td nowrap="nowrap">
			  <?php 
                    echo $row['file_type'];
                    ?>
			</td>
			<td width="15%" nowrap="nowrap" align="right">
			  <?php 
                    echo $file_version_date->format($df . ' ' . $tf);
                    ?>
			</td>
			
			<td nowrap="nowrap" align="right" width="48">
			  <?php 
                    if (empty($file['file_checkout']) || $file['file_checkout'] == 'final') {
                        // Edit File
                        if ($canEdit || $row['project_owner'] == $AppUI->user_id) {
                            ?>
			  <a href="./index.php?m=files&a=addedit&file_id=<?php 
                            echo $row['file_id'];
                            ?>
">
<?php 
                            echo dPshowImage(DP_BASE_URL . '/modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
                            ?>
			  </a>
<?php 
                        }
                        // Duplicate File
                        if ($canAuthor) {
                            ?>
			  <a href="#" 
			   onclick="document.frm_duplicate_file_<?php 
                            echo $row['file_id'];
                            ?>
.submit()">
<?php 
                            echo dPshowImage(DP_BASE_URL . '/modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file');
                            ?>
			  </a>
<?php 
                        }
                        // Delete File
                        if ($canDelete) {
                            ?>
			  <a href="#" 
			   onclick="if (confirm('<?php 
                            echo $AppUI->_('Are you sure you want to delete this file?');
                            ?>
')) {document.frm_remove_file_<?php 
                            echo $row['file_id'];
                            ?>
.submit()}">
<?php 
                            echo dPshowImage(DP_BASE_URL . '/modules/files/images/remove.png', '16', '16', 'delete file', $AppUI->_('delete file'));
                            ?>
			  </a>
<?php 
                        }
                    }
                    ?>
			</td>
			<td nowrap="nowrap" align="center" width="1">
<?php 
                    if ((empty($row['file_checkout']) || $row['file_checkout'] == 'final') && ($canEdit || $row['project_owner'] == $AppUI->user_id)) {
                        $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $row['file_id'] . ') : removeBulkComponent(' . $row['file_id'] . ')"';
                        ?>
			  <input type="checkbox" <?php 
                        echo $bulk_op;
                        ?>
 
			   name="chk_sub_sel_file_<?php 
                        echo $file_row['file_id'];
                        ?>
" />
<?php 
                    }
                    ?>
			  </td>
			</tr>
<?php 
                }
            }
            ?>
		</table>
	  </td></tr>
<?php 
        }
    }
    ?>

	</table>
	<?php 
    shownavbar($xpg_totalrecs, $xpg_pagesize, $xpg_total_pages, $page, $folder_id);
    echo "<br />";
}
Ejemplo n.º 23
0
/**
 * This function shows the address book sort button.
 *
 * @param integer $abook_sort_order Current sort value
 * @param string  $alt_tag          The alt tag value (string
 *                                  visible to text only browsers)
 * @param integer $Down             Sort value when list is sorted
 *                                  ascending
 * @param integer $Up               Sort value when list is sorted
 *                                  descending
 * @param array   $uri_extra        Any additional parameters to add
 *                                  to the button's link, as an
 *                                  associative array of key/value pairs
 *                                  (OPTIONAL; default none)
 *
 * @return string html code with sorting images and urls
 *
 */
function show_abook_sort_button($abook_sort_order, $alt_tag, $Down, $Up, $uri_extra = array())
{
    global $form_url, $icon_theme_path;
    /* Figure out which image we want to use. */
    if ($abook_sort_order != $Up && $abook_sort_order != $Down) {
        $img = 'sort_none.png';
        $text_icon = '&#9723;';
        // U+25FB WHITE MEDIUM SQUARE
        $which = $Up;
    } elseif ($abook_sort_order == $Up) {
        $img = 'up_pointer.png';
        $text_icon = '&#8679;';
        // U+21E7 UPWARDS WHITE ARROW
        $which = $Down;
    } else {
        $img = 'down_pointer.png';
        $text_icon = '&#8681;';
        // U+21E9 DOWNWARDS WHITE ARROW
        $which = 8;
    }
    $uri_extra['abook_sort_order'] = $which;
    $uri = set_uri_vars($form_url, $uri_extra, FALSE);
    /* Now that we have everything figured out, show the actual button. */
    return create_hyperlink($uri, getIcon($icon_theme_path, $img, $text_icon, $alt_tag), '', '', '', '', '', array('style' => 'text-decoration:none', 'title' => $alt_tag), FALSE);
}
Ejemplo n.º 24
0
function displayFiles($folder)
{
    global $m, $a, $tab, $AppUI, $xpg_min, $xpg_pagesize;
    global $deny1, $deny2, $project_id, $task_id, $showProject, $file_types, $cfObj;
    global $xpg_totalrecs, $xpg_total_pages, $page;
    global $company_id, $allowed_companies, $current_uri, $dPconfig;
    $canEdit = !getDenyEdit($m, $folder);
    $canRead = !getDenyRead($m, $folder);
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    // SETUP FOR FILE LIST
    $q = new DBQuery();
    $q->addTable('files');
    $q->addQuery('files.*,count(file_version) as file_versions,round(max(file_version), 2) as file_lastversion,file_folder_id, file_folder_name,project_name, project_color_identifier,contact_first_name, contact_last_name,task_name,task_id');
    $q->addJoin('projects', 'p', 'p.project_id = file_project');
    $q->addJoin('users', 'u', 'u.user_id = file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
    $q->addWhere('file_folder = ' . $folder);
    if (count($deny1) > 0) {
        $q->addWhere('file_project NOT IN (' . implode(',', $deny1) . ')');
    }
    if (count($deny2) > 0) {
        $q->addWhere('file_task NOT IN (' . implode(',', $deny2) . ')');
    }
    if ($project_id) {
        $q->addWhere('file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('company_id = ' . $company_id);
        $q->addWhere('company_id IN (' . $allowed_companies . ')');
    }
    $q->addGroup('file_folder');
    $q->addGroup('project_name');
    $q->addGroup('file_name');
    $q->addOrder('file_folder');
    $q->addOrder('project_name');
    $q->addOrder('file_name');
    $q->setLimit($xpg_pagesize, $xpg_min);
    $files_sql = $q->prepare();
    $q->clear();
    $q = new DBQuery();
    $q->addTable('files');
    $q->addQuery('files.file_id, file_version, file_project, file_name, file_task, file_description, user_username as file_owner, file_size, file_category, file_type, file_date, file_folder_name');
    $q->addJoin('projects', 'p', 'p.project_id = file_project');
    $q->addJoin('users', 'u', 'u.user_id = file_owner');
    $q->addJoin('tasks', 't', 't.task_id = file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
    $q->addWhere('file_folder = ' . $folder);
    if ($project_id) {
        $q->addWhere('file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('company_id = ' . $company_id);
        $q->addWhere('company_id IN (' . $allowed_companies . ')');
    }
    $file_versions_sql = $q->prepare();
    $q->clear();
    $files = array();
    $file_versions = array();
    if ($canRead) {
        $files = db_loadList($files_sql);
        $file_versions = db_loadList($file_versions_sql);
    }
    if ($files === array()) {
        return 0;
    }
    ?>
	<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('File Name');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Description');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Versions');
    ?>
</th>
	    <th><?php 
    echo $AppUI->_('Category');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Task Name');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Owner');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Size');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Type');
    ?>
</a></th>
		<th><?php 
    echo $AppUI->_('Date');
    ?>
</th>
    	<th nowrap="nowrap"><?php 
    echo $AppUI->_('co Reason');
    ?>
</th>
    	<th><?php 
    echo $AppUI->_('co');
    ?>
</th>
		<th nowrap width="1"></th>
		<th nowrap width="1"></th>
	</tr>
<?php 
    $fp = -1;
    $file_date = new CDate();
    $id = 0;
    foreach ($files as $row) {
        $file_date = new CDate($row['file_date']);
        if ($fp != $row["file_project"]) {
            if (!$row["project_name"]) {
                $row["project_name"] = $AppUI->_('All Projects');
                $row["project_color_identifier"] = 'f4efe3';
            }
            if ($showProject) {
                $s = '<tr>';
                $s .= '<td colspan="20" style="background-color:#' . $row["project_color_identifier"] . '">';
                $s .= '<font color="' . bestColor($row["project_color_identifier"]) . '">';
                if ($row['file_project'] > 0) {
                    $href = './index.php?m=projects&a=view&project_id=' . $row['file_project'];
                } else {
                    $href = './index.php?m=projects';
                }
                $s .= '<a href="' . $href . '">' . $row["project_name"] . '</a>';
                $s .= '</font></td></tr>';
                echo $s;
            }
        }
        $fp = $row["file_project"];
        if ($row['file_versions'] > 1) {
            $file = last_file($file_versions, $row['file_name'], $row['file_project']);
        } else {
            $file = $row;
        }
        ?>
	<form name="frm_remove_file_<?php 
        echo $file['file_id'];
        ?>
" action="?m=files" method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="del" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $file['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<form name="frm_duplicate_file_<?php 
        echo $file['file_id'];
        ?>
" action="?m=files" method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="duplicate" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $file['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<tr>
		<td nowrap="8%">
			<?php 
        $file_icon = getIcon($row['file_type']);
        echo "<a href=\"./fileviewer.php?file_id={$file['file_id']}\" title=\"{$file['file_description']}\"><img border=\"0\" width=\"16\" heigth=\"16\" src=\"" . DP_BASE_URL . "/modules/files/images/{$file_icon}\" />&nbsp;{$row['file_name']}</a>";
        ?>
		</td>
		<td width="20%"><?php 
        echo $file['file_description'];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="center">
	        <?php 
        $hidden_table = '';
        echo $row['file_lastversion'];
        if ($row['file_versions'] > 1) {
            echo ' <a href="#" onClick="expand(\'versions_' . $file['file_id'] . '\'); ">(' . $row['file_versions'] . ')</a>';
            $hidden_table = '<tr><td colspan="20">
	<table style="display: none" id="versions_' . $file['file_id'] . '" width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
	        <th nowrap="nowrap">' . $AppUI->_('File Name') . '</th>
	        <th>' . $AppUI->_('Description') . '</th>
	        <th>' . $AppUI->_('Versions') . '</th>
	        <th>' . $AppUI->_('Category') . '</th>
	        <th nowrap="nowrap">' . $AppUI->_('Task Name') . '</th>
	        <th>' . $AppUI->_('Owner') . '</th>
	        <th>' . $AppUI->_('Size') . '</th>
	        <th>' . $AppUI->_('Type') . '</a></th>
	        <th>' . $AppUI->_('Date') . '</th>
    		<th nowrap="nowrap">' . $AppUI->_('co Reason') . '</th>
    		<th>' . $AppUI->_('co') . '</th>
	        <th nowrap width="1"></th>
	        <th nowrap width="1"></th>
	</tr>
	';
            foreach ($file_versions as $file_row) {
                if ($file_row['file_name'] == $row['file_name'] && $file_row['file_project'] == $row['file_project']) {
                    $file_icon = getIcon($file_row['file_type']);
                    $file_date = new CDate($file_row['file_date']);
                    $hidden_table .= '	
			<form name="frm_delete_sub_file_' . $file_row['file_id'] . '" action="?m=files" method="post">
			<input type="hidden" name="dosql" value="do_file_aed" />
			<input type="hidden" name="del" value="1" />
			<input type="hidden" name="file_id" value="' . $file_row['file_id'] . '" />
			<input type="hidden" name="redirect" value="' . $current_uri . '" />
			</form>';
                    $hidden_table .= '	
			<form name="frm_duplicate_sub_file_' . $file_row['file_id'] . '" action="?m=files" method="post">
			<input type="hidden" name="dosql" value="do_file_aed" />
			<input type="hidden" name="duplicate" value="1" />
			<input type="hidden" name="file_id" value="' . $file_row['file_id'] . '" />
			<input type="hidden" name="redirect" value="' . $current_uri . '" />
			</form>';
                    $hidden_table .= '
	        <tr>
	                <td nowrap="8%"><a href="./fileviewer.php?file_id=' . $file_row['file_id'] . '" 
	                        title="' . $file_row['file_description'] . '">' . "<img border=\"0\" width=\"16\" heigth=\"16\" src=\"" . DP_BASE_URL . "/modules/files/images/{$file_icon}\" />&nbsp;" . $file_row['file_name'] . '
	                </a></td>
	                <td width="20%">' . $file_row['file_description'] . '</td>
	                <td width="5%" nowrap="nowrap" align="center">' . $file_row['file_version'] . '</td>
	                <td width="10%" nowrap="nowrap" align="center"><a href="./index.php?m=' . $m . '&a=' . $a . '&tab=' . ($file_row['file_category'] + 1) . '">' . $file_types[$file_row['file_category'] + 1] . '</a></td>
	                <td width="5%" align="center"><a href="./index.php?m=tasks&a=view&task_id=' . $file_row["file_task"] . '">' . $row["task_name"] . '</a></td>
	                <td width="15%" nowrap="nowrap">' . $row["contact_first_name"] . ' ' . $row["contact_last_name"] . '</td>
	                <td width="5%" nowrap="nowrap" align="right">' . intval($file_row['file_size'] / 1024) . 'kb </td>
	                <td width="15%" nowrap="nowrap">' . $file_row['file_type'] . '</td>
	                <td width="15%" nowrap="nowrap" align="right">' . $file_date->format("{$df} {$tf}") . '</td>
        			<td width="10%">' . $row['file_co_reason'] . '</td>
        			<td nowrap="nowrap" align="center">';
                    if ($canEdit && empty($file_row['file_checkout'])) {
                        $hidden_table .= '<a href="?m=files&a=co&file_id=' . $file_row['file_id'] . '">' . dPshowImage('./modules/files/images/up.png', '16', '16', 'checkout', 'checkout file') . '</a>';
                    } else {
                        if ($row['file_checkout'] == $AppUI->user_id) {
                            $hidden_table .= '<a href="?m=files&a=addedit&ci=1&file_id=' . $file_row['file_id'] . '">' . dPshowImage('./modules/files/images/down.png', '16', '16', 'checkin', 'checkin file') . '</a>';
                        } else {
                            if ($file_row['file_checkout'] == 'final') {
                                $hidden_table .= 'final';
                            } else {
                                $q4 = new DBQuery();
                                $q4->addQuery("file_id, file_checkout, user_username as co_user, contact_first_name, contact_last_name");
                                $q4->addTable('files');
                                $q4->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
                                $q4->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
                                $q4->addWhere('file_id = ' . $file_row['file_id']);
                                $co_user = array();
                                $co_user = $q4->loadList();
                                $co_user = $co_user[0];
                                $q4->clear();
                                $hidden_table .= $co_user['contact_first_name'] . ' ' . $co_user['contact_last_name'] . '<br>(' . $co_user['co_user'] . ')';
                            }
                        }
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '<td nowrap="nowrap" align="right" width="48">';
                    if ($canEdit && (empty($file_row['file_checkout']) || $file_row['file_checkout'] == 'final' && ($canEdit || $row['project_owner'] == $AppUI->user_id))) {
                        $hidden_table .= '<a href="./index.php?m=files&a=addedit&file_id=' . $file_row["file_id"] . '">' . dPshowImage('./modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file') . "</a>" . '<a href="#" onclick="document.frm_duplicate_sub_file_' . $file_row['file_id'] . '.submit()">' . dPshowImage('./modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file') . "</a>" . '<a href="#" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_delete_sub_file_' . $file_row['file_id'] . '.submit()}">' . dPshowImage('./modules/files/images/remove.png', '16', '16', 'delete file', 'delete file') . "</a>";
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '<td nowrap="nowrap" align="right" width="1">';
                    if ($canEdit && (empty($row['file_checkout']) || $row['file_checkout'] == 'final' && ($canEdit || $row['project_owner'] == $AppUI->user_id))) {
                        $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $file_row['file_id'] . ') : removeBulkComponent(' . $file_row['file_id'] . ')"';
                        $hidden_table .= '<input type="checkbox" ' . $bulk_op . ' name="chk_sub_sel_file_' . $file_row['file_id'] . '" />';
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '</tr>';
                }
            }
            $hidden_table .= '</table>';
            //$hidden_table .= '</span>';
        }
        ?>
	        </td>
	        <td width="10%" nowrap="nowrap" align="center"><a href="./index.php?m=<?php 
        echo $m;
        ?>
&a=<?php 
        echo $a;
        ?>
&view=categories&tab=<?php 
        echo $file['file_category'];
        ?>
"><?php 
        echo $file_types[$file["file_category"]];
        ?>
</a></td> 
		<td width="5%" align="center"><a href="./index.php?m=tasks&a=view&task_id=<?php 
        echo $file["task_id"];
        ?>
"><?php 
        echo $file["task_name"];
        ?>
</a></td>
		<td width="15%" nowrap="nowrap"><?php 
        echo $file["contact_first_name"] . ' ' . $file["contact_last_name"];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="right"><?php 
        echo intval($file["file_size"] / 1024);
        ?>
 kb</td>
		<td width="15%" nowrap="nowrap"><?php 
        echo $file["file_type"];
        ?>
</td>
		<td width="15%" nowrap="nowrap" align="right"><?php 
        echo $file_date->format("{$df} {$tf}");
        ?>
</td>
        <td width="10%"><?php 
        echo $file['file_co_reason'];
        ?>
</td>
        <td nowrap="nowrap" align="center">
        <?php 
        if ($canEdit && empty($row['file_checkout'])) {
            ?>
                <a href="?m=files&a=co&file_id=<?php 
            echo $file['file_id'];
            ?>
"><?php 
            echo dPshowImage('./modules/files/images/up.png', '16', '16', 'checkout', 'checkout file');
            ?>
</a>
        <?php 
        } else {
            if ($row['file_checkout'] == $AppUI->user_id) {
                ?>
                <a href="?m=files&a=addedit&ci=1&file_id=<?php 
                echo $file['file_id'];
                ?>
"><?php 
                echo dPshowImage('./modules/files/images/down.png', '16', '16', 'checkin', 'checkin file');
                ?>
</a>
        <?php 
            } else {
                if ($file['file_checkout'] == 'final') {
                    echo 'final';
                } else {
                    $q4 = new DBQuery();
                    $q4->addQuery("file_id, file_checkout, user_username as co_user, contact_first_name, contact_last_name");
                    $q4->addTable('files');
                    $q4->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
                    $q4->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
                    $q4->addWhere('file_id = ' . $file['file_id']);
                    $co_user = array();
                    $co_user = $q4->loadList();
                    $co_user = $co_user[0];
                    $q4->clear();
                    echo $co_user['contact_first_name'] . ' ' . $co_user['contact_last_name'] . '<br>(' . $co_user['co_user'] . ')';
                }
            }
        }
        ?>
                
        </td>
		<td nowrap="nowrap" align="center" width="48">
		<?php 
        if ($canEdit && (empty($file['file_checkout']) || $file['file_checkout'] == 'final' && ($canEdit || $file['project_owner'] == $AppUI->user_id))) {
            echo '<a href="./index.php?m=files&a=addedit&file_id=' . $file["file_id"] . '">';
            echo dPshowImage('./modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
            echo "</a>";
            echo '<a href="#" onclick="document.frm_duplicate_file_' . $file['file_id'] . '.submit()">' . dPshowImage('./modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file') . '</a>';
            echo '<a href="#" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_remove_file_' . $file['file_id'] . '.submit()}">' . dPshowImage('./modules/files/images/remove.png', '16', '16', 'delete file', 'delete file') . '</a>';
        }
        ?>
		<td nowrap="nowrap" align="center" width="1">
		<?php 
        if ($canEdit && (empty($file['file_checkout']) || $file['file_checkout'] == 'final' && ($canEdit || $file['project_owner'] == $AppUI->user_id))) {
            $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $file['file_id'] . ') : removeBulkComponent(' . $file['file_id'] . ')"';
            echo '<input type="checkbox" ' . $bulk_op . ' name="chk_sel_file_' . $file['file_id'] . '" />';
        }
        ?>
		
		</td>
	</tr>
	<?php 
        echo $hidden_table;
        ?>
	<?php 
        $hidden_table = '';
    }
    ?>
	</table>
	<?php 
    if ($xpg_totalrecs > $xpg_pagesize) {
        showfnavbar($xpg_totalrecs, $xpg_pagesize, $xpg_total_pages, $page, $folder);
    }
    echo "<br />";
}
function ul_generate($array, $ul_id = '')
{
    global $indention;
    $indention++;
    echo indent() . '<ul' . $ul_id . '>' . "\n";
    foreach ($array as $item) {
        $indention++;
        echo indent() . '<li id="' . $item['type'] . ':' . $item['id'] . '">' . "\n";
        echo indent(1) . getIcon($item['type']) . "\n";
        echo indent(1) . $item['name'] . "\n";
        if (!empty($item['children'])) {
            echo ul_generate($item['children']);
        }
        echo indent() . '</li>' . "\n";
        $indention--;
    }
    echo indent() . '</ul>' . "\n";
    $indention--;
}