Changeset 352

Show
Ignore:
Timestamp:
03/28/08 10:03:54 (10 months ago)
Author:
aarkerio
Message:

Improvs on Lessons and Images

Location:
trunk/app
Files:
2 added
17 modified

Legend:

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

    r350 r352  
    33*   Karamelo E-Learning Platform 
    44*   Manuel Montoya 2002-2008  
    5 *   GPLv3 License manuel<at>mononeurona.org 
     5*   GPLv3 License manuel<arroba>mononeurona<punto>org 
    66*   Chipotle Software TM 
    77*/  
     
    5454 } 
    5555 
    56  public function admin_vclassrooms($ecourse_id, $hidden = 0) 
     56 public function admin_vclassrooms($ecourse_id, $historic = null) 
    5757 { 
    5858        $this->layout = 'admin'; 
     
    6161         
    6262        $conditions   =  array("Ecourse.user_id"=>$this->Auth->user('id'), "Ecourse.id"=>$ecourse_id); 
    63         $fields       =  array('id', 'title', 'status'); 
     63         
     64    if ( $historic === 'historic' ) 
     65        { 
     66          $this->Ecourse->filed(); //show filed classrooms 
     67 
     68          $this->set('historic', true); 
     69    } 
     70      
    6471        $order        =  "Ecourse.id DESC"; 
     72         
     73        //die( debug($this->Ecourse->find($conditions))); 
    6574 
    66         $this->set('data', $this->Ecourse->find($conditions, $fields)); 
     75        $this->set('data', $this->Ecourse->find($conditions)); 
    6776  } 
    6877   
     
    8594  {    
    8695    $this->layout    = 'admin';  
    87      
    88     $this->set('subjects', Set::combine($this->Ecourse->Subject->find('all', array('order' => 'title')), "{n}.Subject.id","{n}.Subject.title")); 
     96    
     97    $this->set('subjects', Set::combine($this->Ecourse->Subject->find('all', array('order' => 'title')), "{n}.Subject.id","{n}.Subject.title")); 
    8998     
    9099    $this->set('langs', Set::combine($this->Ecourse->Lang->find('all', array('order' => 'lang')), "{n}.Lang.id","{n}.Lang.lang")); 
  • trunk/app/controllers/lessons_controller.php

    r336 r352  
    33*  Karamelo E-Learning Platform 
    44*  Manuel Montoya 2002-2008  
    5 *  GPLv3 manuel<at>mononeurona<punto>org 
     5*  GPLv3 manuel<arroba>mononeurona<punto>org 
    66*/  
    77  
     
    9595    $this->layout    = 'admin'; 
    9696     
     97    $this->set('subjects', Set::combine($this->Lesson->Subject->find('all', array('order' => 'title')), "{n}.Subject.id","{n}.Subject.title")); 
     98     
    9799     if (!empty($this->data["Lesson"])) 
    98100     { 
     
    115117{ 
    116118     $this->layout    = 'admin'; 
     119 
     120     $this->set('subjects', Set::combine($this->Lesson->Subject->find('all', array('order' => 'title')), "{n}.Subject.id","{n}.Subject.title")); 
    117121      
    118122     if ( empty( $this->data["Lesson"] ) ) 
     
    146150 public function admin_delete($id) 
    147151 { 
    148       if ($this->Lesson->del($id)) 
     152      if ($this->Lesson->del($id)) 
    149153      { 
    150154          $this->msgFlash('Lesson deleted', '/admin/lessons/listing'); 
     
    152156      else 
    153157      { 
    154            $this->flash('Error, call support', '/admin/lessons/listing'); 
     158                  $this->flash('Error, call support', '/admin/lessons/listing'); 
    155159      } 
    156160  } 
  • trunk/app/controllers/shares_controller.php

    r329 r352  
    1313    
    1414 public $components = array('Edublog', 'Adds'); 
    15   
     15 
     16 public function beforeFilter() 
     17 { 
     18      $this->Auth->allow(array('download')); 
     19      parent::beforeFilter(); 
     20 }  
    1621 public function isAuthorized() 
    1722 { 
  • trunk/app/controllers/users_controller.php

    r342 r352  
    406406    { 
    407407        //die( var_dump($this->data['User']) ); 
    408         if (strlen($this->data["User"]["pwd"]) > 5)   // only if pwd is big enough 
     408        if ( strlen($this->data["User"]["pwd"]) < 5)   // only if pwd is big enough 
    409409        { 
    410              $this->data["User"]["pwd"] = md5($this->data["User"]["pwd"]); // MD5  
    411         }  
    412         else  
    413         { 
    414              unset($this->data["User"]["pwd"]);       
     410                 unset($this->data["User"]["pwd"]);       
    415411        } 
    416412         
  • trunk/app/controllers/vclassrooms_controller.php

    r350 r352  
    7777 /***   == ADMIN METHODS === ***/    
    7878 
    79  public function admin_listing() 
     79 public function admin_listing($historic = null) 
    8080 { 
    8181      $this->layout = 'admin'; 
    82       $conditions = array("Vclassroom.user_id"=>$this->Auth->user('id')); 
    83       $fields     = array("Vclassroom.id", "Vclassroom.name", "Vclassroom.created", "Vclassroom.user_id", "Vclassroom.ecourse_id"); 
     82      $conditions = array("Vclassroom.user_id"=>$this->Auth->user('id'), "Vclassroom.status"=>1); 
     83      $fields     = array('id', 'name', 'created', 'user_id', 'ecourse_id', 'status'); 
    8484      $order      = "Vclassroom.id DESC"; 
    8585       
     86      if ($historic === 'historic') 
     87      { 
     88    $conditions['Vclassroom.status'] = 0; 
     89        $this->set('historic', true); 
     90      } 
     91 
    8692      $this->pageTitle = 'eClass'; 
    8793       
     
    195201  } 
    196202} 
    197   /** 
     203 
     204 /** 
    198205  *   
    199206  *  args id  
    200207  *   
    201   **/  
     208 **/  
    202209  public function admin_edit($id = null) 
    203210  { 
  • trunk/app/models/ecourse.php

    r342 r352  
    99class Ecourse extends AppModel { 
    1010   
    11   public $name = 'Ecourse'; 
     11  public $name = 'Ecourse';  
    1212   
    1313  public $belongsTo = array('User', 'Subject', 'Lang'); 
    1414   
    15   public $hasMany   = array('Vclassroom'); 
     15  public $hasMany   =  array('Vclassroom' => 
     16                array(  
     17                  'className'  =>  'Vclassroom',      
     18                  'foreignKey' =>  'ecourse_id',  
     19                  'conditions' =>  'status = 1' 
     20                                  ) 
     21   ); 
    1622   
     23  public function filed()  
     24  { 
     25      $this->unbindModel(array('hasMany'=>array('Vclassroom'))); 
     26 
     27      $this->bindModel( array('hasMany' => array('Vclassroom' => 
     28                                               array(  
     29                                                 'className'  =>  'Vclassroom',      
     30                                                 'foreignKey' =>  'ecourse_id',  
     31                                                 'conditions' =>  'status = 0' 
     32                                                                 ) 
     33                                   )) 
     34                      ); 
     35       return true;  
     36  } 
     37     
    1738  public $validate = array( 
    1839        'title' => array( 
  • trunk/app/models/lesson.php

    r289 r352  
    1111    public $name        = 'Lesson'; 
    1212     
    13     public $belongsTo   = 'User'; 
     13  public $belongsTo = array('User' => 
     14                array('className'  => 'User', 
     15                  'conditions' => '', 
     16                  'order'      => '', 
     17                                 'foreignKey' => 'user_id' 
     18                  ), 
     19                           'Subject' => 
     20                array('className'  => 'Subject', 
     21                  'conditions' => '', 
     22                  'order'      => null, 
     23                                 'foreignKey' => 'subject_id' 
     24                  ) 
     25                ); 
    1426     
    1527    public $validate = array( 
  • trunk/app/views/ecourses/admin_listing.ctp

    r340 r352  
    77echo $html->addCrumb('Courses', '/admin/ecourses/listing');  
    88echo $html->getCrumbs(' / ');  
    9 ?> 
    109 
    11 <p> 
    12 <?php 
    13  echo  $html->link($html->image('actions/new.png', array("alt"=>"Add new course", "title"=>"Add new course")),  '/admin/ecourses/add', null, null, false); 
    14 ?> 
    15 </p> 
     10echo $html->para(null, $html->link($html->image('actions/new.png', array("alt"=>"Add new course", "title"=>"Add new course")),  '/admin/ecourses/add', null, null, false)); 
    1611 
    17 <?php 
    18 //exit(print_r($data)); 
    1912foreach ($data as $val) 
    2013{ 
    21  echo '<div style="padding:6px 3px 28px 4px;margin:10px 0 5px 0;border:1px dotted gray;">'; 
    22       echo '<div class="butonright">' .$gags->sendEdit($val['Ecourse']['id'], 'ecourses') . '</div>'; 
    23       echo $html->link($val['Ecourse']['title'], '/admin/ecourses/vclassrooms/'.$val['Ecourse']['id']); 
    24       echo '<p>' . $val['Ecourse']['description']  . '</p>'; 
    25       echo '<div class="butonright">'. $gags->confirmDel($val['Ecourse']['id'], 'ecourses') .'</div>'; 
    26  echo '</div>'; 
     14 
     15      $tmp  = $html->div('butonright', $gags->sendEdit($val['Ecourse']['id'], 'ecourses')); 
     16      $tmp .= $html->link($val['Ecourse']['title'], '/admin/ecourses/vclassrooms/'.$val['Ecourse']['id']); 
     17      $tmp .= $html->para(null, $val['Ecourse']['description']); 
     18      $tmp .= $html->div('butonright', $gags->confirmDel($val['Ecourse']['id'], 'ecourses')); 
     19      echo $html->div('grayblock', $tmp); 
    2720} 
    2821?> 
  • trunk/app/views/ecourses/admin_vclassrooms.ctp

    r350 r352  
    66echo $html->getCrumbs(' / ');  
    77 
    8 echo $html->div('title_section', 'Virtual clasrooms  on ' . $data['Ecourse']['title'] . ' e-Course'); 
     8$str =  'Virtual clasrooms  on ' . $data['Ecourse']['title'] . ' e-Course'; 
    99 
     10if ( isset( $historic ) ) 
     11{ 
     12   $str .= ' (filed)'; 
     13} 
     14 
     15echo $html->div('title_section', $str); 
    1016 
    1117 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)); 
     
    2531      $tmp .=  $html->div('butonright', $gags->confirmDel($val['id'], 'Vclassroom')); 
    2632 
    27       echo $html->div('spaced', $tmp); 
     33      echo $html->div('grayblock', $tmp); 
     34} 
     35 
     36if ( !isset( $historic ) ) 
     37{ 
     38echo $html->link( 
     39                $html->image('admin/historic.png', array('alt'=>'Filed classrooms', 'title'=>'Filed classrooms')),  
     40                '/admin/ecourses/vclassrooms/'.$data['Ecourse']['id'].'/historic', null, null, false); 
    2841} 
    2942?> 
  • trunk/app/views/elements/admin_menu.ctp

    r351 r352  
    77                                                               ), 
    88         $html->link('eCourses', '/admin/ecourses/listing') => array( 
    9                                                                  $html->link('Add eCourses', '/admin/ecourses/add') 
     9                                                                 $html->link('Add eCourses', '/admin/ecourses/add'), 
     10                                                                         $html->link('Classrooms', '/admin/vclassrooms/listing') 
    1011                                                             ), 
    1112             $html->link('Webquests', '/admin/webquests/listing'), 
  • trunk/app/views/images/admin_listing.ctp

    r292 r352  
    66   echo $html->addCrumb('Images', '#');  
    77   echo $html->getCrumbs(' / '); 
    8    echo '<div class="title_section">Images</div>'; 
     8   echo $html->div('title_section', 'Images'); 
    99   $return = null; 
    1010 }  
     
    2929           echo $form->error('Image.file', 'Title is required.');  
    3030           echo '</fieldset>'; 
    31            echo $form->end('Upload'); ?> 
    32  
     31           echo $form->end('Upload');  
     32      ?> 
    3333</td> 
    3434</tr> 
     
    6262 { 
    6363        echo  $form->create('Image', array('action'=>'admin_delete')); 
    64         echo  $form->hidden('Image.return', array('value' => '/admin/images/listing')); 
     64        echo $form->hidden('Image.return', array('value'=>'/admin/images/listing/'.$return));  
    6565        echo  $form->hidden('Image.id', array('value' => $val['Image']['id'])); 
    6666        echo  $form->end('Delete'); 
  • trunk/app/views/lessons/admin_add.ctp

    r333 r352  
    2121  <td colspan="2"> 
    2222  <?php  
     23      echo $form->label('Lesson.subject_id', 'Subject:'); 
     24      echo $form->select('Lesson.subject_id', $subjects, null, null, false); 
     25 
    2326      echo $form->label('Lesson.body', 'Body:' ); 
    24       echo $form->textarea('Lesson.body', array("cols"=>80, "rows"=>45)); 
     27      echo $form->textarea('Lesson.body', array("cols"=>80, "rows"=>20)); 
    2528      echo $fck->load('LessonBody', 'Karamelo'); 
    2629      echo $form->error('Lesson.body', 'Body is required.');  
  • trunk/app/views/lessons/admin_edit.ctp

    r312 r352  
    22   window.onload = timedMsg; 
    33</script> 
    4 <?php $session->flash(); ?> 
    5 <?php 
    6 echo $javascript->link('myfunctions'); 
    7 echo $javascript->link('fckeditor/fckeditor');  
    8 ?> 
     4<?php  
     5  $session->flash(); 
    96 
    10 <?php  
    11    echo $html->formTag('/admin/lessons/edit','post'); 
    12    echo $html->hidden('Lesson/id'); 
     7  echo $javascript->link('myfunctions'); 
     8  echo $javascript->link('fckeditor/fckeditor');  
     9  
     10   echo $form->create('Lesson'); 
     11   echo $form->hidden('Lesson.id'); 
    1312?> 
    1413<fieldset> 
     
    1615<table> 
    1716<tr><td> 
    18   <?php  
    19      echo $form->labelTag( 'Lesson/title', 'Title:' ); 
    20      echo $html->input('Lesson/title', array("size" => 50, "maxlength" => 120, "class"=>"formas")); 
    21      echo $html->tagErrorMsg('Lesson/title', 'Title is required.');  
    22   ?> 
     17  <?php  echo $form->input('Lesson.title', array("size" => 50, "maxlength" => 120));  ?> 
    2318  </td> 
    2419  <td> 
     
    2924  <td colspan="2"> 
    3025  <?php  
    31       echo $form->labelTag( 'Lesson/body', 'Body:' ); 
    32       echo $html->textarea('Lesson/body', array("class"=>"formas", "cols"=>80, "rows"=>45)); 
    33       echo $fck->load('Lesson/body', 'Karamelo'); 
    34       echo $html->tagErrorMsg('Lesson/body', 'Body is required.');  
     26      echo $form->label('Lesson.subject_id', 'Subject:'); 
     27      echo $form->select('Lesson.subject_id', $subjects, null, null, false); 
     28 
     29      echo $form->label('Lesson.body', 'Body:' ); 
     30      echo $form->textarea('Lesson.body', array("cols"=>80, "rows"=>20)); 
     31      echo $fck->load('LessonBody', 'Karamelo'); 
    3532  ?> 
    3633  </td></tr> 
    3734  <tr><td> 
    3835  <?php  
    39      echo $form->labelTag( 'Lesson/status', 'Published:' ); 
    40      echo $html->checkbox('Lesson/status');  
     36     echo $form->label( 'Lesson.status', 'Published:' ); 
     37     echo $form->checkbox('Lesson.status', array("value"=>1));  
    4138  ?> 
    4239  </td><td> 
    4340  <?php  
    44       echo $form->labelTag( 'Lesson/disc', 'Comments allowed to this Lesson:' ); 
    45       echo $html->checkbox('Lesson/disc'); 
     41      echo $form->label('Lesson.disc', 'Comments allowed to this Lesson:' ); 
     42      echo $form->checkbox('Lesson.disc', array("value"=>1)); 
    4643       
    47       echo $form->labelTag( 'Lesson/end', 'End edition:' ); 
    48       echo $html->checkbox('Lesson/end', null, array("value"=>1));  
     44      echo $form->label( 'Lesson.end', 'End edition:' ); 
     45      echo $form->checkbox('Lesson.end', array("value"=>1));  
    4946  ?> 
    5047  </td></tr> 
    51   <tr><td colspan="2">  
    52   <?php echo $html->submit('Save'); ?> 
     48  <tr><td colspan="2"> </fieldset> 
     49  <?php echo $form->end('Save'); ?> 
    5350</td></tr> 
    5451</table> 
    55 </fieldset> 
    56 </form> 
     52 
  • trunk/app/views/vclassrooms/admin_edit.ctp

    r307 r352  
    66 echo $html->getCrumbs(' / ');  
    77 
    8  echo $form->create('Vclassroom',array('action'=>'admin_edit', "onsubmit"=>"chkForm()")); 
     8 echo $form->create('Vclassroom', array('onsubmit'=>'chkForm()')); 
    99 echo $form->hidden('Vclassroom.id'); 
    1010?> 
    1111 
    1212<fieldset> 
    13   <legend>New Group</legend>  
    14   <p> 
    15   <?php  
    16      echo $form->input('Vclassroom.name', array("size" => 40, "maxlength" => 60));  
    17      echo $form->error('Vclassroom.name', 'A name is required.');  
    18   ?> 
    19   </p><br /> 
    20   
    21    
    22   <?php  
    23      echo $form->label('Vclassroom.status', 'Status:'); 
    24      echo $form->checkbox('Vclassroom.status', array("value"=>1));  
    25 ?> 
    26   <br /></p> 
    27    
    28    <?php  
    29         $attr    = array("value"=>1, "onclick" => "showhide('invi_code')"); 
     13  <legend>Edit Group</legend>  
     14<?php 
     15    echo $form->input('Vclassroom.name', array('size' => 40, 'maxlength' => 60));  
     16      
     17 
     18    echo $form->label('Vclassroom.status', 'Status:'); 
     19    echo $form->checkbox('Vclassroom.status', array('value'=>1));  
     20 
     21    $attr    = array("value"=>1, "onclick" => "showhide('invi_code')"); 
    3022          
    31         if ($this->data['Vclassroom']['access'] == 1) 
    32         { 
     23    if ($this->data['Vclassroom']['access'] == 1) 
     24    { 
    3325           $display = 'block';   
    34             $attr['checked'] = 'checked'; 
    35          } 
    36          else 
    37          { 
    38            $display = 'none'; 
    39            
     26               $attr['checked'] = 'checked'; 
     27    } 
     28    else 
     29    { 
     30           $display = 'none';      
    4031           
    41          } 
    42     ?> 
    43    
     32    } 
    4433 
    45   <?php  
    46      echo $form->label('Vclassroom.access', 'Members only by invitation:'); 
    47      echo $form->checkbox('Vclassroom.access', $attr);  
     34    echo $form->label('Vclassroom.access', 'Members only by invitation:'); 
     35    echo $form->checkbox('Vclassroom.access', $attr);  
    4836  ?> 
    4937  <br /><br /> 
    5038   
    51   
    52    
    5339  <div id="invi_code" style="display:<?php echo $display; ?>;"> 
    5440     <?php  
    55      echo $form->label('Vclassroom.secret', 'CODE:'); 
    56      echo $html->input('Vclassroom.secret', array("size" => 5, "maxlength" => 6));  
     41      echo $form->label('Vclassroom.secret', 'CODE:'); 
     42      echo $form->input('Vclassroom.secret', array("size" => 5, "maxlength" => 6));  
    5743    ?> 
    58      <br /><br /> 
    5944  </div> 
    6045  <div style="clear:both"></div> 
     
    6752 { 
    6853      var Div = document.getElementById(a); 
    69          
     54       
    7055       if (Div.style.display == "none") 
    7156       { 
  • trunk/app/views/vclassrooms/admin_listing.ctp

    r256 r352  
    1  
    2 <?php echo $html->addCrumb('Control Tools', '/admin/entries/start'); ?>  
    3 <?php echo $html->getCrumbs(' / '); ?> 
    4  
    5 <div class="title_section">Classrooms</div> 
    6  
    7 <p><?php echo $html->link($html->image('actions/new.png', array("alt"=>"Add classroom", "title"=>"Add classroom")), '/admin/vclassrooms/add', null, false, false) ?></p> 
     1<?php  
     2  echo $html->addCrumb('Control Tools', '/admin/entries/start');  
     3  echo $html->getCrumbs(' / ');  
     4  echo $html->div('title_section', 'Classrooms'); 
     5  echo $html->link($html->image('actions/new.png', array("alt"=>"Add classroom", "title"=>"Add classroom")), '/admin/vclassrooms/add', null, null, false);  
     6?> 
    87 
    98<table class="tbadmin"> 
     
    1110//die(print_r($data)); 
    1211 
    13 $th = array ('Edit', 'Virtual classroom', 'View students', 'Delete'); 
     12$th = array ('Edit', 'Virtual classroom', 'View students', 'Status', 'Delete'); 
    1413echo $html->tableHeaders($th);   
    15 foreach ($data as $key=>$val) 
    16     {             
     14foreach ($data as $val) 
     15{        
     16  $st = ( $val['Vclassroom']['status'] == 1 ) ? 'Active' : 'Filed';      
    1717       $tr = array ( 
    1818        $gags->sendEdit($val['Vclassroom']['id'], 'vclassrooms'), 
    1919        $val['Vclassroom']['name'], 
    2020        $html->link('View students','/admin/vclassrooms/start/'.$val['Vclassroom']['id']), 
     21        $html->link('File','/admin/vclassrooms/change/'.$val['Vclassroom']['id'].'/'.$val['Vclassroom']['status']), 
    2122        $gags->confirmDel($val['Vclassroom']['id'], 'vclassrooms') 
    2223        ); 
     
    2829?> 
    2930</table> 
     31<?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)); ?> 
  • trunk/app/views/vclassrooms/admin_members.ctp

    r305 r352  
    1212$r="javascript:window.open('/admin/vclassrooms/treasure/".$data['Vclassroom']['id']."', 'blank', 'toolbar=no, scrollbars=yes,width=700,height=400')";  
    1313 
     14//popup window for forums 
     15$r="javascript:window.open('/admin/vclassrooms/forum/".$data['Vclassroom']['id']."', 'blank', 'toolbar=no, scrollbars=yes,width=700,height=400')";  
     16 
    1417echo $html->link( 
    1518         $html->image('static/icon_test.jpg', array("alt"=>"Add test", "title"=>"Add test", "style"=>"margin-right:12px") 
     
    2427        ), '#', array("onclick"=>$r), null, null, false); 
    2528 
     29 
     30 echo $html->link( 
     31        $html->image('admin/forums_icon.png', array("alt"=>"Add forum", "title"=>"Add forum", "style"=>"margin-right:12px") 
     32        ), '#', array("onclick"=>$r), null, null, false); 
     33 
    2634echo '</div>'; 
    2735 
    2836 
    29 echo '<div class="title_section">Students belonging to ' . $data['Vclassroom']['name'] . '</div>'; 
     37echo $html->div('title_section', 'Students belonging to ' . $data['Vclassroom']['name']); 
    3038?> 
    3139