本文整理汇总了PHP中Menu::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::update方法的具体用法?PHP Menu::update怎么用?PHP Menu::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::update方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_update
public function action_update()
{
$name = $this->request->param('id');
$menu_data = Menu::get_item($name);
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit Menu') . ' ' . $menu_data['title']));
$this->template->title = __('Edit Menu');
$this->template->styles = array('css/sortable.css' => 'screen');
$this->template->scripts['footer'][] = 'js/jquery-sortable-min.js';
$this->template->scripts['footer'][] = 'js/oc-panel/menu.js';
//find all, for populating form select fields
$categories = Model_Category::get_as_array();
$order_categories = Model_Category::get_multidimensional();
if ($_POST) {
if (Menu::update($name, Core::post('title'), Core::post('url'), Core::post('target'), Core::post('icon'))) {
Alert::set(Alert::SUCCESS, __('Menu updated'));
} else {
Alert::set(Alert::ERROR, __('Menu not updated'));
}
HTTP::redirect(Route::url('oc-panel', array('controller' => 'menu', 'action' => 'index')));
}
// d($categories);
$this->template->content = View::factory('oc-panel/pages/menu/update', array('menu_data' => $menu_data, 'name' => $name, 'categories' => $categories, 'order_categories' => $order_categories));
}
示例2: Users
$users = new Users();
$id = 0;
//get the user roles
$userroles = $users->getRoles();
$roles = [];
foreach ($userroles as $r) {
$roles[$r['ID']] = $r['name'];
}
// set the current action
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
switch ($action) {
case 'submit':
if ($_POST["id"] == "") {
$menu->add($_POST);
} else {
$ret = $menu->update($_POST);
}
header("Location:" . WWW_TOP . "/menu-list.php");
break;
case 'view':
default:
if (isset($_GET["id"])) {
$page->title = "Menu Edit";
$id = $_GET["id"];
$menurow = $menu->getByID($id);
$page->smarty->assign('menu', $menurow);
}
break;
}
$page->smarty->assign('yesno_ids', array(1, 0));
$page->smarty->assign('yesno_names', array('Yes', 'No'));
示例3: menu_edit_form_submit
function menu_edit_form_submit($data)
{
$error = menu_validate($data);
if (!empty($error)) {
return FALSE;
}
$menu = new Menu();
foreach ($data as $field => $value) {
if ($field != 'fn') {
$menu->{$field} = $value;
$submit[$field] = $value;
}
}
$update = $menu->update($submit);
if ($update['code'] == 200) {
return menu_list($data['id']);
}
}
示例4: agregarModificar
public function agregarModificar()
{
$eItem = new Menu();
if ($this->_request->isPost()) {
Zend_Loader::loadClass('Zend_Filter_StripTags');
$filter = new Zend_Filter_StripTags();
$id = $this->_request->getPost('id');
$item = trim($filter->filter($this->_request->getPost('item')));
$destino = trim($filter->filter($this->_request->getPost('destino')));
$posicion = trim($filter->filter($this->_request->getPost('posicion')));
$privado = trim($filter->filter($this->_request->getPost('privado')));
$estado = trim($filter->filter($this->_request->getPost('estado')));
if ($item != '' && $destino != '' && $estado != '') {
$data = array('item' => $item, 'destino' => $destino, 'posicion' => $posicion, 'privado' => $privado, 'estado' => $estado, 'id_sitio' => $this->session->sitio->id);
if ((int) $id > 0) {
$where = ' id=' . (int) $id;
$eItem->update($data, $where);
} else {
$eItem->insert($data);
}
$this->_redirect('/admin/menu/');
return;
}
} else {
$id = (int) $this->_request->getParam('id', 0);
}
if (is_numeric($id) && $id > 0) {
#verificar que el item exista para no mostrar error
$this->view->item = $eItem->fetchRow('id=' . $id);
} else {
$this->view->item = new stdClass();
$this->view->item->id = null;
$this->view->item->item = '';
$this->view->item->destino = '';
$this->view->item->posicion = '';
$this->view->item->privado = '0';
$this->view->item->estado = '0';
if ($this->view->pagina) {
$this->view->item->item = $this->view->pagina->titulo;
$this->view->item->destino = '/frontend/paginas/ver/id/' . $this->view->pagina->id;
}
}
return;
}
示例5: setConfig
/**
* Método para actualizar el archivo config.ini según los parámetros enviados
*
* @param type $data Campos de los formularios
* @param type $source Production o Deveploment
* @param type $createDb Indica si se crea o no la base de datos
* @return boolean
*/
public static function setConfig($data, $source = 'application')
{
//Verifico si tiene permisos de escritura para crear y editar un archvivo.ini
if (!is_writable(APP_PATH . 'config')) {
MkcMessage::warning('Asigna temporalmente el permiso de escritura a la carpeta "config" de tu app!.');
return false;
}
//Filtro el array
$data = Filter::data($data, null, 'trim');
$rs = MkcConfig::write('config', $data, $source);
if ($rs && $source == 'custom') {
//Para verificar si está habilitado el manejo de sucursales
$config = MkcConfig::read('config', 'custom');
$menu = new Menu();
$menu->find_first(Menu::SUCURSAL);
$menu->activo = $config['app_office'] == 'Off' ? Menu::INACTIVO : Menu::ACTIVO;
$menu->update();
}
if ($rs) {
MkcAudit::info('Se ha actualizado el archivo de configuración del sistema');
}
return $rs;
}
示例6: save_order
public function save_order()
{
$menu_array = $_POST['menu_id'];
$order_array = $_POST['order'];
$menu = new Menu();
foreach ($menu_array as $key => $value) {
$menu_id = $value;
$menu_order = $order_array[$key];
$menu->update('Menu', array('sequence' => $menu_order), 'id=' . $menu_id);
}
redirect(get_url('menu'));
}