Changeset 617
- Timestamp:
- 07/01/08 19:06:58 (3 months ago)
- Location:
- trunk/app
- Files:
-
- 15 modified
-
config/core.php (modified) (1 diff)
-
config/sql/postgresql/ecourses.sql (modified) (1 diff)
-
controllers/ecourses_controller.php (modified) (5 diffs)
-
controllers/vclassrooms_controller.php (modified) (3 diffs)
-
locale/spa/LC_MESSAGES/default.po (modified) (1 diff)
-
models/ecourse.php (modified) (1 diff)
-
models/vclassroom.php (modified) (1 diff)
-
views/ecourses/admin_add.ctp (modified) (2 diffs)
-
views/ecourses/admin_edit.ctp (modified) (2 diffs)
-
views/ecourses/admin_vclassrooms.ctp (modified) (2 diffs)
-
views/layouts/rubyx.ctp (modified) (2 diffs)
-
views/vclassrooms/admin_add.ctp (modified) (3 diffs)
-
views/vclassrooms/admin_edit.ctp (modified) (3 diffs)
-
views/vclassrooms/admin_listing.ctp (modified) (1 diff)
-
views/vclassrooms/show.ctp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/config/core.php
r615 r617 14 14 * In development mode, you need to click the flash message to continue. 15 15 */ 16 Configure::write('debug', 0);16 Configure::write('debug', 1); 17 17 /** 18 18 * Application wide charset encoding -
trunk/app/config/sql/postgresql/ecourses.sql
r436 r617 8 8 "created" timestamp(0) with time zone DEFAULT now() NOT NULL, 9 9 "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) 11 12 ); 12 13 -
trunk/app/controllers/ecourses_controller.php
r583 r617 23 23 24 24 /**** ===== 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 35 26 public function admin_listing($page=1) 36 {27 { 37 28 $this->layout = 'admin'; 38 29 … … 53 44 $conditions = array("Ecourse.user_id"=>$this->Auth->user('id'), "Ecourse.id"=>$ecourse_id); 54 45 55 if ( $historic === 'historic' ) 56 { 46 if ( $historic === 'historic' ): 57 47 $this->Ecourse->filed(); //show filed classrooms 58 48 59 49 $this->set('historic', true); 60 }50 endif; 61 51 62 52 $order = "Ecourse.id DESC"; … … 97 87 $this->set('langs', Set::combine($this->Ecourse->Lang->find('all', array('order' => 'lang')), "{n}.Lang.id","{n}.Lang.lang")); 98 88 99 if (!empty($this->data['Ecourse'])) 100 { 89 if (!empty($this->data['Ecourse'])): 101 90 $this->Sanitize = new Sanitize; 102 91 … … 107 96 $this->Ecourse->create(); 108 97 109 if ($this->Ecourse->save($this->data['Ecourse'])) 110 { 98 if ($this->Ecourse->save($this->data['Ecourse'])): 111 99 $this->msgFlash('Course saved', '/admin/ecourses/edit/'.$this->Ecourse->getLastInsertID()); 112 } 113 }100 endif; 101 endif; 114 102 } 115 103 116 public function admin_edit($ id = null)104 public function admin_edit($ecourse_id = null) 117 105 { 118 106 $this->layout = 'admin'; … … 122 110 $this->set('langs', Set::combine($this->Ecourse->Lang->find('all', array('order' => 'lang')), "{n}.Lang.id","{n}.Lang.lang")); 123 111 124 if ( empty($this->data['Ecourse']) ) 125 { 112 if ( empty($this->data['Ecourse']) ): 126 113 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 136 118 $this->Sanitize = new Sanitize; 137 119 138 $this->Sanitize->html($this->data[ "Ecourse"]['description']);120 $this->Sanitize->html($this->data['Ecourse']['description']); 139 121 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; 145 126 } 146 127 -
trunk/app/controllers/vclassrooms_controller.php
r607 r617 76 76 $this->set('belongs', false); 77 77 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')))); 79 83 $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)); 86 85 } 87 86 … … 271 270 272 271 if ($this->Vclassroom->save($this->data["Vclassroom"])): 273 $this->msgFlash(' Groupadded', '/admin/ecourses/vclassrooms/'.$this->data["Vclassroom"]["ecourse_id"]);272 $this->msgFlash('vClassroom added', '/admin/ecourses/vclassrooms/'.$this->data["Vclassroom"]["ecourse_id"]); 274 273 endif; 275 274 else: … … 326 325 327 326 if ($this->Vclassroom->save($this->data['Vclassroom'])): 328 $this->msgFlash(' Your virtual classroom has beenupdated.', '/admin/vclassrooms/edit/'.$this->data['Vclassroom']['id']);327 $this->msgFlash('vClassroom updated.', '/admin/vclassrooms/edit/'.$this->data['Vclassroom']['id']); 329 328 endif; 330 329 endif; -
trunk/app/locale/spa/LC_MESSAGES/default.po
r616 r617 5 5 msgstr "Editar" 6 6 7 msgid "New eCourse" 8 msgstr "Nuevo eCourse" 9 10 msgid "Edit eCourse" 11 msgstr "Editar eCourse" 12 7 13 msgid "Save" 8 14 msgstr "Guardar" -
trunk/app/models/ecourse.php
r352 r617 50 50 'message' => 'Mimimum 8 characters long' 51 51 ), 52 'code' => array(53 'rule' => array('minLength', 4),54 'allowEmpty' => false,55 'message' => 'Mimimum 4 characters long'56 ),57 52 'lang_id' => array( 58 53 'rule' => 'numeric', -
trunk/app/models/vclassroom.php
r577 r617 11 11 public $name = 'Vclassroom'; 12 12 13 public $belongsTo = 'Ecourse'; 13 public $belongsTo = array('Ecourse' => 14 array('className' => 'Ecourse', 15 'conditions' => '', 16 'order' => '', 17 'foreignKey' => 'ecourse_id' 18 ) 19 ); 14 20 15 21 public $hasMany = array('Forum' => -
trunk/app/views/ecourses/admin_add.ctp
r585 r617 4 4 ?> 5 5 <fieldset> 6 <legend> New Course</legend>6 <legend><?php __('New eCourse');?></legend> 7 7 <table><tr><td> 8 8 <?php … … 27 27 ?> 28 28 </td></tr> 29 30 29 <tr><td> 31 <?php32 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 ?> 34 33 </td><td colspan="2"> 35 34 <?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')); 38 37 ?></fieldset> 39 38 </td></tr> -
trunk/app/views/ecourses/admin_edit.ctp
r585 r617 10 10 ?> 11 11 <fieldset> 12 <legend>Edit Course</legend>12 <legend><?php __('Edit eCourse'); ?></legend> 13 13 <table><tr><td> 14 14 <?php … … 29 29 <?php 30 30 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)); 32 32 echo $fck->load('EcourseDescription', 'Karamelo'); 33 33 ?> 34 34 </td></tr> 35 <tr><td>36 <?php37 echo $form->input('Ecourse.code', array("size" => 12, "maxlenght" => 12, 'title'=>'max. 12 characters, ie.ROM2121'));38 ?>39 </td>40 <td colspan="2">41 <?php35 <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 42 42 echo $form->label('Ecourse.status', 'Enabled:' ); 43 43 echo $form->checkbox('Ecourse.status', array("value"=>1, 'title'=>'Enabled course')); -
trunk/app/views/ecourses/admin_vclassrooms.ctp
r396 r617 1 1 <?php 2 // exit(print_r($data));2 //die(debug($data)); 3 3 4 echo $html->addCrumb('Control Tools', '/admin/entries/start');4 echo $html->addCrumb('Control Panel', '/admin/entries/start'); 5 5 echo $html->addCrumb('Courses', '/admin/ecourses/listing'); 6 6 echo $html->getCrumbs(' / '); … … 8 8 $str = 'Classrooms on ' . $data['Ecourse']['title']; 9 9 10 if ( isset( $historic ) ) 11 { 10 if ( isset( $historic ) ): 12 11 $str .= ' (filed)'; 13 } 12 endif; 14 13 15 14 echo $html->div('title_section', $str); 16 15 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));18 16 19 if ( count($data['Vclassroom']) < 1 ) 20 { 21 echo $html->div('notice', 'No classrooms yet'); 22 } 17 if ( count($data['Vclassroom']) < 1 ): 18 e($html->div('notice', 'No classrooms yet')); 19 $img = 'admin/vgroups-gray.gif'; 20 else: 21 $img = 'static/vgroups.gif'; 22 endif; 23 23 24 foreach ($data['Vclassroom'] as $val) 25 { 24 echo $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 27 foreach ($data['Vclassroom'] as $val): 26 28 $s = ($val['status'] == 1) ? 'Enabled' : 'Filed'; 27 29 28 30 $tmp = $html->div('butonright', $gags->sendEdit($val['id'], 'Vclassroom')); 29 31 $tmp .= $html->link($val['name'], '/admin/vclassrooms/members/'.$val['id']); 32 $tmp .= $html->div(null, 'Secret:'. $val['secret']); 30 33 $tmp .= $html->para(null, 'Status: '.$html->link($s,'/admin/vclassrooms/change/'.$val['id'].'/'.$val['status'].'/'.$val['ecourse_id'])); 31 34 $tmp .= $html->div('butonright', $gags->confirmDel($val['id'], 'Vclassroom')); 32 35 33 36 echo $html->div('grayblock', $tmp); 34 } 37 endforeach; 35 38 36 if ( !isset( $historic ) ) 37 { 39 if ( !isset( $historic ) ): 38 40 echo $html->link( 39 41 $html->image('admin/historic.png', array('alt'=>'Filed classrooms', 'title'=>'Filed classrooms')), 40 42 '/admin/ecourses/vclassrooms/'.$data['Ecourse']['id'].'/historic', null, null, false); 41 } 43 endif; 42 44 ?> -
trunk/app/views/layouts/rubyx.ctp
r610 r617 17 17 <meta http-equiv="content-language" content="cs" /> 18 18 <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" /> 20 20 <meta name="copyright" content="Design/Code: Vit Dlouhy [Nuvio - www.nuvio.cz]; e-mail: vit.dlouhy@nuvio.cz" /> 21 21 <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php echo '/entries/rss/'.$blog['User']['username']; ?>" /> … … 36 36 <!-- Main --> 37 37 <div id="main" class="box"> 38 38 39 39 <!-- Header --> 40 40 <div id="header"> 41 41 <!-- user_name_blog --> 42 42 <h1 id="logo"> 43 <?php echo $html->link($blog['User']['name_blog'], '/blog/'.$blog['User']['username'], array("title"=>$blog['User']['name_blog'])); ?> 43 <?php 44 e($html->link($blog['User']['name_blog'], '/blog/'.$blog['User']['username'], array("title"=>$blog['User']['name_blog']))); ?> 44 45 </h1> 45 46 46 <?php echo $html->div(null, $blog['User']['quote'], array('id'=>'quote')); ?>47 <?php echo $html->div(null, ''.$blog['User']['quote'], array('id'=>'quote')); ?> 47 48 48 49 </div> <!-- /header --> -
trunk/app/views/vclassrooms/admin_add.ctp
r591 r617 4 4 echo $javascript->link('fckeditor/fckeditor'); 5 5 6 echo $html->addCrumb('Control Tools', '/admin/entries/start');6 echo $html->addCrumb('Control Panel', '/admin/entries/start'); 7 7 echo $html->addCrumb('vGroups', '/admin/ecourses/vclassrooms/'.$this->data['Ecourse']['id']); 8 8 echo $html->getCrumbs(' / '); … … 14 14 <legend>New Group for e-Course: <?php echo $this->data['Ecourse']['title']; ?></legend> 15 15 <?php 16 echo $form->input('Vclassroom.name', array( "size" => 40, "maxlength"=> 60));16 echo $form->input('Vclassroom.name', array('size' => 40, 'maxlength' => 60)); 17 17 18 18 echo $form->label('Vclassroom.status', 'Enabled:'); 19 echo $form->checkbox('Vclassroom.status', array( "value"=>1));19 echo $form->checkbox('Vclassroom.status', array('value'=>1)); 20 20 21 21 22 echo $form->input('Vclassroom.secret', array( "size" => 7, "maxlength"=> 6));22 echo $form->input('Vclassroom.secret', array('size' => 7, 'maxlength' => 6)); 23 23 echo $form->end('Save'); 24 24 ?> … … 54 54 } 55 55 56 if (access.checked == true) 56 57 if (secret.value.length < 5) 57 58 { 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; 64 62 } 63 65 64 return true; 66 65 } -
trunk/app/views/vclassrooms/admin_edit.ctp
r352 r617 2 2 //exit(var_dump($this->data)); 3 3 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'); 6 6 echo $html->getCrumbs(' / '); 7 7 … … 14 14 <?php 15 15 echo $form->input('Vclassroom.name', array('size' => 40, 'maxlength' => 60)); 16 17 16 18 17 echo $form->label('Vclassroom.status', 'Status:'); 19 echo $form->checkbox('Vclassroom.status' , array('value'=>1));18 echo $form->checkbox('Vclassroom.status'); 20 19 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> 49 26 <script type="text/javascript"> 50 27 /* <![CDATA[ */ … … 76 53 } 77 54 78 if ( access.checked == true)55 if (secret.value.length < 5) 79 56 { 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; 86 60 } 61 87 62 return true; 88 63 } -
trunk/app/views/vclassrooms/admin_listing.ctp
r422 r617 10 10 <?php 11 11 12 $th = array ('Edit', 'Virtual classroom', 'Status' );12 $th = array ('Edit', 'Virtual classroom', 'Status', 'See'); 13 13 echo $html->tableHeaders($th); 14 foreach ($data as $val) 15 {16 $st = ( $val['Vclassroom']['status'] == 1 ) ? 'Enabled' : 'Filed'; 17 $tr = array (14 foreach ($data as $val): 15 16 $st = ( $val['Vclassroom']['status'] == 1 ) ? 'Enabled' : 'Filed'; 17 $tr = array ( 18 18 $gags->sendEdit($val['Vclassroom']['id'], 'vclassrooms'), 19 19 $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']) 21 22 //$gags->confirmDel($val['Vclassroom']['id'], 'vclassrooms') 22 23 ); 23 24 24 25 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'")); 26 27 27 } 28 endforeach; 28 29 ?> 29 30 </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 32 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)); 33 ?> -
trunk/app/views/vclassrooms/show.ctp
r607 r617 1 1 <?php 2 //exit(debug($data));2 //exit(debug($data)); 3 3 echo $javascript->link('fckeditor/fckeditor'); 4 4 5 5 echo '<h1>' . $data['Vclassroom']['name'] . '</h1>'; 6 6 7 7 if ( $belongs === true ): 8 8 echo $html->para(null, __('Welcome', true) . '!<b> '. $session->read('Auth.User.username') .'</b>'); … … 16 16 17 17 // Forums 18 if ( count($data['Forum']) > 0):18 if ( isset($data['Forum']) && count($data['Forum']) > 0): 19 19 echo $html->div('titentry', 'Forums'); 20 20 … … 25 25 26 26 // Tests 27 if ( count($data['Test']) > 0):27 if ( isset($data['Test']) && count($data['Test']) > 0): 28 28 echo $html->div('titentry', __('Quizz Tests', true)); 29 29 … … 34 34 35 35 // Webquests 36 if ( count($data['Webquest']) > 0):36 if ( isset($data['Webquest']) && count($data['Webquest']) > 0): 37 37 echo $html->div('titentry', 'Webquests'); 38 38 … … 42 42 endif; 43 43 44 if ( count($data['Treasure']) > 0):44 if ( isset($data['Treasure']) && count($data['Treasure']) > 0): 45 45 echo $html->div('titentry', __('Treasure Hunts', true)); 46 46 … … 83 83 echo $form->hidden('UsersVclassroom.vclassroom_id', array('value'=>$data['Vclassroom']['id'])); 84 84 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/", 86 86 "update"=>"updater", 87 87 "loading" => "Element.show('charging');Element.hide('updater')",
