コード例 #1
0
function caCreateBatchMediaImportResultsReport($po_request, $pa_general, $pa_notices, $pa_errors)
{
    $vs_buf = '';
    if (is_array($pa_errors) && sizeof($pa_errors)) {
        $vs_buf .= '<div class="batchProcessingReportSectionHead">' . _t('Errors occurred') . ':</div><ul>';
        foreach ($pa_errors as $vs_f => $va_error) {
            $vs_buf .= "<li><em>[{$vs_f}]:</em> " . $va_error['message'] . "</li>";
        }
        $vs_buf .= "</ul>";
    }
    if (is_array($pa_notices) && sizeof($pa_notices)) {
        $vs_buf .= '<div class="batchProcessingReportSectionHead">' . _t('Processed') . ':</div><ol>';
        foreach ($pa_notices as $vn_id => $va_notice) {
            switch ($va_notice['status']) {
                case 'SUCCESS':
                    $vs_buf .= "<li><em>" . caEditorLink($po_request, $va_notice['label'], '', $pa_general['table'], $vn_id) . "</em> (" . $va_notice['idno'] . "): " . $va_notice['status'] . "</li>";
                    break;
                case 'SKIPPED':
                case 'MATCHED':
                case 'RELATED':
                    $vs_buf .= "<li><em>" . $va_notice['label'] . "</em>: " . $va_notice['message'] . "</li>";
                    break;
                default:
                    $vs_buf .= "<li><em>" . $va_notice['label'] . "</em> (" . $va_notice['idno'] . "): " . $va_notice['status'] . "</li>";
                    break;
            }
        }
        $vs_buf .= "</ol>";
    }
    if ($pa_general['set_id']) {
        $vs_buf .= caNavButton($po_request, __CA_NAV_BUTTON_BATCH_EDIT__, _t('Batch edit'), 'batch', 'Editor', 'Edit', array('set_id' => $pa_general['set_id']), array(), array('icon_position' => __CA_NAV_BUTTON_ICON_POS_LEFT__, 'use_class' => 'list-button', 'no_background' => true, 'dont_show_content' => true)) . ' ' . _t('Batch edit set <em>%1</em> containing imported media', caNavLink($po_request, $pa_general['setName'], '', 'batch', 'Editor', 'Edit', array('set_id' => $pa_general['set_id'])));
    }
    print "<script type='text/javascript'>";
    print "jQuery('#batchProcessingMediaPreview').hide();";
    print "jQuery('#batchProcessingReport').html('" . addslashes($vs_buf) . "').fadeIn(300);";
    print "jQuery('#batchProcessingMore').fadeIn(300);";
    print "</script>";
    caFlushOutput();
}
コード例 #2
0
function caCreateBatchEditorResultsReport($po_request, $pa_general, $pa_notices, $pa_errors)
{
    $vs_buf = '';
    if (is_array($pa_errors) && sizeof($pa_errors)) {
        $vs_buf .= '<div class="batchProcessingReportSectionHead">' . _t('Errors occurred') . ':</div><ul>';
        foreach ($pa_errors as $vn_id => $va_error) {
            $va_error_list = array();
            foreach ($va_error['errors'] as $o_error) {
                $va_error_list[] = $o_error->getErrorDescription();
            }
            $vs_buf .= "<li><em>" . caEditorLink($po_request, $va_error['label'], '', $pa_general['table'], $vn_id) . "</em> (" . $va_error['idno'] . "): " . join("; ", $va_error_list) . "</li>";
        }
        $vs_buf .= "</ul>";
        $vs_buf .= '<div class="batchProcessingReportSectionWarning">' . (sizeof($pa_errors) == 1 ? _t('Note: <strong>NO</strong> batch changes were saved due to the error.') : _t('Note: <strong>NO</strong> batch changes were saved due to %1 errors.', sizeof($pa_errors))) . "</div>";
    }
    if (is_array($pa_notices) && sizeof($pa_notices)) {
        $vs_buf .= '<div class="batchProcessingReportSectionHead">' . _t('Processed successfully') . ':</div><ol>';
        foreach ($pa_notices as $vn_id => $va_notice) {
            $vs_buf .= "<li><em>" . caEditorLink($po_request, preg_replace("![\r\n\t]+!", " ", $va_notice['label']), '', $pa_general['table'], $vn_id) . "</em> (" . $va_notice['idno'] . "): " . $va_notice['status'] . "</li>";
        }
        $vs_buf .= "</ol>";
    }
    print "<script type='text/javascript'>";
    print "jQuery('#batchProcessingReport').html('" . addslashes($vs_buf) . "').fadeIn(300);";
    print "jQuery('#batchProcessingMore').fadeIn(300);";
    print "</script>";
    caFlushOutput();
}
コード例 #3
0
?>
<div class="dashboardWidgetContentContainer">
<?php 
if (sizeof($va_watched_items) > 0) {
    print '<div class="dashboardWidgetScrollMedium"><ul>';
    ?>
			<form id="watchedItemsForm"><input type="hidden" name="mode" value="list">
<?php 
    foreach ($va_watched_items as $va_item) {
        $vs_idno = "";
        if ($va_item["idno"]) {
            $vs_idno = "[" . $va_item["idno"] . "] ";
        }
        print "<li><input type='checkbox' name='watch_id[]' value='" . $va_item["watch_id"] . "'> ";
        if ($va_item["primary_key"]) {
            print "<span style='font-size:12px; font-weight:bold;'>" . caEditorLink($po_request, $vs_idno . $va_item["displayName"], '', $va_item["table_name"], $va_item["row_id"]) . "</span>";
            print "<br/>&nbsp;&nbsp;&nbsp;<a href='#' id='moreWatchItem" . $va_item["watch_id"] . "' onclick='jQuery(\"#moreWatchItem" . $va_item["watch_id"] . "\").hide(); jQuery(\"#watchItem" . $va_item["watch_id"] . "\").slideDown(250); return false;'>" . _t("Recent Changes") . " &rsaquo;</a>";
            print "<div style='display:none; margin-right:5px;' id='watchItem" . $va_item["watch_id"] . "'>";
            print $va_item["change_log"];
            print "<a href='#' id='hideWatchItem" . $va_item["watch_id"] . "' style='padding-left:10px;' onclick='jQuery(\"#watchItem" . $va_item["watch_id"] . "\").slideUp(250); jQuery(\"#moreWatchItem" . $va_item["watch_id"] . "\").show(); return false;'>" . _t('Hide') . " &rsaquo;</a>";
            print "</div>";
        } else {
            print _t("Item was deleted - row_id: %1; table number: %2", $va_item["row_id"], $va_item["table_num"]);
        }
        print "</li>";
    }
    print '</ul></div>';
    ?>
			<div style="padding-top:10px; text-align:center; padding-right:20px;">
				<a href='#' onclick='jQuery("#watchedItemsForm").attr("action", "<?php 
    print caNavUrl($po_request, 'manage', 'WatchedItems', 'Delete');
コード例 #4
0
function caUpdateBatchMetadataImportResultsReport($po_request, $pa_general, $pa_errors, $pb_done = false)
{
    $vs_buf = '';
    if (is_array($pa_errors) && sizeof($pa_errors)) {
        $vs_buf .= '<div class="batchProcessingReportSectionHead">' . _t('Errors during import') . ':</div><ul>';
        foreach ($pa_errors as $vn_i => $vs_error_message) {
            $vs_buf .= "<li>{$vs_error_message}</li>";
        }
        $vs_buf .= "</ul>";
    }
    if (is_array($pa_notices) && sizeof($pa_notices)) {
        $vs_buf .= '<div class="batchProcessingReportSectionHead">' . _t('Processed') . ':</div><ol>';
        foreach ($pa_notices as $vn_id => $va_notice) {
            switch ($va_notice['status']) {
                case 'SUCCESS':
                    $vs_buf .= "<li><em>" . caEditorLink($po_request, $va_notice['label'], '', $pa_general['table'], $vn_id) . "</em> (" . $va_notice['idno'] . "): " . $va_notice['status'] . "</li>";
                    break;
                case 'SKIPPED':
                case 'MATCHED':
                    $vs_buf .= "<li><em>" . $va_notice['label'] . "</em>: " . $va_notice['message'] . "</li>";
                    break;
                default:
                    $vs_buf .= "<li><em>" . $va_notice['label'] . "</em> (" . $va_notice['idno'] . "): " . $va_notice['status'] . "</li>";
                    break;
            }
        }
        $vs_buf .= "</ol>";
    }
    print "<script type='text/javascript'>";
    print "jQuery('#batchProcessingReport').html('" . addslashes($vs_buf) . "').show();";
    if ($pb_done) {
        print "jQuery('#batchProcessingMore').fadeIn(300);";
    }
    print "</script>";
    caFlushOutput();
}
コード例 #5
0
ファイル: displayHelpers.php プロジェクト: ffarago/pawtucket2
/**
 * Creates links to the appropriate editor (in Providence) or detail page (in Pawtucket) from supplied text and ids.
 * Used in SearchResult::get() and BundlableLabelableBaseModelWithAttributes::get() to automatically generate links when fetching
 * information from related tables.
 *
 * @param array $pa_text An array of strings to create links for
 * @param string $ps_table_name The name of the table/record to which the links refer
 * @param array $pa_row_ids Array of row_ids to link to. Values must correspond by index with those in $pa_text
 * @param string $ps_class Optional CSS class to apply to links
 * @param array $pa_options Supported options are:
 *		requireLinkTags = if set then links are only added when explicitly defined with <l> tags. Default is to make the entire text a link in the absence of <l> tags.
 *
 * @return array A list of HTML links
 */
function caCreateLinksFromText($pa_text, $ps_table_name, $pa_row_ids, $ps_class = null, $ps_target = null, $pa_options = null)
{
    if (!in_array(__CA_APP_TYPE__, array('PROVIDENCE', 'PAWTUCKET'))) {
        return $pa_text;
    }
    if (__CA_APP_TYPE__ == 'PAWTUCKET') {
        $o_config = Configuration::load();
    }
    $vb_can_handle_target = false;
    if ($ps_target) {
        $o_app_plugin_manager = new ApplicationPluginManager();
        $vb_can_handle_target = $o_app_plugin_manager->hookCanHandleGetAsLinkTarget(array('target' => $ps_target));
    }
    // Parse template
    $o_dom = new DOMDocument('1.0', 'utf-8');
    $o_dom->preserveWhiteSpace = true;
    libxml_use_internal_errors(true);
    // don't reported mangled HTML errors
    $o_dm = Datamodel::load();
    $va_links = $va_type_ids = array();
    if ($t_instance = $o_dm->getInstanceByTableName($ps_table_name)) {
        $va_type_ids = $t_instance->getFieldValuesForIDs($pa_row_ids, array('type_id'));
        //if (caUseIdentifiersInUrls()) {
        //	$pa_row_ids = array_values($t_instance->getFieldValuesForIDs($pa_row_ids, array($t_instance->getProperty('ID_NUMBERING_ID_FIELD'))));
        //}
    }
    global $g_request;
    if (!$g_request) {
        return $pa_text;
    }
    foreach ($pa_text as $vn_i => $vs_text) {
        $vs_text = preg_replace("!([A-Za-z0-9]+)='([^']*)'!", "\$1=\"\$2\"", $vs_text);
        // DomDcoument converts single quotes around attributes to double quotes so we do the same to the template
        $vs_text = preg_replace("![ ]+/>!", "/>", $vs_text);
        // DomDocument removes spaces before the end of self-closing tags so we do the same here to the template
        $o_dom->loadHTML('<?xml encoding="utf-8">' . $vs_text);
        // Needs XML declaration to force it to consider the text as UTF-8. Please don't ask why. No one knows.
        libxml_clear_errors();
        $va_l_tags = array();
        $o_links = $o_dom->getElementsByTagName("l");
        // l=link
        foreach ($o_links as $o_link) {
            if (!$o_link) {
                continue;
            }
            $vs_html = $o_dom->saveXML($o_link);
            $vs_content = preg_replace("!^<[^\\>]+>!", "", $vs_html);
            $vs_content = preg_replace("!<[^\\>]+>\$!", "", $vs_content);
            $va_l_tags[] = array('directive' => html_entity_decode($vs_html), 'content' => $vs_content);
        }
        if (sizeof($va_l_tags)) {
            $vs_content = $vs_text;
            foreach ($va_l_tags as $va_l) {
                if ($vb_can_handle_target) {
                    $va_params = array('request' => $g_request, 'content' => $va_l['content'], 'table' => $ps_table_name, 'id' => $pa_row_ids[$vn_i], 'classname' => $ps_class, 'target' => $ps_target, 'additionalParameters' => null, 'options' => null);
                    $va_params = $o_app_plugin_manager->hookGetAsLink($va_params);
                    $vs_link_text = $va_params['tag'];
                } else {
                    switch (__CA_APP_TYPE__) {
                        case 'PROVIDENCE':
                            $vs_link_text = caEditorLink($g_request, $va_l['content'], $ps_class, $ps_table_name, $pa_row_ids[$vn_i]);
                            break;
                        case 'PAWTUCKET':
                            $vs_link_text = caDetailLink($g_request, $va_l['content'], $ps_class, $ps_table_name, $pa_row_ids[$vn_i], array(), array(), array('type_id' => $va_type_ids[$pa_row_ids[$vn_i]]));
                            break;
                    }
                }
                if ($vs_link_text) {
                    $vs_content = str_replace($va_l['directive'], $vs_link_text, $vs_content);
                } else {
                    $vs_content = str_replace($va_l['directive'], $va_l['content'], $vs_content);
                }
            }
            $va_links[] = $vs_content;
        } else {
            if (isset($pa_options['requireLinkTags']) && $pa_options['requireLinkTags']) {
                $va_links[] = $vs_text;
                continue;
            }
            if ($vb_can_handle_target) {
                $va_params = array('request' => $g_request, 'content' => $vs_text, 'table' => $ps_table_name, 'id' => $pa_row_ids[$vn_i], 'classname' => $ps_class, 'target' => $ps_target, 'additionalParameters' => null, 'options' => null);
                $va_params = $o_app_plugin_manager->hookGetAsLink($va_params);
                $va_links[] = $va_params['tag'];
            } else {
                switch (__CA_APP_TYPE__) {
                    case 'PROVIDENCE':
                        $va_links[] = ($vs_link = caEditorLink($g_request, $vs_text, $ps_class, $ps_table_name, $pa_row_ids[$vn_i])) ? $vs_link : $vs_text;
                        break;
                    case 'PAWTUCKET':
                        $va_links[] = ($vs_link = caDetailLink($g_request, $vs_text, $ps_class, $ps_table_name, $pa_row_ids[$vn_i], array(), array(), array('type_id' => $va_type_ids[$pa_row_ids[$vn_i]]))) ? $vs_link : $vs_text;
                        break;
                    default:
                        $va_links[] = $vs_text;
                        break;
                }
            }
        }
    }
    return $va_links;
}
コード例 #6
0
ファイル: displayHelpers.php プロジェクト: kai-iak/providence
/**
 * Creates links to the appropriate editor (in Providence) or detail page (in Pawtucket) from supplied text and ids.
 * Used in SearchResult::get() and BundlableLabelableBaseModelWithAttributes::get() to automatically generate links when fetching
 * information from related tables.
 *
 * @param array $pa_text An array of strings to create links for
 * @param string $ps_table_name The name of the table/record to which the links refer
 * @param array $pa_row_ids Array of row_ids to link to. Values must correspond by index with those in $pa_text
 * @param string $ps_class Optional CSS class to apply to links
 * @param string $ps_target
 * @param array $pa_options Supported options are:
 *		requireLinkTags = if set then links are only added when explicitly defined with <l> tags. Default is to make the entire text a link in the absence of <l> tags.
 * 		addRelParameter =
 *
 * @return array A list of HTML links
 */
function caCreateLinksFromText($pa_text, $ps_table_name, $pa_row_ids, $ps_class = null, $ps_target = null, $pa_options = null)
{
    if (!in_array(__CA_APP_TYPE__, array('PROVIDENCE', 'PAWTUCKET'))) {
        return $pa_text;
    }
    if (__CA_APP_TYPE__ == 'PAWTUCKET') {
        $o_config = Configuration::load();
    }
    $pb_add_rel = caGetOption('addRelParameter', $pa_options, false);
    $vb_can_handle_target = false;
    if ($ps_target) {
        $o_app_plugin_manager = new ApplicationPluginManager();
        $vb_can_handle_target = $o_app_plugin_manager->hookCanHandleGetAsLinkTarget(array('target' => $ps_target));
    }
    // Parse template
    $o_dom = new DOMDocument('1.0', 'utf-8');
    $o_dom->preserveWhiteSpace = true;
    libxml_use_internal_errors(true);
    // don't reported mangled HTML errors
    $va_links = array();
    global $g_request;
    if (!$g_request) {
        return $pa_text;
    }
    foreach ($pa_text as $vn_i => $vs_text) {
        $vs_text = preg_replace("!([A-Za-z0-9]+)='([^']*)'!", "\$1=\"\$2\"", $vs_text);
        // DomDcoument converts single quotes around attributes to double quotes so we do the same to the template
        $vs_text = preg_replace("![ ]+/>!", "/>", $vs_text);
        $vs_text = preg_replace("![\r\n]+!", "", $vs_text);
        // DomDocument removes newlines so we do the same here to the template
        $o_dom->loadHTML('<?xml encoding="utf-8">' . mb_convert_encoding($vs_text, 'HTML-ENTITIES', 'UTF-8'));
        // Needs XML declaration to force it to consider the text as UTF-8. Please don't ask why. No one knows.
        $o_dom->encoding = 'utf-8';
        libxml_clear_errors();
        $va_l_tags = array();
        $o_links = $o_dom->getElementsByTagName("l");
        // l=link
        foreach ($o_links as $o_link) {
            if (!$o_link) {
                continue;
            }
            $vs_html = $o_dom->saveXML($o_link);
            $vs_content = preg_replace("!^<[^\\>]+>!", "", $vs_html);
            $vs_content = preg_replace("!<[^\\>]+>\$!", "", $vs_content);
            $va_l_tags[] = array('directive' => html_entity_decode($vs_html), 'content' => $vs_content);
            //html_entity_decode
        }
        if (sizeof($va_l_tags)) {
            $vs_content = html_entity_decode($vs_text);
            $vs_content = preg_replace_callback("/(&#[0-9]+;)/", function ($m) {
                return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES");
            }, $vs_content);
            foreach ($va_l_tags as $va_l) {
                if ($vb_can_handle_target) {
                    $va_params = array('request' => $g_request, 'content' => $va_l['content'], 'table' => $ps_table_name, 'id' => $pa_row_ids[$vn_i], 'classname' => $ps_class, 'target' => $ps_target, 'additionalParameters' => null, 'options' => null);
                    $va_params = $o_app_plugin_manager->hookGetAsLink($va_params);
                    $vs_link_text = $va_params['tag'];
                } else {
                    switch (__CA_APP_TYPE__) {
                        case 'PROVIDENCE':
                            $vs_link_text = caEditorLink($g_request, $va_l['content'], $ps_class, $ps_table_name, $pa_row_ids[$vn_i], $pb_add_rel ? array('rel' => true) : array());
                            break;
                        case 'PAWTUCKET':
                            $vs_link_text = caDetailLink($g_request, $va_l['content'], $ps_class, $ps_table_name, $pa_row_ids[$vn_i]);
                            break;
                    }
                }
                if ($vs_link_text) {
                    $vs_content = str_replace($va_l['directive'], $vs_link_text, $vs_content);
                } else {
                    $vs_content = str_replace($va_l['directive'], $va_l['content'], $vs_content);
                }
            }
            $va_links[] = $vs_content;
        } else {
            if (isset($pa_options['requireLinkTags']) && $pa_options['requireLinkTags']) {
                $va_links[] = $vs_text;
                continue;
            }
            if ($vb_can_handle_target) {
                $va_params = array('request' => $g_request, 'content' => $vs_text, 'table' => $ps_table_name, 'id' => $pa_row_ids[$vn_i], 'classname' => $ps_class, 'target' => $ps_target, 'additionalParameters' => null, 'options' => null);
                $va_params = $o_app_plugin_manager->hookGetAsLink($va_params);
                $va_links[] = $va_params['tag'];
            } else {
                switch (__CA_APP_TYPE__) {
                    case 'PROVIDENCE':
                        $va_links[] = ($vs_link = caEditorLink($g_request, $vs_text, $ps_class, $ps_table_name, $pa_row_ids[$vn_i])) ? $vs_link : $vs_text;
                        break;
                    case 'PAWTUCKET':
                        $va_links[] = ($vs_link = caDetailLink($g_request, $vs_text, $ps_class, $ps_table_name, $pa_row_ids[$vn_i])) ? $vs_link : $vs_text;
                        break;
                    default:
                        $va_links[] = $vs_text;
                        break;
                }
            }
        }
    }
    return $va_links;
}
コード例 #7
0
/**
 * Creates links to the appropriate editor (in Providence) or detail page (in Pawtucket) from supplied text and ids.
 * Used in SearchResult::get() and BundlableLabelableBaseModelWithAttributes::get() to automatically generate links when fetching
 * information from related tables.
 *
 * @param array $pa_text An array of strings to create links for
 * @param string $ps_table_name The name of the table/record to which the links refer
 * @param array $pa_row_ids Array of row_ids to link to. Values must correspond by index with those in $pa_text
 * @param string $ps_class Optional CSS class to apply to links
 * @param string $ps_target
 * @param array $pa_options Supported options are:
 *		requireLinkTags = if set then links are only added when explicitly defined with <l> tags. Default is to make the entire text a link in the absence of <l> tags.
 * 		addRelParameter =
 *
 * @return array A list of HTML links
 */
function caCreateLinksFromText($pa_text, $ps_table_name, $pa_row_ids, $ps_class = null, $ps_target = null, $pa_options = null)
{
    if (!in_array(__CA_APP_TYPE__, array('PROVIDENCE', 'PAWTUCKET'))) {
        return $pa_text;
    }
    if (__CA_APP_TYPE__ == 'PAWTUCKET') {
        $o_config = Configuration::load();
    }
    $pb_add_rel = caGetOption('addRelParameter', $pa_options, false);
    $vb_can_handle_target = false;
    if ($ps_target) {
        $o_app_plugin_manager = new ApplicationPluginManager();
        $vb_can_handle_target = $o_app_plugin_manager->hookCanHandleGetAsLinkTarget(array('target' => $ps_target));
    }
    // Parse template
    $o_doc = str_get_dom($ps_template);
    $va_links = array();
    global $g_request;
    if (!$g_request) {
        return $pa_text;
    }
    foreach ($pa_text as $vn_i => $vs_text) {
        $vs_text = preg_replace("!([A-Za-z0-9]+)='([^']*)'!", "\$1=\"\$2\"", $vs_text);
        $va_l_tags = array();
        $o_links = $o_doc('l');
        foreach ($o_links as $o_link) {
            if (!$o_link) {
                continue;
            }
            $vs_html = $o_link->html();
            $vs_content = preg_replace("!^<[^\\>]+>!", "", $vs_html);
            $vs_content = preg_replace("!<[^\\>]+>\$!", "", $vs_content);
            $va_l_tags[] = array('directive' => html_entity_decode($vs_html), 'content' => $vs_content);
            //html_entity_decode
        }
        if (sizeof($va_l_tags)) {
            $vs_content = html_entity_decode($vs_text);
            $vs_content = preg_replace_callback("/(&#[0-9]+;)/", function ($m) {
                return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES");
            }, $vs_content);
            foreach ($va_l_tags as $va_l) {
                if ($vb_can_handle_target) {
                    $va_params = array('request' => $g_request, 'content' => $va_l['content'], 'table' => $ps_table_name, 'id' => $pa_row_ids[$vn_i], 'classname' => $ps_class, 'target' => $ps_target, 'additionalParameters' => null, 'options' => null);
                    $va_params = $o_app_plugin_manager->hookGetAsLink($va_params);
                    $vs_link_text = $va_params['tag'];
                } else {
                    switch (__CA_APP_TYPE__) {
                        case 'PROVIDENCE':
                            $vs_link_text = caEditorLink($g_request, $va_l['content'], $ps_class, $ps_table_name, $pa_row_ids[$vn_i], $pb_add_rel ? array('rel' => true) : array());
                            break;
                        case 'PAWTUCKET':
                            $vs_link_text = caDetailLink($g_request, $va_l['content'], $ps_class, $ps_table_name, $pa_row_ids[$vn_i]);
                            break;
                    }
                }
                if ($vs_link_text) {
                    $vs_content = str_replace($va_l['directive'], $vs_link_text, $vs_content);
                } else {
                    $vs_content = str_replace($va_l['directive'], $va_l['content'], $vs_content);
                }
            }
            $va_links[] = $vs_content;
        } else {
            if (isset($pa_options['requireLinkTags']) && $pa_options['requireLinkTags']) {
                $va_links[] = $vs_text;
                continue;
            }
            if ($vb_can_handle_target) {
                $va_params = array('request' => $g_request, 'content' => $vs_text, 'table' => $ps_table_name, 'id' => $pa_row_ids[$vn_i], 'classname' => $ps_class, 'target' => $ps_target, 'additionalParameters' => null, 'options' => null);
                $va_params = $o_app_plugin_manager->hookGetAsLink($va_params);
                $va_links[] = $va_params['tag'];
            } else {
                switch (__CA_APP_TYPE__) {
                    case 'PROVIDENCE':
                        $va_links[] = ($vs_link = caEditorLink($g_request, $vs_text, $ps_class, $ps_table_name, $pa_row_ids[$vn_i])) ? $vs_link : $vs_text;
                        break;
                    case 'PAWTUCKET':
                        $va_links[] = ($vs_link = caDetailLink($g_request, $vs_text, $ps_class, $ps_table_name, $pa_row_ids[$vn_i])) ? $vs_link : $vs_text;
                        break;
                    default:
                        $va_links[] = $vs_text;
                        break;
                }
            }
        }
    }
    return $va_links;
}
コード例 #8
0
while ($vn_item_count < $vn_items_per_page && $vo_result->nextHit()) {
    $vn_lot_id = $vo_result->get('lot_id');
    $i == 2 ? $i = 0 : "";
    ?>
				<tr <?php 
    print $i == 1 ? "class='odd'" : "";
    ?>
>
					<td style="width:10px">
						<input type='checkbox' name='add_to_set_ids' value='<?php 
    print (int) $vn_lot_id;
    ?>
' class="addItemToSetControl" />	
					</td>
<?php 
    print "<td style='width:5%;'>" . caEditorLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), '', 'ca_object_lots', $vn_lot_id, array()) . "</td>";
    foreach ($va_display_list as $vn_placement_id => $va_info) {
        print "<td>" . $t_display->getDisplayValue($vo_result, $vn_placement_id, array_merge(array('request' => $this->request), is_array($va_info['settings']) ? $va_info['settings'] : array())) . "</td>";
    }
    ?>
	
				</tr>
<?php 
    $i++;
    $vn_item_count++;
}
?>
			</tbody>
<?php 
if (is_array($va_bottom_line = $this->getVar('bottom_line'))) {
    ?>
コード例 #9
0
    $vn_padding_top = 0;
    $vn_padding_top_bottom = (180 - $va_media_info["HEIGHT"]) / 2;
    if (sizeof($va_tmp) == 0) {
        $vs_background_image = 'background-image:url("' . $vs_background_image . '"); background-position: 55px 65px; background-repeat: no-repeat; background-size: 64px 64px; opacity: .3;';
    }
    print "<td align='center' valign='top' style='padding:2px 2px 2px 2px;'><div class='objectThumbnailsImageContainer' style='padding: " . $vn_padding_top_bottom . "px 0px " . $vn_padding_top_bottom . "px 0px; {$vs_background_image}'>";
    ?>
			<input type='checkbox' name='add_to_set_ids' value='<?php 
    print (int) $vn_object_id;
    ?>
' class="addItemToSetControl addItemToSetControlInThumbnails" />		
<?php 
    print caEditorLink($this->request, array_shift($va_tmp), '', 'ca_objects', $vn_object_id, array(), array('onmouseover' => 'jQuery(".qlButtonContainerThumbnail").css("display", "none"); jQuery("#ql_' . $vn_object_id . '").css("display", "block");', 'onmouseout' => 'jQuery(".qlButtonContainerThumbnail").css("display", "none");'));
    print "<div class='qlButtonContainerThumbnail' id='ql_" . $vn_object_id . "' onmouseover='jQuery(\"#ql_" . $vn_object_id . "\").css(\"display\", \"block\");'><a class='qlButton' onclick='caMediaPanel.showPanel(\"" . caNavUrl($this->request, 'find', 'SearchObjects', 'QuickLook', array('object_id' => $vn_object_id)) . "\"); return false;' >Quick Look</a></div>";
    print "</div><div class='thumbCaption' " . $vs_caption;
    print "<br/>" . caEditorLink($this->request, $vs_idno, '', 'ca_objects', $vn_object_id, array()) . "\n";
    print "</div></td>";
    $vn_col++;
    if ($vn_col == $vn_display_cols) {
        print "</tr>";
        $vn_col = 0;
    }
    $vn_item_count++;
}
if ($vn_col > 0) {
    while ($vn_col < $vn_display_cols) {
        print "<td><!-- empty --></td>";
        $vn_col++;
    }
    print "</tr>";
}
コード例 #10
0
    $vn_padding_top = 0;
    $vn_padding_top_bottom = (250 - $va_media_info["HEIGHT"]) / 2;
    print "<div class='objectFullImageContainer' style='padding: " . $vn_padding_top_bottom . "px 0px " . $vn_padding_top_bottom . "px 0px;'>";
    ?>
			<input type='checkbox' name='add_to_set_ids' value='<?php 
    print (int) $vn_object_id;
    ?>
' class="addItemToSetControl addItemToSetControlInThumbnails" />
<?php 
    $va_tmp = $vo_result->getMediaTags('ca_object_representations.media', 'small');
    print caEditorLink($this->request, array_shift($va_tmp), '', 'ca_objects', $vn_object_id, array(), array('onmouseover' => 'jQuery(".qlButtonContainerFull").css("display", "none"); jQuery("#ql_' . $vn_object_id . '").css("display", "block");', 'onmouseout' => 'jQuery(".qlButtonContainerFull").css("display", "none");'));
    print "<div class='qlButtonContainerFull' id='ql_" . $vn_object_id . "' onmouseover='jQuery(\"#ql_" . $vn_object_id . "\").css(\"display\", \"block\");'><a class='qlButton' onclick='caMediaPanel.showPanel(\"" . caNavUrl($this->request, 'find', 'SearchObjects', 'QuickLook', array('object_id' => $vn_object_id)) . "\"); return false;' >" . _t("Quick Look") . "</a></div>";
    print "</div>";
    print "<div class='objectFullText'>";
    $va_labels = $vo_result->getDisplayLabels($this->request);
    print "<div class='objectFullTextTitle'>" . caEditorLink($this->request, implode("<br/>", $va_labels), '', 'ca_objects', $vn_object_id, array()) . "</div>";
    // Output configured fields in display
    foreach ($va_display_list as $vn_placement_id => $va_info) {
        if (in_array($va_info['bundle_name'], array('ca_objects.preferred_labels', 'ca_object_labels.name'))) {
            continue;
        }
        // skip preferred labels because we always output them above
        if ($vs_display_text = $t_display->getDisplayValue($vo_result, $vn_placement_id, array_merge(array('request' => $this->request), is_array($va_info['settings']) ? $va_info['settings'] : array()))) {
            print "<div class='objectFullTextTextBlock'><span class='formLabel'>" . $va_info['display'] . "</span>: " . $vs_display_text . "</div>\n";
        }
    }
    //print "<div class='objectFullTextTextBlock'>".caNavLink($this->request, ($vs_action == "Edit" ? _t("Edit") : _t("View"))." &rsaquo;", 'button', 'editor/objects', 'ObjectEditor', $vs_action, array('object_id' => $vn_object_id))."</div>";
    print "</div><!-- END objectFullText -->";
    $vn_item_count++;
    if ($vn_item_count < $vn_items_per_page) {
        print "<br/><div class='divide'><!-- empty --></div>";
コード例 #11
0
			<tr <?php 
        print $i == 1 ? "class='odd'" : "";
        ?>
>
				<td style="width:10px">
<?php 
        if ($t_rel = $o_dm->getInstanceByTableNum($vo_result->get('table_num'), true)) {
            print ' (<i>' . $t_rel->getProperty('NAME_SINGULAR') . '</i>)';
        }
        ?>
				</td>
<?php 
        foreach ($va_display_list as $vn_placement_id => $va_display_item) {
            print "<td>" . $t_display->getDisplayValue($vo_result, $vn_placement_id) . "</td>";
        }
        print "<td style='width:5%;'>" . caEditorLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), 'editIcon', 'ca_relationship_types', $vn_type_id, array()) . "</td>";
        print " <a href='#' onclick='caOpenBrowserWith(" . $vn_type_id . ");'>" . caNavIcon($this->request, __CA_NAV_BUTTON_GO__, array('title' => _t('View in hierarchy'))) . "</a>";
        print "</td>";
        ?>
	
			</tr>
<?php 
        $i++;
        $vn_item_count++;
    }
    ?>
	</tbody></table>
</form><!--end caFindResultsForm -->
</div><!--end scrollingResults -->
<?php 
    TooltipManager::add('.editIcon', _t("Edit"));
コード例 #12
0
                }
                if ($vs_template) {
                    print '<li class="quickSearchList">' . $o_res->getWithTemplate($vs_template) . "</li>\n";
                } else {
                    $vs_idno_display = trim($o_res->get($va_info['displayidno']));
                    if ($vb_show_labels) {
                        $vs_label = $o_res->get($vs_table . '.preferred_labels');
                    } else {
                        $vs_label = $vs_idno_display;
                        $vs_idno_display = '';
                    }
                    $vs_type_display = '';
                    if (($vn_type_id = trim($o_res->get($vs_table . '.type_id'))) && $va_type_list[$vn_type_id]) {
                        $vs_type_display = ' [' . $va_type_list[$vn_type_id]['name_singular'] . ']';
                    }
                    print '<li class="quickSearchList">' . caEditorLink($this->request, $vs_label, null, $vs_table, $o_res->get($va_info['primary_key'])) . " " . ($vs_idno_display ? "({$vs_idno_display})" : "") . " {$vs_type_display}</li>\n";
                }
            }
            ?>
					</ul>
					<div class="quickSearchResultHide"><a href='#' id='hide<?php 
            print $vs_table;
            ?>
' onclick='jQuery("#<?php 
            print $vs_table;
            ?>
_results").slideUp(250); jQuery("#show<?php 
            print $vs_table;
            ?>
").slideDown(1); jQuery("#hide<?php 
            print $vs_table;
コード例 #13
0
        ?>
			<tr <?php 
        print $i == 1 ? "class='odd'" : "";
        ?>
>
				<td style="width:10px">
					<input type='checkbox' name='add_to_set_ids' value='<?php 
        print (int) $vn_item_id;
        ?>
' class="addItemToSetControl" />
				</td>
<?php 
        foreach ($va_display_list as $vn_placement_id => $va_display_item) {
            print "<td>" . $t_display->getDisplayValue($vo_result, $vn_placement_id) . "</td>";
        }
        print "<td class='editDelete'>" . caEditorLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), 'list-button', 'ca_list_items', $vn_item_id, array());
        print " <a href='#' class='list-button' onclick='caOpenBrowserWith({$vn_item_id});'>" . caNavIcon($this->request, __CA_NAV_BUTTON_GO__, array('title' => _t('View in hierarchy'))) . "</a>";
        print "</td>";
        ?>
	
			</tr>
<?php 
        $i++;
        $vn_item_count++;
    }
    ?>
		</tbody>
<?php 
    if (is_array($va_bottom_line = $this->getVar('bottom_line'))) {
        ?>
			<tfoot>
コード例 #14
0
 /**
  *
  */
 public function Index($pa_options = null)
 {
     $po_search = isset($pa_options['search']) ? $pa_options['search'] : null;
     $pb_dont_render_view = isset($pa_options['dontRenderView']) && (bool) $pa_options['dontRenderView'] ? true : false;
     parent::Index($pa_options);
     AssetLoadManager::register('browsable');
     AssetLoadManager::register('hierBrowser');
     $va_access_values = caGetUserAccessValues($this->request);
     //
     // Restrict facets to specific group for main browse landing page (if set in app.conf config)
     //
     if ($vs_facet_group = $this->request->config->get($this->ops_tablename . '_browse_facet_group')) {
         $this->opo_browse->setFacetGroup($vs_facet_group);
     }
     //
     // Set useful values we'll need later
     //
     $t_model = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
     $vb_criteria_have_changed = $this->opo_browse->criteriaHaveChanged();
     // Get elements of result context
     $vn_page_num = $this->opo_result_context->getCurrentResultsPageNumber();
     if ($this->opb_type_restriction_has_changed || $this->request->getParameter('reset', pString) == 'clear') {
         $this->opo_browse->removeAllCriteria();
         $this->opo_result_context->setSearchExpression($this->opo_browse->getBrowseID());
     }
     if (!($vn_items_per_page = $this->opo_result_context->getItemsPerPage())) {
         $vn_items_per_page = $this->opn_items_per_page_default;
         $this->opo_result_context->setItemsPerPage($vn_items_per_page);
     }
     if (!($vs_view = $this->opo_result_context->getCurrentView())) {
         $va_tmp = array_keys($this->opa_views);
         $vs_view = $this->ops_view_default ? $this->ops_view_default : array_shift($va_tmp);
         $this->opo_result_context->setCurrentView($vs_view);
     }
     if (!isset($this->opa_views[$vs_view])) {
         $va_tmp = array_keys($this->opa_views);
         $vs_view = array_shift($va_tmp);
     }
     if (!($vs_sort = $this->opo_result_context->getCurrentSort())) {
         $va_tmp = array_keys($this->opa_sorts);
         $vs_sort = array_shift($va_tmp);
     }
     $vs_sort_direction = $this->opo_result_context->getCurrentSortDirection();
     $vb_sort_has_changed = $this->opo_result_context->sortHasChanged();
     if (!$vn_page_num || $vb_criteria_have_changed) {
         $vn_page_num = 1;
     }
     // Do redirect directly to detail if configured to do so
     if ($this->opo_browse->criteriaHaveChanged() && sizeof($va_criteria = $this->opo_browse->getCriteria()) == 1) {
         $va_tmp = array_keys($va_criteria);
         $va_tmp1 = array_keys($va_criteria[$va_tmp[0]]);
         $va_facet_info = $this->opo_browse->getInfoForFacet($va_tmp[0]);
         if ($this->request->config->get('redirect_to_' . $va_facet_info['table'] . '_detail_if_is_first_facet')) {
             $t_table = $this->opo_datamodel->getInstanceByTableName($va_facet_info['table'], true);
             $va_newmuseum_hack_occurrence_type_ids = $this->request->config->getList('newmuseum_hack_browse_should_redirect_occurrence_types_to_object_details');
             if (is_array($va_newmuseum_hack_occurrence_type_ids) && sizeof($va_newmuseum_hack_occurrence_type_ids) && $va_facet_info['table'] == 'ca_occurrences') {
                 if ($t_table->load($va_tmp1[0])) {
                     if (in_array($t_table->getTypeID(), $va_newmuseum_hack_occurrence_type_ids)) {
                         if (sizeof($va_objects = $t_table->getRelatedItems('ca_objects'))) {
                             $va_object = array_shift($va_objects);
                             $vn_object_id = $va_object['object_id'];
                             $this->response->setRedirect(caNavUrl($this->request, 'Detail', 'Object', 'Show', array('object_id' => $vn_object_id)));
                             return;
                         }
                     }
                 }
             }
             $this->response->setRedirect(caNavUrl($this->request, 'Detail', ucfirst($t_table->getProperty('NAME_SINGULAR')), 'Show', array($t_table->primaryKey() => $va_tmp1[0])));
             return;
         }
     }
     //
     // Enforce type restriction, if defined
     //
     $this->opo_browse->setTypeRestrictions(array($this->opn_type_restriction_id));
     MetaTagManager::setWindowTitle(_t('%1 browse', $this->browseName('plural')));
     //
     // Actually execute the browse - do the queries
     //
     //if ($vs_group_name = $this->request->config->get('browse_facet_group_for_'.$this->ops_tablename)) {
     //	$this->opo_browse->setFacetGroup($vs_group_name);
     //}
     //
     // Restrict facets to specific group (if set in app.conf config)
     //
     if ($vs_facet_group = $this->request->config->get($this->ops_tablename . ($this->opo_browse->numCriteria() < 1 ? '_browse_facet_group' : '_browse_refine_facet_group'))) {
         $this->opo_browse->setFacetGroup($vs_facet_group);
     }
     $this->opo_browse->execute(array('checkAccess' => $va_access_values, 'no_cache' => !$this->opo_result_context->cacheIsValid()));
     $this->opo_result_context->validateCache();
     $this->opo_result_context->setSearchExpression($this->opo_browse->getBrowseID());
     //
     // Pass browse info (context + facets + criteria) to view
     //
     $this->view->setVar('browse', $this->opo_browse);
     $this->view->setVar('target', $this->ops_tablename);
     $this->view->setVar('result_context', $this->opo_result_context);
     $this->view->setVar('criteria', $va_criteria = $this->opo_browse->getCriteriaWithLabels());
     $this->view->setVar('available_facets', $this->opo_browse->getInfoForAvailableFacets());
     $this->view->setVar('facets_with_content', $this->opo_browse->getInfoForFacetsWithContent());
     $this->view->setVar('facet_info', $va_facet_info = $this->opo_browse->getInfoForFacets());
     $va_single_facet_values = array();
     foreach ($va_facet_info as $vs_facet => $va_facet_settings) {
         $va_single_facet_values[$vs_facet] = isset($va_facet_settings['single_value']) ? $va_facet_settings['single_value'] : null;
     }
     $this->view->setVar('single_facet_values', $va_single_facet_values);
     // browse criteria in an easy-to-display format
     $va_browse_criteria = array();
     foreach ($this->opo_browse->getCriteriaWithLabels() as $vs_facet_code => $va_criteria) {
         $va_facet_info = $this->opo_browse->getInfoForFacet($vs_facet_code);
         $va_criteria_list = array();
         foreach ($va_criteria as $vn_criteria_id => $vs_criteria_label) {
             $va_criteria_list[] = $vs_criteria_label;
         }
         $va_browse_criteria[$va_facet_info['label_singular']] = join('; ', $va_criteria_list);
     }
     $this->view->setVar('browse_criteria', $va_browse_criteria);
     //
     // Get the browse results
     //
     $this->view->setVar('num_hits', $vn_num_hits = $this->opo_browse->numResults());
     $this->view->setVar('num_pages', $vn_num_pages = ceil($vn_num_hits / $vn_items_per_page));
     if ($vn_page_num > $vn_num_pages) {
         $vn_page_num = 1;
     }
     if ($pa_options['output_format']) {
         $vo_result = $this->opo_browse->getResults(array('sort' => $vs_sort, 'sort_direction' => $vs_sort_direction));
     } else {
         $vo_result = $this->opo_browse->getResults(array('sort' => $vs_sort, 'sort_direction' => $vs_sort_direction, 'start' => ($vn_page_num - 1) * $vn_items_per_page, 'limit' => $vn_items_per_page));
     }
     // Only prefetch what we need
     $vo_result->setOption('prefetch', $vn_items_per_page);
     if ($vo_result) {
         if ($vb_criteria_have_changed || $vb_sort_has_changed) {
             // Put the results id list into the results context - we used this for previous/next navigation
             $this->opo_result_context->setResultList($vo_result->getPrimaryKeyValues());
             $this->opo_result_context->setParameter('availableVisualizationChecked', 0);
         }
         $vo_result->seek(0);
     }
     //
     // Set up view for display of results
     //
     $this->view->setVar('page', $vn_page_num);
     $this->view->setVar('result', $vo_result);
     $this->view->setVar('views', $this->opa_views);
     // pass view list to view for rendering
     $this->view->setVar('current_view', $vs_view);
     $this->view->setVar('sorts', $this->opa_sorts);
     // pass sort list to view for rendering
     $this->view->setVar('current_sort', $vs_sort);
     $this->view->setVar('current_sort_direction', $vs_sort_direction);
     $this->view->setVar('items_per_page', $this->opa_items_per_page);
     $this->view->setVar('current_items_per_page', $vn_items_per_page);
     $this->view->setVar('t_subject', $t_model);
     $this->view->setVar('mode_name', _t('browse'));
     $this->view->setVar('mode', 'browse');
     $this->view->setVar('mode_type_singular', $this->browseName('singular'));
     $this->view->setVar('mode_type_plural', $this->browseName('plural'));
     $this->view->setVar('access_values', $va_access_values);
     $t_display = $this->view->getVar('t_display');
     $va_display_list = $this->view->getVar('display_list');
     if ($vs_view == 'editable') {
         $va_initial_data = array();
         $va_row_headers = array();
         $vn_item_count = 0;
         if ($vo_result) {
             $vs_pk = $vo_result->primaryKey();
             while ($vn_item_count < 100 && $vo_result->nextHit()) {
                 $va_result = array('item_id' => $vn_id = $vo_result->get($vs_pk));
                 foreach ($va_display_list as $vn_placement_id => $va_bundle_info) {
                     $va_result[str_replace(".", "-", $va_bundle_info['bundle_name'])] = $t_display->getDisplayValue($vo_result, $vn_placement_id, array('request' => $this->request));
                 }
                 $va_initial_data[] = $va_result;
                 $vn_item_count++;
                 $va_row_headers[] = $vn_item_count . " " . caEditorLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), 'caResultsEditorEditLink', $this->ops_tablename, $vn_id);
             }
         }
         $this->view->setVar('initialData', $va_initial_data);
         $this->view->setVar('rowHeaders', $va_row_headers);
     }
     //
     // Bottom line
     //
     $va_bottom_line = array();
     $vb_bottom_line_is_set = false;
     foreach ($va_display_list as $vn_placement_id => $va_placement) {
         if (isset($va_placement['settings']['bottom_line']) && $va_placement['settings']['bottom_line']) {
             $va_bottom_line[$vn_placement_id] = caProcessBottomLineTemplate($this->request, $va_placement, $vo_result, array('pageStart' => ($vn_page_num - 1) * $vn_items_per_page, 'pageEnd' => ($vn_page_num - 1) * $vn_items_per_page + $vn_items_per_page));
             $vb_bottom_line_is_set = true;
         } else {
             $va_bottom_line[$vn_placement_id] = '';
         }
     }
     $this->view->setVar('bottom_line', $vb_bottom_line_is_set ? $va_bottom_line : null);
     switch ($pa_options['output_format']) {
         # ------------------------------------
         case 'LABELS':
             $this->_genLabels($vo_result, $this->request->getParameter("label_form", pString), _t('Browse'), _t('Browse'));
             break;
             # ------------------------------------
         # ------------------------------------
         case 'EXPORT':
             $this->_genExport($vo_result, $this->request->getParameter("export_format", pString), _t('Browse'), _t('Browse'));
             break;
             # ------------------------------------
         # ------------------------------------
         case 'HTML':
         default:
             // generate type menu and type value list
             if (method_exists($t_model, "getTypeList")) {
                 $this->view->setVar('type_list', $t_model->getTypeList());
             }
             $this->opo_result_context->setAsLastFind();
             $this->opo_result_context->saveContext();
             if (!$pb_dont_render_view) {
                 $this->render('Browse/browse_controls_html.php');
             }
             break;
     }
 }
コード例 #15
0
						<th class="{sorter: false} list-header-nosort"><input type='checkbox' name='record' value='' id='watchItemSelectAllControl' class='watchItemControl' onchange="jQuery('.watchItemControl').attr('checked', jQuery('#watchItemSelectAllControl').attr('checked'));"/></th>
					</tr>
				</thead>
				<tbody>
<?php 
    foreach ($va_watched_items as $va_item) {
        $vs_idno = "";
        if ($va_item["idno"]) {
            $vs_idno = "[" . $va_item["idno"] . "] ";
        }
        ?>
				<tr>
					<td>
<?php 
        if ($va_item["primary_key"]) {
            print caEditorLink($this->request, $vs_idno . $va_item["displayName"], '', $va_item["table_name"], $va_item["row_id"]) . " " . "<a href='#' style='font-weight:bold; margin-left:5px; color:#555; text-decoration:none;' id='changeLogLink" . $va_item["watch_id"] . "' onclick='jQuery(\"#changeLogLink" . $va_item["watch_id"] . "\").hide(); jQuery(\"#changeLogHide" . $va_item["watch_id"] . "\").show(); jQuery(\"#changeLog" . $va_item["watch_id"] . "\").slideDown(250); return false;'>" . _t("Recent Changes") . " &rsaquo;</a><a href='#' style='display:none; font-weight:bold; margin-left:5px; text-decoration:none;' id='changeLogHide" . $va_item["watch_id"] . "' onclick='jQuery(\"#changeLogHide" . $va_item["watch_id"] . "\").hide(); jQuery(\"#changeLogLink" . $va_item["watch_id"] . "\").show(); jQuery(\"#changeLog" . $va_item["watch_id"] . "\").slideUp(250); return false;'>" . _t("Hide Recent Changes") . " &rsaquo;</a>";
        } else {
            print "item was deleted.  Row id: " . $va_item["row_id"] . " table_num: " . $va_item["table_num"];
        }
        ?>
					</td>
					<td style="white-space:nowrap; width:75px;">
<?php 
        print $va_item["item_type"];
        ?>
					</td>
					<td style="width:15px;">
						<input type="checkbox" class="watchItemControl" name="watch_id[]" value="<?php 
        print $va_item["watch_id"];
        ?>
">
コード例 #16
0
            ?>
						<?php 
            print "<strong>" . _t("Created by") . "</strong>: " . $va_job['by'] . "<br />";
            ?>
		<?php 
            if ((int) $va_job["completed_on"] > 0) {
                print "<strong>" . _t('Completed on') . "</strong>: " . date("n/d/Y @ g:i:sa T", $va_job["completed_on"]) . "<br/>\n";
                if ((int) $va_job["error_code"] > 0) {
                    print "<span style='color: #cc0000;'><strong>" . _t('Error') . "</strong>: " . $va_job["error_message"] . " [" . $va_job["error_code"] . "] <em>" . _t('TASK DID NOT COMPLETE') . "</em></span><br/>\n";
                }
            }
            foreach ($va_job['status'] as $vs_code => $va_info) {
                switch ($vs_code) {
                    case 'table':
                        $va_tmp = explode(':', $va_job['status']['table']['value']);
                        if ($vs_link = caEditorLink($this->request, $va_info['value'], '', $va_tmp[0], $va_tmp[2], array(), array(), array('verifyLink' => true))) {
                            print "<strong>" . $va_info['label'] . "</strong>: " . $vs_link . "<br/>\n";
                        } else {
                            print "<strong>" . $va_info['label'] . "</strong>: " . $va_info['value'] . " [<em>" . _t('DELETED') . "</em>]<br/>\n";
                        }
                        break;
                    default:
                        print "<strong>" . $va_info['label'] . "</strong>: " . $va_info['value'] . "<br/>\n";
                        break;
                }
            }
            ?>
						<?php 
            print "<strong>" . _t("Total processing time") . "</strong>: " . $va_job['processing_time'] . "s<br />";
            ?>
					</td>
コード例 #17
0
?>
				</th>
				<th>
					<?php 
_p('IP');
?>
				</th>
			</tr>
		</thead>
		<tbody>
<?php 
if (is_array($va_log) && sizeof($va_log) > 0) {
    foreach ($va_log as $vn_i => $va_log_entry) {
        print "<tr>";
        print "<td>" . caGetLocalizedDate($va_log_entry['occurred_on']) . "</td>";
        print "<td>" . $va_log_entry['fulfillment_method_display'] . "</td>";
        print "<td>" . caEditorLink($this->request, $va_log_entry['item_label'], '', 'ca_objects', $va_log_entry['object_id']) . " (" . $va_log_entry['item_idno'] . ")" . "</td>";
        print "<td>" . $va_log_entry['service_display'] . "</td>";
        print "<td>" . (is_array($va_log_entry['fulfillment_details']['files']) ? sizeof($va_log_entry['fulfillment_details']['files']) : 0) . "</td>";
        print "<td>" . $va_log_entry['fname'] . ' ' . $va_log_entry['lname'] . " (" . $va_log_entry['email'] . ")</td>";
        print "<td>" . $va_log_entry['fulfillment_details']['ip_addr'] . "</td>";
        print "</tr>";
    }
} else {
    print "<tr><td colspan='7' align='center'>" . _t('No fulfillment events') . "</td></tr>\n";
}
?>
		</tbody>
	</table>
	<div class="editorBottomPadding"><!-- empty --></div>
</div>
コード例 #18
0
 /**
  * Options:
  *		appendToSearch = optional text to be AND'ed wuth current search expression
  *		output_format = determines format out search result output. "PDF" and "HTML" are currently supported; "HTML" is the default
  *		view = view with path relative to controller to use overriding default ("search/<table_name>_search_basic_html.php")
  *		vars = associative array with key value pairs to assign to the view
  *
  * Callbacks:
  * 		hookBeforeNewSearch() is called just before executing a new search. The first parameter is the BrowseEngine object containing the search.
  */
 public function Index($pa_options = null)
 {
     $po_search = isset($pa_options['search']) ? $pa_options['search'] : null;
     if (isset($pa_options['saved_search']) && $pa_options['saved_search']) {
         $this->opo_result_context->setSearchExpression($pa_options['saved_search']['search']);
         $this->opo_result_context->isNewSearch(true);
     }
     parent::Index($pa_options);
     AssetLoadManager::register('hierBrowser');
     AssetLoadManager::register('browsable');
     // need this to support browse panel when filtering/refining search results
     $t_model = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
     $va_access_values = caGetUserAccessValues($this->request);
     // Get elements of result context
     $vn_page_num = $this->opo_result_context->getCurrentResultsPageNumber();
     $vs_search = $this->opo_result_context->getSearchExpression();
     $vb_is_new_search = $this->opo_result_context->isNewSearch();
     if ((bool) $this->request->getParameter('reset', pString) && $this->request->getParameter('reset', pString) != 'save') {
         $vs_search = '';
         $vb_is_new_search = true;
     }
     if (!($vn_items_per_page = $this->opo_result_context->getItemsPerPage())) {
         $vn_items_per_page = $this->opn_items_per_page_default;
         $this->opo_result_context->setItemsPerPage($vn_items_per_page);
     }
     if (!($vs_view = $this->opo_result_context->getCurrentView())) {
         $va_tmp = array_keys($this->opa_views);
         $vs_view = $this->ops_view_default ? $this->ops_view_default : array_shift($va_tmp);
         $this->opo_result_context->setCurrentView($vs_view);
     }
     if (!isset($this->opa_views[$vs_view])) {
         $va_tmp = array_keys($this->opa_views);
         $vs_view = array_shift($va_tmp);
     }
     if (!($vs_sort = $this->opo_result_context->getCurrentSort())) {
         $va_tmp = array_keys($this->opa_sorts);
         $vs_sort = array_shift($va_tmp);
     }
     $vs_sort_direction = $this->opo_result_context->getCurrentSortDirection();
     $vb_sort_has_changed = $this->opo_result_context->sortHasChanged();
     if (!$this->opn_type_restriction_id) {
         $this->opn_type_restriction_id = '';
     }
     $this->view->setVar('type_id', $this->opn_type_restriction_id);
     MetaTagManager::setWindowTitle(_t('%1 search', $this->searchName('plural')));
     // Get attribute sorts
     $va_sortable_elements = ca_metadata_elements::getSortableElements($this->ops_tablename, $this->opn_type_restriction_id);
     if (!is_array($this->opa_sorts)) {
         $this->opa_sorts = array();
     }
     foreach ($va_sortable_elements as $va_sortable_element) {
         $this->opa_sorts[$this->ops_tablename . '.' . $va_sortable_element['element_code']] = $va_sortable_element['display_label'];
     }
     if ($pa_options['appendToSearch']) {
         $vs_append_to_search .= " AND (" . $pa_options['appendToSearch'] . ")";
     }
     //
     // Execute the search
     //
     if ($vs_search && $vs_search != "") {
         /* any request? */
         $va_search_opts = array('sort' => $vs_sort, 'sort_direction' => $vs_sort_direction, 'appendToSearch' => $vs_append_to_search, 'checkAccess' => $va_access_values, 'no_cache' => $vb_is_new_search, 'dontCheckFacetAvailability' => true, 'filterNonPrimaryRepresentations' => true);
         if ($vb_is_new_search || isset($pa_options['saved_search']) || is_subclass_of($po_search, "BrowseEngine") && !$po_search->numCriteria()) {
             $vs_browse_classname = get_class($po_search);
             $po_search = new $vs_browse_classname();
             if (is_subclass_of($po_search, "BrowseEngine")) {
                 $po_search->addCriteria('_search', $vs_search);
                 if (method_exists($this, "hookBeforeNewSearch")) {
                     $this->hookBeforeNewSearch($po_search);
                 }
             }
             $this->opo_result_context->setParameter('show_type_id', null);
         }
         if ($this->opn_type_restriction_id) {
             $po_search->setTypeRestrictions(array($this->opn_type_restriction_id), array('includeSubtypes' => false));
         }
         $vb_criteria_have_changed = false;
         if (is_subclass_of($po_search, "BrowseEngine")) {
             //
             // Restrict facets to specific group for main browse landing page (if set in app.conf config)
             //
             if ($vs_facet_group = $this->request->config->get($this->ops_tablename . '_search_refine_facet_group')) {
                 $po_search->setFacetGroup($vs_facet_group);
             }
             $vb_criteria_have_changed = $po_search->criteriaHaveChanged();
             $po_search->execute($va_search_opts);
             $this->opo_result_context->setParameter('browse_id', $po_search->getBrowseID());
             if ($vs_group_name = $this->request->config->get('browse_facet_group_for_' . $this->ops_tablename)) {
                 $po_search->setFacetGroup($vs_group_name);
             }
             $vo_result = $po_search->getResults($va_search_opts);
         } else {
             $vo_result = $po_search->search($vs_search, $va_search_opts);
         }
         $vo_result = isset($pa_options['result']) ? $pa_options['result'] : $vo_result;
         $this->opo_result_context->validateCache();
         // Only prefetch what we need
         $vo_result->setOption('prefetch', $vn_items_per_page);
         //
         // Handle details of partitioning search results by type, if required
         //
         if ((bool) $this->request->config->get('search_results_partition_by_type')) {
             $va_type_counts = $vo_result->getResultCountForFieldValues(array('ca_objects.type_id'));
             $va_type_counts_obj_type = $va_type_counts['ca_objects.type_id'];
             ksort($va_type_counts_obj_type);
             $this->view->setVar('counts_by_type', $va_type_counts_obj_type);
             $vn_show_type_id = $this->opo_result_context->getParameter('show_type_id');
             if (!isset($va_type_counts_obj_type[$vn_show_type_id])) {
                 $va_tmp = array_keys($va_type_counts_obj_type);
                 $vn_show_type_id = array_shift($va_tmp);
             }
             $this->view->setVar('show_type_id', $vn_show_type_id);
             $vo_result->filterResult('ca_objects.type_id', $vn_show_type_id);
         }
         if ($vb_is_new_search || $vb_criteria_have_changed || $vb_sort_has_changed) {
             $this->opo_result_context->setResultList($vo_result->getPrimaryKeyValues());
             $this->opo_result_context->setParameter('availableVisualizationChecked', 0);
             if ($this->opo_result_context->searchExpressionHasChanged()) {
                 $vn_page_num = 1;
             }
         }
         $this->view->setVar('num_hits', $vo_result->numHits());
         $this->view->setVar('num_pages', $vn_num_pages = ceil($vo_result->numHits() / $vn_items_per_page));
         if ($vn_page_num > $vn_num_pages) {
             $vn_page_num = 1;
         }
         $vo_result->seek(($vn_page_num - 1) * $vn_items_per_page);
         $this->view->setVar('page', $vn_page_num);
         $this->view->setVar('search', $vs_search);
         $this->view->setVar('result', $vo_result);
     }
     //
     // Set up view for display of results
     //
     $t_model = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
     $this->view->setVar('views', $this->opa_views);
     // pass view list to view for rendering
     $this->view->setVar('current_view', $vs_view);
     $this->view->setVar('sorts', $this->opa_sorts);
     // pass sort list to view for rendering
     $this->view->setVar('current_sort', $vs_sort);
     $this->view->setVar('current_sort_direction', $vs_sort_direction);
     $this->view->setVar('current_items_per_page', $vn_items_per_page);
     $this->view->setVar('items_per_page', $this->opa_items_per_page);
     $this->view->setVar('t_subject', $t_model);
     $this->view->setVar('mode_name', _t('search'));
     $this->view->setVar('mode', 'search');
     $this->view->setVar('mode_type_singular', $this->searchName('singular'));
     $this->view->setVar('mode_type_plural', $this->searchName('plural'));
     $this->view->setVar('search_history', $this->opo_result_context->getSearchHistory());
     $this->view->setVar('result_context', $this->opo_result_context);
     $this->view->setVar('uses_hierarchy_browser', $this->usesHierarchyBrowser());
     $this->view->setVar('access_values', $va_access_values);
     $this->view->setVar('browse', $po_search);
     $t_display = $this->view->getVar('t_display');
     if (!is_array($va_display_list = $this->view->getVar('display_list'))) {
         $va_display_list = array();
     }
     if ($vs_view == 'editable') {
         $va_initial_data = array();
         $va_row_headers = array();
         $vn_item_count = 0;
         if ($vo_result) {
             $vs_pk = $vo_result->primaryKey();
             while ($vn_item_count < 100 && $vo_result->nextHit()) {
                 $va_result = array('item_id' => $vn_id = $vo_result->get($vs_pk));
                 foreach ($va_display_list as $vn_placement_id => $va_bundle_info) {
                     $va_result[str_replace(".", "-", $va_bundle_info['bundle_name'])] = $t_display->getDisplayValue($vo_result, $vn_placement_id, array('request' => $this->request));
                 }
                 $va_initial_data[] = $va_result;
                 $vn_item_count++;
                 $va_row_headers[] = $vn_item_count . " " . caEditorLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), 'caResultsEditorEditLink', $this->ops_tablename, $vn_id);
             }
         }
         $this->view->setVar('initialData', $va_initial_data);
         $this->view->setVar('rowHeaders', $va_row_headers);
     }
     //
     // Bottom line
     //
     $va_bottom_line = array();
     $vb_bottom_line_is_set = false;
     foreach ($va_display_list as $vn_placement_id => $va_placement) {
         if (isset($va_placement['settings']['bottom_line']) && $va_placement['settings']['bottom_line']) {
             $va_bottom_line[$vn_placement_id] = caProcessBottomLineTemplate($this->request, $va_placement, $vo_result, array('pageStart' => ($vn_page_num - 1) * $vn_items_per_page, 'pageEnd' => ($vn_page_num - 1) * $vn_items_per_page + $vn_items_per_page));
             $vb_bottom_line_is_set = true;
         } else {
             $va_bottom_line[$vn_placement_id] = '';
         }
     }
     $this->view->setVar('bottom_line', $vb_bottom_line_is_set ? $va_bottom_line : null);
     switch ($pa_options['output_format']) {
         # ------------------------------------
         case 'LABELS':
             $this->_genLabels($vo_result, $this->request->getParameter("label_form", pString), $vs_search, $vs_search);
             break;
             # ------------------------------------
         # ------------------------------------
         case 'EXPORT':
             $this->_genExport($vo_result, $this->request->getParameter("export_format", pString), $vs_search, $vs_search);
             break;
             # ------------------------------------
         # ------------------------------------
         case 'HTML':
         default:
             // generate type menu and type value list
             if (method_exists($t_model, "getTypeList")) {
                 $this->view->setVar('type_list', $t_model->getTypeList());
             }
             if ($this->opb_uses_hierarchy_browser) {
                 AssetLoadManager::register('hierBrowser');
                 // only for interfaces that use the hierarchy browser
                 $t_list = new ca_lists();
                 if ($vs_type_list_code = $t_model->getTypeListCode()) {
                     $this->view->setVar('num_types', $t_list->numItemsInList($vs_type_list_code));
                     $this->view->setVar('type_menu', $t_list->getListAsHTMLFormElement($vs_type_list_code, 'type_id', array('id' => 'hierTypeList')));
                 }
                 // set last browse id for hierarchy browser
                 $this->view->setVar('browse_last_id', intval($this->request->session->getVar($this->ops_tablename . '_browse_last_id')));
             }
             $this->opo_result_context->setAsLastFind();
             $this->opo_result_context->saveContext();
             if (isset($pa_options['vars']) && is_array($pa_options['vars'])) {
                 foreach ($pa_options['vars'] as $vs_key => $vs_val) {
                     $this->view->setVar($vs_key, $vs_val);
                 }
             }
             if (isset($pa_options['view']) && $pa_options['view']) {
                 $this->render($pa_options['view']);
             } else {
                 $this->render('Search/' . $this->ops_tablename . '_search_basic_html.php');
             }
             break;
             # ------------------------------------
     }
 }
コード例 #19
0
 /**
  * @param RequestHTTP $po_request
  * @param null|array $pa_options
  *		progressCallback =
  *		reportCallback =
  *		sendMail =
  *		log = log directory path
  *		logLevel = KLogger constant for minimum log level to record. Default is KLogger::INFO. Constants are, in descending order of shrillness:
  *			KLogger::EMERG = Emergency messages (system is unusable)
  *			KLogger::ALERT = Alert messages (action must be taken immediately)
  *			KLogger::CRIT = Critical conditions
  *			KLogger::ERR = Error conditions
  *			KLogger::WARN = Warnings
  *			KLogger::NOTICE = Notices (normal but significant conditions)
  *			KLogger::INFO = Informational messages
  *			KLogger::DEBUG = Debugging messages
  * @return array
  */
 public static function importMediaFromDirectory($po_request, $pa_options = null)
 {
     global $g_ui_locale_id;
     $vs_log_dir = caGetOption('log', $pa_options, __CA_APP_DIR__ . "/log");
     $vs_log_level = caGetOption('logLevel', $pa_options, "INFO");
     if (!is_writeable($vs_log_dir)) {
         $vs_log_dir = caGetTempDirPath();
     }
     $vn_log_level = BatchProcessor::_logLevelStringToNumber($vs_log_level);
     $o_log = new KLogger($vs_log_dir, $vn_log_level);
     $vs_import_target = caGetOption('importTarget', $pa_options, 'ca_objects');
     $t_instance = $po_request->getAppDatamodel()->getInstance($vs_import_target);
     $o_eventlog = new Eventlog();
     $t_set = new ca_sets();
     $va_notices = $va_errors = array();
     $vb_we_set_transaction = false;
     $o_trans = isset($pa_options['transaction']) && $pa_options['transaction'] ? $pa_options['transaction'] : null;
     if (!$o_trans) {
         $vb_we_set_transaction = true;
         $o_trans = new Transaction($t_set->getDb());
     }
     $o_batch_log = new Batchlog(array('user_id' => $po_request->getUserID(), 'batch_type' => 'MI', 'table_num' => (int) $t_instance->tableNum(), 'notes' => '', 'transaction' => $o_trans));
     if (!is_dir($pa_options['importFromDirectory'])) {
         $o_eventlog->log(array("CODE" => 'ERR', "SOURCE" => "mediaImport", "MESSAGE" => $vs_msg = _t("Specified import directory '%1' is invalid", $pa_options['importFromDirectory'])));
         $o_log->logError($vs_msg);
         return null;
     }
     $vs_batch_media_import_root_directory = $po_request->config->get('batch_media_import_root_directory');
     if (!preg_match("!^{$vs_batch_media_import_root_directory}!", $pa_options['importFromDirectory'])) {
         $o_eventlog->log(array("CODE" => 'ERR', "SOURCE" => "mediaImport", "MESSAGE" => $vs_msg = _t("Specified import directory '%1' is invalid", $pa_options['importFromDirectory'])));
         $o_log->logError($vs_msg);
         return null;
     }
     if (preg_match("!\\.\\./!", $pa_options['importFromDirectory'])) {
         $o_eventlog->log(array("CODE" => 'ERR', "SOURCE" => "mediaImport", "MESSAGE" => $vs_msg = _t("Specified import directory '%1' is invalid", $pa_options['importFromDirectory'])));
         $o_log->logError($vs_msg);
         return null;
     }
     $vb_include_subdirectories = (bool) $pa_options['includeSubDirectories'];
     $vb_delete_media_on_import = (bool) $pa_options['deleteMediaOnImport'];
     $vs_import_mode = $pa_options['importMode'];
     $vs_match_mode = $pa_options['matchMode'];
     $vn_type_id = $pa_options[$vs_import_target . '_type_id'];
     $vn_rep_type_id = $pa_options['ca_object_representations_type_id'];
     $va_limit_matching_to_type_ids = $pa_options[$vs_import_target . '_limit_matching_to_type_ids'];
     $vn_access = $pa_options[$vs_import_target . '_access'];
     $vn_object_representation_access = $pa_options['ca_object_representations_access'];
     $vn_status = $pa_options[$vs_import_target . '_status'];
     $vn_object_representation_status = $pa_options['ca_object_representations_status'];
     $vn_rel_type_id = isset($pa_options[$vs_import_target . '_representation_relationship_type']) ? $pa_options[$vs_import_target . '_representation_relationship_type'] : null;
     $vn_mapping_id = $pa_options[$vs_import_target . '_mapping_id'];
     $vn_object_representation_mapping_id = $pa_options['ca_object_representations_mapping_id'];
     $vs_idno_mode = $pa_options['idnoMode'];
     $vs_idno = $pa_options['idno'];
     $vs_representation_idno_mode = $pa_options['representationIdnoMode'];
     $vs_representation_idno = $pa_options['representation_idno'];
     $vs_set_mode = $pa_options['setMode'];
     $vs_set_create_name = $pa_options['setCreateName'];
     $vn_set_id = $pa_options['set_id'];
     $vn_locale_id = $pa_options['locale_id'];
     $vs_skip_file_list = $pa_options['skipFileList'];
     $vs_skip_file_list = $pa_options['skipFileList'];
     $vb_allow_duplicate_media = $pa_options['allowDuplicateMedia'];
     $va_relationship_type_id_for = array();
     if (is_array($va_create_relationship_for = $pa_options['create_relationship_for'])) {
         foreach ($va_create_relationship_for as $vs_rel_table) {
             $va_relationship_type_id_for[$vs_rel_table] = $pa_options['relationship_type_id_for_' . $vs_rel_table];
         }
     }
     if (!$vn_locale_id) {
         $vn_locale_id = $g_ui_locale_id;
     }
     $va_files_to_process = caGetDirectoryContentsAsList($pa_options['importFromDirectory'], $vb_include_subdirectories);
     $o_log->logInfo(_t('Found %1 files in directory \'%2\'', sizeof($va_files_to_process), $pa_options['importFromDirectory']));
     if ($vs_set_mode == 'add') {
         $t_set->load($vn_set_id);
     } else {
         if ($vs_set_mode == 'create' && $vs_set_create_name) {
             $va_set_ids = $t_set->getSets(array('user_id' => $po_request->getUserID(), 'table' => $t_instance->tableName(), 'access' => __CA_SET_EDIT_ACCESS__, 'setIDsOnly' => true, 'name' => $vs_set_create_name));
             $vn_set_id = null;
             if (is_array($va_set_ids) && sizeof($va_set_ids) > 0) {
                 $vn_possible_set_id = array_shift($va_set_ids);
                 if ($t_set->load($vn_possible_set_id)) {
                     $vn_set_id = $t_set->getPrimaryKey();
                 }
             } else {
                 $vs_set_code = mb_substr(preg_replace("![^A-Za-z0-9_\\-]+!", "_", $vs_set_create_name), 0, 100);
                 if ($t_set->load(array('set_code' => $vs_set_code))) {
                     $vn_set_id = $t_set->getPrimaryKey();
                 }
             }
             if (!$t_set->getPrimaryKey()) {
                 $t_set->setMode(ACCESS_WRITE);
                 $t_set->set('user_id', $po_request->getUserID());
                 $t_set->set('type_id', $po_request->config->get('ca_sets_default_type'));
                 $t_set->set('table_num', $t_instance->tableNum());
                 $t_set->set('set_code', $vs_set_code);
                 $t_set->insert();
                 if ($t_set->numErrors()) {
                     $va_notices['create_set'] = array('idno' => '', 'label' => _t('Create set %1', $vs_set_create_name), 'message' => $vs_msg = _t('Failed to create set %1: %2', $vs_set_create_name, join("; ", $t_set->getErrors())), 'status' => 'SET ERROR');
                     $o_log->logError($vs_msg);
                 } else {
                     $t_set->addLabel(array('name' => $vs_set_create_name), $vn_locale_id, null, true);
                     if ($t_set->numErrors()) {
                         $va_notices['add_set_label'] = array('idno' => '', 'label' => _t('Add label to set %1', $vs_set_create_name), 'message' => $vs_msg = _t('Failed to add label to set: %1', join("; ", $t_set->getErrors())), 'status' => 'SET ERROR');
                         $o_log->logError($vs_msg);
                     }
                     $vn_set_id = $t_set->getPrimaryKey();
                 }
             }
         } else {
             $vn_set_id = null;
             // no set
         }
     }
     if ($t_set->getPrimaryKey() && !$t_set->haveAccessToSet($po_request->getUserID(), __CA_SET_EDIT_ACCESS__)) {
         $va_notices['set_access'] = array('idno' => '', 'label' => _t('You do not have access to set %1', $vs_set_create_name), 'message' => $vs_msg = _t('Cannot add to set %1 because you do not have edit access', $vs_set_create_name), 'status' => 'SET ERROR');
         $o_log->logError($vs_msg);
         $vn_set_id = null;
         $t_set = new ca_sets();
     }
     $vn_num_items = sizeof($va_files_to_process);
     // Get list of regex packages that user can use to extract object idno's from filenames
     $va_regex_list = caBatchGetMediaFilenameToIdnoRegexList(array('log' => $o_log));
     // Get list of replacements that user can use to transform file names to match object idnos
     $va_replacements_list = caBatchGetMediaFilenameReplacementRegexList(array('log' => $o_log));
     // Get list of files (or file name patterns) to skip
     $va_skip_list = preg_split("![\r\n]+!", $vs_skip_file_list);
     foreach ($va_skip_list as $vn_i => $vs_skip) {
         if (!strlen($va_skip_list[$vn_i] = trim($vs_skip))) {
             unset($va_skip_list[$vn_i]);
         }
     }
     $vn_c = 0;
     $vn_start_time = time();
     $va_report = array();
     foreach ($va_files_to_process as $vs_file) {
         $va_tmp = explode("/", $vs_file);
         $f = array_pop($va_tmp);
         $d = array_pop($va_tmp);
         array_push($va_tmp, $d);
         $vs_directory = join("/", $va_tmp);
         // Skip file names using $vs_skip_file_list
         if (BatchProcessor::_skipFile($f, $va_skip_list)) {
             $o_log->logInfo(_t('Skipped file %1 because it was on the skipped files list', $f));
             continue;
         }
         $vs_relative_directory = preg_replace("!{$vs_batch_media_import_root_directory}[/]*!", "", $vs_directory);
         // does representation already exist?
         if (!$vb_allow_duplicate_media && ($t_dupe = ca_object_representations::mediaExists($vs_file))) {
             $va_notices[$vs_relative_directory . '/' . $f] = array('idno' => '', 'label' => $f, 'message' => $vs_msg = _t('Skipped %1 from %2 because it already exists %3', $f, $vs_relative_directory, caEditorLink($po_request, _t('(view)'), 'button', 'ca_object_representations', $t_dupe->getPrimaryKey())), 'status' => 'SKIPPED');
             $o_log->logInfo($vs_msg);
             continue;
         }
         $t_instance = $po_request->getAppDatamodel()->getInstance($vs_import_target, false);
         $t_instance->setTransaction($o_trans);
         $vs_modified_filename = $f;
         $va_extracted_idnos_from_filename = array();
         if (in_array($vs_import_mode, array('TRY_TO_MATCH', 'ALWAYS_MATCH')) || is_array($va_create_relationship_for) && sizeof($va_create_relationship_for)) {
             foreach ($va_regex_list as $vs_regex_name => $va_regex_info) {
                 $o_log->logDebug(_t("Processing mediaFilenameToObjectIdnoRegexes entry %1", $vs_regex_name));
                 foreach ($va_regex_info['regexes'] as $vs_regex) {
                     switch ($vs_match_mode) {
                         case 'DIRECTORY_NAME':
                             $va_names_to_match = array($d);
                             $o_log->logDebug(_t("Trying to match on directory '%1'", $d));
                             break;
                         case 'FILE_AND_DIRECTORY_NAMES':
                             $va_names_to_match = array($f, $d);
                             $o_log->logDebug(_t("Trying to match on directory '%1' and file name '%2'", $d, $f));
                             break;
                         default:
                         case 'FILE_NAME':
                             $va_names_to_match = array($f);
                             $o_log->logDebug(_t("Trying to match on file name '%1'", $f));
                             break;
                     }
                     // are there any replacements? if so, try to match each element in $va_names_to_match AND all results of the replacements
                     if (is_array($va_replacements_list) && sizeof($va_replacements_list) > 0) {
                         $va_names_to_match_copy = $va_names_to_match;
                         foreach ($va_names_to_match_copy as $vs_name) {
                             foreach ($va_replacements_list as $vs_replacement_code => $va_replacement) {
                                 if (isset($va_replacement['search']) && is_array($va_replacement['search'])) {
                                     $va_replace = caGetOption('replace', $va_replacement);
                                     $va_search = array();
                                     foreach ($va_replacement['search'] as $vs_search) {
                                         $va_search[] = '!' . $vs_search . '!';
                                     }
                                     $vs_replacement_result = @preg_replace($va_search, $va_replace, $vs_name);
                                     if (is_null($vs_replacement_result)) {
                                         $o_log->logError(_t("There was an error in preg_replace while processing replacement %1.", $vs_replacement_code));
                                     }
                                     if ($vs_replacement_result && strlen($vs_replacement_result) > 0) {
                                         $o_log->logDebug(_t("The result for replacement with code %1 applied to value '%2' is '%3' and was added to the list of file names used for matching.", $vs_replacement_code, $vs_name, $vs_replacement_result));
                                         $va_names_to_match[] = $vs_replacement_result;
                                     }
                                 } else {
                                     $o_log->logDebug(_t("Skipped replacement %1 because no search expression was defined.", $vs_replacement_code));
                                 }
                             }
                         }
                     }
                     $o_log->logDebug("Names to match: " . print_r($va_names_to_match, true));
                     foreach ($va_names_to_match as $vs_match_name) {
                         if (preg_match('!' . $vs_regex . '!', $vs_match_name, $va_matches)) {
                             $o_log->logDebug(_t("Matched name %1 on regex %2", $vs_match_name, $vs_regex));
                             if (!$vs_idno || strlen($va_matches[1]) < strlen($vs_idno)) {
                                 $vs_idno = $va_matches[1];
                             }
                             if (!$vs_modified_filename || strlen($vs_modified_filename) > strlen($va_matches[1])) {
                                 $vs_modified_filename = $va_matches[1];
                             }
                             $va_extracted_idnos_from_filename[] = $va_matches[1];
                             if (in_array($vs_import_mode, array('TRY_TO_MATCH', 'ALWAYS_MATCH'))) {
                                 if (!is_array($va_fields_to_match_on = $po_request->config->getList('batch_media_import_match_on')) || !sizeof($va_fields_to_match_on)) {
                                     $batch_media_import_match_on = array('idno');
                                 }
                                 $vs_bool = 'OR';
                                 $va_values = array();
                                 foreach ($va_fields_to_match_on as $vs_fld) {
                                     if (in_array($vs_fld, array('preferred_labels', 'nonpreferred_labels'))) {
                                         $va_values[$vs_fld] = array($vs_fld => array('name' => $va_matches[1]));
                                     } else {
                                         $va_values[$vs_fld] = $va_matches[1];
                                     }
                                 }
                                 if (is_array($va_limit_matching_to_type_ids) && sizeof($va_limit_matching_to_type_ids) > 0) {
                                     $va_values['type_id'] = $va_limit_matching_to_type_ids;
                                     $vs_bool = 'AND';
                                 }
                                 $o_log->logDebug("Trying to find records using boolean {$vs_bool} and values " . print_r($va_values, true));
                                 if (class_exists($vs_import_target) && ($vn_id = $vs_import_target::find($va_values, array('returnAs' => 'firstId', 'boolean' => $vs_bool)))) {
                                     if ($t_instance->load($vn_id)) {
                                         $va_notices[$vs_relative_directory . '/' . $vs_match_name . '_match'] = array('idno' => $t_instance->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD')), 'label' => $t_instance->getLabelForDisplay(), 'message' => $vs_msg = _t('Matched media %1 from %2 to %3 using expression "%4"', $f, $vs_relative_directory, caGetTableDisplayName($vs_import_target, false), $va_regex_info['displayName']), 'status' => 'MATCHED');
                                         $o_log->logInfo($vs_msg);
                                     }
                                     break 3;
                                 }
                             }
                         } else {
                             $o_log->logDebug(_t("Couldn't match name %1 on regex %2", $vs_match_name, $vs_regex));
                         }
                     }
                 }
             }
         }
         if (!$t_instance->getPrimaryKey()) {
             // Use filename as idno if all else fails
             if ($t_instance->load(array('idno' => $f, 'deleted' => 0))) {
                 $va_notices[$vs_relative_directory . '/' . $f . '_match'] = array('idno' => $t_instance->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD')), 'label' => $t_instance->getLabelForDisplay(), 'message' => $vs_msg = _t('Matched media %1 from %2 to %3 using filename', $f, $vs_relative_directory, caGetTableDisplayName($vs_import_target, false)), 'status' => 'MATCHED');
                 $o_log->logInfo($vs_msg);
             }
         }
         switch ($vs_representation_idno_mode) {
             case 'filename':
                 // use the filename as identifier
                 $vs_rep_idno = $f;
                 break;
             case 'filename_no_ext':
                 // use filename without extension as identifier
                 $vs_rep_idno = preg_replace('/\\.[^.\\s]{3,4}$/', '', $f);
                 break;
             case 'directory_and_filename':
                 // use the directory + filename as identifier
                 $vs_rep_idno = $d . '/' . $f;
                 break;
             default:
                 // use idno from form
                 $vs_rep_idno = $vs_representation_idno;
                 break;
         }
         $t_new_rep = null;
         if ($t_instance->getPrimaryKey() && $t_instance instanceof RepresentableBaseModel) {
             // found existing object
             $t_instance->setMode(ACCESS_WRITE);
             $t_new_rep = $t_instance->addRepresentation($vs_directory . '/' . $f, $vn_rep_type_id, $vn_locale_id, $vn_object_representation_status, $vn_object_representation_access, false, array('idno' => $vs_rep_idno), array('original_filename' => $f, 'returnRepresentation' => true, 'type_id' => $vn_rel_type_id));
             if ($t_instance->numErrors()) {
                 $o_eventlog->log(array("CODE" => 'ERR', "SOURCE" => "mediaImport", "MESSAGE" => _t("Error importing {$f} from {$vs_directory}: %1", join('; ', $t_instance->getErrors()))));
                 $va_errors[$vs_relative_directory . '/' . $f] = array('idno' => $t_instance->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD')), 'label' => $t_instance->getLabelForDisplay(), 'errors' => $t_instance->errors(), 'message' => $vs_msg = _t("Error importing %1 from %2: %3", $f, $vs_relative_directory, join('; ', $t_instance->getErrors())), 'status' => 'ERROR');
                 $o_log->logError($vs_msg);
                 $o_trans->rollback();
                 continue;
             } else {
                 if ($vb_delete_media_on_import) {
                     @unlink($vs_directory . '/' . $f);
                 }
             }
         } else {
             // should we create new record?
             if (in_array($vs_import_mode, array('TRY_TO_MATCH', 'DONT_MATCH'))) {
                 $t_instance->setMode(ACCESS_WRITE);
                 $t_instance->set('type_id', $vn_type_id);
                 $t_instance->set('locale_id', $vn_locale_id);
                 $t_instance->set('status', $vn_status);
                 $t_instance->set('access', $vn_access);
                 // for places, take first hierarchy we can find. in most setups there is but one. we might wanna make this configurable via setup screen at some point
                 if ($t_instance->hasField('hierarchy_id')) {
                     $va_hierarchies = $t_instance->getHierarchyList();
                     reset($va_hierarchies);
                     $vn_hierarchy_id = key($va_hierarchies);
                     $t_instance->set('hierarchy_id', $vn_hierarchy_id);
                 }
                 switch ($vs_idno_mode) {
                     case 'filename':
                         // use the filename as identifier
                         $t_instance->set('idno', $f);
                         break;
                     case 'filename_no_ext':
                         // use filename without extension as identifier
                         $f_no_ext = preg_replace('/\\.[^.\\s]{3,4}$/', '', $f);
                         $t_instance->set('idno', $f_no_ext);
                         break;
                     case 'directory_and_filename':
                         // use the directory + filename as identifier
                         $t_instance->set('idno', $d . '/' . $f);
                         break;
                     default:
                         // Calculate identifier using numbering plugin
                         $o_numbering_plugin = $t_instance->getIDNoPlugInInstance();
                         if (!($vs_sep = $o_numbering_plugin->getSeparator())) {
                             $vs_sep = '';
                         }
                         if (!is_array($va_idno_values = $o_numbering_plugin->htmlFormValuesAsArray('idno', null, false, false, true))) {
                             $va_idno_values = array();
                         }
                         $t_instance->set('idno', join($vs_sep, $va_idno_values));
                         // true=always set serial values, even if they already have a value; this let's us use the original pattern while replacing the serial value every time through
                         break;
                 }
                 $t_instance->insert();
                 if ($t_instance->numErrors()) {
                     $o_eventlog->log(array("CODE" => 'ERR', "SOURCE" => "mediaImport", "MESSAGE" => _t("Error creating new record while importing %1 from %2: %3", $f, $vs_relative_directory, join('; ', $t_instance->getErrors()))));
                     $va_errors[$vs_relative_directory . '/' . $f] = array('idno' => $t_instance->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD')), 'label' => $t_instance->getLabelForDisplay(), 'errors' => $t_instance->errors(), 'message' => $vs_msg = _t("Error creating new record while importing %1 from %2: %3", $f, $vs_relative_directory, join('; ', $t_instance->getErrors())), 'status' => 'ERROR');
                     $o_log->logError($vs_msg);
                     $o_trans->rollback();
                     continue;
                 }
                 if ($t_instance->tableName() == 'ca_entities') {
                     // entity labels deserve special treatment
                     $t_instance->addLabel(array('surname' => $f), $vn_locale_id, null, true);
                 } else {
                     $t_instance->addLabel(array($t_instance->getLabelDisplayField() => $f), $vn_locale_id, null, true);
                 }
                 if ($t_instance->numErrors()) {
                     $o_eventlog->log(array("CODE" => 'ERR', "SOURCE" => "mediaImport", "MESSAGE" => _t("Error creating record label while importing %1 from %2: %3", $f, $vs_relative_directory, join('; ', $t_instance->getErrors()))));
                     $va_errors[$vs_relative_directory . '/' . $f] = array('idno' => $t_instance->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD')), 'label' => $t_instance->getLabelForDisplay(), 'errors' => $t_instance->errors(), 'message' => $vs_msg = _t("Error creating record label while importing %1 from %2: %3", $f, $vs_relative_directory, join('; ', $t_instance->getErrors())), 'status' => 'ERROR');
                     $o_log->logError($vs_msg);
                     $o_trans->rollback();
                     continue;
                 }
                 $t_new_rep = $t_instance->addRepresentation($vs_directory . '/' . $f, $vn_rep_type_id, $vn_locale_id, $vn_object_representation_status, $vn_object_representation_access, true, array('idno' => $vs_rep_idno), array('original_filename' => $f, 'returnRepresentation' => true, 'type_id' => $vn_rel_type_id));
                 if ($t_instance->numErrors()) {
                     $o_eventlog->log(array("CODE" => 'ERR', "SOURCE" => "mediaImport", "MESSAGE" => _t("Error importing %1 from %2: ", $f, $vs_relative_directory, join('; ', $t_instance->getErrors()))));
                     $va_errors[$vs_relative_directory . '/' . $f] = array('idno' => $t_instance->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD')), 'label' => $t_instance->getLabelForDisplay(), 'errors' => $t_instance->errors(), 'message' => $vs_msg = _t("Error importing %1 from %2: %3", $f, $vs_relative_directory, join('; ', $t_instance->getErrors())), 'status' => 'ERROR');
                     $o_log->logError($vs_msg);
                     $o_trans->rollback();
                     continue;
                 } else {
                     if ($vb_delete_media_on_import) {
                         @unlink($vs_directory . '/' . $f);
                     }
                 }
             }
         }
         if ($t_instance->getPrimaryKey()) {
             // Perform import of embedded metadata (if required)
             if ($vn_mapping_id) {
                 ca_data_importers::importDataFromSource($vs_directory . '/' . $f, $vn_mapping_id, array('logLevel' => $vs_log_level, 'format' => 'exif', 'forceImportForPrimaryKeys' => array($t_instance->getPrimaryKey(), 'transaction' => $o_trans)));
             }
             if ($vn_object_representation_mapping_id) {
                 ca_data_importers::importDataFromSource($vs_directory . '/' . $f, $vn_object_representation_mapping_id, array('logLevel' => $vs_log_level, 'format' => 'exif', 'forceImportForPrimaryKeys' => array($t_new_rep->getPrimaryKey()), 'transaction' => $o_trans));
             }
             $va_notices[$t_instance->getPrimaryKey()] = array('idno' => $t_instance->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD')), 'label' => $t_instance->getLabelForDisplay(), 'message' => $vs_msg = _t('Imported %1 as %2', $f, $t_instance->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD'))), 'status' => 'SUCCESS');
             $o_log->logInfo($vs_msg);
             if ($vn_set_id) {
                 $t_set->addItem($t_instance->getPrimaryKey(), null, $po_request->getUserID());
             }
             $o_batch_log->addItem($t_instance->getPrimaryKey(), $t_instance->errors());
             // Create relationships?
             if (is_array($va_create_relationship_for) && sizeof($va_create_relationship_for) && is_array($va_extracted_idnos_from_filename) && sizeof($va_extracted_idnos_from_filename)) {
                 foreach ($va_extracted_idnos_from_filename as $vs_idno) {
                     foreach ($va_create_relationship_for as $vs_rel_table) {
                         if (!isset($va_relationship_type_id_for[$vs_rel_table]) || !$va_relationship_type_id_for[$vs_rel_table]) {
                             continue;
                         }
                         $t_rel = $t_instance->getAppDatamodel()->getInstanceByTableName($vs_rel_table);
                         if ($t_rel->load(array($t_rel->getProperty('ID_NUMBERING_ID_FIELD') => $vs_idno))) {
                             $t_instance->addRelationship($vs_rel_table, $t_rel->getPrimaryKey(), $va_relationship_type_id_for[$vs_rel_table]);
                             if (!$t_instance->numErrors()) {
                                 $va_notices[$t_instance->getPrimaryKey() . '_rel'] = array('idno' => $t_instance->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD')), 'label' => $vs_label = $t_instance->getLabelForDisplay(), 'message' => $vs_msg = _t('Added relationship between <em>%1</em> and %2 <em>%3</em>', $vs_label, $t_rel->getProperty('NAME_SINGULAR'), $t_rel->getLabelForDisplay()), 'status' => 'RELATED');
                                 $o_log->logInfo($vs_msg);
                             } else {
                                 $va_notices[$t_instance->getPrimaryKey()] = array('idno' => $t_instance->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD')), 'label' => $vs_label = $t_instance->getLabelForDisplay(), 'message' => $vs_msg = _t('Could not add relationship between <em>%1</em> and %2 <em>%3</em>: %4', $vs_label, $t_rel->getProperty('NAME_SINGULAR'), $t_rel->getLabelForDisplay(), join("; ", $t_instance->getErrors())), 'status' => 'ERROR');
                                 $o_log->logError($vs_msg);
                             }
                         }
                     }
                 }
             }
         } else {
             $va_notices[$vs_relative_directory . '/' . $f] = array('idno' => '', 'label' => $f, 'message' => $vs_msg = $vs_import_mode == 'ALWAYS_MATCH' ? _t('Skipped %1 from %2 because it could not be matched', $f, $vs_relative_directory) : _t('Skipped %1 from %2', $f, $vs_relative_directory), 'status' => 'SKIPPED');
             $o_log->logInfo($vs_msg);
         }
         if (isset($pa_options['progressCallback']) && ($ps_callback = $pa_options['progressCallback'])) {
             $ps_callback($po_request, $vn_c, $vn_num_items, _t("[%3/%4] Processing %1 (%3)", caTruncateStringWithEllipsis($vs_relative_directory, 20) . '/' . caTruncateStringWithEllipsis($f, 30), $t_instance->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD')), $vn_c, $vn_num_items), $t_new_rep, time() - $vn_start_time, memory_get_usage(true), $vn_c, sizeof($va_errors));
         }
         $vn_c++;
     }
     if (isset($pa_options['progressCallback']) && ($ps_callback = $pa_options['progressCallback'])) {
         $ps_callback($po_request, $vn_num_items, $vn_num_items, _t("Processing completed"), null, time() - $vn_start_time, memory_get_usage(true), $vn_c, sizeof($va_errors));
     }
     $vn_elapsed_time = time() - $vn_start_time;
     if (isset($pa_options['reportCallback']) && ($ps_callback = $pa_options['reportCallback'])) {
         $va_general = array('elapsedTime' => $vn_elapsed_time, 'numErrors' => sizeof($va_errors), 'numProcessed' => $vn_c, 'batchSize' => $vn_num_items, 'table' => $t_instance->tableName(), 'set_id' => $t_set->getPrimaryKey(), 'setName' => $t_set->getLabelForDisplay());
         $ps_callback($po_request, $va_general, $va_notices, $va_errors);
     }
     $o_batch_log->close();
     if ($vb_we_set_transaction) {
         if (sizeof($va_errors) > 0) {
             $o_trans->rollback();
         } else {
             $o_trans->commit();
         }
     }
     $vs_set_name = $t_set->getLabelForDisplay();
     $vs_started_on = caGetLocalizedDate($vn_start_time);
     if (isset($pa_options['sendMail']) && $pa_options['sendMail']) {
         if ($vs_email = trim($po_request->user->get('email'))) {
             caSendMessageUsingView($po_request, array($vs_email => $po_request->user->get('fname') . ' ' . $po_request->user->get('lname')), __CA_ADMIN_EMAIL__, _t('[%1] Batch media import completed', $po_request->config->get('app_display_name')), 'batch_media_import_completed.tpl', array('notices' => $va_notices, 'errors' => $va_errors, 'directory' => $vs_relative_directory, 'numErrors' => sizeof($va_errors), 'numProcessed' => $vn_c, 'subjectNameSingular' => _t('file'), 'subjectNamePlural' => _t('files'), 'startedOn' => $vs_started_on, 'completedOn' => caGetLocalizedDate(time()), 'setName' => $vn_set_id ? $vs_set_name : null, 'elapsedTime' => caFormatInterval($vn_elapsed_time)));
         }
     }
     if (isset($pa_options['sendSMS']) && $pa_options['sendSMS']) {
         SMS::send($po_request->getUserID(), _t("[%1] Media import processing for directory %2 with %3 %4 begun at %5 is complete", $po_request->config->get('app_display_name'), $vs_relative_directory, $vn_num_items, $vn_num_items == 1 ? _t('file') : _t('files'), $vs_started_on));
     }
     $o_log->logInfo(_t("Media import processing for directory %1 with %2 %3 begun at %4 is complete", $vs_relative_directory, $vn_num_items, $vn_num_items == 1 ? _t('file') : _t('files')));
     return array('errors' => $va_errors, 'notices' => $va_notices, 'processing_time' => caFormatInterval($vn_elapsed_time));
 }
コード例 #20
0
,
			rowCount: <?php 
print $vo_result->numHits();
?>
,
			
			dataLoadUrl: '<?php 
print caNavUrl($this->request, $this->request->getModulePath(), $this->request->getController(), "getPartialResult");
?>
',
			dataSaveUrl: '<?php 
print caNavUrl($this->request, $this->request->getModulePath(), $this->request->getController(), "saveInlineEdit");
?>
',
			editLinkFormat: "<?php 
print urldecode(caEditorLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), 'caResultsEditorEditLink', $vs_subject_table, '%1'));
?>
",
			
			rowHeaders: <?php 
print json_encode($va_row_headers);
?>
,
			colHeaders: <?php 
print json_encode($va_column_headers);
?>
,
			columns: <?php 
print json_encode($va_columns);
?>
,
コード例 #21
0
    while ($vn_item_count < $vn_items_per_page && $vo_result->nextHit()) {
        $vn_location_id = $vo_result->get('location_id');
        $i == 2 ? $i = 0 : "";
        ?>
				<tr <?php 
        print $i == 1 ? "class='odd'" : "";
        ?>
>
					<td style="width:10px;">
						<input type='checkbox' name='add_to_set_ids' value='<?php 
        print (int) $vn_location_id;
        ?>
' class="addItemToSetControl" />
					</td>
<?php 
        print "<td style='width:17%;'>" . caEditorLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), '', 'ca_storage_locations', $vn_location_id, array()) . "</td>";
        if ($vs_mode == 'search') {
            print " <a href='#' onclick='caOpenBrowserWith(" . $vn_location_id . ");'>" . caNavIcon($this->request, __CA_NAV_BUTTON_HIER__) . "</a>";
        }
        print "</td>";
        foreach ($va_display_list as $vn_placement_id => $va_info) {
            print "<td>" . $t_display->getDisplayValue($vo_result, $vn_placement_id, array_merge(array('request' => $this->request), is_array($va_info['settings']) ? $va_info['settings'] : array())) . "</td>";
        }
        ?>
	
				</tr>
<?php 
        $i++;
        $vn_item_count++;
    }
    ?>
コード例 #22
0
ファイル: TimelineJS.php プロジェクト: guaykuru/pawtucket
 /**
  * Generate timeline data feed
  *
  * @param array $pa_viz_settings Array of visualization settings taken from visualization.conf
  * @param array $pa_options Array of options to use when rendering output. Supported options are:
  *		NONE
  */
 public function getDataForVisualization($pa_viz_settings, $pa_options = null)
 {
     $va_data = array("headline" => isset($pa_viz_settings['display']['headline']) ? $pa_viz_settings['display']['headline'] : '', "type" => "default", "text" => isset($pa_viz_settings['display']['introduction']) ? $pa_viz_settings['display']['introduction'] : '', "asset" => array("media" => "", "credit" => "", "caption" => ""));
     $po_request = caGetOption('request', $pa_options, null);
     $qr_res = $this->getData();
     $vs_table_name = $qr_res->tableName();
     $vs_pk = $qr_res->primaryKey();
     $vn_c = 0;
     $va_results = array();
     while ($qr_res->nextHit()) {
         foreach ($pa_viz_settings['sources'] as $vs_source_name => $va_source) {
             $vs_dates = $qr_res->get($va_source['data'], array('sortable' => true, 'returnAsArray' => false, 'delimiter' => ';'));
             $va_dates = explode(";", $vs_dates);
             $va_date_list = explode("/", $va_dates[0]);
             if (!$va_date_list[0] || !$va_date_list[1]) {
                 continue;
             }
             $va_timeline_dates = caGetDateRangeForTimelineJS($va_date_list);
             $vn_row_id = $qr_res->get("{$vs_table_name}.{$vs_pk}");
             $vs_title = $qr_res->getWithTemplate($va_source['display']['title_template']);
             $va_data['date'][] = array("startDate" => $va_timeline_dates['start'], "endDate" => $va_timeline_dates['end'], "headline" => $po_request ? caEditorLink($po_request, $vs_title, '', $vs_table_name, $vn_row_id) : $vs_title, "text" => $qr_res->getWithTemplate($va_source['display']['description_template']), "tag" => $vs_tag, "classname" => "", "asset" => array("media" => $qr_res->getWithTemplate($va_source['display']['image'], array('returnURL' => true)), "thumbnail" => $qr_res->getWithTemplate($va_source['display']['icon'], array('returnURL' => true)), "credit" => $qr_res->getWithTemplate($va_source['display']['credit_template']), "caption" => $qr_res->getWithTemplate($va_source['display']['caption_template'])));
         }
         $vn_c++;
         if ($vn_c > 2000) {
             break;
         }
     }
     return json_encode(array('timeline' => $va_data));
 }
コード例 #23
0
ファイル: inspector_info.php プロジェクト: kai-iak/providence
    if ($t_item->get('ca_entities.preferred_labels', array('restrictToRelationshipTypes' => array('artist')))) {
        print $t_item->get('ca_entities.preferred_labels', array('restrictToRelationshipTypes' => array('artist'))) . "<br/>";
    }
    print "<em>" . $t_item->get('ca_objects.preferred_labels') . "</em> (" . $t_item->get('ca_objects.idno') . ")<br/><br/>";
    $vn_movement_type_id = caGetListItemID('movement_types', 'movement');
    $vn_condition_type_id = caGetListItemID('movement_types', 'condition');
    $vs_movement_for_display = caGetListItemForDisplay('movement_types', 'movement');
    $vs_condition_for_display = caGetListItemForDisplay('movement_types', 'condition');
    print "<strong>Launch new</strong>:<br/>";
    print caEditorLink($this->request, "&nbsp;&nbsp;{$vs_movement_for_display}", '', 'ca_movements', null, array('type_id' => $vn_movement_type_id, 'rel' => 1, 'rel_table' => 'ca_objects', 'rel_type_id' => 'part', 'rel_id' => $t_item->getPrimaryKey()));
    print "</br >";
    print caEditorLink($this->request, "&nbsp;&nbsp;{$vs_condition_for_display}", '', 'ca_movements', null, array('type_id' => $vn_condition_type_id, 'rel' => 1, 'rel_table' => 'ca_objects', 'rel_type_id' => 'part', 'rel_id' => $t_item->getPrimaryKey()));
}
/**
 * UMMA additions to exhibit inspector
 */
if ($t_item->tableName() === 'ca_occurrences' && $t_item->get('type_id') == caGetListItemID('occurrence_types', 'exhibition')) {
    $vn_loan_object_type_id = caGetListItemID('loan_types', 'loan_object');
    $vs_loan_object_for_display = caGetListItemForDisplay('loan_types', 'loan_object');
    print caEditorLink($this->request, "Launch new {$vs_loan_object_for_display}", '', 'ca_loans', null, array('type_id' => $vn_loan_object_type_id, 'rel' => 1, 'rel_table' => 'ca_occurrences', 'rel_type_id' => 'related', 'rel_id' => $t_item->getPrimaryKey()));
}
/**
 * UMMA additions to loan inspector
 */
if ($t_item->tableName() === 'ca_loans' && $t_item->get('type_id') == caGetListItemID('loan_types', 'loan_in')) {
    $vn_loan_object_type_id = caGetListItemID('loan_types', 'loan_object');
    $vs_loan_object_for_display = caGetListItemForDisplay('loan_types', 'loan_object');
    print caEditorLink($this->request, "Launch new {$vs_loan_object_for_display}", '', 'ca_loans', null, array('type_id' => $vn_loan_object_type_id, 'rel' => 1, 'rel_table' => 'ca_loans', 'rel_type_id' => 'related', 'rel_id' => $t_item->getPrimaryKey()));
}
?>
	</div>