Re: How to define a checkbox variable in Cakephp

2013-03-06 Thread euromark
You already got your answer at SO.

Am Mittwoch, 6. März 2013 08:50:35 UTC+1 schrieb Victor Musvibe:

 I have a form in my Plugin elements and what i would like to insert the 
 checkbox value into a table named it_queries and field status_type and its 
 giving me an error  Undefined variable: variableValue 
 [APP\Plugin\Feedback\View\Elements\comment_add.ctp, line 37] .I have 
 declared the variable in my controller like this 

 $this-set('variableValueStatus', 'Pending');

 and this is line 37 thats giving me the error

 Below is the Controller code

 class CommentsController extends FeedbackAppController
 {
 public $components = array('Feedback.Comments');

 public function add($foreign_model = null, $foreign_id = null)
 {
 if (empty($foreign_model) ||
 empty($foreign_id) ||
 !$this-request-is('post')
 )
 {
 $this-set('variableValueStatus', 'Pending');
 return $this-redirect('/');
 }
 //Other code
 
 }

 and in the add view in my element here is how i am trying to accessing the 
 variable value

 echo $this-Form-checkbox('ItQuery.status_type', array('type' = 
 'hidden', 'value'=$variableValueStatus));

 If someone can show me how to fix this, that would be awesome


-- 
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: How to define a checkbox variable in Cakephp

2013-03-06 Thread Victor Musvibe
Thanks euromark. I am on it

On Wed, Mar 6, 2013 at 10:34 AM, euromark dereurom...@gmail.com wrote:

 You already got your answer at SO.

 Am Mittwoch, 6. März 2013 08:50:35 UTC+1 schrieb Victor Musvibe:

 I have a form in my Plugin elements and what i would like to insert the
 checkbox value into a table named it_queries and field status_type and its
 giving me an error  Undefined variable: variableValue
 [APP\Plugin\Feedback\View\**Elements\comment_add.ctp, line 37] .I have
 declared the variable in my controller like this

 $this-set('**variableValueStatus', 'Pending');

 and this is line 37 thats giving me the error

 Below is the Controller code

 class CommentsController extends FeedbackAppController
 {
 public $components = array('Feedback.Comments');

 public function add($foreign_model = null, $foreign_id = null)
 {
 if (empty($foreign_model) ||
 empty($foreign_id) ||
 !$this-request-is('post')
 )
 {
 $this-set('**variableValueStatus', 'Pending');
 return $this-redirect('/');
 }
 //Other code

 }

 and in the add view in my element here is how i am trying to accessing
 the variable value

 echo $this-Form-checkbox('**ItQuery.status_type', array('type' =
 'hidden', 'value'=$variableValueStatus)**);

 If someone can show me how to fix this, that would be awesome

  --
 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 a topic in the
 Google Groups CakePHP group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/cake-php/NzYQtYu1Jms/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, 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.




-- 
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: Cake 2.1 admin layout is not working

2013-03-06 Thread di
Hi majna, I will follow your suggestion.
Thanks

On Sunday, March 3, 2013 10:27:24 PM UTC+2, majna wrote:

 Hi, here's my suggestions,

 - change admin route to
 Router::connect(‘/admin’, array(‘controller’ = ‘users’, ‘action’ = 
 ‘index’, ‘admin’ = true));

 - replace your beforeRender() callback with:
 public function beforeRender() {
 if (isset($this-request-params['prefix'])  
 $this-request-params['prefix'] === 'admin') {
 if (!$this-request-is('ajax')  $this-name !== 'CakeError' 
  $this-viewPath !== 'Errors') {
 $this-layout = 'admin';
 }
 }
 }

 - change isAuthorized() callback like in this example:

 http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#using-controllerauthorize

 - remove completely beforeFilter() callback (containing 
 $this-Auth-allow(‘*’))

 - in each controller list only publicly accessible actions, i.e in Users 
 controller add:
 public function beforeFilter() {
 $this-Auth-allow('login', 'logout', 'register');
 parent::beforeFilter();
 }

 I hope it'll work then...

 On Friday, March 1, 2013 8:52:29 PM UTC+1, di wrote:

 I have this:
 In routes.php: Router::connect(‘/admin’, array(‘controller’ = ‘users’, 
 ‘action’ = ‘index’,'add’, ‘admin’ = true,’prefix’ = ‘admin’,'layout’ = 
 ‘admin’));

 In core.php: (debug, 0)

 In appController:
 class AppController extends Controller {
 public $components = array(
 ‘Session’,
 ‘Auth’=array(
 ‘loginRedirect’=array(‘controller’=’pagina_inicial’, 
 ‘action’=’index’,'admin’=false),
 ‘logoutRedirect’=array(‘controller’=’users’, ‘action’=’login’),
 ‘authError’= ”,
 ‘authorize’=array(‘Controller’)
 )
 ); 

 public $helpers = array(‘Session’,'form’,'Html’,'PhpExcel’);
 public $pdfConfig = array(
 ‘engine’ = ‘CakePdf.Tcpdf’,
 );

 public $cacheAction = ’1 hour’;

 public function isAuthorized($user) {
 $role=$this-Session-read(‘Auth.User.role’);

 //die(debug($role));
 if(isset($this-request-prefix)  $role!=’admin’){
 return FALSE;
 }
 return true;
 }

 public function beforeFilter() {
 $this-Auth-allow(‘*’);
 //$this-set(‘logged_in’, $this-Auth-loggedIn());
 //$this-set(‘current_user’, $this-Auth-user());

 // if its the administrator/manager – change the layout
 /**if (isset($this-params['prefix'])  $this-params['prefix'] == 
 ‘admin’) {
 $this-layout = ‘admin’;
 } else {
 $this-layout = ‘user’;
 }**/

 }
 public function beforeRender() {
 $this-_configureErrorLayout();
 }

 public function _configureErrorLayout() {
 if ($this-name == ‘CakeError’) {
 if ($this-_isAdminMode()) {
 $this-layout = ‘admin’;
 } else {
 $this-layout = ‘default’;
 }
 }
 }

 public function _isAdminMode() {
 $adminRoute = Configure::read(‘Routing.prefixes’);
 if (isset($this-params['prefix'])  in_array($this-params['prefix'], 
 $adminRoute)) {
 return true;
 }
 return false;
 }

 also have:

 app/view/layout/default.ctp and app/view/layout/admin.ctp
 app/view/Homepage/index.ctp and app/view/HomePage/admin_index.ctp

 But not working, what am I doing wrong, any help please.



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




debug disabled in Custom Authentication object?

2013-03-06 Thread designv...@gmail.com
Hi there,

I'm trying to write my own authentication Custom Authentication object and 
doing the usual thing of debugging everywhere to check stuff and I have 
noticed that debug seems to be suppressed even tho it's set to 2 in the 
core?

I have a results array that I can echo out serialized but cannot display 
with the normal debug() function...

Is this by design or am I missing something? Obviously I can see why it 
would be by design in the core - leaving debug calls in authentication 
methods is mega stupid, but it's just confusing me so I'd like to know for 
certain!

TIA

d//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.




Re: Setting the Value of Options in a drop down...

2013-03-06 Thread April DeRossett
Thanks! ...Unfortunately, sometimes you inherit a database schema and just 
have to make do with what you have.  

I have, however, located a solution in case anyone else comes across this 
issue:
 
echo $this-Form-input('Sold', array('options' = 
array(*'SOLD'='Sold'*),'empty' 
= $biddetail['Biddetail']['Sold']));

The first element ('SOLD' in this case) is the value of the option
The second element ('Sold' in this case) is the selection option

Hope this helps!

On Tuesday, March 5, 2013 5:17:36 PM UTC-6, April DeRossett wrote:

 Hello!

 Here is what I have in my view:

 if($biddetail['Biddetail']['Sold'] == 'SOLD'){$otherstate = 'OPEN';} else 
 {$otherstate = 'SOLD';}
 echo $this-Form-input('Sold', array('options' = 
 array($otherstate),'empty' = $biddetail['Biddetail']['Sold']));

 Is there no way to set the value to equal to the option?  ie  value = 
 'SOLD' rather than value = '0'.  As you can see above the values change 
 based on the current value populated in the data base...

 I don't want to have to go back and add a table to hold two values that 
 will never change.  Any solutions?  I have already read the documentation 
 at:
 http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html  which 
 does not provide a solution for this question.


 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: Date picker for CakePHP 2.0.3

2013-03-06 Thread April DeRossett
@Florin Trifu  Thanks for the instruction...Works perfectly!


@Yen Hua Chuah  You can set the date format here:

script
$(function() {
   $(#datepicker).datepicker({ dateFormat: yy-mm-dd });
});
/script

Check out the API documentation...It is pretty nice.  
http://api.jqueryui.com/datepicker/#option-dateFormat



On Thursday, February 21, 2013 1:25:13 AM UTC-6, Yen Hua Chuah wrote:

 Hi
 it does work but the default date format is mm/dd/. How can i change 
 it to /mm/dd

 please advise

 thanks
 chris

 On Wednesday, January 23, 2013 3:53:30 PM UTC+8, Gian Carlo Asuncion wrote:

 Works like magic bro no more conflict on other components, keep sharing 
 God Bless!

 On Tuesday, November 29, 2011 4:11:27 PM UTC-8, Florin Trifu wrote:

 Thank you very much! Indeed it worked.

 Just to let the other users know in case they will have the same problem:

 1. Download jquery (http://docs.jquery.com/Downloading_jQuery) and put 
 the file in $project/app/webroot/js (e.q: *
 $project/app/webroot/js/jquery.js*)
 2. Download jquery-ui (http://jqueryui.com/download); I, for example, 
 downloaded a zip archive called: jquery-ui-1.8.16.custom.zip. From this 
 archive you will have to copy the followings:

 a. *$archive_root/js/jquery-ui-*.js* in *$project/app/webroot/js* (give 
 it a shorter name e.q: jquery-ui.js)
 b. *$archive_root/css/smothness/** to *$project/app/webroot/css*(including 
 the images; rename the css file to something shorter)

 3. Include both js files in your layout. eq:
 *
 //$project/app/views/Layouts/default.ctp
 -
 echo $this-Html-script(array('jquery',
 'jquery-ui'));

 *4. Include the css file. Eq

 *//$project/app/views/Layouts/default.ctp
 -
 echo $this-Html-css('jquery-ui.css');

 *5. Put this lines of code before calling the date-picker:

 *script
 $(function() {
$(#datepicker).datepicker();
 });
 /script*

 6. Call the date picker in your form:

 *echo $this-Form-input('expire', 
 array(
'id'='datepicker',
'type'='text'
 )*

 This is it!

 Best regards!




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




Saving AJAX Checkboxes

2013-03-06 Thread Jerome Walitzek
Hi there,

i have following tables

Events
Cities
Locations
EventLocations

When i edit an Event i can select the city (city_id) where the event is.
But every City has more than one location which i get over AJAX.
That works Great.
But now i want to store the locations which i have checkboxed into the 
table event_locations
How can i do that ?

Any ideas ?

Here is my Code:
*edit.ctp*
*?php*
*echo $this-Form-input('city_id');
*
*echo $this-Js-writeBuffer();*
*?*
*
*
*div id=target-div/div
*
*
*
*script typ=text/javascript*
* $(#EventCityId).click(function(){*
*var cityid = $(#EventCityId).val();*
*$.get(/events/fetch/+ cityid,*
* function(data) {*
* $('#target-div').fadeOut(fast, function() { *
*   $('#target-div').html(data);*
*   $('#target-div').fadeIn(fast);*
* });*
* });*
*return false;*
* });*
*/script*

*EventsController.php*
*public function fetch($city_id) {*
*$locations = $this-Event-Location-findAllByCityId($city_id);*
*$this-set('locations', $locations);*
*}*
*
*
*fetch.ctp*
*?php*
* $select_value = array(); *
* foreach($locations as $location) {*
* $key = $location['Location']['id'];*
* $value = $location['Location']['name'];*
* $select_value[$key]= $value;*
* }*
* *
* $mydata = $this-data;*
* echo $this-Form-select('Location', $select_value, array('label'= 
false, 'multiple' = 'checkbox'));*
* echo $this-Html-link(__('Add another Location'), array('controller' = 
'locations', 'action' = 'add'));*
*?*

Thanks for help

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




Multirow form - add inputs with JS, but only the first ones gets submitted ...

2013-03-06 Thread petar . kadakevliev
 

I'm doing a CakePHP site, I have a form there, and the user should be able 
to add multirow inputs dynamically, with JavaScript. Let me simplify it: I 
generate the first input with this code:

echo $this-Form-input('Student.0.name');

So, when the user click on add more inputs - then I inject the HTML for 
this input - which is:

div class=input required
  label for=Student1NameWidth/labelinput name=data[Student][1][name] 
id=Student1Name type=text/div

The HTML, generated from the CakePHP code is equal to the other one - 
except the 0 and 1, we have sequent number here. But, when I submit - I 
have only the first input data on the server ... as the other ones have 
never been submitted.

What am I doing wrong?

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




about float numbers

2013-03-06 Thread kishore reddy
What I did

my form having some of input boxes.one of them is about salary .iam entered 
salary as 111 and submitted form
What happened

in the database the salary stored as 1.1e+006
What I expected to happen

how can i store salary as 111
and my input box code is
?php echo $this-Form-input(sales_transaction_avg, array('div'=false, 
'label'=false, 'type'='text', 'class'='number','style'='width:34% 
!important'))?

plz suggest solution and explain indetail what is the actul problem

thank Q

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




missing controller exception

2013-03-06 Thread Devario Johnson
Hi all, Im trying to debug this error.  

when I look at the cakelogs I get this

[MissingControllerException] Controller class Controller could not be found.

where should I look to begin debugging this?  I googled around and everyone 
with a similar issue was referencing an actual controller like img or 
jscontroller.

Is there a way i can get a better idea of what exactly is bombing?  I 
looked at the server access logs and there is a revolving 302 happening. 

I commented out my routes to check if it was happening there and the error 
persisted.  

Any ideas?

-- 
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: missing controller exception

2013-03-06 Thread Devario Johnson
FYI, it was saying this was coming from webroot/index.php...but the site 
itself works fine.

On Wednesday, March 6, 2013 12:56:58 PM UTC-5, Devario Johnson wrote:

 Hi all, Im trying to debug this error.  

 when I look at the cakelogs I get this

 [MissingControllerException] Controller class Controller could not be 
 found.

 where should I look to begin debugging this?  I googled around and 
 everyone with a similar issue was referencing an actual controller like img 
 or jscontroller.

 Is there a way i can get a better idea of what exactly is bombing?  I 
 looked at the server access logs and there is a revolving 302 happening. 

 I commented out my routes to check if it was happening there and the error 
 persisted.  

 Any ideas?


-- 
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: Authentication issue

2013-03-06 Thread David Camerotto
Thanks, that worked, much appreciated

On Tuesday, 5 March 2013 11:29:02 UTC+10:30, David Camerotto wrote:

 My apologies in advance, i am still relatively new to CakePHP.

 I took over a site a number on months ago and have slowly worked out how 
 thing operate. (http://www.musicformywedding.com.au/)

 One issue that has me stumped is access to a custom plugin for FAQs, you 
 can only access this page if logged in.

 I cannot work out where the code is to control this, i have looked in the 
 plugins controller but it seems to only affect the admin page for creating 
 the FAQs.

 I even created a new plugin that was identical to the FAQ plugin apart 
 from the naming conventions (called it questions) and it still asks you to 
 login, does this mean that all plugins need authentication.

 Any help much appreciated

 Regards
 David


-- 
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: about float numbers

2013-03-06 Thread euromark
See the answer you already got here
https://cakephp.lighthouseapp.com/projects/42648/tickets/3676

The answer still is the same:
You got no problem, since `1.1e+006 === 111` (note the identical 
here)

You should also ask yourself if float makes sense here. seems like you are 
only interesting in the integer.
Why not using it as such then?



Am Mittwoch, 6. März 2013 16:24:02 UTC+1 schrieb kishore reddy:

 What I did

 my form having some of input boxes.one of them is about salary .iam 
 entered salary as 111 and submitted form
 What happened

 in the database the salary stored as 1.1e+006
 What I expected to happen

 how can i store salary as 111
 and my input box code is
 ?php echo $this-Form-input(sales_transaction_avg, array('div'=false, 
 'label'=false, 'type'='text', 'class'='number','style'='width:34% 
 !important'))?

 plz suggest solution and explain indetail what is the actul problem

 thank Q


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