Changeset 617

Show
Ignore:
Timestamp:
07/01/08 19:06:58 (3 months ago)
Author:
aarkerio
Message:

Little fixes

Location:
trunk/app
Files:
15 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/config/core.php

    r615 r617  
    1414 * In development mode, you need to click the flash message to continue. 
    1515 */ 
    16     Configure::write('debug', 0); 
     16    Configure::write('debug', 1); 
    1717/** 
    1818 * Application wide charset encoding 
  • trunk/app/config/sql/postgresql/ecourses.sql

    r436 r617  
    88  "created" timestamp(0) with time zone DEFAULT now() NOT NULL, 
    99  "status" smallint DEFAULT 0 NOT NULL, 
    10   "lang_id" int NOT NULL REFERENCES langs(id) 
     10  "lang_id" int NOT NULL REFERENCES langs(id), 
     11  "code" varchar(13) 
    1112); 
    1213 
  • trunk/app/controllers/ecourses_controller.php

    r583 r617  
    2323  
    2424 /****     ===== ADMIN SECTION ========== ****/ 
    25  public function admin_start() 
    26   { 
    27        $this->layout = 'admin'; 
    28         
    29        $conditions   =  array("user_id"=>$this->Auth->user('id')); 
    30        $fields       =  array('id', 'title', 'access',  'status'); 
    31        $order        =  "Ecourse.title DESC"; 
    32         
    33        $this->set('data', $this->Ecourse->findAll($conditions, $fields, $order)); 
    34   } 
     25 
    3526 public function admin_listing($page=1) 
    36   { 
     27 { 
    3728        $this->layout = 'admin'; 
    3829         
     
    5344        $conditions   =  array("Ecourse.user_id"=>$this->Auth->user('id'), "Ecourse.id"=>$ecourse_id); 
    5445         
    55     if ( $historic === 'historic' ) 
    56         { 
     46    if ( $historic === 'historic' ): 
    5747          $this->Ecourse->filed(); //show filed classrooms 
    5848           
    5949          $this->set('historic', true); 
    60     } 
     50    endif; 
    6151         
    6252        $order        =  "Ecourse.id DESC"; 
     
    9787    $this->set('langs', Set::combine($this->Ecourse->Lang->find('all', array('order' => 'lang')), "{n}.Lang.id","{n}.Lang.lang")); 
    9888     
    99     if (!empty($this->data['Ecourse'])) 
    100     { 
     89    if (!empty($this->data['Ecourse'])): 
    10190        $this->Sanitize = new Sanitize; 
    10291         
     
    10796        $this->Ecourse->create(); 
    10897         
    109         if ($this->Ecourse->save($this->data['Ecourse'])) 
    110         { 
     98        if ($this->Ecourse->save($this->data['Ecourse'])): 
    11199                $this->msgFlash('Course saved', '/admin/ecourses/edit/'.$this->Ecourse->getLastInsertID()); 
    112         } 
    113     } 
     100    endif; 
     101   endif; 
    114102  } 
    115103   
    116   public function admin_edit($id = null) 
     104  public function admin_edit($ecourse_id = null) 
    117105  { 
    118106    $this->layout = 'admin'; 
     
    122110    $this->set('langs', Set::combine($this->Ecourse->Lang->find('all', array('order' => 'lang')), "{n}.Lang.id","{n}.Lang.lang")); 
    123111     
    124     if ( empty($this->data['Ecourse']) ) 
    125     { 
     112    if ( empty($this->data['Ecourse']) ): 
    126113         
    127         $this->Ecourse->id = $id; 
    128          
    129         $this->Subject     = new Subject; 
    130          
    131         $this->data = $this->Ecourse->read(); 
    132          
    133     } 
    134     else 
    135     { 
     114       $this->data = $this->Ecourse->read(null, $ecourse_id); 
     115       
     116    else: 
     117       
    136118        $this->Sanitize = new Sanitize; 
    137119         
    138         $this->Sanitize->html($this->data["Ecourse"]['description']); 
     120        $this->Sanitize->html($this->data['Ecourse']['description']); 
    139121         
    140         if ($this->Ecourse->save($this->data['Ecourse'])) 
    141         { 
    142             $this->msgFlash('Course saved', '/admin/ecourses/edit/'.$this->data["Ecourse"]['id']); 
    143         } 
    144     } 
     122        if ($this->Ecourse->save($this->data['Ecourse'])): 
     123             $this->msgFlash('eCourse saved', '/admin/ecourses/edit/'.$this->data["Ecourse"]['id']); 
     124    endif; 
     125    endif; 
    145126 } 
    146127  
  • trunk/app/controllers/vclassrooms_controller.php

    r607 r617  
    7676             $this->set('belongs', false); 
    7777   endif; 
    78      
     78        
     79   // temporal lines, move to model later 
     80   //$this->Vclassroom->Ecourse->unbindModel(array('hasMany'=>array('Vclassroom'), 'belongsTo'=>array('User'))); 
     81   //$this->Vclassroom->Test->unbindModel(array('hasMany'=>array('Question'), 'belongsTo'=>array('User'))); 
     82   $this->Vclassroom->bindModel(array('belongsTo'=>array('Ecourse'=>array('fields'=>'id, title')))); 
    7983   $conditions = array("Vclassroom.status"=>1, "Vclassroom.id"=>$vclassroom_id); 
    80        
    81    // temporal lines, move to model later 
    82    $this->Vclassroom->Ecourse->unbindModel(array('hasMany'=>array('Vclassroom'), 'belongsTo'=>array('User'))); 
    83    $this->Vclassroom->Test->unbindModel(array('hasMany'=>array('Question'), 'belongsTo'=>array('User'))); 
    84  
    85    $this->set('data', $this->Vclassroom->find($conditions, null, null, 2)); 
     84   $this->set('data', $this->Vclassroom->find($conditions)); 
    8685 } 
    8786 
     
    271270         
    272271      if ($this->Vclassroom->save($this->data["Vclassroom"])): 
    273                $this->msgFlash('Group added', '/admin/ecourses/vclassrooms/'.$this->data["Vclassroom"]["ecourse_id"]); 
     272               $this->msgFlash('vClassroom added', '/admin/ecourses/vclassrooms/'.$this->data["Vclassroom"]["ecourse_id"]); 
    274273      endif; 
    275274   else:      
     
    326325        
    327326       if ($this->Vclassroom->save($this->data['Vclassroom'])): 
    328             $this->msgFlash('Your virtual classroom  has been updated.', '/admin/vclassrooms/edit/'.$this->data['Vclassroom']['id']); 
     327            $this->msgFlash('vClassroom updated.', '/admin/vclassrooms/edit/'.$this->data['Vclassroom']['id']); 
    329328       endif; 
    330329  endif; 
  • trunk/app/locale/spa/LC_MESSAGES/default.po

    r616 r617  
    55msgstr "Editar" 
    66 
     7msgid  "New eCourse" 
     8msgstr "Nuevo eCourse" 
     9 
     10msgid  "Edit eCourse" 
     11msgstr "Editar eCourse" 
     12 
    713msgid  "Save" 
    814msgstr "Guardar" 
  • trunk/app/models/ecourse.php

    r352 r617  
    5050            'message' => 'Mimimum 8 characters long' 
    5151        ), 
    52         'code' => array( 
    53             'rule' => array('minLength', 4), 
    54             'allowEmpty' => false, 
    55             'message' => 'Mimimum 4 characters long' 
    56         ), 
    5752        'lang_id' => array( 
    5853            'rule' => 'numeric', 
  • trunk/app/models/vclassroom.php

    r577 r617  
    1111  public $name      = 'Vclassroom'; 
    1212     
    13   public $belongsTo = 'Ecourse'; 
     13  public $belongsTo = array('Ecourse' => 
     14                       array('className'  => 'Ecourse', 
     15                                 'conditions' => '', 
     16                             'order'      => '', 
     17                             'foreignKey' => 'ecourse_id' 
     18                        ) 
     19                ); 
    1420 
    1521  public $hasMany = array('Forum' => 
  • trunk/app/views/ecourses/admin_add.ctp

    r585 r617  
    44?> 
    55<fieldset> 
    6   <legend>New Course</legend> 
     6  <legend><?php __('New eCourse');?></legend> 
    77  <table><tr><td> 
    88<?php 
     
    2727 ?> 
    2828</td></tr> 
    29  
    3029<tr><td> 
    31   <?php 
    32       echo $form->input('Ecourse.code', array("size" => 12, "maxlenght" => 12, 'title'=>' max. 12 characters. Example: ROM2121')); 
    33   ?> 
     30<?php 
     31 e($form->input('Ecourse.code', array("size" => 12, "maxlenght" => 12, 'title'=>' max. 12 characters. Example: ROM2121'))); 
     32?> 
    3433</td><td colspan="2"> 
    3534  <?php 
    36      echo $form->label('Ecourse.status', 'Enabled:' ); 
    37      echo $form->checkbox('Ecourse.status', array("value"=>1, 'title'=>'Enabled course'));  
     35     echo $form->label('Ecourse.status', 'Enabled:'); 
     36     echo $form->checkbox('Ecourse.status', array('value'=>1, 'title'=>'Enabled course'));  
    3837  ?></fieldset> 
    3938</td></tr> 
  • trunk/app/views/ecourses/admin_edit.ctp

    r585 r617  
    1010?> 
    1111<fieldset> 
    12   <legend>Edit Course</legend> 
     12 <legend><?php __('Edit eCourse'); ?></legend> 
    1313<table><tr><td> 
    1414<?php  
     
    2929  <?php 
    3030    echo $form->label('Ecourse.description', 'Description:'); 
    31     echo $form->textarea('Ecourse.description', array("cols" => 40, "rows" =>4)); 
     31    echo $form->textarea('Ecourse.description', array('cols'=>40, 'rows'=>4)); 
    3232    echo $fck->load('EcourseDescription', 'Karamelo'); 
    3333  ?> 
    3434 </td></tr> 
    35  <tr><td> 
    36   <?php 
    37     echo $form->input('Ecourse.code', array("size" => 12, "maxlenght" => 12, 'title'=>'max. 12 characters, ie.ROM2121'));     
    38   ?> 
    39   </td> 
    40   <td colspan="2"> 
    41   <?php 
     35<tr><td> 
     36<?php 
     37  echo $form->input('Ecourse.code', array('size' => 12, 'maxlenght' => 12, 'title'=>'max. 12 characters, ie.ROM2121')); 
     38 ?> 
     39 </td> 
     40 <td colspan="2"> 
     41 <?php 
    4242    echo $form->label('Ecourse.status', 'Enabled:' ); 
    4343    echo $form->checkbox('Ecourse.status', array("value"=>1, 'title'=>'Enabled course'));  
  • trunk/app/views/ecourses/admin_vclassrooms.ctp

    r396 r617  
    11<?php 
    2 //exit(print_r($data)); 
     2//die(debug($data)); 
    33 
    4 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 
     4echo $html->addCrumb('Control Panel', '/admin/entries/start'); 
    55echo $html->addCrumb('Courses', '/admin/ecourses/listing');  
    66echo $html->getCrumbs(' / ');  
     
    88$str =  'Classrooms  on ' . $data['Ecourse']['title']; 
    99 
    10 if ( isset( $historic ) ) 
    11 { 
     10if ( isset( $historic ) ): 
    1211   $str .= ' (filed)'; 
    13 } 
     12endif; 
    1413 
    1514echo $html->div('title_section', $str); 
    1615 
    17  echo  $html->para(null, $html->link($html->image('static/vgroups.gif', array("alt"=>"Add new group", "title"=>"Add new group")),  '/admin/vclassrooms/add/'.$data['Ecourse']['id'], null, null, false)); 
    1816 
    19 if ( count($data['Vclassroom']) < 1 ) 
    20 { 
    21   echo $html->div('notice', 'No classrooms yet'); 
    22 } 
     17if ( count($data['Vclassroom']) < 1 ): 
     18    e($html->div('notice', 'No classrooms yet')); 
     19    $img = 'admin/vgroups-gray.gif';  
     20else: 
     21    $img = 'static/vgroups.gif';    
     22endif; 
    2323 
    24 foreach ($data['Vclassroom'] as $val) 
    25 { 
     24echo  $html->para(null, $html->link($html->image($img, array("alt"=>"Add new group", "title"=>"Add new group")),  '/admin/vclassrooms/add/'.$data['Ecourse']['id'], null, null, false)); 
     25 
     26 
     27foreach ($data['Vclassroom'] as $val): 
    2628 $s = ($val['status'] == 1) ? 'Enabled' : 'Filed'; 
    2729 
    2830      $tmp  =  $html->div('butonright', $gags->sendEdit($val['id'], 'Vclassroom')); 
    2931      $tmp .=  $html->link($val['name'], '/admin/vclassrooms/members/'.$val['id']); 
     32      $tmp .=  $html->div(null, 'Secret:'. $val['secret']); 
    3033      $tmp .=  $html->para(null, 'Status: '.$html->link($s,'/admin/vclassrooms/change/'.$val['id'].'/'.$val['status'].'/'.$val['ecourse_id'])); 
    3134      $tmp .=  $html->div('butonright', $gags->confirmDel($val['id'], 'Vclassroom')); 
    3235 
    3336      echo $html->div('grayblock', $tmp); 
    34 } 
     37endforeach; 
    3538 
    36 if ( !isset( $historic ) ) 
    37 { 
     39if ( !isset( $historic ) ): 
    3840echo $html->link( 
    3941                $html->image('admin/historic.png', array('alt'=>'Filed classrooms', 'title'=>'Filed classrooms')),  
    4042                '/admin/ecourses/vclassrooms/'.$data['Ecourse']['id'].'/historic', null, null, false); 
    41 } 
     43endif; 
    4244?> 
  • trunk/app/views/layouts/rubyx.ctp

    r610 r617  
    1717<meta http-equiv="content-language" content="cs" />  
    1818<meta name="robots" content="all,follow" />  
    19 <meta name="author" content="All: ... [Nazev webu - www.url.cz]; e-mail: info@url.cz" />  
     19<meta name="author" content="Karamelo by Chipotle Software" />  
    2020<meta name="copyright" content="Design/Code: Vit Dlouhy [Nuvio - www.nuvio.cz]; e-mail: vit.dlouhy@nuvio.cz" /> 
    2121<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php echo '/entries/rss/'.$blog['User']['username']; ?>" /> 
     
    3636<!-- Main -->  
    3737<div id="main" class="box">  
    38      
     38  
    3939<!-- Header -->  
    4040<div id="header"> 
    4141<!-- user_name_blog -->           
    4242<h1 id="logo"> 
    43  <?php echo $html->link($blog['User']['name_blog'], '/blog/'.$blog['User']['username'], array("title"=>$blog['User']['name_blog'])); ?> 
     43<?php  
     44e($html->link($blog['User']['name_blog'], '/blog/'.$blog['User']['username'], array("title"=>$blog['User']['name_blog']))); ?> 
    4445</h1>  
    4546 
    46 <?php echo $html->div(null, $blog['User']['quote'], array('id'=>'quote')); ?>  
     47<?php echo $html->div(null, ''.$blog['User']['quote'], array('id'=>'quote')); ?>  
    4748      
    4849</div> <!-- /header -->  
  • trunk/app/views/vclassrooms/admin_add.ctp

    r591 r617  
    44 echo $javascript->link('fckeditor/fckeditor'); 
    55 
    6  echo $html->addCrumb('Control Tools', '/admin/entries/start');   
     6 echo $html->addCrumb('Control Panel', '/admin/entries/start');   
    77 echo $html->addCrumb('vGroups', '/admin/ecourses/vclassrooms/'.$this->data['Ecourse']['id']);  
    88 echo $html->getCrumbs(' / ');  
     
    1414  <legend>New Group for e-Course: <?php echo $this->data['Ecourse']['title']; ?></legend>   
    1515  <?php   
    16     echo $form->input('Vclassroom.name', array("size" => 40, "maxlength" => 60));  
     16    echo $form->input('Vclassroom.name', array('size' => 40, 'maxlength' => 60));  
    1717     
    1818    echo $form->label('Vclassroom.status', 'Enabled:');   
    19     echo $form->checkbox('Vclassroom.status', array("value"=>1)); 
     19    echo $form->checkbox('Vclassroom.status', array('value'=>1)); 
    2020  
    2121 
    22     echo $form->input('Vclassroom.secret', array("size" => 7, "maxlength" => 6)); 
     22    echo $form->input('Vclassroom.secret', array('size' => 7, 'maxlength' => 6)); 
    2323    echo $form->end('Save');  
    2424?> 
     
    5454   } 
    5555  
    56    if (access.checked == true) 
     56   
     57   if (secret.value.length < 5) 
    5758   { 
    58       if (secret.value.length < 5) 
    59       { 
    60         alert('You must type a secret code larger than 5 characters'); 
    61         secret.focus(); 
    62         return false; 
    63       } 
     59      alert('You must type a secret code larger than 5 characters'); 
     60      secret.focus(); 
     61      return false; 
    6462   } 
     63   
    6564   return true; 
    6665 } 
  • trunk/app/views/vclassrooms/admin_edit.ctp

    r352 r617  
    22 //exit(var_dump($this->data)); 
    33 echo $javascript->link('fckeditor/fckeditor'); 
    4  echo $html->addCrumb('Control Tools', '/admin/entries/start');   
    5  echo $html->addCrumb('Classrooms', '/admin/vclassrooms/listing');  
     4 echo $html->addCrumb('Control Panel', '/admin/entries/start');   
     5 echo $html->addCrumb('vClassrooms', '/admin/vclassrooms/listing');  
    66 echo $html->getCrumbs(' / ');  
    77 
     
    1414<?php 
    1515    echo $form->input('Vclassroom.name', array('size' => 40, 'maxlength' => 60));  
    16       
    1716 
    1817    echo $form->label('Vclassroom.status', 'Status:'); 
    19     echo $form->checkbox('Vclassroom.status', array('value'=>1));  
     18    echo $form->checkbox('Vclassroom.status');  
    2019 
    21     $attr    = array("value"=>1, "onclick" => "showhide('invi_code')"); 
    22           
    23     if ($this->data['Vclassroom']['access'] == 1) 
    24     { 
    25            $display = 'block';   
    26                $attr['checked'] = 'checked'; 
    27     } 
    28     else 
    29     { 
    30            $display = 'none';      
    31            
    32     } 
    33  
    34     echo $form->label('Vclassroom.access', 'Members only by invitation:'); 
    35     echo $form->checkbox('Vclassroom.access', $attr);  
    36   ?> 
    37   <br /><br /> 
    38    
    39   <div id="invi_code" style="display:<?php echo $display; ?>;"> 
    40      <?php  
    41       echo $form->label('Vclassroom.secret', 'CODE:'); 
    42       echo $form->input('Vclassroom.secret', array("size" => 5, "maxlength" => 6));  
    43     ?> 
    44   </div> 
    45   <div style="clear:both"></div> 
    46   <br /></fieldset> 
    47   <?php echo $form->end('Save'); ?> 
    48  
     20     echo $form->input('Vclassroom.secret', array('size' => 6, 'maxlength' => 6)) 
     21?> 
     22 <div style="clear:both"></div> 
     23 <?php echo $form->end('Save'); ?> 
     24</fieldset> 
     25</div> 
    4926<script type="text/javascript"> 
    5027/* <![CDATA[ */ 
     
    7653   } 
    7754  
    78    if (access.checked == true) 
     55   if (secret.value.length < 5) 
    7956   { 
    80       if (secret.value.length < 5) 
    81       { 
    82         alert('You must type a secret code larger than 5 characters'); 
    83         secret.focus(); 
    84         return false; 
    85       } 
     57      alert('You must type a secret code larger than 5 characters'); 
     58      secret.focus(); 
     59      return false; 
    8660   } 
     61  
    8762   return true; 
    8863 } 
  • trunk/app/views/vclassrooms/admin_listing.ctp

    r422 r617  
    1010<?php 
    1111 
    12 $th = array ('Edit', 'Virtual classroom', 'Status'); 
     12$th = array ('Edit', 'Virtual classroom', 'Status', 'See'); 
    1313echo $html->tableHeaders($th);   
    14 foreach ($data as $val) 
    15 {        
    16   $st = ( $val['Vclassroom']['status'] == 1 ) ? 'Enabled' : 'Filed';      
    17        $tr = array ( 
     14foreach ($data as $val): 
     15        
     16  $st = ( $val['Vclassroom']['status'] == 1 ) ? 'Enabled' : 'Filed';     
     17  $tr = array ( 
    1818        $gags->sendEdit($val['Vclassroom']['id'], 'vclassrooms'), 
    1919        $html->link($val['Vclassroom']['name'], '/admin/vclassrooms/members/'.$val['Vclassroom']['id']) . ' <span class="petit">'.$val['Ecourse']['title'].'</span>', 
    20         $html->link($st,'/admin/vclassrooms/change/'.$val['Vclassroom']['id'].'/'.$val['Vclassroom']['status']) 
     20        $st, 
     21        $html->link(__('See Group', true), '/vclassrooms/show/'.$val['Vclassroom']['user_id'].'/'.$val['Vclassroom']['id']) 
    2122        //$gags->confirmDel($val['Vclassroom']['id'], 'vclassrooms') 
    2223        ); 
    2324        
    2425    echo $html->tableCells($tr, array("class"=>"altRow", "onmouseover"=>"this.className='highlight'", "onmouseout"=>"this.className='altRow'"),  
    25                                 array('class'=>'evenRow',"onmouseover"=>"this.className='highlight'", "onmouseout"=>"this.className='evenRow'")); 
     26                    array('class'=>'evenRow',"onmouseover"=>"this.className='highlight'", "onmouseout"=>"this.className='evenRow'")); 
    2627     
    27     } 
     28endforeach; 
    2829?> 
    2930</table> 
    30 <?php echo $html->para(null, $html->link($html->image('admin/historic.png', array('alt'=>'See historic','title'=>'See classrooms historic')), '/admin/vclassrooms/listing/historic', null, null, false)); ?> 
     31<?php  
     32echo $html->para(null,$html->link($html->image('admin/historic.png', array('alt'=>'See historic','title'=>'See classrooms historic')), '/admin/vclassrooms/listing/historic', null, null, false));  
     33?> 
  • trunk/app/views/vclassrooms/show.ctp

    r607 r617  
    11<?php 
    2  //exit(debug($data)); 
     2//exit(debug($data)); 
    33 echo $javascript->link('fckeditor/fckeditor');  
    44 
    55 echo  '<h1>' . $data['Vclassroom']['name'] . '</h1>'; 
    6    
     6    
    77 if ( $belongs === true ): 
    88     echo  $html->para(null, __('Welcome', true) . '!<b> '. $session->read('Auth.User.username') .'</b>'); 
     
    1616 
    1717     //  Forums 
    18      if ( count($data['Forum']) > 0): 
     18     if ( isset($data['Forum']) && count($data['Forum']) > 0): 
    1919        echo $html->div('titentry', 'Forums'); 
    2020 
     
    2525     
    2626    // Tests  
    27     if ( count($data['Test']) > 0): 
     27    if ( isset($data['Test']) && count($data['Test']) > 0): 
    2828       echo $html->div('titentry', __('Quizz Tests', true)); 
    2929 
     
    3434 
    3535    // Webquests 
    36     if ( count($data['Webquest']) > 0): 
     36    if ( isset($data['Webquest']) && count($data['Webquest']) > 0): 
    3737       echo $html->div('titentry', 'Webquests'); 
    3838 
     
    4242    endif; 
    4343 
    44     if ( count($data['Treasure']) > 0): 
     44    if ( isset($data['Treasure']) && count($data['Treasure']) > 0): 
    4545       echo $html->div('titentry', __('Treasure Hunts', true)); 
    4646 
     
    8383     echo $form->hidden('UsersVclassroom.vclassroom_id', array('value'=>$data['Vclassroom']['id'])); 
    8484     echo $form->input('UsersVclassroom.code', array('size' => 6, 'maxlength'=>6, 'title'=>'Secret code', 'between'=>': ')); 
    85      echo $ajax->submit(__('Join to this class', true).$session->read('Auth.User.username'), array("url" => "/vclassrooms/jointoclass/",  
     85     echo $ajax->submit(__('Join to this class', true).' '.$session->read('Auth.User.username'), array("url" => "/vclassrooms/jointoclass/",  
    8686                                         "update"=>"updater", 
    8787                                         "loading" => "Element.show('charging');Element.hide('updater')",