Jump to content


h4kl0rd

Member Since 30 Sep 2013
Offline Last Active Oct 22 2013 09:47 PM
-----

Posts I've Made

In Topic: How to insert in 2 tables at the same time

10 October 2013 - 09:47 AM

Hey @web-johnny, wanted to know the progress on the integration of set_relation_1_1 for the new release.

I'm currently using the latest release of Grocery CRUD (version 1.4.1).

 

So, I'm working on a project that includes Sales Module, the user enters sales details and after the sales have been saved it has to automatically calculate if there was profit or loss. If profit enters details to Profits Table (has field 'profit_made'), if loss was incurred during the sale, then the record has to be entered to the Loss Table (has field 'loss_incurred').

 

How should I implement this in my project?


In Topic: Using Custom Template

10 October 2013 - 09:19 AM

At last I succeeded in integrating my custom template with Grocery Crud.

 

Here's my implementation:

 

I created a universal view that works for all my output: views >> out.php

In the head of my file, I added the grocery_crud styles and scripts:

<?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; ?>

 

In my Controller, I made the following modifications:

try {
      $crud = new grocery_CRUD();

      $crud->set_theme(...);
      $crud->set_table(...);

      $crud->....

      $output = $crud->render();

      // comment or remove the default grocery_crud output
      //$this->output($output);

      // load your custom view
      $this->load->view('out', $output);
            
 } catch(Exception $e){
      show_error($e->getMessage().' --- '.$e->getTraceAsString());
 }

In Topic: Concatenate fields after retrieving them from different tables

02 October 2013 - 07:40 AM

Thanks,

 

I'm working with only two tables (items and item_type).

items has fields item_name and item_type_id.

item_type has field item_type, which stores the name of the item type.

 

I want to retrieve the item_name (from items table) and item_type (from item_type table using the FK item_type_id).


In Topic: Concatenate fields after retrieving them from different tables

01 October 2013 - 09:46 AM

The set_relation code: 

$crud->set_relation('user_id','users','{username} - {last_name} {first_name}');

works only when both fields that are to be retrieved are in the same table.

 

So according to the scenario from my early post, I explained that both values come from different tables.


In Topic: Concatenate fields after retrieving them from different tables

01 October 2013 - 09:11 AM

Thanks @davidoster for the welcome,

I want to view the record list in the dropdown.