Ejemplo n.º 1
0
 public function view($fID = '')
 {
     if ($fID > 0) {
         $sessionFormID = $fID;
         Session::set('formifyFormID', $fID);
     } else {
         $sessionFormID = Session::get('formifyFormID');
     }
     $f = \Concrete\Package\Formify\Src\FormifyForm::get($sessionFormID);
     $this->set('f', $f);
     if (!$f) {
         $this->redirect('/dashboard/formify/forms');
     }
     $html = Loader::helper('html');
     $cnt = new SearchUsersController();
     $cnt->search();
     $this->set('searchController', $cnt);
     $this->addHeaderItem($html->css('formify.css', 'formify'));
     $this->addHeaderItem($html->css('records.css', 'formify'));
     $this->addFooterItem($html->javascript('angular.min.js', 'formify'));
     $this->addFooterItem($html->javascript('ui-bootstrap-custom-tpls-0.13.0.min.js', 'formify'));
     $this->addFooterItem($html->javascript('formify.js', 'formify'));
     $this->addFooterItem($html->javascript('records.js', 'formify'));
     $this->addFooterItem($html->javascript('controllers/records.js', 'formify'));
 }
Ejemplo n.º 2
0
 public function view($uID = false, $status = false)
 {
     if ($uID) {
         $this->setupUser($uID);
     }
     $this->requireAsset('select2');
     $ui = $this->user;
     if (is_object($ui)) {
         $dh = Core::make('helper/date');
         /* @var $dh \Concrete\Core\Localization\Service\Date */
         $this->requireAsset('core/app/editable-fields');
         $uo = $this->user->getUserObject();
         $groups = array();
         foreach ($uo->getUserGroupObjects() as $g) {
             $obj = new stdClass();
             $obj->gDisplayName = $g->getGroupDisplayName();
             $obj->gID = $g->getGroupID();
             $obj->gDateTimeEntered = $dh->formatDateTime($g->getGroupDateTimeEntered($this->user));
             $groups[] = $obj;
         }
         $this->set('groupsJSON', Loader::helper('json')->encode($groups));
         $attributes = UserAttributeKey::getList(true);
         $this->set('attributes', $attributes);
         $this->set('pageTitle', t('View/Edit %s', $this->user->getUserDisplayName()));
         switch ($status) {
             case 'activated':
                 $this->set('success', t('User activated successfully.'));
                 break;
             case 'deactivated':
                 $this->set('message', t('User deactivated successfully.'));
                 break;
             case 'created':
                 $this->set('message', t('User created successfully.'));
                 break;
             case 'email_validated':
                 $this->set('message', t('Email marked as valid.'));
                 break;
         }
     } else {
         $cnt = new SearchUsersController();
         $cnt->search();
         $this->set('searchController', $cnt);
         $result = $cnt->getSearchResultObject();
         if (is_object($result)) {
             $object = $result->getJSONObject();
             $result = Loader::helper('json')->encode($object);
             $this->addFooterItem("<script type=\"text/javascript\">\n                        \$(function () {\n                            \$('div[data-search=users]').concreteAjaxSearch({\n                                result: " . $result . ",\n                                onLoad: function (concreteSearch) {\n                                    concreteSearch.\$element.on('click', 'a[data-user-id]', function () {\n                                        window.location.href='" . rtrim(URL::to('/dashboard/users/search', 'view'), '/') . "/' + \$(this).attr('data-user-id');\n                                        return false;\n                                    });\n                                }\n                            });\n                        });\n                    </script>");
         }
     }
 }