Skip to content

Instantly share code, notes, and snippets.

🚴‍♂️
Focusing

Romans Malinovskis romaninsh

🚴‍♂️
Focusing
View GitHub Profile
@romaninsh
romaninsh / atk-demo-1.php
Created Nov 1, 2010
Simple Grid on Agile Toolkit , PHP5
View atk-demo-1.php
<?php
$g=$p->add('Grid');
// All the new views or objects needs to be added. When you do that - new object becomes child. This determines location where it appears on the page.
// For example $p is the "Demo" tab. What you add into $p will always be in there.
$g->addColumn('name');
// You can define multiple columns inside grid using addColumn() method. Columns must correspond with the hash keys in the data
View gist:2414116
#!/bin/bash
if [ $# -lt 1 -o $# -gt 4 ]
then
echo "Usage: $0 log_to_be_checked [cc-emails [to-email [subject]]]" >&2
exit 1
fi
LOGFILE="$1"
TSFILE="${LOGFILE}.ts"
View gist:3324732
this.element.find('tbody').selectable({
filter: 'tr',
cancel: '.ui-button,a,:input,option',
stop: function(){ c
hb.stop.apply(chb,[this])
}
}).css({cursor:'crosshair'});
View gist:3361810
$m=$this;
$m->thumb=$m
->leftJoin('filestore_file','filestore_file_id')
->leftJoin('filestore_image.original_file_id',null,'left')
->leftJoin('filestore_file','thumb_file_id','left');
;
$m->vol=$m->thumb->leftJoin('filestore_volume',null,'left');
$m->addExpression('thumb',function($m,$s){
View gist:4126496
class Controller_Element extends Controller {
function addFields($m){
$m->addField('name');
$m->hasOne('Profile','owner_profile_id');
$m->hasOne('User','created_by');
$m->addField('element_type');
$m->addField('descr')->type('text')->caption('Description');
$m->addField('seo_name');
View Form.php
<?php
class Form extends Form_Basic {
public $split_columns=true;
function init(){
parent::init();
$this->setFormClass('stacked atk-row');
}
function recursiveRender(){
if(count($this->elements)>8 && $this->split_columns){
$o=$this->add('Order')
View gist:4724822

Changes 4.2.3 to 4.2.4

Note: for diff see: https://github.com/atk4/atk4/compare/4.2.3...4.2.4

General:

  • Added PSR-2 compliance to many core files. Will continue to improve other classes too.
  • Added composer.json. Agile Toolkit can be installed through Composer now
  • when calling setController, second argument can specify name or default options
  • Security fixes in Logger
View gist:5313222

Pattern Router

A typical Agile Toolkit application converts your URL into a page. For example /mysite/profile?id=123 normally could be implemented like this:

class page_profile extends Page {
     function init(){
         parent::init();
         $this->setModel('User')->load($_GET['id']);
     }
     function defaultTemplate(){
@romaninsh
romaninsh / View_CommentTree.php
Created Apr 8, 2013
Example of hierarchy add-on use in agile toolkit
View View_CommentTree.php
<?php
class View_CommentTree extends hierarchy\View_Tree {
function init(){
parent::init();
$this->time_ctl=$this->add('Controller_RoundTiming');
}
function formatRow(){
$this->current_row['added']=$this->time_ctl->fancy_datetime($this->current_row['added']).' ago';
$this->current_row_html['descr']=nl2br($this->makeUrls($this->current_row['descr']));
$this->current_row_html['profile_link']=
View gist:5444357
RewriteEngine On
RewriteRule ^[^\.]*$ index.php [L]
You can’t perform that action at this time.