示例#1
0
 public function testDelete()
 {
     $folder = new Folder();
     $folder->setId(3);
     $sql = 'DELETE FROM `*PREFIX*news_folders` WHERE `id` = ?';
     $arguments = array($folder->getId());
     $sql2 = 'DELETE FROM `*PREFIX*news_feeds` WHERE `folder_id` = ?';
     $sql3 = 'DELETE FROM `*PREFIX*news_items` WHERE `feed_id` NOT IN ' . '(SELECT `feeds`.`id` FROM `*PREFIX*news_feeds` `feeds`)';
     $arguments2 = array($folder->getId());
     $this->setMapperResult($sql, $arguments);
     $this->setMapperResult($sql2, $arguments2);
     $this->setMapperResult($sql3);
     $this->folderMapper->delete($folder);
 }
示例#2
0
 public function getFolderCollection($where)
 {
     global $dRep;
     $where = $this->sqlBuilder->createWhere($where, '');
     $sql = "SELECT * FROM ink_folders WHERE {$where} ORDER BY folderOrder;";
     $data = $this->runManyQuery($sql);
     $folders = array();
     foreach ($data as $index => $row) {
         $folder = new Folder();
         $properties = array('id' => $row['folderId'], 'name' => $row['folderName'], 'site' => $row['siteId'], 'parent' => $dRep->getFolder($row['parentId']), 'files' => $dRep->getFileCollection(array('folder' => $row['folderId'])), 'order' => $row['folderOrder']);
         $folder->setProperties($properties);
         $this->folders[$folder->getId()] = $folder;
         $folders[] = $folder;
     }
     return $folders;
 }
 public function handleRoadmaps()
 {
     $default_folders = array();
     $conn = Doctrine_Manager::getInstance()->connection();
     $roadmaps = $conn->execute("SELECT id, user_id from `roadmap` WHERE folder_id is NULL")->fetchAll();
     foreach ($roadmaps as $roadmap) {
         if (!array_key_exists($roadmap['user_id'], $default_folders)) {
             $folder = $conn->execute("SELECT id from `folder` WHERE `user_id` = :user_id and `type` = '" . Folder::TYPE_ROADMAP . "' and `deletable` = 0 LIMIT 1;", array(':user_id' => $roadmap['user_id']))->fetchAll();
             if (count($folder)) {
                 $default_folders[$roadmap['user_id']] = $folder[0]['id'];
             } else {
                 $folder = new Folder();
                 $folder->setName('Default');
                 $folder->setUserId($roadmap['user_id']);
                 $folder->setDeletable(0);
                 $folder->setType(Folder::TYPE_ROADMAP);
                 $folder->save();
                 $default_folders[$roadmap['user_id']] = $folder->getId();
             }
         }
         $conn->execute("UPDATE `roadmap` SET `folder_id` = :folder_id WHERE id = :id", array(':folder_id' => $default_folders[$roadmap['user_id']], ':id' => $roadmap['id']));
     }
 }
示例#4
0
 /**
  * @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 delete(Folder $folder)
 {
     $folderid = $folder->getId();
     return deleteById(folderid);
 }
示例#5
0
 public function testGetId()
 {
     assertThat($this->folder->getId(), is($this->folderId));
 }
示例#6
0
 /**
  * This is the constructor for the KTAPI_Folder.
  *
  * @author KnowledgeTree Team
  * @access private
  * @param KTAPI $ktapi
  * @param Folder $folder
  * @return KTAPI_Folder
  */
 function KTAPI_Folder(&$ktapi, &$folder)
 {
     $this->ktapi =& $ktapi;
     $this->folder =& $folder;
     $this->folderid = $folder->getId();
 }