2014-04-16 16:58:17
    public function admin_editpartner($id=null) {
		$this->set('title_for_layout', 'Sửa thông tin đối tác');
	    $this->loadModel('Partner');
 
		if(!empty($this->data)){
		$this->Partner->id = $id;
		$data = $this->data;
		$im_default = "noimage.gif";
		$im = $data['Partner']['image'];
		if ($this->request->is('post') || $this->request->is('put')) {
 
		if($im['name'] != null){
            $data = $this->data;   
            $im =  $data['Partner']['image'];
            move_uploaded_file($im['tmp_name'], WWW_ROOT . 'partners/' . $im['name']);
			$data['Partner']['title'] = $this->data['Partner']['title'];
			$data['Partner']['link'] = $this->data['Partner']['link'];
            $data['Partner']['image'] = $im['name'];
            $this->Partner->save($data,false);
			$this->Session->setFlash(__('Thêm đối tác thành công.', true));
			$this->redirect(array('action'=>'partner'));
		}else{
			$data1['Partner']['title'] = $this->data['Partner']['title'];
			$data1['Partner']['link'] = $this->data['Partner']['link'];
 
			$this->Partner->save($data1,false);
			$this->Session->setFlash(__('Thêm đối tác thành công.', true));
			$this->redirect(array('action'=>'partner'));
		}
		}
		}else{
			$this->request->data = $this->Partner->read(null, $id);
		}
}
Invalid Email or Password