lundi 20 octobre 2008

native sfPJS plugin in symfony 1.1

SfPJSPlugin is native in symfony 1.1, but documentation lacks.

Just use it by adding a template file of your module/yourAction named
yourActionSuccess.js.php
The content of this file -once rendered by php- has to be javascript.

example:


$(document).observe('dom:loaded', function() {
<?php include_partial('contact/init') ?>
EM = new EuroMineral.contact();
});


As you can see, you have access to php for generating JS...

To include this javascript in your response, use :
<?php use_dynamic_javascript('inscrit_demande/initBatiCodeList'); ?>

in your templates.

It just gives you the power of MVC separation and partials, components rendering in your js files.

vendredi 17 octobre 2008

add select column on manual join with Propel


$c = new Criteria;
$c->addJoin(InscritLignePeer::CAT, CategorieTarifPeer::CODE, Criteria::LEFT_JOIN);
InscritLignePeer::addSelectColumns($c);
$c->addSelectColumn(CategorieTarifPeer::LIBELLE);
$c->addAscendingOrderByColumn(InscritLignePeer::CAT);

$rs = InscritLignePeer::doSelectRS($c);

$this->inscrit_ligneList = array();
while ($rs->next())
{
$inscrit_ligne = new InscritLigne;
$colNum = $inscrit_ligne->hydrate($rs);
$inscrit_ligne->setCatLibelle($rs->getString($colNum));

$this->inscrit_ligneList[] = $inscrit_ligne;
}


and in your object class :


public function setCatLibelle($catLibelle='') {
$this->catLibelle = $catLibelle;
}

public function getCatLibelle() {
return $this->catLibelle;
}

mercredi 15 octobre 2008

Handle culture in symfony's routing



homepage:
url: /:sf_culture
requirements: { sf_culture: (?:fr|en|de) }
param: { module: dashboard, action: index, sf_culture: fr }

default_index:
url: /:sf_culture/:module
requirements: { sf_culture: (?:fr|en|de) }
param: { action: index }

default:
url: /:sf_culture/:module/:action/*
requirements: { sf_culture: (?:fr|en|de) }

lundi 13 octobre 2008



// when ajax working :
function() {
document.body.style.cursor = 'progress';
}

dimanche 12 octobre 2008

Lac du ballon

Par une belle après-midi d'automne,
on s'en est allé promener, à la recherche du bonheur, que je pense, nous avons éffleuré...

jeudi 2 octobre 2008

Sum method for Propel


public function getCumulDebit() {
$c = new Criteria;
$c->clearSelectColumns();
$c->addSelectColumn('SUM(' . EcriturePeer::MONTANT . ') AS total');
$c->add(EcriturePeer::NO_ADHERENT, $this->getNoEntreprise());
$c->add(EcriturePeer::CODE_DEBIT_CREDIT,'D');
$rs = EcriturePeer::doSelectRS($c);
$rs->next();
return $rs->getInt(1);
}