Get Titles for linked table in another relationship

2014-08-22 Thread Kurt Jensen
I am very new to CakePHP and I am not sure the proper phrasing for my 
question when searching google, so I am asking here.

I have these tables:

TABLE `*volunteers*`  (*This is actually Parent Volunteers for a school*) (
  `ID` smallint(5) unsigned NOT NULL auto_increment,
  `FNAME` varchar(25) NOT NULL,
  `LNAME` varchar(25) NOT NULL,
  PRIMARY KEY  (`ID`)

TABLE `*students*` (
  `ID` smallint(5) unsigned NOT NULL auto_increment,
  `VOLY_ID` smallint(5) unsigned NOT NULL,
  `STUDENT` varchar(100) NOT NULL,
  `TEACHER` smallint(4) unsigned NOT NULL,
  PRIMARY KEY  (`ID`),
  KEY `Parent` (`VOLY_ID`),
  KEY `TEACHER` (`TEACHER`)

TABLE `*teachers*` (
  `ID` smallint(4) unsigned NOT NULL auto_increment,
  `TLNAME` varchar(50) NOT NULL,
  `TFNAME` varchar(50) NOT NULL,
  `TROOM` varchar(6) NOT NULL,
  PRIMARY KEY  (`ID`)

The *volunteers* hasMany *students*

The *teachers* hasMany *students*

The *students*  belongsTo *volunteers*
The *students*  belongsTo *teachers*


In my *VolunteersController.php*
I have an action for URL "*cake/Volunteers/Show/2*":

public function show($id = null)
{
   // Show Parents (Volunteers) and the associated students
if (!$id) 
{
throw new NotFoundException(__('Invalid volunteer'));
}
$volunteerData = $this->Volunteer->findById($id);
 if (!$volunteerData) 
{
throw new NotFoundException(__('Invalid volunteer'));
}
$this->set('volunteer', $volunteerData['Volunteer']);
$this->set('students', $volunteerData['Students']);
}

How can I retrieve and display 'Teachers.FNAME' and 'Teachers.LNAME'  in 
place of the 'students.TEACHER' ( 'teacher.ID' ) from *VolunteersController.php 
*?

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: How to get admin home page?

2010-06-11 Thread Kurt Polinar
You can use either:  redirect('controller'=>'pages', 'action'=>'display',
'admin'=> true) or redirect('controller'=>'pages', 'action'=>'display',
'prefix'=>'admin')

use 'prefix'=>'admin' or 'admin'=>true to redirect to admin pages.



On Sat, Jun 12, 2010 at 5:06 AM, saidbakr  wrote:

> In other word,
>
> What does make something like  redirect('controller'=>'pages',
> 'action'=>'display') perform redirection to missing action
> "admin_display"?
>
> On Jun 12, 12:03 am, saidbakr  wrote:
> > Hi,
> > Admin actions "admin_actionname()" works fine something like this:
> >
> > http://thesite.com/admin/contros/actionname
> >
> > What I need is to set another page to work as admin home to be
> >  http://thesite.com/admin/
> >
> > I manged this from pages controller by setting an action called admin
> > and set route to it, but this solution makes some trouble with
> > redirects from admin actions to another non admin action using
> $this->redirect('controller'=>'contNames', 'action'=>'actionname') because
> >
> > it redirect it pages controller but the action is admin_action where
> > it is not found.
>
> 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: Notice (8): Undefined variable: session [APP\views\layouts\login.ctp, line **] and Notice (8): Undefined variable: javascript [APP\views\layouts\default.ctp, line **] :: CakePHP 1.3

2010-05-18 Thread Kurt Polinar
I see. I haven't read it. Now I know. Thank you so much John. Your a big
help.

Solved!



On Tue, May 18, 2010 at 3:58 PM, John Andersen wrote:

> The javascript helper in 1.3 is deprecated, take a look at:
>
> http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3#View-and-Helpers-1566
>
> See the bottom of the page.
> Enjoy,
>   John
>
> On May 18, 10:17 am, kirara  wrote:
> > Hi guys,
> >
> > My first problem with Undefined variable: session is fixed (thanks for
> > Zaky Katalan-Ezra). It made out that commenting $var helpers =
> > array('Html','Form','Javascript'); corrected the problem. But another
> > problem occurs. 'Undefined variable: javascript'. So I've declared my
> > helper to my users_controller.php and still the same error occurs.
> >
> > What can you suggest?
> >
> > Is it a bug in the CakePHP 1.3 version?
> >
> > 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 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.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: Notice (8): Undefined variable: session [APP\views\layouts\login.ctp, line **]::CakePHP 1.3

2010-05-17 Thread Kurt Polinar
Thank you!

I have this one question but not that related. It's on the Auth component.
I've tried to create a login for my admin panel using the Auth component and
just using simple auth. But it gives me an error message: "Login Failed. In
valid username of password". I've inputed the right password. I've used md5
for hasing and declared "Security::setHash('md5')" on the function
"beforeFilter()" on the app_controller.php.

How does this work?

Thank you!

On Tue, May 18, 2010 at 2:33 PM, Zaky Katalan-Ezra wrote:

> For now declare what you need in each controller.
>
> 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: Notice (8): Undefined variable: session [APP\views\layouts\login.ctp, line **]::CakePHP 1.3

2010-05-17 Thread Kurt Polinar
Yeah. Maybe it's a bug. But how can you use helpers without declaring them.
I know Form, Html are loaded automatically. But what about Ajax and other
helpers?

On Tue, May 18, 2010 at 2:08 PM, Zaky Katalan-Ezra wrote:

> I am glad for you.
> I didn't add the helper deceleration any where and every things is working
> fine.
> I hope some one  can tell me if its a bug.
>
> 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: Notice (8): Undefined variable: session [APP\views\layouts\login.ctp, line **]::CakePHP 1.3

2010-05-17 Thread Kurt Polinar
Thank you and it works great!

Should I add the helper on every controller I want?

On Tue, May 18, 2010 at 12:22 PM, Zaky Katalan-Ezra wrote:

> *helpers deceleration
>
>
> On Tue, May 18, 2010 at 7:21 AM, Zaky Katalan-Ezra wrote:
>
>> I had the same problem and I fixed it by removing the component
>> deceleration in app_controller.php
>> #var $helpers = array('Javascript', 'Form', 'Html');
>> Every thing is still working.
>>
>> I had this problem only with two application out of five.
>> I didn't had the time to check the difference between those application
>> yet.
>> All my application use cake 1.3
>> Its look like a bug.
>>
>
>
>
> --
> Regards,
> Zaky Katalan-Ezra
> QA Administrator
> www.IGeneriX.com
> Sites.IGeneriX.com
> 054-7762312
>
> 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


$this->Model->validates() ALWAYS RETURN TRUEE!!!!!

2009-07-15 Thread KURT

I'm using Cake 1.2.3.8166.

My problem is $this->Model->validates() ALWAYS RETURN TRUEE!

Here is my Model file:
 array(
'nokpRule-1'=> array(
'rule'=> array('maxLength', 12),
'message'=>'Maksimum aksara ialah 12 sahaja.',
'required'=>'true'
),
'nokpRule-2' => array(
'rule'=>'alphaNumeric',
'message' => 'No Kad Pengenalan mesti menggunakan
nombor DAN perkataan ATAU nombor sahaja.')
),
'gelaran' => array(
'rule'=>'notempty',
'message'=>'Gelaran mesti dipilih.'
),
'nama' => array(
'namaRule-1'=> array(
'rule'=> array('maxLength', 100),
'message'=>'Maksimum aksara ialah 100 sahaja.',
'required'=>'true'
),
'namaRule-2' => array(
'rule'=> array('custom', '/[a-zA-Z][^0-9]/'),
'message' => 'Nama mesti munggunakan perkataan
sahaja.')
),
'tarikh_lahir' => array(
'rule'=>'date',
'message'=>'Tarikh mesti di dalam format yang betul.'
),
'emel' => array(
'rule'=>'email',
'message'=>'Emel mesti ditulis dengan format yang betul.'
),
'jawatan' => array(
'rule'=>'notempty',
'message'=>'Jawatan mesti diisi.'
),
'skim' => array(
'rule'=>'notempty',
'message'=>'Skim mesti dipilih.'
),
'gred' => array(
'rule'=>'notempty',
'message'=>'Gred mesti dipilih.'
),
'tarikh_lantikan' => array(
'rule'=>'date',
'message'=>'Tarikh mesti di dalam format yang betul.'
),
'gaji' => array(
'rule'=>'numeric',
'message'=>'Gaji mesti diisi dan dalam bentuk nombor
sahaja.'
),
'tanggungan' => array(
'rule'=>'notempty',
'message'=>'Tanggungan mesti dipilih.'
),
'status_kahwin' => array(
'rule'=>'notempty',
'message'=>'Status kahwin mesti dipilih.'
),
'negeri' => array(
'rule'=>'notempty',
'message'=>'Negeri mesti dipilih.'
),
'no_telefon_pejabat' => array(
'rule'=>'numeric',
'message'=>'No telefon pejabat mesti diisi dan dalam
bentuk nombor sahaja.'
),
'application_id' => array('notempty')
);

//The Associations below have been created with all possible keys,
those that are not needed can be removed
var $belongsTo = array(
'Application' => array(
'className' => 'Application',
'foreignKey' => 'application_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);

}
?>



And here is the controller function:
function KJForm () {
// Setting data for validaton by the model
$this->Applicant->set($this->data);

if ($this->Applicant->validates()) {
  // ALWAYS RETURN TRUE
} else {
}
}

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Don't Know How to Delete

2008-06-26 Thread KURT

Basically, this is my codes:

users_controller.php:
function admin_delete($id = null) {
$username = $this->Session->read('user');
$user = $this->Acl->Aro->findByAlias($username);
if ($username) {
if ($user['Aro']['parent_id'] == 1) { // 1 stands for 
Kings
if 
($this->Acl->check($this->Session->read('user'), 'Users',
'delete')) {
if (!$id && empty($this->data)) {

$this->Session->setFlash(__('Invalid User', true));

$this->redirect(array('action'=>'index'));
}
if (!empty($this->data)) {
$deleted_user_aro = 
$this->Acl->Aro->findByAlias($this-
>data['User']['username']);
$deleted_user_aco = 
$this->Acl->Aco->findByAlias($this-
>data['User']['id'].'-'.$this->data['User']['username']);
if ($this->User->del($id)) {
$aro = new Aro();

$aro->delete($deleted_user_aro['Aro']['id']);
$aco = new Aco();

$aco->delete($deleted_user_aco['Aco']['id']);

$this->Session->setFlash(__('User deleted', true));

$this->redirect(array('action'=>'index'));
} else {

$this->Session->setFlash(__('The User could not be saved.
Please, try again.', true));
}
} elseif (empty($this->data)) {
$this->data = 
$this->User->read(null, $id);
}
} else {
$this->Session->setFlash('You do not 
have the permission to do
that.');

$this->redirect(array('action'=>'index'), null, true);
}
} else {
$this->redirect('/users/', null, true);
}
} else {
$this->redirect('/users/login', null, true);
}
}

admin_delete.ctp:

create('User', array('action' => 'delete'));?>


Are you sure you want to delete this user? All data about 
this
user will be permanently deleted.

end('Delete User');?>



link(__('Delete', true),
array('action'=>'delete', $form->value('User.id')), null,
sprintf(__('Are you sure you want to delete # %s?', true), $form-
>value('User.id'))); ?>
link(__('List Users', true),
array('action'=>'index'));?>
link(__('List Categories', true),
array('controller'=> 'categories', 'action'=>'index')); ?> 
link(__('New Category', true),
array('controller'=> 'categories', 'action'=>'add')); ?> 




so...when I press the 'Delete User' button, it just reloads the page
and does nothing and I do not know why, this might be a n00b question,
but please help.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Missing database table

2008-06-19 Thread KURT

Below is the codes that I have done.


array(
'className'  => 'Dealer',
'conditions' => '',
'order'  => '',
'foreignKey' => 'dealer_id'
)
);
}
?>


array(
'className'  => 'Product',
'conditions' => '',
'order'  => '',
'foreignKey' => 'dealer_id'
)
);
}
?>





The tables 'dealers' and 'products' exists.

My problem is when I access 'http://localhost/cookup/dealers' and
'http://localhost/cookup/products', cake give me an error 'Error:
Database table dealers for model Dealer was not found.' or 'Error:
Database table products for model Product was not found.'.

Furthermore, when I try to use bake, I cannot bake dealer and
products.

I have another table called 'users' and that table is fine.

What is my problem?

--~--~-~--~~~---~--~~
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, error with '../' into a render.

2007-05-21 Thread Kurt

Hi, i use one view file for many controllers. This view saved in views
folders and into the controllers i uses:

$this -> render('../anyViewFile');

this works well in my localhost with easyphp 2.0(with PHP5), but when
I upload to this my hosting(with PHP4), renders does not work well.

Example:

in my locahost:

$this -> render('../anyViewFile');
Result: http://localhost/cakephp/anyControllerFile/anyViewFile.

in my hosting:

$this -> render('../anyViewFile');
Result:
You are seeing this error because the view for
ClientecontactosController::paginar(), could not be found.

.../cakephp/app/views/anyControllerFile/../anyViewFile.ctp

that is to say, it does not make case to ../ with a uplevel command.

Help!!! :P

Well thanks i'm sorry for my bad english :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---