Re: 1.2 paginator helper and passedArgs

2009-11-16 Thread merrylin shi
I know the solution , if you have ctp file in  element folder named
paging.ctp ,please add a line

code (?php
$paginator-options(array('url'=$this-params['pass']));
? ) in this file , before your code !



2009/11/16 Asmud asepmuha...@gmail.com

 This is the solution I know, I believe there is[are] other sulution
 [s]I just can't figure out now :)
 This assumse that search form using method 'POST', and search function
 doest not have parameter; function search() { .
 If you wanna maintain the parameter; function search($category=null)
 { , or form use 'GET' method; just replace variable: $this-
 params['form']['input_search_form'] to $category.

 in the controller :
 ==
 
 $keyword = (isset($this-params['named']['keyword'])  strlen($this-
 params['named']['keyword']) = 3) ? $this-params['named']
 ['keyword'] : ((isset($this-params['form']['input_search_form']) 
 strlen($this-params['form']['input_search_form']) = 3) ? $this-
 params['form']['input_search_form'] : '');
 $conditions = (isset($keyword)  $keyword != '') ? array
 ('Cat.category' = $keyword) : array(1 = 1));
 $this-paginate = array(
'conditions' = $conditions,
 'limit' = 10,
'order' = array ('Cat.id' = 'desc')
 );
 $data = $this-paginate('Cat');
 $this-set(compact('data','keyword'));
 

 in the view :
 ===
 
 $paginator-options(array('url'=array_merge(array('keyword'=
 $keyword),$this-passedArgs)));?
 .

 Hope this help you


  Asmud 

 On Nov 17, 12:07 am, Sunchaser mik342...@yahoo.it wrote:
  Problem: when i have a search resultset with pagination, the links
  next, prev and numbers do not keep the search parameters.
 
  I searched everywhere, and at last i found that i should put  this
  statement in the view
 
  $paginator-options(array('url' = $this-passedArgs));
 
  However, i can't make it work, Should i do somthing on $this-
 
  passedArgs in the controller?
 
  Please help
 
  Thanks
 
  controller code:
  ---
  function search($category=null)
  {
  $this-paginate['Cat'] = array(
  'limit' = 10,
  'order' = array ('Cat.id' = 'desc')
  );
 
$conditions = array('Cat.category' = $this-data['Cat']
  ['category']);
$this-set( 'data', $this-paginate('Cat', $conditions ) );
$this-render( 'index_ar' );
 
return;
 
  }
 
  view code:
 
  ?php
  $paginator-options(array('url' = $this-passedArgs));
  echo $paginator-numbers( );
  ?
 
  table class='grid'
  tr
  th?php echo $paginator-sort('ID', 'id'); ?/th
  th?php echo $paginator-sort('Nome', 'name'); ?/th
  th?php echo $paginator-sort('Categoria', 'category'); ?/th
  thFoto/th
  th?php echo $paginator-sort('Stato', 'status'); ?/th
  th width='25%'/th
  /tr
  ?php $i = '0'; $count = '1';?
  ?php foreach ($data as $cats):  ?
  ?php $class = (is_int($i/2)) ? 'data-grid-row-1' :
 'data-grid-
  row-2';?
  tr class=?php echo $class?
  td?php echo $cats['Cat']['id'] ?/td
  td?php echo $cats['Cat']['name'] ?/td
  td?php echo $cats['Cat']['category'] ?/td
  td style='width:25px'
 
  [cut]

 --

 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-...@googlegroups.com.
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/cake-php?hl=.




--

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-...@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=.




Re: CakeFest IV - America - Help us pick a location!

2009-11-13 Thread merrylin shi
2009/11/13 Brenda rld0...@gmail.com

 USA East Coast ... Washington DC!

 ...Brenda

 --

 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-...@googlegroups.com.
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/cake-php?hl=.


 USA East Coast

--

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-...@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=.




Re: Using multiple criteria to login a user. Email or Username.

2009-11-13 Thread merrylin shi
I know ,first cake bake the users table ,generate  the user.php ,open the
files change the
var $validate = array(
'username' = array('notempty')
);
like
var $validate = array(
'username' = array('email')
);

just ok!

2009/11/13 David Roda davidcr...@gmail.com

 To accomplish this you will have to override the Auth COmponents
 authorize variable and isAuthorized() method to check both the username
 and email.  You can read about it here:
 http://book.cakephp.org/view/396/authorize

 On Sat, Nov 14, 2009 at 12:40 AM, jburns jeremybu...@me.com wrote:

 Have you considered using the email address as the username (thereby
 eliminating your problem)?

 On Nov 14, 4:16 am, Ahmed ahmed.shar...@gmail.com wrote:
  Does anyone know how I can begin to tackle this feature?

 --

 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-...@googlegroups.com.
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/cake-php?hl=.



  --
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-...@googlegroups.com.
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/cake-php?hl=.


--

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-...@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=.




whether chagne app/config/core.php code

2009-10-30 Thread merrylin

Hi All
I want add Auth in demo  , I get  a problem ,
whether chagne this code
   Configure::write('Acl.classname', 'DbAcl');
Configure::write('Acl.database', 'default');

//look like this :
//Configure::write('Acl.classname', 'IniAcl'); 
  in app/config/core.php ?
 anyone who  know ,please tell 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



AclNode::node() - Couldn't find Aro node identified by Array ( [Aro0.model] = Group [Aro0.foreign_key] = 1 )

2009-10-29 Thread merrylin

when I do Auth with cake , I  happened a problem
Warning (512): AclNode::node() - Couldn't find Aro node identified by
Array
(
[Aro0.model] = Group
[Aro0.foreign_key] = 1
)
 [CORE\cake\libs\model\db_acl.php, line 191]

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



CORE/cake/libs/model/db_acl.php, line 191

2009-10-29 Thread merrylin


Hi,

I'm trying to use ACL in my application, I have pretty much followed
this tutorial http://book.cakephp.org/view/641/Simple-Acl-controlled-Application
to get my application up and running, however, when I visit any of the
pages that are supposed to be protected, I get this error:

Warning (512): AclNode::node() - Couldn't find Aro node identified by
Array
(
[Aro0.model] = User
[Aro0.foreign_key] = 1
)
 [CORE/cake/libs/model/db_acl.php, line 191]

Warning (512): AclNode::node() - Couldn't find Aro node identified by
Array
(
[Aro0.model] = Group
[Aro0.foreign_key] = 1
)
 [CORE\cake\libs\model\db_acl.php, line 191]


Any help will be greatly appreciated. Thanks and happy holidays!

--~--~-~--~~~---~--~~
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: AclNode::node() - Couldn't find Aro node identified by Array ( [Aro0.model] = Group [Aro0.foreign_key] = 1 )

2009-10-29 Thread merrylin shi
I am sure  using  the Auth Compoment and  ACL
Component  !  I think I do All things about Auth and Acl ,
but not take effect

--~--~-~--~~~---~--~~
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: Multi-value field in cake

2009-10-29 Thread merrylin shi
when  get a problem with multi-value ,I think this code can help you ,this
is me code ,

Controllers:

function add() {
if (!empty($this-data)) {
$this-Wine-create();
//saveAll(), NOT save()
if ($this-Wine-saveAll($this-data)) {
$this-Session-setFlash(__('The Wine has been saved',
true));
$this-redirect(array('action'='index'));
} else {
$this-Session-setFlash(__('The Wine could not be saved.
Please, try again.', true));
}
}
$grapes = $this-Wine-Grape-find('list');  //multi-value
$types = $this-Wine-Type-find('list');
$wineries = $this-Wine-Winery-find('list');
$this-set(compact('grapes', 'types', 'wineries'));
}

view
?php
echo $form-input('name', array('label' = __('Name', true)));
echo $form-input('description', array('label' =
__('Description', true)));
echo $form-input('year', array('label' = __('Year', true)));
echo $form-input('selling_price', array('label' = __('Selling
Price', true)));
echo $form-input('discount', array('label' = __('Discount',
true)));
echo $form-input('type_id', array('label' = __('Type',
true)));
echo $form-input('winery_id', array('label' = __('Winery',
true)));
echo $form-input('Grape', array('label' = __('Grape', true),
'multiple' = 'checkbox')); //multi-value, checkbox

echo $form-input(null, array('label' = __('WinePhoto', true),
'type' = 'file', 'name' = 'data[WinePhoto][]', 'id' = 'files'));
echo $html-link('+', '#', array('id' = 'file-more'));
?

all ok

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