Example #1
0
/**
 * Generate URL tag for graphic in current theme; if graphic is not available the graphic in the default theme will be returned.
 *
 * @param RequestHTTP $po_request
 * @param string $ps_file_path
 * @param array $pa_options
 * @return string 
 */
function caGetThemeGraphicURL($po_request, $ps_file_path, $pa_options = null)
{
    $vs_base_path = $po_request->getThemeUrlPath();
    $vs_file_path = '/assets/pawtucket/graphics/' . $ps_file_path;
    if (!file_exists($po_request->getThemeDirectoryPath() . $vs_file_path)) {
        $vs_base_path = $po_request->getDefaultThemeUrlPath();
    }
    return $vs_base_path . $vs_file_path;
}
/**
 * Formats communication for display in messages list
 *
 * @param RequestHTTP $po_request
 * @param array $pa_data
 * @param array $pa_options
 *		viewContentDivID = 
 *		additionalMessages =
 *		isAdditionalMessage =
 *
 * @return string 
 */
function caClientServicesFormatMessageSummary($po_request, $pa_data, $pa_options = null)
{
    $vb_is_additional_message = (bool) (isset($pa_options['isAdditionalMessage']) && $pa_options['isAdditionalMessage']);
    $vb_is_unread = !(bool) $pa_data['read_on'];
    $vs_unread_class = $vb_is_unread ? "caClientCommunicationsMessageSummaryUnread" : "";
    if ($pa_data['source'] == __CA_COMMERCE_COMMUNICATION_SOURCE_INSTITUTION__) {
        $vb_is_unread = false;
        $vs_unread_class = '';
    }
    // institution-sent messages are never unread in Providence
    if ($vb_is_additional_message) {
        $vs_class = $vb_is_unread ? "caClientCommunicationsAdditionalMessageSummary caClientCommunicationsMessageSummaryUnread" : "caClientCommunicationsAdditionalMessageSummary";
        $vs_buf = "<div class='{$vs_class}' id='caClientCommunicationsMessage_" . $pa_data['communication_id'] . "'>";
    } else {
        $vs_class = $vb_is_unread ? "caClientCommunicationsMessageSummary caClientCommunicationsMessageSummaryUnread" : "caClientCommunicationsMessageSummary";
        $vs_buf = "<div class='{$vs_class}'>";
    }
    $vs_buf .= "<div class='caClientCommunicationsMessageSummaryContainer' id='caClientCommunicationsMessage_" . $pa_data['communication_id'] . "'>";
    $vs_buf .= "<div class='caClientCommunicationsViewMessageIcon'>+</div>";
    TooltipManager::add(".caClientCommunicationsViewMessageIcon", _t("View entire message and associated media"));
    $vs_buf .= "<div class='caClientCommunicationsMessageSummaryFrom {$vs_unread_class}'><span class='caClientCommunicationsMessageSummaryHeading'>" . _t("From") . ":</span> " . caClientServicesGetSenderName($pa_data);
    $vs_buf .= $vb_is_unread ? " <img src='" . $po_request->getThemeUrlPath() . "/graphics/icons/envelope.gif' border='0'>" : "";
    $vs_buf .= "</div>";
    $vs_buf .= "<div class='caClientCommunicationsMessageSummaryDate {$vs_unread_class}'><span class='caClientCommunicationsMessageSummaryHeading'>" . _t("Date") . ":</span> " . caGetLocalizedDate($pa_data['created_on'], array('dateFormat' => 'delimited')) . "</div>";
    $vs_buf .= "<div class='caClientCommunicationsMessageSummarySubject {$vs_unread_class}'><span class='caClientCommunicationsMessageSummaryHeading'>" . _t("Subject") . ":</span> " . $pa_data['subject'] . "</div>";
    $vs_buf .= "<div class='caClientCommunicationsMessageSummaryText'>" . (mb_strlen($pa_data['message']) > 100 ? mb_substr($pa_data['message'], 0, 100) . "..." : $pa_data['message']) . "</div>";
    $vn_num_additional_messages = is_array($pa_options['additionalMessages']) ? sizeof($pa_options['additionalMessages']) : 0;
    // are there orders linked to this thread?
    if ($vn_num_orders = sizeof($va_order_ids = ca_commerce_orders::getOrderIDsForTransaction($pa_data['transaction_id']))) {
        $vs_buf .= "<div class='caClientCommunicationsMessageSummaryThreadButton'>" . caNavLink($po_request, ($vn_num_orders == 1 ? _t('%1 order', $vn_num_orders) : _t('%1 orders', $vn_num_orders)) . " &rsaquo;", 'button', 'client', 'Orders', 'Index', array('transaction_id' => $pa_data['transaction_id'])) . "</div>\n";
    }
    if ($vn_num_additional_messages) {
        $vs_buf .= "<div class='caClientCommunicationsMessageSummaryThreadButton' id='caClientCommunicationsMessageAdditionalCount" . $pa_data['communication_id'] . "'><a href='#' onclick='jQuery(\"#caClientCommunicationsMessageAdditional" . $pa_data['communication_id'] . "\").slideToggle(250, function(){ if(jQuery(\"#caClientCommunicationsMessageViewThread" . $pa_data['communication_id'] . "\").html() == \"" . _t("view thread") . " &rsaquo;\") {jQuery(\"#caClientCommunicationsMessageViewThread" . $pa_data['communication_id'] . "\").html(\"" . _t("hide thread") . " &rsaquo;\")}else{jQuery(\"#caClientCommunicationsMessageViewThread" . $pa_data['communication_id'] . "\").html(\"" . _t("view thread") . " &rsaquo;\")}}); return false;' id='caClientCommunicationsMessageViewThread" . $pa_data['communication_id'] . "' class='button'>" . _t("view thread") . " &rsaquo;</a></div>\n";
    }
    $vs_buf .= "</div>";
    if ($vn_num_additional_messages) {
        $vs_buf .= "<div class='caClientCommunicationsMessageAdditional' id='caClientCommunicationsMessageAdditional" . $pa_data['communication_id'] . "'>";
        $pa_additional_options = $pa_options;
        unset($pa_additional_options['additionalMessages']);
        $pa_additional_options['isAdditionalMessage'] = true;
        foreach ($pa_options['additionalMessages'] as $va_additional_message) {
            $vs_buf .= caClientServicesFormatMessageSummary($po_request, $va_additional_message, $pa_additional_options);
        }
        $vs_buf .= "</div>";
    }
    $vs_buf .= "</div>\n";
    return $vs_buf;
}
Example #3
0
/**
 * Generates sort control HTML for relation bundles (Eg. ca_entities, ca_occurrences)
 *
 * @param RequestHTTP $po_request
 * @param string $ps_id_prefix
 * @param array $pa_settings
 * 
 * @return string HTML implementing the control
 */
function caEditorBundleSortControls($po_request, $ps_id_prefix, $pa_settings)
{
    $vs_buf = "\t<div class=\"caItemListSortControlContainer\">\n\t\t<div class=\"caItemListSortControlTrigger\" id=\"{$ps_id_prefix}caItemListSortControlTrigger\">\n\t\t\t" . _t('Sort by') . " <img src=\"" . $po_request->getThemeUrlPath() . "/graphics/icons/bg.gif\" alt=\"Sort\"/>\n\t\t</div>\n\t\t<div class=\"caItemListSortControls\" id=\"{$ps_id_prefix}caItemListSortControls\">\n\t\t\t<ul>\n\t\t\t\t<li><a href=\"#\" onclick=\"caRelationBundle{$ps_id_prefix}.sort('name'); return false;\" class=\"caItemListSortControl\">" . _t('name') . "</a><br/></li>\n\t\t\t\t<li><a href=\"#\" onclick=\"caRelationBundle{$ps_id_prefix}.sort('idno'); return false;\" class=\"caItemListSortControl\">" . _t('idno') . "</a><br/></li>\n\t\t\t\t<li><a href=\"#\" onclick=\"caRelationBundle{$ps_id_prefix}.sort('type'); return false;\" class=\"caItemListSortControl\">" . _t('type') . "</a><br/></li>\n\t\t\t\t<li><a href=\"#\" onclick=\"caRelationBundle{$ps_id_prefix}.sort('entry'); return false;\" class=\"caItemListSortControl\">" . _t('entry') . "</a><br/></li>\n\t\t\t</ul>\n\t\t</div>\n\t</div>";
    return $vs_buf;
}