Re: need help with check/uncheck all checkbox [cakephp]

2013-11-18 Thread Dave M.
I don't think the class option works for multiple checkboxes. 
What you can do is specify a div and work off of that (you can also reduce 
your js code):

 echo $this->Form->input("Country", array("options" => 
$viewData["countryList"], "multiple" => "checkbox", "onclick" => 
"resetSelectAll();" , "div" => "countries" , "name" => "selectedId")); 

 $('#selectall').click(function () {
var checked = $(this).is(':checked');
$('.countries input[type=checkbox]').each(function(){
$(this).prop('checked', checked); 
});   
});

On Friday, November 15, 2013 1:05:52 AM UTC-5, Sally wrote:
>
> I need help with this. I'm creating a checkbox to select or deselect the 
> country options. Please help to give some clues and explaination. I'll be 
> very grateful. Thanks in advance. 
> Below are the code:
>
> *Location: View/country/add.ctp file*
>
> 
> $(document).ready(function () {
> $('#selectall').click(function () {
>  var checked = $(this).is(':checked');
> 
> $('.selectedId').each(function () {
> var checkBox = $(this);
> console.debug(checkBox);
> if (checked) {
> checkBox.prop('checked', true);
> }
> else {
> checkBox.prop('checked', false);
> }
> });
> 
> });
> });
> 
> 
> Form->create('Showcase'); ?>
> 
> 
>  echo $this->Form->input('p_start', array('label' => 'Start Date'));
> echo $this->Form->input('p_end', array('label' => 'End Date'));
> echo $this->Form->input('priority', array('label' => 'Priority'));
> echo $this->Form->input('Select all Country', array("type" => 
> "checkbox", 'id'=>'selectall'));
> echo $this->Form->input("Country", array("options" => 
> $viewData["countryList"], "multiple" => "checkbox", "onclick" => 
> "resetSelectAll();" , "class" => "selectedId" , "name" => "selectedId")); 
> ?>
> 
> 
>   
>  echo $this->Form->end(__('Submit'));
> echo $this->Html->link('Back', array('action' => 'listShowcases'));
> ?>
> 
>

-- 
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/groups/opt_out.


Validate if not between

2013-11-18 Thread Salines
Hi, folks


Is there any validation rules that check sent data does not exist between 
two dates? Or need to make a custom validation method?

If there is no data between two dates validation must return TRUE or FALSE 
if it exists.

Syntax as follows
SELECT pub_name, country, pub_city, estd
FROM publisher
WHERE YEAR (estd) NOT BETWEEN 2010 AND 2013;

-- 
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/groups/opt_out.


Problem with finding which behavior is loaded by a model

2013-11-18 Thread Vahid Alimohamadi
I wrote this peace of Code in *AppController.php's beforeFilter()* method :

   if (isset($this))
 if (isset($this->modelClass))
   if (isset($this->{$this->modelClass}))
 if ($this->{$this->modelClass}->Behaviors->loaded('Translate'))
$this->{$this->modelClass}->locale=$locale ;

but when there is a Controller with no model or a simple plugin like 
dashboard which no need to have a model this error will appear:

Fatal Error 

*Error: * Cannot access empty property 
*File: ..*\lib\Cake\Controller\Controller.php 
*Line: * 437
It is going to made me crazy!

-- 
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/groups/opt_out.


Problem with checking a behavior is loaded or not

2013-11-18 Thread Vahid Alimohamadi
I used this peace of code in AppController.php's beforeFilter() method to 
find a model is actsAs Translate or not:





*if (isset($this))   if (isset($this->modelClass))   if 
(isset($this->{$this->modelClass}))if 
($this->{$this->modelClass}->Behaviors->loaded('Translate'))
$this->{$this->modelClass}->locale=$ActiveLanguageCatalog['locale'] ;*

but this error will appear when there is no model!

Fatal Error 

*Error: * Cannot access empty property 
*File: ..*\lib\Cake\Controller\Controller.php 
*Line: * 437

-- 
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/groups/opt_out.


Re: Multiple Models In A Controller

2013-11-18 Thread Rafael Queiroz
I suggest you debug ($this->Model), check if model load is really class or
load AppModel default.
Maybe your application no find class requested but the  case your method
load generic model AppModel.


On Sat, Nov 16, 2013 at 2:21 PM, Kristen M  wrote:

> There are several ways to do this, but in my application, only one seems
> to work.
>
> $this -> loadModel("Model");
>
> From my reading it seems there are an assortment of ways to include a
> Model that doesn't require re-loading a Model everytime I need it (assuming
> I need it multiple times within a controller) But in my code App::Uses and
> the $uses = array() do not work- they throw errors.
>
> So I'm clearly missing some small little detail. Could someone point it
> out to me?
>
> --
> 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/groups/opt_out.
>



-- 
Atenciosamente,

Rafael F. Queiroz

-- 
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/groups/opt_out.


CakePHP and Redis (plugin vs native access through Redis Class)

2013-11-18 Thread Matthew Croxon
Hi guys,

*Background:*

I'd like to use Redis for some ranked leaderboards that I'm looking to 
implement in my site. I have googled around, and found that the 
cakephp-redis plugin (https://github.com/nanapi/cakephp-redis) that I'm 
trying to setup.


*First question:*

 I get the following error: 

Missing Database Connection
> Error: A Database connection using "RedisSource" was missing or unable to 
> connect. 
> The database server returned this error: Selected driver is not enabled
> Error: RedisSource driver is NOT enabled

 

I have followed the installation guide. I have completed all pre-requisites 
(including compiling phpredis - and testing that I can access from a simple 
PHP script).


And in a more general sense, the *second question:*

I've also noticed to CakePHP uses Redis as an alternative to the Filesystem 
for Caching. Does CakePHP allow for direct calls to the underlying 
datasource using the following API 
(http://api.cakephp.org/2.3/class-Redis.html)? And if so, what would I need 
to do to use this class?


Thanks in advance for the help,

Matthew 

-- 
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/groups/opt_out.


Re: Exists a Ticket System made in CakePHP

2013-11-18 Thread Rahul Dhavale
I want same. Is there any?

On Tuesday, April 21, 2009 2:29:19 PM UTC+5:30, byqsri wrote:
>
> I have my web application in Cakephp. 
> It has his registered users . 
> Now I would add a ticket system on my application only for registered 
> users. 
> I have searched a ticket system made in Cakephp but I haven't found 
> anything. 
> Is there someone that has found something made in Cakephp? 
> 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.
For more options, visit https://groups.google.com/groups/opt_out.


need help with check/uncheck all checkbox [cakephp]

2013-11-18 Thread Sally
I need help with this. I'm creating a checkbox to select or deselect the 
country options. Please help to give some clues and explaination. I'll be 
very grateful. Thanks in advance. 
Below are the code:

*Location: View/country/add.ctp file*


$(document).ready(function () {
$('#selectall').click(function () {
 var checked = $(this).is(':checked');

$('.selectedId').each(function () {
var checkBox = $(this);
console.debug(checkBox);
if (checked) {
checkBox.prop('checked', true);
}
else {
checkBox.prop('checked', false);
}
});

});
});


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


Form->input('p_start', array('label' => 'Start Date'));
echo $this->Form->input('p_end', array('label' => 'End Date'));
echo $this->Form->input('priority', array('label' => 'Priority'));
echo $this->Form->input('Select all Country', array("type" => 
"checkbox", 'id'=>'selectall'));
echo $this->Form->input("Country", array("options" => 
$viewData["countryList"], "multiple" => "checkbox", "onclick" => 
"resetSelectAll();" , "class" => "selectedId" , "name" => "selectedId")); 
?>


  
Form->end(__('Submit'));
echo $this->Html->link('Back', array('action' => 'listShowcases'));
?>


-- 
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/groups/opt_out.


send contact form to email in cakephp

2013-11-18 Thread Afiq Rashid
*this is my contact.ctp*




 
  First Name *
 
 
  
 


 
  Email Address *
 
 
  
 


 
  Comments *
 
 
  
 


 
 
 





*and this is my send_form_email*
  
";
echo $error."";
echo "Please go https://localhost/mall/pages/contact\";>back and fix these 
errors.";
die();
} 
 
 
// validation expected data exists
if(!isset($_POST['first_name']) ||
!isset($_POST['email']) ||
!isset($_POST['comments'])) {
died('We are sorry, but there appears to be a problem with the form 
you submitted.');   
}
 
$first_name = $_POST['first_name']; // required
$email_from = $_POST['email']; // required
$comments = $_POST['comments']; // required
 
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  if(!preg_match($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be 
valid.';
  }
$string_exp = "/^[A-Za-z .'-]+$/";
  if(!preg_match($string_exp,$first_name)) {
$error_message .= 'The First Name you entered does not appear to be 
valid.';
  }
  if(strlen($comments) < 2) {
$error_message .= 'The Comments you entered do not appear to be 
valid.';
  }
  if(strlen($error_message) > 0) {
died($error_message);
  }
$email_message = "Form details below.\n\n";
 
function clean_string($string) {
  $bad = array("content-type","bcc:","to:","cc:","href");
  return str_replace($bad,"",$string);
}
 
$email_message .= "First Name: ".clean_string($first_name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Comments: ".clean_string($comments)."\n";
 
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email_to, $email_subject, $email_message, $headers);  
?>



when i click the submit button there is no error..but there is nothing when 
i check my email..

-- 
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/groups/opt_out.


session time out randomly

2013-11-18 Thread Muhammad Hussein Fattahizadeh
 

I use this in bootstrap file: set session time out on 60 means 1 hour, isnt?

// set security to low
Configure::write('Security.level', 'low');

// reconfigure session
Configure::write('Session', array(
'defaults' => 'php',
'timeout' => 60,
'autoRegenerate' => false,
'checkAgent' => false,
'cookie' => 'myappsid_',
));
 

but my session expired about 4 or 5 mintues ... what's problem ?

i'm using cakephp 2.4 stable 
 

-- 
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/groups/opt_out.


session remove autocratically

2013-11-18 Thread Muhammad Hussein Fattahizadeh
 

I use this in bootstrap file:

// set security to low
Configure::write('Security.level', 'low');

// reconfigure session
Configure::write('Session', array(
'defaults' => 'php',
'timeout' => 60,
'autoRegenerate' => false,
'checkAgent' => false,
'cookie' => 'myappsid_',
));
 

but my session expired about 4 or 5 mintues ... what's problem ?

i'm using cakephp 2.4 stable 
 

-- 
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/groups/opt_out.


Re: How to connect to a postgres database with CakePHP?

2013-11-18 Thread Luís de Sousa
Hi John, thanks for the reply.

I searched in the documentation for instruction on what you ask but I 
couldn't find it, you could perhaps provide a link. However I could check 
in the command line the modules installed, and indeed postgres is not 
present. I would appreciate some guidance on which modules to install and 
how to do it.

Thanks.

$ php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]


On Sunday, 17 November 2013 11:45:32 UTC+1, John Andersen wrote:
>
> Hi Luis
>
> Please check that the PostGres module has been loaded/activated in your 
> web server.
> Or run phpinfo(); and check that you can see Postgres module has been 
> loaded and is available.
> Kindly inform us of the result.
>
> Kind regards
> John
>
>
>

-- 
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/groups/opt_out.