Passing record from element to a view using different models

2013-02-22 Thread Victor Musvibe
Hi Bakers

I have an app were users can add their queries(ItQueries/add). When the IT 
department views the query (ItQueries/view/1) they should be able to 
comment/respond to it. What i have done so far is.

In the view of the IT query i have called an element for the IT department 
to add a response. below is how im calling the element

?php echo $this-Element('/ItQueryResponses/add'); ?

On submit of the ItQueryResponses i would like the action to redirect to 
the view page of the ItQueris with its comment underneath it.

Here is my code for my element

?php echo $this-Form-create('ItQueryResponse', array('action' = 
'add')); ?
?php echo __('Add It Query Response'); ?
?php
echo $this-Form-input('it_query_id');
echo $this-Form-input('response');
?
?php echo $this-Form-end(__('Submit')); ?

Here is my add function for the ItQueryResponseController

public function add() {
if ($this-request-is('post')) {
$this-ItQueryResponse-create();
if ($this-ItQueryResponse-save($this-request-data)) {
$this-Session-setFlash(__('The it query response has been saved'));
$this-redirect(array('Controller' = 'ItQueryResponses', 'action' = 
'view'));
} else {
$this-Session-setFlash(__('The it query response could not be saved. 
Please, try again.'));
}
}
}

Here is my code for the ItQueryResponses view

h2?php  echo __('It Query Response'); ?/h2
dl
dt?php echo __('Response'); ?/dt
dd
?php echo h($itQueryResponse['ItQueryResponse']['response']); ?
nbsp;
/dd
dt?php echo __('Created'); ?/dt
dd
?php echo h($itQueryResponse['ItQueryResponse']['created']); ?
nbsp;
/dd
/dl

If anyone can show me how i redirect to the ItQueryResponses view and have 
the ItQueryResponse underneath the view that would be awesome.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: is_file returns false - while the file exists

2013-02-22 Thread Evan Jenkins
Thanks!

I used a slight different version where I first set a variable containing 
the file location info as follows:

?php $filename = APP . '/webroot/files/' . $dance['Dance']['id'] . '.mp4'; 
if (file_exists($filename)) {...

I don't understand exactly what APP means other than that it must be 
somesort of internal CakePHP command to get the first part of the download 
file name, all the way up to the /app folder, and then we can give the rest 
of the information needed to see if the file exists.

On Wednesday, 5 September 2007 02:34:46 UTC-6, Anna P wrote:

 Thank you!
 if(file_exists(IMAGES_DIR. 'upload' . DS . 'filename'))  worked for
 me.
 Thank you once again:-))



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Google Analytics API - gapi plugin

2013-02-22 Thread April DeRossett
Hello!!  I finally figured out how to integrate the GAPI- Google Analytics 
AIP PHP Interface into my cake project...But, it is painfully slow.  Here 
is what I did:
*
File in Vendor directory:*
/app/Vendor/gapi.php

*In my controller:*
App::import('Vendor', 'gapi');
*
In my view:*
?PHP
define('ga_email','april.deross...@email.com');
define('ga_password','');
define('ga_profile_id','999');

$ga = new gapi(ga_email,ga_password);

$ga-requestReportData(ga_profile_id,array('browser','browserVersion'),array('pageviews','visits'));
?
table
tr
  thBrowser amp; Browser Version/th
  thPageviews/th
  thVisits/th
/tr
?php
foreach($ga-getResults() as $result):
?
tr
  td?php echo $result ?/td
  td?php echo $result-getPageviews() ?/td
  td?php echo $result-getVisits() ?/td
/tr
?php
endforeach
?
/table

This returns exactly what I was looking forbut it takes between 60 and 
90 seconds.  Any thoughts or sage wisdom to depart (please?) - I appreciate 
any help.  I have been programming in PHP for a decade, but in cake for 
only about a month.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Google Analytics API - gapi plugin

2013-02-22 Thread Thiago Belem
Did you tried it outside CakePHP?

--
Thiago Belem

Enviado pelo celular
Em 22/02/2013 18:24, April DeRossett april.deross...@gmail.com escreveu:

 Hello!!  I finally figured out how to integrate the GAPI- Google Analytics
 AIP PHP Interface into my cake project...But, it is painfully slow.  Here
 is what I did:
 *
 File in Vendor directory:*
 /app/Vendor/gapi.php

 *In my controller:*
 App::import('Vendor', 'gapi');
 *
 In my view:*
 ?PHP
 define('ga_email','april.deross...@email.com');
 define('ga_password','');
 define('ga_profile_id','999');

 $ga = new gapi(ga_email,ga_password);


 $ga-requestReportData(ga_profile_id,array('browser','browserVersion'),array('pageviews','visits'));
 ?
 table
 tr
   thBrowser amp; Browser Version/th
   thPageviews/th
   thVisits/th
 /tr
 ?php
 foreach($ga-getResults() as $result):
 ?
 tr
   td?php echo $result ?/td
   td?php echo $result-getPageviews() ?/td
   td?php echo $result-getVisits() ?/td
 /tr
 ?php
 endforeach
 ?
 /table

 This returns exactly what I was looking forbut it takes between 60 and
 90 seconds.  Any thoughts or sage wisdom to depart (please?) - I appreciate
 any help.  I have been programming in PHP for a decade, but in cake for
 only about a month.

 --
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP

 ---
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




autocomplete issue in cake 1.3

2013-02-22 Thread Chris
hi guys,... can someone help please,... I have a autocomplete issue in cake 
1.3 
I'm using jquery helper from http://www.cakephp.4uk.pl/ajax/autoComplete 
I manage to see the results in form field, 

this is my search.ctp file: 

div style=float: left; width: 400px; margin: 10px 0 40px 15px; 

?php echo $this-Form-create('User', array('action' = 'search')); ?
?php echo $this-Form-text('firstname', array('style' = 'width: 60px')) 
? 

?php echo $this-Form-text('User.email', array('style' = 'width: 60px')) 
? 

?php echo $this-Form-text('User.city', array('style' = 'width: 60px')) 
? 
?php echo $this-Form-end(__('Search', true)); ?
/div

?php foreach($users as $user_obj): ?
  div
  ?php echo $html-link($profileShow-buddy($user_obj), '/profile/' . 
$user_obj['User']['username'], array('escape'=false)) ?
  .div
?php endforeach ?

this is auto_complete.ctp 

?php foreach($members as $member): ?
?php echo $member['User']['firstname'] . '|' . $member['User']['lastname'] 
. \n ?
?php endforeach; ?



this is my controller functions: 

function autoComplete() {

$this-set('members', $this-User-find('all', array(
'conditions' = array(
'OR' = array( 
'User.firstname LIKE' = $this-params['url']['q'].'%', 
'User.lastname LIKE' = $this-params['url']['q'].'%'
)),
'fields' = array('firstname', 'lastname')
)));
$this-layout = 'ajax';
}

  function search() 
  {
$this-User-recursive = 0;
$this-set('users', $this-paginate());

  }

I can see ALL users with pagination in that page, but not the user that I 
search... 
Please help,... 

Thanks in advance 
chris 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




jQuery Signature Pad - Auth Lost on Load

2013-02-22 Thread jonathan
Hi All,

I am using Thomas Bradley's signature pad plugin for jQuery (i am using 
v1.9.1).  I am loading the view that contains the sig pad with AJAX.  I am 
using Cake2.3 and the Auth component for user authentication.  Everything 
works perfectly in FF and Chrome, but not in IE9.  As soon as I load the 
view with the sig pad, the Auth component info is lost.  I can no longer 
load any more pages (as they are protected via Auth) and a refresh sends me 
to /users/login, which is NOT the redirectUrl I had set.  Again, only in 
IE9 do I have this issue.

I have tried all the suggested settings in core.php - security low, 
checkAgent false, etc, etc with no luck.  I cannot imagine what is 
happening inside that sig pad plugin that would single-handedly demolish 
the Auth object, but that's what I have narrowed it down to.  I have 
reached out to the author of the plugin but am not confident I will hear 
back.

If anyone has any suggestions to try, I would be most grateful.  I have 
been banging on this for 3 days now and cannot admit defeat.

Bake on,
Jonathan


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.