ModellistAddAction.class.php (633B)
1 <?php 2 namespace cms\action\modellist; 3 use cms\action\Method; 4 use cms\action\ModellistAction; 5 use cms\model\Model; 6 7 class ModellistAddAction extends ModellistAction implements Method { 8 public function view() { 9 } 10 11 12 public function post() { 13 $model = new Model(); 14 $model->projectid = $this->request->getText('projectid'); 15 $model->name = $this->request->getText('name'); 16 $model->persist(); 17 18 // Wenn kein Namen eingegeben, dann einen setzen. 19 if ( empty($model->name) ) 20 { 21 // Name ist "Variante <id>" 22 $model->name = \cms\base\Language::lang('MODEL').' '.$model->modelid; 23 $model->save(); 24 } 25 } 26 }