本文整理汇总了PHP中grocery_CRUD::set_field_upload方法的典型用法代码示例。如果您正苦于以下问题:PHP grocery_CRUD::set_field_upload方法的具体用法?PHP grocery_CRUD::set_field_upload怎么用?PHP grocery_CRUD::set_field_upload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grocery_CRUD
的用法示例。
在下文中一共展示了grocery_CRUD::set_field_upload方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: usuarios
function usuarios()
{
$crud = new grocery_CRUD();
$crud->set_table('usuarios');
$crud->set_theme('datatables');
$crud->set_language('spanish');
$crud->set_subject('Usuario');
$crud->field_type('clave', 'password');
//-> Display as
$crud->display_as('id_nivel', 'Nivel');
$crud->display_as('id_estatus', 'Estado');
$crud->set_field_upload('foto', 'assets/uploads/users');
//-> Columnas
$crud->columns('usuario', 'nombre', 'email', 'id_nivel');
//-> Relaciones
$crud->set_relation('id_nivel', 'usuario_niveles', 'descripcion');
$crud->set_relation('id_estatus', 'usuario_estatus', 'descripcion');
//-> Output
$output = $crud->render();
$data['titulo'] = "USUARIOS";
$this->load->view('include/head');
$this->load->view('include/header');
$this->load->view('include/sidebar');
$this->load->view('admin/main', $data);
$this->load->view('admin/grocery_crud', $output);
$this->load->view('include/footer');
}
示例2: perfil
function perfil()
{
$crud = new grocery_CRUD();
$crud->where('row_id', $this->session->userdata('user_id'));
$crud->set_table('usuarios');
$crud->set_theme('datatables');
$crud->set_language('spanish');
$crud->set_subject('Usuario');
$state = $crud->getState();
if ($state == 'list' || $state == 'success') {
redirect('user/dashboard');
} else {
$crud->unset_add();
$crud->unset_delete();
$crud->field_type('usuario', 'readonly');
$crud->field_type('clave', 'password');
$crud->field_type('id_nivel', 'hidden');
$crud->field_type('row_id', 'hidden');
$crud->field_type('id_estatus', 'hidden');
$crud->set_field_upload('foto', 'assets/uploads/users/');
$output = $crud->render();
$data['titulo'] = "Configuración de Usuario";
$this->load->view('include/head');
$this->load->view('include/header');
$this->load->view('include/sidebar');
$this->load->view('admin/main', $data);
$this->load->view('admin/grocery_crud', $output);
$this->load->view('include/footer');
}
}
示例3: administration
function administration()
{
try {
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('news');
$crud->set_subject('Noticias');
$crud->set_language('spanish');
$crud->unset_export();
$crud->columns('title', 'author', 'summary', 'date_time', 'active');
$crud->required_fields('title', 'author', 'fk_source', 'date_time', 'priority', 'category', 'tags');
// $crud->add_fields('title', 'author', 'image', 'footer_text', 'date_time', 'url', 'summary', 'text', 'fk_source', 'priority', 'active', 'category', 'tags', 'img');
$crud->set_relation('fk_source', 'sources', 'name');
$crud->set_relation_n_n('category', 'news_categories', 'categories', 'fk_news', 'fk_category', 'category');
$crud->set_relation_n_n('tags', 'news_tags', 'tags', 'fk_news', 'fk_tag', 'tag');
$crud->set_field_upload('image', 'assets/uploads/news/');
$crud->display_as('title', 'Título')->display_as('summary', 'Sumario')->display_as('text', 'Texto')->display_as('author', 'Autor')->display_as('date_time', 'Fecha')->display_as('active', 'Estado')->display_as('comment_url', 'URL')->display_as('comment_count', 'Comentarios')->display_as('category', 'Categoría')->display_as('tags', 'Palabras Claves')->display_as('image', 'Imagen principal')->display_as('priority', 'Prioridad')->display_as('fk_source', 'Fuente')->display_as('img', 'Imágenes Adicionales')->display_as('footer_text', 'Texto de imagen');
$crud->set_relation_n_n('img', 'news_image', 'images', 'fk_news', 'fk_image', 'image');
// $crud->set_field_upload('img', 'assets/uploads/news/');
// $crud->set_field_upload('img', 'uploads/news/');
// $crud->callback_add_field('img', array($this, 'add_field_image_callback'));
// $crud->callback_edit_field('img', array($this, 'edit_field_image_callback'));
/* Generamos la tabla */
// $crud->callback_after_insert(array($this, 'after_insert'));
// $crud->callback_before_delete(array($this, 'before_delete_log'));
// $crud->callback_after_update(array($this, 'after_update_log'));
//
$output = $crud->render();
$this->load->view('includes/template', $output);
} catch (Exception $e) {
/* Si algo sale mal cachamos el error y lo mostramos */
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}
示例4: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid2');
/*$crud->fields(
'tabs'
,'title','description','release_year','length','rating','special_features'
,'actors','category'
,'rental_duration','rental_rate','replacement_cost'
);
$tabs = array (
array('Film','title','description','release_year','length','rating','special_features')
,array('Actors-Category','actors','category')
,array('Rental','rental_duration','rental_rate','replacement_cost')
);
$this->session->set_userdata('myproject_film_tabs', $tabs); // Send variables to the callback via session data
$crud->callback_field('tabs',array($this,'_form_tabs')); // Make the fake field */
#Indicamos que tabla se va a usar
$crud->set_table('banners');
#Modificamos el titulo que se muestra en los listados y fomularios
$crud->set_subject('Bannners');
$crud->columns('nombre', 'activo');
$crud->set_rules('nombre', 'Nombre', 'required');
$crud->field_type('activo', 'dropdown', array('S' => 'Si', 'N' => 'No'));
$config = array('main_table' => 'banners', 'main_table_primary' => 'idbanner', "url" => base_url() . __CLASS__ . '/' . __FUNCTION__ . '/', 'ajax_loader' => base_url() . 'assets/img/ajax-loader.gif');
$crud->set_field_upload('archivo', 'assets/uploads/files');
$output = $crud->render();
#Enviamos el resultado a la funcion usuarios_output para que sea pasado a una vista para mostrarlo
$this->_banners_output($output);
}
示例5: configuracion
function configuracion()
{
$crud = new grocery_CRUD();
$crud->set_table('usuarios');
$crud->set_theme('datatables');
$crud->set_language('spanish');
$crud->set_subject('Usuario');
$state = $crud->getState();
$state_info = $crud->getStateInfo();
if ($state == 'list' || $state == 'success') {
redirect('user/dashboard');
} else {
$crud->unset_add();
$crud->unset_delete();
$crud->field_type('usuario', 'readonly');
$crud->field_type('clave', 'password');
$crud->field_type('id_cliente', 'hidden');
$crud->field_type('id_nivel', 'hidden');
$crud->field_type('row_id', 'hidden');
$crud->field_type('id_estatus', 'hidden');
$crud->set_field_upload('foto', 'assets/uploads/users/');
$output = $crud->render();
$data['titulo'] = "CONFIGURACION DE USUARIO";
$this->load->view('include/head', $output);
$this->load->view('include/header', $data);
$this->load->view('admin/output');
$this->load->view('include/footer', $data);
$this->load->view('admin/librerias');
}
}
示例6: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('hotels');
$crud->set_subject('Hotels');
$agents = $this->ion_auth->get_all_agents();
$user = $this->ion_auth->user()->row();
$agents += array($user->id => $user->first_name . " " . $user->last_name);
$crud->field_type('hotel_agent_id', 'dropdown', $agents);
//var_dump($agents);
// $crud->set_relation('hotel_agent_id', 'io_users', '{first_name} {last_name}', array('active' => 1));
$crud->display_as('hotel_agent_id', 'Agent Name');
$crud->display_as('hotel_name', 'Hotel Name');
$crud->display_as('hotel_rooms', 'Rooms');
$crud->display_as('hotel_tariffs', 'Tariffs');
$crud->display_as('hotel_country', 'Country');
$crud->display_as('hotel_city', 'City');
$crud->display_as('hotel_street', 'Street');
$crud->display_as('hotel_state', 'State');
$crud->display_as('hotel_postCode', 'PostCode');
$crud->display_as('hotel_phoneNumber', 'Phone Number');
$crud->display_as('hotel_emailId', 'Email ID');
$crud->display_as('hotel_website', 'Website');
$crud->display_as('hotel_facebook', 'Facebook');
$crud->display_as('hotel_googleMap', 'Google Map');
$crud->display_as('hotel_related', 'Related Hotels');
$crud->display_as('hotel_status', 'Status');
$crud->columns('hotel_name', 'hotel_agent_id', 'hotel_phoneNumber', 'hotel_website', 'hotel_facebook', 'hotel_googleMap', 'hotel_status');
$crud->required_fields('hotel_agent_id');
$crud->field_type('hotel_stars', 'dropdown', range(0, 5));
/*
* For related hotels
* on add list all the hotels
* on edit, list all except own name
*/
$hrf = array();
if ($crud->getState() == 'edit') {
$hrf = $this->generic_model->get_by('hotels', array('hotel_status' => 1, 'hotel_id !=' => $crud->getStateInfo()->primary_key), 'hotel_id');
} else {
$hrf = $this->generic_model->get_by('hotels', array('hotel_status' => 1), 'hotel_id');
}
$hrf = $this->generic_model->array_from_db($hrf, 'hotel_id, hotel_name');
$crud->field_type('hotel_related', 'multiselect', $hrf);
$crud->callback_column('hotel_image', array($this, 'set_image'));
$crud->set_field_upload('hotel_image', $this->upload_path);
$hf = $this->generic_model->get_by('hotel_facilities', array('hf_status' => 1), 'hf_id');
$hf = $this->generic_model->array_from_db($hf, 'hf_id, hf_facility');
$crud->field_type('hotel_facilities', 'multiselect', $hf);
$hrf = $this->generic_model->get_by('hotel_room_facilities', array('hrf_status' => 1), 'hrf_id');
$hrf = $this->generic_model->array_from_db($hrf, 'hrf_id, hrf_facility');
$crud->field_type('hotel_room_facilities', 'multiselect', $hrf);
$crud->unique_fields('hotel_slug');
$crud->add_action('Photo Gallery', '', 'hotels/gallery', 'ui-icon ui-icon-image');
$output = $crud->render();
$data = array('main_content' => 'list', 'output' => $output, 'pagetitle' => 'Hotels', 'pagedesc' => 'Hotels', 'contenttitle' => 'Hotels List Records');
$this->load->view('gc_admin_wrapper', $data);
}
示例7: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_table('web_identitas');
$crud->columns('nama_website', 'meta_deskripsi', 'meta_keyword', 'favicon', 'theme', 'logo');
$crud->required_fields('nama_website', 'meta_deskripsi', 'meta_keyword');
$crud->set_subject('Identitas Website');
$crud->fields('nama_website', 'meta_deskripsi', 'meta_keyword', 'copyright', 'favicon', 'theme', 'logo', 'google_analytics', 'profil');
$crud->set_field_upload('favicon', 'assets/uploads/identitas');
$crud->set_field_upload('logo', 'assets/uploads/identitas');
$crud->unset_texteditor('google_analytics', 'full_text');
$crud->unset_add();
$crud->unset_delete();
$output = $crud->render();
$data['subject'] = 'Identitas Website';
$data['content'] = $this->load->view('crud.php', $output, true);
$this->load->view('base_theme', $data);
}
示例8: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('hotels');
$crud->set_subject('Hotels');
// $crud->set_relation('hotel_agent_id', 'io_users', '{first_name} {last_name}');
$agent_id = $this->ion_auth->user()->row()->id;
$crud->where('hotel_agent_id', $agent_id);
$crud->field_type('hotel_agent_id', 'hidden', $agent_id);
// $crud->display_as('hotel_agent_id', 'Agent Name');
$crud->display_as('hotel_name', 'Hotel Name');
$crud->display_as('hotel_rooms', 'rooms');
$crud->display_as('hotel_tariffs', 'tariffs');
$crud->display_as('hotel_country', 'Country');
$crud->display_as('hotel_city', 'City');
$crud->display_as('hotel_street', 'Street');
$crud->display_as('hotel_state', 'State');
$crud->display_as('hotel_postCode', 'PostCode');
$crud->display_as('hotel_phoneNumber', 'Phone Number');
$crud->display_as('hotel_emailId', 'Email ID');
$crud->display_as('hotel_website', 'Website');
$crud->display_as('hotel_facebook', 'Facebook');
$crud->display_as('hotel_googleMap', 'GoogleMap');
$crud->display_as('hotel_status', 'Status');
$crud->columns('hotel_name', 'hotel_phoneNumber', 'hotel_website', 'hotel_facebook', 'hotel_googleMap', 'hotel_status');
$crud->callback_column('hotel_image', array($this, 'set_image'));
$crud->set_field_upload('hotel_image', $this->upload_path);
/*
* For related hotels
* on add list all the hotels
* on edit, list all except own name
*/
if ($crud->getState() == 'edit') {
$hrf = $this->generic_model->get_by('hotels', array('hotel_status' => 1, 'hotel_agent_id' => $this->ion_auth->get_user_id(), 'hotel_id !=' => $crud->getStateInfo()->primary_key), 'hotel_id');
} else {
$hrf = $this->generic_model->get_by('hotels', array('hotel_status' => 1, 'hotel_agent_id' => $this->ion_auth->get_user_id()), 'hotel_id');
}
// empty data for multiselect field generates error
if (empty($hrf)) {
$hrf = array('');
} else {
$hrf = $this->generic_model->array_from_db($hrf, 'hotel_id, hotel_name');
}
$crud->field_type('hotel_related', 'multiselect', $hrf);
$hf = $this->generic_model->get_by('hotel_facilities', array('hf_status' => 1), 'hf_id');
$hf = $this->generic_model->array_from_db($hf, 'hf_id, hf_facility');
$crud->field_type('hotel_facilities', 'multiselect', $hf);
$hrf = $this->generic_model->get_by('hotel_room_facilities', array('hrf_status' => 1), 'hrf_id');
$hrf = $this->generic_model->array_from_db($hrf, 'hrf_id, hrf_facility');
$crud->field_type('hotel_room_facilities', 'multiselect', $hrf);
$crud->add_action('Photo Gallery', '', 'agents/hotels/gallery', 'ui-icon ui-icon-image');
$output = $crud->render();
$data = array('main_content' => 'list', 'output' => $output, 'pagetitle' => 'Hotels', 'pagedesc' => 'Hotels', 'contenttitle' => 'Hotels List Records', 'left_menu' => 'agents_menu');
$this->load->view('gc_admin_wrapper', $data);
}
示例9: principal
function principal()
{
try {
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('tp_logos');
$crud->set_subject('logo');
$crud->set_language('spanish');
$crud->fields('logo_gobierno', 'vinculacion_logo_gobierno', 'logo_opcional', 'vinculacion_logo_opcional');
$crud->display_as('logo_gobierno', 'Logotipo principal');
$crud->display_as('vinculacion_logo_gobierno', 'Vínculo del logotipo principal');
$crud->display_as('logo_opcional', 'Logotipo secundario (opcional)');
$crud->display_as('vinculacion_logo_opcional', 'Vínculo del logotipo secundario');
$crud->unset_add();
$crud->unset_export();
$crud->unset_print();
$crud->unset_delete();
$crud->unset_list();
$crud->where('id_logo', 1);
$crud->set_field_upload('logo_gobierno', 'archivos/logos');
$crud->set_field_upload('logo_opcional', 'archivos/logos');
$crud->callback_after_upload(array($this, 'obtener_imagen_upload'));
$crud->callback_after_update(array($this, 'redireccionar'));
$output = $crud->render();
$data['opcion'] = '';
$data['cambiar_logos'] = '';
$data['nombre_usuario'] = $this->modelo->nombre_usuario($this->session->userdata('id_usuario'));
$data['logo'] = $this->modelo->logo();
$data['url_logo'] = $this->modelo->url_logo();
$data['logo_opcional'] = $this->modelo->logo_opcional();
$data['url_logo_opcional'] = $this->modelo->url_logo_opcional();
$this->load->view('cabecera', $data);
$this->load->view('nuevos_logos', $output);
$this->load->view('pie');
} catch (Exception $e) {
if ($e->getCode() == 14) {
redirect('medios/principal');
} else {
show_error($e->getMessage());
}
}
}
示例10: projects
public function projects()
{
try {
$crud = new grocery_CRUD();
//$crud->set_theme('datatables');
$crud->set_table('t05_proyecto_ma');
$crud->set_subject('Proyecto');
$crud->columns('Nombre_TXT', 'Resumen_TXT', 'ImagenProyecto_TXT', 'VideoProyecto_TXT', 'Descripcion_TXT');
$crud->fields('Nombre_TXT', 'Resumen_TXT', 'ImagenProyecto_TXT', 'VideoProyecto_TXT', 'Descripcion_TXT');
$crud->display_as('Nombre_TXT', 'Nombre del proyecto')->display_as('Resumen_TXT', 'Resumen')->display_as('ImagenProyecto_TXT', 'Imagen')->display_as('VideoProyecto_TXT', 'Video')->display_as('Descripcion_TXT', 'Descripción');
$crud->set_field_upload('ImagenProyecto_TXT', 'assets/uploads/proyectos');
$crud->set_field_upload('VideoProyecto_TXT', 'assets/uploads/proyectos');
$crud->required_fields('Nombre_TXT', 'Resumen_TXT', 'Descripcion_TXT');
$crud->edit_fields('Resumen_TXT', 'Descripcion_TXT');
$output = $crud->render();
$this->_example_output($output);
} catch (Exception $e) {
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}
示例11: items
public function items()
{
$crud = new grocery_CRUD();
$crud->set_table('item');
$crud->display_as('category_id', 'Categoria')->display_as('tag_id', 'Etiqueta');
$crud->set_relation('category_id', 'category', 'name');
$crud->set_relation('tag_id', 'tag', 'name');
$crud->set_field_upload('photo', 'assets/uploads/files');
$output = $crud->render();
$this->_example_output($output);
}
示例12: index
public function index()
{
$arr['page'] = 'admmarcas';
$crud = new grocery_CRUD();
$crud->set_table('marcas');
$crud->required_fields('marca', 'mostrar', 'imagen', 'link');
$crud->set_field_upload('imagen', 'assets/uploads/images');
$output = $crud->render();
$arr['output'] = $output;
$this->load->view('admin/vwManageCMS', $arr);
}
示例13: slider
public function slider()
{
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('slider');
$crud->set_subject('Image');
$crud->required_fields('title', 'image');
$crud->set_field_upload('image', 'assets/uploads');
$output = $crud->render();
$this->_admin_output($output);
}
示例14: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('banner')->set_subject('Banners')->columns('imagen');
$crud->required_fields('imagen');
$crud->set_field_upload('imagen', 'assets/uploads/files');
$crud->unset_fields('fecha');
$crud->unset_print();
$output = $crud->render();
$this->_example_output($output);
}
示例15: index
public function index()
{
$arr['page'] = 'admnovedades';
$crud = new grocery_CRUD();
$crud->set_table('novedades');
$crud->columns('titulo', 'mostrar', 'texto', 'imagen');
$crud->fields('titulo', 'mostrar', 'imagen', 'texto');
$crud->required_fields('titulo', 'mostrar', 'texto');
$crud->set_field_upload('imagen', 'assets/uploads/images');
$output = $crud->render();
$arr['output'] = $output;
$this->load->view('admin/vwManageCMS', $arr);
}