Pagination Sort

2010-05-03 Thread sijo jose
Hi guys,

I have this model Structure -

Model 1 - Union

var $belongsTo = array(
'Address' => array(
'className' => 'Address',
'foreignKey' => 'address_id',
'conditions' => '',
'fields' => '',
'order' => ''
) );


Model 2 - Address

var $belongsTo = array(
'District' => array(
'className' => 'District',
'foreignKey' => 'district_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);

Model 3  District.
 with fields name and code both varchar.


Now I would like to paginate the Unions which should be ordered in ASC by
Union.Address.District.name ASC

Is that possible and if so how should i write the paginate.

Urgent help need. I am stuck here.





Regards,
-- 
Sijo Jose Chakramakkil

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: 404 error when I call controller

2010-05-03 Thread John Andersen
Disregard my last! Early in the morning, my sleepy eyes didn't see the
route!
Sorry for the inconvenience,
   John

On May 4, 9:38 am, John Andersen  wrote:
> Your controllers name is Logins, which means that in your URL you must
> use logins, not login!
> Enjoy,
>    John
[snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: 404 error when I call controller

2010-05-03 Thread John Andersen
Your controllers name is Logins, which means that in your URL you must
use logins, not login!
Enjoy,
   John

On May 3, 5:49 pm, gannher  wrote:
> Hello
>
> I am trying to build a controller but when i call it, i have a 404
> code error.
>
> Here the controller "logins":
>
>  class LoginsController extends AppController {
>         var $name = 'Logins';
>         var $uses = '';
>         public function display() {
>
>         }
>
> }
>
> ?>
>
> Here routes.php:
>
> Router::connect('/', array('controller' => 'homes', 'action' =>
> 'index'));
> Router::connect('/login', array('controller' => 'logins', 'action' =>
> 'display'));
>
> I try to call my controller with this url:
>
> http://www.my_url/login
>
> Log of apache (error.log):
> [Mon May 03 18:38:50 2010] [error] [client ] File does not
> exist: /home/cake/app/webroot/login, referer: 
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Displyaing two models data in a view

2010-05-03 Thread aveev

Thanks for your pointer.. 
I've tried using saveAll method to save parent and related models. and it
works..
Trying to look at containable behavior now...


Jeremy Burns wrote:
> 
> Rather than walk through your code correcting it, I can give some hints
> and point you at the guide - because the answers are all there and it is
> the best way of learning.
> 
> 1) You need to link your models appropriately:
> http://book.cakephp.org/view/1039/Associations-Linking-Models-Together
> 2) When you have done that, you can build an array in your controller that
> contains all of the data you need by doing the right find:
> http://book.cakephp.org/view/1017/Retrieving-Your-Data. Also look at the
> Containable behaviour because it will help you build the right find:
> http://book.cakephp.org/view/1323/Containable
> 3) When you do this, your array will have elements for each model
> 4) When you create the view, name the form inputs with the matching model
> name and field name (e.g. $this->Form->input('Model.field_name');
> 5) When the form data is submitted you'll see that $this->data is a
> structured array with elements named after your models.
> 6) Save the data using the correct save method; saveAll if the array is
> structured correctly or by looping through your $this->data and using save
> as many times as you need:
> http://book.cakephp.org/view/1031/Saving-Your-Data. Pay attention to the
> array format expected by each different save method because they are not
> all the same.
> 
> Jeremy Burns
> jeremybu...@me.com
> 
> 
> On 30 Apr 2010, at 04:37, aveev wrote:
> 
>> 
>> Hi, I'm designing travel document application. Here's the process:
>> A person submits his/her data. Applicant data will be saved in applicants
>> table. 
>> For those whose data is already approved, the data will be saved in
>> approved_applicants table. 
>> After saving applicant data to approved_applicants table, we assign
>> him/her
>> a travel document by inserting a record in documents table with newly
>> created approved applicant id as foreign key
>> here are the related tables:
>> CREATE TABLE `applicants` (
>>  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
>>  `name` varchar(30) NOT NULL,
>>  `pob` varchar(25) DEFAULT NULL,
>>  `dob` date NOT NULL,
>>  `file_num` varchar(10) NOT NULL,
>>  PRIMARY KEY (`id`)
>> )
>> 
>> CREATE TABLE `documents` (
>>  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
>>  `document_number` varchar(10) NOT NULL,
>>  `approved_applicant_id` int(10) DEFAULT NULL,
>>  `status` varchar(15) DEFAULT NULL,
>>  `app_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
>> CURRENT_TIMESTAMP,
>>  `created` timestamp NOT NULL DEFAULT '-00-00 00:00:00',
>>  `modified` timestamp NOT NULL DEFAULT '-00-00 00:00:00',
>>  PRIMARY KEY (`id`)
>> ) 
>> 
>> CREATE TABLE `approved_applicants` (
>>  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
>>  `name` varchar(30) NOT NULL,
>>  `pob` varchar(25) DEFAULT NULL,
>>  `dob` date NOT NULL,
>>  `file_num` varchar(10) NOT NULL,
>>  PRIMARY KEY (`id`)
>> )
>> 
>> So what I want to ask is how I can display applicant data and travel
>> document in one page ?
>> If we submit this form. the applicant data will be saved to
>> approved_applicants table and a record in documents table will be
>> inserted.
>> 
>> What I've already done is I put this code in ApprovedApplicant controller
>> function result() {
>>  
>>  if(!empty($this->data)) {
>>  //is this the right way to pass document data to the 
>> view ?
>>  $docs =
>> $this->Document->find('first',array('conditions'=>array('Document.document_type_id'=>1,'status'=>'new'),
>> 'fields'=>array('MIN(document_number) as max_doc')));
>>  
>>  $this->set('docs',$docs);
>>  $this->data =
>> $this->Applicant->find('first',array('conditions'=>array('Applicant.reg_num'=>
>> $this->data['Applicant']['reg_num'])));
>>  } else {
>>  
>> $this->redirect(array('controller'=>'applicants','action'=>'search'));
>>  }
>>  }
>> 
>>  function process() {
>>  if(array_key_exists('confirm',$this->params['form'])) {
>>  //save applicant data to approved applicants 
>> table
>>  //insert new record in documents table with 
>> newly created approved
>> applicant id as foreign key
>>  }
>>  } else {
>>  
>>  }
>>  }
>> 
>> 
>> 
>> result.ctp
>> >  
>>  echo $form->create('Applicant', array('action'=>'process'));
>>  echo $form->input('name');
>>  echo $form->input('pob');
>>  echo $form->input('dob');
>>  echo $form->input('address');
>>  echo $form->submit('confirm', array('name'=>'confirm', 'div'=>false));
>>  echo $form->submit('cancel', array('name'=>'cancel', 'div'=>false));
>>  
>>  

Re: Simple assoication not working

2010-05-03 Thread Ed Propsner
Have another look at your naming conventions, most notably those for your
models.

http://book.cakephp.org/view/24/Model-and-Database-Conventions

On Mon, May 3, 2010 at 10:43 PM, Rodney Chan  wrote:

> I try to follow the example from a book called "CakePHP Application
> Development"
>
> I have created the following table under MySQL
> books(id, isbn, title, description, author_id)
> authors(id, name, email, website)
>
> And created 4 .php files:
>
> C:\xampp\htdocs\relationship\app\models\authors.php
>
>  class Author extends AppModel
> {
>  var $name = 'Author';
>  var $hasMany = 'Book';
> }
> ?>
>
> C:\xampp\htdocs\relationship\app\models\books.php
>
>  class Book extends AppModel
> {
>  var $name = 'Book';
>  var $belongsTo = 'Author';
> }
> ?>
>
> C:\xampp\htdocs\relationship\app\controllers\authors_controller.php
>
>  class AuthorsController extends AppController {
> var $name = 'Authors';
> var $scaffold;
> }
> ?>
>
> C:\xampp\htdocs\relationship\app\controllers\books_controller
>
>  class BooksController extends AppController {
>  var $name = 'Books';
>  var $scaffold;
> }
> ?>
>
> When I try to view the books (http://localhost/relationship/books),
> author column only shows author_id but not the author name.  Also,
> under edit screen, the combo box for pick up author name is empty.  I
> also tried to remove $hasMany and $belongsTo and the result is the
> same.  It seems that the $hasManay and $belongsTo has no effect at
> all.
>
> Is there anything I missed?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Editing Multiple Records - Problem with selected options

2010-05-03 Thread abocanegra
Well, the structure I wanted proved too difficult to update so I went
with the tag plugin instead.

i recommend checking it out.

http://sonnygauran.co.cc/blog/2010/03/28/cakephp-tags-plugin-documentation/

On May 3, 1:36 pm, abocanegra  wrote:
> the view is the problem, the tags should be a drop down and those
> selected should be, well selected. but that is only working in the
> edit view, and failing in the edit all view. in edit all it lists all
> the options but fails to select those that are already chosen for the
> record.
>
> On May 3, 5:24 am, Andrei Mita  wrote:
>
>
>
> > Your problem is in the view?
>
> > On Mon, May 3, 2010 at 3:15 PM,abocanegra wrote:
> > > I have created a multiple image upload that needs to have multiple
> > > records edited to add in content such as title and tags. When I do a
> > > regular edit it works fine, when I try to do the multiple edit the tag
> > > select function fails to load the selected options as it does in a
> > > regular edit. I have been struggling with this, any help would be
> > > appreciated.
>
> > >  Photo Controller
>
> > >        function edit($id = null) {
> > >                if (!$id && empty($this->data)) {
> > >                        $this->Session->setFlash(sprintf(__('Invalid %s',
> > > true), 'photo'));
> > >                        $this->redirect(array('action' => 'index'));
> > >                }
> > >                if (!empty($this->data)) {
> > >                        if ($this->Photo->save($this->data)) {
> > >                                $this->Session->setFlash(sprintf(__('The %s
> > > has been saved',
> > > true), 'photo'));
> > >                                $this->redirect(array('action' => 
> > > 'index'));
> > >                        } else {
> > >                                $this->Session->setFlash(sprintf(__('The %s
> > > could not be saved.
> > > Please, try again.', true), 'photo'));
> > >                        }
> > >                }
> > >                if (empty($this->data)) {
> > >                        $this->data = $this->Photo->read(null, $id);
> > >                }
> > >                $tags = $this->Photo->Tag->find('list', array('fields' =>
> > > array('Tag.tag')));
> > >                $this->set(compact('tags'));
> > >        }
>
> > > function editall() {
> > >   if(!empty($this->data)) {
> > >      $this->Photo->saveAll($this->data['Photo']);
> > >   }
> > >   else {
> > >      $this->data['Photo'] = Set::combine($this->Photo->find('all'),
> > > '{n}.Photo.id', '{n}.Photo');
> > >        }
> > >                $tags = $this->Photo->Tag->find('list', array('fields' =>
> > > array('Tag.tag')));
> > >                $this->set(compact('tags'));
> > > }
>
> > > /// Edit View
> > > 
> > > Form->create('Photo');?>
> > >        
> > >                 > > true)); ?> > > legend>
> > >         > >                echo $this->Form->input('id');
> > >                echo
> > > $html->image('../../../uploads/images/photography/small/' .
> > > $this->Form->value('Photo.image'));
> > >                echo $this->Form->input('title');
> > >                echo $this->Form->input('image');
> > >                echo $this->Form->input('client');
> > >                echo $this->Form->input('description');
> > >                echo $this->Form->input('Tag');
> > >        ?>
> > >        
> > > Form->end(__('Submit', true));?>
> > > 
>
> > > / Edit View Output
> > > 
> > > Tag
> > > 
> > > 
> > > Jewelery
> > > Headshot
> > > Product
> > > Location
> > > Travel
> > > Art
> > > HDR
> > > 
>
> > > /// Edit All View
> > > 
> > > create('Photo', array('action'=>'editall'));?>
> > >        
> > >                 > > true)); ?
> > > >
> > >  > > foreach($this->data['Photo'] as $key => $value) {
> > >        echo '' . "\n";
>
> > >    echo $form->input('Photo.'.$key.'.id') . "\n";
> > >        echo $html->image('../../../uploads/images/photography/small/' .
> > > $this->Form->value('Photo.'.$key.'.image')) . "\n";
> > >    echo $form->input('Photo.'.$key.'.title') . "\n";
> > >        echo $form->input('Photo.'.$key.'.client') . "\n";
> > >        echo $form->input('Photo.'.$key.'.description') . "\n";
> > >        echo $form->input('Tag.'.$key.'.tag') . "\n";
> > >        echo '' . "\n";
> > > }
> > > ?>
> > > 
> > > end('Save All Photos');?>
> > > 
>
> > > / Edit All Output
> > > (for only on entry)
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
>
> > > Edit All Photos
> > > 
> > >  > > id="Photo7Id" />
> > > 
> > > 
> > > Title
> > >  > > value="testint" id="Photo7Title" />
> > > 
> > > 
> > > Client
> > >  > > value="test" id="Photo7Client" />
> > > 
> > > 
> > > Description
> > >  > > id="Photo7Description" >test
> > > 
> > > 
> > > Tag
> > > 
> > > Jewelery
> > > Headshot
> > > Product
> > > Location
>

Re: Implementing uploadify - File upload issue - param definitions issue

2010-05-03 Thread abocanegra
I forgot to mention this belongs in the photosController

function beforeFilter() {
if ($this->action == 'upload') {
$this->Session->id($this->params['pass'][0]);
$this->Session->start();
}
parent::beforeFilter();
}


On May 3, 1:03 pm, Sam Sherlock  wrote:
> Hi Miles,
>
> have you tried to use your uploader with uploadify or swfupload?
>
> @abocanegra
>
> I mean that the user is logged in through auth.  I think that the follow up
> requests that uploadify uses to check success of queued items are passed
> with out Session ID (appened to query string) and so the auth session is
> terminated by the time the uploads are complete
>
> - S
>
> On 3 May 2010 18:04, Miles J  wrote:
>
> > It would be better to actually use an uploader that was built for
> > Cake.
>
> >http://github.com/milesj/uploader
>
> > On May 3, 5:28 am, abocanegra  wrote:
> > > Could you clarify what you mean by admin routing. I have it working
> > > solidly in my multi-user admin system. I have chosen to save the data
> > > outside of the cakePHP admin section for this specific project. I have
> > > everything routing based on roles. Sorry i am unclear on some
> > > terminology, if you can clarify the question,  can answer.
>
> > > Below is the image.php component code I have altered for my own
> > > purposes including the ability to work with single or multi-image
> > > upload (uploadify)
>
> > > /// image.php
>
> > >  > > /*
> > >  File: /app/controllers/components/image.php
> > > */
> > > class ImageComponent extends Object
> > > {
> > >  /*
> > >  * Uploads an image and its thumbnail into $folderName/big and
> > > $folderName/small respectivley.
> > >  *  Also uploads a zoom cropped image into $folderName/home. You could
> > > easily modify it to suit your needs!
>
> > >  *  Directions:
> > >  * In view where you upload the image, make sure your form creation is
> > > similar to the following
> > >  * create('FurnitureSet',array('type' => 'file')); ?>
>
> > >  * In view where you upload the image, make sure that you have a file
> > > input similar to the following
> > >  * file('Image/name1'); ?>
>
> > >  * In the controller, add the component to your components array
> > >  * var $components = array("Image");
>
> > >  * In your controller action (the parameters are expained below)
> > >  * $image_path =
> > $this->Image->upload_image_and_thumbnail($this->data,"name1", 573,380,80,80,
> > "sets");
>
> > >  * this returns the file name of the result image.  You can  store
> > > this file name in the database
> > >  *
> > >  * Note that your image will be stored in 3 locations:
> > >  * Image: /webroot/img/$folderName/big/$image_path
> > >  * Thumbnail:  /webroot/img/$folderName/small/$image_path
> > >  * Homepage:  /webroot/img/$folderName/home/$image_path
> > >  *
> > >  * You could easily add more locations or remove locations you don't
> > > need
>
> > >  * Finally in the view where you want to see the images
> > >  * image('sets/big/'.$furnitureSet['FurnitureSet']
> > > ['image_path']);
> > >  *  where "sets" is the folder name we saved our pictures in, and
> > > $furnitureSet['FurnitureSet']['image_path'] is the file name we stored
> > > in the database
>
> > >  * Parameters:
> > >  * $data: CakePHP data array from the form
> > >  * $datakey: key in the $data array. If you used  > $form->file('Image/name1'); ?> in your view, then $datakey = name1
>
> > >  * $maxw: the maximum width that you want your picture to be resized
> > > to
> > >  * $maxh: the maximum width that you want your picture to be resized
> > > to
> > >  * $thumbscalew: the maximum width hat you want your thumbnail to be
> > > resized to
> > >  * $thumbscaleh: the maximum height that you want your thumbnail to be
> > > resized to
> > >  * $folderName: the name of the parent folder of the images. The
> > > images will be stored to /webroot/img/$folderName/big/ and  /webroot/
> > > img/$folderName/small/
> > >  */
> > >  function upload_image_and_thumbnail($data, $datakey, $maxw, $maxh,
> > > $thumbscalew, $thumbscaleh, $folderName, $multi) {
> > >         if($multi == false){
> > >         $dName = $data['Image'][$datakey]['name'];
> > >         $dTempName = $data['Image'][$datakey]['tmp_name'];
> > >         }else if($multi == true){
> > >         $dName = $datakey;
> > >         $dTempName = $data;
> > >         }
> > >         if(strlen($dName)>4){
> > >         $error = 0;
> > >          $homedir = "../../../uploads";
> > >          if(!is_dir($homedir)){mkdir($homedir, 0777, true);}
> > >      $tempuploaddir = $homedir . "/temp"; // the /temp/ directory,
> > > should delete the image after we upload
> > >          if(!is_dir($tempuploaddir)){mkdir($tempuploaddir, 0777, true);}
> > >      $homeuploaddir = $homedir."/images/".$folderName."/home"; // the /
> > > home/ directory
> > >          if(!is_dir($homeuploaddir)){ mkdir($homeuploaddir , 0777,
> > > true);}  // o

Simple assoication not working

2010-05-03 Thread Rodney Chan
I try to follow the example from a book called "CakePHP Application
Development"

I have created the following table under MySQL
books(id, isbn, title, description, author_id)
authors(id, name, email, website)

And created 4 .php files:

C:\xampp\htdocs\relationship\app\models\authors.php



C:\xampp\htdocs\relationship\app\models\books.php



C:\xampp\htdocs\relationship\app\controllers\authors_controller.php



C:\xampp\htdocs\relationship\app\controllers\books_controller



When I try to view the books (http://localhost/relationship/books),
author column only shows author_id but not the author name.  Also,
under edit screen, the combo box for pick up author name is empty.  I
also tried to remove $hasMany and $belongsTo and the result is the
same.  It seems that the $hasManay and $belongsTo has no effect at
all.

Is there anything I missed?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Multiple Undo/Redo!!

2010-05-03 Thread Mike
Hey Jason, you have an interesting idea and done some nice work.  I
had to do something similar in the past as well.  How I approached it
was to add a version to my model and then everytime the model was
saved, re-save the entire model and increment the version number .

Mike

On May 2, 8:53 pm, paws_galuten  wrote:
> Hey everyone. I've written some code that I'd love to get some
> feedback on. I have posted an "article" here:
>
> http://www.galuten.com/jason/Undo.rtf
>
> It's a bit involved but I think it could be very useful if developed
> further!
>
> Thanks for your attention...
> Jason
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Sessions working in one controller and not the other

2010-05-03 Thread LordZardeck
Ok, I found out that the problem arises when I use a model. When I set
the $uses varibale to an empty array, it works. What would cause this?

On May 3, 6:21 pm, thatsgreat2345  wrote:
> Include the session component
>
> On May 3, 3:59 pm, LordZardeck  wrote:
>
>
>
>
>
> > For some reason, the session handling works in one controller and not
> > the other. I can't figure out why. I am using CakePHP 1.2.5.
>
> > //
> > //Does work
> > //
>
> > sessions_controller.php:
>
> > class SessionsController extends AppController {
> >     var $name = "Sessions";
> >     var $layout = "ajax";
> >     var $uses = array();
>
> >     function create(){
> >         if($this->Session->read('Data') == null){
> >             $this->Session->write('Data', rand());
> >         }
> >         $this->set('data', $this->Session->read('Data'));
> >         $this->set('SessionID', $this->Session->id());
> >     }
>
> > }
>
> > create.ctp:
> > $msgJson["SessionID"] = $SessionID;
> > $msgJson["data"] = $data;
> > echo json_encode($msgJson);
> > //results in ({"SessionID":"sd8s8o32edmjnjt94ouse99fd2","data":19409})
> > every time (parenthesis not in result)
>
> > //
> > //Doesn't Work
> > //
>
> > messages_controller.php:
>
> > class MessagesController extends AppController {
>
> >     var $name = 'Messages';
> >     var $layout = "ajax";
>
> >     function listMessages() {
> >         if($this->Session->read('Data') == null){
> >             $this->Session->write('Data', rand());
> >         }
> >         $this->set('data', $this->Session->read('Data'));
> >         $this->set('SessionID', $this->Session->id());
> >         $this->set('messages', $this->Message->find("all",
> > array("order"=>"priority ASC")));
> >     }
>
> > }
>
> > list_messages.ctp:
>
> > $msgJson["count"] = count($messages);
> > $msgJson["SessionID"] = $SessionID;
> > $msgJson["SessionData"] = $data;
> > foreach($messages as $message){
> >     $msg[] = $message["Message"];}
>
> > $msgJson["items"] = $msg;
> > echo json_encode($msgJson);
> > /*
> > results in ({"count":3,"SessionID":"","SessionData":27384,"items":
> > [{"id":"4","priority":"3","subject":"Another
> > message","message":"adsfasdf"},
> > {"id":"2","priority":"3","subject":"testing again","message":"just
> > seeing ow "},
> > {"id":"7","priority":"3","subject":"asdgasdg","message":"asdfasdfasd"}]})
> > except the SessionData changes everytime and the SessionID never shows
> > up.
> > */
>
> > Any ideas what might be wrong?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en- Hide quoted text -
>
> - Show quoted text -

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Sessions working in one controller and not the other

2010-05-03 Thread LordZardeck
Also, shouldn't there be an error if I try to use the Session
component when it isn't included?

On May 3, 6:21 pm, thatsgreat2345  wrote:
> Include the session component
>
> On May 3, 3:59 pm, LordZardeck  wrote:
>
>
>
>
>
> > For some reason, the session handling works in one controller and not
> > the other. I can't figure out why. I am using CakePHP 1.2.5.
>
> > //
> > //Does work
> > //
>
> > sessions_controller.php:
>
> > class SessionsController extends AppController {
> >     var $name = "Sessions";
> >     var $layout = "ajax";
> >     var $uses = array();
>
> >     function create(){
> >         if($this->Session->read('Data') == null){
> >             $this->Session->write('Data', rand());
> >         }
> >         $this->set('data', $this->Session->read('Data'));
> >         $this->set('SessionID', $this->Session->id());
> >     }
>
> > }
>
> > create.ctp:
> > $msgJson["SessionID"] = $SessionID;
> > $msgJson["data"] = $data;
> > echo json_encode($msgJson);
> > //results in ({"SessionID":"sd8s8o32edmjnjt94ouse99fd2","data":19409})
> > every time (parenthesis not in result)
>
> > //
> > //Doesn't Work
> > //
>
> > messages_controller.php:
>
> > class MessagesController extends AppController {
>
> >     var $name = 'Messages';
> >     var $layout = "ajax";
>
> >     function listMessages() {
> >         if($this->Session->read('Data') == null){
> >             $this->Session->write('Data', rand());
> >         }
> >         $this->set('data', $this->Session->read('Data'));
> >         $this->set('SessionID', $this->Session->id());
> >         $this->set('messages', $this->Message->find("all",
> > array("order"=>"priority ASC")));
> >     }
>
> > }
>
> > list_messages.ctp:
>
> > $msgJson["count"] = count($messages);
> > $msgJson["SessionID"] = $SessionID;
> > $msgJson["SessionData"] = $data;
> > foreach($messages as $message){
> >     $msg[] = $message["Message"];}
>
> > $msgJson["items"] = $msg;
> > echo json_encode($msgJson);
> > /*
> > results in ({"count":3,"SessionID":"","SessionData":27384,"items":
> > [{"id":"4","priority":"3","subject":"Another
> > message","message":"adsfasdf"},
> > {"id":"2","priority":"3","subject":"testing again","message":"just
> > seeing ow "},
> > {"id":"7","priority":"3","subject":"asdgasdg","message":"asdfasdfasd"}]})
> > except the SessionData changes everytime and the SessionID never shows
> > up.
> > */
>
> > Any ideas what might be wrong?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en- Hide quoted text -
>
> - Show quoted text -

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Sessions working in one controller and not the other

2010-05-03 Thread LordZardeck
But the sessions controller works without it. Shouldn't the messages
controller work without it also? I added it anyways, and it still
didn't work.

On May 3, 6:21 pm, thatsgreat2345  wrote:
> Include the session component
>
> On May 3, 3:59 pm, LordZardeck  wrote:
>
>
>
>
>
> > For some reason, the session handling works in one controller and not
> > the other. I can't figure out why. I am using CakePHP 1.2.5.
>
> > //
> > //Does work
> > //
>
> > sessions_controller.php:
>
> > class SessionsController extends AppController {
> >     var $name = "Sessions";
> >     var $layout = "ajax";
> >     var $uses = array();
>
> >     function create(){
> >         if($this->Session->read('Data') == null){
> >             $this->Session->write('Data', rand());
> >         }
> >         $this->set('data', $this->Session->read('Data'));
> >         $this->set('SessionID', $this->Session->id());
> >     }
>
> > }
>
> > create.ctp:
> > $msgJson["SessionID"] = $SessionID;
> > $msgJson["data"] = $data;
> > echo json_encode($msgJson);
> > //results in ({"SessionID":"sd8s8o32edmjnjt94ouse99fd2","data":19409})
> > every time (parenthesis not in result)
>
> > //
> > //Doesn't Work
> > //
>
> > messages_controller.php:
>
> > class MessagesController extends AppController {
>
> >     var $name = 'Messages';
> >     var $layout = "ajax";
>
> >     function listMessages() {
> >         if($this->Session->read('Data') == null){
> >             $this->Session->write('Data', rand());
> >         }
> >         $this->set('data', $this->Session->read('Data'));
> >         $this->set('SessionID', $this->Session->id());
> >         $this->set('messages', $this->Message->find("all",
> > array("order"=>"priority ASC")));
> >     }
>
> > }
>
> > list_messages.ctp:
>
> > $msgJson["count"] = count($messages);
> > $msgJson["SessionID"] = $SessionID;
> > $msgJson["SessionData"] = $data;
> > foreach($messages as $message){
> >     $msg[] = $message["Message"];}
>
> > $msgJson["items"] = $msg;
> > echo json_encode($msgJson);
> > /*
> > results in ({"count":3,"SessionID":"","SessionData":27384,"items":
> > [{"id":"4","priority":"3","subject":"Another
> > message","message":"adsfasdf"},
> > {"id":"2","priority":"3","subject":"testing again","message":"just
> > seeing ow "},
> > {"id":"7","priority":"3","subject":"asdgasdg","message":"asdfasdfasd"}]})
> > except the SessionData changes everytime and the SessionID never shows
> > up.
> > */
>
> > Any ideas what might be wrong?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en- Hide quoted text -
>
> - Show quoted text -

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Sessions working in one controller and not the other

2010-05-03 Thread thatsgreat2345
Include the session component

On May 3, 3:59 pm, LordZardeck  wrote:
> For some reason, the session handling works in one controller and not
> the other. I can't figure out why. I am using CakePHP 1.2.5.
>
> //
> //Does work
> //
>
> sessions_controller.php:
>
> class SessionsController extends AppController {
>     var $name = "Sessions";
>     var $layout = "ajax";
>     var $uses = array();
>
>     function create(){
>         if($this->Session->read('Data') == null){
>             $this->Session->write('Data', rand());
>         }
>         $this->set('data', $this->Session->read('Data'));
>         $this->set('SessionID', $this->Session->id());
>     }
>
> }
>
> create.ctp:
> $msgJson["SessionID"] = $SessionID;
> $msgJson["data"] = $data;
> echo json_encode($msgJson);
> //results in ({"SessionID":"sd8s8o32edmjnjt94ouse99fd2","data":19409})
> every time (parenthesis not in result)
>
> //
> //Doesn't Work
> //
>
> messages_controller.php:
>
> class MessagesController extends AppController {
>
>     var $name = 'Messages';
>     var $layout = "ajax";
>
>     function listMessages() {
>         if($this->Session->read('Data') == null){
>             $this->Session->write('Data', rand());
>         }
>         $this->set('data', $this->Session->read('Data'));
>         $this->set('SessionID', $this->Session->id());
>         $this->set('messages', $this->Message->find("all",
> array("order"=>"priority ASC")));
>     }
>
> }
>
> list_messages.ctp:
>
> $msgJson["count"] = count($messages);
> $msgJson["SessionID"] = $SessionID;
> $msgJson["SessionData"] = $data;
> foreach($messages as $message){
>     $msg[] = $message["Message"];}
>
> $msgJson["items"] = $msg;
> echo json_encode($msgJson);
> /*
> results in ({"count":3,"SessionID":"","SessionData":27384,"items":
> [{"id":"4","priority":"3","subject":"Another
> message","message":"adsfasdf"},
> {"id":"2","priority":"3","subject":"testing again","message":"just
> seeing ow "},
> {"id":"7","priority":"3","subject":"asdgasdg","message":"asdfasdfasd"}]})
> except the SessionData changes everytime and the SessionID never shows
> up.
> */
>
> Any ideas what might be wrong?
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Sessions working in one controller and not the other

2010-05-03 Thread LordZardeck
For some reason, the session handling works in one controller and not
the other. I can't figure out why. I am using CakePHP 1.2.5.

//
//Does work
//

sessions_controller.php:

class SessionsController extends AppController {
var $name = "Sessions";
var $layout = "ajax";
var $uses = array();

function create(){
if($this->Session->read('Data') == null){
$this->Session->write('Data', rand());
}
$this->set('data', $this->Session->read('Data'));
$this->set('SessionID', $this->Session->id());
}
}

create.ctp:
$msgJson["SessionID"] = $SessionID;
$msgJson["data"] = $data;
echo json_encode($msgJson);
//results in ({"SessionID":"sd8s8o32edmjnjt94ouse99fd2","data":19409})
every time (parenthesis not in result)

//
//Doesn't Work
//

messages_controller.php:

class MessagesController extends AppController {

var $name = 'Messages';
var $layout = "ajax";

function listMessages() {
if($this->Session->read('Data') == null){
$this->Session->write('Data', rand());
}
$this->set('data', $this->Session->read('Data'));
$this->set('SessionID', $this->Session->id());
$this->set('messages', $this->Message->find("all",
array("order"=>"priority ASC")));
}

}

list_messages.ctp:

$msgJson["count"] = count($messages);
$msgJson["SessionID"] = $SessionID;
$msgJson["SessionData"] = $data;
foreach($messages as $message){
$msg[] = $message["Message"];
}
$msgJson["items"] = $msg;
echo json_encode($msgJson);
/*
results in ({"count":3,"SessionID":"","SessionData":27384,"items":
[{"id":"4","priority":"3","subject":"Another
message","message":"adsfasdf"},
{"id":"2","priority":"3","subject":"testing again","message":"just
seeing ow "},
{"id":"7","priority":"3","subject":"asdgasdg","message":"asdfasdfasd"}]})
except the SessionData changes everytime and the SessionID never shows
up.
*/

Any ideas what might be wrong?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


model testing - any ideas?

2010-05-03 Thread euromark
unit testing with cake usually is very nice
but what model testing is concerned it drives me nuts

if i want to work on fixtures i have to include all related models of
any submodel as well (MANUALLY).
var $fixtures = array('app.daily_stat', 'app.country',
'app.country_province', 'app.user_stat', ...[and 50 others connected
to user which unfortunately is connected to daily_stat...]]);

this really is annoying and time-consuming. often times, the relations
(as defined inside each model via $hasMany etc) change - code-
redundance of the test cases make it hard to keep up with those
changes

did anyone write some kind of hack to autoload fixtures like models
are in normal productive mode - without hardcoding them? the
neccessary models can easily be retrieved from within the appropriate
model relation arrays, can they not?

thx mark

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: 404 error when I call controller

2010-05-03 Thread Don Drake
A 404 error? I'm gonna guess that your .htaccess file is missing.

Don

On Mon, May 3, 2010 at 7:49 AM, gannher  wrote:

> Hello
>
> I am trying to build a controller but when i call it, i have a 404
> code error.
>
> Here the controller "logins":
>
>  class LoginsController extends AppController {
>var $name = 'Logins';
>var $uses = '';
>public function display() {
>
>}
> }
>
> ?>
>
> Here routes.php:
>
> Router::connect('/', array('controller' => 'homes', 'action' =>
> 'index'));
> Router::connect('/login', array('controller' => 'logins', 'action' =>
> 'display'));
>
>
>
> I try to call my controller with this url:
>
> http://www.my_url/login
>
>
> Log of apache (error.log):
> [Mon May 03 18:38:50 2010] [error] [client ] File does not
> exist: /home/cake/app/webroot/login, referer: 
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Implementing uploadify - File upload issue - param definitions issue

2010-05-03 Thread Sam Sherlock
Thanks Miles, Aran,

@miles
I will also try it out this evening hopefully. Had some nice success with
commentia last night also

I am fairly certain that the data was in correct format as I checked this
early on (when using multi upload I made some of my additional fields
default)

but i will check again anywhow - I may have inadvertently  altered
something

@aran
yep I saw that I have that in my code also.  my uploads are successful but
immediately after uploading I
get logged out - so I was thinking that is credentials are not verifed
correctly at that poiunt that might be
why I get bumped out.

Also the code you posted seems quite excessive; it could be leaner and more
compact.
some should be in other components - and some of it looks like vendor code
within the comp - then the controller bring it all together

I have a seen  a few cloud transfer comps - if you plan to do this it should
be a plugin

off to explore possibilities with MJ's uploader :) sans uploadify for now


On 3 May 2010 21:08, Miles J  wrote:

> If the $data passed to the controller is correct, the uploader should
> work. I have not tested it personally but I can test case it when I
> get home.
>
> On May 3, 1:03 pm, Sam Sherlock  wrote:
> > Hi Miles,
> >
> > have you tried to use your uploader with uploadify or swfupload?
> >
> > @abocanegra
> >
> > I mean that the user is logged in through auth.  I think that the follow
> up
> > requests that uploadify uses to check success of queued items are passed
> > with out Session ID (appened to query string) and so the auth session is
> > terminated by the time the uploads are complete
> >
> > - S
> >
> > On 3 May 2010 18:04, Miles J  wrote:
> >
> > > It would be better to actually use an uploader that was built for
> > > Cake.
> >
> > >http://github.com/milesj/uploader
> >
> > > On May 3, 5:28 am, abocanegra  wrote:
> > > > Could you clarify what you mean by admin routing. I have it working
> > > > solidly in my multi-user admin system. I have chosen to save the data
> > > > outside of the cakePHP admin section for this specific project. I
> have
> > > > everything routing based on roles. Sorry i am unclear on some
> > > > terminology, if you can clarify the question,  can answer.
> >
> > > > Below is the image.php component code I have altered for my own
> > > > purposes including the ability to work with single or multi-image
> > > > upload (uploadify)
> >
> > > > /// image.php
> >
> > > >  > > > /*
> > > >  File: /app/controllers/components/image.php
> > > > */
> > > > class ImageComponent extends Object
> > > > {
> > > >  /*
> > > >  * Uploads an image and its thumbnail into $folderName/big and
> > > > $folderName/small respectivley.
> > > >  *  Also uploads a zoom cropped image into $folderName/home. You
> could
> > > > easily modify it to suit your needs!
> >
> > > >  *  Directions:
> > > >  * In view where you upload the image, make sure your form creation
> is
> > > > similar to the following
> > > >  * create('FurnitureSet',array('type' => 'file')); ?>
> >
> > > >  * In view where you upload the image, make sure that you have a file
> > > > input similar to the following
> > > >  * file('Image/name1'); ?>
> >
> > > >  * In the controller, add the component to your components array
> > > >  * var $components = array("Image");
> >
> > > >  * In your controller action (the parameters are expained below)
> > > >  * $image_path =
> > > $this->Image->upload_image_and_thumbnail($this->data,"name1",
> 573,380,80,80,
> > > "sets");
> >
> > > >  * this returns the file name of the result image.  You can  store
> > > > this file name in the database
> > > >  *
> > > >  * Note that your image will be stored in 3 locations:
> > > >  * Image: /webroot/img/$folderName/big/$image_path
> > > >  * Thumbnail:  /webroot/img/$folderName/small/$image_path
> > > >  * Homepage:  /webroot/img/$folderName/home/$image_path
> > > >  *
> > > >  * You could easily add more locations or remove locations you don't
> > > > need
> >
> > > >  * Finally in the view where you want to see the images
> > > >  * image('sets/big/'.$furnitureSet['FurnitureSet']
> > > > ['image_path']);
> > > >  *  where "sets" is the folder name we saved our pictures in, and
> > > > $furnitureSet['FurnitureSet']['image_path'] is the file name we
> stored
> > > > in the database
> >
> > > >  * Parameters:
> > > >  * $data: CakePHP data array from the form
> > > >  * $datakey: key in the $data array. If you used  > > $form->file('Image/name1'); ?> in your view, then $datakey = name1
> >
> > > >  * $maxw: the maximum width that you want your picture to be resized
> > > > to
> > > >  * $maxh: the maximum width that you want your picture to be resized
> > > > to
> > > >  * $thumbscalew: the maximum width hat you want your thumbnail to be
> > > > resized to
> > > >  * $thumbscaleh: the maximum height that you want your thumbnail to
> be
> > > > resized to
> > > >  * $folderName: the name of the pare

404 error when I call controller

2010-05-03 Thread gannher
Hello

I am trying to build a controller but when i call it, i have a 404
code error.

Here the controller "logins":



Here routes.php:

Router::connect('/', array('controller' => 'homes', 'action' =>
'index'));
Router::connect('/login', array('controller' => 'logins', 'action' =>
'display'));



I try to call my controller with this url:

http://www.my_url/login


Log of apache (error.log):
[Mon May 03 18:38:50 2010] [error] [client ] File does not
exist: /home/cake/app/webroot/login, referer: 

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Implementing uploadify - File upload issue - param definitions issue

2010-05-03 Thread abocanegra
Your uploader looks great and will be useful to me on many levels. I
actually had planned on extending this to send files to s3. The one i
was using was designed for cakePHP
http://sabbour.wordpress.com/2008/07/18/enhanced-image-upload-component-for-cakephp-12/
thought its a bit older. I'll let you know how it goes for me. Great
work.

On May 3, 10:04 am, Miles J  wrote:
> It would be better to actually use an uploader that was built for
> Cake.
>
> http://github.com/milesj/uploader
>
> On May 3, 5:28 am,abocanegra wrote:
>
> > Could you clarify what you mean by admin routing. I have it working
> > solidly in my multi-user admin system. I have chosen to save the data
> > outside of the cakePHP admin section for this specific project. I have
> > everything routing based on roles. Sorry i am unclear on some
> > terminology, if you can clarify the question,  can answer.
>
> > Below is the image.php component code I have altered for my own
> > purposes including the ability to work with single or multi-image
> > upload (uploadify)
>
> > /// image.php
>
> >  > /*
> >  File: /app/controllers/components/image.php
> > */
> > class ImageComponent extends Object
> > {
> >  /*
> >  * Uploads an image and its thumbnail into $folderName/big and
> > $folderName/small respectivley.
> >  *  Also uploads a zoom cropped image into $folderName/home. You could
> > easily modify it to suit your needs!
>
> >  *  Directions:
> >  * In view where you upload the image, make sure your form creation is
> > similar to the following
> >  * create('FurnitureSet',array('type' => 'file')); ?>
>
> >  * In view where you upload the image, make sure that you have a file
> > input similar to the following
> >  * file('Image/name1'); ?>
>
> >  * In the controller, add the component to your components array
> >  * var $components = array("Image");
>
> >  * In your controller action (the parameters are expained below)
> >  * $image_path = 
> > $this->Image->upload_image_and_thumbnail($this->data,"name1", 
> > 573,380,80,80, "sets");
>
> >  * this returns the file name of the result image.  You can  store
> > this file name in the database
> >  *
> >  * Note that your image will be stored in 3 locations:
> >  * Image: /webroot/img/$folderName/big/$image_path
> >  * Thumbnail:  /webroot/img/$folderName/small/$image_path
> >  * Homepage:  /webroot/img/$folderName/home/$image_path
> >  *
> >  * You could easily add more locations or remove locations you don't
> > need
>
> >  * Finally in the view where you want to see the images
> >  * image('sets/big/'.$furnitureSet['FurnitureSet']
> > ['image_path']);
> >  *  where "sets" is the folder name we saved our pictures in, and
> > $furnitureSet['FurnitureSet']['image_path'] is the file name we stored
> > in the database
>
> >  * Parameters:
> >  * $data: CakePHP data array from the form
> >  * $datakey: key in the $data array. If you used  > $form->file('Image/name1'); ?> in your view, then $datakey = name1
>
> >  * $maxw: the maximum width that you want your picture to be resized
> > to
> >  * $maxh: the maximum width that you want your picture to be resized
> > to
> >  * $thumbscalew: the maximum width hat you want your thumbnail to be
> > resized to
> >  * $thumbscaleh: the maximum height that you want your thumbnail to be
> > resized to
> >  * $folderName: the name of the parent folder of the images. The
> > images will be stored to /webroot/img/$folderName/big/ and  /webroot/
> > img/$folderName/small/
> >  */
> >  function upload_image_and_thumbnail($data, $datakey, $maxw, $maxh,
> > $thumbscalew, $thumbscaleh, $folderName, $multi) {
> >         if($multi == false){
> >         $dName = $data['Image'][$datakey]['name'];
> >         $dTempName = $data['Image'][$datakey]['tmp_name'];
> >         }else if($multi == true){
> >         $dName = $datakey;
> >         $dTempName = $data;
> >         }
> >         if(strlen($dName)>4){
> >         $error = 0;
> >          $homedir = "../../../uploads";
> >          if(!is_dir($homedir)){mkdir($homedir, 0777, true);}
> >      $tempuploaddir = $homedir . "/temp"; // the /temp/ directory,
> > should delete the image after we upload
> >          if(!is_dir($tempuploaddir)){mkdir($tempuploaddir, 0777, true);}
> >      $homeuploaddir = $homedir."/images/".$folderName."/home"; // the /
> > home/ directory
> >          if(!is_dir($homeuploaddir)){ mkdir($homeuploaddir , 0777,
> > true);}  // octal; correct value of mode
> >          $biguploaddir = $homedir . "/images/".$folderName."/big"; // the /
> > big/ directory
> >          if(!is_dir($biguploaddir)){mkdir($biguploaddir , 0777, true);}  //
> > octal; correct value of mode
> >      $smalluploaddir = $homedir . "/images/".$folderName."/small"; //
> > the /small/ directory for thumbnails
> >          if(!is_dir($smalluploaddir)){mkdir($smalluploaddir, 0777,
> > true);}  // octal; correct value of mode
>
> >      // Make sure the required directories exist, and cr

Re: Implementing uploadify - File upload issue - param definitions issue

2010-05-03 Thread abocanegra
I pass the session id to the upload script, the auth session as never
timed out on me while using it. Each upload sends the session id, it
is in the javascript.
-a

On May 3, 1:03 pm, Sam Sherlock  wrote:
> Hi Miles,
>
> have you tried to use your uploader with uploadify or swfupload?
>
> @abocanegra
>
> I mean that the user is logged in through auth.  I think that the follow up
> requests that uploadify uses to check success of queued items are passed
> with out Session ID (appened to query string) and so the auth session is
> terminated by the time the uploads are complete
>
> - S
>
> On 3 May 2010 18:04, Miles J  wrote:
>
> > It would be better to actually use an uploader that was built for
> > Cake.
>
> >http://github.com/milesj/uploader
>
> > On May 3, 5:28 am, abocanegra  wrote:
> > > Could you clarify what you mean by admin routing. I have it working
> > > solidly in my multi-user admin system. I have chosen to save the data
> > > outside of the cakePHP admin section for this specific project. I have
> > > everything routing based on roles. Sorry i am unclear on some
> > > terminology, if you can clarify the question,  can answer.
>
> > > Below is the image.php component code I have altered for my own
> > > purposes including the ability to work with single or multi-image
> > > upload (uploadify)
>
> > > /// image.php
>
> > >  > > /*
> > >  File: /app/controllers/components/image.php
> > > */
> > > class ImageComponent extends Object
> > > {
> > >  /*
> > >  * Uploads an image and its thumbnail into $folderName/big and
> > > $folderName/small respectivley.
> > >  *  Also uploads a zoom cropped image into $folderName/home. You could
> > > easily modify it to suit your needs!
>
> > >  *  Directions:
> > >  * In view where you upload the image, make sure your form creation is
> > > similar to the following
> > >  * create('FurnitureSet',array('type' => 'file')); ?>
>
> > >  * In view where you upload the image, make sure that you have a file
> > > input similar to the following
> > >  * file('Image/name1'); ?>
>
> > >  * In the controller, add the component to your components array
> > >  * var $components = array("Image");
>
> > >  * In your controller action (the parameters are expained below)
> > >  * $image_path =
> > $this->Image->upload_image_and_thumbnail($this->data,"name1", 573,380,80,80,
> > "sets");
>
> > >  * this returns the file name of the result image.  You can  store
> > > this file name in the database
> > >  *
> > >  * Note that your image will be stored in 3 locations:
> > >  * Image: /webroot/img/$folderName/big/$image_path
> > >  * Thumbnail:  /webroot/img/$folderName/small/$image_path
> > >  * Homepage:  /webroot/img/$folderName/home/$image_path
> > >  *
> > >  * You could easily add more locations or remove locations you don't
> > > need
>
> > >  * Finally in the view where you want to see the images
> > >  * image('sets/big/'.$furnitureSet['FurnitureSet']
> > > ['image_path']);
> > >  *  where "sets" is the folder name we saved our pictures in, and
> > > $furnitureSet['FurnitureSet']['image_path'] is the file name we stored
> > > in the database
>
> > >  * Parameters:
> > >  * $data: CakePHP data array from the form
> > >  * $datakey: key in the $data array. If you used  > $form->file('Image/name1'); ?> in your view, then $datakey = name1
>
> > >  * $maxw: the maximum width that you want your picture to be resized
> > > to
> > >  * $maxh: the maximum width that you want your picture to be resized
> > > to
> > >  * $thumbscalew: the maximum width hat you want your thumbnail to be
> > > resized to
> > >  * $thumbscaleh: the maximum height that you want your thumbnail to be
> > > resized to
> > >  * $folderName: the name of the parent folder of the images. The
> > > images will be stored to /webroot/img/$folderName/big/ and  /webroot/
> > > img/$folderName/small/
> > >  */
> > >  function upload_image_and_thumbnail($data, $datakey, $maxw, $maxh,
> > > $thumbscalew, $thumbscaleh, $folderName, $multi) {
> > >         if($multi == false){
> > >         $dName = $data['Image'][$datakey]['name'];
> > >         $dTempName = $data['Image'][$datakey]['tmp_name'];
> > >         }else if($multi == true){
> > >         $dName = $datakey;
> > >         $dTempName = $data;
> > >         }
> > >         if(strlen($dName)>4){
> > >         $error = 0;
> > >          $homedir = "../../../uploads";
> > >          if(!is_dir($homedir)){mkdir($homedir, 0777, true);}
> > >      $tempuploaddir = $homedir . "/temp"; // the /temp/ directory,
> > > should delete the image after we upload
> > >          if(!is_dir($tempuploaddir)){mkdir($tempuploaddir, 0777, true);}
> > >      $homeuploaddir = $homedir."/images/".$folderName."/home"; // the /
> > > home/ directory
> > >          if(!is_dir($homeuploaddir)){ mkdir($homeuploaddir , 0777,
> > > true);}  // octal; correct value of mode
> > >          $biguploaddir = $homedir . "/images/".$folderName."/big"; // t

Re: Editing Multiple Records - Problem with selected options

2010-05-03 Thread abocanegra
the view is the problem, the tags should be a drop down and those
selected should be, well selected. but that is only working in the
edit view, and failing in the edit all view. in edit all it lists all
the options but fails to select those that are already chosen for the
record.



On May 3, 5:24 am, Andrei Mita  wrote:
> Your problem is in the view?
>
>
>
> On Mon, May 3, 2010 at 3:15 PM, abocanegra  wrote:
> > I have created a multiple image upload that needs to have multiple
> > records edited to add in content such as title and tags. When I do a
> > regular edit it works fine, when I try to do the multiple edit the tag
> > select function fails to load the selected options as it does in a
> > regular edit. I have been struggling with this, any help would be
> > appreciated.
>
> >  Photo Controller
>
> >        function edit($id = null) {
> >                if (!$id && empty($this->data)) {
> >                        $this->Session->setFlash(sprintf(__('Invalid %s',
> > true), 'photo'));
> >                        $this->redirect(array('action' => 'index'));
> >                }
> >                if (!empty($this->data)) {
> >                        if ($this->Photo->save($this->data)) {
> >                                $this->Session->setFlash(sprintf(__('The %s
> > has been saved',
> > true), 'photo'));
> >                                $this->redirect(array('action' => 'index'));
> >                        } else {
> >                                $this->Session->setFlash(sprintf(__('The %s
> > could not be saved.
> > Please, try again.', true), 'photo'));
> >                        }
> >                }
> >                if (empty($this->data)) {
> >                        $this->data = $this->Photo->read(null, $id);
> >                }
> >                $tags = $this->Photo->Tag->find('list', array('fields' =>
> > array('Tag.tag')));
> >                $this->set(compact('tags'));
> >        }
>
> > function editall() {
> >   if(!empty($this->data)) {
> >      $this->Photo->saveAll($this->data['Photo']);
> >   }
> >   else {
> >      $this->data['Photo'] = Set::combine($this->Photo->find('all'),
> > '{n}.Photo.id', '{n}.Photo');
> >        }
> >                $tags = $this->Photo->Tag->find('list', array('fields' =>
> > array('Tag.tag')));
> >                $this->set(compact('tags'));
> > }
>
> > /// Edit View
> > 
> > Form->create('Photo');?>
> >        
> >                 > true)); ?> > legend>
> >         >                echo $this->Form->input('id');
> >                echo
> > $html->image('../../../uploads/images/photography/small/' .
> > $this->Form->value('Photo.image'));
> >                echo $this->Form->input('title');
> >                echo $this->Form->input('image');
> >                echo $this->Form->input('client');
> >                echo $this->Form->input('description');
> >                echo $this->Form->input('Tag');
> >        ?>
> >        
> > Form->end(__('Submit', true));?>
> > 
>
> > / Edit View Output
> > 
> > Tag
> > 
> > 
> > Jewelery
> > Headshot
> > Product
> > Location
> > Travel
> > Art
> > HDR
> > 
>
> > /// Edit All View
> > 
> > create('Photo', array('action'=>'editall'));?>
> >        
> >                 > true)); ?
> > >
> >  > foreach($this->data['Photo'] as $key => $value) {
> >        echo '' . "\n";
>
> >    echo $form->input('Photo.'.$key.'.id') . "\n";
> >        echo $html->image('../../../uploads/images/photography/small/' .
> > $this->Form->value('Photo.'.$key.'.image')) . "\n";
> >    echo $form->input('Photo.'.$key.'.title') . "\n";
> >        echo $form->input('Photo.'.$key.'.client') . "\n";
> >        echo $form->input('Photo.'.$key.'.description') . "\n";
> >        echo $form->input('Tag.'.$key.'.tag') . "\n";
> >        echo '' . "\n";
> > }
> > ?>
> > 
> > end('Save All Photos');?>
> > 
>
> > / Edit All Output
> > (for only on entry)
> > 
> > 
> > 
> > 
> > 
> > 
>
> > Edit All Photos
> > 
> >  > id="Photo7Id" />
> > 
> > 
> > Title
> >  > value="testint" id="Photo7Title" />
> > 
> > 
> > Client
> >  > value="test" id="Photo7Client" />
> > 
> > 
> > Description
> >  > id="Photo7Description" >test
> > 
> > 
> > Tag
> > 
> > Jewelery
> > Headshot
> > Product
> > Location
> > Travel
> > Art
> > HDR
> > 
> > 
> > 
>
> > Thanks
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > 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.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> Check out

Re: Implementing uploadify - File upload issue - param definitions issue

2010-05-03 Thread Miles J
If the $data passed to the controller is correct, the uploader should
work. I have not tested it personally but I can test case it when I
get home.

On May 3, 1:03 pm, Sam Sherlock  wrote:
> Hi Miles,
>
> have you tried to use your uploader with uploadify or swfupload?
>
> @abocanegra
>
> I mean that the user is logged in through auth.  I think that the follow up
> requests that uploadify uses to check success of queued items are passed
> with out Session ID (appened to query string) and so the auth session is
> terminated by the time the uploads are complete
>
> - S
>
> On 3 May 2010 18:04, Miles J  wrote:
>
> > It would be better to actually use an uploader that was built for
> > Cake.
>
> >http://github.com/milesj/uploader
>
> > On May 3, 5:28 am, abocanegra  wrote:
> > > Could you clarify what you mean by admin routing. I have it working
> > > solidly in my multi-user admin system. I have chosen to save the data
> > > outside of the cakePHP admin section for this specific project. I have
> > > everything routing based on roles. Sorry i am unclear on some
> > > terminology, if you can clarify the question,  can answer.
>
> > > Below is the image.php component code I have altered for my own
> > > purposes including the ability to work with single or multi-image
> > > upload (uploadify)
>
> > > /// image.php
>
> > >  > > /*
> > >  File: /app/controllers/components/image.php
> > > */
> > > class ImageComponent extends Object
> > > {
> > >  /*
> > >  * Uploads an image and its thumbnail into $folderName/big and
> > > $folderName/small respectivley.
> > >  *  Also uploads a zoom cropped image into $folderName/home. You could
> > > easily modify it to suit your needs!
>
> > >  *  Directions:
> > >  * In view where you upload the image, make sure your form creation is
> > > similar to the following
> > >  * create('FurnitureSet',array('type' => 'file')); ?>
>
> > >  * In view where you upload the image, make sure that you have a file
> > > input similar to the following
> > >  * file('Image/name1'); ?>
>
> > >  * In the controller, add the component to your components array
> > >  * var $components = array("Image");
>
> > >  * In your controller action (the parameters are expained below)
> > >  * $image_path =
> > $this->Image->upload_image_and_thumbnail($this->data,"name1", 573,380,80,80,
> > "sets");
>
> > >  * this returns the file name of the result image.  You can  store
> > > this file name in the database
> > >  *
> > >  * Note that your image will be stored in 3 locations:
> > >  * Image: /webroot/img/$folderName/big/$image_path
> > >  * Thumbnail:  /webroot/img/$folderName/small/$image_path
> > >  * Homepage:  /webroot/img/$folderName/home/$image_path
> > >  *
> > >  * You could easily add more locations or remove locations you don't
> > > need
>
> > >  * Finally in the view where you want to see the images
> > >  * image('sets/big/'.$furnitureSet['FurnitureSet']
> > > ['image_path']);
> > >  *  where "sets" is the folder name we saved our pictures in, and
> > > $furnitureSet['FurnitureSet']['image_path'] is the file name we stored
> > > in the database
>
> > >  * Parameters:
> > >  * $data: CakePHP data array from the form
> > >  * $datakey: key in the $data array. If you used  > $form->file('Image/name1'); ?> in your view, then $datakey = name1
>
> > >  * $maxw: the maximum width that you want your picture to be resized
> > > to
> > >  * $maxh: the maximum width that you want your picture to be resized
> > > to
> > >  * $thumbscalew: the maximum width hat you want your thumbnail to be
> > > resized to
> > >  * $thumbscaleh: the maximum height that you want your thumbnail to be
> > > resized to
> > >  * $folderName: the name of the parent folder of the images. The
> > > images will be stored to /webroot/img/$folderName/big/ and  /webroot/
> > > img/$folderName/small/
> > >  */
> > >  function upload_image_and_thumbnail($data, $datakey, $maxw, $maxh,
> > > $thumbscalew, $thumbscaleh, $folderName, $multi) {
> > >         if($multi == false){
> > >         $dName = $data['Image'][$datakey]['name'];
> > >         $dTempName = $data['Image'][$datakey]['tmp_name'];
> > >         }else if($multi == true){
> > >         $dName = $datakey;
> > >         $dTempName = $data;
> > >         }
> > >         if(strlen($dName)>4){
> > >         $error = 0;
> > >          $homedir = "../../../uploads";
> > >          if(!is_dir($homedir)){mkdir($homedir, 0777, true);}
> > >      $tempuploaddir = $homedir . "/temp"; // the /temp/ directory,
> > > should delete the image after we upload
> > >          if(!is_dir($tempuploaddir)){mkdir($tempuploaddir, 0777, true);}
> > >      $homeuploaddir = $homedir."/images/".$folderName."/home"; // the /
> > > home/ directory
> > >          if(!is_dir($homeuploaddir)){ mkdir($homeuploaddir , 0777,
> > > true);}  // octal; correct value of mode
> > >          $biguploaddir = $homedir . "/images/".$folderName."/big"; // the
> > /
> > > b

Re: Implementing uploadify - File upload issue - param definitions issue

2010-05-03 Thread Sam Sherlock
Hi Miles,

have you tried to use your uploader with uploadify or swfupload?

@abocanegra

I mean that the user is logged in through auth.  I think that the follow up
requests that uploadify uses to check success of queued items are passed
with out Session ID (appened to query string) and so the auth session is
terminated by the time the uploads are complete

- S


On 3 May 2010 18:04, Miles J  wrote:

> It would be better to actually use an uploader that was built for
> Cake.
>
> http://github.com/milesj/uploader
>
> On May 3, 5:28 am, abocanegra  wrote:
> > Could you clarify what you mean by admin routing. I have it working
> > solidly in my multi-user admin system. I have chosen to save the data
> > outside of the cakePHP admin section for this specific project. I have
> > everything routing based on roles. Sorry i am unclear on some
> > terminology, if you can clarify the question,  can answer.
> >
> > Below is the image.php component code I have altered for my own
> > purposes including the ability to work with single or multi-image
> > upload (uploadify)
> >
> > /// image.php
> >
> >  > /*
> >  File: /app/controllers/components/image.php
> > */
> > class ImageComponent extends Object
> > {
> >  /*
> >  * Uploads an image and its thumbnail into $folderName/big and
> > $folderName/small respectivley.
> >  *  Also uploads a zoom cropped image into $folderName/home. You could
> > easily modify it to suit your needs!
> >
> >  *  Directions:
> >  * In view where you upload the image, make sure your form creation is
> > similar to the following
> >  * create('FurnitureSet',array('type' => 'file')); ?>
> >
> >  * In view where you upload the image, make sure that you have a file
> > input similar to the following
> >  * file('Image/name1'); ?>
> >
> >  * In the controller, add the component to your components array
> >  * var $components = array("Image");
> >
> >  * In your controller action (the parameters are expained below)
> >  * $image_path =
> $this->Image->upload_image_and_thumbnail($this->data,"name1", 573,380,80,80,
> "sets");
> >
> >  * this returns the file name of the result image.  You can  store
> > this file name in the database
> >  *
> >  * Note that your image will be stored in 3 locations:
> >  * Image: /webroot/img/$folderName/big/$image_path
> >  * Thumbnail:  /webroot/img/$folderName/small/$image_path
> >  * Homepage:  /webroot/img/$folderName/home/$image_path
> >  *
> >  * You could easily add more locations or remove locations you don't
> > need
> >
> >  * Finally in the view where you want to see the images
> >  * image('sets/big/'.$furnitureSet['FurnitureSet']
> > ['image_path']);
> >  *  where "sets" is the folder name we saved our pictures in, and
> > $furnitureSet['FurnitureSet']['image_path'] is the file name we stored
> > in the database
> >
> >  * Parameters:
> >  * $data: CakePHP data array from the form
> >  * $datakey: key in the $data array. If you used  $form->file('Image/name1'); ?> in your view, then $datakey = name1
> >
> >  * $maxw: the maximum width that you want your picture to be resized
> > to
> >  * $maxh: the maximum width that you want your picture to be resized
> > to
> >  * $thumbscalew: the maximum width hat you want your thumbnail to be
> > resized to
> >  * $thumbscaleh: the maximum height that you want your thumbnail to be
> > resized to
> >  * $folderName: the name of the parent folder of the images. The
> > images will be stored to /webroot/img/$folderName/big/ and  /webroot/
> > img/$folderName/small/
> >  */
> >  function upload_image_and_thumbnail($data, $datakey, $maxw, $maxh,
> > $thumbscalew, $thumbscaleh, $folderName, $multi) {
> > if($multi == false){
> > $dName = $data['Image'][$datakey]['name'];
> > $dTempName = $data['Image'][$datakey]['tmp_name'];
> > }else if($multi == true){
> > $dName = $datakey;
> > $dTempName = $data;
> > }
> > if(strlen($dName)>4){
> > $error = 0;
> >  $homedir = "../../../uploads";
> >  if(!is_dir($homedir)){mkdir($homedir, 0777, true);}
> >  $tempuploaddir = $homedir . "/temp"; // the /temp/ directory,
> > should delete the image after we upload
> >  if(!is_dir($tempuploaddir)){mkdir($tempuploaddir, 0777, true);}
> >  $homeuploaddir = $homedir."/images/".$folderName."/home"; // the /
> > home/ directory
> >  if(!is_dir($homeuploaddir)){ mkdir($homeuploaddir , 0777,
> > true);}  // octal; correct value of mode
> >  $biguploaddir = $homedir . "/images/".$folderName."/big"; // the
> /
> > big/ directory
> >  if(!is_dir($biguploaddir)){mkdir($biguploaddir , 0777, true);}
>  //
> > octal; correct value of mode
> >  $smalluploaddir = $homedir . "/images/".$folderName."/small"; //
> > the /small/ directory for thumbnails
> >  if(!is_dir($smalluploaddir)){mkdir($smalluploaddir, 0777,
> > true);}  // octal; correct value of mode
> >
> >  

cakephp 1.3 plugin layout path

2010-05-03 Thread davido
Hi!

I wanted to ask if somebody can help me with the 1.3 versions plugin. I
´ve used a plugin in 1.2.6 and everything was working great.

On version 1.3 the same plugin delivers me an error message on call:

 Error:  The layout file 
www.mydomain.at/app/views/plugins/about/layouts/About.Pages.ctp
can not be found or does not exist.

Error: Confirm you have created the file:
www.mydomain.at/app/views/plugins/about/layouts/About.Pages.ctp

I don´t know what exactly is happen and I found now hints.

Would be happy about any help.

Regards

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: How create a observeField with the new JSHelper?

2010-05-03 Thread cguyer
i'm also trying to figure out this myself, hacking through the new
help and learning jquery. any help would also be appreciated.

On Apr 30, 2:38 pm, Celso  wrote:
> Hi ! I want using the new JSHelper with Jquery, i need create a
> observeField to fill a combo with another combo that changed
>
> Thanks!
> Celso
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Selected option in select

2010-05-03 Thread Ed Propsner
@Andrei

Not sure if it will help but I've been using $form->input myself and haven't
had any real issues.

echo $form->input('User.gender', array(
 'label' => 'Gender:',
 'empty' => '-',
 'selected' => 'M',
 'options' => array(
   'M' => 'Male',
   'F' => 'Female'
)
 )
  );

- Ed
On Mon, May 3, 2010 at 6:01 AM, Andrei Mita  wrote:

> I've tried what you suggested and I doesn't work. I believe it's because
> the list of options is static and defined in the view. In some other view,
> where the select is populated from the DB, it works and I don't even need to
> specify the Model :)
>
> Thanks a lot
>
>
> On Sun, May 2, 2010 at 10:21 AM, WebbedIT  wrote:
>
>> Glad u got it working :o)
>>
>> If you change the file name to Profile.group, you should be able to
>> remove the 'selected' =>$this->data['Profile']['group'] attribute.
>>
>> P.S. to show the input without a label using form->input you just
>> supply label=>false.  I personally much prefer using the same method
>> as much as possible and form->input very rarely lets me down.
>>
>> HTH
>>
>> Paul
>>
>> Check out the new CakePHP Questions site http://cakeqs.org and help
>> others with their CakePHP related questions.
>>
>> 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.comFor
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>  Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Implementing uploadify - File upload issue - param definitions issue

2010-05-03 Thread Miles J
It would be better to actually use an uploader that was built for
Cake.

http://github.com/milesj/uploader

On May 3, 5:28 am, abocanegra  wrote:
> Could you clarify what you mean by admin routing. I have it working
> solidly in my multi-user admin system. I have chosen to save the data
> outside of the cakePHP admin section for this specific project. I have
> everything routing based on roles. Sorry i am unclear on some
> terminology, if you can clarify the question,  can answer.
>
> Below is the image.php component code I have altered for my own
> purposes including the ability to work with single or multi-image
> upload (uploadify)
>
> /// image.php
>
>  /*
>  File: /app/controllers/components/image.php
> */
> class ImageComponent extends Object
> {
>  /*
>  * Uploads an image and its thumbnail into $folderName/big and
> $folderName/small respectivley.
>  *  Also uploads a zoom cropped image into $folderName/home. You could
> easily modify it to suit your needs!
>
>  *  Directions:
>  * In view where you upload the image, make sure your form creation is
> similar to the following
>  * create('FurnitureSet',array('type' => 'file')); ?>
>
>  * In view where you upload the image, make sure that you have a file
> input similar to the following
>  * file('Image/name1'); ?>
>
>  * In the controller, add the component to your components array
>  * var $components = array("Image");
>
>  * In your controller action (the parameters are expained below)
>  * $image_path = 
> $this->Image->upload_image_and_thumbnail($this->data,"name1", 573,380,80,80, 
> "sets");
>
>  * this returns the file name of the result image.  You can  store
> this file name in the database
>  *
>  * Note that your image will be stored in 3 locations:
>  * Image: /webroot/img/$folderName/big/$image_path
>  * Thumbnail:  /webroot/img/$folderName/small/$image_path
>  * Homepage:  /webroot/img/$folderName/home/$image_path
>  *
>  * You could easily add more locations or remove locations you don't
> need
>
>  * Finally in the view where you want to see the images
>  * image('sets/big/'.$furnitureSet['FurnitureSet']
> ['image_path']);
>  *  where "sets" is the folder name we saved our pictures in, and
> $furnitureSet['FurnitureSet']['image_path'] is the file name we stored
> in the database
>
>  * Parameters:
>  * $data: CakePHP data array from the form
>  * $datakey: key in the $data array. If you used  $form->file('Image/name1'); ?> in your view, then $datakey = name1
>
>  * $maxw: the maximum width that you want your picture to be resized
> to
>  * $maxh: the maximum width that you want your picture to be resized
> to
>  * $thumbscalew: the maximum width hat you want your thumbnail to be
> resized to
>  * $thumbscaleh: the maximum height that you want your thumbnail to be
> resized to
>  * $folderName: the name of the parent folder of the images. The
> images will be stored to /webroot/img/$folderName/big/ and  /webroot/
> img/$folderName/small/
>  */
>  function upload_image_and_thumbnail($data, $datakey, $maxw, $maxh,
> $thumbscalew, $thumbscaleh, $folderName, $multi) {
>         if($multi == false){
>         $dName = $data['Image'][$datakey]['name'];
>         $dTempName = $data['Image'][$datakey]['tmp_name'];
>         }else if($multi == true){
>         $dName = $datakey;
>         $dTempName = $data;
>         }
>         if(strlen($dName)>4){
>         $error = 0;
>          $homedir = "../../../uploads";
>          if(!is_dir($homedir)){mkdir($homedir, 0777, true);}
>      $tempuploaddir = $homedir . "/temp"; // the /temp/ directory,
> should delete the image after we upload
>          if(!is_dir($tempuploaddir)){mkdir($tempuploaddir, 0777, true);}
>      $homeuploaddir = $homedir."/images/".$folderName."/home"; // the /
> home/ directory
>          if(!is_dir($homeuploaddir)){ mkdir($homeuploaddir , 0777,
> true);}  // octal; correct value of mode
>          $biguploaddir = $homedir . "/images/".$folderName."/big"; // the /
> big/ directory
>          if(!is_dir($biguploaddir)){mkdir($biguploaddir , 0777, true);}  //
> octal; correct value of mode
>      $smalluploaddir = $homedir . "/images/".$folderName."/small"; //
> the /small/ directory for thumbnails
>          if(!is_dir($smalluploaddir)){mkdir($smalluploaddir, 0777,
> true);}  // octal; correct value of mode
>
>      // Make sure the required directories exist, and create them if
> necessary
>      if(!is_dir($tempuploaddir)) mkdir($tempuploaddir,true);
>      if(!is_dir($homeuploaddir)) mkdir($homeuploaddir,true);
>      if(!is_dir($biguploaddir)) mkdir($biguploaddir,true);
>      if(!is_dir($smalluploaddir)) mkdir($smalluploaddir,true);
>
>         $filetype = $this->getFileExtension($dName);
>         $filetype = strtolower($filetype);
>
>      if (($filetype != "jpeg")  && ($filetype != "jpg") && ($filetype !
> = "JPG") && ($filetype != "gif") && ($filetype != "png"))
>      {
>       // verify the extension
>       return;

Re: I need full ORM example

2010-05-03 Thread gremlin
The point here is that you obviously haven't read the manual. Why
should we be helping someone who hasn't bothered to read the excellent
materials provided? Second, your question is answerable with a quick
google search. Google for "cakephp complete application tutorial" and
*READ THE ENTIRE MANUAL* then see if  you still need to post your
question on the support group.

On Apr 25, 5:05 am, zonery  wrote:
> thank you jacombe. I will try..
>
> and
> dear thatsthegreat2345 and walther,
> I am a newcomer, and ask a sipmle question. may be some body know...
> is this wrong? I did not want somebody to write my application for
> me?  and the book has not complete example. if I see this example, I
> can gain time. please dont judge my method.  read my question again.
> if you know, your answer will be only one clause. no need to polemic.
> you can be little gentle. if you dont know or you dont want to help
> please dont write any message. I blame you for your unrelated and
> priggish messages
>
> thank you
>
> On 25 Nisan, 14:00, jacmoe  wrote:
>
>
>
>
>
>
>
>
>
> > If you don't want scaffolding, use the cake bake console.
> > Then you'll get CRUD.
> > The database you have to do yourself.
> > Pick any design and make sure that you adhere to the CakePHP naming
> > conventions - the cake bake console will give you the rest.
> > Then just customize the baked models/controllers/views to your needs.
>
> > On Apr 25, 1:38 am, zonery  wrote:
>
> > > Hi everybody,
> > > I need full ORM crud example. (Not with scafolding). Manually created
> > > conroller, model and view including "one to many", "many to many" and
> > > "one to one" associations. including index, edit, add, delete
> > > functionalities.
>
> > > do you know any tutorial or good example..
>
> > > thank you for advices
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > with their CakePHP related questions.
>
> > > 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 For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


ACL with routes

2010-05-03 Thread alaxos
Hi all,

I have a question regarding the usage of ACL with routes.

A long time ago (when ACL was only based on the INI file...) I wrote a
component that allows me to easily grant/block access to actions
depending on roles the authenticated users are linked to. Its
configuration allows to check for distinct action names or by granting/
blocking access on whole routes.

This allows me to say for instance that all admin_xxx actions can be
accessed only by users linked to an ADMIN role, and manage_xxx actions
can only be accessed by users linked to a MANAGER role.

But today I'm really considering to replace my custom Component by the
ACL + Auth core components, as it has become fully usable over time. I
have read the ACL doc and made the ACL tutorial, and I didn't see
anything about using routes as ACOs.

So my question is simple, is the ACL configurable in a way that routes
can be considered as ACOs ? Or do we have to manage ACL rights each
time a new action is added in a controller if we want a user/group to
be able to access the new action ?

Thanks,
Nicolas

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


CakePHP on IIS with UrlScan on shared hosting

2010-05-03 Thread rei...@gmail.com
Hello,

i'm trying to setup a CakePHP applicatie on a shared IIS hosting, this
is working but when i use a colon in the url i get a '400 bad
request'. Is there a way to avoid the colon and replace it with
something else?

Greetings,
Reijer

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Problem setting the page title with the $pageTitle variable

2010-05-03 Thread ale3andro
A change brought by Cake 1.3.0...
Thank you for pointing this out!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Newbie problem with 15 minute blog in Cake 1.3

2010-05-03 Thread calvin
http://yourapp/foos/bar/id:1/ will not work when Cake is expecting
http://yourapp/foos/bar/1

Cake doesn't know the name of your function variables (I don't even
think there's a way to determine that in PHP). So it wouldn't know
that the 'id' named param is supposed to be the first argument in
FoosController::bar($id, [$var2, $var3...]). If you want to use named
parameters, then you need to define a custom route and tell CakePHP to
pass the named parameters to the action and the order to pass them in.
Otherwise, you'll have to use $this->passedArgs['id'] in the action.

See the cookbook: http://book.cakephp.org/view/949/Passing-parameters-to-action

On May 2, 3:58 pm, Sam Sherlock  wrote:
> you can access it
>
> $this->params['named']['id']
>
> your view action may take it as argument (in controller)
> ..
> function view($id) {
> ...}
>
> ..
>
> 
>
> You can alter posts routes should you want to use slugs rather than ids with
> Syrup.Sluggable  (syrup is a cake plugin that has a few behaviours)
>
> - S
>
> On 2 May 2010 23:27, Matt  wrote:
>
>
>
> > > The controller has the 'params' property. If you output this:
> > > debug($this->params); //from your view
> > > I believe you should see your id showing in the 'pass' array if
> > everything
> > > is working. If it's there, this will confirm the value is getting all the
> > > way in to your controller or not. If it's there, then to problem isn't in
> > > the mod-rewrite or anything early in the process.
>
> > > Don
>
> > Thanks for the tip.  Added the debug code and pasting the output
> > below.   ID is in the "named" element but not the "pass" element.  Is
> > that a problem?
>
> > Array
> > (
> >    [controller] => posts
> >    [action] => view
> >    [named] => Array
> >        (
> >            [id] => 3
> >        )
>
> >    [pass] => Array
> >        (
> >        )
>
> >    [plugin] =>
> >    [form] => Array
> >        (
> >        )
>
> >    [url] => Array
> >        (
> >            [url] => posts/view/id:3
> >        )
>
> >    [models] => Array
> >        (
> >            [0] => Post
> >        )
>
> > )
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > 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.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: fresh install of cakephp 1.3, Fatal Error: Call to a member function cd()

2010-05-03 Thread mikeottinger
I should mention I'm on apache2, php 5.3.2 as well.

On May 2, 11:16 pm, mikeottinger  wrote:
> Hi Guys,
>
> I saw one post on this that seemed to peter out...  I've a fresh
> install of 1.3, I'm running this in my own installations of apache,
> php and mysql on mac osx snow leopard. All of which run fine aside
> from cakephp. Yet, when I bring up the install in my browser I'm
> confronted with:
>
> Fatal error: Call to a member function cd() on a non-object in /
> Library/WebServer/Documents/cakephptest/cake/libs/cache/file.php  on
> line 244
>
> At first I had the errors with the cache directories not being
> writable. But as soon as I clear that up, I get this. Any ideas out
> there on this? I could go with MAMP if need be, but out of principle,
> I feel I *should* be able to get this working with the configuration I
> currently have.
>
> Thanks in advance.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Cakephp.org having trouble

2010-05-03 Thread Dave
Website is grinding pretty bad and poppin internal server errors
every
now then.  Looks like it is swapping

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: How to get the data form the different table.

2010-05-03 Thread Jonathon Musters
WeLl you would need to have told cake there relationship and then you
can use contianable to get the fields you are after



On 5/3/10, Master Ram  wrote:
> hi.. all
>
> i what to show 3table data in one table.
>
> i have to add 3table fields in one place like:
>
> i have table name called "adb_campaign" in this table i want fields
> "campaign_id",jobno..etc and also i want fields form the table
> adb_clients, and user name form the table adb_users. how to get the
> data form different table.
>
> regards:
> Ram
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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 For more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Implementing uploadify - File upload issue - param definitions issue

2010-05-03 Thread abocanegra
Could you clarify what you mean by admin routing. I have it working
solidly in my multi-user admin system. I have chosen to save the data
outside of the cakePHP admin section for this specific project. I have
everything routing based on roles. Sorry i am unclear on some
terminology, if you can clarify the question,  can answer.

Below is the image.php component code I have altered for my own
purposes including the ability to work with single or multi-image
upload (uploadify)

/// image.php

create('FurnitureSet',array('type' => 'file')); ?>


 * In view where you upload the image, make sure that you have a file
input similar to the following
 * file('Image/name1'); ?>


 * In the controller, add the component to your components array
 * var $components = array("Image");


 * In your controller action (the parameters are expained below)
 * $image_path = $this->Image->upload_image_and_thumbnail($this-
>data,"name1", 573,380,80,80, "sets");
 * this returns the file name of the result image.  You can  store
this file name in the database
 *
 * Note that your image will be stored in 3 locations:
 * Image: /webroot/img/$folderName/big/$image_path
 * Thumbnail:  /webroot/img/$folderName/small/$image_path
 * Homepage:  /webroot/img/$folderName/home/$image_path
 *
 * You could easily add more locations or remove locations you don't
need

 * Finally in the view where you want to see the images
 * image('sets/big/'.$furnitureSet['FurnitureSet']
['image_path']);
 *  where "sets" is the folder name we saved our pictures in, and
$furnitureSet['FurnitureSet']['image_path'] is the file name we stored
in the database


 * Parameters:
 * $data: CakePHP data array from the form
 * $datakey: key in the $data array. If you used file('Image/name1'); ?> in your view, then $datakey = name1
 * $maxw: the maximum width that you want your picture to be resized
to
 * $maxh: the maximum width that you want your picture to be resized
to
 * $thumbscalew: the maximum width hat you want your thumbnail to be
resized to
 * $thumbscaleh: the maximum height that you want your thumbnail to be
resized to
 * $folderName: the name of the parent folder of the images. The
images will be stored to /webroot/img/$folderName/big/ and  /webroot/
img/$folderName/small/
 */
 function upload_image_and_thumbnail($data, $datakey, $maxw, $maxh,
$thumbscalew, $thumbscaleh, $folderName, $multi) {
if($multi == false){
$dName = $data['Image'][$datakey]['name'];
$dTempName = $data['Image'][$datakey]['tmp_name'];
}else if($multi == true){
$dName = $datakey;
$dTempName = $data;
}
if(strlen($dName)>4){
$error = 0;
 $homedir = "../../../uploads";
 if(!is_dir($homedir)){mkdir($homedir, 0777, true);}
 $tempuploaddir = $homedir . "/temp"; // the /temp/ directory,
should delete the image after we upload
 if(!is_dir($tempuploaddir)){mkdir($tempuploaddir, 0777, true);}
 $homeuploaddir = $homedir."/images/".$folderName."/home"; // the /
home/ directory
 if(!is_dir($homeuploaddir)){ mkdir($homeuploaddir , 0777,
true);}  // octal; correct value of mode
 $biguploaddir = $homedir . "/images/".$folderName."/big"; // the /
big/ directory
 if(!is_dir($biguploaddir)){mkdir($biguploaddir , 0777, true);}  //
octal; correct value of mode
 $smalluploaddir = $homedir . "/images/".$folderName."/small"; //
the /small/ directory for thumbnails
 if(!is_dir($smalluploaddir)){mkdir($smalluploaddir, 0777,
true);}  // octal; correct value of mode

 // Make sure the required directories exist, and create them if
necessary
 if(!is_dir($tempuploaddir)) mkdir($tempuploaddir,true);
 if(!is_dir($homeuploaddir)) mkdir($homeuploaddir,true);
 if(!is_dir($biguploaddir)) mkdir($biguploaddir,true);
 if(!is_dir($smalluploaddir)) mkdir($smalluploaddir,true);

$filetype = $this->getFileExtension($dName);
$filetype = strtolower($filetype);

 if (($filetype != "jpeg")  && ($filetype != "jpg") && ($filetype !
= "JPG") && ($filetype != "gif") && ($filetype != "png"))
 {
  // verify the extension
  return;
 }
 else
 {
  // Get the image size
  $imgsize = GetImageSize($dTempName);
}

 // Generate a unique name for the image (from the timestamp)
 $id_unic = str_replace(".", "", strtotime ("now"));
 $filename = $id_unic;

 settype($filename,"string");
 $filename.= ".";
 $filename.=$filetype;
 $tempfile = $tempuploaddir . "/$filename";
 //chmod($tempfile, 0777);
 $homefile = $homeuploaddir . "/$filename";
 //chmod($homefile, 0777);
 $resizedfile = $biguploaddir . "/$filename";
 //chmod($resizedfile, 0777);
 $croppedfile = $smalluploaddir . "/$filename";
 //chmod($croppedfile, 0777);

if (is_uploaded_file($dTempName)){
  // Copy the image into the temporary directory
   

Re: Editing Multiple Records - Problem with selected options

2010-05-03 Thread Andrei Mita
Your problem is in the view?


On Mon, May 3, 2010 at 3:15 PM, abocanegra  wrote:

> I have created a multiple image upload that needs to have multiple
> records edited to add in content such as title and tags. When I do a
> regular edit it works fine, when I try to do the multiple edit the tag
> select function fails to load the selected options as it does in a
> regular edit. I have been struggling with this, any help would be
> appreciated.
>
>  Photo Controller
>
>function edit($id = null) {
>if (!$id && empty($this->data)) {
>$this->Session->setFlash(sprintf(__('Invalid %s',
> true), 'photo'));
>$this->redirect(array('action' => 'index'));
>}
>if (!empty($this->data)) {
>if ($this->Photo->save($this->data)) {
>$this->Session->setFlash(sprintf(__('The %s
> has been saved',
> true), 'photo'));
>$this->redirect(array('action' => 'index'));
>} else {
>$this->Session->setFlash(sprintf(__('The %s
> could not be saved.
> Please, try again.', true), 'photo'));
>}
>}
>if (empty($this->data)) {
>$this->data = $this->Photo->read(null, $id);
>}
>$tags = $this->Photo->Tag->find('list', array('fields' =>
> array('Tag.tag')));
>$this->set(compact('tags'));
>}
>
> function editall() {
>   if(!empty($this->data)) {
>  $this->Photo->saveAll($this->data['Photo']);
>   }
>   else {
>  $this->data['Photo'] = Set::combine($this->Photo->find('all'),
> '{n}.Photo.id', '{n}.Photo');
>}
>$tags = $this->Photo->Tag->find('list', array('fields' =>
> array('Tag.tag')));
>$this->set(compact('tags'));
> }
>
>
> /// Edit View
> 
> Form->create('Photo');?>
>
> true)); ?> legend>
>echo $this->Form->input('id');
>echo
> $html->image('../../../uploads/images/photography/small/' .
> $this->Form->value('Photo.image'));
>echo $this->Form->input('title');
>echo $this->Form->input('image');
>echo $this->Form->input('client');
>echo $this->Form->input('description');
>echo $this->Form->input('Tag');
>?>
>
> Form->end(__('Submit', true));?>
> 
>
>
> / Edit View Output
> 
> Tag
> 
> 
> Jewelery
> Headshot
> Product
> Location
> Travel
> Art
> HDR
> 
>
> /// Edit All View
> 
> create('Photo', array('action'=>'editall'));?>
>
> true)); ?
> >
>  foreach($this->data['Photo'] as $key => $value) {
>echo '' . "\n";
>
>echo $form->input('Photo.'.$key.'.id') . "\n";
>echo $html->image('../../../uploads/images/photography/small/' .
> $this->Form->value('Photo.'.$key.'.image')) . "\n";
>echo $form->input('Photo.'.$key.'.title') . "\n";
>echo $form->input('Photo.'.$key.'.client') . "\n";
>echo $form->input('Photo.'.$key.'.description') . "\n";
>echo $form->input('Tag.'.$key.'.tag') . "\n";
>echo '' . "\n";
> }
> ?>
> 
> end('Save All Photos');?>
> 
>
> / Edit All Output
> (for only on entry)
> 
> 
> 
> 
> 
> 
>
> Edit All Photos
> 
>  id="Photo7Id" />
> 
> 
> Title
>  value="testint" id="Photo7Title" />
> 
> 
> Client
>  value="test" id="Photo7Client" />
> 
> 
> Description
>  id="Photo7Description" >test
> 
> 
> Tag
> 
> Jewelery
> Headshot
> Product
> Location
> Travel
> Art
> HDR
> 
> 
> 
>
>
> Thanks
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Editing Multiple Records - Problem with selected options

2010-05-03 Thread abocanegra
I have created a multiple image upload that needs to have multiple
records edited to add in content such as title and tags. When I do a
regular edit it works fine, when I try to do the multiple edit the tag
select function fails to load the selected options as it does in a
regular edit. I have been struggling with this, any help would be
appreciated.

 Photo Controller

function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(sprintf(__('Invalid %s', 
true), 'photo'));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->Photo->save($this->data)) {
$this->Session->setFlash(sprintf(__('The %s has 
been saved',
true), 'photo'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(sprintf(__('The %s 
could not be saved.
Please, try again.', true), 'photo'));
}
}
if (empty($this->data)) {
$this->data = $this->Photo->read(null, $id);
}
$tags = $this->Photo->Tag->find('list', array('fields' =>
array('Tag.tag')));
$this->set(compact('tags'));
}

function editall() {
   if(!empty($this->data)) {
  $this->Photo->saveAll($this->data['Photo']);
   }
   else {
  $this->data['Photo'] = Set::combine($this->Photo->find('all'),
'{n}.Photo.id', '{n}.Photo');
}
$tags = $this->Photo->Tag->find('list', array('fields' =>
array('Tag.tag')));
$this->set(compact('tags'));
}


/// Edit View

Form->create('Photo');?>


Form->input('id');
echo $html->image('../../../uploads/images/photography/small/' .
$this->Form->value('Photo.image'));
echo $this->Form->input('title');
echo $this->Form->input('image');
echo $this->Form->input('client');
echo $this->Form->input('description');
echo $this->Form->input('Tag');
?>

Form->end(__('Submit', true));?>



/ Edit View Output

Tag


Jewelery
Headshot
Product
Location
Travel
Art
HDR


/// Edit All View

create('Photo', array('action'=>'editall'));?>


data['Photo'] as $key => $value) {
echo '' . "\n";

echo $form->input('Photo.'.$key.'.id') . "\n";
echo $html->image('../../../uploads/images/photography/small/' .
$this->Form->value('Photo.'.$key.'.image')) . "\n";
echo $form->input('Photo.'.$key.'.title') . "\n";
echo $form->input('Photo.'.$key.'.client') . "\n";
echo $form->input('Photo.'.$key.'.description') . "\n";
echo $form->input('Tag.'.$key.'.tag') . "\n";
echo '' . "\n";
}
?>

end('Save All Photos');?>


/ Edit All Output
(for only on entry)







Edit All Photos




Title



Client



Description
test


Tag

Jewelery
Headshot
Product
Location
Travel
Art
HDR





Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


How to get the data form the different table.

2010-05-03 Thread Master Ram
hi.. all

i what to show 3table data in one table.

i have to add 3table fields in one place like:

i have table name called "adb_campaign" in this table i want fields
"campaign_id",jobno..etc and also i want fields form the table
adb_clients, and user name form the table adb_users. how to get the
data form different table.

regards:
Ram

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Selected option in select

2010-05-03 Thread Andrei Mita
I've tried what you suggested and I doesn't work. I believe it's because the
list of options is static and defined in the view. In some other view, where
the select is populated from the DB, it works and I don't even need to
specify the Model :)

Thanks a lot


On Sun, May 2, 2010 at 10:21 AM, WebbedIT  wrote:

> Glad u got it working :o)
>
> If you change the file name to Profile.group, you should be able to
> remove the 'selected' =>$this->data['Profile']['group'] attribute.
>
> P.S. to show the input without a label using form->input you just
> supply label=>false.  I personally much prefer using the same method
> as much as possible and form->input very rarely lets me down.
>
> HTH
>
> Paul
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: PHP CodeSniffer

2010-05-03 Thread Braindead
I use this plugin with NetBeans, too. Which coding standard you want
to use is just a matter of taste. In every case you have to make the
standard follow Cake conventions and this is my problem. Is there
really no one who uses CodeSniffer in a Cake project?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Implementing uploadify - File upload issue - param definitions issue

2010-05-03 Thread Sam Sherlock
Hi Aaron,


Sure I would love to see how you have used uploadify in a component.

Have you managed to get it working with admin routing?  The code you posted
so far does not use the admin prefix

 - S




On 3 May 2010 08:47, Andrei Mita  wrote:

> Your timing could not be better. Thanks
>
>
>
> On Mon, May 3, 2010 at 9:05 AM, abocanegra wrote:
>
>> I have it working -
>>
>> photoController -
>>
>> function upload(){
>>
>>if (isset($this->params['form']['Filedata']))
>>{
>>$tempFile = $this->params['form']['Filedata']['tmp_name'];
>>$targetPath = '../../../uploads/temp/';
>>$targetFile =  str_replace('//','/',$targetPath) . $this-
>> >params['form']['Filedata']['name'];
>>
>>move_uploaded_file($tempFile,$targetFile);
>>echo "1";
>>
>>$image_path = $this->params['form']['Filedata']['name'];
>>
>>if(isset($image_path))
>>{
>>
>>  $this->Photo->saveField('image',$image_path);
>>//Put success message and redirect here
>>}else{
>>//Put error message here
>>}
>>}
>> }
>>  // Handle multiple incoming uploads.
>>function addmulti() {
>>}
>>
>> //Addmulti view (no upload view)
>> 
>>  $(document).ready(function() {
>>$("#fileInput2").uploadify({
>>'uploader'   : '/admin/swf/uploadify.swf',
>>'script' : '> $html->url('/photos/upload/'.$session-
>> >id()); ?>',
>>'cancelImg'  : '/admin/img/cancel.png',
>>'fileExt':
>> '*.JPG;*.jpg;*.jpeg;*.png;*.gif',
>>'folder' : '../../../uploads/temp/',
>>'multi'  : true,
>>'auto'   : true,
>>'simUploadLimit' : 1,
>>'sizeLimit'  : 700
>>});
>> });
>> 
>> Multiple File Upload
>> file('Image.name1', array('escape'=>false,
>> 'id'=>'fileInput2')); ?>
>> Clear
>> Queue
>>
>> Enjoy - I also have it working with the image.php component now, i
>> have had to update the component, but it was fairly straightforward.
>> Let me know if you want info about that implementation.
>>
>> On Apr 9, 1:10 am, Sam Sherlock  wrote:
>> > I saw Fonzie was making progress with uploadify (having a discussion
>> with
>> > himself on this list as I recall - but productive 1)
>> >
>> > he documented his progress on uploadify forum - I also tried his
>> findings to
>> > partially good results - better than swfupload anyway
>> >
>> > here is the linkhttp://
>> www.uploadify.com/forum/viewtopic.php?f=7&t=5017&p=9334&hilit=...
>> >
>> > I managed to get files uploading (multiple files) but not able to
>> > insert/update to db - and it logged me out after too
>> >
>> > I was using cake 1.3 & latest uploadify too
>> >
>> > - S
>> >
>> > On 9 April 2010 08:47, luke BAKING barker  wrote:
>> >
>> > > any luck with this? I would like to try uploadify but it seems there
>> > > are only broken reports with cake in the google group? Anybody used it
>> > > successfully out there?
>> >
>> > > regards
>> >
>> > > Luke
>> >
>> > > On Mar 21, 10:41 pm, abocanegra  wrote:
>> > > > Correction - However, problems still not fixed
>> >
>> > > >  upload function had a typo, fixed it but still not
>> > > > uploading file
>> > > > function upload()
>> > > > {
>> > > >  if (isset($this->params['form']['Filedata']))
>> > > > {
>> > > > //Derived from theuploadify.php file - does not work
>> > > > $tempFile = $this->params['form']['Filedata']['name'];
>> > > > $targetPath = '
>> http://www.whatartist.com/uploads/temp';
>> > > > $targetFile =  str_replace('//','/',$targetPath) .
>> > > $this->params['form']['Filedata']['name'];
>> >
>> > > > move_uploaded_file($tempFile,$targetFile);
>> >
>> > > > $image_path =
>> $this->params['form']['Filedata']['name'];
>> >
>> > > > if(isset($image_path))
>> > > > {
>> >
>> > > $this->Photo->saveField('image',$image_path);
>> > > > //Put success message and
>> > > redirect here
>> > > > }else{
>> > > > //Put error message here
>> > > > }
>> > > > }
>> > > > }
>> >
>> > > > Also, I beleive the multiple posting - beyond 2 entries - was a
>> > > > session issue. I deleted all sessions in the phptmpdir and it fixed
>> > > > that issue.
>> > > > I still cannot upload the file though.
>> >
>> > > > On Mar 20, 9:40 pm, abocanegra  wrote:
>> >
>> > > > > Alright, ahead of time thanks for any hel

Re: need help

2010-05-03 Thread Andrei Mita
What do you get from the secont query? And why do you need to specify
'fields' if you are doing a count?


On Mon, May 3, 2010 at 8:08 AM, chandrasekhar reddy wrote:

> hi all,
>
> i am new to cake php can any 1 help me plz,
>
>
> 1).. $rsProfile = pg_exec($conn,"SELECT strprofilename FROM
> tblmusicprofiles WHERE lngprofile = $PROFILE_ID");
>
>
> $rsProfile = $this->Tblmusicprofiles->find(
> 'all',
> array(
>  'conditions' => array(
>  'Tblmusicprofiles.lngprofile' => $PROFILE_ID
>  ),
>  'fields' => array(
>'Tblmusicprofiles.strprofilename'
>  )
> )
> );
>
>
> 2).  $intProfileCnt = pg_numrows($rsProfile);
>
>
> $rsProfile = $this->set('rsProfile', $rsProfile);
>
> $intProfileCnt = $this->Tblmusicprofiles->find(
>  'count',
>  array('conditions' => array(
>'Tblmusicprofiles.lngprofile' => $PROFILE_ID
>   ),
>   'fields' => array(
> 'Tblmusicprofiles.strprofilename'
>   )
>  )
> );
>
>  i am trying the above two statements , i got the out put of first , but i
> am unable to find out the number of rows in a particular table with
> particular colom . as write the above 2nd statement.
>
>
> plz help out
>
> thanks in advance,
>
> regards,
> chandu
>
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: notEmpty validation for the Selectbox

2010-05-03 Thread Andrei Mita
Check out the cookbook: http://book.cakephp.org/view/125/data-validation


On Mon, May 3, 2010 at 7:42 AM, Ram  wrote:

> Hello friends,
>
> In my application I have a select option to select the
> country, I need to apply the notEmpty validation to that, can anyone
> help me to fix this?
>
> Thanks in advance,
> M. Ramkumar.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


notEmpty validation for the Selectbox

2010-05-03 Thread Ram
Hello friends,

 In my application I have a select option to select the
country, I need to apply the notEmpty validation to that, can anyone
help me to fix this?

Thanks in advance,
M. Ramkumar.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: PHP CodeSniffer

2010-05-03 Thread gabriel Tessier
Hi,

I want to use coding standards with my cake app too.
The default coding standard is pear. You can change default standard
see the Code Sniffer doc.
If you use netbeans there's a plugin to check your code.
http://www.amaxus.com/cms-blog/coding-standards-netbeans-php-codesniffer
I don't find a coding wich match with cake so i try make my own...
then i give up :-(
If you make one or have more information about, i can be interested.


Thanks.




On 30 avr, 13:34, Braindead  wrote:
> Hi all
>
> is there anybody out there who uses PHP CodeSniffer with his Cake app?
> I tried PHP CodeSniffer for the first time and used the build in
> coding standards to sniff my code. Actually I get warnings because of
> Cake conventions.
>
> Method name "PostsController::admin_edit" is not on camel caps format
>
> Just to mention one warning. So can anybody lead me the way to use PHP
> CodeSniffer with CakePHP?
>
> Cheers,
> Markus
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-03 Thread AD7six


On May 2, 1:45 pm, Jon Bennett  wrote:
> > i need to use Merchant model to do a find of all 4 related data.
> > notice that Domain is the only one NOT directly related to Merchant.
>
> > i tried this in a method inside Merchant model:
>
> > $this->Behaviors->attach('Containable');
> > $this->User->Behaviors->attach('Containable');
> > $this->Shop->Behaviors->attach('Containable');
> > $this->Shop->Domain->Behaviors->attach('Containable');
>
> > $this->recursive = -1;
> > $this->User->recursive = -1;
> > $this->Shop->recursive = -1;
> > $this->Shop->Domain->recursive = -1;
>
> > return $this->find('first',
> >                array(
> >                  'contain'=>array(
> >                                         'User',
> >                                         'Shop' => array('Domain' ),
>
> >                                        ),
> >                'conditions' => $conditions
> >        ));
>
> >http://book.cakephp.org/view/1323/Containablehas errors in terms of
> > telling you where to place the conditions. my way is correct as of 1.3
> > Cakephp
>
> return $this->find('first', array(
>         // conditions for the main model
>         'conditions'=>array(),
>         // contain
>         'contain'=>array(
>                 'User'=>array(
>                         // conditions for the user model
>                         'conditions'=>array('User.status'=>1),
>                         'Other', 'Models', 'From', 'User'
>                 ),
>                 'Shop'=>array('Domain'),
>         )
> ));

Using conditions like that is the equivalent of a right join - you're
still going to get every single "main model" row - and just get an
empty array for any row which links to a user with a status that isn't
1.

hth,

AD

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-03 Thread AD7six


On May 3, 7:02 am, Kei Simone  wrote:
> Hi i did this
>
> $this->Behaviors->attach('Containable');
>                 $this->User->Behaviors->attach('Containable');
>                 $this->Shop->Behaviors->attach('Containable');
>                 $this->Shop->Domain->Behaviors->attach('Containable');
>
>                 $this->recursive = -1;
>                 $this->User->recursive = -1;
>                 $this->Shop->recursive = -1;
>                 $this->Shop->Domain->recursive = -1;
>
>                 return $this->find('first', array(
>                         // conditions for the main model
>                         'conditions'=>array('Merchant.owner'=>1),
>                         // contain
>                         'contain'=>array(
>                                 'User'=>array(
>                                         // conditions for the user model
>                                         
> 'conditions'=>array('User.group_id'=>MERCHANTS,
>                                                             'User.email' => 
> 'a...@a.com',),
>
>                                 ),
>                                 'Shop'=>array(
>                                         
> 'conditions'=>array('Shop.web_address' => 'http://
> abc.myspree2shop.com',),
>                                               'Domain'),
>                         )
>                 ));
>
> i got this in the sql query log
>
> SELECT `Merchant`.`id`, `Merchant`.`owner`, `Merchant`.`shop_id`,
> `Merchant`.`user_id`, `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
> `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
> `Shop`.`status`, `User`.`id`, `User`.`email`, `User`.`password`,
> `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
> `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
> `User`.`modified_on` FROM `merchants` AS `Merchant` LEFT JOIN `shops`
> AS `Shop` ON (`Merchant`.`shop_id` = `Shop`.`id` AND
> `Shop`.`web_address` = 'http://abc.myspree2shop.com') LEFT JOIN
> `users` AS `User` ON (`Merchant`.`user_id` = `User`.`id` AND
> `User`.`group_id` = 3 AND `User`.`email` = 'a...@a.com') WHERE
> `Merchant`.`owner` = 1 LIMIT 1
>
> SELECT `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
> `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
> `Shop`.`status` FROM `shops` AS `Shop` WHERE `Shop`.`id` = 1 AND
> `Shop`.`web_address` = 'http://abc.myspree2shop.com'
>
> SELECT `User`.`id`, `User`.`email`, `User`.`password`,
> `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
> `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
> `User`.`modified_on` FROM `users` AS `User` WHERE `User`.`id` = 1 AND
> `User`.`group_id` = 3 AND `User`.`email` = 'a...@a.com'
>
> i got this result
>
> Array
> (
>     [Merchant] => Array
>         (
>             [id] => 1
>             [owner] => 1
>             [shop_id] => 1
>             [user_id] => 1
>         )
>
>     [Shop] => Array
>         (
>             [id] =>
>             [theme_id] =>
>             [name] =>
>             [web_address] =>
>             [created_on] =>
>             [modified_on] =>
>             [status] =>
>         )
>
>     [User] => Array
>         (
>             [id] =>
>             [email] =>
>             [password] =>
>             [group_id] =>
>             [full_name] =>
>             [name_to_call] =>
>             [last_login_on] =>
>             [status] =>
>             [created_on] =>
>             [modified_on] =>
>         )
>
> )
>
> When i changed your recommendation to
>
>                             return $this->find('first',
>                                         array(
>                                           'contain'=>array(
>                                                            'User',
>                                                            'Shop' => 
> array('Domain'
>                                                                         ),
>
>                                                            ),
>                                           'conditions' => 
> array('User.group_id'=>MERCHANTS,
>                                                             'User.email' => 
> 'a...@a.com',
>
> 'Shop.web_address' => 'http://abc.myspree2shop.com',
>                                                            )
>                                           )
>                                 );
>
> all i did was to move all the conditions to the main model.
>
> i got this in my sql query log:
> SELECT `Merchant`.`id`, `Merchant`.`owner`, `Merchant`.`shop_id`,
> `Merchant`.`user_id`, `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
> `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
> `Shop`.`status`, `User`.`id`, `User`.`email`, `User`.`password`,
> `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
> `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
> `User`.`modified_on` FROM `merchants` AS `Merchant` LEFT JOIN `s

Re: Implementing uploadify - File upload issue - param definitions issue

2010-05-03 Thread Andrei Mita
Your timing could not be better. Thanks


On Mon, May 3, 2010 at 9:05 AM, abocanegra  wrote:

> I have it working -
>
> photoController -
>
> function upload(){
>
>if (isset($this->params['form']['Filedata']))
>{
>$tempFile = $this->params['form']['Filedata']['tmp_name'];
>$targetPath = '../../../uploads/temp/';
>$targetFile =  str_replace('//','/',$targetPath) . $this-
> >params['form']['Filedata']['name'];
>
>move_uploaded_file($tempFile,$targetFile);
>echo "1";
>
>$image_path = $this->params['form']['Filedata']['name'];
>
>if(isset($image_path))
>{
>
>  $this->Photo->saveField('image',$image_path);
>//Put success message and redirect here
>}else{
>//Put error message here
>}
>}
> }
>  // Handle multiple incoming uploads.
>function addmulti() {
>}
>
> //Addmulti view (no upload view)
> 
>  $(document).ready(function() {
>$("#fileInput2").uploadify({
>'uploader'   : '/admin/swf/uploadify.swf',
>'script' : ' $html->url('/photos/upload/'.$session-
> >id()); ?>',
>'cancelImg'  : '/admin/img/cancel.png',
>'fileExt': '*.JPG;*.jpg;*.jpeg;*.png;*.gif',
>'folder' : '../../../uploads/temp/',
>'multi'  : true,
>'auto'   : true,
>'simUploadLimit' : 1,
>'sizeLimit'  : 700
>});
> });
> 
> Multiple File Upload
> file('Image.name1', array('escape'=>false,
> 'id'=>'fileInput2')); ?>
> Clear
> Queue
>
> Enjoy - I also have it working with the image.php component now, i
> have had to update the component, but it was fairly straightforward.
> Let me know if you want info about that implementation.
>
> On Apr 9, 1:10 am, Sam Sherlock  wrote:
> > I saw Fonzie was making progress with uploadify (having a discussion with
> > himself on this list as I recall - but productive 1)
> >
> > he documented his progress on uploadify forum - I also tried his findings
> to
> > partially good results - better than swfupload anyway
> >
> > here is the linkhttp://
> www.uploadify.com/forum/viewtopic.php?f=7&t=5017&p=9334&hilit=...
> >
> > I managed to get files uploading (multiple files) but not able to
> > insert/update to db - and it logged me out after too
> >
> > I was using cake 1.3 & latest uploadify too
> >
> > - S
> >
> > On 9 April 2010 08:47, luke BAKING barker  wrote:
> >
> > > any luck with this? I would like to try uploadify but it seems there
> > > are only broken reports with cake in the google group? Anybody used it
> > > successfully out there?
> >
> > > regards
> >
> > > Luke
> >
> > > On Mar 21, 10:41 pm, abocanegra  wrote:
> > > > Correction - However, problems still not fixed
> >
> > > >  upload function had a typo, fixed it but still not
> > > > uploading file
> > > > function upload()
> > > > {
> > > >  if (isset($this->params['form']['Filedata']))
> > > > {
> > > > //Derived from theuploadify.php file - does not work
> > > > $tempFile = $this->params['form']['Filedata']['name'];
> > > > $targetPath = '
> http://www.whatartist.com/uploads/temp';
> > > > $targetFile =  str_replace('//','/',$targetPath) .
> > > $this->params['form']['Filedata']['name'];
> >
> > > > move_uploaded_file($tempFile,$targetFile);
> >
> > > > $image_path =
> $this->params['form']['Filedata']['name'];
> >
> > > > if(isset($image_path))
> > > > {
> >
> > > $this->Photo->saveField('image',$image_path);
> > > > //Put success message and
> > > redirect here
> > > > }else{
> > > > //Put error message here
> > > > }
> > > > }
> > > > }
> >
> > > > Also, I beleive the multiple posting - beyond 2 entries - was a
> > > > session issue. I deleted all sessions in the phptmpdir and it fixed
> > > > that issue.
> > > > I still cannot upload the file though.
> >
> > > > On Mar 20, 9:40 pm, abocanegra  wrote:
> >
> > > > > Alright, ahead of time thanks for any help on this. I have been
> > > > > researching for far longer than I care to admit. I am attempting to
> > > > > getuploadify2.1 to work with cakePHP 1.3. I have read up a great
> > > > > deal on other formats as well, such as swfupload.
> >
> > > > > Controller name = photos_controller.php
> > > > >   relevant functions = upload & addmult
> > > > > Model Name = photo.php
> > > > >

Re: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-03 Thread Andrei Mita
Or here is another idea. Make a find('all') query with $recursive = 2 and
see how much information is there that you don't need.


On Mon, May 3, 2010 at 10:33 AM, Andrei Mita  wrote:

> Simone,
>
> Containable is extremely powerful. I am just amazed how little time it
> takes me to write complex queries.
>
> Give me the structure of the tables and an example of what do you want to
> retrieve from them and I might be able to help you around.
>
>
>
> On Mon, May 3, 2010 at 8:02 AM, Kei Simone  wrote:
>
>> Hi i did this
>>
>> $this->Behaviors->attach('Containable');
>>$this->User->Behaviors->attach('Containable');
>>$this->Shop->Behaviors->attach('Containable');
>>$this->Shop->Domain->Behaviors->attach('Containable');
>>
>>$this->recursive = -1;
>>$this->User->recursive = -1;
>>$this->Shop->recursive = -1;
>>$this->Shop->Domain->recursive = -1;
>>
>>
>>return $this->find('first', array(
>> // conditions for the main model
>> 'conditions'=>array('Merchant.owner'=>1),
>> // contain
>>'contain'=>array(
>>'User'=>array(
>>// conditions for the user model
>>
>>  'conditions'=>array('User.group_id'=>MERCHANTS,
>>'User.email' =>
>> 'a...@a.com',),
>>
>>),
>>'Shop'=>array(
>>
>>  'conditions'=>array('Shop.web_address' => 'http://
>> abc.myspree2shop.com',),
>>  'Domain'),
>>)
>>));
>>
>>
>> i got this in the sql query log
>>
>> SELECT `Merchant`.`id`, `Merchant`.`owner`, `Merchant`.`shop_id`,
>> `Merchant`.`user_id`, `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
>> `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
>> `Shop`.`status`, `User`.`id`, `User`.`email`, `User`.`password`,
>> `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
>> `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
>> `User`.`modified_on` FROM `merchants` AS `Merchant` LEFT JOIN `shops`
>> AS `Shop` ON (`Merchant`.`shop_id` = `Shop`.`id` AND
>> `Shop`.`web_address` = 'http://abc.myspree2shop.com') LEFT JOIN
>> `users` AS `User` ON (`Merchant`.`user_id` = `User`.`id` AND
>> `User`.`group_id` = 3 AND `User`.`email` = 'a...@a.com') WHERE
>> `Merchant`.`owner` = 1 LIMIT 1
>>
>>
>> SELECT `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
>> `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
>> `Shop`.`status` FROM `shops` AS `Shop` WHERE `Shop`.`id` = 1 AND
>> `Shop`.`web_address` = 'http://abc.myspree2shop.com'
>>
>> SELECT `User`.`id`, `User`.`email`, `User`.`password`,
>> `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
>> `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
>> `User`.`modified_on` FROM `users` AS `User` WHERE `User`.`id` = 1 AND
>> `User`.`group_id` = 3 AND `User`.`email` = 'a...@a.com'
>>
>>
>>
>> i got this result
>>
>> Array
>> (
>>[Merchant] => Array
>>(
>>[id] => 1
>>[owner] => 1
>>[shop_id] => 1
>>[user_id] => 1
>>)
>>
>>[Shop] => Array
>>(
>>[id] =>
>>[theme_id] =>
>>[name] =>
>>[web_address] =>
>>[created_on] =>
>>[modified_on] =>
>>[status] =>
>>)
>>
>>[User] => Array
>>(
>>[id] =>
>>[email] =>
>>[password] =>
>>[group_id] =>
>>[full_name] =>
>>[name_to_call] =>
>>[last_login_on] =>
>>[status] =>
>>[created_on] =>
>>[modified_on] =>
>>)
>>
>> )
>>
>>
>>
>>
>> When i changed your recommendation to
>>
>>return $this->find('first',
>>array(
>>  'contain'=>array(
>>   'User',
>>   'Shop' =>
>> array('Domain'
>>),
>>
>>
>>   ),
>>   'conditions' =>
>> array('User.group_id'=>MERCHANTS,
>>'User.email' =>
>> 'a...@a.com',
>>
>> 'Shop.web_address' => 'http://abc.myspree2shop.com',
>>   )
>>  )
>>);
>>
>>
>> all i did was to move all the conditions to the main model.
>>
>> i got this in my sql q

Re: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-03 Thread Andrei Mita
Simone,

Containable is extremely powerful. I am just amazed how little time it takes
me to write complex queries.

Give me the structure of the tables and an example of what do you want to
retrieve from them and I might be able to help you around.


On Mon, May 3, 2010 at 8:02 AM, Kei Simone  wrote:

> Hi i did this
>
> $this->Behaviors->attach('Containable');
>$this->User->Behaviors->attach('Containable');
>$this->Shop->Behaviors->attach('Containable');
>$this->Shop->Domain->Behaviors->attach('Containable');
>
>$this->recursive = -1;
>$this->User->recursive = -1;
>$this->Shop->recursive = -1;
>$this->Shop->Domain->recursive = -1;
>
>
>return $this->find('first', array(
> // conditions for the main model
> 'conditions'=>array('Merchant.owner'=>1),
> // contain
>'contain'=>array(
>'User'=>array(
>// conditions for the user model
>
>  'conditions'=>array('User.group_id'=>MERCHANTS,
>'User.email' =>
> 'a...@a.com',),
>
>),
>'Shop'=>array(
>
>  'conditions'=>array('Shop.web_address' => 'http://
> abc.myspree2shop.com',),
>  'Domain'),
>)
>));
>
>
> i got this in the sql query log
>
> SELECT `Merchant`.`id`, `Merchant`.`owner`, `Merchant`.`shop_id`,
> `Merchant`.`user_id`, `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
> `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
> `Shop`.`status`, `User`.`id`, `User`.`email`, `User`.`password`,
> `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
> `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
> `User`.`modified_on` FROM `merchants` AS `Merchant` LEFT JOIN `shops`
> AS `Shop` ON (`Merchant`.`shop_id` = `Shop`.`id` AND
> `Shop`.`web_address` = 'http://abc.myspree2shop.com') LEFT JOIN
> `users` AS `User` ON (`Merchant`.`user_id` = `User`.`id` AND
> `User`.`group_id` = 3 AND `User`.`email` = 'a...@a.com') WHERE
> `Merchant`.`owner` = 1 LIMIT 1
>
>
> SELECT `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
> `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
> `Shop`.`status` FROM `shops` AS `Shop` WHERE `Shop`.`id` = 1 AND
> `Shop`.`web_address` = 'http://abc.myspree2shop.com'
>
> SELECT `User`.`id`, `User`.`email`, `User`.`password`,
> `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
> `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
> `User`.`modified_on` FROM `users` AS `User` WHERE `User`.`id` = 1 AND
> `User`.`group_id` = 3 AND `User`.`email` = 'a...@a.com'
>
>
>
> i got this result
>
> Array
> (
>[Merchant] => Array
>(
>[id] => 1
>[owner] => 1
>[shop_id] => 1
>[user_id] => 1
>)
>
>[Shop] => Array
>(
>[id] =>
>[theme_id] =>
>[name] =>
>[web_address] =>
>[created_on] =>
>[modified_on] =>
>[status] =>
>)
>
>[User] => Array
>(
>[id] =>
>[email] =>
>[password] =>
>[group_id] =>
>[full_name] =>
>[name_to_call] =>
>[last_login_on] =>
>[status] =>
>[created_on] =>
>[modified_on] =>
>)
>
> )
>
>
>
>
> When i changed your recommendation to
>
>return $this->find('first',
>array(
>  'contain'=>array(
>   'User',
>   'Shop' =>
> array('Domain'
>),
>
>
>   ),
>   'conditions' =>
> array('User.group_id'=>MERCHANTS,
>'User.email' =>
> 'a...@a.com',
>
> 'Shop.web_address' => 'http://abc.myspree2shop.com',
>   )
>  )
>);
>
>
> all i did was to move all the conditions to the main model.
>
> i got this in my sql query log:
> SELECT `Merchant`.`id`, `Merchant`.`owner`, `Merchant`.`shop_id`,
> `Merchant`.`user_id`, `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
> `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
> `Shop`.`status`, `User`.`id`, `User`.`email`, `User`.`password`,
> `User`.`group_id`, `User`.`full_name`, `User`.`name

Re: Selected option in select

2010-05-03 Thread Andrei Mita
I'll give it a try right now, thanks.


On Sun, May 2, 2010 at 10:21 AM, WebbedIT  wrote:

> Glad u got it working :o)
>
> If you change the file name to Profile.group, you should be able to
> remove the 'selected' =>$this->data['Profile']['group'] attribute.
>
> P.S. to show the input without a label using form->input you just
> supply label=>false.  I personally much prefer using the same method
> as much as possible and form->input very rarely lets me down.
>
> HTH
>
> Paul
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en