Esempio n. 1
0
function show_breadcrumb($post_id = 0)
{
    if (!$post_id) {
        $post_id = get_the_ID();
    }
    echo '<div class="breadcrumb-container" id="breadcrumb-container">';
    echo '<div class="breadcrumb"><a href="/property-listing">Property Listing</a></div> &gt; ';
    if (is_property_a_floorplan($post_id)) {
        $building = get_building();
        echo '<div class="breadcrumb"><a href="/property/' . $building->slug . '">' . $building->name . '</a></div> &gt; ';
    }
    echo '<div class="breadcrumb-main">' . the_title('', '', false) . '</div>';
    echo '</div>';
}
/**
 * Prints the details of an inventory object and, optionally, its children. 
 *
 * @param int ID of the object.
 * @param array Array containing inventory objects.
 * @param array Inventory object tree.
 * @param bool Show child nodes.
 * @param bool Show incident statistics.
 * @param int Call depth, used for indentation.
 * @param bool Whether to return an output string or echo now (optional, echo by default).
 */
function print_inventory_object($id, $inventory, $tree, $show_children = false, $show_incidents = false, $depth = 0, $return = false)
{
    global $config;
    $output = '';
    if (!isset($inventory[$id])) {
        return '';
    }
    $object = $inventory[$id];
    if ($object['id_contract']) {
        /* Only check ACLs if the inventory has a contract */
        if (!give_acl($config['id_user'], get_inventory_group($object['id']), "VR")) {
            return '';
        }
    }
    $output .= '<tr id="result-' . $object['id'] . '">';
    $output .= '<td><strong>#' . $object['id'] . '</strong></td>';
    $output .= '<td>';
    if ($depth > 0) {
        $output .= '<span class="indent">';
        for ($i = 0; $i < $depth; $i++) {
            $output .= '&nbsp;&nbsp;&nbsp;&nbsp;';
        }
        $output .= '</span>';
        $output .= '<img src="images/copy.png" />';
    }
    $output .= $object['name'] . '</td>';
    if ($show_incidents) {
        $incidents = get_incidents_on_inventory($object['id'], false);
        $total_incidents = sizeof($incidents);
        $output .= '<td>';
        if ($total_incidents) {
            $actived = 0;
            foreach ($incidents as $incident) {
                if ($incident['estado'] != 7 && $incident['estado'] != 6) {
                    $actived++;
                }
            }
            $output .= '<img src="images/info.png" /> <strong>' . $actived . '</strong> / ' . $total_incidents;
        }
        $output .= '</td>';
    }
    $companies = get_inventory_affected_companies($object['id'], false);
    $output .= '<td>';
    if (isset($companies[0]['name'])) {
        $output .= $companies[0]['name'];
    }
    $output .= '</td>';
    $building = get_building($object['id_building']);
    $output .= '<td>';
    if ($building) {
        $output .= $building['name'];
    }
    $output .= '</td>';
    $output .= '<td>' . $object['description'] . '</td>';
    $output .= '</tr>';
    // Print child objects
    if (!$show_children || !isset($tree[$object['id']])) {
        if ($return) {
            return $output;
        }
        echo $output;
        return;
    }
    foreach ($tree[$object['id']] as $child) {
        $output .= print_inventory_object($child, $inventory, $tree, $show_children, $show_incidents, $depth + 1, true);
    }
    if ($return) {
        return $output;
    }
    echo $output;
}
&session=<?php 
        echo $session;
        ?>
&cp=<?php 
        echo $planet['planet_id'];
        ?>
" title="|<?php 
        echo loca("NAME_" . $queue['obj_id']);
        ?>
">
                    <img src="red_images/8d5601022c4f91d22c90802ee65393.gif" height="12" width="12" />
                    </a>
<?php 
    }
    if ($moon) {
        $queue = get_building($moon['planet_id']);
        if ($queue) {
            ?>
                                                            <a class="constructionIcon moon tipsStandard" href="index.php?page=<?php 
            echo $thispage;
            ?>
&session=<?php 
            echo $session;
            ?>
&cp=<?php 
            echo $moon['planet_id'];
            ?>
" title="|<?php 
            echo loca("NAME_" . $queue['obj_id']);
            ?>
">