Changeset 358

Show
Ignore:
Timestamp:
04/01/08 15:19:30 (9 months ago)
Author:
aarkerio
Message:

My monday work

Location:
trunk/app
Files:
6 modified

Legend:

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

    r339 r358  
    7878 } 
    7979  
    80  /** 
    81     ===== ADMIN METHODS -=========== 
    82  **/ 
     80 /**    ===== ADMIN METHODS ====== **/ 
    8381  
    8482 public function admin_listing() 
     
    121119 public function admin_delete($id) 
    122120 { 
    123     if ($this->Comment->del($id)) 
     121    if ($this->Comment->del($id)) 
    124122    { 
    125123        $this->msgFlash('Comment deleted', '/admin/comments/listing'); 
  • trunk/app/controllers/podcasts_controller.php

    r349 r358  
    5050 
    5151     $this->set('data', $this->Podcast->findAll($conditions, $fields, $order, $limit)); 
    52   } 
     52 } 
     53 
    5354 public function rss($username)  
    5455 {    
     
    9495    } 
    9596     
    96 /*********** 
    97     ====ADMIN METHODS==== 
    98 ***/     
    99  
    100     public function admin_listing() 
    101     {    
     97/******    ====ADMIN METHODS==== ***/     
     98 
     99 public function admin_listing() 
     100 {    
    102101        $this->pageTitle = $this->Auth->user('username') . '\'s Podcasts'; 
    103102         
     
    110109         
    111110        $this->set('data', $this->Podcast->findAll($conditions, $fields, $order, $limit, null, 1));  
    112     } 
    113      
    114 public function admin_add()  
    115 { 
     111 } 
     112     
     113 public function admin_add()  
     114 { 
    116115     
    117116    $this->layout    = 'admin'; 
     117     
     118    $this->set('subjects', Set::combine($this->Podcast->Subject->find('all', array('order' => 'title')), "{n}.Subject.id","{n}.Subject.title")); 
    118119     
    119120    if (!empty($this->data["Podcast"]) && is_uploaded_file($this->data['Podcast']['file']['tmp_name'])) 
     
    164165    if ( $podfile_size > $maxfilesize)  
    165166    { 
    166     $ErrMsg  = "<h1>ERROR</h1> The image is too big.<br>"; 
    167      $ErrMsg .= "<p>Bigger than 10.0 MB <br><br>"; 
    168      $ErrMsg .= "The current size: " . $podfile_size ."</p>\n"; 
     167      $ErrMsg  = "<h1>ERROR</h1> The image is too big.<br>"; 
     168      $ErrMsg .= "<p>Bigger than 10.0 MB <br><br>"; 
     169      $ErrMsg .= "The current size: " . $podfile_size ."</p>\n"; 
    169170         
    170171        /** delete uploaded file */ 
     
    179180    $order       = "Podcast.id DESC"; 
    180181     
    181     $current_id  = $this->Podcast->field($field, $conditions, $order); 
    182      
    183     $next_id     = ($current_id + 1); 
     182    $current_id  = $this->Podcast->field($field, $conditions, $order); 
     183     
     184    $next_id     = ($current_id + 1); 
    184185      
    185186    $extension   = $this->get_extension($podfile_name); 
     
    230231   if ($this->Podcast->save($this->data)) 
    231232   { 
    232        $this->flash('Your podcast has been saved.','/podcasts/listing'); 
     233       $this->msgFlash('Your podcast has been saved.','/podcasts/listing'); 
    233234   } 
    234235    
     
    239240} 
    240241 
     242 public function admin_edit($podcast_id=null) 
     243 { 
     244  $this->set('subjects', Set::combine($this->Podcast->Subject->find('all',array('order'=>'title')),'{n}.Subject.id','{n}.Subject.title')); 
     245 } 
     246 public function admin_delete($podcast_id) 
     247 { 
     248     if ( $this->Podcast->delete( $podcast_id )) 
     249     { 
     250        $this->msgFlash('Podcast removed', '/admin/podcast/listing'); 
     251     } 
     252 } 
    241253} 
    242254?> 
  • trunk/app/controllers/tests_controller.php

    r328 r358  
    33*  Karamaelo E-Learning Platform 
    44*  Chipotle Software 2002-2008  
    5 *  GPLv3 manuel<at>mononeurona<dot>org 
     5*  GPLv3 manuel<arroba>mononeurona<punto>org 
    66*/  
    77//File: /app/controllers/tests_controller.php 
     
    1414   
    1515 public $components = array('Edublog'); 
    16  
     16  
     17 public function beforeFilter()  
     18 { 
     19    $this->Auth->allow(array('view', 'display')); 
     20    parent::beforeFilter(); 
     21 } 
     22  
    1723 public function isAuthorized()  
    18   {  var_dump($this->params);     
     24      
    1925    if (isset( $this->params[Configure::read('Routing.admin')] ))  
    2026    { 
    2127        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 )  // admin and teachers 
    2228        { 
    23         return true; 
     29            return true; 
    2430        } 
    25         else  
     31        else 
    2632        {  
    2733           return false;  
     
    3036    return false;  // go away !! 
    3137 } 
    32    
     38  
    3339 public function display($username, $user_id) 
    3440 { 
  • trunk/app/views/comments/admin_listing.ctp

    r269 r358  
    11<?php  
    2   echo $html->addCrumb('Control Tools', '/admin/entries/start');  
    3   echo $html->addCrumb('Comments', '/admin/comments/listing');  
    4   echo $html->getCrumbs(' / ');  
    5 ?> 
    6  
    7 <div class="title_section"> Comments on your Blog </div> 
    8 <?php 
     2echo $html->addCrumb('Control Tools', '/admin/entries/start');  
     3echo $html->addCrumb('Comments', '/admin/comments/listing');  
     4echo $html->getCrumbs(' / ');  
     5   
     6echo $html->div('title_section', 'Comments on your Blog'); 
    97 
    108foreach ($data as $val)  
    119{ 
    12    echo '<div style="border:1px dotted gray;padding:4px;margin:2px">'; 
    13         echo $html->link($val['Entry']['title'], '/users/entry/'. $othAuth->user('username') . '/'.$val['Entry']['id']) . '<br />'; 
    14         echo $val['Comment']['created'].' <b>'.$val['Comment']['username'].' wrote:</b><br />'; 
    15         echo '<p>'.$val['Comment']['comment'] . '</p>'; 
    16         echo '<p>'. $gags->sendEdit($val['Comment']['id'], 'comments') . '   '. $gags->confirmDel($val['Comment']['id'], 'comments') .'</p>'; 
    17    echo '</div>'; 
     10  $tmp  = $html->link($val['Entry']['title'], '/users/entry/'. $cU['User']['username'] . '/'.$val['Entry']['id']) . '<br />'; 
     11  $tmp .= $val['Comment']['created'].' <b>'.$val['Comment']['username'].' wrote:</b><br />'; 
     12  $tmp .= $html->para(null, $val['Comment']['comment']); 
     13  $tmp .= $gags->confirmDel($val['Comment']['id'], 'Comment'); 
     14  echo $html->div(null, $tmp); 
    1815} 
    1916?>  
  • trunk/app/views/podcasts/admin_add.ctp

    r272 r358  
    1 <?php echo $javascript->link('myfunctions'); ?> 
    2 <?php echo $html->addCrumb('Control Tools', '/admin/entries/start'); ?>  
    3 <?php echo $html->addCrumb('Podcasts', '/admin/podcasts/listing'); ?>  
    4 <?php echo $html->getCrumbs(' / '); ?> 
     1<?php  
     2  echo $html->addCrumb('Control Tools', '/admin/entries/start');  
     3  echo $html->addCrumb('Podcasts', '/admin/podcasts/listing'); 
     4  echo $html->getCrumbs(' / ');  
    55 
    6 <div class="title_section">Add new podcast</div> 
     6  echo $html->div('title_section', 'Add new podcast'); 
    77 
    8 <div class="spaced">  
    9  
    10 <?php echo $html->formTag('/admin/podcasts/add/','post', array("enctype"=>"multipart/form-data") ); ?> 
     8  echo $form->create('Podcast', array("enctype"=>"multipart/form-data") );  
     9?> 
    1110 
    1211<fieldset> 
    1312  <legend>New podcast</legend> 
    14    <p> 
    15    <?php echo $form->labelTag( 'Podcast/file', 'MP3 File:' );?><br /> 
    16    <?php echo $html->file('Podcast/file'); ?> 
    17    <?php echo $html->tagErrorMsg('Podcast/file', 'Title is required.'); ?> 
     13   
     14 <?php  
     15  echo $form->label('Podcast.file', 'MP3 File:'); 
     16  echo $form->file('Podcast.file'); 
    1817    
    19    <?php echo $html->hiddenTag('Podcast/user_id', $othAuth->user('id')) ?> 
    20   </p> 
    21   <p> 
    22    <?php echo $form->labelTag( 'Podcast/status', 'Publish:' );?><br /> 
    23    <?php echo $html->checkbox('Podcast/status', null, array("onclick" => "showhide()")); ?> 
    24   <br /><br /></p> 
     18  echo $form->label('Podcast/status', 'Publish:'); 
     19  echo $form->checkbox('Podcast.status', array('value'=>1, 'onclick' => 'showhide()'));  
    2520   
    26   <p> 
    27   <?php echo $form->labelTag( 'Podcast/created', 'Created:' );?> 
    28   <br /> 
    29   <?php 
     21  echo $form->label('Podcast.created', 'Created:' ); 
     22  echo $form->day('Podcast.created',  date("d"), null, false); 
     23  echo $form->month('Podcast.created', date("m"), null, false); 
     24  echo $form->year('Podcast.created', 1920, 2017, date("Y"), null, false); 
    3025   
    31   echo $html->dayOptionTag('Podcast/created', null, date("d"), null, null, false); 
    32    
    33   echo $html->monthOptionTag('Podcast/created', null, date("m"), null, null, false); 
    34    
    35   echo $html->yearOptionTag('Podcast/created', null, 1920, 2017, date("Y"), null, null, false); 
    36    
    37   echo $form->labelTag( 'Podcast/subject_id', 'Subject:' ); 
    38   echo "<br />"; 
    39    
    40   echo $html->selectTag('Podcast/subject_id', $subjects, null, null, null, false); 
     26  echo $form->label( 'Podcast.subject_id', 'Subject:' ) .'<br />'; 
     27  echo $form->select('Podcast.subject_id', $subjects, null, null, null, false); 
     28 
     29  
     30  echo $form->input('Podcast.title', array("size" => 25, "maxlength" => 50));  
     31 
     32  echo $form->label('Podcast.description', 'Description:'); 
     33  echo $form->textarea('Podcast.description', array("rows"=>10, "cols"=>40)) . '</fieldset>'; 
     34 
     35  echo $form->secure(); 
     36  echo $form->end('Upload');  
    4137?> 
    42  
    43 <br /><br /> 
    44 </p> 
    45  <p> 
    46      <?php echo $form->labelTag('Podcast/title', 'Title:' );?><br /> 
    47      <?php echo $html->input('Podcast/title', array("size" => 25, "maxlength" => 50, "class"=>"formas")); ?> 
    48      <br /><br /> 
    49 </p> 
    50 <p> 
    51     <?php echo $form->labelTag('Podcast/description', 'Description:' );?><br /> 
    52     <?php echo $html->textarea('Podcast/description', array("rows"=>10, "cols"=>40)) ?> 
    53   </p> 
    54   <br /> 
    55   <?php echo $html->submit('Upload'); ?> 
    56 </fieldset> 
    57 </form> 
    58 </div> 
  • trunk/app/views/tests/admin_questions.ctp

    r264 r358  
    1 <?php 
    2 //die(print_r($data)); 
    3 if ( isset($javascript) ): 
    4       echo $html->charsetTag('UTF-8'); 
    5       echo $javascript->link('prototype'); 
    6       echo $javascript->link('scriptaculous.js?load=effects'); 
    7 endif; 
     1<?php  
     2  echo $html->addCrumb('Control Tools', '/admin/entries/start');  
     3  echo $html->addCrumb('Tests', '/admin/tests/listing');  
     4  echo $html->getCrumbs(' / ');  
     5 
     6  echo $html->div('title_section', 'Tests'); 
    87?> 
    9  
    10 <?php echo $html->addCrumb('Control Tools', '/admin/entries/start'); ?>  
    11 <?php echo $html->addCrumb('Tests', '/admin/tests/listing'); ?> 
    12 <?php echo $html->getCrumbs(' / '); ?> 
    13  
    14 <div class="title_section">Tests</div> 
    158<div id="loading" style="display: none;"> 
    169        <?php echo $html->image("static/loading.gif", array("alt"=>"Loading")); ?> 
    1710</div> 
    1811<?php 
    19  echo '<p><a href="/admin/tests/edit/'.$data['Test']['id'].'">Edit</a>&nbsp;&nbsp;'; 
     12 echo $html->para(null, $html->link('Edit', '/admin/tests/edit/'.$data['Test']['id'])) . '&nbsp;&nbsp;'; 
    2013 echo $data['Test']['title'] . "  " . $data['Test']['description']; 
    2114 echo "  ". count($data["Question"]) . " questions"; 
     15 
     16 echo $html->para(null, $html->link($html->image('actions/new.png', array("alt"=>"Add new question", "title"=>"Add new question")), '#', array("onclick"=>"hU()"), false, false));  
    2217?> 
    23 <p> 
    24  <?php echo $html->link($html->image('actions/new.png', array("alt"=>"Add new question", "title"=>"Add new question")), '#', array("onclick"=>"hU()"), false, false); ?> 
    25 </p> 
    26  
     18<!-- Ajax form beggin --> 
    2719<div id="addquestion" style="display:none"> 
    28  
    29 <?php echo $ajax->form(null,'post'); ?> 
    30 <?php echo $html->hiddenTag('Question/test_id', $data['Test']['id']); ?> 
     20<?php  
     21   echo $ajax->form(null,'post');  
     22   echo $form->hidden('Question.test_id', array('value'=>$data['Test']['id']));  
     23?> 
    3124<fieldset> 
    3225<legend>New question</legend> 
     26<?php 
     27 echo $html->div('required', $form->input('Question.question', array("size" => 40, "maxlength" => 120)));  
     28 echo $html->div('required', $form->input('Question.hint', array("size" => 40, "maxlength" => 120)));  
     29 echo $html->div('required', $form->label('Question.explanation', 'Explanation:') . $form->textarea('Question.explanation', array("cols" => 50, "rows" => 5)));  
    3330 
    34 <div class="required"> 
    35   <?php echo $form->labelTag( 'Question/question', 'Question' ); ?> 
    36   <?php echo $html->input('Question/question', array("size" => 40, "maxlength" => 120)); ?> 
    37   <?php echo $html->tagErrorMsg('Question/question', 'Question is required.'); ?> 
    38 </div> 
    39 <div class="required"> 
    40   <?php echo $form->labelTag( 'Question/hint', 'Hint:' ); ?> 
    41   <?php echo $html->input('Question/hint', array("size" => 40, "maxlength" => 120)); ?> 
    42   <?php echo $html->tagErrorMsg('Question/hint', 'Hint is required.'); ?> 
    43 </div> 
     31 $tmp = $form->label('Question.worth', 'Worth:'); 
     32 $tmp .=  $form->select('Question.worth',  array(1, 2, 3, 4, 5, 6,7, 8, 9, 10), null, null, false, false);  
     33 echo $html->div('required', $tmp); 
    4434 
    45 <div class="required"> 
    46 <?php  
    47    echo $form->labelTag('Question/explanation', 'Explanation:' );  
    48    echo $html->textarea('Question/explanation', array("cols" => 50, "rows" => 5));  
    49    echo $html->tagErrorMsg('Question/explanation', 'explanation is required.'); 
    50 ?> 
    51 </div> 
    52 <div class="required"> 
    53 <?php  
    54    echo $form->labelTag('Question/worth', 'Worth:' ); 
    55     
    56    $temp = array(1, 2, 3, 4, 5, 6,7, 8, 9, 10); 
    57     
    58    echo $html->selectTag('Question/worth', $temp, null, null, false, false);  
    59 ?> 
    60 </div> 
    61 <div> 
    62 <?php 
    63     echo $ajax->submit('Add', array("url" => "/admin/questions/add", 
     35 echo $ajax->submit('Add', array("url" => "/admin/questions/add", 
    6436                                         "update"=>"questions", 
    6537                                         "loading" => "Element.hide('questions');Element.hide('addquestion');Element.show('loading')", 
     
    7143</form> 
    7244</div> 
     45<!-- Ajax form ends --> 
    7346<?php 
    7447echo '<div id="questions">'; 
     
    7851    $answers = count($val["Answer"]); 
    7952 
    80     echo '<div style="padding:5px;border:1px dotted gray;margin:4px;">'; 
    81     echo '<div class="butonright">' . $gags->sendEdit($val['id'],   'questions')   . '</div>'; 
    82     echo '<div class="butonright">' . $gags->confirmDel($val['id'], 'questions') . '</div>'; 
     53    echo '<div style="padding:5px;border:1px dotted gray;margin:auto;">'; 
     54    echo $html->div('butonright', $gags->sendEdit($val['id'],   'Question')); 
     55    echo $html->div('butonright', $gags->confirmDel($val['id'], 'Question')); 
    8356       echo "Question: "    . $val["question"]       . "<br />"; 
    8457       echo "Hint: "        . $val["hint"]           . "<br />";