EzDevInfo.com

atk4

Agile Toolkit is a PHP framework for developing Powerful Web Applications. Inspired by Desktop Toolkits (QT, Cocoa, .NET) it provides clever web application framework for developers with any skill level. Agile Toolkit free for open-source projects and has commercial support. Agile Toolkit - PHP based cloud-platform for developers

Create REST API in ATK4?

Just started fumbling with ATK4. I'd like to use it both as a backend API (if possible) as well as to create a small CMS based on the same data the API will work with. The API will be accessed by browser plugins so no rendering will be done by ATK4.

So basically my question is, does ATK4 come with support for creating your own REST API or would I basically have to create this functionality myself? I've found the API docs but they seem focused on making API methods in service of the rendering "engine".

In case I should make this myself, what's the best way of implementing this on ATK4? (in terms of future compatibility).

Thanks


Source: (StackOverflow)

how do i access the session variables in the pages

how do i access the session variables in the pages in agile toolkit. i am using $this->getUser() but it is not working


Source: (StackOverflow)

Advertisements

Adding custom meta

How can I add custom tags (for SEO) in Agile Toolkit (atk4)?


Source: (StackOverflow)

need simple examples for hasone and hasmany usage [closed]

I have watched the movies and read the documents but I can't understand the usage of hasone and hasmany in agile toolkit! can anybody give me some simple examples for these?

Thanks.


Source: (StackOverflow)

Agile Toolkit (ATK4) documentation or tutorial to create a membership site?

I'd like to get started with testing the ATK4 (Agile Toolkit - http://agiletoolkit.org/). Does anyone have any suggestion regarding where to find a tutorial for using ATK4 with:

  • Template development
  • User management
  • Registration, login, and other account management features

I see potential in the ATK4, but documentation is hard to find, since it's new.


Source: (StackOverflow)

Reasons to NOT use a PHP Framework? [closed]

I have always developed web software using a framework (Agile Toolkit) and it was helpful to me in all situations, but one question always concerned me:

In which circumstances it's NOT advisable to use a framework?

So a question to other veteran framework developers - when would you code in a raw good PHP instead of your framework of choice?


Source: (StackOverflow)

Recurring Billing Database Design [closed]

I'm writing an application that will involve recurring billing of a monthly (or weekly) fixed amount, and it can last until subscription is canceled. The customer can pay several periods in advance. He can cancel subscription, and then come back after certain unpaid periods. I need the sistem to let me know when a period is past due.

So I'm burning my brain on how to design the database (maybe is not a database issue but a programming one),

Has any one come to this kind of applications? what approach has been taken?


Source: (StackOverflow)

Recursive tree rendering with Agile Toolkit

I have a following situation. I have a Model A with following properties: id int name varchar(255) parent_id int (references same Model A).

Now, I need to render Tree View using that ModelA. Of course, I could just load all data, sort it properly by parent_id and "render it" using traditional string sticking. e.g.

class Model_A extends Model_Table {
...

function render_branch($nodes, $parent){
    if (!isset($nodes[$parent])){
        return null;
    }
    $out = "<ul>";
    foreach ($nodes[$parent] as $node){
        $out .= "<li>" . $node["name"];
        $out .= $this->render_branch($nodes, $node["id"]);
        $out .= "</li>";
    }
    return $out;
}

function init(){
    parent::init();
    $nodes = array(); // preload from db and arrange so that key = parent and content is array of childs
    $this->template->set("tree", $this->render_branch($nodes, 0));
}

}

now, I would instead like to use atk4 native lister/smlite template parser for the purpose. but, if you try to do that, then you would end up with nasty lister, where in format row, you would anyway try to substitute the specific tag with output from other lister which in fact you would have to destruct to void runtime memory overflows.

any suggestions?

p.s. code above is not tested, just shows concept

thanks!


Source: (StackOverflow)

Agile Toolkit, worth using?

I'm considering using the Agile Toolkit, ATK4 to upgrade a number of web projects that I'm working on. I really like the idea/paradigm that the Agile Toolkit presents, but I'm worried about documentation.

The agile website's documentation is sparse, in broken English, and seems to 'paraphrase' the symfony documentation.

The agile toolkit alleges to have been in development/production since 1999, yet there are only a handful of StackOverflow.com posts regarding agile, and next to nothing comes up in Google searches...

In short is it worth spending time learning the Agile toolkit, or would my time be better spent on a framework that has more of an active support community? I've tried a few other frameworks, but ATK's implementation really stands out...


Source: (StackOverflow)

ATK4 Form datePicker - default state is 'opened', can this be changed?

I'm using the following form, and everytime the page opens (it's in an expander on a grid) the datePicker is 'open', obscuring part of the text above it.

function page_del() {
    $billingid  = $_GET['id'];
    $now        = date("Y-m-d H:i:s"); 

    $q = $this->api->db->dsql()
        ->table('billing')
        ->where('id', $billingid)
        ->field('enddate')
        ->getOne();

    if (!$q) {
        $this->add('H5')->set('Are you sure you want to stop billing this item?');
        $form = $this->add('Form');
        $form->addField('hidden','billingid')->set($billingid);
        $form->addField('datePicker','datum')->set($now);
        $form->addSubmit('Confirm');

        if ($form->isSubmitted()) {
            $form->stopBilling('manual', $form, $now);              
            $this->js()->univ()->getjQuery()->trigger('reload_grid')->execute(); 
        }
    } else {
            $this->add('H5')->set('This product has already been stopped, effective date: ' .$q);
            }
        }
}

I have other forms elsewhere that also have a datePicker as their first (visible) field that do not display this behaviour. I only mention it because it looks like a 'focus' issue? I.e. the first field gets focus?

Any thoughts on what causes this or how it can be remedied?


Source: (StackOverflow)

How to perform multiple js actions from one button in atk4

--EDIT: This is now SOLVED.

I want one button to do multiple js commands, e.g.

$nextButton = $form->addButton('Next');

to do:

$button_repopulate_address->js(true)->show()
$street->js(true)->closest('fieldset')->show()

when:

$nextButton->isClicked()

The example code here suggests that you nest the commands in the 2nd paramater of the js call like this:

$g->addButton('Show all buttons')->js('click',$b1->js(null,$b2->js(null,$b3->js()->show())->show())->show());

I think this is very ugly and will create code that is very difficult to follow for more than 2 commands.

I looked in the source and found the _prepend command, which I've used to solved my problem by doing this:

if($nextButton->isClicked()){
      $form->js()->_prepend($street->js(true)->closest('fieldset')->show())
                 ->_prepend($button_repopulate_address->js(true)->show())
              ->execute();
}

EDIT: I just looked at the source of js() and it appears that you can pass an array to js which calls the _prepend method for each item in the array - nice!:

$form->js(null, array(
     $street->js(true)->closest('fieldset')->show(),
     $button_repopulate_address->js(true)->show()
));

--SOLVED (but perhaps the example I linked to could be updated with this much better functionality)


Source: (StackOverflow)

atk4 advanced crud?

I have the following tables:

-- -----------------------------------------------------

-- Table `product`

-- -----------------------------------------------------

CREATE  TABLE IF NOT EXISTS `product` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `productName` VARCHAR(255) NULL ,
  `s7location` VARCHAR(255) NULL ,
  PRIMARY KEY (`id`) )
ENGINE = InnoDB;


-- -----------------------------------------------------

-- Table `pages`

-- -----------------------------------------------------

CREATE  TABLE IF NOT EXISTS `pages` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `productID` INT NULL ,
  `pageName` VARCHAR(255) NOT NULL ,
  `isBlank` TINYINT(1) NULL ,
  `pageOrder` INT(11) NULL ,
  `s7page` INT(11) NULL ,
  PRIMARY KEY (`id`) ,
  INDEX `productID` (`productID` ASC) ,
  CONSTRAINT `productID`
    FOREIGN KEY (`productID` )
    REFERENCES `product` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------

-- Table `field`

-- -----------------------------------------------------

CREATE  TABLE IF NOT EXISTS `field` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `pagesID` INT NULL ,
  `fieldName` VARCHAR(255) NOT NULL ,
  `fieldType` VARCHAR(255) NOT NULL ,
  `fieldDefaultValue` VARCHAR(255) NULL ,
  PRIMARY KEY (`id`) ,
  INDEX `id` (`pagesID` ASC) ,
  CONSTRAINT `pagesID`
    FOREIGN KEY (`pagesID` )
    REFERENCES `pages` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;

I have gotten CRUD to work on the 'product' table.

//addproduct.php
class page_addproduct extends Page {
    function init(){
        parent::init();

        $crud=$this->add('CRUD')->setModel('Product');

    }
}

This works. but I need to get it so that when a new product is created it basically allows me to add new rows into the pages and field tables.

For example, the products in the tables are a print product(like a greeting card) that has multiple pages to render. Page 1 may have 2 text fields that can be customized, page 2 may have 3 text fields, a slider to define text size, and a drop down list to pick a color, and page 3 may have five text fields that can all be customized. All three pages (and all form elements, 12 in this example) are associated with 1 product.

So when I create the product, could i add a button to create a page for that product, then within the page i can add a button to add a new form element field?

I'm still somewhat new to this, so my db structure may not be ideal. i'd appreciate any suggestions and feedback! Could someone point me toward some information, tutorials, documentation, ideas, suggestions, on how I can implement this?


Source: (StackOverflow)

Form with two tables as source

I have two tables master and detail.

When I add a new record to master, after that I need to add records to the detail table.

Is it possible to have a form with tow "setSource()" methods ? Or do I have to make first one form, and then add a second with the ID of the first as parameter ??

Which can be the best approach ?

Thanks


Source: (StackOverflow)

MVCForm Agile Toolkit Form Update Record ID must be specified

hopefully simple questions regarding Agle Toolkit. Currently with the below code getting

Error in AJAX response: SyntaxError: Unexpected token <

BaseException

Record ID must be specified, otherwise use loadAny()

page\grant.php

<?php
class page_grant extends Page {
    function init(){
        parent::init();

        $saveForm=$this->add('MVCForm');
        $model=$this->add('Model_Grant')->load($_GET['id']);
        $saveForm->setModel($model);

        $saveForm->addSubmit();

        $saveForm->onSubmit(function($saveForm){
            $saveForm->update()->js()->univ()->successMessage('Grant info saved.')->execute();
        });
    }
}

And Model_Grant:

<?php

class Model_Grant extends Model_Table {
    public $table='minigrant';

    function init() {
        parent::init();
        $this->addField('grant_number');
        $this->addField('grant_name');
        $this->addField('uid');
    }
}

Data is loaded fine but cannot save it back as per above error message.


Source: (StackOverflow)

hasOne filtered by value of previous hasOne?

In a 'Jobs' table / model, I have two fields using 'hasOne' to pull descriptions from Companies and People tables:

$this->hasOne('Companies','companies_id','CompanyName')->caption('Company')
   ->display(array('form'=>'autocomplete/Basic'));
$this->hasOne('People','people_id','DisplayedName')->caption('Contact');

My goal is to use the choice made for Companies to filter People to that list who are associated with companies_id. Both Jobs and People have companies_id which would match 'id' in the Companies table.

How best to apply the equivalent filter (for the second item - the Contact) which is equivalent to 'WHERE People.companies_id = Jobs.companies_id'? Is there a form of addCondition to accomplish this?

Thanks,

Mark


Source: (StackOverflow)