Re: TCPDF and Cake PHP

2008-12-02 Thread Fernando Mendonça

Hello everybody,

Thanks very much everybody helps me.

I follow all steps that qwanta said and the pdf generate works! In my
view I put:

SetAuthor("KBS Homes & Properties a http://kbs-properties.com";);
$tcpdf->SetAutoPageBreak( false );
$tcpdf->setHeaderFont(array($textfont,'',20));
$tcpdf->xheadercolor = array(150,0,0);
$tcpdf->xheadertext = 'Test';
$tcpdf->xfootertext = 'Copyright © %d KBS Homes & Properties. All
rights reserved.';



// Now you position and print your page content
// example:
$tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($textfont,'B',20);
$tcpdf->Cell(0,14, "Hello World", 0,1,'L');
// ...
// etc.
// see the TCPDF examples

$tcpdf->Output('filename.pdf', 'I');

?>

Thanks again (specially qwanta  and modfather)!!!

see you!

On 1 dez, 20:18, modfather <[EMAIL PROTECTED]> wrote:
> You might try and remove "echo" from your last line of code and leave
> it as: $tcpdf->Output('filename.pdf', 'D');
> I don't know how your routes are set up but you might try
> 127.0.0.1/cake/myapp/teacher/viewpdf/1 - you are missing the action
> from your url.
>
> On Dec 1, 10:34 pm, Fernando Mendonça <[EMAIL PROTECTED]> wrote:
>
> > Hi everybody,
>
> > I'm trying to generate some pdfs files with Cake PHP and TCPDF with
> > Bakery Tutorial of this 
> > address:http://bakery.cakephp.org/articles/view/creating-pdf-files-with-cakep...
>
> > I did everything like this tutorial and I wrote in one of my
> > controller (teacher_controller.php) the follow code:
>
> >         function __view($id = null) {
> >                 if (!$id) {
> >                         $this->Session->setFlash(__('Invalid Teacher.', 
> > true));
> >                         $this->redirect(array('action'=>'index'));
> >                 }
>
> >                 $this->set('teacher', $this->Teacher->read(null, $id));
>
> >         }
>
> >         function viewPdf($id = null)
> >     {
> >         if (!$id)
> >         {
> >             $this->Session->setFlash('Sorry, there was no property ID
> > submitted.');
> >             $this->redirect(array('action'=>'index'), null, true);
> >         }
> >         //Configure::write('debug',0); // Otherwise we cannot use this
> > method while developing
>
> >         $id = intval($id);
>
> >         $property = $this->__view($id); // here the data is pulled
> > from the database and set for the view
>
> >         if (empty($property))
> >         {
> >             $this->Session->setFlash('Sorry, there is no property with
> > the submitted ID.');
> >             $this->redirect(array('action'=>'index'), null, true);
> >         }
>
> >         $this->layout = 'pdf'; //this will use the pdf.ctp layout
> >         $this->render();
> >     }
>
> > I created the view (viewPdf.ctp) too:
>
> >  > App::import('Vendor','xtcpdf');
> > $tcpdf = new XTCPDF();
> > $textfont = 'freesans'; // looks better, finer, and more condensed
> > than 'dejavusans'
>
> > $tcpdf->SetAuthor("KBS Homes & Properties athttp://kbs-properties.com";);
> > $tcpdf->SetAutoPageBreak( false );
> > $tcpdf->setHeaderFont(array($textfont,'',40));
> > $tcpdf->xheadercolor = array(150,0,0);
> > $tcpdf->xheadertext = 'KBS Homes & Properties';
> > $tcpdf->xfootertext = 'Copyright © %d KBS Homes & Properties. All
> > rights reserved.';
>
> > // Now you position and print your page content
> > // example:
> > $tcpdf->SetTextColor(0, 0, 0);
> > $tcpdf->SetFont($textfont,'B',20);
> > $tcpdf->Cell(0,14, "Hello World", 0,1,'L');
> > // ...
> > // etc.
> > // see the TCPDF examples
>
> > echo $tcpdf->Output('filename.pdf', 'D');
>
> > ?>
>
> > But when I try to acess: 127.0.0.1/cake/myapp/teacher/1 the message
> > "Sorry, there is no property with the submitted ID." appears. I know
> > this message has to appears when nothing is set to $property, but I
> > thing I'm doing this.
>
> > Anybody Can help me?
>
> > Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



TCPDF and Cake PHP

2008-12-01 Thread Fernando Mendonça

Hi everybody,

I'm trying to generate some pdfs files with Cake PHP and TCPDF with
Bakery Tutorial of this address:
http://bakery.cakephp.org/articles/view/creating-pdf-files-with-cakephp-and-tcpdf

I did everything like this tutorial and I wrote in one of my
controller (teacher_controller.php) the follow code:

function __view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid Teacher.', true));
$this->redirect(array('action'=>'index'));
}

$this->set('teacher', $this->Teacher->read(null, $id));

}

function viewPdf($id = null)
{
if (!$id)
{
$this->Session->setFlash('Sorry, there was no property ID
submitted.');
$this->redirect(array('action'=>'index'), null, true);
}
//Configure::write('debug',0); // Otherwise we cannot use this
method while developing

$id = intval($id);

$property = $this->__view($id); // here the data is pulled
from the database and set for the view

if (empty($property))
{
$this->Session->setFlash('Sorry, there is no property with
the submitted ID.');
$this->redirect(array('action'=>'index'), null, true);
}

$this->layout = 'pdf'; //this will use the pdf.ctp layout
$this->render();
}

I created the view (viewPdf.ctp) too:

SetAuthor("KBS Homes & Properties at http://kbs-properties.com";);
$tcpdf->SetAutoPageBreak( false );
$tcpdf->setHeaderFont(array($textfont,'',40));
$tcpdf->xheadercolor = array(150,0,0);
$tcpdf->xheadertext = 'KBS Homes & Properties';
$tcpdf->xfootertext = 'Copyright © %d KBS Homes & Properties. All
rights reserved.';



// Now you position and print your page content
// example:
$tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($textfont,'B',20);
$tcpdf->Cell(0,14, "Hello World", 0,1,'L');
// ...
// etc.
// see the TCPDF examples

echo $tcpdf->Output('filename.pdf', 'D');

?>

But when I try to acess: 127.0.0.1/cake/myapp/teacher/1 the message
"Sorry, there is no property with the submitted ID." appears. I know
this message has to appears when nothing is set to $property, but I
thing I'm doing this.

Anybody Can help me?

Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Date format in Grid

2008-10-15 Thread Fernando Mendonça

Hi

Writing:
format($format = 'd-m-Y', $reserve['Reserve']
['reserve_date']); ?>

in my index.ctp page the date in grid disappears. This line didn't
work.



On 15 out, 15:39, teknoid <[EMAIL PROTECTED]> wrote:
> What do you mean by "didn't work"?
>
> On Oct 15, 1:17 pm, Fernando Mendonça <[EMAIL PROTECTED]> wrote:
>
> > Anybody?
>
> > On 11 out, 15:26, Fernando Mendonça <[EMAIL PROTECTED]> wrote:
>
> > > Hi again guys,
>
> > > I'm with another problem.
>
> > > I need to change dedateformatthat appears in my grid. I was reading
> > > the manual and I try to use the TimeHelper but it didn't work. Look
> > > please my view Reserve, page index.ctp:
>
> > > 
> > >                 format($format= 'd-m-Y', 
> > > $reserve['Reserve']
> > > ['reserve_date']); ?>
> > > 
> > > 
> > >                 
> > > 
>
> > > I´ve just wrote this...
>
> > > Anybody can help me?
>
> > > Thanks again
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Date format in Grid

2008-10-15 Thread Fernando Mendonça

Anybody?

On 11 out, 15:26, Fernando Mendonça <[EMAIL PROTECTED]> wrote:
> Hi again guys,
>
> I'm with another problem.
>
> I need to change dedateformatthat appears in my grid. I was reading
> the manual and I try to use the TimeHelper but it didn't work. Look
> please my view Reserve, page index.ctp:
>
> 
>                 format($format= 'd-m-Y', $reserve['Reserve']
> ['reserve_date']); ?>
> 
> 
>                 
> 
>
> I´ve just wrote this...
>
> Anybody can help me?
>
> Thanks again
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Date format in Grid

2008-10-11 Thread Fernando Mendonça

Hi again guys,

I'm with another problem.

I need to change de date format that appears in my grid. I was reading
the manual and I try to use the TimeHelper but it didn't work. Look
please my view Reserve, page index.ctp:


format($format = 'd-m-Y', $reserve['Reserve']
['reserve_date']); ?>





I´ve just wrote this...

Anybody can help me?

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



Re: Date in another language

2008-10-11 Thread Fernando Mendonça

Thank you very much.
This problem was solved. ;)

Thanks again

On 9 out, 10:45, Simonas Juodelis <[EMAIL PROTECTED]> wrote:
> I don't know if this have changed in recent vesions (I use older one -
> 1663), but when I need to translate some application to another language
> I do this way ( for example for my (lithuanian) language):
>
> create directory cake/app/locale/lit/LC_MESSAGES/
> put here file "default.po"
> contents of this file should be like this:
>
> msgid "January"
> msgstr "Sausis"
>
> msgid "February"
> msgstr "Vasaris"
>
> .. and so on.  This works for me.
> Hope this helps.
>
> br,
> Simonas.
>
> Fernando Mendonça wrote:
> > Hi,
>
> > I didn't define translation of months. How can I do that?
>
> > I've just created the two directories: cake\myappdir\locale\pt_br
>
> > I don't know what I have to write in this file (default.po).
>
> > On 9 out, 09:41, Simonas Juodelis <[EMAIL PROTECTED]> wrote:
>
> >> I see that months are defined in forms helper, on line 01658
> >> (http://api.cakephp.org/1.2/form_8php-source.html#l01658) and it should
> >> be translated.
>
> >>  Have you defined translation of months in your language translation
> >> (*.po) files?
>
> >> br,
> >> Simonas,
>
> >> Fernando Mendonça wrote:
>
> >>> Hello
>
> >>> I'm using cakephp cake_1.2.0.7296-rc2
>
> >>> This version is not the newest?
>
> >>> Thanks
>
> >>> On 9 out, 08:27, Simonas Juodelis <[EMAIL PROTECTED]> wrote:
>
> >>>> Hi,
>
> >>>> what version on CakePHP you are using? I'm asking, because months were
> >>>> translated into other languages only in recent versions.  Probably you
> >>>> are using old version. Please try downloading newest version of CakePHP.
>
> >>>> br,
> >>>> Simonas.
>
> >>>> Fernando Mendonça wrote:
>
> >>>>> Hello everybody,
>
> >>>>> I'm trying to change the values of my date´s SELECT but it's not
> >>>>> working. I need the values like "January", "February" appears in
> >>>>> Portuguese in to SELECT. I already put "setlocale(LC_ALL,
> >>>>> "pt_BR.utf-8"); " in my "bootstrasp.php" in the application directory
> >>>>> (myapplication/config/bootstrap.php) but it´s not working yet.
>
> >>>>> Help me friends...
>
> >>>>> Thanks!
> >>>>> :o)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Date in another language

2008-10-09 Thread Fernando Mendonça

Hi,

I didn't define translation of months. How can I do that?

I've just created the two directories: cake\myappdir\locale\pt_br

I don't know what I have to write in this file (default.po).


On 9 out, 09:41, Simonas Juodelis <[EMAIL PROTECTED]> wrote:
> I see that months are defined in forms helper, on line 01658
> (http://api.cakephp.org/1.2/form_8php-source.html#l01658) and it should
> be translated.
>
>  Have you defined translation of months in your language translation
> (*.po) files?
>
> br,
> Simonas,
>
> Fernando Mendonça wrote:
> > Hello
>
> > I'm using cakephp cake_1.2.0.7296-rc2
>
> > This version is not the newest?
>
> > Thanks
>
> > On 9 out, 08:27, Simonas Juodelis <[EMAIL PROTECTED]> wrote:
>
> >> Hi,
>
> >> what version on CakePHP you are using? I'm asking, because months were
> >> translated into other languages only in recent versions.  Probably you
> >> are using old version. Please try downloading newest version of CakePHP.
>
> >> br,
> >> Simonas.
>
> >> Fernando Mendonça wrote:
>
> >>> Hello everybody,
>
> >>> I'm trying to change the values of my date´s SELECT but it's not
> >>> working. I need the values like "January", "February" appears in
> >>> Portuguese in to SELECT. I already put "setlocale(LC_ALL,
> >>> "pt_BR.utf-8"); " in my "bootstrasp.php" in the application directory
> >>> (myapplication/config/bootstrap.php) but it´s not working yet.
>
> >>> Help me friends...
>
> >>> Thanks!
> >>> :o)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Date in another language

2008-10-09 Thread Fernando Mendonça

Hello

I'm using cakephp cake_1.2.0.7296-rc2

This version is not the newest?

Thanks

On 9 out, 08:27, Simonas Juodelis <[EMAIL PROTECTED]> wrote:
> Hi,
>
> what version on CakePHP you are using? I'm asking, because months were
> translated into other languages only in recent versions.  Probably you
> are using old version. Please try downloading newest version of CakePHP.
>
> br,
> Simonas.
>
> Fernando Mendonça wrote:
> > Hello everybody,
>
> > I'm trying to change the values of my date´s SELECT but it's not
> > working. I need the values like "January", "February" appears in
> > Portuguese in to SELECT. I already put "setlocale(LC_ALL,
> > "pt_BR.utf-8"); " in my "bootstrasp.php" in the application directory
> > (myapplication/config/bootstrap.php) but it´s not working yet.
>
> > Help me friends...
>
> > Thanks!
> > :o)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Date in another language

2008-10-09 Thread Fernando Mendonça

Hello everybody,

I'm trying to change the values of my date´s SELECT but it's not
working. I need the values like "January", "February" appears in
Portuguese in to SELECT. I already put "setlocale(LC_ALL,
"pt_BR.utf-8"); " in my "bootstrasp.php" in the application directory
(myapplication/config/bootstrap.php) but it´s not working yet.

Help me friends...


Thanks!
:o)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Help a Learner

2008-09-25 Thread Fernando Mendonça

Hello everybody,

I've a problem... I'm starting to learn how to use CakePHP and I'm
trying to write a new Action in one of my Controllers. I need to
recuperate values sent by a View and validate them.

The idea is: The user makes a reserve to one Official in one Date and
Time. I've to verify if this reserve already exists in my database
when he tries to make another one.

So, I wrote this Action in Reserve Controller:

function verifyReserve($official, $date, $time) {
if($this->Reserve->query("SELECT COUNT(reserves.id) FROM reserves
WHERE official_id='$official' AND reserve_date='$date' AND
reserve_time='$time'") != 0) {
return true;
} else {
return false;
}
}

And into the Action "Add" of the Reserve Controller I wrote this
validade:

if(($this->Reserve->verifyReserve($this->data['Reserve']
['official_id'], $this->data['Reserve']['reserve_date'], $this-
>data['Reserve']['reserve_time'])) == true)
{
$this->Session->setFlash(Already exists an reserve for this official
on this date and time.');
$this->set('officials', $this->Reserve->Official->generateList(null,
'name', null,'{n}.Offical.id','{n}.Official.name'));
$this->set('customers', $this->Reserve->Customer->generateList(null,
'name', null,'{n}.Customer.id','{n}.Customer.name'));
}

However, when I try to make a reserve an error occurs:

Query: verifyReserve
Warning: SQL Error: 1064: You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near 'verifyReserve' at line 1 in C:\xampp\htdocs\cake
\cake\libs\model\datasources\dbo_source.php on line 440

Warning: Cannot modify header information - headers already sent by
(output started at C:\xampp\htdocs\cake\cake\basics.php:697) in C:
\xampp\htdocs\cake\cake\libs\controller\controller.php on line 447

Help me, please.

Thanks :o)

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