Skip to content

Instantly share code, notes, and snippets.

[
{
id : 'root' ,
name : 'root',
someProperty: 'root',
children: [
{
$ref: 'node1',
name: 'node1',
someProperty: 'somePropertyA',
@Kalyse
Kalyse / Zend_Dojo_Form-Bug.php
Created February 8, 2011 12:08
Setting the decorator to ViewHelper on a Zend_Dojo_Form means your CheckBox won't visually show as unchecked.
// Zend_Dojo_Form returned by getForm()
// Having the decorator as "ViewHelper" means you cannot visually display the checkbox as unchecked.
// Does not work
$this->getForm()->addElement(
'CheckBox',
$attraction['id'],
array(
'label' => $attraction['attraction'],
'decorators' => array(
@Kalyse
Kalyse / MapperArray.php
Created February 14, 2011 10:42
Mapper Array
$interested = array(
"activities" => array( "_CLASS" => $entityPath . "PropertyActivityTypes", "_collectionMethod" => "getActivity", "_idMethod" => "getActivityId", "_flatRegistryAccessorMethodSuffix" => "ActivityTypes"),
"attractions" => array( "_CLASS" => $entityPath . "PropertyAttractionTypes", "_collectionMethod" => "getAttraction", "_idMethod" => "getAttractionId", "_flatRegistryAccessorMethodSuffix" => "AttractionTypes"),
"communications" => array( "_CLASS" => $entityPath . "PropertyCommunicationFeatures","_collectionMethod" => "getCommunication", "_idMethod" => "getFeatureId", "_flatRegistryAccessorMethodSuffix" => "CommunicationFeatures"),
"entertainment" => array( "_CLASS" => $entityPath . "PropertyEntertainmentFeatures","_collectionMethod" => "getEntertainment", "_idMethod" => "getFeatureId", "_flatRegistryAccessorMethodSuffix" => "EntertainmentFeatures"),
"general" => array( "_CLASS" => $entityPath . "PropertyGeneralFeatures", "_collectionMethod"
var layout = [
{
cells: [
{ field: "seasonName", name:"Season Name", datatype:"string", width: "12", editable: true},
{ field: "startDate", name:"Start Date", width:12},
{ field: "endDate", name:"End Date", width:12},
{ field: "weekNight", name:"Week Night", datatype:"float", width: 7},
{ field: "weekendNight", name:"Weekend Night", datatype:"float", width: 7},
{ field: "weekly", name:"Weekly", datatype:"float", width: 7},
@Kalyse
Kalyse / FocusableDijitFormatter.js
Created April 13, 2011 12:03
Allow a dijit to be focusable in a Textbox. (Yes I know that dijit.grid.cells._Widget and _Base exists exactly for this purpose, but I wanted to do it without doing that).
formatCurrency: function(value, idx){
if(!this._widgets[idx]){
this._widgets[idx] = new dijit.form.TextBox(
{ value: value,
constraints: {pattern:"#,###,###.00"}
});
this._widgets[idx]._connection = dojo.connect(this._widgets[idx], "onFocus", function(e,f,g){
setTimeout(dojo.hitch(this,function(){
dojo.disconnect(this._connection);
dojox.grid.util.fire(this,"focus");
@Kalyse
Kalyse / NumberTextBox.js
Created April 13, 2011 15:08
Allow NumberTextBox to accept focus on a Enhanced Data Grid
formatCurrency: function(value, idx,e){
if(!this._widgets[e.field][idx]){
this._widgets[e.field][idx] = new dijit.form.NumberTextBox(
{ value: value,
'class': 'ratesNumber',
constraints: {pattern:"#,###,###.00"
}
});
@Kalyse
Kalyse / RowPositionChange.js
Created May 11, 2011 08:23
RowPositionChange
dojo.provide("discovery.grid.enhanced.plugins.RowPositionChange");
dojo.require("dojox.grid.enhanced._Plugin");
dojo.declare("discovery.grid.enhanced.plugins.RowPositionChange", dojox.grid.enhanced._Plugin, {
name: "rowPositionChange",
constructor: function(grid, args){
this.grid = grid;
this._mixinGrid();
var layout = this.grid.layout;
@Kalyse
Kalyse / ClassCounter.php
Created July 22, 2011 19:02
ClassCounter
<?php
// The ViewHelper
class My_View_Helper_ClassCounter extends Zend_View_Helper_Abstract
{
protected $_registry;
public function __construct()
{
$this->_registry = My_View_Helper_ClassCounter_Registry::getRegistry();
@Kalyse
Kalyse / MyViewHelperFuzzyDate.php
Created September 20, 2011 11:12
My_View_Helper_FuzzyDate
<?php
class My_View_Helper_FuzzyDate extends Zend_View_Helper_Abstract {
public function __construct() {
}
public function fuzzyDate($dateFrom, $dateTo) {
@Kalyse
Kalyse / my_diskit_Social.js
Created March 7, 2012 21:35
Lazy Loading Social Buttons
require([
"dojo/_base/declare", "dojo/dom-construct", "dojo/parser", "dojo/ready",
"dijit/_WidgetBase", "dijit/_TemplatedMixin", "dijit/_CssStateMixin"
], function(declare, domConstruct, parser, ready,_WidgetBase, _TemplatedMixin, _CssStateMixin){
declare("my.diskit.Social", [_WidgetBase, _TemplatedMixin, _CssStateMixin], {
// counter
baseClass: 'diskitSocial',
fb : {
dataLayout : "button_count",
dataSend: false,