Results 1 to 5 of 5

Thread: ListViewData.php is in view or controller

  1. #1
    rakeshray is offline Sugar Community Member
    Join Date
    Jun 2010
    Location
    Hyderabad (India)
    Posts
    313

    Default ListViewData.php is in view or controller

    Hi,

    As we know sugarCRM is MVC based,
    I want to know about file include/ListView/ListViewData.php ,which type of file it is.

    it is file of View or Controller ?

    At same time i want to put code of file upload . I want to put file upload option in menu.
    I want to put the code of file upload in "model" or controller . This code is business logic and not related to database so i think it should be inside controller . So i want to know where i should put this code . I want to put code according to MVC architecture only.
    Please any body give me idea how to implement it

    Thanks

  2. #2
    rafael.q.g@hotmail.com's Avatar
    rafael.q.g@hotmail.com is offline Sugar Community Member
    Join Date
    Jun 2011
    Location
    Florianópolis - Brazil
    Posts
    782

    Default Re: ListViewData.php is in view or controller

    include/ListView/ListViewData.php is a controler, once it make db queries and also haven't any function to write responses ro users it isn't a view. It also isn't a model once it doesn't represents any entity.

    This file is used by sugar engine, so is not recommended to do any change here, once this file is used by list view of all modules.

    To customize list view for one module you have to customize one of (or both) files:
    [custom]/modules/<module_name>/metadata/listviewdefs.php
    modules/<module_name>/views/view.list.php

    Customizing this files you are able to add new options in your menu and also make many others customzations, been them accoring with MVC (depending also of you business logic implementation), and according sugar framework architecture.
    Rafael Queiroz Gonçalves
    Advanced OMG UML Certified Professional
    Sun Certified Enterprise Architect for the Java Platform
    Sun Certified Programmer for the Java 2 Platform
    IBM Certified Advanced Application Developer - Lotus Notes and Domino
    IBM Certified Application Developer - IBM WebSphere Portlet Factory
    Computer Science Mastering / UFSC - PPGCC

  3. #3
    rakeshray is offline Sugar Community Member
    Join Date
    Jun 2010
    Location
    Hyderabad (India)
    Posts
    313

    Default Re: ListViewData.php is in view or controller

    Quote Originally Posted by rafael.q.g@hotmail.com View Post
    include/ListView/ListViewData.php is a controler, once it make db queries and also haven't any function to write responses ro users it isn't a view. It also isn't a model once it doesn't represents any entity.

    This file is used by sugar engine, so is not recommended to do any change here, once this file is used by list view of all modules.

    To customize list view for one module you have to customize one of (or both) files:
    [custom]/modules/<module_name>/metadata/listviewdefs.php
    modules/<module_name>/views/view.list.php

    Customizing this files you are able to add new options in your menu and also make many others customzations, been them accoring with MVC (depending also of you business logic implementation), and according sugar framework architecture.

    Thanks a lot MR. rafael .
    As i read in developer guide, model contains code for communication with data base.
    Controller contains all business logic except code related to view.
    So i think any business logic not related to data base should be in controller.From this point of view code for file uploading should be in controller.
    One thing i want to know .. Is SugarCRM is completely MVC based ?
    Suppose i am defining a function in custom file in custom module for file upload , then i think it will not be in MVC architecture.

  4. #4
    rafael.q.g@hotmail.com's Avatar
    rafael.q.g@hotmail.com is offline Sugar Community Member
    Join Date
    Jun 2011
    Location
    Florianópolis - Brazil
    Posts
    782

    Default Re: ListViewData.php is in view or controller

    The custom files are extentions which allows you to change sugar standard behavior.
    For example the two files I listed to you:

    [custom]/modules/<module_name>/metadata/listviewdefs.php

    modules/<module_name>/views/view.list.php

    Both of them theorically are just view files, but you are allowed to customize it the way you want, with your own code.

    So, whether do you use this files just for layout stuffs, and for every action you call/request a business object/service to handle that action, it still will be MVC. But whether did you make the bussiness logic directky on these files, it won't be MVC anymore.

    There is many ways to separete view from control, one example is using the custom file named Controller.php which could be located on module root folder. This file can have methods to be called by actions invoked from screens.
    Rafael Queiroz Gonçalves
    Advanced OMG UML Certified Professional
    Sun Certified Enterprise Architect for the Java Platform
    Sun Certified Programmer for the Java 2 Platform
    IBM Certified Advanced Application Developer - Lotus Notes and Domino
    IBM Certified Application Developer - IBM WebSphere Portlet Factory
    Computer Science Mastering / UFSC - PPGCC

  5. #5
    rakeshray is offline Sugar Community Member
    Join Date
    Jun 2010
    Location
    Hyderabad (India)
    Posts
    313

    Default Re: ListViewData.php is in view or controller

    Thank you very much !
    I got idea

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. upgrade safe for listViewData.php?
    By johnvl in forum Developer Help
    Replies: 8
    Last Post: 2011-11-04, 06:38 PM
  2. Customize ListViewData::getListViewData()
    By Cedric K in forum Developer Help
    Replies: 6
    Last Post: 2011-01-25, 06:26 PM
  3. Replies: 0
    Last Post: 2010-04-28, 02:00 AM
  4. How to render a view from a controller?
    By jamstv in forum Installation and Upgrade Help
    Replies: 0
    Last Post: 2010-04-14, 06:07 AM
  5. Replies: 1
    Last Post: 2008-11-27, 12:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •