⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

How to use Grocery CRUD and Image CRUD together?



MSuprayogie KivaHeatnix

MSuprayogie KivaHeatnix
  • profile picture
  • Member

Posted 22 June 2013 - 00:28 AM

in folder grucery crud n image crud . . . paste 2 folder of them ? or grucery crud only @david


davidoster

davidoster
  • profile picture
  • Member

Posted 22 June 2013 - 00:51 AM

in folder grucery crud n image crud . . . paste 2 folder of them ? or grucery crud only @david

You don't need to copy anything! It already contains both Grocery CRUD and Image CRUD.

Just copy this folder (grocery_image_in_one) to your web server with any name you want.


teoj

teoj
  • profile picture
  • Member

Posted 19 July 2013 - 16:34 PM

Hellow all im trying do works imagecrud and grocery crud, i show you my code:

 

Controller:

 

function view_fotos($id = null)
    {
        $this->load->library('image_crud');
        $image_crud = new image_crud();


        $image_crud->set_table('photos');


       
        $image_crud->set_primary_key_field('id');


        $image_crud->set_url_field('url')
         ->set_image_path('assets/uploads')
         -> set_relation_field('inmueble_ID')
         ->set_title_field('title');


        $output = $image_crud->render();
     // load_plantilla load a template
        $this -> load_plantilla('layout',  $output, 'fotos_view');
    }


function load_plantilla ($layout, $output,  $content)
    {
$this->template
            ->set_partial('head', 'template/head')
            ->set_partial('header', 'template/header')
            ->set_partial('subheader', 'template/subheader')
            ->set_partial('latizq', 'template/latizq')
            ->set_partial('content', $content)
            ->set_partial('subfooter', 'template/subfooter')
            ->set_partial('footer', 'template/footer')
            ->set_partial('foot', 'template/foot')
            ->build($layout, $output);
}
 
and the view is:
 
<?php
echo $output;
?>

 

 

well when i look the code from the google chrome this apear:

 

 

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    <title></title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <link rel="stylesheet" href="http://xxxxx.xx/assets/backend/css/cpanel_ifcs.css" type="text/css" media="screen, projection" />
    <!--[if lte IE 6]><link rel="stylesheet" href="http://xxxxx.xx/css/style_ie.css" type="text/css" media="screen, projection" /><![endif]-->
    
                <link type="text/css" rel="stylesheet" href="http://xxxxx.xx/assets/image_crud/css/fineuploader.css" />
                    <link type="text/css" rel="stylesheet" href="http://xxxxx.xx/assets/image_crud/css/photogallery.css" />
                    <link type="text/css" rel="stylesheet" href="http://xxxxx.xx/assets/image_crud/css/colorbox.css" />
                
          


        
    <link rel="stylesheet" type="text/css" href="http://xxxxx.xx/assets/bootstrap/css/bootstrap.min.css" media="screen" />
   
     
    <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
</head> 
<div class="container-fluid">
  <div class="row-fluid">
    <div class="span2">
           <div id="menu">
       <ul class="nav nav-list">
   <li class="nav-header">teoj.em@gmail.com</li>
  <li class=""><a href="http://xxxxx.xx/cpanel">Panel de Control</a></li>
   <li><a href="http://xxxxx.xx/cpanel/view_pages">Paginas</a></li>
   <li><a href="http://xxxxx.xx/cpanel/view_clientes">Clientes</a></li>
   <li><a href="http://xxxxx.xx/cpanel/view_inmuebles">Inmuebles</a></li>
   <li><a href="http://xxxxx.xx/cpanel/view_alquileres">Alquileres</a></li>
   <li><a href="http://xxxxx.xx/cpanel/view_contactos">Contactos</a></li>
   <li class="divider"></li>
   <li class=""><a href="http://xxxxx.xx/">Inicio</a></li>
   <li><a href="http://xxxxx.xx/auth/logout">Logout</a></li>
</ul>  
      </div>


    </div>
    <div class="span10">
             


<script>
$(function(){
createUploader();
loadColorbox();
});
function loadColorbox()
{
$('.color-box').colorbox({
rel: 'color-box'
});
}
function loadPhotoGallery(){
$.ajax({
url: 'http://xxxxx.xx/cpanel/view_fotos/1/ajax_list',
cache: false,
dataType: 'text',
beforeSend: function()
{
$('.file-upload-messages-container:first').show();
$('.file-upload-message').html("Loading, please wait...");
},
complete: function()
{
$('.file-upload-messages-container').hide();
$('.file-upload-message').html('');
},
success: function(data){
$('#ajax-list').html(data);
loadColorbox();
}
});
}


function createUploader() {
var uploader = new qq.FineUploader({
element: document.getElementById('fine-uploader'),
request: {
endpoint: 'http://xxxxx.xx/cpanel/view_fotos/upload_file/1'
},
validation: {
allowedExtensions: ['jpeg', 'jpg', 'png', 'gif']
}, 
callbacks: {
onComplete: function(id, fileName, responseJSON) {
loadPhotoGallery();
}
},
debug: true,
/*template: '<div class="qq-uploader">' +
'<div class="qq-upload-drop-area"><span>Drop files here to upload</span></div>' +
'<div class="qq-upload-button">Upload files here</div>' +
'<ul class="qq-upload-list"></ul>' +
'</div>',
fileTemplate: '<li>' +
'<span class="qq-upload-file"></span>' +
'<span class="qq-upload-spinner"></span>' +
'<span class="qq-upload-size"></span>' +
'<a class="qq-upload-cancel" href="#">Cancel</a>' +
'<span class="qq-upload-failed-text">Failed</span>' +
'</li>',
*/
});
}


function saveTitle(data_id, data_title)
{
  $.ajax({
url: 'http://xxxxx.xx/cpanel/view_fotos/insert_title',
type: 'post',
data: {primary_key: data_id, value: data_title},
beforeSend: function()
{
$('.file-upload-messages-container:first').show();
$('.file-upload-message').html("Saving title...");
},
complete: function()
{
$('.file-upload-messages-container').hide();
$('.file-upload-message').html('');
}
});
}


window.onload = createUploader;


</script>
<!-- <div id="file-uploader-demo1" class="floatL upload-button-container"></div>
<div class="file-upload-messages-container hidden">
<div class="message-loading"></div>
<div class="file-upload-message"></div>
<div class="clear"></div>
</div>-->
<div id="fine-uploader"></div>
<div class="clear"></div>
<div id='ajax-list'>
</div>    </div>
  </div>
</div>




<script src="http://xxxxx.xx/assets/image_crud/js/jquery-1.8.2.min.js"></script>
    <script src="http://xxxxx.xx/assets/image_crud/js/jquery-ui-1.9.0.custom.min.js"></script>
    <script src="http://xxxxx.xx/assets/image_crud/js/fineuploader-3.2.min.js"></script>
    <script src="http://xxxxx.xx/assets/image_crud/js/jquery.colorbox-min.js"></script>
     
<script src="http://xxxxx.xx/assets/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>

 

 

all the file exist and all apear to works but dont show my nothing. the page is clean only show me the menu. no button and no pictures. Whats the problem thankyou.

 

 


davidoster

davidoster
  • profile picture
  • Member

Posted 20 July 2013 - 03:23 AM

Hello [member=teoj] and welcome to the forums.

You wrote "im trying do works imagecrud and grocery crud" but from your code I only see imagecrud.

Can you please explain what exactly you are trying to do?

I suggest you create a new topic here: /forum/4-bugs-issues/


victor

victor
  • profile picture
  • Member

Posted 30 July 2013 - 21:18 PM

/topic/1912-updated-30072013-multiple-uploading/

it's not image crud, but it's an example how to make this functionality. 

maybe it's difficult a bit...


Pedro Bernal

Pedro Bernal
  • profile picture
  • Member

Posted 24 January 2014 - 14:29 PM

Hi there I already could implement the davidoster code, and with some modifications in the core I can have two or more images related to the same element, however I have a problem with the reading, I can edit easily but when I am  going to read I got an error, can someone help me with it, because in the davidoster example the read option is disabled and I cant figure it out.

 

Thanks.

 

 

Errors when I click the read option in the list:

 

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: controllers/site.php

Line Number: 126

 

A PHP Error was encountered

Severity: Warning

Message: array_merge(): Argument #2 is not an array

Filename: controllers/site.php

Line Number: 126

 

A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: views/gc_example.php

Line Number: 6

 

 controllers/site.php Code:

 
 function hvf()
	{
		$this->g_crud->set_table('hojasvida');
		//$this->g_crud->set_field_upload2('url','assets/uploads');
		$this->g_crud->set_field_upload('imagen1','assets/uploads');
		$this->g_crud->unset_export();
		$this->g_crud->unset_print();
		$this->g_i_crud->unset_upload();
		$this->g_i_crud->unset_delete();
		$this->g_i_crud->set_primary_key_field('sitio');
		//$this->g_i_crud->set_url_field2('url');
		$this->g_i_crud->set_url_field('imagen1');
		$this->g_i_crud->set_table('hojasvida')
		//->set_relation_field('category_id')
		->set_image_path('assets/uploads');
		
		$output = $this->g_crud->render();
		$output2 = $this->g_i_crud->render();
		
		//$output3 = (object)array('output' => $output->output . $output2->output, 'css_files' => array_merge($output->css_files,$output2->css_files), array_merge($output->js_files,$output2->js_files));
		//$this->_gc_output($output3);
		
		$state = $this->g_crud->getState();
		$state_info = $this->g_crud->getStateInfo();
		$t_output = '';
		switch($state)
		{
			case 'add':
			case 'update':
			case 'insert':
			case 'upload':
			case 'upload_file':
			case 'delete':
			case 'delete_file':
			case 'success':
				// use an if($this->ion_auth->is_admin()) for proper user rights
				$t_output = $output;
				break;
			case 'edit':
				$primary_key = $state_info->primary_key;
				// use an if($this->ion_auth->is_admin()) for proper user rights
				$t_output = $output;
				break;
			case 'list':
			default:
				$t_output = (object)array('output' => $output->output . $output2->output, 'js_files' => array_merge($output->js_files,$output2->js_files), 'css_files' => array_merge($output->css_files,$output2->css_files));
				break;
		}
		$this->_gc_output($t_output);
	}

 views/gc_example.php Code:

 
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
<?php 
foreach($css_files as $file): ?>
	<link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
<?php endforeach; ?>
<?php foreach($js_files as $file): ?>
	<script src="<?php echo $file; ?>"></script>
<?php endforeach; ?>
<style type='text/css'>
body
{
	font-family: Arial;
	font-size: 14px;
}
a {
    color: blue;
    text-decoration: none;
    font-size: 14px;
}
a:hover
{
	text-decoration: underline;
}
</style>
</head>

cybersven

cybersven
  • profile picture
  • Member

Posted 27 March 2017 - 12:36 PM

All the links are dead, someone got the files or can explain how to do it ?