Changeset 240

Show
Ignore:
Timestamp:
02/18/08 20:28:30 (8 months ago)
Author:
aarkerio
Message:

Update views to cakephp 1.2

Location:
trunk/app
Files:
7 added
7 removed
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/controllers/news_controller.php

    r238 r240  
    1111class NewsController extends AppController { 
    1212   
    13   public $helpers          = array('Ajax', 'Form', 'Fck', 'News', 'Time', 'Gags'); 
    14    
    15   public $components       = array('Portal', 'Mypagination', 'Security', 'Session'); 
     13  public $helpers          = array('Ajax', 'Fck', 'News', 'Time', 'Gags'); 
     14   
     15  //public $components       = array('Portal'); 
    1616   
    1717  public function display($page=1)  
     
    2323        $conditions = array("News.status"=>1); 
    2424 
    25         $fields     = array("News.id", "News.title", "News.comments", "News.body", "News.created", "News.reference", "News.theme_id", "News.user_id", "Theme.img", "Theme.theme", "User.username"); 
     25        $fields     = array("News.id", "News.title", "News.comments", "News.body", "News.created", "News.reference", "News.theme_id", "News.user_id", "Theme.img", "Theme.theme", "User.username", "Subject.title", "Subject.id"); 
    2626         
    2727        $order      = "News.id DESC"; 
  • trunk/app/views/layouts/portal.ctp

    r239 r240  
    11<?php echo '<?xml version="1.0"?>'; ?> 
    2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     2<?php echo $html->docType(); ?> 
    33<html xmlns="http://www.w3.org/1999/xhtml"> 
    44<head> 
    55<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
    66<title>Karamelo:: <?php echo $title_for_layout; ?> </title> 
    7 <meta name="keywords" content="education, school" /> 
     7<meta name="keywords" content="education, school, elearning" /> 
    88<meta name="description" content="Educational Portal" /> 
    99<?php 
     
    2323<div id="toplinks"> 
    2424<?php 
    25  if ( $othAuth->sessionValid() ) 
     25 if ( isset( $cU['User']['id']) ) 
    2626 { 
    2727   echo '<span style="font-size:7pt;color:#8bb126;padding-right:15px">You are logged in as <b>'; 
    2828 
    29    echo $othAuth->user('username') .'</b></span>'.$html->link('(Logout)', '/users/logout') . ' | ';  
     29   echo $cU['User']['username'] .'</b></span>'.$html->link('(Logout)', '/users/logout') . ' | ';  
    3030 
    3131        if ( $othAuth->user('group_id') < 3 ) // the logged user is teacher or admin? 
     
    5959   echo $this->renderElement('menu_b'); 
    6060   
    61    if ( $othAuth->sessionValid() ) 
     61   if ( isset( $cU['User']['id']) ) 
    6262   { 
    6363           echo '<div class="spaced">'.$html->link('Logout','/users/logout').'</div>'; 
     
    6868   } 
    6969 
    70   echo  $this->renderElement('lastentries', $Element["Lentry"]); 
     70// echo  $this->renderElement('lastentries', $Element["Lentry"]); 
    7171   echo  '<br />';    
    72    echo  $this->renderElement('poll',       $Element["Poll"]);  
     72//echo  $this->renderElement('poll',       $Element["Poll"]);  
    7373         
    74   echo $this->renderElement('subjects');  
     74// echo $this->renderElement('subjects');  
    7575?> 
    76        <ul>   
    77       
    78             <li id="archives"> 
    79                 <h2 class="bg3">Search</h2> 
    80                              <?php echo $this->renderElement('search'); ?>           
     76       <ul>    
     77        <li id="archives"> 
     78            <h2 class="bg3">Search</h2> 
     79                       <?php echo $this->renderElement('search'); ?>             
    8180            </li> 
    8281        </ul> 
     
    8887<div id="footer"> 
    8988 
    90     <p><?php echo $this->renderElement('footer') . '<br />  ' . $this->renderElement('quote',   $Element["Quote"]); ?></p> 
     89    <p><?php  
     90    // echo $this->renderElement('footer') . '<br />  ' . $this->renderElement('quote',   $Element["Quote"]);  
     91?></p> 
    9192 
    92     <p id="legal"><strong>Karamelo</strong> &copy; 2007. Designed by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a></p> 
     93    <p id="legal"><strong>Karamelo</strong> &copy; 2002-2008. Designed by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a></p> 
    9394    <p id="links"> <a href="#">Privacy Policy</a> | <a href="#">Terms of Use</a> | <a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional"><abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a> | <a href="http://jigsaw.w3.org/css-validator/check/referer" title="This page validates as CSS"><abbr title="Cascading Style Sheets">CSS</abbr></a></p> 
    9495</div> 
    9596<!-- end footer --> 
    9697<?php 
    97  if ( !$othAuth->sessionValid() ) 
     98 if ( !isset( $cU['User']) ) 
    9899 { 
    99100            echo $this->renderElement('login_hide'); 
  • trunk/app/views/news/display.ctp

    r238 r240  
    1  <div class="titnew"><?php echo $data['News']['title']; ?></div> 
    2  <div class="redaccion">From  <i><?php echo $data['Theme']['theme']; ?> dept</i>,  
    3     posted by <a style="font-size:7pt;" href="/users/blogger/<?php echo $data['User']['username']; ?>"><?php echo $data['User']['username']; ?></a> on <?php echo $data['News']['created']; ?></div>  
    4     <div class="bodynew"> 
    5      
    6     <div class="img_new">            
    7     <?php echo $html->link( 
    8                            $html->image('themes/'.$data['Theme']['img'], array("alt"=>$data['Theme']['theme'], "title"=>$data['Theme']['theme'], "class"=>"themes")),  
    9                            '/news/category/' .$data['News']['theme_id'],  
    10                            null, null, false);  
    11     ?> 
    12     </div> 
    13       
    14     <?php  echo $data['News']['body']; ?> 
    15      
    16     <br /> 
    17     <span style="font-size:7pt;">Permalink:</span> <br /> 
    18     <a style="font-size:7pt;" href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/news/display/<?php echo $data['News']['id']; ?>">http://<?php echo $_SERVER['SERVER_NAME']; ?>/news/display/<?php echo $data['News']['id']; ?></a> 
    19     <br /><br /> 
    20     <b>Reference:</b> 
    21      
    22     <?php echo $html->link( 
    23                            $html->image('static/newwindow.gif', array("alt"=>"Open new window", "title"=>"Open new window")), 
    24                            $data['News']['reference'], 
    25                            array("onclick"=>"window.open(this.href, '_help', 'status,scrollbars,resizable,width=800,height=600,left=10,top=10,menubar,toolbar')"),  
    26                            null, 
    27                            null, 
    28                            false); 
    29      
    30      
    31   echo $news->socialNets($data['News']['id'], $data['News']['title']); // Social nets buttons 
    32      
    33   if ( $data['News']['comments'] == 1 )  // comments are actived ?? 
     1<div class="title_section">News</div> 
     2 
     3<?php 
     4//die(var_dump($data)); 
     5 
     6foreach ($data as $key => $val) 
     7{ 
     8  echo "<div class=\"wrapnew\">"; 
     9  echo "<div class=\"news_title\">". $val['News']['title']   . "</div>"; 
     10  echo "<div class=\"news_date\">" . $val['News']['created'] . "</div>"; 
     11  echo "<div class=\"news_body\">"; 
     12   
     13  echo "Subject: ". $html->link($val['Subject']['title'], '/news/all/'.$val['Subject']['id'], null, false, false) . "<br /><br />"; 
     14   
     15  echo  $val['News']['body']    . "</div>"; 
     16   
     17  if (strlen($val['News']['reference'])  > 5 )  // the reference 
    3418  { 
    35          $i = 1; 
    36             echo '<div id="cnews">'; 
    37             foreach($data["Commentnews"] as $v) 
    38             { 
    39               $bg = ($i%2==0) ? "#e2e2e2" : "#fff"; 
    40                
    41               echo '<div class="comentnew" style="background-color:'.$bg.'">';   
    42                  echo $time->timeAgoInWords($v["created"]) . " <b>". $v["name"]    . "</b> wrote:<br />"; 
    43                  echo $v["comment"]; 
    44               echo "</div>"; 
    45               $i++; 
    46             } 
    47             echo "</div>"; 
     19      echo "<div>". $html->link('Reference', $val['News']['reference']) ."</div>"; 
     20  } 
     21   
     22  echo "</div>"; 
     23 } 
    4824?> 
    49  
    50 <p> 
    51 <?php  
    52    echo $html->formTag('/commentnews/add/','post', array("onsubmit"=>"return validateNew()")); 
    53    echo $html->hiddenTag('Commentnews/new_id', $data['News']['id']);  
    54    echo $html->hiddenTag('Commentnews/level', 1); 
    55    echo $html->hiddenTag('Commentnews/comentnew_id', 1); 
    56 ?> 
    57 <fieldset> 
    58 <legend>Add comment:</legend> 
    59  
    60   <?php  
    61   if ( $othAuth->user('username') )  
    62   { 
    63      echo $html->hiddenTag('Commentnews/user_id', $othAuth->user('id')); 
    64      echo $html->hiddenTag('Commentnews/name', $othAuth->user('username')); 
    65      echo '<b>'. $othAuth->user('username') . '</b>  writes. '; 
    66   } 
    67   else 
    68   { 
    69      echo $html->hiddenTag('Commentnews/user_id', 0); 
    70      echo $html->input('Commentnews/name', array("size" => 25, "maxlength" => 50)); 
    71      echo $form->labelTag( 'Commentnews/name', ' Name:' ); 
    72      echo $html->tagErrorMsg('Commentnews/name', 'Name is required.'); 
    73       
    74      echo '<br /><br /> <img src="'. $html->url('/comentnews/captcha') .'" alt="Captcha" /> <br />'; 
    75      echo $html->input('Commentnews/captcha', array("size" => 6, "maxlength" => 6)); 
    76      echo $form->labelTag( 'Commentnews/cptcha', 'Introduce el codigo, todas la letras son minusculas' ); 
    77   } 
    78   ?> 
    79    
    80   <?php echo $form->labelTag( 'Commentnews/comment', 'Comment:' );?><br /> 
    81   <?php echo $html->textarea('Commentnews/comment', array("cols"=>70, "rows"=>10)) ?> 
    82   <?php echo $html->tagErrorMsg('Commentnews/comment', 'Comment is required.'); ?> 
    83   <br /> 
    84  </p> 
    85    
    86   <br /> 
    87   <?php echo $html->submit('Add comment') ?> 
    88 </fieldset> 
    89 </form> 
    90 <?php } ?> 
    91 </div>