コード例 #1
0
 private static function updateFeed($feedmapper, $feed)
 {
     $newfeed = null;
     $newfeed = Utils::fetch($feed['url']);
     if ($newfeed !== null) {
         $feedmapper = new FeedMapper();
         $newfeedid = $feedmapper->save($newfeed, $feed['folderid']);
     }
 }
コード例 #2
0
ファイル: itemmapper.php プロジェクト: noldmess/apps
 /**
  * @brief Retrieve all the item corresponding to a feed from the database
  * @param feedid The id of the feed in the database table.
  */
 public function findByFeedId($feedid)
 {
     $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE feed_id = ? ORDER BY pub_date DESC');
     $result = $stmt->execute(array($feedid));
     $feedmapper = new FeedMapper($this->userid);
     $feed = $feedmapper->findById($feedid);
     $items = array();
     while ($row = $result->fetchRow()) {
         $item = $this->fromRow($row);
         $item->setFeedTitle($feed->getTitle());
         $items[] = $item;
     }
     return $items;
 }
コード例 #3
0
ファイル: feedmapper.php プロジェクト: nitewol/reader
 static function instance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #4
0
ファイル: foldermapper.php プロジェクト: netcon-source/apps
 /**
  * @brief Delete the folder and all its feeds from the database
  * @param folder the folder to be deleted (an instance of OCA\News\Folder)
  * @returns true if the folder has been deleted, false if an error occurred
  */
 public function deleteById($folderid)
 {
     if ($folderid == null) {
         return false;
     }
     // delete child folders
     $stmt = \OCP\DB::prepare('SELECT id FROM ' . self::tableName . ' WHERE parent_id = ? AND user_id = ?');
     $result = $stmt->execute(array($folderid, $this->userid));
     while ($row = $result->fetchRow()) {
         if (!self::deleteById($row['id'])) {
             return false;
         }
     }
     $stmt = \OCP\DB::prepare('DELETE FROM ' . self::tableName . ' WHERE id = ? AND user_id = ?');
     $result = $stmt->execute(array($folderid, $this->userid));
     $feedMapper = new FeedMapper($this->userid);
     //TODO: handle the value that the execute returns
     if (!$feedMapper->deleteAll($folderid)) {
         return false;
     }
     return true;
 }
コード例 #5
0
ファイル: feed.php プロジェクト: nitewol/reader
<?php

include 'header.php';
$feed = FeedMapper::instance()->find($_GET['id']);
$item_helper = new ItemHelper();
?>

<table>
<th>id</th><th>title</th>

<?php 
foreach ($feed->items() as $item) {
    ?>

<tr>
 <td><?php 
    echo $item->id();
    ?>
</td>
  <td><?php 
    echo $item_helper->link($item);
    ?>
 </td>
</tr>

<?php 
}
?>


コード例 #6
0
ファイル: item.php プロジェクト: nitewol/reader
 function feed()
 {
     return FeedMapper::instance()->find($this->feed_id());
 }
コード例 #7
0
ファイル: feed.php プロジェクト: nitewol/reader
 function mapper()
 {
     return FeedMapper::instance();
 }
コード例 #8
0
ファイル: index.php プロジェクト: nitewol/reader
<?php

include 'header.php';
$feeds = FeedMapper::instance()->find_all();
$feed_helper = new FeedHelper();
?>

<table>

<tr><th>id</th><th>title</th><th>feed url</th><th>time to live</th>
 <tr>

<?php 
foreach ($feeds as $feed) {
    ?>
<tr>

<td><?php 
    echo $feed->id();
    ?>
</td>
<td><?php 
    echo $feed_helper->link($feed);
    ?>
</td>
<td><?php 
    echo $feed->feed_url();
    ?>
</td>
<td><?php 
    echo $feed->time_to_live();