Exemplo n.º 1
0
function get_list_username($user_id, $mode, $subject = NULL, $redirect_link = NULL, $redirect_url = NULL)
{
    // Do not include email link, if Current User.
    if ($user_id == get_opendb_session_var('user_id')) {
        return get_opendb_lang_var('current_user', array('fullname' => fetch_user_name($user_id), 'user_id' => $user_id));
    } else {
        $user_name = get_opendb_lang_var('user_name', array('fullname' => fetch_user_name($user_id), 'user_id' => $user_id));
        if (is_user_granted_permission(PERM_VIEW_USER_PROFILE)) {
            return "<a href=\"user_profile.php?uid=" . $user_id . "&subject=" . urlencode(ifempty($subject, get_opendb_lang_var('no_subject'))) . "&redirect_link=" . urlencode($redirect_link) . "&redirect_url=" . urlencode($redirect_url) . "\" title=\"" . htmlspecialchars(get_opendb_lang_var('user_profile')) . "\">{$user_name}</a>";
        } else {
            return $user_name;
        }
    }
}
Exemplo n.º 2
0
             //if(!is_user_active($HTTP_VARS['user_id']))
             echo format_error_block(get_opendb_lang_var('operation_not_available'));
         }
         echo format_footer_links($footer_links_r);
         echo _theme_footer();
     } else {
         opendb_not_authorised_page(PERM_ADMIN_USER_PROFILE, $HTTP_VARS);
     }
 } else {
     if ($HTTP_VARS['op'] == 'delete') {
         if (is_user_granted_permission(PERM_ADMIN_USER_PROFILE)) {
             echo _theme_header(get_opendb_lang_var('delete_user'));
             echo "<h2>" . get_opendb_lang_var('delete_user') . "</h2>";
             $return_val = handle_user_delete($HTTP_VARS['user_id'], $HTTP_VARS, $errors);
             if ($return_val === '__CONFIRM__') {
                 echo get_op_confirm_form($PHP_SELF, get_opendb_lang_var('confirm_user_delete', array('fullname' => fetch_user_name($HTTP_VARS['user_id']), 'user_id' => $HTTP_VARS['user_id'])), $HTTP_VARS);
             } else {
                 if ($return_val === '__ABORTED__') {
                     echo "<p class=\"success\">" . get_opendb_lang_var('user_not_deleted') . "</p>";
                     $footer_links_r[] = array(url => "{$PHP_SELF}?op=edit&user_id=" . $HTTP_VARS['user_id'], text => $HTTP_VARS['user_id'] == get_opendb_session_var('user_id') ? get_opendb_lang_var('edit_my_info') : get_opendb_lang_var('edit_user_info'));
                 } else {
                     if ($return_val === TRUE) {
                         echo "<p class=\"success\">" . get_opendb_lang_var('user_deleted') . "</p>";
                     } else {
                         //if($return_val === FALSE)
                         echo format_error_block($errors);
                     }
                 }
             }
             echo format_footer_links($footer_links_r);
             echo _theme_footer();
Exemplo n.º 3
0
                 }
             } else {
                 $result = fetch_item_instance_history_rs($item_r['item_id'], $item_r['instance_no'], $listingObject->getCurrentOrderBy(), $listingObject->getCurrentSortOrder());
             }
         } else {
             opendb_not_authorised_page();
         }
     } else {
         echo _theme_header(get_opendb_lang_var('item_not_found'));
         echo "<p class=\"error\">" . get_opendb_lang_var('item_not_found') . "</p>";
         echo _theme_footer();
     }
 } else {
     if ($HTTP_VARS['op'] == 'my_history') {
         if (is_user_valid($HTTP_VARS['uid']) && $HTTP_VARS['uid'] !== get_opendb_session_var('user_id') && is_user_granted_permission(PERM_ADMIN_BORROWER)) {
             $page_title = get_opendb_lang_var('borrower_history_for_fullname', array('fullname' => fetch_user_name($HTTP_VARS['uid']), 'user_id' => $HTTP_VARS['uid']));
             if (is_numeric($listingObject->getItemsPerPage())) {
                 $listingObject->setTotalItems(fetch_my_history_item_cnt($HTTP_VARS['uid']));
                 if ($listingObject->getTotalItemCount() > 0) {
                     $result = fetch_my_history_item_rs($HTTP_VARS['uid'], $listingObject->getCurrentOrderBy(), $listingObject->getCurrentSortOrder(), $listingObject->getStartIndex(), $listingObject->getItemsPerPage());
                 }
             } else {
                 $result = fetch_my_history_item_rs($HTTP_VARS['uid'], $listingObject->getCurrentOrderBy(), $listingObject->getCurrentSortOrder());
             }
         } else {
             $page_title = get_opendb_lang_var('my_history');
             if (is_numeric($listingObject->getItemsPerPage())) {
                 $listingObject->setTotalItems(fetch_my_history_item_cnt(get_opendb_session_var('user_id')));
                 if ($listingObject->getTotalItemCount() > 0) {
                     $result = fetch_my_history_item_rs(get_opendb_session_var('user_id'), $listingObject->getCurrentOrderBy(), $listingObject->getCurrentSortOrder(), $listingObject->getStartIndex(), $listingObject->getItemsPerPage());
                 }
Exemplo n.º 4
0
}
if (is_site_enabled()) {
    if (is_opendb_valid_session()) {
        if (is_user_granted_permission(PERM_ADMIN_QUICK_CHECKOUT)) {
            if (get_opendb_config_var('borrow', 'enable') !== FALSE) {
                if ($HTTP_VARS['op'] == 'checkout' || $HTTP_VARS['op'] == 'checkin') {
                    if ($HTTP_VARS['op'] == 'checkout' && !validate_borrower_id($HTTP_VARS['borrower_id'], $errors)) {
                        echo _theme_header(get_opendb_lang_var('quick_check_out'));
                        echo "<h2>" . get_opendb_lang_var('quick_check_out') . "</h2>";
                        if (is_array($errors) > 0) {
                            echo format_error_block($errors);
                        }
                        display_borrower_form($HTTP_VARS);
                    } else {
                        if ($HTTP_VARS['op'] == 'checkout') {
                            $page_title = get_opendb_lang_var('quick_check_out_for_fullname', array('user_id' => $HTTP_VARS['borrower_id'], 'fullname' => fetch_user_name($HTTP_VARS['borrower_id'])));
                        } else {
                            if ($HTTP_VARS['op'] == 'checkin') {
                                $page_title = get_opendb_lang_var('quick_check_in');
                            }
                        }
                        echo _theme_header($page_title);
                        echo '<h2>' . $page_title . ' ' . $page_image . '</h2>';
                        $attribute_type_r = fetch_alt_item_id_attribute_type_r();
                        $altid_item_instance_rs = update_altid_item_instance_rs($HTTP_VARS['op'], $HTTP_VARS['alt_item_id'], $attribute_type_r, get_decoded_item_instance_rs($HTTP_VARS['op'], $HTTP_VARS['checkout_item_instance_rs']), $errors);
                        if (is_array($errors) > 0) {
                            echo format_error_block($errors);
                        }
                        echo "\n<form action=\"{$PHP_SELF}\" method=\"POST\">";
                        echo "\n<input type=\"hidden\" name=\"op\" value=\"" . $HTTP_VARS['op'] . "\">";
                        echo "\n<input type=\"hidden\" name=\"page_no\" value=\"\">";
Exemplo n.º 5
0
                     }
                     echo _theme_footer();
                 } else {
                     opendb_not_authorised_page(PERM_ADMIN_SEND_EMAIL, $HTTP_VARS);
                 }
             } else {
                 if ($HTTP_VARS['op'] == 'send_to_uid' && is_user_permitted_to_receive_email($HTTP_VARS['uid'])) {
                     if (is_user_granted_permission(PERM_SEND_EMAIL)) {
                         echo _theme_header(get_opendb_lang_var('send_email'), $HTTP_VARS['inc_menu']);
                         echo "<h2>" . get_opendb_lang_var('send_email') . "</h2>";
                         $from_user_r = fetch_user_r(get_opendb_session_var('user_id'));
                         $HTTP_VARS['toname'] = trim(strip_tags($HTTP_VARS['toname']));
                         if ($HTTP_VARS['op2'] == 'send' && send_email_to_userids(array($HTTP_VARS['uid']), $from_user_r['user_id'], $HTTP_VARS['subject'], $HTTP_VARS['message'], $errors)) {
                             // do nothing
                         } else {
                             show_email_form($HTTP_VARS['uid'], fetch_user_name($HTTP_VARS['uid']), $from_user_r['user_id'], $from_user_r['fullname'], $HTTP_VARS['subject'], $HTTP_VARS['message'], $HTTP_VARS, $errors);
                         }
                         echo _theme_footer();
                     } else {
                         opendb_not_authorised_page(PERM_SEND_EMAIL, $HTTP_VARS);
                     }
                 } else {
                     opendb_operation_not_available();
                 }
             }
         }
     } else {
         opendb_operation_not_available();
     }
 } else {
     // invalid login, so login instead.
Exemplo n.º 6
0
function get_search_query_matrix($HTTP_VARS)
{
    function get_match_type($match)
    {
        if ($match == 'word') {
            return get_opendb_lang_var('word_match');
        } else {
            if ($match == 'partial') {
                return get_opendb_lang_var('partial_match');
            } else {
                if ($match == 'exact') {
                    return get_opendb_lang_var('exact_match');
                } else {
                    return NULL;
                }
            }
        }
    }
    $searches = array();
    if (strlen($HTTP_VARS['title']) > 0) {
        // Default title match is exact match.
        $HTTP_VARS['title_match'] = ifempty($HTTP_VARS['title_match'], 'exact');
        if ($HTTP_VARS['title_match'] == 'word' || $HTTP_VARS['title_match'] == 'partial') {
            if (is_null($HTTP_VARS['title_case'])) {
                $searches[] = array(prompt => get_opendb_lang_var('title') . ' (<em>' . get_match_type($HTTP_VARS['title_match']) . '</em>)', field => $HTTP_VARS['title']);
            } else {
                $searches[] = array(prompt => get_opendb_lang_var('title') . ' (<em>' . get_match_type($HTTP_VARS['title_match']) . ', ' . get_opendb_lang_var('case_sensitive') . '</em>)', field => $HTTP_VARS['title']);
            }
        } else {
            $searches[] = array(prompt => get_opendb_lang_var('title'), field => $HTTP_VARS['title']);
        }
    }
    if (strlen($HTTP_VARS['category']) > 0) {
        // If s_item_type defined, we can get at the s_attribute_type of the category value.
        if (strlen($HTTP_VARS['s_item_type']) > 0) {
            $attribute_type_r = fetch_sfieldtype_item_attribute_type_r($HTTP_VARS['s_item_type'], 'CATEGORY');
            $searches[] = array(prompt => get_opendb_lang_var('category'), field => get_item_display_field(NULL, $attribute_type_r, $HTTP_VARS['category'], FALSE));
        } else {
            $searches[] = array(prompt => get_opendb_lang_var('category'), field => $HTTP_VARS['category']);
        }
    }
    if (strlen($HTTP_VARS['owner_id']) > 0) {
        $username = fetch_user_name($HTTP_VARS['owner_id']);
        if (strlen($username) > 0) {
            $searches[] = array(prompt => get_opendb_lang_var('owner'), field => $username . ' (' . $HTTP_VARS['owner_id'] . ')');
        }
    }
    if (strlen($HTTP_VARS['s_item_type_group']) > 0) {
        $searches[] = array(prompt => get_opendb_lang_var('s_item_type_group'), field => $HTTP_VARS['s_item_type_group']);
    }
    if (is_array($HTTP_VARS['s_item_type'])) {
        $field = '';
        for ($i = 0; $i < count($HTTP_VARS['s_item_type']); $i++) {
            $item_type_r = fetch_item_type_r($HTTP_VARS['s_item_type'][$i]);
            $field .= theme_image($item_type_r['image'], $item_type_r['description'], 's_item_type');
        }
        $searches[] = array(prompt => get_opendb_lang_var('s_item_type'), field => $field);
    } else {
        if (strlen($HTTP_VARS['s_item_type']) > 0) {
            $item_type_r = fetch_item_type_r($HTTP_VARS['s_item_type']);
            $searches[] = array(prompt => get_opendb_lang_var('s_item_type'), field => theme_image($item_type_r['image'], $item_type_r['description'], 's_item_type'));
        }
    }
    if (is_numeric($HTTP_VARS['rating'])) {
        $attribute_type_r = fetch_cached_attribute_type_r('S_RATING');
        $searches[] = array(prompt => $attribute_type_r['prompt'], field => get_display_field($attribute_type_r['s_attribute_type'], NULL, 'review()', $HTTP_VARS['rating'], FALSE));
    }
    $attribute_type_r = NULL;
    if (strlen($HTTP_VARS['attribute_type']) > 0) {
        $attribute_type_r = fetch_cached_attribute_type_r($HTTP_VARS['attribute_type']);
        if (is_not_empty_array($attribute_type_r)) {
            $attribute_type_r['listing_link_ind'] = 'N';
            // Default title match is exact match.
            $HTTP_VARS['attr_match'] = ifempty($HTTP_VARS['attr_match'], 'exact');
            // Special category search, but ignore if category variable actually specified.
            if (strlen($HTTP_VARS['category']) == 0 && strlen($HTTP_VARS['attribute_val']) > 0 && $HTTP_VARS['attr_match'] == 'category') {
                // We do not want the Listing Link to be added to this display field
                $searches[] = array(prompt => $attribute_type_r['prompt'], field => get_item_display_field(NULL, $attribute_type_r, stripslashes($HTTP_VARS['attribute_val']), FALSE));
            } else {
                if (strlen($HTTP_VARS['attribute_val']) > 0) {
                    $HTTP_VARS['attribute_val'] = stripslashes($HTTP_VARS['attribute_val']);
                    if (starts_with($HTTP_VARS['attribute_val'], '"') && ends_with($HTTP_VARS['attribute_val'], '"')) {
                        $HTTP_VARS['attribute_val'] = substr($HTTP_VARS['attribute_val'], 1, -1);
                    }
                    $search = ifempty(get_item_display_field(NULL, $attribute_type_r, $HTTP_VARS['attribute_val'], FALSE), $HTTP_VARS['attribute_val']);
                } else {
                    if (strlen($HTTP_VARS['lookup_attribute_val']) > 0) {
                        $search = get_item_display_field(NULL, $attribute_type_r, stripslashes($HTTP_VARS['lookup_attribute_val']), FALSE);
                    }
                }
                if (!is_lookup_attribute_type($HTTP_VARS['attribute_type']) && $HTTP_VARS['attr_match'] != 'exact') {
                    $searches[] = array(prompt => $attribute_type_r['prompt'] . ' (<em>' . get_match_type($HTTP_VARS['attr_match']) . '</em>)', field => $search);
                } else {
                    $searches[] = array(prompt => $attribute_type_r['prompt'], field => $search);
                }
            }
        }
        //if(is_not_empty_array($attribute_type_r))
    } else {
        if (strlen($HTTP_VARS['attribute_val']) > 0) {
            // specified a search term without attribute type, this is a global search.
            if (is_null($HTTP_VARS['attr_case'])) {
                $searches[] = array(prompt => get_opendb_lang_var('attribute_val') . ' (<em>' . get_match_type(ifempty($HTTP_VARS['attr_match'], 'exact')) . '</em>)', field => stripslashes($HTTP_VARS['attribute_val']));
            } else {
                $searches[] = array(prompt => get_opendb_lang_var('attribute_val') . ' (<em>' . get_match_type(ifempty($HTTP_VARS['attr_match'], 'exact')) . ', ' . get_opendb_lang_var('case_sensitive') . '</em>)', field => stripslashes($HTTP_VARS['attribute_val']));
            }
        }
    }
    // add another search field if update_on value also specified.
    if (strlen($HTTP_VARS['attr_update_on']) > 0) {
        if (is_not_empty_array($attribute_type_r)) {
            $prompt = get_opendb_lang_var('attribute_prompt_updated', array('s_attribute_type' => $attribute_type_r['s_attribute_type'], 'prompt' => $attribute_type_r['prompt']));
        } else {
            $prompt = get_opendb_lang_var('attributes_updated');
        }
        if (strlen($HTTP_VARS['datetimemask']) > 0) {
            $searches[] = array(prompt => $prompt, field => $HTTP_VARS['attr_update_on'] . ' (' . $HTTP_VARS['datetimemask'] . ')');
        } else {
            $searches[] = array(prompt => $prompt, field => $HTTP_VARS['attr_update_on']);
        }
    } else {
        if (is_numeric($HTTP_VARS['attr_update_on_days'])) {
            if (is_not_empty_array($attribute_type_r)) {
                $prompt = get_opendb_lang_var('attribute_prompt_updated', array('s_attribute_type' => $attribute_type_r['s_attribute_type'], 'prompt' => $attribute_type_r['prompt']));
            } else {
                $prompt = get_opendb_lang_var('attributes_updated');
            }
            if ($HTTP_VARS['attr_update_on_days'] == '1') {
                $field = get_opendb_lang_var('one_day_ago');
            } else {
                if ($HTTP_VARS['attr_update_on_days'] == '7') {
                    $field = get_opendb_lang_var('one_week_ago');
                } else {
                    if ($HTTP_VARS['attr_update_on_days'] == '28') {
                        $field = get_opendb_lang_var('one_month_ago');
                    } else {
                        if ($HTTP_VARS['attr_update_on_days'] == '365') {
                            $field = get_opendb_lang_var('one_year_ago');
                        }
                    }
                }
            }
            $searches[] = array(prompt => $prompt, field => $field);
        }
    }
    if (strlen($HTTP_VARS['update_on']) > 0) {
        if (strlen($HTTP_VARS['datetimemask']) > 0) {
            $searches[] = array(prompt => get_opendb_lang_var('updated'), field => $HTTP_VARS['update_on'] . ' (' . $HTTP_VARS['datetimemask'] . ')');
        } else {
            $searches[] = array(prompt => get_opendb_lang_var('updated'), field => $HTTP_VARS['update_on']);
        }
    } else {
        if (is_numeric($HTTP_VARS['update_on_days'])) {
            if ($HTTP_VARS['update_on_days'] == '1') {
                $field = get_opendb_lang_var('one_day_ago');
            } else {
                if ($HTTP_VARS['update_on_days'] == '7') {
                    $field = get_opendb_lang_var('one_week_ago');
                } else {
                    if ($HTTP_VARS['update_on_days'] == '28') {
                        $field = get_opendb_lang_var('one_month_ago');
                    } else {
                        if ($HTTP_VARS['update_on_days'] == '365') {
                            $field = get_opendb_lang_var('one_year_ago');
                        }
                    }
                }
            }
            $searches[] = array(prompt => get_opendb_lang_var('updated'), field => $field);
        }
    }
    if (is_not_empty_array($HTTP_VARS['s_status_type']) > 0) {
        $search = '';
        for ($i = 0; $i < count($HTTP_VARS['s_status_type']); $i++) {
            if (strlen($search) > 0) {
                $search .= ' ';
            }
            $status_type_r = fetch_status_type_r($HTTP_VARS['s_status_type'][$i]);
            if (is_not_empty_array($status_type_r)) {
                $search .= format_display_value('%img%', $status_type_r['img'], 'Y', $status_type_r['description'], 's_status_type');
            }
        }
        if (strlen($search) > 0) {
            $searches[] = array(prompt => get_opendb_lang_var('s_status_type'), field => $search);
        }
    }
    if (strlen($HTTP_VARS['status_comment']) > 0) {
        // Default status_comment match is exact match.
        $HTTP_VARS['status_comment_match'] = ifempty($HTTP_VARS['status_comment_match'], 'exact');
        if ($HTTP_VARS['status_comment_match'] == 'word' || $HTTP_VARS['status_comment_match'] == 'partial' || $HTTP_VARS['status_comment_match'] == 'exact') {
            if (is_null($HTTP_VARS['status_comment_case'])) {
                $searches[] = array(prompt => get_opendb_lang_var('status_comment') . ' (<em>' . get_match_type($HTTP_VARS['status_comment_match']) . '</em>)', field => $HTTP_VARS['status_comment']);
            } else {
                $searches[] = array(prompt => get_opendb_lang_var('status_comment') . ' (<em>' . get_match_type($HTTP_VARS['status_comment_match']) . ', ' . get_opendb_lang_var('case_sensitive') . '</em>)', field => $HTTP_VARS['status_comment']);
            }
        } else {
            $searches[] = array(prompt => get_opendb_lang_var('status_comment'), field => $HTTP_VARS['status_comment']);
        }
    }
    if (is_numeric($HTTP_VARS['interest_level']) && $HTTP_VARS['interest_level'] > 0) {
        $searches[] = array(prompt => get_opendb_lang_var('interest'), field => theme_image("interest_1.gif", get_opendb_lang_var('interest'), 's_item_type'));
    }
    return $searches;
}
Exemplo n.º 7
0
function get_item_review_block($item_r)
{
    $buffer .= "<h3>" . get_opendb_lang_var('review(s)') . "</h3>";
    $result = fetch_review_rs($item_r['item_id']);
    if ($result) {
        $buffer .= "<ul>";
        while ($review_r = db_fetch_assoc($result)) {
            $action_links = NULL;
            $buffer .= "<li>";
            // even if already review author its possible to revoke rights to
            // edit / modify own reviews by revoking the PERM_USER_REVIEWER grant!
            if (is_user_granted_permission(PERM_ADMIN_REVIEWER) || is_user_granted_permission(PERM_USER_REVIEWER) && is_review_author($review_r['sequence_number'])) {
                $action_links_rs = NULL;
                if (get_opendb_config_var('item_review', 'update_support') !== FALSE) {
                    $action_links[] = array(url => "item_review.php?op=edit&sequence_number=" . $review_r['sequence_number'] . "&item_id=" . $item_r['item_id'] . "&instance_no=" . $item_r['instance_no'], text => get_opendb_lang_var('edit'));
                }
                if (get_opendb_config_var('item_review', 'delete_support') !== FALSE) {
                    $action_links[] = array(url => "item_review.php?op=delete&sequence_number=" . $review_r['sequence_number'] . "&item_id=" . $item_r['item_id'] . "&instance_no=" . $item_r['instance_no'], text => get_opendb_lang_var('delete'));
                }
                $buffer .= format_footer_links($action_links);
            }
            $buffer .= "<p class=\"author\">";
            $buffer .= get_opendb_lang_var('on_date_name_wrote_the_following', array('date' => get_localised_timestamp(get_opendb_config_var('item_display', 'review_datetime_mask'), $review_r['update_on']), 'fullname' => fetch_user_name($review_r['author_id']), 'user_id' => $review_r['author_id']));
            $buffer .= "</p>";
            $buffer .= "<p class=\"comments\">" . nl2br(trim($review_r['comment']));
            if ($review_r['item_id'] != $item_r['item_id']) {
                $buffer .= "<span class=\"reference\">" . get_opendb_lang_var('review_for_item_type_title', array('s_item_type' => $review_r['s_item_type'], 'item_id' => $review_r['item_id'])) . "</span>";
            }
            $buffer .= "</p>";
            $average = $review_r['rating'];
            $attribute_type_r = fetch_attribute_type_r("S_RATING");
            $buffer .= "<span class=\"rating\">" . get_display_field($attribute_type_r['s_attribute_type'], NULL, 'review()', $average, FALSE) . "</span>";
            $buffer .= "</li>";
        }
        //while
        $buffer .= "</ul>";
    } else {
        $buffer .= '<p>' . get_opendb_lang_var('no_item_reviews') . '</p>';
    }
    $action_links = NULL;
    if (is_user_granted_permission(PERM_USER_REVIEWER)) {
        $action_links[] = array(url => "item_review.php?op=add&item_id=" . $item_r['item_id'] . "&instance_no=" . $item_r['instance_no'], text => get_opendb_lang_var('review'));
        $buffer .= format_footer_links($action_links);
    }
    return $buffer;
}
Exemplo n.º 8
0
         $page_title = get_opendb_lang_var('type_export_for_name_item_type', array('description' => $exportPlugin->get_display_name(), 'fullname' => fetch_user_name($HTTP_VARS['owner_id']), 'user_id' => $HTTP_VARS['owner_id'], 's_item_type' => $HTTP_VARS['s_item_type']));
     } else {
         if (strlen($HTTP_VARS['s_item_type']) > 0) {
             $page_title = get_opendb_lang_var('type_export_for_item_type', array('description' => $exportPlugin->get_display_name(), 's_item_type' => $HTTP_VARS['s_item_type']));
         } else {
             if (is_numeric($HTTP_VARS['item_id']) && is_numeric($HTTP_VARS['instance_no'])) {
                 $item_r = fetch_item_instance_r($HTTP_VARS['item_id'], $HTTP_VARS['instance_no']);
                 $page_title = get_opendb_lang_var('type_export_for_item_instance', array('description' => $exportPlugin->get_display_name(), 'item_id' => $HTTP_VARS['item_id'], 'instance_no' => $HTTP_VARS['instance_no'], 'title' => $titleMaskCfg->expand_item_title($item_r)));
             } else {
                 if (is_numeric($HTTP_VARS['item_id'])) {
                     // Not really a child item, but we are not interested in the instance, so use this.  It still
                     // returns the right data anyway.
                     $item_r = fetch_child_item_r($HTTP_VARS['item_id']);
                     $page_title = get_opendb_lang_var('type_export_for_item', array('description' => $exportPlugin->get_display_name(), 'item_id' => $HTTP_VARS['item_id'], 'title' => $titleMaskCfg->expand_item_title($item_r)));
                 } else {
                     $page_title = get_opendb_lang_var('type_export_for_name', array('description' => $exportPlugin->get_display_name(), 'fullname' => fetch_user_name($HTTP_VARS['owner_id']), 'user_id' => $HTTP_VARS['owner_id']));
                 }
             }
         }
     }
 } else {
     //if(strlen($HTTP_VARS['owner_id'])>0 || is_numeric($HTTP_VARS['item_id']))
     $page_title = get_opendb_lang_var('type_export', array('description' => $exportPlugin->get_display_name()));
 }
 @set_time_limit(600);
 if (!export_type_items($exportPlugin, $page_title, $HTTP_VARS['s_item_type'], $HTTP_VARS['item_id'], $HTTP_VARS['instance_no'], $HTTP_VARS['owner_id'], $HTTP_VARS['s_status_type'])) {
     echo _theme_header($page_title);
     echo "<h2>" . $page_title . "</h2>";
     echo format_error_block(array('error' => get_opendb_lang_var('no_records_found'), 'detail' => ''));
     echo _theme_footer();
 }
Exemplo n.º 9
0
                         echo _theme_header(get_opendb_lang_var('undefined_error'));
                         echo "<p class=\"error\">" . get_opendb_lang_var('undefined_error') . " (" . $import_cache_r['plugin_name'] . ")</p>";
                         echo _theme_footer();
                     }
                 } else {
                     //if(is_not_empty_array($import_cache_r))
                     echo _theme_header(get_opendb_lang_var('import_cache_file_not_found'));
                     echo "<p class=\"error\">" . get_opendb_lang_var('import_cache_file_not_found') . "</p>";
                     echo _theme_footer();
                 }
             } else {
                 if (strlen($HTTP_VARS['owner_id']) > 0) {
                     if (strcmp($HTTP_VARS['owner_id'], get_opendb_session_var('user_id')) === 0) {
                         $page_title = get_opendb_lang_var('import_my_items');
                     } else {
                         $page_title = get_opendb_lang_var('import_items_for_name', array('fullname' => fetch_user_name($HTTP_VARS['owner_id']), 'user_id' => $HTTP_VARS['owner_id']));
                     }
                 } else {
                     $page_title = get_opendb_lang_var('import_items');
                 }
                 echo _theme_header($page_title);
                 echo "<h2>" . $page_title . "</h2>";
                 echo get_upload_form($HTTP_VARS);
                 echo _theme_footer();
             }
         }
     }
 } else {
     // if(is_file_upload_enabled() && import_check_is_installed())
     if (is_file_upload_enabled()) {
         echo _theme_header(get_opendb_lang_var('import_not_available'));
Exemplo n.º 10
0
/**
 * Will work out based on the $op what the title should be.  It will
 * return a complete heading, including calling the _theme_header
 * and everything.
 */
function do_op_title($item_r, $status_type_r, $op)
{
    global $titleMaskCfg;
    global $HTTP_VARS;
    // hack
    if ($op == 'new' || $op == 'site' || $op == 'site-search' || $op == 'insert') {
        if ($item_r['owner_id'] != get_opendb_session_var('user_id')) {
            $item_title = get_opendb_lang_var('add_new_item_for_name', array('user_id' => $item_r['owner_id'], 'fullname' => fetch_user_name($item_r['owner_id'])));
        } else {
            $item_title = get_opendb_lang_var('add_new_item');
        }
    } else {
        if ($op == 'update' || $op == 'delete' || $op == 'delete_related') {
            $item_title = get_opendb_lang_var($op . '_item');
        } else {
            if ($op == 'refresh' || $op == 'edit' || $op == 'clone_item') {
                if ($op == 'clone_item') {
                    $op = 'clone';
                }
                $item_title = get_opendb_lang_var($op . '_title', array('display_title' => $titleMaskCfg->expand_item_title($item_r)));
            } else {
                if ($op == 'newinstance') {
                    // temporarily remove instance_no so that title renders correctly.
                    $item_r['instance_no'] = NULL;
                    $item_title = get_opendb_lang_var('new_item_instance_title', array('display_title' => $titleMaskCfg->expand_item_title($item_r)));
                }
            }
        }
    }
    echo _theme_header($item_title, $HTTP_VARS['inc_menu']);
    echo "<h2>" . $item_title . " " . get_item_image($item_r['s_item_type']) . "</h2>\n";
}
Exemplo n.º 11
0
 function addUserNameColumn($user_id, $extra_http_vars = NULL)
 {
     $this->_row_column_rs[] = array(column_type => 'username', user_id => $user_id, fullname => fetch_user_name($user_id), extra_http_vars => $extra_http_vars);
 }
Exemplo n.º 12
0
/**
   The $borrow_item_r array format:
       $item_r
       $details
*/
function send_notification_email($to_user, $from_user, $heading, $introduction, $more_information, $item_entry_rs, &$errors)
{
    // Format the entire message.
    $message = get_opendb_lang_var('to_user_email_intro', 'fullname', fetch_user_name($to_user)) . "\n\n" . $introduction;
    while (list(, $item_entry_r) = each($item_entry_rs)) {
        $message .= "\n*    " . $item_entry_r['display_title'];
        // Add any item Borrow (overdue,due,reminder,etc) details here.
        while (list(, $detail) = @each($item_entry_r['detail'])) {
            $message .= "\n     - " . $detail;
        }
    }
    if (strlen($more_information) > 0) {
        $message .= "\n\n\n" . $more_information . "\n";
    }
    // Send the mail!
    return opendb_user_email($to_user, $from_user, $heading, $message, $errors);
}