Hi! In my Pawtuckt2 Application, in the ca_objects_default_html.php, I’d like to use a metadata element linked with a related occurrence in some custom PHP Code. I know that I can use $t_object = $this->getVar('item');
declared in the PHP Part right on top (see https://github.com/collectiveaccess/pawtucket2/blob/8d3e7889181308142dd2f42700b9fc595262c07c/themes/default/views/Details/ca_objects_default_html.php#L29) in my PHP Code like
$str = $t_object->get('ca_objects.metadata-element-code');
How can I access the value of ca_occurrences.related.wikidata
in my custom PHP code? Thanks!
Hi,
We are facing performance issues with Collective Access systems. We are using about 10 Collective Access systems; all of them are quite slow.
The slowness has increased to a point that we are now looking for a tangible solution to this problem. In this regard, we would like to get feedback from other users of Collective Access, whether their Collective Access systems are slow as well or we are the only one facing this problem.
All of our Collective Access systems show slowness in all kinds of operations. From login to search, from viewing a record in editor to saving a record.
Login to Collective Access sometimes takes several minutes, loading an object in object editor takes several seconds, etc. Larger exports of search results (let say pdf of 1500 objects) almost never succeed.
We use Collective Access on Centos 7 machine with MySQL database (installed on the same machine to reduce network overhead for database queries).
Number of records in our systems varies from system to system, for example, number of object type records range from 7000 to 50000.
Collective Access version that we use are: 1.4, 1.7.5 and 1.7.6. We are using Collective Access for a long time, in all versions that we have used until now slowness is a common factor.
If you are a Collective Access user please respond, as your response will help us understand whether this is a common problem among all users or not.
Thanks in advance for your response.
Thanks @kehh ! $t_object->getWithTemplate
works for metadata elements from directly related occurrences. I need, however, to get the value of a metadata element connected to an occurrence which is related to an occurrence which is related to my object. For normal use I can do that like this:
{{{<unit relativeTo="ca_occurrences">^ca_occurrences.related.wikidata</unit>}}}
Using $str = $t_object->getWithTemplate('^ca_occurrences.related.wikidata.url');
in PHP doesn’t return the expected value.
I'm having this problem: I have a dimensions element for art, with each dimmension inside a container. Height, length, etc. The values are stored in CM but Pawtucket is changing the values to inches.
The code for one of the elements is this:
{{{<ifdef code="ca_objects.dimensions.dimensions_height"><b>Alto:</b> ^ca_objects.dimensions.dimensions_height<br/></ifdef>}}}
The save value is: "0.36 m". The displayed value in pawtucket is "14 3/16 in"
I've tried using the UNITS modifier but it didn't work
@mbutel_twitter I had the same problem, solved it with this PHP Code:
<?php
$width = $t_object->get('ca_objects.measure.breite1', array('returnAsDecimalMetric' => true));
if ($width) {
echo 'Breite: '.($width * 100).' cm <br>';
}
?>
You’d need to adapt .measure.breite1
to .dimensions.dimensions_height
and try it from there…
if(!defined('__CA_REDIS_PORT__')) {
define('__CA_REDIS_PORT__', 6379);
}
$o_redis = new Redis();
$o_redis->connect(__CA_REDIS_HOST__, __CA_REDIS_PORT__);
if(defined('__CA_REDIS_DB__') && is_int(__CA_REDIS_DB__)) {
$o_redis->select(__CA_REDIS_DB__);
}
$o_cache = new \Doctrine\Common\Cache\RedisCache();
$o_cache->setRedis($o_redis);
return $o_cache;
}