Welcome Guest, Not a member yet? Register   Sign In
CodeExtinguisher (Formerly jTaby) version 1.4 Released!
#11

[eluser]Majd Taby[/eluser]
Yes Thoer, thanks for bringing that up, I forgot to bring it up in the main post, will edit Smile
#12

[eluser]Majd Taby[/eluser]
Hey guys, just wanted everyone to know the new site is up, first post is updated, here's a link for your convenience http://codeextinguisher.com/

Thanks a lot to CI_Lee for the free hosting.
#13

[eluser]Majd Taby[/eluser]
Adding support for table relations

Hey everyone, I was talking with Thoer about adding table relations to Codex and here's the idea we came up with:

Add a table_relations.php file that specifies the relationships between the tables. Then whenever codex executes an insert/update/delete, it will look for rules in table_relations.php and run accordingly. We haven't drafted a sample of what the rules would look like, but I'm thinking something along these lines:

Code:
// The following line would read: relate entry to users through `user_id`
$relate['entry'] = array('users'=>'user_id');

That would mean that all the entries would be related to some user in the users table, reference by entry.user_id.

I'd like to know what everyone thinks of this approach, do you have any better ideas?

EDIT: by the way, I just stumbled on this: http://codeigniter.com/wiki/ActiveRecord_Class/ , seems useful.
#14

[eluser]Majd Taby[/eluser]
Hey guys, just wanted to give you a heads up, I have put up a live demo of Codex up, please check it out at http://codeextinguisher.com/demo.php
I will soon be releasing the code of the website to the public, so that people have an idea of how to setup a website like that.

Happy Extinguishing Smile
#15

[eluser]12vunion[/eluser]
I really like the idea of CodeExtingusher, but let me ask you this. What do you do when your inserts use more than one table and need to make fields dynamically?

Say you have a recipe. So there's a recipe table. Each recipe could have any amount of ingredients and steps involved in it. So there would be related ingredients and steps tables.

Using CodeExtingusher and its YAML, how do you accomplish this dynamically? I mean dynamically as in editing one form that allows you to add new ingredients or pull already entered ones from the DB. Rather than having a seperate form where you have to enter a new ingredient each time before you can start a recipe.

I'm not trying to give you a hard time. I'm genuinely curious if CodeExtingusher can handle a common problem like that. If so, then I'll jump on board.
#16

[eluser]Majd Taby[/eluser]
Read post number 12 Smile
I am working on that right now. The way I can see of handling this is by adding a table_relations.php file which will notify the system when it's inserting/updating/deleting so that the data will always maintain its integrity.
#17

[eluser]Majd Taby[/eluser]
The code is up at http://jtaby.com:83 . You can browse the source and submit tickets. Enjoy !
#18

[eluser]Late Night Again[/eluser]
This addition looks fantastic, although I am trying to create my own controller with YAML but receiving errors everywhere on the page like so

Code:
A PHP Error was encountered

Severity: Notice

Message: Uninitialized string offset: 0

Filename: libraries/jtabyadmin.php

Line Number: 40

Is this something I am doing wrong or am I missing a value somewhere my controller is as follows

Code:
<?php
include("jtabycontroller.php");

class Webinar extends jTabyController {
    function Webinar() {
        jTabyController::jTabyController();
        $this->load->library('spyc');                
        $this->load->helper('inflector');
        
        $config = array(
                'db_table' => 'webinar',
                'form_setup' => $this->spyc->YAMLLOAD('definitions/webinar_form.yml'),
                'controller_name'=>'Webinar',
                'list_header'=>'Webinar',
                'list_text' => array('active','expire'),
            );
        $this->setConfig($config);
    }
}

?>

Code:
created_by:
    class:SessionData
    params:
        item:user_id
created_at:
    class:Time
    params:
        -on_insert
updated_at:    
    class:Time
    params:
        -on_update
name:
    class:TextBox
description:
    class:TextArea
    attributes:
        cols:50
        rows:50
activate:
    class:Date
expire:
    class:Date    
active:
    class:DropDown
    params:
        list:
            Yes:Yes
            No:No
        value:Yes

obviously the database is there and so are the fields
#19

[eluser]Majd Taby[/eluser]
well, line 40 of jtabyadmin.php is $this->field_list[$name] = $params['class']; The error indicates that your form_setup isn't valid.

The first thing I recommend you do is add this line somewhere in your constructor:

Code:
echo "<pre>"; print_r($this->spyc->YAMLLOAD('definitions/webinar_form.yml')); echo "</pre>";

That should tell you if the form is loaded or not.

The only syntatical error I see in your code is:
Code:
active:
    class:DropDown
    params:
        list:
            Yes:Yes
            No:No
        value:Yes

Should be:
Code:
active:
    class:DropDown
    params:
        list:
            Yes:Yes
            No:No
    value:Yes

YAML is white-space-sensitive which means it divides the file into an array based on your indentation.

Please let me know the output of the print_r call.

EDIT: ok this might seem ridiculous, but try it out, try adding a space between class: and the name of the class. So, class: TextBox instead of class:TextBox.

I think that's screwing up spyc.

p.s. Just for reference, you don't need to define list_header if it's the same as your controller_name. It will automatically fall back onto the constructor_name if list_header is missing.
#20

[eluser]Late Night Again[/eluser]
Error is definately in the area you are stating because for some reason it puts the dropdown as the first class.
Code:
Array
(
    [created_by] =>
    [class] => DropDown
    [params] =>
    [item] => user_id
    [created_at] =>
    [0] => on_insert
    [updated_at] =>
    [1] => on_update
    [name] =>
    [description] =>
    [attributes] =>
    [cols] => 50
    [rows] => 50
    [activate] =>
    [expire] =>
    [active] =>
    [list] =>
    [Yes] => 1
    [No] =>
    [value] => 1
)

The space does not make a difference

actually I do not think it is reading the file correctly because this is all put into one array instead of seperating into multiple arrays.

It also has these error down at the very bottom

Code:
A PHP Error was encountered

Severity: Notice

Message: Uninitialized string offset: 0

Filename: libraries/jtabyforms.php

Line Number: 62
Code:
A PHP Error was encountered

Severity: Notice

Message: Uninitialized string offset: 0

Filename: libraries/jtabyforms.php

Line Number: 65




Theme © iAndrew 2016 - Forum software by © MyBB