本文整理汇总了PHP中ca_objects::numberOfRepresentationsOfClass方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_objects::numberOfRepresentationsOfClass方法的具体用法?PHP ca_objects::numberOfRepresentationsOfClass怎么用?PHP ca_objects::numberOfRepresentationsOfClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_objects
的用法示例。
在下文中一共展示了ca_objects::numberOfRepresentationsOfClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: commandImportSIPs
//.........这里部分代码省略.........
$vn_image_count = 0;
$o_progress->next(_t('Processing %1', $vs_archive_file));
$o_progress->setMessage(_t("Creating reel for %1", $vs_idno));
$va_ids = ca_objects::find(array('idno' => $vs_idno, 'deleted' => 0, 'type_id' => 'reel'), array('returnAs' => 'ids'));
if (!is_array($va_ids) || !sizeof($va_ids)) {
$t_object = new ca_objects();
$t_object->setMode(ACCESS_WRITE);
$t_object->set(array('status' => 5, 'type_id' => 'reel', 'idno' => $vs_idno));
$vn_object_id = $t_object->insert();
if ($t_object->numErrors()) {
if ($o_log) {
$o_log->logError(_t("Could not add reel record %1: %2", $vs_idno, join("; ", $t_object->getErrors())));
}
}
$t_object->addLabel(array('name' => $vs_idno_padded), $pn_locale_id, null, true);
if ($t_object->numErrors()) {
if ($o_log) {
$o_log->logError(_t("Could not add label to reel record %1: %2", $vs_idno, join("; ", $t_object->getErrors())));
}
}
if ($t_object->numErrors()) {
if ($o_log) {
$o_log->logError(_t("Could not add artifct media %1 to reel %2: %3", pathinfo($vs_artifact, PATHINFO_BASENAME), $vs_idno, join("; ", $t_object->getErrors())));
}
}
} else {
if ($o_log) {
$o_log->logDebug(_t("Found existing reel record %1 for %2", $va_ids[0], $vs_idno));
}
$t_object = new ca_objects($vn_object_id = $va_ids[0]);
$t_object->setMode(ACCESS_WRITE);
$t_object->set('status', 5);
$t_object->update();
if (($vn_image_count = $t_object->numberOfRepresentationsOfClass("image")) > 0) {
// skip reels that have images already
//if ($o_log) { $o_log->logDebug(_t("Skipped existing reel record %1 because it already has %2 images", $vs_idno, $vn_image_count)); }
//if ($o_progress) { $o_progress->setError(_t("Skipped existing reel record %1 because it already has %2 images", $vs_idno, $vn_image_count)); }
//continue;
}
$t_object->setMode(ACCESS_WRITE);
}
//print "[7] ".$t->getTime(4)."\n";
if ($vn_image_count > 0) {
$t_object->removeAllRepresentations();
if ($t_object->numErrors()) {
if ($o_log) {
$o_log->logError(_t("Could not add remove existing media from reel %1: %2", $vs_idno, join("; ", $t_object->getErrors())));
}
}
}
$o_progress->setMessage(_t("Linking artifact images for %1", $vs_idno));
foreach ($va_artifacts as $vs_artifact) {
$o_progress->next(_t('Processing artifact image %1', $vs_artifact));
copy($vs_artifact, $vs_tmp_filepath = "/tmp/pbc" . md5(time()));
$t_object->addRepresentation($vs_tmp_filepath, 'front', $pn_locale_id, 0, 1, 1);
$o_progress->setMessage(_t("Added artifact image %1 for %2", $vs_artifact, $vs_idno));
if ($t_object->numErrors()) {
if ($o_log) {
$o_log->logError(_t("Could not add artifact media %1 to reel %2: %3", pathinfo($vs_artifact, PATHINFO_BASENAME), $vs_idno, join("; ", $t_object->getErrors())));
}
}
// remove tmp file
@unlink($vs_tmp_filepath);
}
//
// Add XML
示例2: caNavLink
' class='setItemCaption'><?php
print caNavLink($this->request, $vs_title, '', 'Detail', 'Object', 'Show', array('object_id' => $va_item['row_id']));
?>
</div>
<div id='selectReps<?php
print $vn_item_id;
?>
'><span id='selectRepsCount<?php
print $vn_item_id;
?>
'><?php
print ($va_item['representation_count'] == 1 ? _t("%1/%2 page selected", $vn_num_reps_selected, $va_item['representation_count']) : _t("%1/%2 pages selected", $vn_num_reps_selected, $va_item['representation_count'])) . "</span>";
print " (<a href='#' onclick='caMediaPanel.showPanel(\"" . caNavUrl($this->request, '', 'Sets', 'SelectRepresentations', array('object_id' => $va_item['row_id'], 'item_id' => $va_item['item_id'])) . "\", function() { jQuery(\"#selectRepsCount{$vn_item_id}\").load(\"" . caNavUrl($this->request, '', 'Sets', 'GetSelectedRepresentationCount', array('item_id' => $vn_item_id)) . "\"); }); return false;' >" . _t("change") . "</a>)" . "</div>";
# --- output special halep text if there are any audio or video reps associated with this object
$t_order_objects->load($va_item['row_id']);
if ($t_order_objects->numberOfRepresentationsOfClass("audio") || $t_order_objects->numberOfRepresentationsOfClass("video")) {
print "<p>This record contains audio and/or video materials. If this is what you are interested in purchasing please add your inquiry in the messaging system on the right of the screen.</p>";
}
print "<div class='setItemServicesForm'><form action='#' id='setItemServices<?php print {$vn_item_id}; ?>'>";
$va_service_list = $t_order_item->getFieldInfo('service', 'BOUNDS_CHOICE_LIST');
foreach ($t_order_item->getServiceGroups() as $vs_group_code => $va_group_info) {
print "<br style='clear: both;'/><div style='margin-top: 10px;'><strong>" . $va_group_info['label'] . "</strong> " . (mb_strtolower($va_group_info['label']) == "usage" ? " <a href='" . caNavUrl($this->request, "", "About", "faq") . "#usage'>" . _t("Why do I need usage?") . "</a>" : "") . "</div>\n";
foreach ($va_group_info['services'] as $vs_service_code => $va_service_info) {
$va_opts = array('value' => $vn_item_id . '|' . $vs_service_code);
if (in_array($vs_service_code, $va_item['selected_services'])) {
$va_opts['checked'] = 1;
}
print "<div class='serviceItem'><div style='float: left;'>" . caHTMLCheckboxInput('setItemServices_' . $vn_item_id, $va_opts) . "</div><div>" . $va_service_info['label'] . "</div></div>";
}
}
print "</form></div>";