Displaying myOmeka posters and creating user profiles

Hello!

Is there any way to do the following:

1 -- create a page to publicly list all myOmeka posters

2 -- create a user profile page based on email addresses that will list each users' posters

3 -- create a user profile page based on email addresses that will list each users' submissions (incl. admin and contribution form submissions)

It seems that each of these things happen on the admin side in various spots, but can they be called publicly in one spot? If so, how? What are the functions and parameters and where do they need to be implemented (can I use a Simple Page?)? I'm thinking about something similar to WP author profiles here.

Thanks a bunch.

Erin

Erin,

Interesting questions. I might be getting into using myOmeka soon, too, so I took a stab at this. I'm probably doing it wrong, but maybe it's a start.

Using SimplePage as you suggested, here's the PHP I put in:

<?php

//get the table of Posters ...
$table = get_db()->getTable('MyOmekaPoster');

//...and the array of Posters from it

$posters = $table->findAll();

//loop through them
foreach($posters as $poster) {

//pull out the title
echo "<h2>$poster->title</h2>";
   $posterItems = $poster->getItems();

//put out the user
$user=$poster->getUser();
echo "<p>" . $user->username . "</p>";

//loop through the items in the Poster
   foreach($posterItems as $posterItem) {
      set_current_item($posterItem);
      echo "<p>". item('Dublin Core', 'Title') ."</p>";
   }
}

Hope this helps!
Patrick

Patrick! Thanks, especially for including some actual code. I'm modifying it a bit to get what I need, but it's always great to have a solid foundation.

<?php

//get the table of Posters ...
$table = get_db()->getTable('MyOmekaPoster');

//...and the array of Posters from it

$posters = $table->findAll();

//loop through them
foreach($posters as $poster) {

//pull out the title
echo "<h2>$poster->title</h2>";
   $posterItems = $poster->getItems();

//description
echo $poster->description;

//the user
$user=$poster->getUser();
echo "<p>by " . $user->username . "</p>";

//get the link - base may vary
echo "<a href='../myomeka/posters/show/".$poster->id . "'>view</a>";

//spacer if needed

echo "<br /><br /><br />";

}

For anyone who might be trying something similar, here's an updated page I'm using at:

http://csudigitalhumanities.org/exhibits/all-posters

Nothing special but it gets the job done. If anyone can figure out how to address the "todo" items in the code comments, please post them here.

<?php

//get the table of Posters ...
$table = get_db()->getTable('MyOmekaPoster');

//...and the array of Posters from it
$posters = $table->findAll();

//loop through them
foreach($posters as $poster) {

//exclude posters with no title - todo: exclude posters with no items or text
$untitled = 'Untitled';
if ($poster->title != $untitled) {

//pull out the title
echo "<h2>$poster->title</h2>";
$posterItems = $poster->getItems();

//description - todo: use description excerpt?
echo $poster->description;

//the user - todo: link users to their contributions if any?
$user=$poster->getUser();
echo "<div class=''>by " . $user->username ."</div>";

//get the link - base may vary
echo "<p class='border-bottom'><a href='../exhibits/myomeka/posters/show/".$poster->id . "'>View</a></p>";

};
}

Hooray!

I haven't tried these for the todos you have, but it might work. $poster->getItems() should give false if there are no Items, so I'd try adding it in the if, even though it looks like you're not printing info(?). Then, for each item, check to see if it has an annotation on it.

That's taking "text" in your todo comment to mean text in a note, rather than the description of the poster. If you meant description of the poster, should be able to check with $poster->description != '' in the if instead

if ( ($poster->title != $untitled) && ($posterItems = $poster->getItems() ) ) {

    $hasText = false;
    foreach($posterItems as $posterItem) {
       if ($posterItem->annotation) {
          $hasText = true;

          //assuming we're done withthe posterItem
          release_object($posterItem);
       }
    }

    if($hasText) {
    // do the output
    }
release_object($poster);
}

I expect that if there are a lot of Posters, doing that findAll() at the top could be very resource intensive. Not sure if there's a better way.

The release_object things are to free up resources when we're done with something.

Hope this helps!
Patrick

Great stuff, guys! If you think it would help, we can discuss adding some of these features to a future release of MyOmeka.

Erin: I'll look at the to-dos and see if there are any fixes for those.

Thanks,
Jeremy