コード例 #1
0
ファイル: WmenuContoller.php プロジェクト: tvad911/wmenu
 public function createnewmenu()
 {
     $menu = new Menu();
     $menu->name = Input::get("menuname");
     $menu->save();
     return json_encode(array("resp" => $menu->id));
 }
コード例 #2
0
 public function run()
 {
     DB::table('menus')->delete();
     DB::table('dish_menu')->delete();
     DB::table('recommendations')->delete();
     $menu = new Menu();
     $menu->menu_date = "2014-03-30";
     $menu->save();
     foreach (Dish::all() as $dish) {
         $menu->dishes()->save($dish);
     }
     $menu = new Menu();
     $menu->menu_date = "2014-04-23";
     $menu->save();
     foreach (Dish::all() as $dish) {
         $menu->dishes()->save($dish);
     }
     $recommendation = new Recommendation();
     $recommendation->menu_id = 1;
     $recommendation->recommendation = "Today, we has abcxyz for menu 1";
     $recommendation->save();
     $recommendation = new Recommendation();
     $recommendation->menu_id = 2;
     $recommendation->recommendation = "Today, we has abcxyz for menu 2";
     $recommendation->save();
 }
コード例 #3
0
ファイル: menus.php プロジェクト: unisexx/thaigcd2015
 function save($id = FALSE)
 {
     if ($_POST) {
         if (isset($_POST['orderlist'])) {
             foreach ($_POST['orderlist'] as $key => $item) {
                 if ($item) {
                     $menu = new Menu(@$_POST['orderid'][$key]);
                     $menu->from_array(array('orderlist' => $item));
                     $menu->save();
                 }
             }
             set_notify('success', lang('save_data_complete'));
         } else {
             $menu = new Menu($id);
             if ($_FILES['icon']['name']) {
                 if ($id) {
                     $menu->delete_file('uploads/icon/', 'icon');
                 }
                 $_POST['icon'] = $menu->upload($_FILES['icon'], 'uploads/icon/', 24, 24);
             }
             $_POST['title'] = lang_encode($_POST['title']);
             $_POST['url'] = $_POST['url'];
             $_POST['user_id'] = $this->session->userdata('id');
             $menu->from_array($_POST);
             $menu->save();
             set_notify('success', lang('save_data_complete'));
         }
     }
     redirect('menus/admin/menus');
 }
コード例 #4
0
 public function save($id = null)
 {
     if (permission("menus", "create")) {
         if ($_POST) {
             $data = new Menu($id);
             $data->parent_id = $_POST["parent_id"];
             $data->title = $_POST["title"];
             switch (@$_POST["route"]) {
                 case 1:
                     $data->route = 1;
                     switch (@$_POST["s"]) {
                         case 'contents':
                             if ($_POST["g"]) {
                                 //	ตรวจสอบว่าเป็นค่าที่เลือกเป็นประเภทบทความหรือไม่
                                 $data->route_2 = $_POST["g"];
                                 $data->links = "contents?g=" . $_POST["g"];
                             } else {
                                 //	ถ้าไม่ได้เลือกประเภทบทความจะไปที่หน้ารวมบทความทั้งหมด
                                 $data->links = "contents";
                             }
                             break;
                         case 'p':
                             if (@$_POST["g"]) {
                                 //	ตรวจสอบว่าเป็นค่าที่เลือกเป็นประเภทบทความหรือไม่
                                 $data->route_2 = "p";
                                 $data->links = "p/" . $_POST["g"];
                             }
                             break;
                         default:
                             $data->links = $_POST["s"];
                             break;
                     }
                     break;
                 case 2:
                     $data->route = 2;
                     $data->links = $_POST["links"];
                     break;
                 case 3:
                     $data->route = 3;
                     $data->detail = $_POST["detail"];
                     break;
                 default:
                     $data->route = 2;
                     $data->links = "#";
                     break;
             }
             $data->save();
             $type = $id ? 'edit' : 'add';
             // for logs.
             save_logs($type, $data->id);
             if (@$_POST["route"] == 3) {
                 $data->slug = clean_url($_POST["title"]) . "-" . $data->id;
                 $data->save();
             }
         }
     }
     redirect("admin/menus");
 }
コード例 #5
0
ファイル: menu.php プロジェクト: raalveco/temporal
 public static function registrar($texto)
 {
     $menu = new Menu();
     $menu->texto = $texto;
     $menu->abierto = "SI";
     $menu->activo = "SI";
     $menu->save();
     return $menu;
 }
コード例 #6
0
ファイル: SetorTableSeeder.php プロジェクト: kuell/buriti
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $subMenu = new Menu();
     $subMenu->id = 10;
     $subMenu->descricao = "Setor";
     $subMenu->menu_pai = 2;
     $subMenu->url = '/cadastro/setors/';
     $subMenu->save();
 }
コード例 #7
0
ファイル: CreateAction.php プロジェクト: jerrylsxu/yiifcms
 public function run()
 {
     $model = new Menu();
     if (isset($_POST['Menu'])) {
         $model->attributes = $_POST['Menu'];
         if ($model->save()) {
             $this->controller->redirect(array('index'));
         }
     }
     $this->controller->render('create', array('model' => $model));
 }
コード例 #8
0
 public function add()
 {
     $input = Request::all();
     $menu = new Menu();
     $menu->menu = $input['menu_nombre'];
     $menu->url = $input['menu_url'];
     $menu->padre_id = $input['menu_padre_id'];
     $menu->save();
     return redirect('listMenu');
     //->back();
 }
コード例 #9
0
ファイル: Menu.php プロジェクト: viniciusilveira/pluton
 /**
  * Cria um novo menu
  * @param  string $menu_icon             nome do novo icone, pode ser referente a glyphicons do bootstrap(http://getbootstrap.com/components/)
  * ou os icônes do font awesome (http://fortawesome.github.io/Font-Awesome/3.2.1/icons/)
  * @param  string $menu_name             nome do menu
  * @param  string $menu_href             Endereço que deve acessar
  * @param  int $menu_level_permission    Nível de permissão do menu
  * @return int                        id do menu inserido
  */
 public function createMenu($menu_icon, $menu_name, $menu_href, $menu_level_permission, $menu_active)
 {
     $menu = new Menu();
     $menu->menu_icon = $menu_icon;
     $menu->menu_name = $menu_name;
     $menu->menu_href = $menu_href;
     $menu->menu_level_permission = $menu_level_permission;
     $menu->menu_active = $menu_active;
     $menu->save();
     return $menu->menu_id;
 }
コード例 #10
0
 public function postNew()
 {
     // Create a new menu item and save it
     $item = new Menu();
     $item->title = e(Input::get('title', 'untitled'));
     $item->label = e(Input::get('label', ''));
     $item->url = e(Input::get('url', ''));
     $item->order = Menu::max('order') + 1;
     $item->save();
     return Redirect::to('admin/menu');
 }
コード例 #11
0
 /**
  * Создает новую модель меню.
  * Если создание прошло успешно - перенаправляет на просмотр.
  */
 public function actionCreate()
 {
     $model = new Menu();
     if (($data = Yii::app()->getRequest()->getPost('Menu')) !== null) {
         $model->setAttributes($data);
         if ($model->save()) {
             Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('MenuModule.menu', 'Menu was created!'));
             $this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', ['create']));
         }
     }
     $this->render('create', ['model' => $model]);
 }
コード例 #12
0
 /**
  * 添加菜单
  *
  */
 public function actionCreate()
 {
     $model = new Menu();
     if (isset($_POST['Menu'])) {
         $model->attributes = $_POST['Menu'];
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $parentId = intval($_GET['id']);
     $this->render('create', array('model' => $model, 'parentId' => $parentId));
 }
コード例 #13
0
 /**
  * 添加菜单
  *
  * 对应API
  * 请求类型:POST
  * @return array 执行状态
  */
 public function addMenu()
 {
     $menu = new Menu();
     $menu->shop_id = Input::get('shop_id');
     $menu->group_id = Input::get('group_id');
     $menu->title = Input::get('title');
     $menu->price = Input::get('price');
     $menu->pic = Input::get('pic');
     $menu->pic_small = Input::get('pic_small');
     $menu->state = Input::get('state');
     $menu->save();
 }
コード例 #14
0
ファイル: OrdemInternaSeeder.php プロジェクト: kuell/buriti
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $menu = new Menu();
     $menu->descricao = "Ordem Interna";
     $menu->id = 8;
     $menuId = $menu->save();
     $subMenu = new Menu();
     $subMenu->id = 9;
     $subMenu->descricao = "Inclusão de Ordem Interna";
     $subMenu->menu_pai = 8;
     $subMenu->url = 'osi';
     $subMenu->save();
 }
コード例 #15
0
ファイル: MenuController.php プロジェクト: vuvankhai/itplus
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Menu();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Menu'])) {
         $model->attributes = $_POST['Menu'];
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #16
0
 public function actionCreate()
 {
     $model = new Menu();
     $form = new Form('content.MenuForm', $model);
     if ($form->submitted() && $model->save()) {
         $section = new MenuSection();
         $section->menu_id = $model->id;
         $section->title = $model->name . '::корень';
         $section->saveNode();
         $this->redirect('/content/MenuAdmin/manage/');
     }
     $this->render('create', ['form' => $form]);
 }
コード例 #17
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Menu();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Menu'])) {
         $model->attributes = $_POST['Menu'];
         $model->group = implode(",", (array) $model->attributes['group']);
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #18
0
 /**
  * Создает новую модель меню.
  * Если создание прошло успешно - перенаправляет на просмотр.
  */
 public function actionCreate()
 {
     $model = new Menu();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (($data = Yii::app()->getRequest()->getPost('Menu')) !== null) {
         $model->setAttributes($data);
         if ($model->save()) {
             Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('MenuModule.menu', 'Menu was created!'));
             $this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', array('create')));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #19
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Menu();
     // pre-fill business id
     $model->business_id = $this->_business->id;
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Menu'])) {
         $model->attributes = $_POST['Menu'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model, 'bid' => $model->business_id));
 }
コード例 #20
0
ファイル: MenuController.php プロジェクト: Telemedellin/tm
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCrear()
 {
     $menu = new Menu();
     if (isset($_POST['Menu'])) {
         $menu->attributes = $_POST['Menu'];
         if ($menu->save()) {
             Yii::app()->user->setFlash('success', 'Menú ' . $menu->nombre . ' guardado con éxito');
             $this->redirect(array('view', 'id' => $menu->getPrimaryKey()));
         }
         //if($menu->save())
     }
     //if(isset($_POST['MenuItem']))
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $this->render('crear', array('model' => $menu));
 }
コード例 #21
0
ファイル: BaseMenu.php プロジェクト: rafaelccomp/compsite
 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aMenuRelatedByParent !== null) {
             if ($this->aMenuRelatedByParent->isModified() || $this->aMenuRelatedByParent->isNew()) {
                 $affectedRows += $this->aMenuRelatedByParent->save($con);
             }
             $this->setMenuRelatedByParent($this->aMenuRelatedByParent);
         }
         if ($this->isNew()) {
             $this->modifiedColumns[] = MenuPeer::ID;
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = MenuPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 // we are assuming that there is only 1 row per doInsert() which
                 // should always be true here (even though technically
                 // BasePeer::doInsert() can insert multiple rows).
                 $this->setId($pk);
                 //[IMV] update autoincrement primary key
                 $this->setNew(false);
             } else {
                 $affectedRows += MenuPeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         if ($this->collMenusRelatedByParent !== null) {
             foreach ($this->collMenusRelatedByParent as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
コード例 #22
0
ファイル: menu.php プロジェクト: abdul-baten/hbcms
 public function action_add()
 {
     $data = array();
     if (Request::$method == "POST") {
         $cat = new Menu();
         $root_id = $_POST['parent_id'];
         $post = $cat->validate_create($_POST);
         if ($post->check()) {
             $post = $post->as_array();
             $cat->user_id = Auth::instance()->get_user()->id;
             $cat->name = $post['name'];
             $cat->url = $post['url'];
             $cat->save();
             //rebuil tree
             if ($root_id == 0) {
                 // if no parent was selected, add/move this node to be a new root in the tree
                 $categoryTree = Menu::bll()->getTree();
                 $categoryTree->createRoot($cat);
             } else {
                 $parent = Menu::bll()->findOneBy('id', $root_id);
                 $cat->getNode()->insertAsLastChildOf($parent);
             }
             Message::success('Thêm mới liên kết thành công!');
             Request::instance()->redirect('/admin/menu/index');
         } else {
             $data['errors'] = $post->errors();
             $_POST = $post->as_array();
             $_POST['parent_id'] = $root_id;
         }
     }
     $this->template->title = __('Thêm mới liên kết');
     $this->template->section_title = __('Thêm mới liên kết');
     $q = Menu::bll()->createQuery();
     $q->addOrderBy('root_id asc')->addOrderBy('lft asc');
     //echo $q->getSqlQuery();
     $objects = $q->execute();
     ///$trees[0] = ' --- ROOT ---';
     foreach ($objects as $object) {
         $prefix = '|';
         if ($object['level'] == 0) {
             $prefix = null;
         }
         $trees[$object['id']] = $prefix . ' ' . str_repeat('- ', $object['level'] * 2) . $object['name'];
     }
     $data['trees'] = $trees;
     $this->template->content = View::factory('admin/menu/add', $data);
 }
コード例 #23
0
ファイル: MenuController.php プロジェクト: conghua1013/yii
 public function actionAdd()
 {
     if (empty($_POST)) {
         $select = Menu::model()->getSelectMenuForEdit();
         $viewData = array();
         $viewData['select'] = $select;
         $this->render('add', $viewData);
         exit;
     }
     $res = array('statusCode' => 200, 'message' => '添加成功!');
     try {
         if (!empty($_REQUEST['parent_id'])) {
             $info = Menu::model()->findByPk($_REQUEST['parent_id']);
             if (empty($info)) {
                 throw new exception('父级不存在!');
             }
             $level = $info['level'] + 1;
         } else {
             $level = 1;
         }
         $m = new Menu();
         $m->title = $_REQUEST['title'];
         $m->url = $_REQUEST['url'];
         $m->page_sign = $_REQUEST['page_sign'];
         $m->status = $_REQUEST['status'];
         $m->sort = $_REQUEST['sort'];
         $m->remark = $_REQUEST['remark'];
         $m->parent_id = $_REQUEST['parent_id'];
         $m->level = $level;
         $flag = $m->save();
         if (!$flag) {
             throw new exception('添加失败');
         }
     } catch (Exception $e) {
         $res['statusCode'] = 300;
         $res['message'] = '失败【' . $e->getMessage() . '】';
     }
     $res['navTabId'] = 'menuList';
     $res['callbackType'] = 'closeCurrent';
     $res['forwardUrl'] = '/manage/menu/index';
     $this->ajaxDwzReturn($res);
 }
コード例 #24
0
	public function save($name, $description)
	{
		$menu = new Menu;
		$menu->name = $name;
		$menu->description = $description;
		
		try
		{
			$menu->save();
			$this->notice(t('Menu created'));
			$this->redirect('admin', 'menu', 'edit', $name);
		}
		catch (ValidationException $e)
		{
			$this->error(t('Menu was not saved'));
			$this->menus = Menu::all();
			$this->newMenu = $menu;
			$this->render('index');
		}
	}
コード例 #25
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Menu();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Menu'])) {
         $model->attributes = $_POST['Menu'];
         if ($model->save()) {
             if (!$this->goBack()) {
                 $this->redirect(array('view', 'id' => $model->id));
             } else {
                 $this->goBack();
             }
         }
     }
     $parent = $this->loadModel();
     $model->parent_id = $parent->id;
     $model->parentPath = $model->getPathText($parent->id);
     $this->render('create', array('model' => $model));
 }
コード例 #26
0
ファイル: MenuController.php プロジェクト: awecode/awecms
 public function actionCreate()
 {
     $model = new Menu();
     if (isset($_POST['Menu'])) {
         $model->setAttributes($_POST['Menu']);
         try {
             if ($model->save()) {
                 if (isset($_GET['returnUrl'])) {
                     $this->redirect($_GET['returnUrl']);
                 } else {
                     $this->redirect(array('/' . $this->module->id));
                 }
             }
         } catch (Exception $e) {
             $model->addError('', $e->getMessage());
         }
     } elseif (isset($_GET['Menu'])) {
         $model->attributes = $_GET['Menu'];
     }
     $this->render('create', array('model' => $model));
 }
コード例 #27
0
ファイル: MenuController.php プロジェクト: lueimg/activista
 /**
  * Store a newly created resource in storage.
  * POST /menu/crear
  *
  * @return Response
  */
 public function postCrear()
 {
     //si la peticion es ajax
     if (Request::ajax()) {
         $regex = 'regex:/^([a-zA-Z .,ñÑÁÉÍÓÚáéíóú]{2,60})$/i';
         $required = 'required';
         $reglas = array('nombre' => $required . '|' . $regex);
         $mensaje = array('required' => ':attribute Es requerido', 'regex' => ':attribute Solo debe ser Texto');
         $validator = Validator::make(Input::all(), $reglas, $mensaje);
         if ($validator->fails()) {
             return Response::json(array('rst' => 2, 'msj' => $validator->messages()));
         }
         $menus = new Menu();
         $menus['nombre'] = Input::get('nombre');
         $menus['estado'] = Input::get('estado');
         $menus['class_icono'] = Input::get('class_icono');
         $menus['usuario_created_at'] = Auth::user()->id;
         $menus->save();
         return Response::json(array('rst' => 1, 'msj' => 'Registro realizado correctamente'));
     }
 }
コード例 #28
0
 /**
  * 添加一个菜单
  * 商铺
  */
 public function addMenu()
 {
     $user = Auth::user();
     $record = array('shop_id' => $user->shop_id, 'group_id' => Input::get('style'), 'title' => Input::get('title'), 'price' => Input::get('price'));
     $rules = array('shop_id' => 'required | integer | exists:shop,id', 'group_id' => 'required | integer | exists:menu_group,id', 'title' => 'required | between:1,100', 'price' => 'required | numeric');
     $v = Validator::make($record, $rules);
     if ($v->fails()) {
         $message = $v->messages();
         $error['msg'] = $message->toArray();
         $error['status'] = '400';
         return $error;
     }
     $menu = new Menu($record);
     if ($menu->save()) {
         // 成功后返回的是分类列表
         return Redirect::to('/good')->with('goodMsg', '添加成功!');
     } else {
         return json_encode(array('status' => '400', 'msg' => 'add failed'));
     }
     //var_dump($menu);
 }
コード例 #29
0
ファイル: MenuController.php プロジェクト: hntvu/db_for_site
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     Yii::app()->bootstrap->registerJS();
     Yii::app()->bootstrap->registerJSBackend();
     $model = new Menu();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Menu'])) {
         $model->attributes = $_POST['Menu'];
         if ($model->parent == 0) {
             $model->controller = "";
         } else {
             $findCate = Menu::model()->find('t.id="' . $model->parent . '"');
             $model->controller = $findCate->alias;
         }
         if ($model->save()) {
             Yii::app()->user->setFlash('createCate', 'Danh mục ' . $model->title . ' đã được tạo');
         }
         $this->refresh();
     }
     $this->render('create', array('model' => $model));
 }
コード例 #30
0
ファイル: MenuController.php プロジェクト: s-nice/24int
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Menu();
     $menulist = Menu::getDropList(0);
     $model->orderid = 1;
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Menu'])) {
         $model->attributes = $_POST['Menu'];
         $model->create_uid = Yii::app()->user->id;
         $model->update_uid = Yii::app()->user->id;
         $model->create_time = date('Y-m-d H:i:s');
         $model->update_time = date('Y-m-d H:i:s');
         if ($model->save()) {
             //$this->redirect(array('view','id'=>$model->id));
             Yii::app()->user->setFlash('success', '信息提交成功!');
         } else {
             Yii::app()->user->setFlash('success', '信息提交失败!');
         }
     }
     $this->render('create', array('model' => $model, 'menulist' => $menulist));
 }