CakePHP HABTM how to save data

[sql] CREATE TABLE IF NOT EXISTS `permissions` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) NOT NULL, `displayName` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) CREATE TABLE IF NOT EXISTS `roles` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(100) NOT NULL, `company_id` int(11) NOT NULL, `dashboard_type` varchar(100) NOT NULL, PRIMARY KEY (`id`), KEY `company_id` (`company_id`) … Read more

ExtJS 4 Loading data into form panel from store/model or via form.load

[code] var contactModel = component.contactDetails; Ext.getCmp(‘EditContact_Form’).getForm().loadRecord( contactModel ); OR var form = this.getWebItemForm().getForm(); var data = this.getStore(‘WebItemsForm’).getAt(0); form.loadRecord(data); OR Ext.getCmp(‘patient-form’).getForm().load({ url:’formdata.php’, params:{moduleId:moduleId,action:’doAction’,activity:’getActivePatient’}, success:function(form,action) { var res = action.result; Ext.getCmp(‘patient_count’).setText(res.data.active_patient_count); }, failure:function(response) { } }); [/code]

sencha loading icon before app startup screen

In the index.html,  add a div in the body: [html] <body> <style type="text/css"> #loading-mask { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: url(resources/img/indicator.gif) no-repeat; text-align: center; } </style> <div id="loading-mask"></div> <script type="text/javascript" src="app.js"></script> [/html]   In app.js, in the launch function, once all the app initialization is finished I remove the … Read more

condition in find function cakephp

How to get data on condition that start time only have current year data: [php] $event = $this->Event->find(‘first’, array( ‘conditions’ => array( ‘Event.id’ => $targetEvent[‘Eventtarget’][‘event_id’], ‘Event.stage’ => ‘created’, ‘year(Event.startTime)’ => date(‘Y’) ), //this is the condition we have to check ‘fields’ => array(‘Event.startTime’, ‘Event.city’, ‘Event.zip’, ‘Event.employee_id’) )); [/php]