예제 #1
0
 public function actionDelete($id)
 {
     if ($_POST['action'] == 1) {
         $model = Field::find($id);
         $model->delete();
         echo json_encode(array('id' => array($id), 'class' => 'alert-success', 'message' => __('delete success')));
         exit;
     }
 }
예제 #2
0
파일: Node.php 프로젝트: rocketyang/mincms
 /**
  * 内容类型 下的字段信息
  */
 static function tree($name)
 {
     $model = Field::find(array('slug' => $name));
     if (!$model) {
         exit(__('form builder error'));
     }
     $models = Field::find()->where(array('pid' => $model->id))->all();
     foreach ($models as $m) {
         $n = $m->slug;
         $out[$n]['slug'] = $m->slug;
         $out[$n]['name'] = $m->name;
         $out[$n]['fid'] = $m->id;
         $out[$n]['widget'] = $m->widget;
         $out[$n]['mysql'] = \app\modules\content\Hook::run($m->widget, 'mysql');
     }
     return $out;
 }