Ejemplo n.º 1
0
 /**
  * update record
  *
  * @param App_Push_Dm $dm
  * @return multitype:|Ambigous <boolean, number, rowCount>
  */
 public function update($id, App_Push_Dm $dm)
 {
     if (true !== ($r = $dm->beforeUpdate())) {
         return $r;
     }
     return $this->loadDao()->update($id, $dm->getData());
 }
Ejemplo n.º 2
0
 public function editAction()
 {
     if ($this->getInput('submitype', 'post') === 'do') {
         list($schoolid, $title, $type, $content, $status) = $this->getInput(array('schoolid', 'title', 'type', 'content', 'status'), 'post');
         if (empty($schoolid)) {
             $this->showError('请选择高校.');
             return;
         }
         if (empty($title)) {
             $this->showError('请输入推送标题.');
             return;
         }
         if (empty($type)) {
             $this->showError('请选择推送类型.');
             return;
         }
         $dm = new App_Push_Dm();
         $dm->setSchoolId($schoolid)->setType($type)->setTitle($title)->setContent($content)->setStatus($status)->setCreator($this->adminUser->username)->setUpdateDate($this->getCurrentDate());
         $id = $this->getInput('id');
         $id = $this->_getPushDs()->update($id, $dm);
         if ($id == 1) {
             $this->showMessage('更新成功');
         } else {
             $this->showError('更新失败,请联系管理员');
         }
     } else {
         $id = $this->getInput('id');
         $pushList = $this->_getPushDs()->getOnePushById($id);
         $allSchool = $this->_get4TSchoolDS()->getOpenedSchools();
         $allSchool = array_values($allSchool);
         $pushTypeList = $this->setPushType();
         $this->setOutput($allSchool, 'allSchool');
         $this->setOutput($pushTypeList, 'pushTypeList');
         $this->setOutput($pushList, 'pushList');
     }
 }