Changeset 241
- Timestamp:
- 02/19/08 17:24:43 (8 months ago)
- Location:
- trunk/app
- Files:
-
- 6 modified
-
controllers/users_controller.php (modified) (6 diffs)
-
views/elements/login.ctp (modified) (1 diff)
-
views/elements/search.ctp (modified) (1 diff)
-
views/layouts/portal.ctp (modified) (2 diffs)
-
views/news/display.ctp (modified) (1 diff)
-
webroot/css/portal/portal.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/users_controller.php
r234 r241 8 8 9 9 uses('sanitize'); 10 loadModel('Entry');11 loadModel('Podcast');12 loadModel('Catfaq');13 loadModel('Recover');14 10 15 11 class UsersController extends AppController 16 12 { 17 public $helpers = array('Ajax', 'Form', 'User', 'Fck', 'Gags'); 18 19 public $components = array('Security', 'Edublog', 'Portal', 'Email', 'Adds', 'Mypagination'); 20 21 public function index($id = null) 22 { 23 $this->pageTitle = 'View Active Users'; 24 $this->set('data', $this->User->findAll()); 25 $this->set('color', 'blue'); 26 } 27 28 public function blog($username = null, $page=1) 29 { 30 $this->layout = 'blog'; 31 32 $this->pageTitle = $username . '\'s Blog'; 33 34 $this->Entry = new Entry; 35 36 $user_id = $this->User->field("id", array("username"=>$username)); 37 38 if ($username == null || $user_id == null) 39 { 13 public $helpers = array('Ajax', 'Fck', 'Gags'); 14 15 //public $components = array('Security', 'Edublog', 'Portal', 'Email', 'Adds'); 16 17 public function isAuthorized() 18 { 19 if (isset($this->params[Configure::read('Routing.admin')])) 20 { 21 if ($this->Auth->user('role') == 'admin') 22 { 23 return false; 24 } 25 } 26 return true; 27 } 28 29 public function blog($username = null, $page=1) 30 { 31 if ($username == null || $user_id == null) 32 { 40 33 $this->redirect("/"); 41 } 42 43 $order = "Entry.id DESC"; 44 45 $fields = array("Entry.title", "Entry.body", "Entry.created", "Entry.user_id", "Entry.discution", "Entry.subject_id", "Entry.id", "User.username", "Subject.title", "Subject.id"); 46 47 //pagination 48 $total_rows = $this->Entry->findCount(array("Entry.user_id"=>$user_id, "Entry.status"=>1)); 49 50 $lmt = 10; // limit news 51 52 $targetpage = "/blog/".$username."/"; 53 54 $pagination = $this->Mypagination->init($total_rows, $page, $lmt, $targetpage); //Pagination 55 56 $this->set('pagination', $pagination); 57 58 $offset = (($page * $lmt) - 10); 59 60 $limit = $lmt . " OFFSET " . $offset; 61 62 $conditions = array("Entry.user_id"=>$user_id, "Entry.status"=>1); 63 64 $this->set('data', $this->Entry->findAll($conditions, $fields, $order, $limit)); 65 66 $this->layout = $this->Edublog->layout($user_id); 67 68 $this->Edublog->blog($user_id); 34 } 35 36 $this->layout = 'blog'; 37 38 $this->pageTitle = $username . '\'s Blog'; 39 40 $this->Entry = new Entry; 41 42 $user_id = $this->User->field("id", array("username"=>$username)); 43 44 $order = "Entry.id DESC"; 45 46 $fields = array("Entry.title", "Entry.body", "Entry.created", "Entry.user_id", "Entry.discution", "Entry.subject_id", "Entry.id", "User.username", "Subject.title", "Subject.id"); 47 48 49 $conditions = array("Entry.user_id"=>$user_id, "Entry.status"=>1); 50 51 $this->set('data', $this->Entry->findAll($conditions, $fields, $order, $limit)); 52 53 $this->layout = $this->Edublog->layout($user_id); 54 55 //$this->Edublog->blog($user_id); 69 56 } 70 57 … … 271 258 $limit = null; 272 259 $this->set('users', $this->User->findAll($conditions, $fields, $order, $limit, null, 2)); 273 }274 275 public function karanet()276 {260 } 261 262 public function karanet() 263 { 277 264 $this->pageTitle = 'Directory :: Karamelo E-learning on Web 2.0'; 278 265 … … 280 267 281 268 $this->layout = 'portal'; 282 }283 284 public function recover()285 {269 } 270 271 public function recover() 272 { 286 273 $this->pageTitle = 'Recover password :: Karamelo E-learning on Web 2.0'; 287 274 … … 289 276 290 277 $this->layout = 'portal'; 291 }292 293 public function bloggers($order = 'username', $desc = 'DESC')294 {278 } 279 280 public function bloggers($order = 'username', $desc = 'DESC') 281 { 295 282 $this->layout = 'portal'; 296 283 … … 303 290 304 291 $this->set('Element', $this->Portal->statics()); // Using Portal component 305 } 306 public function login() 307 { 308 $this->layout = 'portal'; 292 } 293 294 public function login() 295 { 296 $this->layout = 'portal'; 309 297 310 $this->pageTitle = 'Login :: Karamelo E-learning';298 $this->pageTitle = 'Login :: Karamelo E-learning'; 311 299 312 $this->set('Element', $this->Portal->statics()); // Using Portal component 313 314 if (isset($this->data)) 315 { 316 $auth_num = $this->othAuth->login($this->data['User']); 317 318 $this->set('auth_msg', $this->othAuth->getMsg($auth_num)); 319 } 320 $this->set('auth_msg', 'Welcome!'); 321 } 322 323 public function logout() 324 { 325 $this->othAuth->logout(); 326 327 $this->redirect('/news/view'); 328 } 329 330 public function noaccess() 331 { 332 $this->flash("You don't have permissions to access this page.",'/users/login'); 333 } 334 335 public function register() 336 { 300 //$this->set('Element', $this->Portal->statics()); // Using Portal component 301 302 if ($this->Auth->user()) 303 { 304 if (!empty($this->data)) 305 { 306 if (empty($this->data['User']['remember_me'])) 307 { 308 $this->Cookie->del('User'); 309 } 310 else 311 { 312 $cookie = array(); 313 $cookie['email'] = $this->data['User']['email']; 314 $cookie['token'] = $this->data['User']['pasword']; 315 $this->Cookie->write('User', $cookie, true, '+2 weeks'); 316 } 317 unset($this->data['User']['remember_me']); 318 } 319 320 $this->redirect($this->Auth->redirect()); 321 } 322 } 323 324 public function logout() 325 { 326 $this->Session->setFlash("You've successfully logged out."); 327 $this->redirect($this->Auth->logout()); 328 } 329 330 public function register() 331 { 337 332 $this->layout = 'portal'; 338 333 … … 342 337 $this->set('Element', $this->Portal->statics()); // Using Portal component 343 338 344 }339 } 345 340 346 341 public function insert() -
trunk/app/views/elements/login.ctp
r240 r241 1 1 <div id="login"> 2 3 <?php echo $html->formTag('/users/login','post', array("onsubmit"=>"return validateLogin()")); ?> 2 <?php echo $form->create('User', array("action"=>"login", "onsubmit"=>"return validateLogin()")); ?> 4 3 <fieldset> 5 4 <legend> Login</legend> 6 5 <?php 7 echo $form->labelTag( 'User/username', 'Username:' ) . "<br />"; 8 echo $html->input('User/username', array('id' => 'user_username', 'size' => '15', 'maxlength'=>'30')). '<br />'; 9 echo $html->tagErrorMsg('User/username', 'Please enter your username') .'<br />'; 10 echo $form->labelTag( 'User/passwd', 'Password:' ) .'<br />'; 11 echo $html->input('User/passwd', array('id' => 'user_passwd', 'size' => '9', 'type'=>'password')); 12 echo $html->tagErrorMsg('User/passwd', 'Please enter your password!') 6 echo $form->input('User.username', array('id' => 'user_username', 'size' => '15', 'maxlength'=>'30')). '<br />'; 7 echo $form->input('User.passwd', array('id' => 'user_passwd', 'size' => '9', 'type'=>'password')); 13 8 ?><br /> 14 Remember me: <?php echo $ html->checkbox("User/cookie");?><br />9 Remember me: <?php echo $form->checkbox("User.remember_me");?><br /> 15 10 16 <?php echo $ html->submit('Login'); ?>11 <?php echo $form->end('Login'); ?> 17 12 </fieldset> 18 </form>19 13 20 14 <p><?php echo $html->link('Join us!', '/users/register'); ?></p> -
trunk/app/views/elements/search.ctp
r240 r241 24 24 </script> 25 25 <?php 26 echo $ html->formTag('/entries/search/', 'post', array("onsubmit"=>"return chkSearch();"));27 echo $ html->input('Entry/terms', array("size" => 12, "value" => "Search...", "maxlength" => 40,26 echo $form->create('Entry', array("action"=>"return chkSearch();")); 27 echo $form->input('Entry/terms', array("size" => 12, "value" => "Search...", "maxlength" => 40, 28 28 "onblur" => "if(this.value=='') this.value='Search...';", 29 29 "onfocus"=>"if(this.value=='Search...') this.value='';")); 30 echo $ html->input('Send/button', array("src"=>"/img/search_go.gif", "type"=>"image", "value"=>"Search", "alt"=>"Search", "title"=>"Search"));30 echo $form->end('Search'); 31 31 ?> 32 </form> -
trunk/app/views/layouts/portal.ctp
r240 r241 1 <?php echo '<?xml version="1.0"?>'; ?> 2 <?php echo $html->docType(); ?> 1 <?php 2 echo '<?xml version="1.0"?>'; 3 echo $html->docType(); 4 ?> 3 5 <html xmlns="http://www.w3.org/1999/xhtml"> 4 6 <head> … … 9 11 <?php 10 12 if ( isset($javascript) ): 11 echo $html->charset Tag('UTF-8');13 echo $html->charset('UTF-8'); 12 14 echo $javascript->link('prototype'); 13 15 echo $javascript->link('myfunctions'); -
trunk/app/views/news/display.ctp
r240 r241 4 4 //die(var_dump($data)); 5 5 6 foreach ($data as $ key => $val)6 foreach ($data as $val) 7 7 { 8 8 echo "<div class=\"wrapnew\">"; 9 echo "<div class=\"news_title\">". $ val['News']['title']. "</div>";9 echo "<div class=\"news_title\">". $html->link($val['News']['title'], '/news/view/'. $val['News']['id']) . "</div>"; 10 10 echo "<div class=\"news_date\">" . $val['News']['created'] . "</div>"; 11 11 echo "<div class=\"news_body\">"; 12 12 13 echo " Subject: ". $html->link($val['Subject']['title'], '/news/all/'.$val['Subject']['id'], null, false, false) . "<br /><br />";13 echo "Theme: ". $html->link($val['Theme']['theme'], '/news/theme/'.$val['Theme']['id'], null, false, false) . "<br /><br />"; 14 14 15 15 echo $val['News']['body'] . "</div>"; -
trunk/app/webroot/css/portal/portal.css
r233 r241 333 333 } 334 334 335 .news_title{margin-top:15px;} 336 337 .news_title a {font-size:14pt;font-weight:bold;color:orange;text-decoration:none;} 338 335 339 .news_theme { 336 340 color:gray;
