<?php include 'config.php'; $comms = new Dase_DBO_Comment($db); foreach ($comms->find() as $c) { $item = new Dase_DBO_Item($db); $item->load($c->item_id); $item->comments_updated = $c->updated; $item->comments_count = $item->comment_count + 1; $item; $item->update(); } $cs = new Dase_DBO_Collection($db); $i = 0; foreach ($cs->find() as $c) { print "\nworking on {$c->collection_name}\n\n"; foreach ($c->getItems() as $item) { $i++; $item = clone $item; if (!$item->collection_name) { $item->collection_name = $c->collection_name; $type = $item->getItemType(); $item->item_type_ascii_id = $type->ascii_id; $item->item_type_name = $type->name; $item->update(); } print "\n{$i}"; } }
public function getCommentsJson($app_root, $eid = '') { $db = $this->db; $comments = new Dase_DBO_Comment($db); $comments->item_id = $this->id; $comments->updated_by_eid = $eid; $comments->orderBy('updated DESC'); $com = array(); foreach ($comments->find() as $c_obj) { $c['id'] = $c_obj->id; //$c['updated'] = $c_obj->updated; $c['updated'] = date('D M j, Y \\a\\t g:ia', strtotime($c_obj->updated)); $c['eid'] = $c_obj->updated_by_eid; $c['text'] = $c_obj->text; $c['url'] = $this->getUrl($app_root) . '/comments/' . $c_obj->id; $com[] = $c; } return Dase_Json::get($com); }