Ejemplo n.º 1
0
     }
 }
 for ($i = 0; $i < count($v_column_display_config_rs); $i++) {
     if ($v_column_display_config_rs[$i]['include_in_listing'] !== FALSE) {
         if ($v_column_display_config_rs[$i]['column_type'] == 's_attribute_type') {
             if ($v_column_display_config_rs[$i]['search_attribute_ind'] == 'y') {
                 $attribute_val = $item_r[$v_column_display_config_rs[$i]['fieldname']];
             } else {
                 if ($v_column_display_config_rs[$i]['multi_attribute_ind'] == 'Y' || $v_column_display_config_rs[$i]['lookup_attribute_ind'] == 'Y') {
                     $attribute_val = fetch_attribute_val_r($item_r['item_id'], $item_r['instance_no'], $v_column_display_config_rs[$i]['s_attribute_type']);
                 } else {
                     $attribute_val = fetch_attribute_val($item_r['item_id'], $item_r['instance_no'], $v_column_display_config_rs[$i]['s_attribute_type']);
                 }
             }
             if ($attribute_val !== FALSE && $attribute_val !== NULL) {
                 $listingObject->addAttrDisplayColumn($item_r, fetch_cached_attribute_type_r($v_column_display_config_rs[$i]['s_attribute_type']), $attribute_val);
             } else {
                 $listingObject->addColumn();
             }
         } else {
             if ($v_column_display_config_rs[$i]['column_type'] == 's_field_type') {
                 if ($v_column_display_config_rs[$i]['s_field_type'] == 'RATING') {
                     $rating = fetch_review_rating($item_r['item_id']);
                     if ($rating !== FALSE) {
                         $attribute_type_r = fetch_cached_attribute_type_r($v_column_display_config_rs[$i]['s_attribute_type']);
                         if (strlen($attribute_type_r['display_type']) == 0 || $attribute_type_r['display_type'] == 'hidden') {
                             $attribute_type_r['display_type'] = 'review';
                         }
                         $listingObject->addAttrDisplayColumn($item_r, $attribute_type_r, fetch_review_rating($item_r['item_id']));
                     } else {
                         $listingObject->addColumn();
Ejemplo n.º 2
0
function get_related_items_listing($item_r, $HTTP_VARS, $related_mode)
{
    global $PHP_SELF;
    $buffer = '';
    $results = fetch_item_instance_relationship_rs($item_r['item_id'], $item_r['instance_no'], $related_mode);
    if ($results) {
        $listingObject = new HTML_Listing($PHP_SELF, $HTTP_VARS);
        $listingObject->setBufferOutput(TRUE);
        $listingObject->setNoRowsMessage(get_opendb_lang_var('no_items_found'));
        $listingObject->setShowItemImages(TRUE);
        $listingObject->setIncludeFooter(FALSE);
        $listingObject->addHeaderColumn(get_opendb_lang_var('type'), 'type', FALSE);
        $listingObject->addHeaderColumn(get_opendb_lang_var('title'), 'title', FALSE);
        $listingObject->addHeaderColumn(get_opendb_lang_var('action'), 'action', FALSE);
        $listingObject->addHeaderColumn(get_opendb_lang_var('status'), 'status', FALSE);
        $listingObject->addHeaderColumn(get_opendb_lang_var('status_comment'), 'status_comment', FALSE);
        $listingObject->addHeaderColumn(get_opendb_lang_var('category'), 'category', FALSE);
        $listingObject->startListing(NULL);
        while ($related_item_r = db_fetch_assoc($results)) {
            $listingObject->startRow();
            $listingObject->addItemTypeImageColumn($related_item_r['s_item_type']);
            $listingObject->addTitleColumn($related_item_r);
            $action_links_rs = NULL;
            if (is_user_granted_permission(PERM_ITEM_OWNER) && get_opendb_session_var('user_id') === $item_r['owner_id'] || is_user_granted_permission(PERM_ITEM_ADMIN)) {
                $action_links_rs[] = array(url => 'item_input.php?op=edit&item_id=' . $related_item_r['item_id'] . '&instance_no=' . $related_item_r['instance_no'], img => 'edit.gif', text => get_opendb_lang_var('edit'));
                if (get_opendb_config_var('listings', 'show_refresh_actions') && is_item_legal_site_type($related_item_r['s_item_type'])) {
                    $action_links_rs[] = array(url => 'item_input.php?op=site-refresh&item_id=' . $related_item_r['item_id'] . '&instance_no=' . $related_item_r['instance_no'], img => 'refresh.gif', text => get_opendb_lang_var('refresh'));
                }
                $action_links_rs[] = array(url => 'item_input.php?op=delete&item_id=' . $related_item_r['item_id'] . '&instance_no=' . $related_item_r['instance_no'] . '&parent_item_id=' . $item_r['item_id'] . '&parent_instance_no=' . $item_r['instance_no'], img => 'delete.gif', text => get_opendb_lang_var('delete'));
                $action_links_rs[] = array(url => 'item_input.php?op=delete-relation&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'] . '&parent_item_id=' . $related_item_r['item_id'] . '&parent_instance_no=' . $related_item_r['instance_no'], img => 'delete.gif', text => get_opendb_lang_var('delete_relationship'));
            }
            $listingObject->addActionColumn($action_links_rs);
            $status_type_r = fetch_status_type_r($related_item_r['s_status_type']);
            $listingObject->addThemeImageColumn($status_type_r['img'], $status_type_r['description'], $status_type_r['description'], 's_status_type');
            //type
            // If a comment is allowed and defined, add it in.
            if ($status_type_r['status_comment_ind'] == 'Y' || get_opendb_session_var('user_id') === $related_item_r['owner_id'] || is_user_granted_permission(PERM_ITEM_ADMIN)) {
                // support newlines in this field
                $listingObject->addColumn(nl2br($related_item_r['status_comment']));
            } else {
                $listingObject->addColumn(get_opendb_lang_var('not_applicable'));
            }
            $attribute_type_r = fetch_sfieldtype_item_attribute_type_r($related_item_r['s_item_type'], 'CATEGORY');
            if (is_array($attribute_type_r)) {
                if ($attribute_type_r['lookup_attribute_ind'] === 'Y') {
                    $attribute_val = fetch_attribute_val_r($related_item_r['item_id'], $related_item_r['instance_no'], $attribute_type_r['s_attribute_type'], $attribute_type_r['order_no']);
                } else {
                    $attribute_val = fetch_attribute_val($related_item_r['item_id'], $related_item_r['instance_no'], $attribute_type_r['s_attribute_type'], $attribute_type_r['order_no']);
                }
                $listingObject->addAttrDisplayColumn($related_item_r, $attribute_type_r, $attribute_val);
            }
            $listingObject->endRow();
        }
        $listingObject->endListing();
        $buffer =& $listingObject->getContents();
        unset($listingObject);
        return $buffer;
    } else {
        return NULL;
    }
}