Re: Cakephp 1.3 Edit Action Not Populating Fields

2013-06-11 Thread Karl Smith
Yea I noticed that! Thanks!! Only thing now is my find method is not 
retrieving the correct records. I will post more later. Again thanks!

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

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




Cakephp 1.3 Edit Action Not Populating Fields

2013-06-07 Thread Karl Smith
I'm having a problem with my edit action and Im not sure what my problem is 
but my fields are not populating. In my model I have a function that 
retrieves 3 records based on an id, and I call that function in my 
controller, which in turn should populate data in the view. I have tried to 
debug but have had no luck. I have tried to use die(debug($this->data)); 
but I when I run the script the next page loads instead of displaying what 
is in $this->data, which is strange to me! With that said, here is what 
I've got. Any input would be greatly appreciated! Thanks!


Model

public function declinationsForPolicyId($id = null) {
if ($id) {
$items = $this->find('all', array(
'conditions' => array(
'Declination.policy_id' => $id
),
'limit' => 3,
'contain' => array()
));
foreach ($items as $item) {
$ret= $item['Declination'];
}
$ret = array('Declination' => $ret);
 }
 return $ret;
}


Controller

public function edit($id = null) {
if (!empty($this->data)) {
die(debug($this->data));
$this->Declination->create();
$this->data = $this->Declination->declinationsForPolicyId($id);
if ($this->Declination->saveAll($this->data['Declination'])) {
$this->Session->setFlash(__('Declinations saved.', true));
$this->redirect(array(
'controller' => 'policies',
'action' => 'view',
$id
));
} else {
$this->Session->setFlash(__('Declinations failed to save.', true));
}
} 
 $reasons = $this->Declination->Reason->find('list');
$contactTypes = $this->Declination->ContactType->find('list');
$this->set(compact('id', 'reasons', 'contactTypes'));
}


View

 
 UiForm->create('Declination', array(
'url' => array(
'controller' => 'declinations',
'action' => 'add',
$id
)
)); ?>


 Declination 
UiForm->input("Declination.{$i}.policy_id", array(
'type' => 'hidden',
'value' => $id
)); ?>
UiForm->input("Declination.{$i}.id", array(
'type' => 'hidden'
)); ?>
UiForm->input("Declination.{$i}.first_name"); ?>
UiForm->input("Declination.{$i}.last_name"); ?>
UiForm->input("Declination.{$i}.company"); ?>
UiForm->input("Declination.{$i}.contact_type_id"); ?>
UiForm->input("Declination.{$i}.phone_number"); ?>
UiForm->input("Declination.{$i}.reason_id"); ?>
UiForm->input("Declination.{$i}.other", array(
'label' => 'If other, please supply a reason'
)); ?>
UiForm->input("Declination.{$i}.dated", array(
'type' => 'text',
'readonly' => 'readonly',
'data-datepicker' => ''
)); ?>



UiForm->end(array('label'=>'Continue', 'class'=>'btn 
success large fr')); ?>

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

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




Re: Edit Page Not Populating Data

2013-05-16 Thread Karl Smith
Also here is my controller


   /**
 * edit function.
 * 
 * @access public
 * @param mixed $id (default: null)
 * @return void
 */
public function edit($id = null) {
if (!empty($this->data)) {
$this->Declination->create();
if ($this->Declination->saveAll($this->data['Declination'])) {
$this->Session->setFlash(__('Declinations saved.', true));
$this->redirect(array(
'controller' => 'coverages',
'action' => 'view',
$id
));
} else {
$this->Session->setFlash(__('Declinations failed to save.', true));
}
} else {
$this->data = $this->Declination->declinationsForPolicyId($id);
}
$reasons = $this->Declination->Reason->find('list');
$contactTypes = $this->Declination->ContactType->find('list');
$this->set(compact('id', 'reasons', 'contactTypes'));
}

}

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

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




Edit Page Not Populating Data

2013-05-16 Thread Karl Smith
I am trying to populate fields in my edit action. I have been struggling 
with this for a full day now and can't seem to wrap my head around it. Here 
is what Ive got.


The model is Declination which belongsTo Policy. Policy hasMany 
Declination. With that said, the edit action does contain the id of a 
declination as follows (edit/x-x-xxx-)
 
Furthermore, when I debug $items they array is empty! What am I doing wrong 
or not doing at all? Any input would be greatly appreciated!




Here is my function located in my model that uses the find method for the 
declination.


 /**
 * A Policy can only have 3 declinations or none, so this method will 
return the
 * declinations that belong to the Policy in a format that will prepopulate 
the 
 * edit form correctly.
 * 
 * @access public
 * @param mixed $id (default: null)
 * @return void
 */
public function declinationsForPolicyId($id = null) {
$ret = array();
if ($id) {
$items = $this->find('all', array(
'conditions' => array(
'Declination.policy_id' => $id
),
'limit' => 3,
'contain' => array()
));
foreach ($items as $i) {
$ret[] = $i['Declination'];
}
$ret = array('Declination' => $ret);
 }
return $ret;
}

}


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

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




Re: Find Method On Associated Models

2013-05-10 Thread Karl Smith

*aren't

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

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




Find Method On Associated Models

2013-05-10 Thread Karl Smith
I am having some problems with the find method on a associated model. For 
some reason my Declinations are populating in policy/view. I have a model 
named Policy, and I have a model named Declinations that is associated with 
the Policy model. A policy hasMany Declinations. Now with all of that said, 
here is what I've got and what I've tried so far. What am I doing wrong or 
not doing at all. Any input would be greatly appreciated. Thanks!


 Model


 public function getPolicies($conditions = array()) {
$default = array(
'contain' => array(
'Endorsement' => array(
'order' => array(
'Endorsement.endorsement_date' => 'DESC',
'Endorsement.created' => 'DESC'
),
'Document'
),
'Location',
'Declination',
'Company',
'Document'
)
);
$cond = array();
if (array_key_exists('conditions', $conditions) && 
!empty($conditions['conditions'])) {
$default['conditions'] = $conditions['conditions'];
}
$policies = $this->find('all', $default);
$declination = $this->Declination->find('all');
$states = ClassRegistry::init('State')->states();
if (!empty($policies)) {
foreach ($policies as &$policy) { 
$policy['Producing'] = $policy['Filing'] = array();
if (isset($states[$policy['Policy']['producing_id']])) {
$policy['Producing'] = $states[$policy['Policy']['producing_id']];
}
if (isset($states[$policy['Policy']['filing_id']])) {
$policy['Filing'] = $states[$policy['Policy']['filing_id']];
}
}
}
return $policies;
return $declination;
}


Controller

 public function view($id = null) {
$policy = $this->Policy->getPolicy($id);
$group = 
$this->Policy->Coverage->User->Group->group($this->Auth->user('group_id'));
if (!empty($this->data)) {
$this->redirect(array(
'controller' => 'coverages',
'action' => 'view',
$policy['Policy']['coverage_id']
));
}
 $this->set(compact('id', 'policy'));
$this->render('view', null, strtolower($group['name']).'/view');
}



View

 Declinations


Html->link(
__('Edit', true),
array(
'controller' => 'declinations',
'action' => 'edit',
$coverage['Coverage']['id']
),
array('class'=>'btn fr')
); ?>






 












 Date: 





Html->link(
__('Add Declinations', true),
array(
'controller' => 'declinations',
'action' => 'add',
print_r($policy)
),
array('class'=>'btn success fr')
); ?>
No declinations for this policy. 




In addition to the code above. This method calls the getPolicies method 
above.


 public function getPolicy($id = null) {
if (!$id) {
return array();
}
$policy = $this->getPolicies(array(
'conditions' => array(
'Policy.id' => $id,
'Policy.is_deleted' => 0
)
));
if (!empty($policy)) {
$policy = $policy[0];
}
return $policy;
}

 

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

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




Help With Classes and Objects

2013-03-06 Thread Karl Smith
I am currently taking on a medium sized application and I need a few 
pointers as far as the design process goes. The project I am working on is 
going to be a new version of a website written with the ASP.NET 1.1 
framework. The application I am working with is very straightforward ,but I 
want to know what should be considered a class. There is one class that I 
am sure that I will have and that is Users. Now with that said, the 
application will have three types of users, which are Agency, Individuals, 
and last but not least Admin. Now the only thing that my application will 
be really used for is to submit data via forms, and once submitted the 
users will have to the ability to view the data submitted and export the 
data to an excel spreadsheet. Now my question is by looking at the legacy 
website, how should I know what should be considered a class, and also what 
should be considered an object. With that said, this is my first real 
project and I just need a little guidance. Thanks in advance!!  

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

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




Re: Cakephp .htaccess/Mod_Rewrite with hosted site

2013-02-11 Thread Karl Smith
I finally got! I moved the files to the upper directory. Being that I am
Cakephp Noob, I was afraid of breaking something!! Thank God I didn't! With
that said, thanks Vanja!

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

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




Re: Cakephp .htaccess/Mod_Rewrite with hosted site

2013-02-06 Thread Karl Smith

Ok will do! Thanks!

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

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




Cakephp .htaccess/Mod_Rewrite with hosted site

2013-02-06 Thread Karl Smith


Currently you can access my website with something like this 
www..com//source/now my question is how would I alter my 
.htaccess file so I can access my site like this www..com/? I have 
looked around on the web but I don't have a clear understanding of 
mod_rewrite.Any input would be greatly appreciated! Thanks!

My .htaccess file is as follows

   

RewriteEngine on
RewriteRule^$webroot/[L]
RewriteRule(.*) webroot/$1[L]

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

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




Re: Save Uploaded/Parsed File to Database Table

2013-02-05 Thread Karl Smith
I solved my problem. I added the following to my controller

$this->data['Spreadsheet']['coverage_id'] = $this->Coverage->id;
$this->data['Spreadsheet']['user_id'] = $this->Auth->user('id');
$this->data['Spreadsheet']['filename'] = $uploadedFile['name'];
$this->data['Spreadsheet']['filepath'] = 
'x//xx/xxx/xx';
$this->Coverage->Spreadsheet->save($this->data);
$this->set(compact('coverage_id'));


and I added this to my view



UiForm->input('coverage_id', array('type' => 'hidden')); ?>


Hope this helps someone!


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

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




Re: Save ID for Associated Table

2013-02-04 Thread Karl Smith
I solved my problem!!! I added this to my controller

$this->data['Spreadsheet']['coverage_id'] = $this->Coverage->id;
$this->Coverage->Spreadsheet->save($this->data);

With that said, the reason I was having so much trouble is because CakePHP 
doesn't have saving multiple relationships/associations documented very 
well for CakePHP 1.3. I found this post on 
StackOverFlow
 that 
helped me get over the hump! Hope this helps someone!! 

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

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




Re: Save ID for Associated Table

2013-01-31 Thread Karl Smith
Also I forgot to mention I am getting this error message*SQL Error:*1452: 
Cannot add or update a child row: a foreign key constraint fails

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

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




Save ID for Associated Table

2013-01-31 Thread Karl Smith
I am trying to save the ID for a table called Coverages in a table called 
Spreadsheets. I have all my associations correct but for some reason I 
cannot wrap my head around this task, which I know it is probably simple. 
This is what I have tried. 

View:
UiForm->input('coverage.id', array('type' => 'hidden')); 
?>

As you can see in my view I have created a hidden input field for my ID.

Controller:
public function processSpreadsheet($coverageId = null) {
if(!empty($this->data)) {
if(isset($this->data['Coverage']) && !empty($this->data['Coverage'])) {
if(array_key_exists('Spreadsheet', $this->data['Coverage']) && 
$this->data['Coverage']['Spreadsheet']['size'] > 0) { 
$uploadedFile = $this->data['Coverage']['Spreadsheet'];
$coverageId = $this->Coverage->id;
$this->set('coverage.id', $coverageId);
$spreadsheetId = $this->Coverage->saveSpreadsheet($uploadedFile);
if($spreadsheetId) {
$this->Session->setFlash(__('Spreadsheet processed and saved 
successfully.', true));
$this->redirect(array(
'action' => 'edit',
$spreadsheetId
));
} else {
$this->Session->setFlash(__('Spreadsheet processing failed.', true));
$this->redirect(array(
'action' => 'add'
));
}
}
}
}
 }
I have created a var called CoverageId in the controller also I have set 
the CoverageId as well.

Model:
public function saveSpreadsheet($uploadedFile) {
if(!empty($uploadedFile) && !empty($uploadedFile['tmp_name'])) {
if($uploadedFile['error'] == UPLOAD_ERR_OK) {
$pulledData = $this->extract($uploadedFile['tmp_name']);
$filePath = WWW_ROOT.'/spreadsheet/' . DS . $uploadedFile['name'] ;
if(!empty($pulledData)){
$pulledData = 
$this->Declination->ContactType->setSpreadsheetContactTypeIds($pulledData);
if(!empty($pulledData[$this->alias])) {
$this->save($pulledData[$this->alias]);
unset($pulledData[$this->alias]);
$coverageId = $this->id;
$pulledData = $this->setSpreadsheetCoverageIds($pulledData, $coverageId);
$pulledData = 
$this->CoverageInsured->setSpreadsheetCoverageInsuredIds($pulledData);
//$pulledData = 
$this->Policy->Location->setupSpreadsheetPolicyLocation($pulledData, 
$coverageId);
}
$this->CoverageInsured->save($pulledData['CoverageInsured']);
$this->Declination->saveAll($pulledData['Declination']);
$this->savePolicyData($pulledData);
$this->Spreadsheet->save($this->data);
move_uploaded_file($uploadedFile['tmp_name'], $filePath); 
//$this->Policy->Location->saveAll($pulledData['Location']);
//$this->Policy->Company->saveAll($pulledData['Policy']);
return $coverageId;
}
}
}
 return false;
}

Last but not least I am saving data to my spreadsheet table.


Im not sure what Im doing wrong or what I am not doing at all. If someone 
would please explain to me how this is suppose to work. I have read 
the documentation but some things are still unclear to me. I think I am 
doing something wrong in my controller and my model. As far as my model 
goes I think its just a matter of passing the right argument to the save 
method, and Im not sure what Im doing wrong in my controller. With that 
said, any input on this issue will be greatly appreciated!! Thanks!!


 

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

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




Re: Save Uploaded/Parsed File to Database Table

2013-01-24 Thread Karl Smith
And I am suppose to set the Model ID in the controller right?

On Wednesday, January 23, 2013 12:56:15 PM UTC-6, cricket wrote:
>
> On Wed, Jan 23, 2013 at 11:41 AM, Karl Smith 
> > 
> wrote: 
> > I just want to verify that my logic is right before I move 
> forward...If 
> > I use UiForm->input('id', array('type' => 'hidden')); 
>  to 
> > pass my id to my controllerthe id will be automagically added to my 
> > $data array...correct? 
>
> Not exactly. FormHelper populates inputs based on what's in 
> $this->request->data. But since you're not trying to populate an 
> entire form so as to edit the record, you can just do this: 
>
> $this->set('model_id', $model_id); 
>
> view: 
>
> echo $form->hidden('Model.id', array('value' => $model_id)); 
>

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

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




Re: Save Uploaded/Parsed File to Database Table

2013-01-23 Thread Karl Smith
I just want to verify that my logic is right before I move forward...If 
I use UiForm->input('id', array('type' => 'hidden'));  to 
pass my id to my controllerthe id will be automagically added to my 
$data array...correct? 

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

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




Re: Save Uploaded/Parsed File to Database Table

2013-01-18 Thread Karl Smith
Yea I know.Im somewhat new to this.

On Fri, Jan 18, 2013 at 1:01 PM, lowpass  wrote:

> Technically, yes. But without knowing the details of what you're
> doing, take that with a grain of salt.
>
> You might want to specify the model, for one thing.
>
> On Fri, Jan 18, 2013 at 10:02 AM, Karl Smith  wrote:
> > Is it possible to pass the id to my action like this?
> >
> > UiForm->input('id', array('type' => 'hidden')); ?>
> >
> >
> >
> >
> > On Thu, Jan 17, 2013 at 5:56 PM, lowpass  wrote:
> >>
> >> On Wed, Jan 16, 2013 at 5:37 PM, Karl Smith 
> wrote:
> >> >
> >> >
> >> >>
> >> >> > Now as far as my view goes..do I need to add an input for user_id
> and
> >> >> > coverage_id as hidden fields?
> >> >>
> >> >> The user_id you can add manually after the upload with
> >> >> $this->Auth->user('id') but for coverage_id you can either use a
> >> >> hidden form field or add that data to the array before saving as
> well.
> >> >> Either way, you'll need to know what the coverage_id is so you should
> >> >> pass it to the action in the first place:
> >> >>
> >> >> echo $this->Html->link(
> >> >> 'upload spreadsheet',
> >> >> array(
> >> >> 'controller' => 'Coverages',
> >> >> 'action' => 'processSpreadsheet',
> >> >> 'coverage_id' => $xxx
> >> >> )
> >> >> );
> >> >>
> >> > Ok...I have a quick questionis there another way to pass the
> >> > coverage_id
> >> > beside the code listed above. I need to pass the coverage_id  but I
> >> > don't
> >> > need a hyperlink.
> >>
> >> Well, the link is just an example. How does the user arrive at the
> >> upload form? Whichever way you choose, you're going to have to pass
> >> $coverage_id to your action somehow.
> >>
> >> --
> >> Like Us on FaceBook https://www.facebook.com/CakePHP
> >> Find us on Twitter http://twitter.com/CakePHP
> >>
> >> ---
> >> You received this message because you are subscribed to the Google
> Groups
> >> "CakePHP" group.
> >> To post to this group, send email to cake-php@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> cake-php+unsubscr...@googlegroups.com.
> >> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> >>
> >>
> >
> > --
> > Like Us on FaceBook https://www.facebook.com/CakePHP
> > Find us on Twitter http://twitter.com/CakePHP
> >
> > ---
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com.
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com.
> > Visit this group at http://groups.google.com/group/cake-php?hl=en.
> >
> >
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

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

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




Re: Save Uploaded/Parsed File to Database Table

2013-01-18 Thread Karl Smith
Is it possible to pass the id to my action like this?

UiForm->input('id', array('type' => 'hidden')); ?>




On Thu, Jan 17, 2013 at 5:56 PM, lowpass  wrote:

> On Wed, Jan 16, 2013 at 5:37 PM, Karl Smith  wrote:
> >
> >
> >>
> >> > Now as far as my view goes..do I need to add an input for user_id and
> >> > coverage_id as hidden fields?
> >>
> >> The user_id you can add manually after the upload with
> >> $this->Auth->user('id') but for coverage_id you can either use a
> >> hidden form field or add that data to the array before saving as well.
> >> Either way, you'll need to know what the coverage_id is so you should
> >> pass it to the action in the first place:
> >>
> >> echo $this->Html->link(
> >> 'upload spreadsheet',
> >> array(
> >> 'controller' => 'Coverages',
> >> 'action' => 'processSpreadsheet',
> >> 'coverage_id' => $xxx
> >> )
> >> );
> >>
> > Ok...I have a quick questionis there another way to pass the
> coverage_id
> > beside the code listed above. I need to pass the coverage_id  but I don't
> > need a hyperlink.
>
> Well, the link is just an example. How does the user arrive at the
> upload form? Whichever way you choose, you're going to have to pass
> $coverage_id to your action somehow.
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

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

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




Re: Save Uploaded/Parsed File to Database Table

2013-01-16 Thread Karl Smith



> > Now as far as my view goes..do I need to add an input for user_id and 
> > coverage_id as hidden fields? 
>
> The user_id you can add manually after the upload with 
> $this->Auth->user('id') but for coverage_id you can either use a 
> hidden form field or add that data to the array before saving as well. 
> Either way, you'll need to know what the coverage_id is so you should 
> pass it to the action in the first place: 
>
> echo $this->Html->link( 
> 'upload spreadsheet', 
> array( 
> 'controller' => 'Coverages', 
> 'action' => 'processSpreadsheet', 
> 'coverage_id' => $xxx 
> ) 
> ); 
>
> Ok...I have a quick questionis there another way to pass the 
coverage_id  beside the code listed above. I need to pass the coverage_id 
 but I don't need a hyperlink. 

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

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




Re: Save Uploaded/Parsed File to Database Table

2013-01-09 Thread Karl Smith
Ok...I finally got the file to save in the file system correctly. Here is 
my code

$filePath = WWW_ROOT.'/spreadsheet/' . DS . $uploadedFile['name'] ;
move_uploaded_file($uploadedFile['tmp_name'], $filePath);

Now I have to save the meta data associated with file as well as the file 
path. If I need some assistance I will let you guys know. Thank you for 
taking the time to look at my post and helping me! Yall don't know how much 
I appreciate you guys!

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

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




Re: Save Uploaded/Parsed File to Database Table

2013-01-08 Thread Karl Smith
I am trying to move an uploaded file and Im having trouble with my file 
path. I want to move the uploaded file into Webroot/Spreadsheet. This is 
how I am currently doing it

$filePath = WWW_ROOT . DS . 
'spreadsheet/'.$this->data['Coverage']['Spreadsheet'];


I also get this error message.
Notice (8): Undefined index:  Coverage [APP/models/coverage.php, line 197]

Any input would be greatly appreciated!

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

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




Re: Save Uploaded/Parsed File to Database Table

2013-01-07 Thread Karl Smith
I am going to take heed to your message and save my files to my file 
system. The reason being is because my Web Application is going to process 
over 1000 files a year easily, and I don't want to run into performance 
issues in the long run. Also the file size of the uploads will increase in 
size as time goes along. In addition to your advice I also read an article 
called To Blob Or Not To Blob. It can be found 
here. 
I hope this article helps those of you who are in need of a better 
understanding and insight as to how you should save your files.

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

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




Re: Save Uploaded/Parsed File to Database Table

2013-01-04 Thread Karl Smith
Also I forgot to list the errors I have been getting when running my 
script.

*Warning* (512): *SQL Error:* 1452: Cannot add or update a child row: a foreign 
key constraint fails (`ilsa_slic`.`spreadsheets`, CONSTRAINT 
`spreadsheets_ibfk_1` FOREIGN KEY (`coverage_id`) REFERENCES `coverages` 
(`id`)) [*CORE/cake/libs/model/datasources/dbo_source.php*, line *684*]

*Query:* INSERT INTO `spreadsheets` (`modified`, `created`) VALUES ('2013-01-04 
09:19:05', '2013-01-04 09:19:05') 

*Warning* (2): Cannot modify header information - headers already sent by 
/cake/libs/debugger.php:686) [*CORE/cake/libs/controller/controller.php*, line 
*742*]

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

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




Re: Save Uploaded/Parsed File to Database Table

2013-01-04 Thread Karl Smith
Thank you for such a quick response, and yes I can not get the file to save 
in my database. Now to answer some of your questions...yes Coverage can 
only have one spreadsheet, and yes my spreadsheet table has a coverage_id 
field. With that said, I added 

die(debug(uploadedFile)); 
$CoverageId = $this->id;

and this is what I see in the view 

Array
(
[name] => SLT.xls
[type] => application/vnd.ms-excel
[tmp_name] => /tmp/phpH03DuW
[error] => 0
[size] => 36352
)


All I need from this array is the file name. Now with that said, I read alot of 
articles online about saving files to a database. Some people think it is 
better to save to the file system rather than the database. In my case I think 
the best thing for me to do is save the file in my db. My only question is "If 
I save the files to my database will it affect the performance of my website 
over time?" 


Now as far as my view goes..do I need to add an input for user_id and 
coverage_id as hidden fields?

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

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