function save() { /* First, convert to akStoryEntry */ $st = new akStoryEntry(); $st->book = $this->book; $st->author = $this->author; $st->create_time = $this->create_time; $st->edit_time = $this->edit_time; $st->deliver_date = $this->reference_date; $st->is_frozen = $this->is_frozen; $st->keywords = implode(',', $this->tags); $st->series = $this->series; $st->title = $this->caption; $st->section_title = $this->content_type; $st->lede = $this->thumb; $st->banner = null; // $this->altimg; $st->text = $this->path; /* Now, save it */ $st->save(); }
function db_getStoryById($storyId = 0) { global $db_cxn; /* Step 1: Connect to db if not connected */ if (0 == $storyId || !db_connect()) { return null; } /* Step 2: build and issue the primary query */ $query = "SELECT * FROM " . TBL_STORIES . " WHERE id=" . $storyId . ";"; $result = @$db_cxn->query($query); /* Step 3: pull result into user object */ if ($result->num_rows == 0) { $story = null; } else { $row = $result->fetch_assoc(); $story = new akStoryEntry($storyId); $story->id = $row['id']; $story->book = $row['book']; $story->author = $row['author']; $story->create_time = $row['create_time']; $story->edit_time = $row['edit_time']; $story->deliver_date = $row['deliver_date']; $story->is_frozen = $row['is_frozen']; $story->keywords = $row['keywords']; $story->series = $row['series']; $story->title = $row['title']; $story->section_title = $row['section_title']; $story->lede = $row['lede']; $story->banner = $row['banner']; $story->text = $row['text']; } /* Step 4: Gather any secondary chunks */ /* CLEAN: TODO: Implement me */ /* Step 5: clean up */ $result->free_result(); /* Step 6: Return the cooked story object */ return $story->getCooked(); }