Exemplo n.º 1
0
 public function actionUpdate()
 {
     $lid = Yii::app()->request->getParam('lid');
     $dpid = Yii::app()->request->getParam('companyId');
     Until::isUpdateValid(array($lid), $this->companyId, $this);
     //0,表示企业任何时候都在云端更新。
     $model = SitePersons::model()->find('t.lid=:lid and t.dpid=:dpid', array(':lid' => $lid, ':dpid' => $dpid));
     //var_dump($model);
     if (Yii::app()->request->isPostRequest) {
         $model->attributes = Yii::app()->request->getPost('SitePersons');
         $model->update_at = date('Y-m-d H:i:s', time());
         if ($model->save()) {
             Yii::app()->user->setFlash('success', yii::t('app', '修改成功'));
             $this->redirect(array('sitePersons/index', 'companyId' => $this->companyId));
         }
     }
     $this->render('update', array('model' => $model));
 }
Exemplo n.º 2
0
 private function getSitePersons()
 {
     $sitepersons = SitePersons::model()->findAll('dpid=:companyId and delete_flag=0', array(':companyId' => $this->companyId));
     $sitepersons = $sitepersons ? $sitepersons : array();
     $splist = array();
     if (!empty($sitepersons)) {
         foreach ($sitepersons as $sp) {
             array_push($splist, array("lid" => $sp->lid, "persons" => $sp->min_persons . "-" . $sp->max_persons));
         }
     }
     // var_dump($sp)
     return CHtml::listData($splist, 'lid', 'persons');
 }