3 * Static pages controller
5 * @todo Refactoring needed
6 * @author Artem Daniliants <artem@daniliants.com>
9 class Pages_Controller extends Template_Controller {
11 public $template = 'pages/base'; //defaults to template but you can set your own view file
13 public $auto_render = TRUE; //defaults to true, renders the template after the controller method is done
15 public function __construct()
17 parent::__construct(); //necessary
22 * Generate lightbox markup
24 * @param array $images
26 private function lightbox($images){
28 foreach ($images as $i){
29 $output .= '<a href="'.url::base().'static/img/screenshots/big/'.$i['img'].'.png" rel="lightbox[screenshots]" title="'.$i['title'].'"><img border=0 class="lightbox_thumbs" src="'.url::base().'static/img/screenshots/small/'.$i['img'].'.png" alt="'.$i['alt'].'"/></a>';
34 public function index()
37 $this->template->title = 'Maemo5 application for car enthusiasts and speed freaks';
38 $this->template->header = 'Home';
40 $this->template->content = '
42 <object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/edKtuF__L_8&hl=en_US&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/edKtuF__L_8&hl=en_US&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>
47 SpeedFreak is a free application for your mobile that allows you to measure your car\'s performance such as acceleration and top speed. In order to make it even
48 more interesting you can compete against others on our leaderboards to see who\'s car packs the most punch!
51 SpeedFreak is developed by group of enthusiastic programmers with passion for speed and OpenSource. If you want to get involved by contributing code, ideas, bug reports, translation and more just click on
54 $this->template->sidebar_title = 'SpeedFreak for Nokia N900';
55 $this->template->sidebar_content ='
56 <img src="'.url::base().'static/img/speedfreak_n900.png" /><br />
57 <p>Download SpeedFreak for Nokia N900.</p>
58 <p><a href="https://garage.maemo.org/projects/speedfreak/" class="link"><span><span>Download now</span></span></a></p>
65 public function leaderboards($category='')
67 //@todo: Fix this hack. OMG what a horrible hack. That's what I get for coding at 4am =)
68 $categories = array('acceleration-0-20' => 'Acceleration from 0 to 20 km/h', 'acceleration-0-40' => 'Acceleration from 0 to 40 km/h', 'acceleration-0-100'=> 'Acceleration from 0 to 100 km/h');
70 if (!array_key_exists($category,$categories))
71 $category='acceleration-0-100';
73 $this->template->title = $categories[$category];
75 $results = new Result_Model();
76 if ($rows=$results->get_results($category,10)){
78 foreach ($rows as $r){
81 <td align="right">'.$r->username.'</td>
82 <td align="center">'.$r->value.' seconds</td>
83 <td>'.$r->result_date.'</td>
87 <table cellspacing="20" cellpadding="20">
89 <td><strong>Nick</strong></td>
90 <td><strong>Record (seconds)</strong></td>
91 <td><strong>Date</strong></td>
99 $output="No results :(";
103 $this->template->header = $categories[$category];
104 $this->template->content = $output;
105 $this->template->sidebar_title = 'Categories';
106 $this->template->sidebar_content ='
108 <li><a href="'.url::site('pages/leaderboards/acceleration-0-20').'" title="Leaderboard for acceleration from 0 to 20 km/h category">Acceleration from 0 to 20 km/h</a></li>
109 <li><a href="'.url::site('pages/leaderboards/acceleration-0-40').'" title="Leaderboard for acceleration from 0 to 40 km/h category">Acceleration from 0 to 40 km/h</a></li>
110 <li><a href="'.url::site('pages/leaderboards/acceleration-0-100').'" title="Leaderboard for acceleration from 0 to 100 km/h category">Acceleration from 0 to 100 km/h</a></li>
118 public function screenshots()
120 $this->template->title = 'Screenshots';
121 $this->template->header = 'Screenshots';
122 $this->template->head = '
123 <script type="text/javascript" src="'.url::base().'static/js/prototype.js"></script>
124 <script type="text/javascript" src="'.url::base().'static/js/scriptaculous.js?load=effects,builder"></script>
125 <script type="text/javascript" src="'.url::base().'static/js/lightbox.js"></script>
126 <link rel="stylesheet" href="'.url::base().'static/css/lightbox.css" type="text/css" media="screen" />
129 $screenshots=array();
130 $screenshots[0]['img']=1;
131 $screenshots[0]['alt']='Main window';
132 $screenshots[0]['title']='OpenSource Maemo 5 application for car enthusiasts';
134 $screenshots[1]['img']=2;
135 $screenshots[1]['alt']='Acceleration screen';
136 $screenshots[1]['title']='See how fast your car accelerates and compete for the first position on our leaderboards';
138 $screenshots[2]['img']=3;
139 $screenshots[2]['alt']='Categories window';
140 $screenshots[2]['title']='You can compete in defferent categories';
142 $screenshots[3]['img']=4;
143 $screenshots[3]['alt']='Route window';
144 $screenshots[3]['title']='Save your roadtrip route';
146 $screenshots[4]['img']=5;
147 $screenshots[4]['alt']='Registration window';
148 $screenshots[4]['title']="Participating in our community is as easy as registering for an account";
150 $screenshots[5]['img']=6;
151 $screenshots[5]['alt']='Credits window';
152 $screenshots[5]['title']='SpeedFreak is developed by a group of dedicated contributors. Join us and help make it even better!';
154 $lightbox = $this->lightbox($screenshots);
156 $this->template->content = '
159 $this->template->sidebar_title = 'SpeedFreak for Nokia N900';
160 $this->template->sidebar_content ='
161 <img src="'.url::base().'static/img/speedfreak_n900.png" /><br />
162 <p>Download SpeedFreak for Nokia N900.</p>
163 <p><a href="#" class="link"><span><span>Download now</span></span></a></p>