当前位置: 首页>>代码示例>>PHP>>正文


PHP ca_occurrences::getPrimaryKey方法代码示例

本文整理汇总了PHP中ca_occurrences::getPrimaryKey方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_occurrences::getPrimaryKey方法的具体用法?PHP ca_occurrences::getPrimaryKey怎么用?PHP ca_occurrences::getPrimaryKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ca_occurrences的用法示例。


在下文中一共展示了ca_occurrences::getPrimaryKey方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: caDownloadAttributeMedia

 function caDownloadAttributeMedia($po_request, $po_response, $pn_occurrence_id, $ps_version, $pa_options = null)
 {
     $o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/');
     $t_occurrence = new ca_occurrences($pn_occurrence_id);
     if (!$t_occurrence->getPrimaryKey()) {
         return null;
     }
     $vs_path = $t_occurrence->get('ca_occurrences.report_file', array('version' => $ps_version, 'return' => 'path'));
     $vs_path_ext = pathinfo($vs_path, PATHINFO_EXTENSION);
     if (!($vs_title = trim($t_occurrence->get('ca_occurrences.preferred_labels.name')))) {
         $vs_title = "report";
     }
     $vs_name = _t(preg_replace('![^A-Za-z0-9\\,\\/\\?\\"\']+!', '_', $vs_title) . ".{$vs_path_ext}");
     $o_view->setVar('file_path', $vs_path);
     $o_view->setVar('file_name', $vs_name);
     // send download
     return $o_view->render('ca_attributes_download_media.php');
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:18,代码来源:reports.php

示例2: getOccurrenceMediaOverlay

 /**
  * Returns content for overlay containing details for object representation linked to occurrence
  */
 public function getOccurrenceMediaOverlay()
 {
     $pn_occurrence_id = $this->request->getParameter('occurrence_id', pInteger);
     $pn_object_id = $this->request->getParameter('object_id', pInteger);
     $this->view->setVar('object_id', $pn_object_id);
     $pn_representation_id = $this->request->getParameter('representation_id', pInteger);
     $this->view->setVar('occurrence_id', $pn_occurrence_id);
     $t_occurrence = new ca_occurrences($pn_occurrence_id);
     $this->view->setVar('object_id', $pn_object_id);
     $t_object = new ca_objects($pn_object_id);
     $this->view->setVar('t_object', $t_object);
     $t_rep = new ca_object_representations($pn_representation_id);
     $this->view->setVar('representation_id', $pn_representation_id);
     $this->view->setVar('t_object_representation', $t_rep);
     if ($this->request->config->get("dont_enforce_access_settings")) {
         $va_access_values = array();
     } else {
         $va_access_values = caGetUserAccessValues($this->request);
     }
     if (!$t_occurrence->getPrimaryKey()) {
         die("Invalid occurrence_id");
     }
     if (!$t_object->getPrimaryKey()) {
         die("Invalid object_id");
     }
     if (!$t_rep->getPrimaryKey()) {
         die("Invalid representation_id");
     }
     if (sizeof($va_access_values) && !in_array($t_occurrence->get('access'), $va_access_values)) {
         die("Invalid occurrence_id");
     }
     if (sizeof($va_access_values) && !in_array($t_object->get('access'), $va_access_values)) {
         die("Invalid object_id");
     }
     if (sizeof($va_access_values) && !in_array($t_rep->get('access'), $va_access_values)) {
         die("Invalid rep_id");
     }
     // Get media for display using configured rules
     $va_rep_display_info = caGetMediaDisplayInfo("media_overlay", $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
     // set version
     $this->view->setVar('version', $va_rep_display_info['display_version']);
     unset($va_display_info['display_version']);
     // set poster frame URL
     //$va_rep_display_info['poster_frame_url'] = $t_rep->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
     //unset($va_display_info['poster_frame_version']);
     //$va_rep_display_info['viewer_base_url'] = $t_rep->getAppConfig()->get('ca_url_root');
     // set other options
     $this->view->setVar('display_options', $va_rep_display_info);
     if (!($ps_display_type = trim($this->request->getParameter('display_type', pString)))) {
         $ps_display_type = 'media_overlay';
     }
     if (!($ps_containerID = trim($this->request->getParameter('containerID', pString)))) {
         $ps_containerID = 'caMediaPanelContentArea';
     }
     $this->view->setVar("display_type", $ps_display_type);
     $this->view->setVar("containerID", $ps_containerID);
     // Get all objects asscoiated with this occurrence and show primary reps as icons for navigation
     $va_exhibition_images = $t_occurrence->get("ca_objects", array('restrict_to_relationship_types' => array('describes'), "returnAsArray" => 1, 'checkAccess' => $va_access_values));
     if (sizeof($va_exhibition_images) > 0) {
         $t_image_objects = new ca_objects();
         $i = 1;
         foreach ($va_exhibition_images as $vn_rel_id => $va_info) {
             $t_image_objects->load($va_info["object_id"]);
             if ($t_primary_rep = $t_image_objects->getPrimaryRepresentationInstance()) {
                 $va_temp = array();
                 if (!sizeof($va_access_values) || in_array($t_primary_rep->get('access'), $va_access_values)) {
                     $va_temp["representation_id"] = $t_primary_rep->get("representation_id");
                     $va_temp["rep_icon"] = $t_primary_rep->getMediaTag('media', 'icon');
                     $va_temp["rep_tinyicon"] = $t_primary_rep->getMediaTag('media', 'tinyicon');
                     $va_temp["object_id"] = $va_info["object_id"];
                     $va_thumbnails[$va_info["object_id"]] = $va_temp;
                     if ($vn_getNext == 1) {
                         $this->view->setVar("next_object_id", $va_info["object_id"]);
                         $this->view->setVar("next_representation_id", $t_primary_rep->get("representation_id"));
                         $vn_getNext = 0;
                     }
                     if ($va_info["object_id"] == $pn_object_id) {
                         $this->view->setVar("representation_index", $i);
                         $this->view->setVar("previous_object_id", $vn_prev_obj_id);
                         $this->view->setVar("previous_representation_id", $vn_prev_rep_id);
                         $vn_getNext = 1;
                     }
                     $vn_prev_obj_id = $va_info["object_id"];
                     $vn_prev_rep_id = $t_primary_rep->get("representation_id");
                     $i++;
                 }
             }
         }
     }
     $this->view->setVar('reps', $va_thumbnails);
     return $this->render("Detail/ajax_ca_occurrences_media_overlay_html.php");
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:95,代码来源:OccurrenceMediaOverlayController.php

示例3: getOccurrenceID


//.........这里部分代码省略.........
             $vn_id = ca_occurrences::find($va_find_arr, array('returnAs' => 'firstId', 'transaction' => $pa_options['transaction']));
         }
     }
     if (!$vn_id) {
         if (isset($pa_options['dontCreate']) && $pa_options['dontCreate']) {
             return false;
         }
         if ($o_event) {
             $o_event->beginItem($vs_event_source, 'ca_occurrences', 'I');
         }
         $t_occurrence->setMode(ACCESS_WRITE);
         $t_occurrence->set('locale_id', $pn_locale_id);
         $t_occurrence->set('type_id', $pn_type_id);
         $t_occurrence->set('parent_id', $pn_parent_id);
         $t_occurrence->set('source_id', isset($pa_values['source_id']) ? $pa_values['source_id'] : null);
         $t_occurrence->set('access', isset($pa_values['access']) ? $pa_values['access'] : 0);
         $t_occurrence->set('status', isset($pa_values['status']) ? $pa_values['status'] : 0);
         $t_occurrence->set('idno', $vs_idno);
         $t_occurrence->set('hier_occurrence_id', isset($pa_values['hier_occurrence_id']) ? $pa_values['hier_occurrence_id'] : null);
         $t_occurrence->insert();
         if ($t_occurrence->numErrors()) {
             if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                 print "[Error] " . _t("Could not insert occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())) . "\n";
             }
             if ($o_log) {
                 $o_log->logError(_t("Could not insert occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())));
             }
             return null;
         }
         $vb_label_errors = false;
         $t_occurrence->addLabel(array('name' => $ps_occ_name), $pn_locale_id, null, true);
         if ($t_occurrence->numErrors()) {
             if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                 print "[Error] " . _t("Could not set preferred label for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())) . "\n";
             }
             if ($o_log) {
                 $o_log->logError(_t("Could not set preferred label for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())));
             }
             $vb_label_errors = true;
         }
         unset($pa_values['access']);
         unset($pa_values['status']);
         unset($pa_values['idno']);
         unset($pa_values['source_id']);
         unset($pa_values['hier_occurrence_id']);
         $vb_attr_errors = false;
         if (is_array($pa_values)) {
             foreach ($pa_values as $vs_element => $va_value) {
                 if (is_array($va_value)) {
                     // array of values (complex multi-valued attribute)
                     $t_occurrence->addAttribute(array_merge($va_value, array('locale_id' => $pn_locale_id)), $vs_element);
                 } else {
                     // scalar value (simple single value attribute)
                     if ($va_value) {
                         $t_occurrence->addAttribute(array('locale_id' => $pn_locale_id, $vs_element => $va_value), $vs_element);
                     }
                 }
             }
         }
         $t_occurrence->update();
         if ($t_occurrence->numErrors()) {
             if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                 print "[Error] " . _t("Could not set values for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())) . "\n";
             }
             if ($o_log) {
                 $o_log->logError(_t("Could not set values for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())));
             }
             $vb_attr_errors = true;
         }
         $vn_occurrence_id = $t_occurrence->getPrimaryKey();
         if ($o_event) {
             if ($vb_attr_errors || $vb_label_errors) {
                 $o_event->endItem($vn_occurrence_id, __CA_DATA_IMPORT_ITEM_PARTIAL_SUCCESS__, _t("Errors setting field values: %1", join('; ', $t_occurrence->getErrors())));
             } else {
                 $o_event->endItem($vn_occurrence_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
             }
         }
         if ($o_log) {
             $o_log->logInfo(_t("Created new occurrence %1", $ps_occ_name));
         }
         if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
             return $t_occurrence;
         }
     } else {
         if ($o_event) {
             $o_event->beginItem($vs_event_source, 'ca_occurrences', 'U');
         }
         $vn_occurrence_id = $vn_id;
         if ($o_event) {
             $o_event->endItem($vn_occurrence_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
         }
         if ($o_log) {
             $o_log->logDebug(_t("Found existing occurrence %1 in DataMigrationUtils::getOccurrenceID(); total of %2 occurrences were found", $ps_occ_name, sizeof($va_occurrence_ids) + 1));
         }
         if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
             return new ca_occurrences($vn_occurrence_id);
         }
     }
     return $vn_occurrence_id;
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:101,代码来源:DataMigrationUtils.php

示例4: getOccurrenceID


//.........这里部分代码省略.........
                 if ($t_occurrence->numErrors()) {
                     if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                         print "[Error] " . _t("Could not update idno for %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())) . "\n";
                     }
                     if ($o_log) {
                         $o_log->logError(_t("Could not idno for %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())));
                     }
                     return null;
                 }
             }
         }
         unset($pa_values['access']);
         unset($pa_values['status']);
         unset($pa_values['idno']);
         unset($pa_values['source_id']);
         unset($pa_values['hier_occurrence_id']);
         $vb_attr_errors = false;
         if (is_array($pa_values)) {
             foreach ($pa_values as $vs_element => $va_values) {
                 if (!caIsIndexedArray($va_values)) {
                     $va_values = array($va_values);
                 }
                 foreach ($va_values as $va_value) {
                     if (is_array($va_value)) {
                         // array of values (complex multi-valued attribute)
                         $t_occurrence->addAttribute(array_merge($va_value, array('locale_id' => $pn_locale_id)), $vs_element);
                     } else {
                         // scalar value (simple single value attribute)
                         if ($va_value) {
                             $t_occurrence->addAttribute(array('locale_id' => $pn_locale_id, $vs_element => $va_value), $vs_element);
                         }
                     }
                 }
             }
             $t_occurrence->update();
             if ($t_occurrence->numErrors()) {
                 if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                     print "[Error] " . _t("Could not set values for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())) . "\n";
                 }
                 if ($o_log) {
                     $o_log->logError(_t("Could not set values for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())));
                 }
                 $vb_attr_errors = true;
             }
         }
         if (is_array($va_nonpreferred_labels = caGetOption("nonPreferredLabels", $pa_options, null))) {
             if (caIsAssociativeArray($va_nonpreferred_labels)) {
                 // single non-preferred label
                 $va_labels = array($va_nonpreferred_labels);
             } else {
                 // list of non-preferred labels
                 $va_labels = $va_nonpreferred_labels;
             }
             foreach ($va_labels as $va_label) {
                 $t_occurrence->addLabel($va_label, $pn_locale_id, null, false);
                 if ($t_occurrence->numErrors()) {
                     if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                         print "[Error] " . _t("Could not set non-preferred label for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())) . "\n";
                     }
                     if ($o_log) {
                         $o_log->logError(_t("Could not set non-preferred label for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())));
                     }
                 }
             }
         }
         $vn_occurrence_id = $t_occurrence->getPrimaryKey();
         if ($o_event) {
             if ($vb_attr_errors || $vb_label_errors) {
                 $o_event->endItem($vn_occurrence_id, __CA_DATA_IMPORT_ITEM_PARTIAL_SUCCESS__, _t("Errors setting field values: %1", join('; ', $t_occurrence->getErrors())));
             } else {
                 $o_event->endItem($vn_occurrence_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
             }
         }
         if ($o_log) {
             $o_log->logInfo(_t("Created new occurrence %1", $ps_occ_name));
         }
         if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
             return $t_occurrence;
         }
     } else {
         if ($o_event) {
             $o_event->beginItem($vs_event_source, 'ca_occurrences', 'U');
         }
         $vn_occurrence_id = $vn_id;
         if ($o_event) {
             $o_event->endItem($vn_occurrence_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
         }
         if ($o_log) {
             $o_log->logDebug(_t("Found existing occurrence %1 in DataMigrationUtils::getOccurrenceID()", $ps_occ_name));
         }
         if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
             $t_occurrence = new ca_occurrences($vn_occurrence_id);
             if (isset($pa_options['transaction']) && $pa_options['transaction'] instanceof Transaction) {
                 $t_occurrence->setTransaction($pa_options['transaction']);
             }
             return $t_occurrence;
         }
     }
     return $vn_occurrence_id;
 }
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:101,代码来源:DataMigrationUtils.php


注:本文中的ca_occurrences::getPrimaryKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。