Poll: CI4: Module support?
You do not have permission to vote in this poll.
yes
88.46%
115 88.46%
no
4.62%
6 4.62%
maybe
6.92%
9 6.92%
Total 130 vote(s) 100%
* You voted for this item. [Show Results]

  • 7 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Module support?

#33
(06-24-2015, 07:52 PM)kilishan Wrote: I'm a huge proponent of module use, myself. But also very much against the "controller calling controller" method that WireDesignz' code uses due to the possibility of a confusion of what "$this" means in the different contexts (since "$this" is simply an instance of the calling controller).

It seems to me you could use a library from another module to get the same results without the potential issues with controller calling controller.

thats the reason why we do 95% of our stuff in our models - even form_validation; We pass an prepared data object to the models and let the model do all the stuff- and pass just the data through the controllers who decides which data they want
but there are simply cases where its quite comfortable to load a module in a controller
In our system we've by now about 250 controllers and some of them put out different formats (like pdf, csv, doc, xml etc.)
a last example should illustrate what i mean

PHP Code:
public function pdfExport()
{
    
$this->load->model("onlineshop/OnlineShopCategory_Model");
    
$this->load->model("shopbackend/SaleItems_Model");
    
$mainCategory intval($this->input->post("category_type",true));

    
$objCategory $this->OnlineShopCategory_Model->getCategoryFromId($mainCategory);

    
//print_r($objCategory);
    //die;
    
$objPDF = new PDFExport_Object();
    
$objPDF->setHeaderTypeToHtml();
    
$objPDF->setFooterTypeToHtml();
    
$objPDF->setDefaultFont("arial");
    
$objPDF->setConfigVaues("margin_top",22);
    
$objPDF->setConfigVaues("margin_bottom",22);

    
$arrData = array("objCategory" => $objCategory);

    
$objPDF->setPrintHeader($this->load->view("shopbackend/sale-items-header",$arrData,true));
    
$objPDF->setPrintFooter($this->load->view("shopbackend/sale-items-footer",$arrData,true));
    
//$objPDF->setPrint
    
$objPDF->setPDFFileName("abverkaufsartikel-".date("Y-m-d").".pdf");

    
$objCategoryWrapper $this->SaleItems_Model->loadItems();
    
$arrMainViewData = array("objCategoryWrapper" => $objCategoryWrapper);
    
$objPDF->setHtmlText($this->load->view("shopbackend/sale-items-pdf-export",$arrMainViewData,true));

    
modules::run("PdfExport/createPdfFromHtml",$objPDF);

    



Again - of course i can use a library but i don't want to because of the reasons i mentioned in an earlier post.
Also, i don't want to make a religious thing out of that (my posts are just my opinion), but i really want the freedom to call a module where- and whenever i want. 
If i don't have that, i think its use- and pointless to integrate a module based system in CI 4.
Reply


Messages In This Thread
Module support? - by jlp - 04-06-2015, 05:55 PM
RE: Module support? - by gadelat - 04-06-2015, 11:20 PM
RE: Module support? - by llebkered - 04-08-2015, 08:34 AM
RE: Module support? - by Hobbes - 04-09-2015, 12:58 PM
RE: Module support? - by yurikhita - 04-09-2015, 02:21 PM
RE: Module support? - by ardhie1032 - 04-09-2015, 02:34 PM
RE: Module support? - by no1youknowz - 04-10-2015, 06:51 AM
RE: Module support? - by sintakonte - 04-12-2015, 01:52 AM
RE: Module support? - by josetrindade - 04-10-2015, 08:11 AM
RE: Module support? - by dmyers - 04-10-2015, 11:27 AM
RE: Module support? - by no1youknowz - 04-10-2015, 04:23 PM
RE: Module support? - by dmyers - 04-10-2015, 07:09 PM
RE: Module support? - by wolfgang1983 - 04-12-2015, 02:17 AM
RE: Module support? - by michalsn - 04-12-2015, 03:28 AM
RE: Module support? - by Davcon - 04-12-2015, 05:38 AM
RE: Module support? - by RWCH - 06-05-2015, 07:42 AM
RE: Module support? - by nasser.man - 06-05-2015, 08:46 AM
RE: Module support? - by nasser.man - 05-04-2015, 02:23 AM
RE: Module support? - by apsweb - 05-14-2015, 08:33 AM
RE: Module support? - by InsiteFX - 06-06-2015, 11:13 PM
RE: Module support? - by ivantcholakov - 06-07-2015, 07:49 AM
RE: Module support? - by nasser.man - 06-13-2015, 01:31 AM
RE: Module support? - by PaulD - 06-22-2015, 07:22 PM
RE: Module support? - by no1youknowz - 06-23-2015, 08:34 PM
RE: Module support? - by ivantcholakov - 06-22-2015, 11:30 PM
RE: Module support? - by sintakonte - 06-24-2015, 07:51 AM
RE: Module support? - by ivantcholakov - 06-24-2015, 08:21 AM
RE: Module support? - by sintakonte - 06-24-2015, 08:38 AM
RE: Module support? - by kilishan - 06-24-2015, 07:52 PM
RE: Module support? - by sintakonte - 06-25-2015, 01:11 AM
RE: Module support? - by ivantcholakov - 06-24-2015, 09:31 PM
RE: Module support? - by kilishan - 06-24-2015, 09:56 PM
RE: Module support? - by ivantcholakov - 06-24-2015, 10:18 PM
RE: Module support? - by nc03061981 - 06-25-2015, 09:21 AM
RE: Module support? - by dmyers - 06-26-2015, 04:52 AM
RE: Module support? - by ivantcholakov - 06-26-2015, 10:32 AM
RE: Module support? - by dmyers - 06-26-2015, 02:52 PM
RE: Module support? - by RWCH - 06-30-2015, 03:11 PM
RE: Module support? - by ivantcholakov - 07-02-2015, 04:42 AM
RE: Module support? - by solidcodes - 09-23-2015, 02:16 AM
RE: Module support? - by InsiteFX - 09-23-2015, 04:13 AM
RE: Module support? - by Narf - 09-23-2015, 05:05 AM
RE: Module support? - by Martin7483 - 09-24-2015, 02:11 AM
RE: Module support? - by mwhitney - 09-24-2015, 07:16 AM
RE: Module support? - by solidcodes - 09-24-2015, 03:53 AM
RE: Module support? - by mwhitney - 09-24-2015, 11:12 AM
RE: Module support? - by Narf - 09-25-2015, 01:50 AM
RE: Module support? - by Martin7483 - 09-25-2015, 02:43 AM
RE: Module support? - by mwhitney - 09-25-2015, 08:55 AM
RE: Module support? - by Martin7483 - 09-25-2015, 09:17 AM
RE: Module support? - by mwhitney - 09-25-2015, 11:18 AM
RE: Module support? - by Martin7483 - 09-26-2015, 04:59 AM
RE: Module support? - by Ivo Miranda - 06-26-2016, 05:14 PM
RE: Module support? - by kilishan - 06-26-2016, 07:52 PM
RE: Module support? - by orionstar - 06-26-2016, 09:54 PM
RE: Module support? - by Ivo Miranda - 06-27-2016, 04:58 AM
RE: Module support? - by ivantcholakov - 09-20-2016, 08:49 AM
RE: Module support? - by Narf - 09-20-2016, 10:52 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.