PageRenderTime 50ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/core/Forms/Controller/Forms.php

https://github.com/scogle/cockpit
PHP | 34 lines | 22 code | 12 blank | 0 comment | 2 complexity | 2dc53226c0d9465da730b9011150304c MD5 | raw file
Possible License(s): LGPL-2.1
  1. <?php
  2. namespace Forms\Controller;
  3. class Forms extends \Cockpit\Controller {
  4. public function index(){
  5. return $this->render("forms:views/index.php");
  6. }
  7. public function form($id = null) {
  8. if(!$this->app->module("auth")->hasaccess("Forms", 'manage.forms')) {
  9. return false;
  10. }
  11. return $this->render("forms:views/form.php", compact('id'));
  12. }
  13. public function entries($id) {
  14. $form = $this->app->db->findOne("common/forms", ["_id" => $id]);
  15. if(!$form) {
  16. return false;
  17. }
  18. $count = $this->app->module("forms")->collectionById($form["_id"])->count();
  19. $form["count"] = $count;
  20. return $this->render("forms:views/entries.php", compact('id', 'form', 'count'));
  21. }
  22. }