Exemplo n.º 1
0
 public function getItemsJson($r)
 {
     $items = new Dase_DBO_Item($this->db);
     $items->orderBy('updated DESC');
     $set = array();
     foreach ($items->find() as $item) {
         $item = clone $item;
         $set[] = $item->asArray($r);
     }
     $r->renderResponse(Dase_Json::get($set));
 }
Exemplo n.º 2
0
 public function getRecentUploadsJson($r)
 {
     //todo: implement http authorization!
     $coll = $r->get('collection_ascii_id');
     $items = new Dase_DBO_Item($this->db);
     $items->created_by_eid = $this->user->eid;
     $items->collection_id = Dase_DBO_Collection::get($this->db, $coll)->id;
     $items->orderBy('created DESC');
     if ($r->has('limit')) {
         $limit = $r->get('limit');
     } else {
         $limit = 50;
     }
     $items->setLimit($limit);
     $recent = array();
     foreach ($items->find() as $item) {
         $item = clone $item;
         $recent['a' . $item->serial_number]['title'] = $item->getTitle();
         $recent['a' . $item->serial_number]['thumbnail_href'] = $item->getMediaUrl('thumbnail', $r->app_root);
         $recent['a' . $item->serial_number]['item_record_href'] = $item->getUrl($r->app_root);
     }
     $r->renderResponse(Dase_Json::get($recent));
 }
Exemplo n.º 3
0
 function getItems($limit = '')
 {
     $item = new Dase_DBO_Item($this->db);
     $item->collection_id = $this->id;
     //reverse chronological so we can get "recent" w/ limit param
     $item->orderBy('updated DESC');
     if ($limit && is_numeric($limit)) {
         $item->setLimit($limit);
     }
     //note: MUST clone items
     return $item->find();
 }
Exemplo n.º 4
0
 public function getDeleteItems($r)
 {
     $tpl = new Dase_Template($r);
     $items = new Dase_DBO_Item($this->db);
     $items->collection_id = $this->collection->id;
     $items->status = 'delete';
     $doomed = array();
     foreach ($items->find() as $item) {
         $doomed[] = $item->getUrl($r->app_root);
     }
     $tpl->assign('collection', $this->collection);
     $tpl->assign('doomed', $doomed);
     $r->renderResponse($tpl->fetch('manage/delete_items.tpl'));
 }
Exemplo n.º 5
0
    if ($update) {
        $user->update();
    }
}
$cms = new Dase_DBO_CollectionManager();
foreach ($cms->find() as $cm) {
    if ($cm->dase_user_eid != strtolower($cm->dase_user_eid)) {
        print "updating manager {$cm->dase_user_eid}\n";
        $cm->dase_user_eid = strtolower($cm->dase_user_eid);
        if ($update) {
            $cm->update();
        }
    }
}
$items = new Dase_DBO_Item();
foreach ($items->find() as $item) {
    if ($item->created_by_eid != strtolower($item->created_by_eid)) {
        print "updating item {$item->created_by_eid}\n";
        $item->created_by_eid = strtolower($item->created_by_eid);
        if ($update) {
            $item->update();
        }
    }
}
$vrhs = new Dase_DBO_ValueRevisionHistory();
foreach ($vrhs->find() as $vrh) {
    if ($vrh->dase_user_eid != strtolower($vrh->dase_user_eid)) {
        print "updating history {$vrh->dase_user_eid}\n";
        $vrh->dase_user_eid = strtolower($vrh->dase_user_eid);
        if ($update) {
            $vrh->update();
Exemplo n.º 6
0
 public function getItemsMarkedToBeDeletedUris($r)
 {
     $output = '';
     $items = new Dase_DBO_Item($this->db);
     $items->collection_id = $this->collection->id;
     $items->status = 'delete';
     foreach ($items->find() as $item) {
         $output .= $item->getUrl($r->app_root) . "\n";
     }
     $r->renderResponse($output);
 }