Re: Reutilizable App, How to?

2013-10-27 Thread Vinicius Dusso
Hey Mark, thanks for your reply!

By 'copy-and-paste', I meant when I need to create a new project, so I 
would only copy-and-paste this customized Plugin, insted of copying all the 
separated MVC files...

Do you put all the app logic inside your plugin's AppController ? I had 
some issues with Acl plugin, because it was trying to access the Acl 
Component, but this Component was defined in PluginAppController insted 
AppController. 
And then I started wondering if I would find other issues like this in the 
future.

Maybe the best solution is create a plugin with Components, Helpers and 
Behaviors, instead of a Plugin which tries to take AppController's place?
Or I am missing something here?

Thanks a lot !!

Vinicius

On Sunday, October 27, 2013 8:53:43 AM UTC-2, euromark wrote:
>
> Yes, plugins are the way to go.
> I fail to see the issue with reusing a plugin component, though.
> And I don't understand what you mean by copy-and-paste? Ideally, you don't 
> do that at all, but use/extend the available classes.
>
> Mark
>
>
> Am Sonntag, 27. Oktober 2013 00:52:01 UTC+2 schrieb Vinicius Dusso:
>>
>> Hi guys,
>>
>> Which way do you think is the best to create a reutilizable app?
>>
>> I've been trying to create all my app rules inside one single plugin, so 
>> it will make easier to copy and paste to a new project. But I've been 
>> facing a few problems, especially when another plugin try to use a 
>> Component that was defined in my PluginAppController.
>>
>> So, to create a full and simple reutilizable architecture, what do you 
>> guys recommend?
>>
>> Thanks in advance !
>>
>> Vinicius Dusso
>>
>

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


Reutilizable App, How to?

2013-10-26 Thread Vinicius Dusso
Hi guys,

Which way do you think is the best to create a reutilizable app?

I've been trying to create all my app rules inside one single plugin, so it 
will make easier to copy and paste to a new project. But I've been facing a 
few problems, especially when another plugin try to use a Component that 
was defined in my PluginAppController.

So, to create a full and simple reutilizable architecture, what do you guys 
recommend?

Thanks in advance !

Vinicius Dusso

-- 
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: Page not found headache

2013-09-24 Thread Vinicius Dusso

Are you using routing prefix? Did you enable 'manger' prefix in core.php ?


On Tuesday, September 24, 2013 5:04:36 PM UTC-3, advantage+ wrote:
>
> I have no clue why I am getting a page not found. 
> Seems so straight forward to even think where to look.
>
>  
>
> Controller:
>
> public function manage_add(){
>
> echo 'hello';
>
> die();
>
> }
>
>  
>
> manage_add view:
>
> Where the hell are you?
>
>  
>
> I can see the index page no problem. I should see the "hello" before 
> killing the request but it does not even get there. 
>
> Simply just goes to 404 page not found. Manually type the address in the 
> browser same results.
>
>  
>
> Any ideas?
>
>  
>
> Thanks,
>
> Dave
>

-- 
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: Silent Request Pagination Info

2013-04-17 Thread Vinicius Dusso
Hi Dave,

Use Ajax Pagination, and after delete a record,  reload the page which you 
are again.

On Tuesday, April 16, 2013 6:31:35 AM UTC-3, advantage+ wrote:
>
> What I am trying to do is create a standard pagination set, but the user 
> has the ability to delete a record using AJAX.
>
>  
>
> So if on page/2 for example standard pagination gets this data:
>
>  
>
> array(
>
> 'page' => (int) 2,
>
> 'current' => (int) 20,
>
> 'count' => (int) 221,
>
> 'prevPage' => true,
>
> 'nextPage' => true,
>
> 'pageCount' => (int) 12,
>
> 'order' => null,
>
> 'limit' => (int) 20,
>
> 'options' => array(
>
>'page' => (int) 2,
>
> 'conditions' => array()
>
> ),
>
> 'paramType' => 'named'
>
> )
>
>  
>
> What I need to do is if user using ajax deletes say record 25, that row 
> slides / removed from DOM, 
>
> I need to now grab the next record which in this case id 41 (Page 2 of 12, 
> showing 20 records out of 221 total, starting on record 21, ending on 40) 
> and add it to the current pagination set.
>
>  
>
> Basically calling the pagination function after the user deletes the 
> record but grab the next record inline and update the paging count / 
> records, and append the new record to the bottom so there are still the 
> 'limit' => (int) 20, in play.
>
>  
>
> Any ideas how to accomplish this?
>
>  
>
> Thanks,
>
>  
>
> Dave
>
>  
>
>  
>

-- 
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: Content moderation in CakePHP

2013-04-10 Thread Vinicius Dusso

Hi Alex,

I guess you can create a schema similar which Drupal uses. 
It would be something like this:

1. Create two tables: *posts *and *post_revisions*.
2. Posts table would store all new data. When a new post is created, it 
would be stored there. 
3. To edit a lastest post's version, you could simply edit the Post entry.
4. When a moderator approves a Post, you would create a entry in Post 
Revisions table. You can do this simply using the beforeSave model callback.

This way you can handle separated the moderated and unmoderated entries, 
without checkin any boolean field.

Best regards,

Vinicius

On Wednesday, April 10, 2013 10:11:05 AM UTC-3, Alex Bovey wrote:
>
> Hello all,
>
> I'm just wondering how best to approach content moderation and wondered 
> whether anyone that has done something similar could offer any advice?
>
> For example, I have Users that have many Posts.  Whenever a Post is added 
> it needs to be approved before being published (easy), but also when a Post 
> is edited the changes will need to be held in moderation before being 
> published.  Whilst awaiting moderation, the previous version of the Post 
> should stay live on the site until the new version is published.
>
> Also if a User edits a Post that is currently awaiting moderation, they 
> should be presented with the latest (unmoderated) version to edit instead 
> of the current live version.
>
> For this scenario Posts do not HABTM Tags, which keeps it simpler.
>
> So far I have thought of two approaches:
>
> 1) Have two tables for Posts and ModeratedPosts and a ModeratedPost 
> belongsTo a Post.  A Post only becomes a ModeratedPost when it has been 
> approved.
>
> 2) Store both Posts and ModeratedPosts in the same table with a 
> 'moderated' boolean.  I would still need some way of linking records 
> together so that a Post belongsTo a ModeratedPost.
>
> Any thoughts welcome!
>
> Thanks in advance,
>
> Alex
>
> -- 
> Alex Bovey
> Web Developer | Alex Bovey Consultancy Ltd
> Registered in England & Wales no. 6471391 | VAT no. 934 8959 65
> al...@bovey.co.uk  | t 0844 567 8995 | m 07828 649386 | f 0870 
> 288 9533
> PHP | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | 
> Hosting
>  

-- 
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 perform a find with HABTM relationship?

2013-04-05 Thread Vinicius Dusso
Hi Leonhart,

And if you look from another perspective.. Try to perform a search on the 
Language model, filtering by laguage_name field and then CakePHP will take 
care of getting the HABTM results from your Post model.

What do you think?

On Wednesday, April 3, 2013 6:03:09 PM UTC-3, Leonhart wrote:
>
> Ok, maybe the "Post" model can lead to mistakes. Let's suppose I've a 
> "Link" model and the content of the page that I store in the database can 
> contain text in more than a language. I've stored the supported languages 
> in a "Language" table. Considering that the article pointed by the link can 
> contain more than a translation of the article (on the same page) 
> obviously, the right relationship between Link and Language is a HABTM.
>
> Well, I need to perform a search on the Link table starting from the 
> language of the content: If a user searches for english contents, I wanna 
> get just the Links that contains something in English, even if it contains 
> the same article in more than a language.
>
> I'm using the Paginate Component and I really tried everything... If I 
> perform a search on the Link model specifying the Language.id field I get 
> an "Unknown column" error, cause in the first query the Language table isnt 
> present in the FROM statement of the query. If I use the contain behavior I 
> dont get any error, but I see Links that are not in the specified language.
>
> Hope this make the problem clearer. Thanks again for any reply to this 
> topic. I really appreciate your efforts. =]
>
> Il giorno mercoledì 3 aprile 2013 22:46:01 UTC+2, Salines ha scritto:
>>
>> I do not understand, What do you want to store in languages table?
>>
>> Look here: 
>> http://book.cakephp.org/2.0/en/core-libraries/behaviors/translate.html
>>
>> Dana srijeda, 3. travnja 2013. 15:06:49 UTC+2, korisnik Leonhart napisao 
>> je:
>>>
>>> How can I perform a find call if I've a Model linked to another one with 
>>> the Has And Belongs To Many relation? The Models involved are "Post" and 
>>> "Language". According to the Cake Conventions I've created and populated 
>>> the Language_Post table. I want to find only the Posts with a specific 
>>> language id... Thanks in advance guys!!
>>>
>>

-- 
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: changing Form input's contents from their default 'value'

2013-04-03 Thread Vinicius Dusso
Hi Robert,

You should configure this in your Model. There is an attribute named 
$displayField which you can set the name from the column that actually 
represents the name of your register.

Take a look at this link fore more information:
http://book.cakephp.org/2.0/en/models/model-attributes.html#displayfield

Regards,

Vinicius

On Tuesday, April 2, 2013 8:38:45 PM UTC-3, Robert Denomme wrote:
>
> Say I have a hasOne relationship between two Models, for instance Recipe 
> hasOne User. If I set up the data (recipes contains a user_id field) and 
> bake I will see a beautiful user id drop-down menu in the recipe add 
> screen. The problem is that it displays the user_id, and not a bunch of 
> usernames! Can I change this?
>
> For reference, here is some relevant code, and the html it outputs,
> //Views/add.ctp
> ...
> echo $this->Form->input('user_id');
>
> which produces the following html:
>
> 
> 12
> ...
>
>
> The html I would prefer would be more like...
> 
> RobertPaulson
> ...
> Thanks for any 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.




Re: Auth Component Issues

2013-04-02 Thread Vinicius Dusso

 Ramon, 

 Which CakePHP's version are you using?

On Monday, April 1, 2013 4:55:32 PM UTC-3, Ramon José Silva wrote:
>
> Hi guys.
>
> Well, I trying to use the CakePHP on my own project, but I have a problem 
> with the Auth Component.
>
> I'm not using the password hash yet and not using the UsersController and 
> User Model, but I using Admin Model, AdminController and an Ajax, passing 
> the form data to the controller login method, but I can't login in my 
> system, the Auth always return false. I read the Docs trying to find 
> something that's help me, and saw in the Auth part that I can personalized 
> my form fields and tables to passing the data and everything works fine, 
> but it not work for me.
>
> If I use:
>
> $this->data = array() and passing all data that I receive with Ajax to my 
> Auth login, the login works fine, but not check if the User are subscribed 
> on my DB. In the Docs have something about that, but with I try to login 
> with the e-mail address and password that I registered, the Auth always 
> return false even my User really exists in my DB.
>
> This is my AdminController: http://pastebin.com/AvQQf6iw, 
>
> This is my App Controller: http://pastebin.com/B5XBwR5g, 
>
> This is my Ajax: http://pastebin.com/kQV7taWQ
>
> Now, if I use in my login method this line: 
>
> $query = $this->Admin->find('first', array('conditions' => 
> array('admin_email' => $this->data['admin_email'], 'admin_pass' => 
> $this->data['admin_pass'])));
>
> if($query == true){
>   echo 'true'; 
> } else {
>   echo 'Wrong User/Password';
> }
>
> I really find the user.
>
> Can anyone help me with this?
>
> Thanks Guys for the help anyway.
>
>
>
>

-- 
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: Registration - Teacher & Students - Multiple Auth?

2013-04-02 Thread Vinicius Dusso
Hi Nathan,

I've just finished setting up my project with separated auths.

Here is basically what I did:

In AppController, created a method to setup Auth Configurations:

private function setAuthType($type) {
 switch ($type) {
case "admin":
$sessionKey = 'Auth.Admin.User';
$username = 'email';
$password = 'password';
$userModel = 'User';
$displayField = 'email';
$authType = 'Form';
 break;
case "user":
$sessionKey = 'Auth.User';
$username = 'email';
$password = 'password';
$userModel = 'Member';
$displayField = 'email';
$authType = 'Form';
 break;
}
 AuthComponent::$sessionKey = $sessionKey;
 $this->Auth->authenticate = array(
$authType => array(
'fields' => array(
'username' => $username,
'password' => $password
),
'userModel'=> $userModel
) 
);
$this->Auth->authorize['Actions']['userModel'] = $userModel;
}


The AuthComponent allows you to define which will be your UserModel and 
wich will be your SessionKey. 

You can get the current user simply using the method $this->Auth->user();

This way you can check if its an user or a student.

Hope it helps!

Best Regards,

Vinicius


On Monday, April 1, 2013 4:18:06 PM UTC-3, Nathan Pierce wrote:
>
> Hey y'all, I got a question. 
>
> I've got the registration form for my site putting stuff in the database, 
> but I'm wondering if someone has any suggestions on how I can achieve some 
> features.
>
> 1. I'm going to have a table for teachers and students. They will have two 
> separate login forms on the site, one more simple than the other. I'm 
> focusing on students right now, since it's using the UsersController, etc. 
> I'm just wondering if someone has any suggestion on using cakephp and 
> having two separate auth systems. Is there some documentation somewhere 
> about this? I want two separate tables in the database, I don't want all 
> users in one giant ass database table and then having roles, etc.
>
> 2. I need a way to identify student login sessions from teachers sessions 
> so I can do some if logic and send them to the proper dashboard/etc. I'm 
> new to cake, so I'm wondering if there is a best method someone can suggest 
> to me. I'm trying to keep things standard to cake, which will be 
> impossible, but I'm still trying. I'm guessing I need to assign a role to 
> the user when they signup and then just use that. Right? Or should I use 
> another system to do this and have them all in one database? I'd really 
> like them split up..
>
> Thanks for your time!
>

-- 
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: Custom queries in cake PHP

2012-08-06 Thread Vinicius Dusso
Hi Mohit,

You can use the 'query' method:

$this->YourModel->query('SELECT * FROM table');

Take a look in this tutorial:
http://book.cakephp.org/1.3/view/1027/query 

[]'s

Vinicius

Em segunda-feira, 6 de agosto de 2012 13h06min53s UTC-3, mohit escreveu:
>
> Hi Folks, 
> What is the best way to have custom queries from the database. I need to 
> query from one of the pages. 
>
> *With Best Regards,
> Mohit Kumar *
> *+91-9582894570*
>
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Using PHP's Interface as Extension Point

2012-05-31 Thread Vinicius Dusso

Sure, I know I'm able to use Interfaces where I want to. I just want to 
know if there is a easier way to do this using the CakePHP Plugins. And if 
isn't, if there is a pattern to use Interfaces and let the CakePHP 
autoinclude them, like it did with the MVC classes.

Thanks,

Vinicius

On Thursday, May 31, 2012 1:07:35 PM UTC-3, jeremyharris wrote:
>
> CakePHP is just PHP, so there's no reason you couldn't use interfaces 
> where you wanted to. The users of the plugins would just need to understand 
> that they need to implement them.
>
> On Thursday, May 31, 2012 4:07:13 AM UTC-7, Vinicius Dusso wrote:
>>
>> Hello all,
>>
>> Did everyone tried to use PHP's Interface as Extension Point in CakePHP? 
>> My idea is to create a fully modular app. To build a menu, for example, I 
>> would be able to do something like this:
>>
>> The method 'getExtensionPoint' will get all the classes that implements 
>> the given interface, at run time.
>>
>> // The core of extension point
>> class MenuController {
>>
>>   function _buildMenu() {
>> $menu = array();
>>
>> $menuProviders = $this->getExtensionPoint('IMenu');
>> foreach($menuProviders as $menuProvider) {
>>   $menu += $menuProvider->getMenu();
>> }
>>   }
>>
>> }
>>
>> // Some class ( could be a Controller or a Model ) which uses this 
>> extension point
>> class User implements IMenu {
>>
>>   function getMenu() {
>> return array('Users' => '/user/list');
>>   }  
>>
>> }
>>
>> // The Interface, to bind the extended classes
>> public interface IMenu {
>>   function getMenu();
>> }
>>
>>
>> Sorry for write all this code here. 
>> Someone already did something like this? This can be done using the 
>> plugins in CakePHP ?
>>
>>
>> Thanks in advance !
>>
>>
>> Vinicius
>>
>>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Using PHP's Interface as Extension Point

2012-05-31 Thread Vinicius Dusso
Hello all,

Did everyone tried to use PHP's Interface as Extension Point in CakePHP? 
My idea is to create a fully modular app. To build a menu, for example, I 
would be able to do something like this:

The method 'getExtensionPoint' will get all the classes that implements the 
given interface, at run time.

// The core of extension point
class MenuController {

  function _buildMenu() {
$menu = array();

$menuProviders = $this->getExtensionPoint('IMenu');
foreach($menuProviders as $menuProvider) {
  $menu += $menuProvider->getMenu();
}
  }

}

// Some class ( could be a Controller or a Model ) which uses this 
extension point
class User implements IMenu {

  function getMenu() {
return array('Users' => '/user/list');
  }  

}

// The Interface, to bind the extended classes
public interface IMenu {
  function getMenu();
}


Sorry for write all this code here. 
Someone already did something like this? This can be done using the plugins 
in CakePHP ?


Thanks in advance !


Vinicius

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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