Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2012
142
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function admin_add() {
  2. $langs=$this->Language->find('all',array('conditions'=>array('active'=>'1'),'fields'=>array('name','code'),'order'=>'sequence asc'));
  3. $this->set('langs',$langs);
  4. if($this->request->is('post')) {
  5. if(!empty($this->request->data)) {
  6. $this->Subpage->set($this->request->data);
  7. if($this->Subpage->validates()) {
  8. $max=$this->Subpage->field('MAX(sequence)','1=1');
  9. $this->Subpage->create();
  10. $this->request->data['Subpage']['sequence']=$max+1;
  11. foreach($langs as $l) {
  12. $this->request->data['Subpage']['link'][$l['Language']['code']]=$this->Link->replace_characters($this->request->data['Subpage']['title'][$l['Language']['code']]);
  13. }
  14. $this->request->data['Subpage']['modified']=date("Y-m-d H:i:s");
  15. $this->Subpage->save($this->request->data);
  16. $this->set('id',$this->Subpage->getLastInsertId());
  17. //...//
  18. }
  19. }
  20. }
  21. }
Advertisement
RAW Paste Data Copied
Advertisement