Skip to content

Instantly share code, notes, and snippets.

var clickedsectionelement;
function noteDamage(el)
{
var data = $('#damage-form').serializeArray();
data = data.concat({'name':'vehicletypedamageareaid', 'value':el.vehicletypedamageareaid},
{'name':'vehicleid', 'value':<?= $vehicleid?>});
<?php echo CHtml::ajax(array(
'url'=>array('vehicle/DamageForm'),
'data'=> "js:data",
'type'=>'post',
<pre class='xdebug-var-dump' dir='ltr'>
<b>array</b> <i>(size=3)</i>
'VehicleDamageMap' <font color='#888a85'>=&gt;</font>
<b>array</b> <i>(size=10)</i>
'damage_dent' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'1'</font> <i>(length=1)</i>
'damage_signsofspray' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'1'</font> <i>(length=1)</i>
'damage_scratch' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'0'</font> <i>(length=1)</i>
'damage_rust' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'0'</font> <i>(length=1)</i>
'damage_chip' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'0'</font> <i>(length=1)</i>
'damage_prev_repairs_noted' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'0'</font> <i>(length=1)</i>
var myvar;
function doDamage(element)
{
console.log("TYPE:"+typeof element);
myvar = element;
vehicletypesideareaid = myvar.vehicletypesideareaid;
var url = '<?php echo Yii::app()->createUrl("vehicle/DamageForm"); ?>' + '&vehicleid=<?php echo $vehicleid?>&vehicletypesideareaid='+vehicletypesideareaid;
<?php echo CHtml::ajax(array(
'url'=>'js:url',
'data'=> "js:$(this).serialize()",
public function actionDamageForm($vehicleid,$vehicletypesideareaid) {
$model= VehicleDamageMap::model()->find('vehicleid = :vehicleid and vehicletypedamageareaid = :vehicletypedamageareaid',
array('vehicleid'=>$vehicleid,'vehicletypedamageareaid'=>$vehicletypesideareaid)
);
if(count($model) == 0) {
$model= new VehicleDamageMap;
}
if(isset($_POST['VehicleDamageMap'])) {
$_POST['VehicleDamageMap']['datecreated'] = new CDbExpression('NOW()');
$criteria->select = 'concat("'.mysql_real_escape_string($V[0]).'|", make) as v, make as d';
@jackkitley
jackkitley / gist:5161568
Last active December 14, 2015 22:49
Please help.
$user=$this->loadModel($id); - Gets this Fine
$userperson = $user->person; - Gets this Fine
$personcontactmap = $userperson->personcontactmaps; - Gets this Fine
$contact = $personcontactmap->contact; - Fails to get this data even though there is a contactid....
var_dump($contact);
exit;
@jackkitley
jackkitley / gist:5097592
Created March 6, 2013 08:18
What am i doing wrong?
if(!empty($_POST)) {
$datenow = new CDbExpression('NOW()');
$systemaccountmodel->attributes=array('datecreated'=>$datenow,'createdbyuserid'=>0);
$systemaccountmodel->save();
$systemaccountid = Yii::app()->db->getLastInsertId();
$_POST["Person"][1]['systemaccountid'] = $systemaccountid;
$_POST["Person"][1]['datecreated'] = $datenow;
$_POST["Person"][1]['createdbyuserid'] = 0;
@jackkitley
jackkitley / gist:4706392
Created February 4, 2013 12:10
Router transition problemo....
{{#linkTo catalogue.item item}
App.Router.map(function() {
this.resource('catalogue', function() {
this.route('index');
this.route('search', { path: ':searchvalue' });
this.route('item', {path: '/view/:itemguid'});
});
});
//Catalogue
// catalogue: Em.Route.extend({
// route: '/catalogue',
// index: Ember.Route.extend({
// route: '/',
// connectOutlets: function (router,searchvalue) {
// router.get('applicationController').connectOutlet('catalogue');
// router.get('catalogueController').connectOutlet('cataloguelist','cataloguelist');
// router.get('catalogueController').connectOutlet('cataloguegroupfilter','cataloguegroups');
// router.get('catalogueController').connectOutlet('catalogueattributefilter','catalogueattributes');
@jackkitley
jackkitley / gist:4690213
Last active December 12, 2015 01:18
Route
//This isnt going to /search/all/
this.get("target").transitionTo("search.searchcontent",{filter: filter, searchvalue: searchstring});
this.resource('search', function() {
this.resource('searchcontent', { path: ':filter/:searchvalue' });
});
//ERROR