Shell to run as a cron... errors

2012-11-07 Thread elogic
Hi All,

I have created my first shell that I need to run as a cron, I have the 
shell setup as follows:

App::uses('CakeEmail', 'Network/Email');

class TaskEmailerShell extends AppShell {
public $uses = array('Task');

public function main() {
// DO NOTHING}

public function send() {
// GENERATE AND SEND THE EMAIL
// 
$email = new CakeEmail();
 and so on


The cron is running but I am getting the following errors in the log file 
and the actual email won't send.

[36mUsage:[0m
cake emailer [-h] [-v] [-q]

 [36mOptions:[0m
--help, -h Display this help.--verbose, -v  Enable verbose output.--quiet, 
-qEnable quiet output.

Any idea what might be going on here? My cron line is as follows: 
/home/village/public_html/lib/Cake/Console/cake 
TaskEmailer send -cli /usr/bin -console /Cake/Console -app 
/home/village/public_html/app  /home/village/public_html/emailer_log.log

Using cakephp Version: 2.2.3
Thanks

-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Existing named params included into link with additional named params?

2012-08-30 Thread elogic
Hi All,

I have a table of records that have multiple columns that you can click on 
a set record which will pass the named param for that selection and update 
the records found.

e.g. after a click the URL is: /cards/index/P/*prospect_type_id:4*

I need to do this on multiple levels, at the moment I click another column 
and the url turns to: /cards/index/P/*property_id:1* where I need it to go 
something like this: /cards/index/P/*prospect_type_id:4/property_id:1*

How can I go about doing this on many levels from the view page (I already 
have it setup to call multiple named params into the find). I think the 
Paginator function does this so I guess I am looking
to replicate it somehow.

A current link looks like this for me:

?php echo 
$this-Html-link(__($statustypes[$card['Prospect']['prospect_type_id']]), 
array('action' = 'index', $this-request-params['pass'][0], 
'prospect_type_id' = $card['Prospect']['prospect_type_id'])); ?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: CakePdf - How To Start?

2012-08-22 Thread elogic
On a brand new app I have uploaded the plugin and I set the bootstrap 
config line to:

 CakePlugin::load('CakePdf', array('bootstrap' = true, 'routes' = true)); 

Reloading the page and I get this error:

*Fatal error*: Call to undefined method Router::setExtensions() in *
/home/village/public_html/app/Plugin/CakePdf/Config/routes.php* on line *7


*

-- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: CakePdf - How To Start?

2012-08-22 Thread elogic

I changed CakePlugin::load('CakePdf', array('bootstrap' = true, 'routes' 
= true)); to CakePlugin::load('CakePdf', array('bootstrap' = true)); and 
the error is gone however I still am not getting a PDF.

I forgot to mention I have created the layout in 
/app/View/Layout/pdf/default.ctp and am trying to go to 
/reports/snapshots.pdf where I get this error now:

*Error: * The action *snapshots.pdf* is not defined in controller *
ReportsController*

I think I am still missing the configuration, what is a sample of this so I 
can get it setup properly.

**

*Thankyou
*

-- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: CakePdf - How To Start?

2012-08-22 Thread elogic
I since have setup the routes.php line of Router::parseExtensions( 'pdf');

The error I am getting now is: 

*Notice* (8): Undefined variable: res 
[*APP/Plugin/CakePdf/Vendor/dompdf/lib/class.pdf.php*, line *1413*]

I assume this is a config setting?



-- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: CakePdf - How To Start?

2012-08-15 Thread elogic
Thanks for your help so far, I have updated the config as you showed me and 
now I go to: */admin/forms/pdf_view/1.pdf *and I get the following error:*

Fatal error*: Allowed memory size of 134217728 bytes exhausted (tried to 
allocate 76 bytes) in */home/beanclai/public_html/lib/Cake/View/View.php*on 
line 
*994

*if I go to /admin/forms/pdf_view/1 I will get the html content I am trying 
to show as a PDF*

*Any suggestions?

Thanks*
*

-- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: CakePdf - How To Start?

2012-08-15 Thread elogic
Sorry I meant /pdf/forms/view/1/ or /pdf/forms/view/1.pdf as paths. The 
same error applies as above.

Bootstrap looks like this now: (I've tried DomPdf and Tcpdf, same error on 
both)

CakePlugin::load('CakePdf', array('bootstrap' = true, 'routes' = true));
Configure::write('Pdf',
  array(
'engine' = 'DomPdf' 
  )); *
*

-- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: CakePdf - How To Start?

2012-08-13 Thread elogic
Thanks however Ideally I really want to get CakePdf going rather then using 
another process.

-- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




CakePdf - How To Start?

2012-08-02 Thread elogic
I have just downloaded and installed CakePdf - 
https://github.com/ceeram/CakePdf

I don't understand how to get a sample PDF running. Anything will do, i.e. 
hello world, once I get this going then I can look into generating things 
further.

Thanks.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePdf - How To Start?

2012-08-02 Thread elogic
This is what I have done so far:

1. CakePdf is in my Plugin folder.

2. bootstrap.php has at the bottom:
/* LOAD CakePdf PLUGIN */
CakePlugin::load('CakePdf', array('bootstrap' = true, 'routes' = true));
Configure::write('Pdf',
  array(
'prefix' = 'pdf',
'engine' = 'tcpdf'
  )); 

3. FormsController.php has this function
public function pdf_view($id = null) 
{

$this-Form-id = $id;
if (!$this-Form-exists()) {
throw new NotFoundException(__('Invalid form'));
}
$this-set('form', $this-Form-read(null, $id));
}

4. I have setup a template file at: /app/View/Layouts/pdf/default.ctp

5. I have setup the view file at: /app/View/Forms/pdf/view.ctp


I am getting this error (please note I also tried the view.ctp as 
pdf_view.ctp in the /app/View/Forms/ folder but it just rendered the html 
to the page without the error, still no pdf)

*Error: * The view for *FormsController::**pdf_view()* was not found.

*Error: * Confirm you have created the file: 
/home/beanclai/public_html/app/View/Forms/pdf_view.ctp

Any idea where I am going wrong? Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Web-App works local but not on my Server

2012-07-26 Thread elogic
I am getting this sample issue, works on local but as soon as I put it on 
live server I get this issue. The blackhole error comes back with 'auth' 
nothing else.

I'm stuck.

Thanks

On Saturday, 24 December 2011 03:20:03 UTC+10, Gerrit wrote:

 Hello everybody, 

 I've the following question: On my local machine my application works 
 correctly. I call the app folder, become redirected to the login page, 
 can enter login details and after a successful login I will be 
 redirected to the index-action. When I try this in the prod 
 environment my request was catched by the black hole. Has anybody a 
 hint for me what could be the reason? 

 Thanks and regards!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Auth Function Issues

2012-07-26 Thread elogic
Hi All,

I am using some basic Auth code that I have used many times in the past but 
for some reason this time it is failing. I cannot work it out, there isn't 
much to the actual code so I cannot see why it would fail.

Can anyone see where I am going wrong? I am not getting any errors to the 
page when I try and login, when I echo  $this-Auth-login() it comes back 
as fail, I have tested the password hash and it matches that of the 
database. 

Also this exact code is working on my local computer dev setup but as soon 
as it goes online it doesn't work.

Any ideas?

Thankyou


AppController.php

public $components = array(
'Auth'= array(
'authenticate' = array(
'Form' = array(
'fields' = array('username' = 'email', 'password' = 
'password')
)
)
),
'Session',
'Cookie',
'RequestHandler',
'Whmcs'
);  


login.ctp

?php
echo $this-Session-flash('auth');
echo $this-Form-input('email', array(
   'class' = 'span2',
   //'div' = array('class' = 
'control-group'),
   'div' = false,
   'label' = false,
   'placeholder' = 'Email'
   ));
echo $this-Form-input('password', array(
   'class' = 'span2',
   //'div' = array('class' = 
'control-group'),
   'div' = false,
   'label' = false,
   'placeholder' = 'Password'
   ));
?
?php echo $this-Form-submit('Login', array(
  'class' = 'btn',
  'div' = false
  ));? 
?php echo $this-Form-end(); ?



UserController.php

public function login() 
{
//DEFINE THE LAYOUT
// 
$this-layout = 'users_front';

//print_r($this-data);

if ($this-request-is('post')) 
{


  if ($this-Auth-login()) 
  {
//print_r($this-data);
// CHECK USER THAT LOGS IN IS ACCOUNTANT OR USER LEVEL
if($this-Auth-user('group_id') == 3 || 
$this-Auth-user('group_id') == 4)
{
return $this-redirect(array('action' = 'dashboard'));;
}
else // ADMIN GOES TO THEIR AREA
{

return $this-redirect(array('admin' = true, 'action' 
= 'dashboard'));
}
  } 
  else 
  {

$this-Session-setFlash(__('Username or password is 
incorrect'), 'default', array(), 'auth');

  }
}
}


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Auth Function Issues

2012-07-26 Thread elogic
I have also realised that none of the redirects are working either. I get a 
blank page.

Could these be some kind of cached information files, sessions or similar 
that I have uploaded from the local to the live server that I can clear?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Auth Function Issues

2012-07-26 Thread elogic
I found the solution


My UserController.php has 2 white spaces before the ?php

There's 2 hours of my life I won't get back.

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


router help

2012-07-20 Thread elogic
Hello,

I am having some issues with my routes, I have put in the below route so I 
can have my front end pages all go to my contents controller view page.
e.g. /home shows /contents/view/home or /about-us shows 
/contents/view/about-us (I'm using a slug)

Router::connect('/*', array('controller' = 'contents', 'action' = 
'view'));

This works as needed for that part however now all of my other controller 
links are routing to the same area.

e.g. /admin/users/login or /users/index etc all go to the contents/view 
controller / action.

How can I get around this so both items work? 

If I remove the * from above. i.e. Router::connect('/', array('controller' 
= 'contents', 'action' = 'view')); the home page works but none of the 
other pages (e.g. /about-us) work but all my other controllers will work.

Thanks

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: WHMCS Api - Component

2012-07-20 Thread elogic
Thanks, this did the trick. It's working now.


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: router help

2012-07-20 Thread elogic
After some more searching around I came up with the following:


*Router::connect('/', array('controller' = 'contents', 'action' = 
'view'));
Router::connect('/:slug', array('controller' = 'contents', 'action' = 
'view', array('routeClass' = 'SlugRoute')));*


It seems to be working for my requirements however I wanted to see if this 
was the best way to do it or should it be done differently?

Thankyou

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


WHMCS Api - Component

2012-07-18 Thread elogic
I am building a new system in cake and I want to heavily use the WHMCS api 
but I am not sure where to start, I haven't written a component before 
(still new to cakephp)

I found this online but it is quite old and errors out a fair bit, I assume 
it's built for cake 1.x, I am using the latest version of 2.21.

OLD WHMCS COMPONENT: 
http://awnist.com/blog/2009/04/09/cakephp-whmcs-module-interacting-with-whmcs-api-via-cake/

The first initial error I get when I install this component is:

Fatal error: Class 'HttpSocket' not found in 
C:\wamp\www\beanclaim\app\Controller\Component\WhmcsComponent.php on line *
53*

Any idea what I need to do for this?

It comes from here (of the code at the link above):

var $last_result = Array();
function __construct() {
$this-Http = new HttpSocket();  (LINE 53)
}

Thanks
Adam

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: WHMCS Api - Component

2012-07-18 Thread elogic
I have then updated the first line to: App::uses('HttpSocket', 
'Network/Http'); and that error is by passed, now I get this:

*Warning* (2): call_user_func_array() expects parameter 1 to be a valid 
callback, class 'WhmcsComponent' does not have a method 'initialize' 
[*CORE\Cake\Utility\ObjectCollection.php*, line *130*]


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: re-skinned or plugin version or my site.. like an API but templated

2012-07-03 Thread elogic
Thanks, I think it might need to be via an API seeing it needs to be apart 
of their actual website. Does anyone know of any tutorials online covering 
creating an API with cakephp so I can look into this further? It's all very 
new to me, I have used API's but never created one with or without cake.

On Tuesday, 3 July 2012 14:07:37 UTC+10, Greg wrote:

 So you want to have essentially 1 instance of your application running 
 (the model, and controllers), but different views (or perhaps, just a 
 different template) at the other end?

 There are many ways to do this i suppose. If you host everything yourself 
 you can probably use App::build to point at a central/reusable set of 
 models/controllers etc for a given domain.

 Or you could go the other way, and change the template view path based on 
 the request..

 if you want them to physically host the front end, then you probably need 
 to use an actual API - expose your backend as a restful api (which is a 
 snap in cake to do), and write a front end app which consumes that API - 
 customise the front end app with various styles etc. They can then install 
 your front end application on their servers and get at it from something 
 like http://clienturl/yourapplication






 Hi All,

 I am about to being a projest with cakePHP as the framework, my client 
 has now asked me how we can go about setting up the site so other firms in 
 the same industry
 could somehow use the same system (running on our database) from a front 
 end point of view on their website as an addon product.

 So basically the front end of the site will be designed for us and then 
 again for each of the other firms but the functionality and admin remain 
 the same which they plugin to their site (nearly like using old school 
 iframes).

 Any ideas on how this could best work and be setup initially? Almost like 
 an API but the whole front end needs to be templated with their corporate 
 colours and logo (I'm thinking custom header and footer then the content 
 area remains quite neutral)

 Any tips or threads, posts etc online would be great.
 Thanks

 -- 
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org 
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.
  
  
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 at http://groups.google.com/group/cake-php




-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


re-skinned or plugin version or my site.. like an API but templated

2012-07-02 Thread elogic
Hi All,

I am about to being a projest with cakePHP as the framework, my client has 
now asked me how we can go about setting up the site so other firms in the 
same industry
could somehow use the same system (running on our database) from a front 
end point of view on their website as an addon product.

So basically the front end of the site will be designed for us and then 
again for each of the other firms but the functionality and admin remain 
the same which they plugin to their site (nearly like using old school 
iframes).

Any ideas on how this could best work and be setup initially? Almost like 
an API but the whole front end needs to be templated with their corporate 
colours and logo (I'm thinking custom header and footer then the content 
area remains quite neutral)

Any tips or threads, posts etc online would be great.
Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: url=controller/function appears now in my url address bar

2012-07-02 Thread elogic
I checked this all out but I couldn't see anything that was wrong. Anyone 
have an idea exactly what might be going on here? Everything still works, 
it's just the URL is different.

Thanks


On Wednesday, 20 June 2012 20:47:27 UTC+10, dogmatic69 wrote:

 The rewrite rules have changed in 2.x so make sure you update the 
 .htaccess (and the other files in webroot / Config)

 On Wednesday, 20 June 2012 06:19:26 UTC+1, elogic wrote:

 Hi All,

 I moved a site from one server and upgraded it from 1.3.x to 2.x and now 
 in the url I am getting something like this: 
 /units/staffindex?url=units%2Fstaffindex

 The url=units%2Fstaffindex part is new to me. Any idea why it is now 
 there and how do I get rid of it?

 Everything works as normal, it's just not neat so I want it removed.

 Thanks



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


url=controller/function appears now in my url address bar

2012-06-19 Thread elogic
Hi All,

I moved a site from one server and upgraded it from 1.3.x to 2.x and now in 
the url I am getting something like this: 
/units/staffindex?url=units%2Fstaffindex

The url=units%2Fstaffindex part is new to me. Any idea why it is now there 
and how do I get rid of it?

Everything works as normal, it's just not neat so I want it removed.

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


how to generate this sql

2012-06-18 Thread elogic
Hi All,

How do I go about generating the following SQL line using cakePHP from the 
timesheets controller?

SELECT user_id, date, count(id) as count_name FROM `timesheets`GROUP BY 
user_id, date HAVING count_name  1 ORDER BY count_name;

Basically it is just checking for double up records mathching the date and 
user_id fields.

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


count from different model in find by id

2012-03-28 Thread elogic
I have a find (below) that selects all users so I can loop through them in 
a foreach on the view page. I need to add in some count fields that are 
separate from another table (one of the count finds is below).

How would you suggest I can do this easily?

$staffmembers = $this-User-find('all', array(
'fields' = array('User.id', 'User.first_name', 
'User.last_name'),
'conditions' = array('User.group_id' = 3),
'recursive' = 0
));

$currenttasks = $this-Task-find('count', array('conditions' = 
array('Task.completed' = 0, 'Task.user_id' = $staffmembers['User']['id'], 
'Task.due_date ' = date(Y-m-d;


So it can somehow be displayed on the page (code is not accurate, just to 
explain the situation):

foreach $staffmembers as $user 
{
  echo $user['User']['first_name'] - $currenttasks (for this user)
}



Is there a way to use a subquery or somehow make the currenttask a field 
selected in the first thing to get into the array?

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: count from different model in find by id

2012-03-28 Thread elogic
I ended up doing the following which works but I do wonder is there a 
better cakePHP way.

Thanks

REPORTS CONTROLLER

// LOAD REQUIRED MODELS
// ---
$this-loadModel('User');
$this-loadModel('Task');


// SELECT STAFF MEMEBRS
// ---
$staffmembers = $this-User-find('all', array(
'fields' = array('User.id', 'User.first_name', 
'User.last_name'),
'conditions' = array('User.group_id' = 3, 
'User.active' = 1),
'recursive' = 0
));
$this-set('staffmembers', $staffmembers);


// FOR EACH STAFF MEMEBR WORK OUT THE COUNT INTO AN ARRAY
// 

foreach ($staffmembers as $staff) 
{
$currenttasks[] = $this-Task-find('count', array('conditions' 
= array('Task.completed' = 0, 'Task.user_id' = $staff['User']['id'], 
'Task.due_date ' = $thedate)));
$completedtasks[] = $this-Task-find('count', 
array('conditions' = array('Task.completed' = 1, 'Task.user_id' = 
$staff['User']['id'])));
$overduetasks[] = $this-Task-find('count', array('conditions' 
= array('Task.completed' = 0, 'Task.user_id' = $staff['User']['id'], 
'Task.due_date ' = $thedate)));

$this-set('currenttasks', $currenttasks);
$this-set('completedtasks', $completedtasks);
$this-set('overduetasks', $overduetasks);
}

REPORT TASK VIEW
$i = 0;
foreach ($staffmembers as $row) 
{ 
$thefullname = $row['User']['first_name'] . ' ' . 
$row['User']['last_name'];
$theuserid = $row['User']['id'];
   echo data.addRow(['.$thefullname.', 
.$currenttasks[$i]., .$completedtasks[$i]., .$overduetasks[$i].]);; 
$i++;
} 


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


cakePHP Data into Google Charts

2012-03-27 Thread elogic
I need to build some reports for a cakePHP system I have been building and 
google charts seems to be the easiest way to get some charts happening.

How do I go about getting the cakePHP data into the chart records? I have 
only just started by using the sample code on google charts info pages.

e.g.

script type=text/javascript src=https://www.google.com/jsapi;/script
script type=text/javascript
  google.load(visualization, 1, {packages:[corechart]});
  google.setOnLoadCallback(drawChart);
  function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Staff Member');
data.addColumn('number', 'Current');
data.addColumn('number', 'Competed');
data.addColumn('number', 'Overdue');
data.addRows([
  ['2004', 1000, 400, 100],
  ['2005', 1170, 460, 100],
  ['2006', 660, 1120, 100],
  ['2007', 1030, 540, 100]
]);

var options = {
  title: 'Task Status Summary',
  hAxis: {title: 'Staff Member', titleTextStyle: {color: 'red'}}
};

var chart = new 
google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
  }
/script

div id=chart_div style=width: 1000px; height: 500px;/div

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: cakePHP Data into Google Charts

2012-03-27 Thread elogic
For example, the first column would use something as follows to get the 
names out:

$staffmembers = $this-User-find('all', array(
'fields' = array('User.id', 'User.first_name', 
'User.last_name'),
'conditions' = array('User.group_id' = 3),
'recursive' = 0
));

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: cakeDC utils csvImport - fixed fields

2012-02-20 Thread elogic
This is driving me crazy, I'm sure it has to be something I am doing
incorrectly but I cannot imagine what.

I wonder if their is a limit to the fixed fields or something?

Thanks

On Feb 14, 4:03 pm, elogic asymo...@elogicmedia.com.au wrote:
 Thanks but that isn't the issue as I even tried putting it in manually
 i.e. $fixed = array('Property' = array('estate_id' = $estate_id,
 'staff_id' = $staff_id, 'upload_id' = 3));

 It's quite strange, I even renamed the field in the DB and in the
 fixed array but nothing is working.

 On Feb 14, 2:40 pm, Graham Weldon predomin...@gmail.com wrote:







  Hey,

  Where is this code being run? beforeSave, afterSave, somewhere in the 
  controller?
  If you haven't performed the save yet, then getInsertID won't work.

  Cheers,
  Graham Weldonhttp://grahamweldon.com
  e. gra...@grahamweldon.com
  p. (+61) 0407 017 293
  Skype: grahamweldon

  On Tuesday, 14 February 2012 at 3:26 PM, elogic wrote:
   Hi All,

   I am using cakeDC utils csvImport to import an uploaded CSV into a
   table. Everything is working besides one of the fixed fields. I have 3
   fixed fields, 2 work as required but the other is skipped everytime. I
   cannot work out what is happening or why this is the case. It's not
   making sense to me.

   basic code is as follows:

   // FIXED FIELDS
   $estate_id = $this-data['Upload']['estate_id'];
   $staff_id = $this-data['Upload']['staff_id'];
   $upload_id = $this-Upload-getInsertID();

   // ARRAY OF ABOVE FIXED FIELDS (Note When I print_r this all works)
   $fixed = array('Property' = array('estate_id' = $estate_id,
   'staff_id' = $staff_id, 'upload_id' = $upload_id));

   // IMPORTING THE CSV WITH FIXED FIELDS
   $this-Upload-Property-importCSV($_SERVER[DOCUMENT_ROOT] . '/app/
   webroot/files/csvcontacts/'. $thefilename, $fixed);

   The estate_id and staff_id both work, the upload_id is coming though
   NULL each time.

   Very strange to me.

   Thanks

   --
   Our newest site for the community: CakePHP Video 
   Tutorialshttp://tv.cakephp.org
   Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
   others with their CakePHP related questions.

   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.com For more options, visit this group 
   athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: create duplicate record

2012-02-15 Thread elogic
Thanks, Where do I put it though?

I tried this:

$existing_id = $this-request-data['Ladder']['id'];
$new_record = $this-Ladder-findById($existing_id);
unset($new_record['Ladder']['id']);
$new_record['Ladder']['level'] = $next_round;
$new_record['Ladder']['status'] = 0;
print_r($new_record);
$this-Ladder-create();
$this-Ladder-save($new_record);


Which does create the new record but it isn't saving the changed
values within the $new_record array. It is just saving the same
details as the original.

print_r($new_record); - this is showing the data has been updated but
it isn't being used in the create / save of the new record.

Thanks



On Feb 15, 5:38 pm, Andras Kende and...@kende.com wrote:
 try to add:

 $this-Ladder-create();

 Andras Kende

 On Feb 15, 2012, at 1:12 AM, elogic wrote:







  Thanks,

  This is what I have:

  // GET THE EXISTING RECORD, REMOVE THE ID, UPDATE THE LEVEL AND SAVE
  // --
  $existing_id = $this-request-data['Ladder']['id'];
  $new_record = $this-Ladder-findById($existing_id);
  unset($new_record['Ladder']['id']);
  $new_record['Ladder']['level'] = $next_round;
  $this-Ladder-save($new_record);

  Nothing is saving though?

  Thanks

  On Feb 15, 4:16 pm, Jeremy Burns | Class Outfit
  jeremybu...@classoutfit.com wrote:
  Do a find, remove the 'id' key from the resulting array, change the value 
  of the field/key you want and then save it again. The lack of an id key 
  will force a save rather than an update.

  Jeremy Burns
  Class Outfit

 http://www.classoutfit.com

  On 15 Feb 2012, at 06:04:20, elogic wrote:

  Is there an easy way to create a duplicate record using cakePHP and
  maybe change one field in the duplication while still keeping the
  original?

  Thanks

  --
  Our newest site for the community: CakePHP Video 
  Tutorialshttp://tv.cakephp.org
  Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
  others with their CakePHP related questions.

  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php

  --
  Our newest site for the community: CakePHP Video 
  Tutorialshttp://tv.cakephp.org
  Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
  others with their CakePHP related questions.

  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: create duplicate record

2012-02-15 Thread elogic
Ignore this, user error.

I had the field in the database setup incorrectly so it would accept
the value I was changing.

Thanks

On Feb 16, 7:38 am, elogic asymo...@elogicmedia.com.au wrote:
 Thanks, Where do I put it though?

 I tried this:

 $existing_id = $this-request-data['Ladder']['id'];
 $new_record = $this-Ladder-findById($existing_id);
 unset($new_record['Ladder']['id']);
 $new_record['Ladder']['level'] = $next_round;
 $new_record['Ladder']['status'] = 0;
 print_r($new_record);
 $this-Ladder-create();
 $this-Ladder-save($new_record);

 Which does create the new record but it isn't saving the changed
 values within the $new_record array. It is just saving the same
 details as the original.

 print_r($new_record); - this is showing the data has been updated but
 it isn't being used in the create / save of the new record.

 Thanks

 On Feb 15, 5:38 pm, Andras Kende and...@kende.com wrote:







  try to add:

  $this-Ladder-create();

  Andras Kende

  On Feb 15, 2012, at 1:12 AM, elogic wrote:

   Thanks,

   This is what I have:

   // GET THE EXISTING RECORD, REMOVE THE ID, UPDATE THE LEVEL AND SAVE
   // --
   $existing_id = $this-request-data['Ladder']['id'];
   $new_record = $this-Ladder-findById($existing_id);
   unset($new_record['Ladder']['id']);
   $new_record['Ladder']['level'] = $next_round;
   $this-Ladder-save($new_record);

   Nothing is saving though?

   Thanks

   On Feb 15, 4:16 pm, Jeremy Burns | Class Outfit
   jeremybu...@classoutfit.com wrote:
   Do a find, remove the 'id' key from the resulting array, change the 
   value of the field/key you want and then save it again. The lack of an 
   id key will force a save rather than an update.

   Jeremy Burns
   Class Outfit

  http://www.classoutfit.com

   On 15 Feb 2012, at 06:04:20, elogic wrote:

   Is there an easy way to create a duplicate record using cakePHP and
   maybe change one field in the duplication while still keeping the
   original?

   Thanks

   --
   Our newest site for the community: CakePHP Video 
   Tutorialshttp://tv.cakephp.org
   Check out the new CakePHP Questions 
   sitehttp://ask.cakephp.organdhelpothers with their CakePHP related 
   questions.

   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.com For more options, visit this 
   group athttp://groups.google.com/group/cake-php

   --
   Our newest site for the community: CakePHP Video 
   Tutorialshttp://tv.cakephp.org
   Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
   others with their CakePHP related questions.

   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.com For more options, visit this group 
   athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


create duplicate record

2012-02-14 Thread elogic
Is there an easy way to create a duplicate record using cakePHP and
maybe change one field in the duplication while still keeping the
original?

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: create duplicate record

2012-02-14 Thread elogic
Thanks,

This is what I have:

// GET THE EXISTING RECORD, REMOVE THE ID, UPDATE THE LEVEL AND SAVE
// --
$existing_id = $this-request-data['Ladder']['id'];
$new_record = $this-Ladder-findById($existing_id);
unset($new_record['Ladder']['id']);
$new_record['Ladder']['level'] = $next_round;
$this-Ladder-save($new_record);

Nothing is saving though?

Thanks



On Feb 15, 4:16 pm, Jeremy Burns | Class Outfit
jeremybu...@classoutfit.com wrote:
 Do a find, remove the 'id' key from the resulting array, change the value of 
 the field/key you want and then save it again. The lack of an id key will 
 force a save rather than an update.

 Jeremy Burns
 Class Outfit

 http://www.classoutfit.com

 On 15 Feb 2012, at 06:04:20, elogic wrote:







  Is there an easy way to create a duplicate record using cakePHP and
  maybe change one field in the duplication while still keeping the
  original?

  Thanks

  --
  Our newest site for the community: CakePHP Video 
  Tutorialshttp://tv.cakephp.org
  Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
  others with their CakePHP related questions.

  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


cakeDC utils csvImport - fixed fields

2012-02-13 Thread elogic
Hi All,

I am using cakeDC utils csvImport to import an uploaded CSV into a
table. Everything is working besides one of the fixed fields. I have 3
fixed fields, 2 work as required but the other is skipped everytime. I
cannot work out what is happening or why this is the case. It's not
making sense to me.

basic code is as follows:

// FIXED FIELDS
$estate_id =  $this-data['Upload']['estate_id'];
$staff_id =  $this-data['Upload']['staff_id'];
$upload_id = $this-Upload-getInsertID();

// ARRAY OF ABOVE FIXED FIELDS (Note When I print_r this all works)
$fixed = array('Property' = array('estate_id' = $estate_id,
'staff_id' = $staff_id, 'upload_id' = $upload_id));

// IMPORTING THE CSV WITH FIXED FIELDS
$this-Upload-Property-importCSV($_SERVER[DOCUMENT_ROOT] . '/app/
webroot/files/csvcontacts/'. $thefilename, $fixed);


The estate_id and staff_id both work, the upload_id is coming though
NULL each time.

Very strange to me.

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: cakeDC utils csvImport - fixed fields

2012-02-13 Thread elogic
Thanks but that isn't the issue as I even tried putting it in manually
i.e. $fixed = array('Property' = array('estate_id' = $estate_id,
'staff_id' = $staff_id, 'upload_id' = 3));

It's quite strange, I even renamed the field in the DB and in the
fixed array but nothing is working.



On Feb 14, 2:40 pm, Graham Weldon predomin...@gmail.com wrote:
 Hey,

 Where is this code being run? beforeSave, afterSave, somewhere in the 
 controller?
 If you haven't performed the save yet, then getInsertID won't work.

 Cheers,
 Graham Weldonhttp://grahamweldon.com
 e. gra...@grahamweldon.com
 p. (+61) 0407 017 293
 Skype: grahamweldon







 On Tuesday, 14 February 2012 at 3:26 PM, elogic wrote:
  Hi All,

  I am using cakeDC utils csvImport to import an uploaded CSV into a
  table. Everything is working besides one of the fixed fields. I have 3
  fixed fields, 2 work as required but the other is skipped everytime. I
  cannot work out what is happening or why this is the case. It's not
  making sense to me.

  basic code is as follows:

  // FIXED FIELDS
  $estate_id = $this-data['Upload']['estate_id'];
  $staff_id = $this-data['Upload']['staff_id'];
  $upload_id = $this-Upload-getInsertID();

  // ARRAY OF ABOVE FIXED FIELDS (Note When I print_r this all works)
  $fixed = array('Property' = array('estate_id' = $estate_id,
  'staff_id' = $staff_id, 'upload_id' = $upload_id));

  // IMPORTING THE CSV WITH FIXED FIELDS
  $this-Upload-Property-importCSV($_SERVER[DOCUMENT_ROOT] . '/app/
  webroot/files/csvcontacts/'. $thefilename, $fixed);

  The estate_id and staff_id both work, the upload_id is coming though
  NULL each time.

  Very strange to me.

  Thanks

  --
  Our newest site for the community: CakePHP Video 
  Tutorialshttp://tv.cakephp.org
  Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
  others with their CakePHP related questions.

  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Nick Baker's FileUpload Plugin + phpThumb Generator for existing files

2012-01-30 Thread elogic
Hi All,

I have Nick Baker's FileUpload working for an image gallery aloong
with a phpThumb generator and all works well except if there is an
existing file in the folder. The FileUpload plugin is renaming the
files correctly e.g. filename-1.jpg but I have something wrong in my
controller where I am calling the original name of the uploaded file
and not the newly generated name so the thumbnail is being created off
filename.jpg.

I have an add function in my GalleryphotosController that has this
line:

if(!$this-PhpThumb-
generateThumbnail($_SERVER['DOCUMENT_ROOT'] . '/siteadmin/app/webroot/
files/galleryphotos/' . $this-data['Galleryphoto']['file']['name'],
$_SERVER['DOCUMENT_ROOT'] . '/siteadmin/app/webroot/files/
galleryphotos/thumbs/' . $this-data['Galleryphoto']['file']['name']))
{
pr($this-PhpThumb-errors);
}

I'm sure all I need to do is replace $this-data['Galleryphoto']
['file']['name'] with the filename that the plugin makes but I cannot
work out how. I'm sure it is simple but everything I have tried is
failing. I am using cakephp 2.0.5

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


_cake_model_ cache was unable to write - Apc cache

2012-01-24 Thread elogic
I have copied a cakephp setup from one server to another and now I am
getting the following errrors, any idea what it might be? I have set
the permissisons on the app/tmp folders so that wasn't it. It's
cakephp 2.0.5.

Thanks




Warning (512): _cake_model_ cache was unable to write
'default_worklinks_staff_list' to Apc cache [CORE/Cake/Cache/
Cache.php, line 310]

Warning (512): _cake_model_ cache was unable to write
'default_worklinks_staff_list' to Apc cache [CORE/Cake/Cache/
Cache.php, line 310]

Warning (512): _cake_model_ cache was unable to write 'default_users'
to Apc cache [CORE/Cake/Cache/Cache.php, line 310]

Warning (512): _cake_model_ cache was unable to write 'default_users'
to Apc cache [CORE/Cake/Cache/Cache.php, line 310]

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: cakeDC utils csvImport - extra record

2012-01-18 Thread elogic
This is what I originally thought but I tested it with a csv file that
I first opened in notepad to make sure there wasn't the extra line in
there. It still generates the extra record.

Any ideas?

Thanks

On Jan 19, 12:35 pm, José Lorenzo jose@gmail.com wrote:
 probably an extra line in your CSV file

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


cakeDC utils csvImport - extra record

2012-01-11 Thread elogic
I am using the plugin cakeDC Utils (CSVImport - Link Below) with
cakephp 2.0.4 and everything works however when the csv is imported it
is adding in an additional blank record at the end, does anyone else
have this issue and know how I can fix it?

Thanks


LINK: https://github.com/CakeDC/utils

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Remove Pagination Controls if 1 page only

2012-01-09 Thread elogic
Is there an easy way to simply remove the previous / next controls if
there is only one page of data found?

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Remove Pagination Controls if 1 page only

2012-01-09 Thread elogic
Thanks, Just what I was after.

On Jan 10, 10:36 am, majna majna...@gmail.com wrote:
 if ($this-Paginator-hasPage(2)) {
 // display prev, next, numers...









-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: editing user data when password doesn't change

2011-12-22 Thread elogic
http://www.dereuromark.de/2011/08/25/working-with-passwords-in-cakephp/
- This was perfect, thankyou!

On Dec 22, 8:23 pm, euromark dereurom...@googlemail.com wrote:
 this might 
 help:http://www.dereuromark.de/2011/08/25/working-with-passwords-in-cakephp/

 On 22 Dez., 11:09, Sam Sherlock sam.sherl...@gmail.com wrote:







  Intercept the password in beforeFilter

  - S
  On 22 Dec 2011 02:08, elogic asymo...@elogicmedia.com.au wrote:

   Hi All,

   I am using Auth and I have an edit user details page, the password is
   coming though hashed into the password field, if the user doesn't
   change the password, the hashed password get re-hashed and therefore
   it will be unknown to the user. How do I get around this issue?

   Thanks

   --
   Our newest site for the community: CakePHP Video Tutorials
  http://tv.cakephp.org
   Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
   others with their CakePHP related questions.

   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.com For more options, visit this group
   athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


editing user data when password doesn't change

2011-12-21 Thread elogic
Hi All,

I am using Auth and I have an edit user details page, the password is
coming though hashed into the password field, if the user doesn't
change the password, the hashed password get re-hashed and therefore
it will be unknown to the user. How do I get around this issue?

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


validation rule help

2011-12-12 Thread elogic
Hi All,

I have a database listing of properties down the page. Each property
row has a date selector and a time selector. I need to somehow
validate that if one of the dates is selected the time must be
selected before the bulk save can happen, if neither are selected it
cane be left blank and addressed later.

Any ideas how I can go about validating this?

The file names are as follows:

DATE - data[Property][777][entry_date]
TIME - data[Property][777][entry_time]

NOTE: 777 is the property ID.


Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: history log table

2011-10-04 Thread elogic
Thanks, so where do I add the $activeUser part?



On Oct 5, 2:06 am, majna majna...@gmail.com wrote:
 Add $actsAs to AppModel

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: history log table

2011-10-04 Thread elogic
When I put the $actAs within my user model for example I get the
following error:


Undefined property: UsersController::$activeUser [APP/
app_controller.php, line 20]


Thanks







On Oct 5, 8:20 am, elogic asymo...@elogicmedia.com.au wrote:
 Thanks, so where do I add the $activeUser part?

 On Oct 5, 2:06 am, majna majna...@gmail.com wrote:







  Add $actsAs to AppModel

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: history log table

2011-10-03 Thread elogic
Thanks for the reply.

Are you able to explain further or direct me to something online that
could help me out in getting this sorted? I'm just starting with
cakephp.

Thankyou



On Oct 3, 7:59 pm, euromark dereurom...@googlemail.com wrote:
 you could write a method in the model or even a behavior which will do
 that for you
 in the beforeSave() callback it can be triggered globally

 On 3 Okt., 06:38, elogic asymo...@elogicmedia.com.au wrote:







  My client wants a listing of all actions that happen within the system
  so they can check back and search the records at a later date.

  I thought the best way to handle this would be to have a histories
  table which would be similar to below:

  CREATE TABLE `histories` (
          `id` INT(11) NULL AUTO_INCREMENT,
          `user_id` INT(11) NOT NULL DEFAULT '0',
          `action` VARCHAR(50) NULL DEFAULT NULL,
          `content` VARCHAR(250) NULL DEFAULT NULL,
          `created` DATETIME NULL DEFAULT NULL,
          `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
  CURRENT_TIMESTAMP,
          PRIMARY KEY (`id`),
          INDEX `user_id` (`user_id`)
  )

  How would I go about inserting the user_id (the logged user - using
  Auth), action (i.e. create, edit, delete, login etc) and content
  (added joe blogs or deleted record ID123 etc) from every section
  within the site?

  Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: history log table

2011-10-03 Thread elogic
Thanks, that looks like what I am after.



On Oct 4, 7:11 am, Meroe Kush whme...@gmail.com wrote:
 Have a look at this:

 http://bakery.cakephp.org/articles/alkemann/2008/10/21/logablebehavior







 -Original Message-
 From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf

 Of elogic
 Sent: Monday, October 03, 2011 5:07 PM
 To: CakePHP
 Subject: Re: history log table

 Thanks for the reply.

 Are you able to explain further or direct me to something online that
 could help me out in getting this sorted? I'm just starting with
 cakephp.

 Thankyou

 On Oct 3, 7:59 pm, euromark dereurom...@googlemail.com wrote:
  you could write a method in the model or even a behavior which will do
  that for you
  in the beforeSave() callback it can be triggered globally

  On 3 Okt., 06:38, elogic asymo...@elogicmedia.com.au wrote:

   My client wants a listing of all actions that happen within the system
   so they can check back and search the records at a later date.

   I thought the best way to handle this would be to have a histories
   table which would be similar to below:

   CREATE TABLE `histories` (
           `id` INT(11) NULL AUTO_INCREMENT,
           `user_id` INT(11) NOT NULL DEFAULT '0',
           `action` VARCHAR(50) NULL DEFAULT NULL,
           `content` VARCHAR(250) NULL DEFAULT NULL,
           `created` DATETIME NULL DEFAULT NULL,
           `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON
 UPDATE
   CURRENT_TIMESTAMP,
           PRIMARY KEY (`id`),
           INDEX `user_id` (`user_id`)
   )

   How would I go about inserting the user_id (the logged user - using
   Auth), action (i.e. create, edit, delete, login etc) and content
   (added joe blogs or deleted record ID123 etc) from every section
   within the site?

   Thanks

 --
 Our newest site for the community: CakePHP Video 
 Tutorialshttp://tv.cakephp.org
 Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
 others with their CakePHP related questions.

 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: history log table

2011-10-03 Thread elogic
I took a look at the loggable behavoir but I wasn't sure where the
$activeUser information was to be put.

I have done the following:

1. added the logable.php behavour to the models / behavour folder
2. Created a logs table with required feilds.
3. Added the following into my beforefilter in the AppController
if (sizeof($this-uses)  
$this-{$this-modelClass}-Behaviors-
attached('Logable')) {

$this-{$this-modelClass}-setUserData($this-activeUser);
}
4. Add the following into the AppController
var $actsAs = array('Logable' = array('userModel' = 'User',
'userKey' = 'user_id'));

Is this right so far and also where does the active user info go?

Thankyou



On Oct 4, 10:16 am, elogic asymo...@elogicmedia.com.au wrote:
 Thanks, that looks like what I am after.

 On Oct 4, 7:11 am, Meroe Kush whme...@gmail.com wrote:







  Have a look at this:

 http://bakery.cakephp.org/articles/alkemann/2008/10/21/logablebehavior

  -Original Message-
  From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf

  Of elogic
  Sent: Monday, October 03, 2011 5:07 PM
  To: CakePHP
  Subject: Re: history log table

  Thanks for the reply.

  Are you able to explain further or direct me to something online that
  could help me out in getting this sorted? I'm just starting with
  cakephp.

  Thankyou

  On Oct 3, 7:59 pm, euromark dereurom...@googlemail.com wrote:
   you could write a method in the model or even a behavior which will do
   that for you
   in the beforeSave() callback it can be triggered globally

   On 3 Okt., 06:38, elogic asymo...@elogicmedia.com.au wrote:

My client wants a listing of all actions that happen within the system
so they can check back and search the records at a later date.

I thought the best way to handle this would be to have a histories
table which would be similar to below:

CREATE TABLE `histories` (
        `id` INT(11) NULL AUTO_INCREMENT,
        `user_id` INT(11) NOT NULL DEFAULT '0',
        `action` VARCHAR(50) NULL DEFAULT NULL,
        `content` VARCHAR(250) NULL DEFAULT NULL,
        `created` DATETIME NULL DEFAULT NULL,
        `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON
  UPDATE
CURRENT_TIMESTAMP,
        PRIMARY KEY (`id`),
        INDEX `user_id` (`user_id`)
)

How would I go about inserting the user_id (the logged user - using
Auth), action (i.e. create, edit, delete, login etc) and content
(added joe blogs or deleted record ID123 etc) from every section
within the site?

Thanks

  --
  Our newest site for the community: CakePHP Video 
  Tutorialshttp://tv.cakephp.org
  Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
  others with their CakePHP related questions.

  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


history log table

2011-10-02 Thread elogic
My client wants a listing of all actions that happen within the system
so they can check back and search the records at a later date.

I thought the best way to handle this would be to have a histories
table which would be similar to below:

CREATE TABLE `histories` (
`id` INT(11) NULL AUTO_INCREMENT,
`user_id` INT(11) NOT NULL DEFAULT '0',
`action` VARCHAR(50) NULL DEFAULT NULL,
`content` VARCHAR(250) NULL DEFAULT NULL,
`created` DATETIME NULL DEFAULT NULL,
`modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
INDEX `user_id` (`user_id`)
)


How would I go about inserting the user_id (the logged user - using
Auth), action (i.e. create, edit, delete, login etc) and content
(added joe blogs or deleted record ID123 etc) from every section
within the site?

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: using auth-login - displaying logged in username?

2011-09-23 Thread elogic
This is how I do it: ?php echo $this-Session-
read('Auth.User.username'); ?

Not sure about all logged in users. I'm only a few weeks into cakePHP.



On Sep 23, 5:30 pm, mivogtGermanyLU miv...@mivogt.net wrote:
 hi there,

 i am using the auth component for a very simple login/logoff located
 in users-controller.

 On the head of my app I would like to show the username I am logged in
 with.

 How do I get the name I am logged in with to show it inside a view?

 .. is it also possible to show all useres current logged in(??)?

 Thanks in advance

 Michael

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Using Auth To Limit Results

2011-09-22 Thread elogic
Thanks, I agree. Simple is better at the moment. it seems to cover
everything I want.

Thanks for the replies.

On Sep 22, 5:41 pm, WebbedIT p...@webbedit.co.uk wrote:
 I don't see why this has to get any more complex than what Teddy
 suggested?  I have always stayed well clear of ACL as it was too
 complex for me to implement when first learning CakePHP and I've never
 needed more than standard Auth and User Groups in the many CakePHP
 sites I have developed since.

 @Thomas: I have however bookmarked that RMAC plugin for further
 reading - maybe I should go back and look at ACL some time too.

 HTH, Paul

 On Sep 21, 12:05 pm, Thomas Ploch profipl...@googlemail.com wrote:







  Taking that you are new to CakePHP this might be a bit too hard to
  digest, but I recommend at least reading this article:

 http://jmcneese.wordpress.com/2009/04/19/rmac-ftw-part-1/http://jmcne...

  This is implementing UNIX-style permissions for Model access, which is
  basically what you want.

  Kind regards
  Thomas

  Am 21.09.2011 11:28, schrieb elogic:

   Is there any quick / better way to use Auth to limit the results based
   on the users login details or is it just a matter of using if/else
   statments to get what you want.

   For example, I have a list of products which all have a group id
   assigned to them. Each user also has a group id. When the user is
   logged in they are to only show the products that matches their group
   id.

   I'm only new to cakephp and still do not know all the tricks or short
   cuts for things like this.

   Thankyou

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Using Auth To Limit Results

2011-09-21 Thread elogic
Is there any quick / better way to use Auth to limit the results based
on the users login details or is it just a matter of using if/else
statments to get what you want.

For example, I have a list of products which all have a group id
assigned to them. Each user also has a group id. When the user is
logged in they are to only show the products that matches their group
id.

I'm only new to cakephp and still do not know all the tricks or short
cuts for things like this.

Thankyou

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


cakedc search plugin - PHP notice on like-field with encode=true

2011-09-21 Thread elogic
Hi All,

I am having the exact problem as mentioned in the below post. It says
the ticket has been resolved however I have the latest copy and the
same issue is happening.

Anyone know the fit for this?

Thanks

ISSUE:
===
I have a like-field with encoding turned on:
Model:
var $filterArgs = array(
array('name' = 'name', 'type' = 'like')
);

Controller:
var $presetVars = array(
array('field' = 'name', 'type' = 'value', 'encode' = true)
);

And recieve the following notice when submitting the search form with
an empty name field:
Undefined index: name [APP/plugins/search/controllers/components/
prg.php, line 76]

If I turn off encoding no notice appears.

==
SOURCE: 
http://cakedc.lighthouseapp.com/projects/59618/tickets/4-php-notice-on-like-field-with-encodingtrue

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


dc search plugin - searching with backslash

2011-09-13 Thread elogic
Hi All,

I have the dc search plugin running well on my site, one field however
is an address field and has a lot of 3/123 sample st etc in them. When
the backslash is put in the search won't work. It ignores everything
after the backslash.

Any ideas how to get around this?

Thanks

SOURCE: http://cakedc.com/downloads/view/cakephp_search_plugin

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Convert native PHP class into cakePHP component

2011-09-06 Thread elogic
Hi All,

I am only new to cakePHP and am learning slowly (but loving it). I
have been given a pre-built class and some basic instructions on how
to use it from our SMS provider (it works very well and easily with
native PHP).

I need to convert the class into something that I can easily use
within cakePHP sites. Am I right in assuming I want to convert it into
a component? If not what would you suggest?

Are there any tutorials around that might help me complete my task? I
presume it shouldn't be too hard at all once I know what I am doing.

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Convert native PHP class into cakePHP component

2011-09-06 Thread elogic
Thankyou so much for the information. Sounds just like what I was
after.

Cheers!



On Sep 6, 5:33 pm, Teddy Zeenny teddyzee...@gmail.com wrote:
 I think it's better not to change a pre-built class (in case they perform
 updates to it or fix any bugs you wouldn't be able to make use of them).

 This is why CakePHP has the vendors system.  You simply place your
 pre-built class in your vendors folder and call it from your application.
 For example:

 App::import('Vendor','SmsPHP');
 $sms_php=new SmsPHP();

 What I would also do is create a component that simply interacts with this
 class.
 For example create a component called SmsCakeComponent, and inside the
 component import the class from vendors and call it's functions.
 The reason why I'd create a component would be to abstract the vendor class
 away from my application, in that case if I want to switch classes I would
 only need to fix my component instead of fixing the entire application,
 therefore making my component act as an interface between my application
 and the vendor class.

 I hope I wasn't very confusing  :)

 Anyway, here's a link from the CakePHP book that might help you get started
 with vendors:http://book.cakephp.org/view/943/Loading-Vendor-Files

 Teddy







 On Tue, Sep 6, 2011 at 9:03 AM, elogic asymo...@elogicmedia.com.au wrote:
  Hi All,

  I am only new to cakePHP and am learning slowly (but loving it). I
  have been given a pre-built class and some basic instructions on how
  to use it from our SMS provider (it works very well and easily with
  native PHP).

  I need to convert the class into something that I can easily use
  within cakePHP sites. Am I right in assuming I want to convert it into
  a component? If not what would you suggest?

  Are there any tutorials around that might help me complete my task? I
  presume it shouldn't be too hard at all once I know what I am doing.

  Thanks

  --
  Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
  Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
  others with their CakePHP related questions.

  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group
  athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


database design help - menu, menu items and controllers within

2011-07-19 Thread elogic
Hello,

I am having some issues setting up the database for my base CMS to use
for all clients. My thoughts were to have the following:

blocks table - this is simply the html, title, description etc for
each page (i.e. home, about us)
menus table - simply contains the menu name (i.e. top navigation or
footer links etc)
menu_items table - this would contain the menu_id, the parent_id (from
this same table), the title of the link in the menu and then there
would be a controller field which would contain the name of the
controller i.e. blocks and then the next field to contain the actual
block id such as the home id for the link.

This is how I can see that I can easily add additional controllers
such as galleries, pdfs, blogs etc and they could be within the menus
quite easily by adding in contoller = pdfs, controller_id = 3 (the
pdf id or whatever)

Below is the SQL I have come up with, I wanted to get some advise to
see if there was an easy way or better way to do this. Ideally I want
to be able to generate the list of controllers on the add/edit field
and then their assigning ids when adding menu_items.

Thankyou



CREATE TABLE IF NOT EXISTS `blocks` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(150) NOT NULL,
  `title` varchar(150) DEFAULT NULL,
  `show_title` tinyint(1) DEFAULT '1',
  `content` longtext,
  `metadescription` text,
  `metakeywords` text,
  `stepback` longtext,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

# Data exporting was unselected.


# Dumping structure for table siteadmin.menus
CREATE TABLE IF NOT EXISTS `menus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

# Data exporting was unselected.


# Dumping structure for table siteadmin.menu_items
CREATE TABLE IF NOT EXISTS `menu_items` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `menu_id` int(11) DEFAULT NULL,
  `parent_id` int(11) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `controller` varchar(255) DEFAULT NULL,
  `controller_id` int(11) DEFAULT NULL,
  `published` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

==

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


data from models onto pages.. e.g. /pages/home etc

2011-07-08 Thread elogic
Hi All,

How do I go about calling data from models within my system onto the
standard pages? I have built an intranet with models such as accounts,
users, groups, properties and now I want to create a dashboard /
homepage (it is /pages/dashboard). I have the blank page but I want to
call stuff from those other models on to this page.

How do I do this?

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: editing multiple records with beforesave. beforesave working but data not updating

2011-07-08 Thread elogic
I worked this one out. I had the beforesave within the accounts model
while it should have been in the users model seeing that is where the
data was being saved.

Easy really but as I only just started cakephp there are many things
like this I am yet to understand.

Thanks



On Jul 7, 3:36 pm, elogic asymo...@elogicmedia.com.au wrote:
 Hi All,

 I am having some issues with the following: I have 2 tables that I
 have saving data to, accounts and users. I need to save the password
 field within users as MD5 and so I am usingbeforesavefunction in my
 model. It seems to be ignoring it though. Any ideas how I can go about
 this?

 ACCOUNT model
 
 functionbeforeSave() {
    if ($this-data['User'][0]['password'])
    {
                 $this-data['User'][0]['password'] = 
 md5($this-data['User'][0]
 ['password']);
                 echo $this-data['User'][0]['password'];
    }
    return true;}

 ---

 NOTE: Above I have echo $this-data['User'][0]['password'], this is
 printing out the encrypted password...

 ACCOUNT controller
 --

         function edit($id = null) {
                 if (!$id  empty($this-data)) {
                         $this-Session-setFlash(__('Invalid account', true));
                         $this-redirect(array('action' = 'index'));
                 }
                 if (!empty($this-data))
                 {
                         if ($this-Account-save($this-data))
                         {
                                 $this-data['User'][0]['account_id'] = 
 $this-Account-id;
                                 $this-Account-User-save($this-data);

                                 $this-Session-setFlash(__('The account has 
 been saved', true));
                                 echo pre;
                                 print_r($this-data);
                                 echo /pre;
                                 //$this-redirect(array('action' = 'index'));
                         } else {
                                 $this-Session-setFlash(__('The account 
 could not be saved.
 Please, try again.', true));
                         }
                 }
                 if (empty($this-data)) {
                         $this-data = $this-Account-read(null, $id);
                 }
                 //$users = $this-Account-User-find('list');
                 //$this-set(compact('users'));
         }
 
 NOTE: by this stage the password is back to the unencrypted way...
 (when I call the print_r($this-data);)

 Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: upload and import csv to mysql

2011-07-07 Thread elogic
Thankyou for your reply. I only started cakePHP a week or so ago and
am struggling a bit. I really haven't found a sample / tutorial online
that shows and works with what I need it too. Any direction you could
point me in would be appreciated.

Thanks again..



On Jul 6, 4:53 pm, Vulinux f.roett...@gmail.com wrote:
 Hi elogic,

 where exactly is your error or aren't you able to find a concept for
 your import?

 The way I did this once: Build a Behavior that is able to build an
 Object from the imported Csv Data (File Class is your friend). Then
 Import the data, call the Csv to Object method and save it to the
 database.

 Kind regards,
 Vulinux

 On 6 Jul., 04:09, elogic asymo...@elogicmedia.com.au wrote:







  Hi All,

  I have setup a file upload feature for my application using the below
  plugin. Now that I have the csv uploading using an upload controller
  and model I now need to insert the csv into a mysql table. I haven't
  had much luck with the samples I have found online. Does anyone know
  how I can do this? I can get my client to name the fields however it
  needs to be done so that isn't an issue.

  MY UPLOADS_CONTROLLER
  -
  class UploadsController extends AppController
  {

          var $name = 'Uploads';

          // CSV UPLOAD
          // 
  --

          function upload() {

                          if (!empty($this-data))
                          {
                                  $this-Upload-create();
                                  if($this-Upload-save($this-data))
                                  {
                                          $this-Session-setFlash(__('The 
  file has been saved', true));
                                          //print_r($this-data);
                                          $thefilename =  
  $this-data['Upload']['file']['name'];
                                          echo $thefilename; // the uploaded 
  CSV FILE NAME!

                                          // TO DO PROCESS UPLOADED FILE INTO 
  PROPERTIES DATABSE
                                  }
                                  else
                                  {
                                          $this-Session-setFlash(__('The 
  file could not be saved. Please,
  try again.', true));
                                  }

                          }
          }

  }

  

  MY UPLOADS MODEL
  -
  ?php
  class Upload extends AppModel {
  var $name = 'Upload';
  var $actsAs = array(
            'FileUpload.FileUpload' = array(
                  'uploadDir' = 'files',
                  'forceWebroot' = true, //if false, uploads will be saved to
                                                                              
       //the uploadDir as a direct path.
                                                                              
       //default: true
                  /*
                  'fields' = array(
                    'name' = 'file_name',
                    'type' = 'file_type',
                    'size' = 'file_size'
                  ),
                  */
                  'allowedTypes' = array(
                    'csv' = array('text/csv', 'application/csv')
                  ),
                  'maxFileSize' = '100', //in bytes
                  'unique' = false, //uploaded files will overwrite existing 
  files
                  'fileNameFunction' = false, //execute sha1 on fileName if 
  required,
  not though
            )
          );}

  --

  Thanks

  FILE UPLOAD 
  PLUGIN:http://www.webtechnick.com/blogs/view/221/CakePHP_File_Upload_Plugin

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: find data in index view foreach loop

2011-07-06 Thread elogic
Thankyou, how would I go about calling it within the properties view
foreach loop?

I tried this:
 $estate_name = $this-getEstateName($property['Property']
['estate_id']);

and then I tried:
echo getEstateName($property['Property']['estate_id']);


but both times I got errors like this:
Call to undefined method View::getEstateName()

My properties controller file has this now:
public function getEstateName($accountId)
{
return $this-Property-User-find('first', array('conditions' 
=
array('Account.id' = $accountId), 'fields' =
array('Account.first_name', 'Account.last_name')));
}


Thanks


On Jul 6, 5:06 pm, Vulinux f.roett...@gmail.com wrote:
 Hi elogic,

 since your methods for getting estate- and staff names are supposed to
 be called more than once, I would recommend to outsource your code
 into model methods, so you can easily call them from your controller
 and don't have any code repitition.

 /*
  * @param int $accountId: The Account Id to be looked for
  */

 public function getEstateName ($accountId)
 {
   return $this-Property-User-find('first', array('conditions'
      = array('Account.id' = $accountId),
 'fields' = array('Account.first_name', 'Account.last_name')));

 }

 Same with the staff names. You can then call it in all of your
 controller functions and use the data for ... stuff.

 Kind regards,
 Vulinux

 On 6 Jul., 06:13, elogic asymo...@elogicmedia.com.au wrote:







  Hi All,

  I have on my view page of properties in the controller which is
  working as I want it to.

  // GET THE ESTATE AND STAFF NAMES
  $estate_name = $this-Property-User-find('first', array('conditions'
  = array('Account.id' = $this-Property-field('estate_id')),
  'fields' = array('Account.first_name', 'Account.last_name')));
  $staff_name = $this-Property-User-find('first', array('conditions'
  = array('Account.id' = $this-Property-field('staff_id')), 'fields'
  = array('Account.first_name', 'Account.last_name')));
  $this-set(compact('estate_name','staff_name'));

  (Call them like: ?php echo $estate_name['Account']['first_name'] . '
  ' . $estate_name['Account']['last_name']; ?)

  I somehow need to get this same data on the index view within a for
  loop for each row, how would I go about this? The estate_name and
  staff_name need to be found for each record down the page.

  Thankyou

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


editing multiple records with beforesave. beforesave working but data not updating

2011-07-06 Thread elogic
Hi All,

I am having some issues with the following: I have 2 tables that I
have saving data to, accounts and users. I need to save the password
field within users as MD5 and so I am using beforesave function in my
model. It seems to be ignoring it though. Any ideas how I can go about
this?

ACCOUNT model

function beforeSave() {
   if ($this-data['User'][0]['password'])
   {
$this-data['User'][0]['password'] = md5($this-data['User'][0]
['password']);
echo $this-data['User'][0]['password'];
   }
   return true;
}
---

NOTE: Above I have echo $this-data['User'][0]['password'], this is
printing out the encrypted password...

ACCOUNT controller
--

function edit($id = null) {
if (!$id  empty($this-data)) {
$this-Session-setFlash(__('Invalid account', true));
$this-redirect(array('action' = 'index'));
}
if (!empty($this-data))
{
if ($this-Account-save($this-data))
{
$this-data['User'][0]['account_id'] = 
$this-Account-id;
$this-Account-User-save($this-data);

$this-Session-setFlash(__('The account has 
been saved', true));
echo pre;
print_r($this-data);
echo /pre;
//$this-redirect(array('action' = 'index'));
} else {
$this-Session-setFlash(__('The account could 
not be saved.
Please, try again.', true));
}
}
if (empty($this-data)) {
$this-data = $this-Account-read(null, $id);
}
//$users = $this-Account-User-find('list');
//$this-set(compact('users'));
}

NOTE: by this stage the password is back to the unencrypted way...
(when I call the print_r($this-data);)


Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: retrieving data from multiple tables for dropdown

2011-07-05 Thread elogic
Thankyou for your reply. I tried that but I got an error, I then
however put the following into the properties controller and it looks
like I am closer but it still isn't quite right.

$estates = $this-Property-User-find('all', array('conditions' =
array('User.group_id' = 4), 'fields' = array( 'Account.id',
'Account.first_name')));

The select is producing the following code now:

div class=input selectlabel for=PropertyEstateIdEstate/
labelselect name=data[Property][estate_id] id=PropertyEstateId
option value=/option

option value=first_nameestate/option
option value=id9/option
optgroup label=Account
/optgroupoptgroup label=1
/optgroup
option value=first_nameestatexyz/option
option value=id10/option
optgroup label=Account
/optgroup
optgroup label=2
/optgroup
option value=first_nameestateklaka/option

option value=id11/option
optgroup label=Account
/optgroup
optgroup label=3
/optgroup
option value=first_nameqq2/option
option value=id24/option
optgroup label=Account
/optgroup
/select/div

Ideally i want the first and last name as the option display and the
id as the value.

Thanks


On Jul 5, 5:30 am, Vulinux f.roett...@gmail.com wrote:
 Hi elogic.

 Since both, Account and Property, belong to User, it should be as easy
 as follows:

 In your UsersController (app/controllers/users_controller.php), just
 do

  $this-User-find('all', array('conditions' = array('Users.group_id'
 = 4)));

 The method find('all') will then return all the associated data of
 your User Object.

 Kind regards,
 Vulinux

 On 5 Jul., 06:17, elogic asymo...@elogicmedia.com.au wrote:







  Hi All,

  I have 3 tables, accounts, users, properties. Within the properties
  add / edit pages I need to populate two select dropdowns with data
  from the accounts table however I am not sure how to go about this.

  TABLE INFO (basics)

  ACCOUNTS
  id
  first_name
  last_name

  USERS
  id
  username
  password
  account_id
  group_id

  PROPERTIES
  id
  name
  staff_id
  estate_id

  So both staff_id and estate_id need to have selects using the id
  first_name and last_name from ACCOUNTS but staff_id will be where
  group_id in users equals 3 and estate_id = 4.

  The basic SQL should be as follows:

  SELECT accounts.`id`, accounts.`first_name`, accounts.`last_name` FROM
  accounts, users WHERE accounts.`id` = users.account_id AND
  users.`group_id` = 4

  Any ideas how I can go about getting this data within my properties
  controller? I've googled around but I think I am more confused now
  then before.

  Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


upload and import csv to mysql

2011-07-05 Thread elogic
Hi All,

I have setup a file upload feature for my application using the below
plugin. Now that I have the csv uploading using an upload controller
and model I now need to insert the csv into a mysql table. I haven't
had much luck with the samples I have found online. Does anyone know
how I can do this? I can get my client to name the fields however it
needs to be done so that isn't an issue.


MY UPLOADS_CONTROLLER
-
class UploadsController extends AppController
{

var $name = 'Uploads';

// CSV UPLOAD
// --

function upload() {

if (!empty($this-data))
{
$this-Upload-create();
if($this-Upload-save($this-data))
{
$this-Session-setFlash(__('The file 
has been saved', true));
//print_r($this-data);
$thefilename =  
$this-data['Upload']['file']['name'];
echo $thefilename; // the uploaded CSV 
FILE NAME!


// TO DO PROCESS UPLOADED FILE INTO 
PROPERTIES DATABSE
}
else
{
$this-Session-setFlash(__('The file 
could not be saved. Please,
try again.', true));
}

}
}

}


MY UPLOADS MODEL
-
?php
class Upload extends AppModel {
var $name = 'Upload';
var $actsAs = array(
  'FileUpload.FileUpload' = array(
'uploadDir' = 'files',
'forceWebroot' = true, //if false, uploads will be saved to

 //the uploadDir as a direct path.

 //default: true
/*
'fields' = array(
  'name' = 'file_name',
  'type' = 'file_type',
  'size' = 'file_size'
),
*/
'allowedTypes' = array(
  'csv' = array('text/csv', 'application/csv')
),
'maxFileSize' = '100', //in bytes
'unique' = false, //uploaded files will overwrite existing 
files
'fileNameFunction' = false, //execute sha1 on fileName if 
required,
not though
  )
);
}
--


Thanks




FILE UPLOAD PLUGIN: 
http://www.webtechnick.com/blogs/view/221/CakePHP_File_Upload_Plugin

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


find data in index view foreach loop

2011-07-05 Thread elogic
Hi All,

I have on my view page of properties in the controller which is
working as I want it to.


// GET THE ESTATE AND STAFF NAMES
$estate_name = $this-Property-User-find('first', array('conditions'
= array('Account.id' = $this-Property-field('estate_id')),
'fields' = array('Account.first_name', 'Account.last_name')));
$staff_name = $this-Property-User-find('first', array('conditions'
= array('Account.id' = $this-Property-field('staff_id')), 'fields'
= array('Account.first_name', 'Account.last_name')));
$this-set(compact('estate_name','staff_name'));

(Call them like: ?php echo $estate_name['Account']['first_name'] . '
' . $estate_name['Account']['last_name']; ?)


I somehow need to get this same data on the index view within a for
loop for each row, how would I go about this? The estate_name and
staff_name need to be found for each record down the page.

Thankyou

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


retrieving data from multiple tables for dropdown

2011-07-04 Thread elogic
Hi All,

I have 3 tables, accounts, users, properties. Within the properties
add / edit pages I need to populate two select dropdowns with data
from the accounts table however I am not sure how to go about this.

TABLE INFO (basics)

ACCOUNTS
id
first_name
last_name

USERS
id
username
password
account_id
group_id

PROPERTIES
id
name
staff_id
estate_id


So both staff_id and estate_id need to have selects using the id
first_name and last_name from ACCOUNTS but staff_id will be where
group_id in users equals 3 and estate_id = 4.

The basic SQL should be as follows:

SELECT accounts.`id`, accounts.`first_name`, accounts.`last_name` FROM
accounts, users WHERE accounts.`id` = users.account_id AND
users.`group_id` = 4

Any ideas how I can go about getting this data within my properties
controller? I've googled around but I think I am more confused now
then before.

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


cakePHP - Base Web App Distribution With Role Based Levels

2011-06-29 Thread elogic
Hi All,

I have just started with cakePHP, I have been able to get my head
around creating my own modules however I am having trouble with ACL or
role based user account levels. I was wondering if there was somewhere
online a downloaded base install for a web application with cakePHP
and user levels setup. Then I would be able to simply start creating
the custom modules I need without having to worry about the base work.
Ideally I would have liked to set this up myself but time is now short
and I need to get started ASAP.

I found cakeplate: http://cakeplate.posterous.com/launching-cakeplate
which is on the right track but it doesn't have anything such as users
and groups etc that I am looking for.

Thankyou

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php