SHARE
TWEET

Untitled

a guest Jan 23rd, 2012 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function admin_edit($id) {
  2.   $langs=$this->Language->find('all',array('conditions'=>array('active'=>'1'),'fields'=>array('name','code'),'order'=>'sequence asc'));
  3.   $this->set('langs',$langs);
  4.   $this->Subpage->bindTranslation(array('title'=>'titleTranslation','content'=>'contentTranslation'));
  5.   $s=$this->Subpage->findById($id);
  6.  
  7.   if(!empty($this->request->data)) {
  8.           $this->Subpage->set($this->request->data);
  9.     if($this->Subpage->validates()) {
  10.                         $this->request->data['Subpage']['id']=$id;
  11.                         $s=$this->request->data;
  12.                   $i=0;
  13.       foreach($langs as $l) {
  14.         $this->request->data['Subpage']['link'][$l['Language']['code']]=$this->Link->replace_characters($this->request->data['Subpage']['title'][$l['Language']['code']]);
  15.         $s['titleTranslation'][$i]['content']=$this->request->data['Subpage']['title'][$l['Language']['code']];
  16.         $s['contentTranslation'][$i]['content']=$this->request->data['Subpage']['content'][$l['Language']['code']];
  17.         $i++;
  18.                         }
  19.                         $this->Subpage->saveAll($this->request->data);
  20.       $this->set('msg_saved',1);
  21.                 }
  22.         }
  23.         $this->set('s',$s);
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top