Changeset 43

Show
Ignore:
Timestamp:
07/17/07 12:42:52 (18 months ago)
Author:
aarkerio
Message:

helps

Location:
trunk/app
Files:
5 added
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/controllers/components/search.php

    r41 r43  
    2828                switch ($matchType)  
    2929                { 
    30                 case ANYWHERE: 
     30                case 'ANYWHERE': 
    3131                    $conditions .= "$searchField LIKE '%$keywords[$k]%'";    
    3232                    break; 
    33                 case EXACT: 
     33                case 'EXACT': 
    3434                    $conditions .= "$searchField = '$keywords[$k]'";    
    3535                    break; 
    36                 case ENDS_WITH: 
     36                case 'ENDS_WITH': 
    3737                    $conditions .= "$searchFields LIKE '%$keywords[$k]'";    
    3838                    break; 
    39                 case STARTS_WITH: 
     39                case 'STARTS_WITH': 
    4040                    $conditions .= "$searchField LIKE '$keywords[$k]%'";    
    4141                    break; 
     
    5454                switch ($multipleKeywords)  
    5555                { 
    56                 case ANY: 
     56                case 'ANY': 
    5757                    $conditions .= ") OR ("; 
    5858                    break; 
    59                 case ALL: 
     59                case 'ALL': 
    6060                    $conditions .= ") AND (";  
    6161                    break; 
     
    7373} 
    7474?> 
    75  
  • trunk/app/controllers/entries_controller.php

    r41 r43  
    1414   public $helpers       = array('Ajax', 'Form', 'Fck'); 
    1515    
    16    public $components    = array('Edublog', 'Portal'); 
     16   public $components    = array('Edublog', 'Portal', 'Search'); 
    1717    
    1818   public function results($string)  
     
    2525   } 
    2626    
    27    public function rss($user_id)  
     27   public function rss($user_id) 
    2828   { 
    2929       $this->layout    = 'rss'; 
     
    4949        $searchFields = array('Entry.title', 'Entry.body', 'News.body', 'Page.body'); 
    5050         
    51         $this->set('data', $this->Search->query($this->Product, $keywords, $searchFields, ALL, ANYWHERE)); 
     51        $this->set('data', $this->Search->query($this->Entry, $keywords, $searchFields, 'ALL', 'ANYWHERE')); 
    5252    } 
    5353    
  • trunk/app/controllers/helps_controller.php

    r31 r43  
    11<?php 
    22/** 
    3 Karamelo eLearning Platform 
     3Chipotle Software 
    44*  Manuel Montoya 2002-2007  
    5 *  GPL manuel<at>mononeurona.org 
     5*  GPL manuel<at>mononeurona<dot>org 
    66*/  
    77  
     
    1010class HelpsController extends AppController 
    1111 
    12    public $helpers       = array('Ajax', 'Form', 'Fck'); 
     12   public $helpers       = array('Javascript', 'Ajax', 'Form', 'Fck'); 
    1313    
    14    public $components    = array('Edublog', 'Portal'); 
     14   public $components    = array('Security'); 
    1515    
    16    public function listing() 
     16   public function tour()  
     17   { 
     18        $this->layout    = 'tour'; 
     19        $this->pageTitle = 'Karamelo'; 
     20    } 
     21    
     22   /**=== ADMIN METHODS === */ 
     23   public function admin_display($path = null)  
     24   { 
     25      $this->layout    = 'popup'; 
     26       
     27      $url = str_replace('-', '/', $path); 
     28       
     29      echo $url; 
     30       
     31      $conditions   = array("url"=>$url); 
     32       
     33      $fields       = array("id", "url", "help"); 
     34       
     35      $this->pageTitle = 'Centauro Help'; 
     36       
     37      $this->set('data', $this->Help->find($conditions, $fields)); 
     38   } 
     39    
     40    public function admin_listing() 
    1741   { 
    1842      $this->layout = 'admin'; 
     
    2751   } 
    2852    
    29     public function tour() { 
    30         $this->layout = 'tour'; 
    31     } 
    32        
    33    public function display($lang = null, $id = null) { 
    34        
    35       $this->set('subjects', $this->Portal->cms()); // Using Portal component 
    36        
    37       $this->set('randomQuote', $this->Portal->quote()); // quote footer 
    38        
    39       $conditions   = array(); 
    40        
    41       if ($id != null) 
    42       { 
    43         $conditions["id"] = $id; 
    44       } 
    45        
    46       if ($lang != null) 
    47       { 
    48         $conditions["lang"] = $id; 
    49       } 
    50        
    51       $fields       = array("id", "url", "help"); 
    52        
    53       $this->pageTitle = 'Karamelo LMS'; 
    54        
    55       $this->set('data', $this->Help->findAll($conditions, $fields)); 
    56    } 
    57     
    58    public function add() { 
     53   public function admin_add() { 
    5954     
    6055    // adds new classroom to database 
     
    6560        $this->Sanitize->cleanArray($this->params['data']); //Hopefully this is enough 
    6661         
    67         if ($this->Help->save($this->params['data'])) 
    68          { 
    69            //$this->set('data', $this->Help->index()); 
    70            $this->flash('Your classroom has been saved.','/vclassrooms/listing'); 
    71            //$this->render('todo', 'ajax'); 
    72          } 
    73     } else { 
    74       $this->layout = 'admin'; 
    75        
    76       $this->Subject     = new Subject; 
    77        
    78       $this->set('subjects', $this->Subject->generateList(null, 'title'));       
    79        
    80       $conditions = array("status"=>1); 
    81        
    82       $order      = "order DESC"; 
    83        
    84       $O = $this->Help->field('order', $conditions, $order); 
    85        
    86       $Order = $O + 1; 
    87        
    88       $this->set('Order', $Order); 
     62          if ($this->Help->save($this->params['data'])) 
     63      { 
     64             //$this->set('data', $this->Help->index()); 
     65              $this->flash('Your classroom has been saved.','/vclassrooms/listing'); 
     66       } 
     67    }  
     68        else  
     69        { 
     70        $this->layout = 'admin'; 
     71         
     72        $this->Subject     = new Subject; 
     73         
     74        $this->set('subjects', $this->Subject->generateList(null, 'title'));         
     75         
     76        $conditions = array("status"=>1); 
     77         
     78        $order      = "order DESC"; 
     79         
     80        $O = $this->Help->field('order', $conditions, $order); 
     81         
     82        $Order = $O + 1; 
     83         
     84        $this->set('Order', $Order); 
    8985    } 
    9086         
    9187 } 
    9288  
    93   public function edit($id = null) 
     89  public function admin_edit($id = null) 
    9490  { 
    9591      
     
    115111} 
    116112   
    117   public function delete($id) 
     113  public function admin_delete($id) 
    118114  { 
    119115        // deletes task from database 
  • trunk/app/controllers/users_controller.php

    r42 r43  
    7676    } 
    7777     
    78     public function about($user_id)  
    79     { 
    80          
    81         $this->pageTitle = 'About me'; 
     78    public function entry($username = null, $Entry_id = null)  
     79    { 
     80        if ($Entry_id == null) 
     81        { 
     82           $this->redirect('/blog/'.$username); 
     83           exit; 
     84        } 
     85         
     86        $this->layout    = 'blog'; 
     87        $this->pageTitle = $username . '\'s Blog'; 
     88        //exit($username); 
     89        $this->Entry     = new Entry; 
     90         
     91        $user_id = $this->User->field("id", array("username"=>$username)); 
     92         
     93        //exit($user_id); 
     94         
     95        if ($username == null || $user_id == null) 
     96        { 
     97           $this->redirect("/"); 
     98        } 
     99         
     100        $order    = "Entry.id DESC"; 
     101         
     102        $fields   = array("Entry.title", "Entry.body", "Entry.created", "Entry.user_id", "Entry.discution", "Entry.themeblog_id", "Entry.id", "User.username", "Themeblog.title", "Themeblog.id"); 
     103         
     104        if ( $Entry_id != null && is_numeric( $Entry_id ) ) // show only one new 
     105        { 
     106           $limit      = 1; 
     107            
     108           $conditions = array("Entry.user_id"=>$user_id, "Entry.id"=>$Entry_id); 
     109        } 
     110         
     111        $this->set('data', $this->Entry->find($conditions, $fields));  
     112         
     113        $this->set('Element', $this->Blog->bloggerStuff($user_id)); // Charge Blog components aka Sidebars 
     114         
     115        $this->set('Entry_id', $Entry_id); 
     116         
     117        $this->set('style', $this->Blog->getStyle($user_id)); 
     118    } 
     119     
     120    public function about($username)  
     121    { 
     122        $this->pageTitle = 'About ' . $username; 
     123         
     124        $user_id = $this->User->field("id", array("username"=>$username)); 
    82125         
    83126        $this->layout    = $this->Edublog->layout($user_id); 
  • trunk/app/views/layouts/portal.thtml

    r30 r43  
    3838} 
    3939?> 
    40     <a href="/" title="Home">Home</a> |  
    41     <a href="/helps/themes/" title="Faq">Help</a> |  
     40    <a href="/" title="Home">Home</a> | 
    4241    <a href="/pages/sitemap/" title="Site">SiteMap</a> | 
    4342    <a href="/messages/contact" title="Site">Contact</a> |