Changeset 41
- Timestamp:
- 07/16/07 22:42:26 (18 months ago)
- Location:
- trunk/app
- Files:
-
- 2 added
- 10 modified
-
config/routes.php (modified) (1 diff)
-
controllers/components/search.php (added)
-
controllers/entries_controller.php (modified) (4 diffs)
-
controllers/news_controller.php (modified) (1 diff)
-
controllers/newsletters_controller.php (modified) (4 diffs)
-
controllers/podcasts_controller.php (modified) (2 diffs)
-
controllers/users_controller.php (modified) (5 diffs)
-
views/elements/menu_b.thtml (modified) (1 diff)
-
views/layouts/default.thtml (modified) (1 diff)
-
views/newsletters/all.thtml (added)
-
views/newsletters/subscribe.thtml (modified) (1 diff)
-
views/users/bloggers.thtml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/config/routes.php
r22 r41 14 14 * developement. 15 15 */ 16 $Route->connect('/tests', array('controller' => 'tests', 'action' => 'index'));16 $Route->connect('/blog/*/', array('controller'=>'Users', 'action'=>'blog')); 17 17 ?> -
trunk/app/controllers/entries_controller.php
r36 r41 39 39 } 40 40 41 public function search()42 { 41 function search($keywords = '') 42 { 43 43 $this->layout = 'portal'; 44 44 … … 47 47 $this->set('Element', $this->Portal->statics()); // Charge Portal components aka Sidebars 48 48 49 /* if (!empty($this->data["Entry"]) ) 50 { 51 $data = $this->Lucene->query($this->data['Entry']['terms']); 52 53 $this->set('data', $data); 54 } */ 55 } 49 $searchFields = array('Entry.title', 'Entry.body', 'News.body', 'Page.body'); 50 51 $this->set('data', $this->Search->query($this->Product, $keywords, $searchFields, ALL, ANYWHERE)); 52 } 56 53 57 54 /** ==== ADMIN SECTION ====*/ … … 118 115 $this->layout = 'admin'; 119 116 120 $this->set(' categories', $this->Entry->Category->generateList());117 $this->set('subjects', $this->Entry->Subject->generateList()); 121 118 122 119 if (empty($this->data)) … … 129 126 if ($this->Entry->save($this->data['Entry'])) 130 127 { 131 $this-> flash('Your entry has been updated.', '/admin/entries/listing');128 $this->msgFlash('The story has been updated.', '/admin/entries/listing'); 132 129 } 133 130 } -
trunk/app/controllers/news_controller.php
r36 r41 63 63 $fields = array("News.id", "News.title", "News.comments", "News.body", "News.created", "News.reference", "News.theme_id", "News.user_id", "Theme.img", "Theme.theme", "User.username"); 64 64 65 $this->pageTitle = ' Hacktivismo';65 $this->pageTitle = '::News'; 66 66 67 67 $this->set('data', $this->News->find($conditions, $fields, null, 1)); -
trunk/app/controllers/newsletters_controller.php
r32 r41 6 6 * Chipotle Software 7 7 */ 8 9 loadModel('User');10 loadModel('Entry');11 8 12 9 class NewslettersController extends AppController … … 18 15 public function subscribe() 19 16 { 17 $this->layout = 'portal'; 20 18 $this->set('Element', $this->Portal->statics()); // Charge Portal components aka Sidebars 21 19 } … … 61 59 $this->layout = 'admin'; 62 60 63 $conditions = array("News .user_id" => $this->othAuth->user('id')); // only the user's news61 $conditions = array("Newsletter.status" => 1); // only the user's news 64 62 $fields = array("id", "title", "body", "created", "reference", "status", "subject_id", "user_id"); 65 $order = "News .id DESC";63 $order = "Newsletter.id DESC"; 66 64 $limit = 12; 67 65 … … 69 67 } 70 68 71 public function all($subject_id = null)72 { 73 $ conditions = array("News.status"=>1);69 public function all($page=1) 70 { 71 $this->layout = 'portal'; 74 72 75 if ($subject_id != null)76 {77 $conditions["News.subject_id"] = $subject_id;78 }73 $conditions = array("Newsletter.status"=>1); 74 $fields = array("Newsletter.id", "Newsletter.title", "Newsletter.body", "Newsletter.created", "Newsletter.user_id"); 75 $order = "Newsletter.id DESC"; 76 $limit = 20; 79 77 80 $fields = array("id", "title", "body", "created", "reference", "subject_id", "user_id"); 81 $order = "News.id DESC"; 82 $limit = 12; 83 84 // move task from todo to done 85 $data = $this->Newsletter->findAll($conditions, $fields, $order, $limit, null, true); 86 //die(print_r($data)); 87 $this->set('data', $data); 78 $this->set('data', $this->Newsletter->findAll($conditions, $fields, $order, $limit)); 88 79 89 $this->set('subjects', $this->Portal->cms()); // Using Portal component 90 91 $this->set('randomQuote', $this->Portal->quote()); // quote footer 80 $this->set('Element', $this->Portal->statics()); // Using Portal component 92 81 } 93 82 94 public function delete($id) { 95 96 // deletes new from database 97 83 public function admin_delete($id) 84 { 98 85 if ( $this->Newsletter->del($id) ) 99 86 { 100 $this-> flash('Your new have been removed', '/news/listing');87 $this->msgFlash('Your new have been removed', '/admin/newsletters/listing'); 101 88 } 102 89 else 103 90 { 104 $this->flash('Database error!', '/news/listing'); 105 } 106 91 $this->msgFlash('Database error!', '/admin/newsletters/listing'); 92 } 107 93 } 108 94 } -
trunk/app/controllers/podcasts_controller.php
r15 r41 63 63 } 64 64 65 public function all($username=null, $entry_id=null) { 65 public function all($username=null, $entry_id=null) 66 { 67 $this->layout = 'portal'; 68 66 69 $this->pageTitle = $username . '\'s Podcast'; 67 70 … … 88 91 $this->set('data', $this->Podcast->findAll($conditions, $fields, $order, $limit, null, true)); 89 92 90 $this->set('subjects', $this->Portal->cms()); // Using Portal component 91 92 $this->set('randomQuote', $this->Portal->quote()); // quote footer 93 $this->set('Element', $this->Portal->statics()); // Using Portal component 93 94 } 94 95 -
trunk/app/controllers/users_controller.php
r35 r41 15 15 loadModel('Catfaq'); 16 16 loadModel('Cover'); 17 loadModel('Poll');18 17 loadModel('News'); 19 18 loadModel('Confirm'); … … 23 22 public $helpers = array('Ajax', 'Form', 'User', 'Fck'); 24 23 25 public $components = array('Edublog', 'Portal', 'Email', 'Adds'); 26 27 public $displayField = 'title'; 24 public $components = array('Security', 'Edublog', 'Portal', 'Email', 'Adds', 'Mypagination'); 28 25 29 26 public function index($id = null) … … 34 31 } 35 32 36 public function blog($user_id, $entry_id = null) 37 { 38 $this->pageTitle = 'Karamelo Blog'; 33 public function blog($username = null, $page=1) 34 { 35 $this->layout = 'blog'; 36 37 $this->pageTitle = $username . '\'s Blog'; 38 39 $this->Entry = new Entry; 40 41 $user_id = $this->User->field("id", array("username"=>$username)); 42 43 //exit($user_id); 44 45 if ($username == null || $user_id == null) 46 { 47 $this->redirect("/"); 48 } 49 50 $order = "Entry.id DESC"; 51 52 $fields = array("Entry.title", "Entry.body", "Entry.created", "Entry.user_id", "Entry.discution", "Entry.themeblog_id", "Entry.id", "User.username", "Themeblog.title", "Themeblog.id"); 53 54 //pagination 55 $total_rows = $this->Entry->findCount(array("Entry.user_id"=>$user_id, "Entry.status"=>1)); 56 57 $lmt = 10; // limit news 58 59 $targetpage = "/blog/".$username."/"; 60 61 $pagination = $this->Mypagination->init($total_rows, $page, $lmt, $targetpage); //Pagination 62 63 $this->set('pagination', $pagination); 64 65 $offset = (($page * $lmt) - 10); 66 67 $limit = $lmt . " OFFSET " . $offset; 68 69 $conditions = array("Entry.user_id"=>$user_id); 70 71 $this->set('data', $this->Entry->findAll($conditions, $fields, $order, $limit)); 39 72 40 73 $this->layout = $this->Edublog->layout($user_id); 41 74 42 75 $this->set('blog', $this->Edublog->blog($user_id)); 43 44 $this->set('Entry_id', $entry_id);45 46 // blog entries47 $this->Entry = new Entry;48 49 $conditions = array("Entry.status"=>1, "Entry.user_id"=>$user_id);50 51 if ($entry_id != null)52 {53 $conditions["Entry.id"] = $entry_id;54 }55 56 $fields = array("id", "title", "body", "created", "disc", "category_id", "user_id");57 $order = "Entry.id DESC";58 $limit = 10;59 60 $this->set('data', $this->Entry->findAll($conditions, $fields, $order, $limit, null, 2));61 76 } 62 77 … … 95 110 { 96 111 $this->data["User"]["passwd"] = md5($this->data["User"]["passwd"]); // MD5 97 } else { 112 } 113 else 114 { 98 115 unset($this->data["User"]["passwd"]); 99 116 } 100 117 101 118 if ($this->User->save($this->data['User'])) 102 119 { 103 $this-> flash('User has been updated.','/entries/');120 $this->msgFlash('User has been updated.','/admin/users/listing'); 104 121 } 105 122 } … … 138 155 139 156 $this->set('Element', $this->Portal->statics()); // Using Portal component 140 }141 142 public function general()143 {144 $this->layout = 'portal';145 146 $this->pageTitle = 'Welcome :: Karamelo E-learning on Web 2.0';147 148 $this->set('Element', $this->Portal->statics()); // Using Portal component149 150 /********** News ****/151 152 $this->News = new News; //Instantiate the model153 154 $conditions = array("News.status"=>1);155 $fields = array("News.id", "News.title", "News.body", "News.created", "News.reference", "News.subject_id", "News.user_id");156 $order = "News.id DESC";157 $limit = 1;158 159 $this->pageTitle = 'Karamelo E-learning on Web 2.0';160 161 $lastNew = $this->News->findAll($conditions, $fields, $order, $limit);162 163 $this->set('new', $lastNew);164 165 157 } 166 158 -
trunk/app/views/elements/menu_b.thtml
r1 r41 1 1 <div id="menu_div"> 2 <a class="nav" href="/news/all/" title="News">News</a>3 2 <a class="nav" href="/users/bloggers/" title="eduBlogs">eduBlogs</a> 4 3 <a class="nav" href="/podcasts/all/" title="Podcast">Podcast</a> 5 4 <a class="nav" href="/users/directory/" title="Directory">Directory</a> 6 <a class="nav" href="/newsletters/subscribe/" title="Newsletter">Newsletter</a> 5 <a class="nav" href="/newsletters/subscribe/" title="Newsletter">Newsletters</a> 6 <a class="nav" href="/events/view/" title="Coming soon">Events Calendar</a> 7 7 </div> -
trunk/app/views/layouts/default.thtml
r34 r41 1 1 <html> 2 2 <head> 3 <title>:: MonoNeurona::</title>3 <title>::Karamelo e-Learning::</title> 4 4 <style type="text/css"> 5 5 body { -
trunk/app/views/newsletters/subscribe.thtml
r1 r41 1 <?php echo $html->formTag('/n lemails/add', 'post', array('onsubmit'=>'return false')); ?>1 <?php echo $html->formTag('/newsletters/add', 'post', array('onsubmit'=>'return false')); ?> 2 2 3 3 <fieldset> 4 4 <legend>Subscribe:</legend> 5 5 6 <?php echo $form->labelTag('N lemails/email', 'Email:' );?><br />7 <?php echo $html->input('N lemails/email', array("size" => 25, "maxlength" => 50)); ?>6 <?php echo $form->labelTag('Newsletter/email', 'Email:' );?><br /> 7 <?php echo $html->input('Newsletter/email', array("size" => 25, "maxlength" => 50)); ?> 8 8 <br /><br /> 9 9 <?php echo $html->submit('Send'); ?> 10 10 </fieldset> 11 11 </form> 12 13 <br /> 14 15 <?php 16 echo $html->link('View pass newsletters', '/newsletters/all'); 17 ?> -
trunk/app/views/users/bloggers.thtml
r1 r41 6 6 7 7 <?php 8 foreach ($data as $key => $val) { 8 foreach ($data as $key => $val) 9 { 9 10 echo '<p><b>Docent</b>: '.$data[$key]['User']['name'].' <br />'; 10 echo 'blog: <a href="/ users/blog/'.$data[$key]['User']['id'].'/">'.$data[$key]['User']['name_blog'].'</a></p>';11 echo 'blog: <a href="/blog/'.$data[$key]['User']['username'].'">'.$data[$key]['User']['name_blog'].'</a></p>'; 11 12 } 12 13 ?>
