Пример #1
0
 * GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See
 * the "license.txt" file for details, or visit the CollectiveAccess web site at
 * http://www.CollectiveAccess.org
 *
 * ----------------------------------------------------------------------
 */
$t_place = $this->getVar('t_item');
$vn_place_id = $t_place->getPrimaryKey();
$vs_title = $this->getVar('label');
$va_access_values = $this->getVar('access_values');
if (!$this->request->isAjax()) {
    ?>
	<div id="detailBody">
		<div id="pageNav">
<?php 
    if ($this->getVar('is_in_result_list') && ($vs_back_link = ResultContext::getResultsLinkForLastFind($this->request, 'ca_places', _t("Back"), ''))) {
        if ($this->getVar('previous_id')) {
            print caNavLink($this->request, "&lsaquo; " . _t("Previous"), '', 'Detail', 'Place', 'Show', array('place_id' => $this->getVar('previous_id')), array('id' => 'previous'));
        } else {
            print "&lsaquo; " . _t("Previous");
        }
        print "&nbsp;&nbsp;&nbsp;{$vs_back_link}&nbsp;&nbsp;&nbsp;";
        if ($this->getVar('next_id') > 0) {
            print caNavLink($this->request, _t("Next") . " &rsaquo;", '', 'Detail', 'Place', 'Show', array('place_id' => $this->getVar('next_id')), array('id' => 'next'));
        } else {
            print _t("Next") . " &rsaquo;";
        }
    }
    ?>
		</div><!-- end nav -->
		<h2><?php 
Пример #2
0
/**
 * Generates next/previous/back-to-results navigation HTML for bundleable editors
 *
 * @param $po_request RequestHTTP The current request
 * @param $po_instance BaseModel An instance containing the currently edited record
 * @param $po_result_context ResultContext The current result content
 * @param $pa_options array An optional array of options. Supported options are:
 *		backText = a string to use as the "back" button text; default is "Results"
 *
 * @return string HTML implementing the navigation element
 */
function caEditorFindResultNavigation($po_request, $po_instance, $po_result_context, $pa_options = null)
{
    $vn_item_id = $po_instance->getPrimaryKey();
    $vs_pk = $po_instance->primaryKey();
    $vs_table_name = $po_instance->tableName();
    if (($vs_priv_table_name = $vs_table_name) == 'ca_list_items') {
        $vs_priv_table_name = 'ca_lists';
    }
    $va_found_ids = $po_result_context->getResultList();
    $vn_current_pos = $po_result_context->getIndexInResultList($vn_item_id);
    $vn_prev_id = $po_result_context->getPreviousID($vn_item_id);
    $vn_next_id = $po_result_context->getNextID($vn_item_id);
    if (isset($pa_options['backText']) && $pa_options['backText']) {
        $vs_back_text = $pa_options['backText'];
    } else {
        $vs_back_text = "<span class='resultLink'>" . _t('Results') . "</span>";
    }
    $vs_buf = '';
    if (is_array($va_found_ids) && sizeof($va_found_ids)) {
        if ($vn_prev_id > 0) {
            if ($po_request->user->canAccess($po_request->getModulePath(), $po_request->getController(), "Edit", array($vs_pk => $vn_prev_id)) && !$po_request->getAppConfig()->get($vs_table_name . '_editor_defaults_to_summary_view')) {
                $vs_buf .= caNavLink($po_request, '&#60; prev', 'prev', $po_request->getModulePath(), $po_request->getController(), 'Edit' . '/' . $po_request->getActionExtra(), array($vs_pk => $vn_prev_id)) . '&nbsp;';
            } else {
                $vs_buf .= caNavLink($po_request, '&#60; prev', 'prev', $po_request->getModulePath(), $po_request->getController(), 'Summary', array($vs_pk => $vn_prev_id)) . '&nbsp;';
            }
        } else {
            $vs_buf .= '<span class="prev disabled">&#60; prev</span>';
        }
        $vs_buf .= "<span class='resultCount'>" . ResultContext::getResultsLinkForLastFind($po_request, $vs_table_name, $vs_back_text, '') . " (" . $vn_current_pos . "/" . sizeof($va_found_ids) . ")</span>";
        if (!$vn_next_id && sizeof($va_found_ids)) {
            $vn_next_id = $va_found_ids[0];
        }
        if ($vn_next_id > 0) {
            if ($po_request->user->canAccess($po_request->getModulePath(), $po_request->getController(), "Edit", array($vs_pk => $vn_next_id)) && !$po_request->getAppConfig()->get($vs_table_name . '_editor_defaults_to_summary_view')) {
                $vs_buf .= '&nbsp;' . caNavLink($po_request, '&#62; next', 'next', $po_request->getModulePath(), $po_request->getController(), 'Edit' . '/' . $po_request->getActionExtra(), array($vs_pk => $vn_next_id));
            } else {
                $vs_buf .= '&nbsp;' . caNavLink($po_request, '&#62; next', 'next', $po_request->getModulePath(), $po_request->getController(), 'Summary', array($vs_pk => $vn_next_id));
            }
        } else {
            $vs_buf .= '<span class="next disabled">&#62; next</span>';
        }
    } elseif ($vn_item_id) {
        $vs_buf .= ResultContext::getResultsLinkForLastFind($po_request, $vs_table_name, $vs_back_text, '');
    }
    return $vs_buf;
}
$t_collection = $this->getVar('t_item');
$vn_collection_id = $t_collection->getPrimaryKey();
$vs_title = $this->getVar('label');
$va_access_values = $this->getVar('access_values');
if (!$this->request->isAjax()) {
    ?>
	<div id="detailBody">
		<div id="pageNav">
<?php 
    if ($this->getVar('previous_id')) {
        print caNavLink($this->request, "&lsaquo; " . _t("Previous"), '', 'Detail', 'Collection', 'Show', array('collection_id' => $this->getVar('previous_id')), array('id' => 'previous'));
    } else {
        print "&lsaquo; " . _t("Previous");
    }
    print "&nbsp;&nbsp;&nbsp;";
    print ResultContext::getResultsLinkForLastFind($this->request, 'ca_collections', _t("Back"), '');
    print "&nbsp;&nbsp;&nbsp;";
    if ($this->getVar('next_id') > 0) {
        print caNavLink($this->request, _t("Next") . " &rsaquo;", '', 'Detail', 'Collection', 'Show', array('collection_id' => $this->getVar('next_id')), array('id' => 'next'));
    } else {
        print _t("Next") . " &rsaquo;";
    }
    ?>
		</div><!-- end nav -->
		<h1><?php 
    print $vs_title;
    ?>
</h1>	
<?php 
    # --- identifier
    if ($t_collection->get('idno')) {
Пример #4
0
 /**
  *
  */
 public function __call($ps_function, $pa_args)
 {
     AssetLoadManager::register("panel");
     AssetLoadManager::register("mediaViewer");
     AssetLoadManager::register("carousel");
     AssetLoadManager::register("readmore");
     AssetLoadManager::register("maps");
     $ps_function = strtolower($ps_function);
     $ps_id = urldecode($this->request->getActionExtra());
     if (!isset($this->opa_detail_types[$ps_function]) || !isset($this->opa_detail_types[$ps_function]['table']) || !($vs_table = $this->opa_detail_types[$ps_function]['table'])) {
         // invalid detail type – throw error
         die("Invalid detail type");
     }
     $t_table = $this->opo_datamodel->getInstanceByTableName($vs_table, true);
     if (($vb_use_identifiers_in_urls = caUseIdentifiersInUrls()) && substr($ps_id, 0, 3) == "id:") {
         $va_tmp = explode(":", $ps_id);
         $ps_id = (int) $va_tmp[1];
         $vb_use_identifiers_in_urls = false;
     }
     if (!$t_table->load($vb_use_identifiers_in_urls && $t_table->getProperty('ID_NUMBERING_ID_FIELD') ? $t_table->hasField('deleted') ? array($t_table->getProperty('ID_NUMBERING_ID_FIELD') => $ps_id, 'deleted' => 0) : array($t_table->getProperty('ID_NUMBERING_ID_FIELD') => $ps_id) : ($t_table->hasField('deleted') ? array($t_table->primaryKey() => (int) $ps_id, 'deleted' => 0) : array($t_table->primaryKey() => (int) $ps_id)))) {
         // invalid id - throw error
         die("Invalid id");
     }
     // Printables
     // 	merge displays with drop-in print templates
     //
     $va_export_options = caGetAvailablePrintTemplates('summary', array('table' => $t_table->tableName()));
     $this->view->setVar('export_formats', $va_export_options);
     $va_options = array();
     foreach ($va_export_options as $vn_i => $va_format_info) {
         $va_options[$va_format_info['name']] = $va_format_info['code'];
     }
     // Get current display list
     $t_display = new ca_bundle_displays();
     foreach (caExtractValuesByUserLocale($t_display->getBundleDisplays(array('table' => $this->ops_tablename, 'user_id' => $this->request->getUserID(), 'access' => __CA_BUNDLE_DISPLAY_READ_ACCESS__, 'checkAccess' => caGetUserAccessValues($this->request)))) as $va_display) {
         $va_options[$va_display['name']] = "_display_" . $va_display['display_id'];
     }
     ksort($va_options);
     $this->view->setVar('export_format_select', caHTMLSelect('export_format', $va_options, array('class' => 'searchToolsSelect'), array('value' => $this->view->getVar('current_export_format'), 'width' => '150px')));
     #
     # Enforce access control
     #
     if (sizeof($this->opa_access_values) && $t_table->hasField('access') && !in_array($t_table->get("access"), $this->opa_access_values)) {
         $this->notification->addNotification(_t("This item is not available for view"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . $t_table->getTypeName() . ": " . $t_table->get('preferred_labels') . (($vs_idno = $t_table->get($t_table->getProperty('ID_NUMBERING_ID_FIELD'))) ? " [{$vs_idno}]" : ""));
     $vs_type = $t_table->getTypeCode();
     $this->view->setVar('detailType', $vs_table);
     $this->view->setVar('item', $t_table);
     $this->view->setVar('itemType', $vs_type);
     caAddPageCSSClasses(array($vs_table, $ps_function, $vs_type));
     // Do we need to pull in the multisearch result set?
     if (ResultContext::getLastFind($this->request, $vs_table, array('noSubtype' => true)) === 'multisearch') {
         $o_context = new ResultContext($this->request, $vs_table, 'multisearch', $ps_function);
         $o_context->setAsLastFind();
         $o_context->saveContext();
     } else {
         $o_context = ResultContext::getResultContextForLastFind($this->request, $vs_table);
     }
     $this->view->setVar('previousID', $vn_previous_id = $o_context->getPreviousID($t_table->getPrimaryKey()));
     $this->view->setVar('nextID', $vn_next_id = $o_context->getNextID($t_table->getPrimaryKey()));
     $this->view->setVar('previousURL', caDetailUrl($this->request, $vs_table, $vn_previous_id));
     $this->view->setVar('nextURL', caDetailUrl($this->request, $vs_table, $vn_next_id));
     $this->view->setVar('resultsURL', ResultContext::getResultsUrlForLastFind($this->request, $vs_table));
     $va_options = isset($this->opa_detail_types[$ps_function]['options']) && is_array($this->opa_detail_types[$ps_function]['options']) ? $this->opa_detail_types[$ps_function]['options'] : array();
     $this->view->setVar('previousLink', $vn_previous_id > 0 ? caDetailLink($this->request, caGetOption('previousLink', $va_options, _t('Previous')), '', $vs_table, $vn_previous_id) : '');
     $this->view->setVar('nextLink', $vn_next_id > 0 ? caDetailLink($this->request, caGetOption('nextLink', $va_options, _t('Next')), '', $vs_table, $vn_next_id) : '');
     $this->view->setVar('resultsLink', ResultContext::getResultsLinkForLastFind($this->request, $vs_table, caGetOption('resultsLink', $va_options, _t('Back'))));
     $this->view->setVar('commentsEnabled', (bool) $va_options['enableComments']);
     //
     //
     //
     if (method_exists($t_table, 'getPrimaryRepresentationInstance')) {
         if ($pn_representation_id = $this->request->getParameter('representation_id', pInteger)) {
             $t_representation = $this->opo_datamodel->getInstanceByTableName("ca_object_representations", true);
             $t_representation->load($pn_representation_id);
         } else {
             $t_representation = $t_table->getPrimaryRepresentationInstance(array("checkAccess" => $this->opa_access_values));
         }
         if ($t_representation) {
             $this->view->setVar("t_representation", $t_representation);
             $this->view->setVar("representation_id", $t_representation->get("representation_id"));
         } else {
             $t_representation = $this->opo_datamodel->getInstanceByTableName("ca_object_representations", true);
         }
         $this->view->setVar("representationViewer", caObjectDetailMedia($this->request, $t_table->getPrimaryKey(), $t_representation, $t_table, array("primaryOnly" => caGetOption('representationViewerPrimaryOnly', $va_options, false), "dontShowPlaceholder" => caGetOption('representationViewerDontShowPlaceholder', $va_options, false))));
     }
     //
     // map
     //
     if (!is_array($va_map_attributes = caGetOption('map_attributes', $va_options, array())) || !sizeof($va_map_attributes)) {
         if ($vs_map_attribute = caGetOption('map_attribute', $va_options, false)) {
             $va_map_attributes = array($vs_map_attribute);
         }
     }
     $this->view->setVar("map", "");
     if (is_array($va_map_attributes) && sizeof($va_map_attributes)) {
         $o_map = new GeographicMap(($vn_width = caGetOption('map_width', $va_options, false)) ? $vn_width : 285, ($vn_height = caGetOption('map_height', $va_options, false)) ? $vn_height : 200, 'map');
         $vn_mapped_count = 0;
         foreach ($va_map_attributes as $vs_map_attribute) {
             if ($t_table->get($vs_map_attribute)) {
                 $o_map->mapFrom($t_table, $vs_map_attribute);
                 $vn_mapped_count++;
             }
         }
         if ($vn_mapped_count > 0) {
             $this->view->setVar("map", $o_map->render('HTML'));
         }
     }
     //
     // comments, tags, rank
     //
     $this->view->setVar('averageRank', $t_table->getAverageRating(true));
     $this->view->setVar('numRank', $t_table->getNumRatings(true));
     #
     # User-generated comments, tags and ratings
     #
     $va_user_comments = $t_table->getComments(null, true);
     $va_comments = array();
     if (is_array($va_user_comments)) {
         foreach ($va_user_comments as $va_user_comment) {
             if ($va_user_comment["comment"] || $va_user_comment["media1"] || $va_user_comment["media2"] || $va_user_comment["media3"] || $va_user_comment["media4"]) {
                 # TODO: format date based on locale
                 $va_user_comment["date"] = date("n/j/Y", $va_user_comment["created_on"]);
                 # -- get name of commenter
                 if ($va_user_comment["user_id"]) {
                     $t_user = new ca_users($va_user_comment["user_id"]);
                     $va_user_comment["author"] = $t_user->getName();
                 } elseif ($va_user_comment["name"]) {
                     $va_user_comment["author"] = $va_user_comment["name"];
                 }
                 $va_comments[] = $va_user_comment;
             }
         }
     }
     $this->view->setVar('comments', $va_comments);
     $va_user_tags = $t_table->getTags(null, true);
     $va_tags = array();
     if (is_array($va_user_tags)) {
         foreach ($va_user_tags as $va_user_tag) {
             if (!in_array($va_user_tag["tag"], $va_tags)) {
                 $va_tags[] = $va_user_tag["tag"];
             }
         }
     }
     $this->view->setVar('tags_array', $va_tags);
     $this->view->setVar('tags', implode(", ", $va_tags));
     $this->view->setVar("itemComments", caDetailItemComments($this->request, $t_table->getPrimaryKey(), $t_table, $va_comments, $va_tags));
     //
     // share link
     //
     $this->view->setVar("shareLink", "<a href='#' onclick='caMediaPanel.showPanel(\"" . caNavUrl($this->request, '', 'Detail', 'ShareForm', array("tablename" => $t_table->tableName(), "item_id" => $t_table->getPrimaryKey())) . "\"); return false;'>Share</a>");
     // find view
     //		first look for type-specific view
     if (!$this->viewExists($vs_path = "Details/{$vs_table}_{$vs_type}_html.php")) {
         // If no type specific view use the default
         $vs_path = "Details/{$vs_table}_default_html.php";
     }
     switch ($ps_view = $this->request->getParameter('view', pString)) {
         case 'pdf':
             $this->_genExport($t_table, $this->request->getParameter("export_format", pString), 'Detail', 'Detail');
             break;
         default:
             //
             // Tag substitution
             //
             // Views can contain tags in the form {{{tagname}}}. Some tags, such as "itemType" and "detailType" are defined by
             // the detail controller. More usefully, you can pull data from the item being detailed by using a valid "get" expression
             // as a tag (Eg. {{{ca_objects.idno}}}. Even more usefully for some, you can also use a valid bundle display template
             // (see http://docs.collectiveaccess.org/wiki/Bundle_Display_Templates) as a tag. The template will be evaluated in the
             // context of the item being detailed.
             //
             $va_defined_vars = array_keys($this->view->getAllVars());
             // get list defined vars (we don't want to copy over them)
             $va_tag_list = $this->getTagListForView($vs_path);
             // get list of tags in view
             foreach ($va_tag_list as $vs_tag) {
                 if (in_array($vs_tag, $va_defined_vars)) {
                     continue;
                 }
                 if (strpos($vs_tag, "^") !== false || strpos($vs_tag, "<") !== false) {
                     $this->view->setVar($vs_tag, $t_table->getWithTemplate($vs_tag, array('checkAccess' => $this->opa_access_values)));
                 } elseif (strpos($vs_tag, ".") !== false) {
                     $this->view->setVar($vs_tag, $t_table->get($vs_tag, array('checkAccess' => $this->opa_access_values)));
                 } else {
                     $this->view->setVar($vs_tag, "?{$vs_tag}");
                 }
             }
             $this->render($vs_path);
             break;
     }
 }
Пример #5
0
 * GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See
 * the "license.txt" file for details, or visit the CollectiveAccess web site at
 * http://www.CollectiveAccess.org
 *
 * ----------------------------------------------------------------------
 */
$t_place = $this->getVar('t_item');
$vn_place_id = $t_place->getPrimaryKey();
$vs_title = $this->getVar('label');
$t_rel_types = $this->getVar('t_relationship_types');
if (!$this->request->isAjax()) {
    ?>
	<div id="detailBody">
		<div id="pageNav">
<?php 
    print ResultContext::getResultsLinkForLastFind($this->request, 'ca_places', "<img src='" . $this->request->getThemeUrlPath() . "/graphics/arrow_up_grey.gif' width='11' height='10' border='0'> " . _t("BACK"), '');
    if ($this->getVar('next_id') || $this->getVar('previous_id')) {
        print "&nbsp;&nbsp;&nbsp;";
    }
    if ($this->getVar('previous_id')) {
        print caNavLink($this->request, "<img src='" . $this->request->getThemeUrlPath() . "/graphics/arrow_grey_left.gif' width='10' height='10' border='0'> " . _t("PREVIOUS"), '', 'Detail', 'Place', 'Show', array('place_id' => $this->getVar('previous_id')), array('id' => 'previous'));
    }
    if ($this->getVar('next_id') && $this->getVar('previous_id')) {
        print "&nbsp;&nbsp;|&nbsp;&nbsp;";
    }
    if ($this->getVar('next_id') > 0) {
        print caNavLink($this->request, _t("NEXT") . " <img src='" . $this->request->getThemeUrlPath() . "/graphics/arrow_grey_right.gif' width='10' height='10' border='0'>", '', 'Detail', 'Place', 'Show', array('place_id' => $this->getVar('next_id')), array('id' => 'next'));
    }
    ?>
		</div><!-- end nav -->
		<h1><?php 
$t_entity = $this->getVar('t_item');
$vn_entity_id = $t_entity->getPrimaryKey();
$vs_title = $this->getVar('label');
$va_access_values = $this->getVar('access_values');
if (!$this->request->isAjax()) {
    ?>
	<div id="detailBody">
		<div id="pageNav">
<?php 
    if ($this->getVar('previous_id')) {
        print caNavLink($this->request, "&lsaquo; " . _t("Previous"), '', 'Detail', 'Entity', 'Show', array('entity_id' => $this->getVar('previous_id')), array('id' => 'previous'));
    } else {
        print "&lsaquo; " . _t("Previous");
    }
    print "&nbsp;&nbsp;&nbsp;";
    print ResultContext::getResultsLinkForLastFind($this->request, 'ca_entities', _t("Back"), '');
    print "&nbsp;&nbsp;&nbsp;";
    if ($this->getVar('next_id') > 0) {
        print caNavLink($this->request, _t("Next") . " &rsaquo;", '', 'Detail', 'Entity', 'Show', array('entity_id' => $this->getVar('next_id')), array('id' => 'next'));
    } else {
        print _t("Next") . " &rsaquo;";
    }
    ?>
		</div><!-- end nav -->
		<h1><?php 
    print $vs_title;
    ?>
</h1>		
<?php 
    # --- identifier
    if ($t_entity->get('idno')) {
Пример #7
0
$t_rep = $this->getVar('t_primary_rep');
$vn_num_images = $this->getVar('num_images');
$vs_display_version = $this->getVar('primary_rep_display_version');
$va_display_options = $this->getVar('primary_rep_display_options');
$vn_image_object_id = $this->getVar("image_object_id");
if (!$this->request->isAjax()) {
    ?>
<div id="pageHeading"><img src='<?php 
    print $this->request->getThemeUrlPath();
    ?>
/graphics/ncr/t_chronology.gif' width='141' height='23' border='0'></div><!-- end pageHeading -->
	<div id="detailBody">
<?php 
}
if ($this->getVar("show_back_button")) {
    $vs_back_link = ResultContext::getResultsLinkForLastFind($this->request, 'ca_occurrences', _t("Back"), '');
}
?>
		<div id="jumpTo">
			<?php 
print $vs_back_link ? $vs_back_link . "&nbsp;&nbsp;<span class='lineDivide'>|</span>&nbsp;&nbsp;" : "";
?>
<span class="subTitle"><?php 
print _t("Jump to:");
?>
&nbsp;</span><!-- end subTitle -->
<?php 
print caFormTag($this->request, 'Detail', 'caChronJumpToFormYear');
print "<select name='year' onchange='this.form.submit();' style='width:70px;'>";
print "<option value=''>Year</option>";
for ($year = 1904; $year <= 1988; $year++) {