Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
12345 anikendra 1
<?php
2
/*
3
 * Twitter Bootstrap View Helper 
4
 *
5
 * Copyright 2012, visionred (http://visionred.org)
6
 *
7
 * Licensed under The MIT License
8
 * Redistributions of files must retain the above copyright notice.
9
 *
10
 * @author 		  Florian Nitschmann (f.nitschmann@visionred.org) 
11
 * @copyright     Copyright 2012, visionred (http://visionred.org)
12
 * @link          http://visionred.org, visionred Web Solutions
13
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
14
 */
15
 
16
class BootstrapHelper extends AppHelper {
17
 
18
	public $helpers = array('Html');			
19
 
20
	/*
21
	 * laod($type = 'min') - Load all Twitter Bootstap Framework Files
22
	 * 
23
	 * @access public
24
	 * @param String $type - The type for the Twitter Bootstrap Version (min: compressed, dev: uncompressed) 
25
	 * @return html  
26
	 */
27
	public function load($type = 'min') {
28
		//Create the html tags: 
29
		echo $this->Html->css('twitter/bootstrap/'.$this->filename($type).''); 
30
		echo $this->Html->script('twitter/bootstrap/'.$this->filename($type).''); 			
31
	}
32
 
33
	/*
34
	 * css($type = 'min') - Load Twitter Bootstrap CSS File
35
	 * 
36
	 * @access public
37
	 * @param String $type - The type for the Twitter Bootstrap Version (min: compressed, dev: uncompressed) 
38
	 * @return html  
39
	 */
40
	public function css($type = 'min') {
41
		//Load CSS and create html tag: 
42
		echo $this->Html->css('twitter/bootstrap/'.$this->filename($type).''); 
43
	}
44
 
45
	/*
46
	 * js($type = 'min') - Load Twitter Bootstrap JS File
47
	 * 
48
	 * @access public
49
	 * @param String $type - The type for the Twitter Bootstrap Version (min: compressed, dev: uncompressed) 
50
	 * @return html  
51
	 */
52
	public function js($type = 'min') {
53
		//Load JS and create html tag: 
54
		echo $this->Html->script('twitter/bootstrap/'.$this->filename($type).''); 			
55
	}
56
 
57
	/*
58
	 * filename($type) - Returns the specific filename for compressed or uncompressed Bootstrap Files
59
	 * 
60
	 * @access private
61
	 * @param String $type - dev for uncompressed or min for compressed files
62
	 * @return String 
63
	 */
64
	private function filename($type) {
65
		$type = strtolower($type); 
66
		$filename = '';
67
 
68
		if($type == 'dev' || $type == 'min') {
69
			if($type == 'dev') $filename = 'bootstrap';
70
			else $filename = 'bootstrap.min'; 
71
		}
72
		else $filename = 'bootstrap.min'; 
73
 
74
		return $filename; 
75
	}
76
 
77
}