Jump to content


Hemant Randive

Member Since 06 May 2015
Offline Last Active Nov 30 2015 12:43 PM
-----

Topics I've Started

Export option not showing the file while downloding,we have to go to that location wher...

30 November 2015 - 12:43 PM

I am working on one web application. I have used datatable theme of grocery crud. When i export the table in that,its not showing anything getting downloaded. We have to go to that location to open the file. But in flexigrid theme its available,i want that option in datatables theme. 


How to add multiple checkboxes in grocery crud codeigniter and save them

05 September 2015 - 09:23 AM

This is my code,now i can only able to insert single value but i want more than one value to be inserted  
 
public function cms_category_selected() {
        $crud = new grocery_CRUD();
        $crud->set_theme('datatables');
        $crud->set_table('articles');
        $crud->set_subject('Article');
        $crud->display_as('article_id', 'Article ID')
                ->display_as('article_name', 'Article Name')
                ->display_as('article', 'Article')
                ->display_as('category_id', 'Category ID')
                ->display_as('article_image', 'Article Image')
                ->display_as('tags', 'Tags')
 
                ->display_as('created_date', 'Created Date');
        $crud->set_relation('category_id', 'cms_category', 'category_name');
        $crud->set_relation('type_id', 'cms_types', 'type_name');
         
        $crud->callback_edit_field('category_id', array($this, 'edit_category_field'));
        $crud->callback_add_field('category_id', array($this, 'edit_category_field'));
        $crud->callback_edit_field('tags', array($this, 'edit_tags_field'));
        $crud->callback_add_field('tags', array($this, 'edit_tags_field'));
 
        $crud->columns('article_id', 'article_name', 'category_id', 'type_id', 'created_date', 'tags','article_image');
        $crud->required_fields('article_name', 'article', 'category_id', 'type_id');
        $crud->set_field_upload('article_image', 'assets/uploads/articleImages');
            // $crud->callback_after_upload(array($this,'example_callback_after_upload'));
     
        $crud->fields('article_name', 'article', 'type_id', 'tags','article_image');
        $output = $crud->render();
        $this->_example_output($output);
    }
    
    public function wellness_cms_category_selected()
    {
        $crud = new grocery_CRUD();
        $crud->set_theme('datatables');
        $crud->set_table('articles');
        $crud->set_subject('Article');
        $crud->display_as('article_id', 'Article ID')
                ->display_as('article_name', 'Article Name')
                ->display_as('article', 'Article')
                ->display_as('category_id', 'Category ID')
                ->display_as('article_image', 'Article Image')
                ->display_as('tags', 'Tags')
 
                ->display_as('created_date', 'Created Date');
        $crud->set_relation('category_id', 'cms_category', 'category_name');
        $crud->set_relation('type_id', 'cms_types', 'type_name');
         
        $crud->callback_edit_field('category_id', array($this, 'edit_category_field'));
        $crud->callback_add_field('category_id', array($this, 'edit_category_field'));
        $crud->callback_edit_field('tags', array($this, 'edit_tags_field'));
        $crud->callback_add_field('tags', array($this, 'edit_tags_field'));
 
        $crud->columns('article_id', 'article_name', 'category_id', 'type_id', 'created_date', 'tags','article_image');
        $crud->required_fields('article_name', 'article', 'category_id', 'type_id');
        $crud->set_field_upload('article_image', 'assets/uploads/articleImages');
            // $crud->callback_after_upload(array($this,'example_callback_after_upload'));
     
        $crud->fields('article_name', 'article', 'type_id', 'tags','article_image');
        $output = $crud->render();
        $this->_example_output($output);
    }
 
 
 function edit_tags_field() {
  return  ' <input type="checkbox" name="tags" value="male" /> Male
  <input type="checkbox" name="tags" value="female" /> Female';
        
    }

 


grocery crud query

30 June 2015 - 11:54 AM

i have code like this i want to select only those records who have todays appointment

 

    public function display_appointment() {
 
        $crud = new grocery_CRUD();
      $crud->set_model('custom_query_model');
        $crud->set_theme('datatables');
   
        $crud->set_table('appointment_details');
       
       $crud->custom_query_model->get_list("SELECT * FROM  appointment_details WHERE date= CURDATE()");
    
        $crud->set_subject('appointment details ');
         $crud->columns('client id','Datetime');
        $crud->display_as('name', 'Name')
                ->display_as('date', 'Date')
                ->display_as('start_time', 'Start Time')
                ->display_as('end_time', 'End Time')
                ->display_as('room_type', 'Room Type')
                ->display_as('mobile', 'Mobile Number');
        $crud->columns('name', 'room_type', 'mobile', 'start_time', 'end_time', 'date');
        $crud->callback_column('start_time',array($this,'format_time'));
        $crud->callback_column('end_time',array($this,'format_time'));
        $crud->order_by('date', 'desc');
        //$crud->order_by('room_type','asc');
        $crud->columns('name','room_type','mobile','date','start_time','end_time');
 
 
        $crud->add_action('create profile', '', 'user/create_client', '', '');
 
        $crud->unset_print();
        $crud->unset_add();
        $outputAppoint = $crud->render();
 
        $this->_example($outputAppoint, (object) array('output' => '', 'js_files' => array(), 'css_files' => array()));
    }
 
 
and my custom model is
 
 
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
class Custom_query_model extends grocery_CRUD_model {
 
private  $query_str = ''; 
function __construct() {
 
parent::__construct();
}
 
function get_list() {
$query=$this->db->query($this->query_str);
 
$results_array=$query->result();
return $results_array;
}
 
public function set_query_str($query_str) {
echo"its working";
$this->query_str = $query_str;
}
}
  

i cant get it done.please help me