Jump to content


Mike's Content

There have been 6 items by Mike (Search limited from 20-January 20)


By content type

See this member's

Sort by                Order  

#12751 Agregar Boton de Imprimir en PDF

Posted by Mike on 05 July 2015 - 07:58 PM in Bugs / Issues

Buenas noches JoseVen, tu pregunta es bastante ámplia, y más complicada de lo que parece en un primer momento.

 

Lo primero que debes tener en cuenta es que para exportar a PDF necesitarás crear un método en tus clases que ejecute el trabajo a través de la clave primaria que le envíes desde el grid del grocery crud.

Esto lo puedes hacer con muchas librerías, entre ellas:

Lo segundo, el tema de agregar el botón, es muy simple, te remito a la propia documentación:

Con esto se creará un botón por cada fila de la tabla que te dejará incluir una URL y lanzar la acción.

 

Un saludo!




#12750 Multiple Image Crud uploaders in one page

Posted by Mike on 05 July 2015 - 07:54 PM in Bugs / Issues

Maybe i am telling nonsense but have you tried to clear the $image_crud object, and/or create a new one with different name?, it had to be a different one, but if something is wrong it may cache the data and work wrong.

 

Greetings!




#12743 Problemas theme bootstrap

Posted by Mike on 04 July 2015 - 12:50 AM in I have a question

Buenas!, la solución es más sencilla, simplemente hay que añadir las librerías de fancybox al archivo list_template.php

Hello, the solution is more simple, just have to add the fancybox libs to the list_template.php file.

/** Fancybox */
	$this->set_css($this->default_css_path.'/jquery_plugins/fancybox/jquery.fancybox.css');
	$this->set_js($this->default_javascript_path.'/jquery_plugins/jquery.fancybox-1.3.4.js');
	$this->set_js($this->default_javascript_path.'/jquery_plugins/config/jquery.fancybox.config.js');

Con eso es suficiente para funcionar correctamente.

With this is enough to work properly.

 

Saludos!

Greetings!




#12700 forms with nonexistent primary key

Posted by Mike on 28 June 2015 - 05:04 PM in Bugs / Issues

Hello, "auto-solution found"

 

In the two methods that i've mentioned the "solution" (i think there are one better like redirect or something else) is throwing an Exception.

 

 

Original code:

protected function showEditForm($state_info)
	{
		$this->set_js_lib($this->default_javascript_path.'/'.grocery_CRUD::JQUERY);

		$data 				= $this->get_common_data();
		$data->types 		= $this->get_field_types();

		$data->field_values = $this->get_edit_values($state_info->primary_key);

		$data->add_url		= $this->getAddUrl();

		$data->list_url 	= $this->getListUrl();
		$data->update_url	= $this->getUpdateUrl($state_info);
		$data->delete_url	= $this->getDeleteUrl($state_info);
		$data->read_url		= $this->getReadUrl($state_info->primary_key);
		$data->input_fields = $this->get_edit_input_fields($data->field_values);
		$data->unique_hash			= $this->get_method_hash();

		$data->fields 		= $this->get_edit_fields();
		$data->hidden_fields	= $this->get_edit_hidden_fields();
		$data->unset_back_to_list	= $this->unset_back_to_list;

		$data->validation_url	= $this->getValidationUpdateUrl($state_info->primary_key);
		$data->is_ajax 			= $this->_is_ajax();

		$this->_theme_view('edit.php',$data);
		$this->_inline_js("var js_date_format = '".$this->js_date_format."';");

		$this->_get_ajax_results();
	}

	protected function showReadForm($state_info)
	{
		$this->set_js_lib($this->default_javascript_path.'/'.grocery_CRUD::JQUERY);

		$data 				= $this->get_common_data();
		$data->types 		= $this->get_field_types();

		$data->field_values = $this->get_edit_values($state_info->primary_key);

		$data->add_url		= $this->getAddUrl();

		$data->list_url 	= $this->getListUrl();
		$data->update_url	= $this->getUpdateUrl($state_info);
		$data->delete_url	= $this->getDeleteUrl($state_info);
		$data->read_url		= $this->getReadUrl($state_info->primary_key);
		$data->input_fields = $this->get_read_input_fields($data->field_values);
		$data->unique_hash			= $this->get_method_hash();

		$data->fields 		= $this->get_read_fields();
		$data->hidden_fields	= $this->get_edit_hidden_fields();
		$data->unset_back_to_list	= $this->unset_back_to_list;

		$data->validation_url	= $this->getValidationUpdateUrl($state_info->primary_key);
		$data->is_ajax 			= $this->_is_ajax();

		$this->_theme_view('read.php',$data);
		$this->_inline_js("var js_date_format = '".$this->js_date_format."';");

		$this->_get_ajax_results();
	}

Updated code:

	protected function showEditForm($state_info)
	{
		$this->set_js_lib($this->default_javascript_path.'/'.grocery_CRUD::JQUERY);

		$data 				= $this->get_common_data();
		$data->types 		= $this->get_field_types();

		$data->field_values = $this->get_edit_values($state_info->primary_key);

		if(empty($data->field_values))
		{
			throw new Exception('You don\'t have permissions for this operation');
			die();
		}
		
		$data->add_url		= $this->getAddUrl();

		$data->list_url 	= $this->getListUrl();
		$data->update_url	= $this->getUpdateUrl($state_info);
		$data->delete_url	= $this->getDeleteUrl($state_info);
		$data->read_url		= $this->getReadUrl($state_info->primary_key);
		$data->input_fields = $this->get_edit_input_fields($data->field_values);
		$data->unique_hash			= $this->get_method_hash();

		$data->fields 		= $this->get_edit_fields();
		$data->hidden_fields	= $this->get_edit_hidden_fields();
		$data->unset_back_to_list	= $this->unset_back_to_list;

		$data->validation_url	= $this->getValidationUpdateUrl($state_info->primary_key);
		$data->is_ajax 			= $this->_is_ajax();

		$this->_theme_view('edit.php',$data);
		$this->_inline_js("var js_date_format = '".$this->js_date_format."';");

		$this->_get_ajax_results();
	}

	protected function showReadForm($state_info)
	{
		$this->set_js_lib($this->default_javascript_path.'/'.grocery_CRUD::JQUERY);

		$data 				= $this->get_common_data();
		$data->types 		= $this->get_field_types();

		$data->field_values = $this->get_edit_values($state_info->primary_key);
		
		if(empty($data->field_values))
		{
			throw new Exception('You don\'t have permissions for this operation');
			die();
		}
		
		$data->add_url		= $this->getAddUrl();

		$data->list_url 	= $this->getListUrl();
		$data->update_url	= $this->getUpdateUrl($state_info);
		$data->delete_url	= $this->getDeleteUrl($state_info);
		$data->read_url		= $this->getReadUrl($state_info->primary_key);
		$data->input_fields = $this->get_read_input_fields($data->field_values);
		$data->unique_hash			= $this->get_method_hash();

		$data->fields 		= $this->get_read_fields();
		$data->hidden_fields	= $this->get_edit_hidden_fields();
		$data->unset_back_to_list	= $this->unset_back_to_list;

		$data->validation_url	= $this->getValidationUpdateUrl($state_info->primary_key);
		$data->is_ajax 			= $this->_is_ajax();

		$this->_theme_view('read.php',$data);
		$this->_inline_js("var js_date_format = '".$this->js_date_format."';");

		$this->_get_ajax_results();
	}

Greetings!




#12699 forms with nonexistent primary key

Posted by Mike on 28 June 2015 - 04:53 PM in Bugs / Issues

Hello, i am new in this forum and library and was reading about it and doing some tests.
 
While doing those tests i've found a "bug" (to call it something) that consists in when you pass a primary key that does not exists in the table, the system allows to work with it, the result are incorrect forms and data list show, and a system malfunction when editing a field (nothing important, just doesn't work)

 

Listing:

Editing:

I think the solution is very simple, but as yet i don't know how the library works completely i prefer to ask here if there is any method to check this in the main file.

 

Extra info (Lines and stuff):

  • Grocery_CRUD.php -> Line: 1832 ( protected function showEditForm($state_info) )
  • Grocery_CRUD.php -> Line: 1863 ( protected function showReadForm($state_info) )
  • Var to check if exists in table: $state_info->primary_key

Greetings!




#12694 Upload in a specific directory

Posted by Mike on 28 June 2015 - 10:21 AM in Extra coding / Plugins

Hello, i'm a newbie within this library, but i think you can do it by passing a variable to the set_field_upload method, something like this:

public function employees_management($myvar)
{
		$crud = new grocery_CRUD();

		$crud->set_theme('datatables');
		$crud->set_table('employees');
		$crud->set_relation('officeCode','offices','city');
		$crud->display_as('officeCode','Office City');
		$crud->set_subject('Employee');

		$crud->required_fields('lastName');

		$crud->set_field_upload('file_url','assets/uploads/'. $myvar .'files');

		$output = $crud->render();

		$this->_example_output($output);
}

Greetings!