Fix CRLF -> LF
This commit is contained in:
		
							parent
							
								
									e14b564742
								
							
						
					
					
						commit
						656d2e67cc
					
				
					 1 changed files with 63 additions and 63 deletions
				
			
		
							
								
								
									
										126
									
								
								tag.php
									
										
									
									
									
								
							
							
						
						
									
										126
									
								
								tag.php
									
										
									
									
									
								
							| 
						 | 
					@ -1,64 +1,64 @@
 | 
				
			||||||
<?php
 | 
					<?php
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * COPS (Calibre OPDS PHP Server) class file
 | 
					 * COPS (Calibre OPDS PHP Server) class file
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 | 
					 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 | 
				
			||||||
 * @author     Sébastien Lucas <sebastien@slucas.fr>
 | 
					 * @author     Sébastien Lucas <sebastien@slucas.fr>
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require_once('base.php');
 | 
					require_once('base.php');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class tag extends Base {
 | 
					class tag extends Base {
 | 
				
			||||||
    const ALL_TAGS_ID = "calibre:tags";
 | 
					    const ALL_TAGS_ID = "calibre:tags";
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public $id;
 | 
					    public $id;
 | 
				
			||||||
    public $name;
 | 
					    public $name;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public function __construct($pid, $pname) {
 | 
					    public function __construct($pid, $pname) {
 | 
				
			||||||
        $this->id = $pid;
 | 
					        $this->id = $pid;
 | 
				
			||||||
        $this->name = $pname;
 | 
					        $this->name = $pname;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public function getUri () {
 | 
					    public function getUri () {
 | 
				
			||||||
        return "?page=".parent::PAGE_TAG_DETAIL."&id=$this->id";
 | 
					        return "?page=".parent::PAGE_TAG_DETAIL."&id=$this->id";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public function getEntryId () {
 | 
					    public function getEntryId () {
 | 
				
			||||||
        return self::ALL_TAGS_ID.":".$this->id;
 | 
					        return self::ALL_TAGS_ID.":".$this->id;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static function getCount() {
 | 
					    public static function getCount() {
 | 
				
			||||||
        $nTags = parent::getDb ()->query('select count(*) from tags')->fetchColumn();
 | 
					        $nTags = parent::getDb ()->query('select count(*) from tags')->fetchColumn();
 | 
				
			||||||
        $entry = new Entry ("Tags", self::ALL_TAGS_ID, 
 | 
					        $entry = new Entry ("Tags", self::ALL_TAGS_ID, 
 | 
				
			||||||
            "Alphabetical index of the $nTags tags", "text", 
 | 
					            "Alphabetical index of the $nTags tags", "text", 
 | 
				
			||||||
            array ( new LinkNavigation ("?page=".parent::PAGE_ALL_TAGS)));
 | 
					            array ( new LinkNavigation ("?page=".parent::PAGE_ALL_TAGS)));
 | 
				
			||||||
        return $entry;
 | 
					        return $entry;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
       
 | 
					       
 | 
				
			||||||
    public static function getTagById ($tagId) {
 | 
					    public static function getTagById ($tagId) {
 | 
				
			||||||
        $result = parent::getDb ()->prepare('select id, name  from tags where id = ?');
 | 
					        $result = parent::getDb ()->prepare('select id, name  from tags where id = ?');
 | 
				
			||||||
        $result->execute (array ($tagId));
 | 
					        $result->execute (array ($tagId));
 | 
				
			||||||
        if ($post = $result->fetchObject ()) {
 | 
					        if ($post = $result->fetchObject ()) {
 | 
				
			||||||
            return new Tag ($post->id, $post->name);
 | 
					            return new Tag ($post->id, $post->name);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return NULL;
 | 
					        return NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public static function getAllTags() {
 | 
					    public static function getAllTags() {
 | 
				
			||||||
        $result = parent::getDb ()->query('select tags.id as id, tags.name as name, count(*) as count
 | 
					        $result = parent::getDb ()->query('select tags.id as id, tags.name as name, count(*) as count
 | 
				
			||||||
from tags, books_tags_link
 | 
					from tags, books_tags_link
 | 
				
			||||||
where tags.id = tag
 | 
					where tags.id = tag
 | 
				
			||||||
group by tags.id, tags.name
 | 
					group by tags.id, tags.name
 | 
				
			||||||
order by tags.name');
 | 
					order by tags.name');
 | 
				
			||||||
        $entryArray = array();
 | 
					        $entryArray = array();
 | 
				
			||||||
        while ($post = $result->fetchObject ())
 | 
					        while ($post = $result->fetchObject ())
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            $tag = new Tag ($post->id, $post->name);
 | 
					            $tag = new Tag ($post->id, $post->name);
 | 
				
			||||||
            array_push ($entryArray, new Entry ($tag->name, $tag->getEntryId (), 
 | 
					            array_push ($entryArray, new Entry ($tag->name, $tag->getEntryId (), 
 | 
				
			||||||
                "$post->count books", "text", 
 | 
					                "$post->count books", "text", 
 | 
				
			||||||
                array ( new LinkNavigation ($tag->getUri ()))));
 | 
					                array ( new LinkNavigation ($tag->getUri ()))));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return $entryArray;
 | 
					        return $entryArray;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue