-bug fix for ajax
-bug fix for select box options
download
Tuesday, July 7, 2009
Monday, July 6, 2009
Wednesday, July 1, 2009
Friday, June 26, 2009
enhanced CI pagination
(For codeigniter v1.7.1)
Additional parameter for pager assign href value and onclick function.
{arg} value will be replace by {paging link tag}.
so that if paging link tag is 20.
ci class will output: href="http://sample/page/20"
this class will output: href="http://sample/page/20" onclick="doSomething('20'); return false;"
[sample]
$pagination_config['base_function_name'] = jhistoryList(\'#list/format/html/begin/{arg}\')';
$pagination_config['replace_href_content'] = current_url().'#list/format/html/begin/{arg}';
$this->pagination->initialize($pagination_config);
Download
Additional parameter for pager assign href value and onclick function.
{arg} value will be replace by {paging link tag}.
so that if paging link tag is 20.
ci class will output: href="http://sample/page/20"
this class will output: href="http://sample/page/20" onclick="doSomething('20'); return false;"
[sample]
$pagination_config['base_function_name'] = jhistoryList(\'#list/format/html/begin/{arg}\')';
$pagination_config['replace_href_content'] = current_url().'#list/format/html/begin/{arg}';
$this->pagination->initialize($pagination_config);
Download
multilingual supported CI Calendar
(For codeigniter v1.7.1)
Additional parameter for translate calendar's day names and month names.
[sample]
$prefs['translated_day_names'] = array('日', '一', '二', '三', '四', '五', '六');
$prefs['translated_month_names'] = array('01' => '一月', '02' => '二月', '03' => '三月', '04' => '四月', '05' => '五月', '06' => '六月', '07' => '七月', '08' => '八月', '09' => '九月', '10' => '十月', '11' => '十一月', '12' => '十二月');
一月', '12' => '十二月');
$this->load->library('calendar', $prefs);
Download
Additional parameter for translate calendar's day names and month names.
[sample]
$prefs['translated_day_names'] = array('日', '一', '二', '三', '四', '五', '六');
$prefs['translated_month_names'] = array('01' => '一月', '02' => '二月', '03' => '三月', '04' => '四月', '05' => '五月', '06' => '六月', '07' => '七月', '08' => '八月', '09' => '九月', '10' => '十月', '11' => '十一月', '12' => '十二月');
一月', '12' => '十二月');
$this->load->library('calendar', $prefs);
Download
Sunday, January 18, 2009
codeilo_v1beta
codeilo version 1 beta
after re-engineering whole system, I think codeilo can be publish now.
however, I need somebody help to test it and reply me some comment.
download codeilo_v1beta
[Feature for codeigniter]
For codeigniter it generate below items
- CRUD page controller, model and view
- validator for all field based on field type, null value
- index page filter and pager.
- filter by the value of foreign key table field.
- foreign key selection box
- create language file for all table field's label.
- predefine foreign key's display field name.
- predefine input field code.
after re-engineering whole system, I think codeilo can be publish now.
however, I need somebody help to test it and reply me some comment.
download codeilo_v1beta
[Feature for codeigniter]
For codeigniter it generate below items
- CRUD page controller, model and view
- validator for all field based on field type, null value
- index page filter and pager.
- filter by the value of foreign key table field.
- foreign key selection box
- create language file for all table field's label.
- predefine foreign key's display field name.
- predefine input field code.
Thursday, January 1, 2009
How To "display related table field value on View" - second way
refer to "step by step" post.
post table's "sysuser_id" field is a foreign key, which related to sysuser table.
this post show that how to show sysuser table's name field value on post's show record page.
you have 2 way for get sysuser's name.
1. use sysuser options array.
2. left join table when get the record.
second way:
edit the post controller's show function
remove all code which for create sysuser options array.
// sysuser options array
$this->sysuser_id_options=array();
$this->load->model('sysuser_model');
$records=$this->sysuser_model->get_records();
$sysuser_option=array(''=>'');
foreach($records as $record){
$sysuser_option[$record['id']]=$record['id'];
}
$data['sysuser_options']=$sysuser_option;
then change show function's code
form
$data['m']=$this->post_model->get_record_by_pk($m_id);
to
$this->post_model->set_related_table_field('sysuser','sysuser.name as uname');
$this->post_model->add_where(array('post.id'=>$m_id));
$data['m']=$this->post_model->get_record();
change post's view show.php file.
from
<tr>
<th><?php echo form_label('Sysuser Id:', 'sysuser_id'); ?><th>
<td><?php echo $m['sysuser_id']; ?><td>
</tr>
to
<tr>
<th><?php echo form_label('Sysuser Id:', 'sysuser_id'); ?><th>
<td><?php echo $m['uname']; ?><td>
</tr>
that's all
post table's "sysuser_id" field is a foreign key, which related to sysuser table.
this post show that how to show sysuser table's name field value on post's show record page.
you have 2 way for get sysuser's name.
1. use sysuser options array.
2. left join table when get the record.
second way:
edit the post controller's show function
remove all code which for create sysuser options array.
// sysuser options array
$this->sysuser_id_options=array();
$this->load->model('sysuser_model');
$records=$this->sysuser_model->get_records();
$sysuser_option=array(''=>'');
foreach($records as $record){
$sysuser_option[$record['id']]=$record['id'];
}
$data['sysuser_options']=$sysuser_option;
then change show function's code
form
$data['m']=$this->post_model->get_record_by_pk($m_id);
to
$this->post_model->set_related_table_field('sysuser','sysuser.name as uname');
$this->post_model->add_where(array('post.id'=>$m_id));
$data['m']=$this->post_model->get_record();
change post's view show.php file.
from
<tr>
<th><?php echo form_label('Sysuser Id:', 'sysuser_id'); ?><th>
<td><?php echo $m['sysuser_id']; ?><td>
</tr>
to
<tr>
<th><?php echo form_label('Sysuser Id:', 'sysuser_id'); ?><th>
<td><?php echo $m['uname']; ?><td>
</tr>
that's all
How To "display related table field value on View" - first way
refer to "step by step" post.
post table's "sysuser_id" field is a foreign key, which related to sysuser table.
this post show that how to show sysuser table's name field value on post's show record page.
you have 2 way for get sysuser's name.
1. use sysuser options array.
2. left join table when get the record.
first way:
you can see post controller have " $sysuser_options " assigned to view.
please change post's view show.php file.
from
<tr>
<th><?php echo form_label('Sysuser Id:', 'sysuser_id'); ?><th>
<td><?php echo $m['sysuser_id']; ?><td>
</tr>
to
<tr>
<th><?php echo form_label('Sysuser Id:', 'sysuser_id'); ?><th>
<td><?php echo $sysuser_options[$m['sysuser_id']]; ?><td>
</tr>
than change the controller show function content.
from
// sysuser options array
$this->sysuser_id_options=array();
$this->load->model('sysuser_model');
$records=$this->sysuser_model->get_records();
$sysuser_option=array(''=>'');
foreach($records as $record){
$sysuser_option[$record['id']]=$record['id'];
}
$data['sysuser_options']=$sysuser_option;
to
// sysuser options array
$this->sysuser_id_options=array();
$this->load->model('sysuser_model');
$records=$this->sysuser_model->get_records();
$sysuser_option=array(''=>'');
foreach($records as $record){
$sysuser_option[$record['id']]=$record['name'];
}
$data['sysuser_options']=$sysuser_option;
that's all.
post table's "sysuser_id" field is a foreign key, which related to sysuser table.
this post show that how to show sysuser table's name field value on post's show record page.
you have 2 way for get sysuser's name.
1. use sysuser options array.
2. left join table when get the record.
first way:
you can see post controller have " $sysuser_options " assigned to view.
please change post's view show.php file.
from
<tr>
<th><?php echo form_label('Sysuser Id:', 'sysuser_id'); ?><th>
<td><?php echo $m['sysuser_id']; ?><td>
</tr>
to
<tr>
<th><?php echo form_label('Sysuser Id:', 'sysuser_id'); ?><th>
<td><?php echo $sysuser_options[$m['sysuser_id']]; ?><td>
</tr>
than change the controller show function content.
from
// sysuser options array
$this->sysuser_id_options=array();
$this->load->model('sysuser_model');
$records=$this->sysuser_model->get_records();
$sysuser_option=array(''=>'');
foreach($records as $record){
$sysuser_option[$record['id']]=$record['id'];
}
$data['sysuser_options']=$sysuser_option;
to
// sysuser options array
$this->sysuser_id_options=array();
$this->load->model('sysuser_model');
$records=$this->sysuser_model->get_records();
$sysuser_option=array(''=>'');
foreach($records as $record){
$sysuser_option[$record['id']]=$record['name'];
}
$data['sysuser_options']=$sysuser_option;
that's all.
Subscribe to:
Posts (Atom)