コード例 #1
0
ファイル: PwEducation.php プロジェクト: chendong0444/phpwind
 /** 
  * 更新教育经历
  *
  * @param id $id
  * @param PwEducationDm $dm
  * @return PwError|boolean|int
  */
 public function editEducation($id, $dm)
 {
     $uid = intval($dm->getField('uid'));
     if (($id = intval($id)) < 1 || $uid < 1) {
         return new PwError('USER:education.illegal.request');
     }
     if (!$dm instanceof PwEducationDm) {
         return new PwError('USER:education.illegal.datatype');
     }
     if (($result = $dm->beforeUpdate()) instanceof PwError) {
         return $result;
     }
     $data = $dm->getData();
     unset($data['uid']);
     return $this->_getDao()->update($id, $uid, $data);
 }
コード例 #2
0
 /**
  * 编辑教育经历
  */
 public function editAction()
 {
     $educationDm = new PwEducationDm();
     $educationDm->setSchoolid($this->getInput('schoolid', 'post'));
     $educationDm->setStartTime($this->getInput('startYear', 'post'));
     $educationDm->setDegree($this->getInput('degree', 'post'));
     $educationDm->setUid($this->loginUser->uid);
     $educationDs = $this->_getDs();
     if (($result = $educationDs->editEducation($this->getInput('id'), $educationDm)) instanceof PwError) {
         $this->showError($result->getError());
     }
     $this->showMessage('USER:education.update.success');
 }