function login_action($backPage = '') { $this->pageTitle = 'Logowanie'; $form = new Form('wmelon.users.login', 'users/loginSubmit', 'users/login'); $form->submitLabel = 'Zaloguj'; $form->addInput('text', 'login', 'Login'); $form->addInput('password', 'pass', 'Hasło'); $form->addInput('hidden', 'backPage', $backPage); echo $form->generate(); }
public function generate() { static::$objStatic = $this; $formId = $this->formID != '' ? 'auto_' . $this->formID : 'auto_form_' . $this->id; if (\Environment::get('isAjaxRequest') && \Input::post('FORM_SUBMIT') == $formId) { $this->strTemplate = 'ajaxform_inline'; $objResponse = new HtmlResponse(parent::generate()); $objResponse->send(); } return parent::generate(); }
function page() { global $db, $session; //lets get a user $user = $db->from('users')->where('id', 1); $formOptions = array('action' => $_SERVER['PHP_SELF'], 'id' => 'testForm', 'data' => $user, 'files' => true, 'class' => 'form-horizontal', 'sidebar' => true, 'title' => '', 'description' => ''); $form = new Form($formOptions, $session); $sidebar = array('class' => 'warning', 'title' => 'Be careful!', 'body' => 'Be sure you complete all fields'); $form->setSidebar($sidebar); $emailValidation = array('required' => 'true', 'error' => 'Please supply a valid email address'); $email = array('field' => 'email', 'label' => "Email", 'description' => '', 'validation' => $emailValidation); $form->email($email); $firstNameValidation = array(); $firstName = array('field' => 'firstname', 'label' => "First Name", 'description' => '', 'validation' => $firstNameValidation); $form->text($firstName); $lastName = array('field' => 'lastname', 'label' => "Last Name", 'description' => 'Fill in your last name'); $form->text($lastName); $taName = array('field' => 'descriptionField', 'label' => "Last Name", 'description' => 'Fill in your last name'); $form->textarea($taName); $phoneOptions = array('field' => 'phone', 'label' => "Phone", 'description' => 'Home Phone'); $form->phone($phoneOptions); $checkOptions = array('field' => 'checkTest', 'label' => "Check here", 'description' => 'You authorize everything'); $form->checkbox($checkOptions); $passwordValidation = array('pattern' => '(?=^.{6,}$)((?=.*\\d)|(?=.*\\W+))(?![.\\n])(?=.*[A-Z])(?=.*[a-z]).*$'); $passwordOptions = array('field' => 'password', 'label' => "Password", 'description' => 'Enter a password at least 6 characters, with at least one symbol and number.', 'validation' => $passwordValidation); $form->password($passwordOptions); /* $dateValidation = array('disabledDays'=>'0,1','disabledDates'=>array("11/23/2015", "12/25/2015"), 'minDate'=>'11/1/2015', 'maxDate'=>'1/30/2016'); $secondDateValidation = array('disabledDays'=>'0,1','disabledDates'=>array("11/23/2015", "12/25/2015"), 'minDate'=>'11/1/2015', 'maxDate'=>'1/30/2016'); $dateOptions = array('field'=>'startdate', 'label'=>'Start/Stop Dates', 'description' =>'Enter a start and stop date', 'validation' => $dateValidation, 'second_field'=>'enddate', 'second_validation' => $secondDateValidation ); $form->date($dateOptions); $timeValidation = array('stepping'=>5,'disabledDays'=>'0,1','disabledDates'=>array("11/23/2015", "12/25/2015"), 'minDate'=>'11/1/2015', 'maxDate'=>'1/30/2016'); $secondTimeValidation = array('disabledDays'=>'0,1','disabledDates'=>array("11/23/2015", "12/25/2015"), 'minDate'=>'11/1/2015', 'maxDate'=>'1/30/2016'); $dateOptions = array('field'=>'starttime', 'label'=>'Start/Stop Times', 'description' =>'Enter a start and stop time', 'validation' => $timeValidation, 'second_field'=>'endtime', 'second_validation' => $secondTimeValidation ); $form->time($dateOptions); */ $timeValidation = array('stepping' => 5, 'disabledDays' => '0,1', 'disabledDates' => array("11/23/2015", "12/25/2015"), 'minDate' => '11/1/2015', 'maxDate' => '1/30/2016'); $secondTimeValidation = array('stepping' => 5, 'disabledDays' => '0,1', 'disabledDates' => array("11/23/2015", "12/25/2015"), 'minDate' => '11/1/2015', 'maxDate' => '1/30/2016'); $dateOptions = array('field' => 'startdatetime', 'label' => 'Start/Stop Date Times', 'description' => 'Enter a start and stop date time', 'validation' => $timeValidation, 'second_field' => 'enddatetime', 'second_validation' => $secondTimeValidation); $form->datetime($dateOptions); $options = array('field' => 'department', 'options' => array(0 => 'Advertising', 1 => "Circulation", 2 => 'Production'), 'label' => 'Department', 'description' => 'Select your department'); $form->select($options); $options = array('field' => 'publications', 'url' => '/ajax/forms/publications.php', 'label' => 'Publication', 'description' => 'Select a publication'); $form->remoteSelect($options); $form->generate(); //var_dump($this->formScripts); //grab any form scripts and append them to the global scripts array $GLOBALS['scripts'] = array_merge($GLOBALS['scripts'], $form->formScripts); }
function page() { global $db, $session; //did we get passed an id? $group = []; if ($_GET['id']) { //build up a record $groupID = intval($_GET['id']); $group = $db->from('core_permission_groups')->where('id', $groupID)->fetch(); } $formOptions = array('action' => 'permissionGroup.php', 'data' => $group, 'title' => 'Group Setup'); $groupForm = new Form($formOptions); $options = array('field' => 'group_name', 'label' => "Group name", 'description' => ''); $groupForm->text($options); $groupForm->generate(); }
function page() { global $db, $session; //did we get passed a userid? $permission = []; if ($_GET['id']) { //build up a user $permissionID = intval($_GET['id']); $permission = $db->from('core_permission_list')->where('id', $permissionID)->fetch(); } $formOptions = array('action' => 'permission.php', 'data' => $permission, 'files' => true, 'title' => 'Permission Setup'); $permissionForm = new Form($formOptions); $options = array('field' => 'displayname', 'label' => "Display name", 'description' => ''); $permissionForm->text($options); $options = array('field' => 'js_varname', 'label' => "JS variable name", 'description' => ''); $permissionForm->text($options); $options = array('field' => 'include_js', 'label' => "Include JS in head", 'description' => ''); $permissionForm->checkbox($options); $permissionForm->generate(); }
function page() { global $db, $session; //did we get passed an id? $selectedPermissions = []; if ($_GET['id']) { //build up a record $groupID = intval($_GET['id']); $selectedPermissions = $db->select('id,permission_id')->from('core_permission_group_xref')->where('group_id', $groupID)->fetch_simple_array('permission_id'); } else { $groupID = 0; } //build list of permissions $permissions = $db->from('core_permission_list')->order_by('displayname')->fetch_as_select_options('displayname'); $formOptions = array('action' => 'addPermissionsToGroup.php', 'data' => $selectedPermissions, 'recordID' => $groupID, 'title' => 'Group Permissions', 'description' => "Move permissions to the second list to add them to this permission group."); $groupForm = new Form($formOptions); $options = array('field' => 'permission', 'nonSelectedLabel' => 'Available Permissions', 'selectedLabel' => 'Applied Permissions', 'values' => $selectedPermissions, 'label' => "Permissions", 'description' => '', 'options' => $permissions); $groupForm->dualSelect($options); $groupForm->generate(); $GLOBALS['scripts'] = array_merge($GLOBALS['scripts'], $groupForm->formScripts); }
function edit_action($id, $backPage) { $id = (int) $id; // getting data $data = $this->model->commentData($id); if (!$data) { SiteRedirect('comments'); } // displaying form $this->pageTitle = 'Edytuj wpis'; $form = new Form('wmelon.comments.editComment', 'comments/editSubmit/' . $id . '/' . $backPage, 'comments/edit/' . $id . '/' . $backPage); $form->addInput('textarea', 'content', 'Treść', true, array('style' => 'width: 100%; height:30em', 'value' => $data->content)); echo $form->generate(); }
function prefDepartments($prefs) { global $db; //build up all the bits we need for dropdowns $departments = $db->select('id,department_name')->from('user_departments')->order_by('department_name')->fetch_as_select_options('department_name'); $positions = $db->select('id,position_name')->from('user_positions')->order_by('position_name')->fetch_as_select_options('position_name'); $permissionGroups = $db->select('id,group_name')->from('core_permission_groups')->order_by('group_name')->fetch_as_select_options('group_name'); $formOptions = array('action' => 'preferences/prefsDepartments.php', 'data' => $prefs, 'files' => true, 'title' => 'Department Information'); $prefForm = new Form($formOptions); $options = array('field' => 'advertisingDepartmentID', 'label' => "Advertising Dept", 'description' => 'Select the advertising department', 'options' => $departments); $prefForm->select($options); $options = array('field' => 'productionDepartmentID', 'label' => "Production Dept", 'description' => 'Select the production department', 'options' => $departments); $prefForm->select($options); $options = array('field' => 'pressDepartmentID', 'label' => "Press Dept", 'description' => 'Select the press department', 'options' => $departments); $prefForm->select($options); $options = array('field' => 'mailroomDepartmentID', 'label' => "Mailroom Dept", 'description' => 'Select the mailroom department', 'options' => $departments); $prefForm->select($options); $options = array('field' => 'financeDepartmentID', 'label' => "Finance Dept", 'description' => 'Select the finance department', 'options' => $departments); $prefForm->select($options); $options = array('field' => 'editorialDepartmentID', 'label' => "Editorial Dept", 'description' => 'Select the editorial department', 'options' => $departments); $prefForm->select($options); $options = array('field' => 'circulationDepartmentID', 'label' => "Circulation Dept", 'description' => 'Select the circulation department', 'options' => $departments); $prefForm->select($options); $prefForm->generate(); }
/** * Generate a form and return it as string * * @param mixed $varId A form ID or a Model object * * @return string The form HTML markup */ protected function getForm($varId) { if (is_object($varId)) { $objRow = $varId; } else { if ($varId == '') { return ''; } $objRow = \FormModel::findByIdOrAlias($varId); if ($objRow === null) { return ''; } } $objRow->typePrefix = 'ce_'; $objRow->form = $objRow->id; $objElement = new \Form($objRow); $strBuffer = $objElement->generate(); // HOOK: add custom logic if (isset($GLOBALS['TL_HOOKS']['getForm']) && is_array($GLOBALS['TL_HOOKS']['getForm'])) { foreach ($GLOBALS['TL_HOOKS']['getForm'] as $callback) { $this->import($callback[0]); $strBuffer = $this->{$callback}[0]->{$callback}[1]($objRow, $strBuffer); } } return $strBuffer; }
function general_action() { $this->pageTitle = 'Ustawienia ogólne'; $form = new Form('wmelon.options.general', 'options/general_save', 'options/general'); // input values $config = Watermelon::$config; $siteName = $config->siteName; $footer = $config->footer; $head = $config->headTags; $tail = $config->tailTags; $userData = Users::userData(); $login = $userData->login; $nick = $userData->nick; $email = $userData->email; $sblamKey = Config::get('wmelon.sblam.apiKey'); // label notes $footer_label = 'Możesz używać HTML<br>oraz <em>$/</em> dla linków na stronie'; $head_label = '"sekcja <head>"; skrypty, arkusze stylów itp.'; $tail_label = 'Skrypty, dodane na końcu strony'; $login_label = 'Nazwa użyta podczas logowania. Uważaj, żeby przypadkiem nie zmienić.'; $nick_label = 'Nazwa pokazywana przy Twoich komentarzach itp.'; $email_label = 'Zostanie użyty obok Twoich komentarzy do pokazania <a href="http://gravatar.com/" target="_blank">gravatara</a>'; if (!empty($email)) { $email_label .= '<br>Podgląd: '; $email_label .= '<img src="http://gravatar.com/avatar/' . md5($email) . '?s=64&d=mm" style="vertical-align:middle" />'; } $sblamKey_label = ''; // input args $siteName = array('value' => $siteName); $footer = array('value' => $footer, 'labelNote' => $footer_label); $head = array('value' => $head, 'labelNote' => $head_label); $tail = array('value' => $tail, 'labelNote' => $tail_label); $login = array('value' => $login, 'labelNote' => $login_label); $nick = array('value' => $nick, 'labelNote' => $nick_label); $email = array('value' => $email, 'labelNote' => $email_label); $sblamKey = array('value' => $sblamKey, 'labelNote' => $sblamKey_label); // adding inputs $form->addHTML('<fieldset id="siteOptions"><legend>Strona</legend>'); $form->addInput('text', 'siteName', 'Nazwa strony', true, $siteName); $form->addInput('textarea', 'footer', 'Stopka', false, $footer); $form->addInput('textarea', 'head', 'Własne tagi na początek strony', false, $head); $form->addInput('textarea', 'tail', 'Własne tagi na koniec strony', false, $tail); $form->addHTML('</fieldset>'); $form->addHTML('<fieldset id="adminOptions"><legend>Ty</legend>'); $form->addInput('text', 'login', 'Twój login', true, $login); $form->addInput('text', 'nick', 'Twój nick', false, $nick); $form->addInput('password', 'pass', 'Twoje hasło', false); $form->addInput('password', 'pass2', 'Twoje hasło (powtórz)', false); $form->addHTML('</fieldset>'); $form->addHTML('<fieldset id="sblamOptions"><legend>Sblam!</legend>'); $form->addHTML('<p>Sblam! to filtr antyspamowy użyty w Watermelonie. Aby działał poprawnie należy ustalić dla niego <em>klucz API</em>. Własny klucz możesz <a href="http://sblam.com/key.html">wygenerować na stronie Sblam!</a></p>'); $form->addInput('text', 'sblamKey', 'Klucz API', false, $sblamKey); $form->addHTML('</fieldset>'); // rendering echo $form->generate(); }
/** * Generate a form and return it as string * * @param mixed $varId A form ID or a Model object * @param string $strColumn The column the form is in * * @return string The form HTML markup */ public static function getForm($varId, $strColumn = 'main') { if (is_object($varId)) { $objRow = $varId; } else { if ($varId == '') { return ''; } $objRow = \FormModel::findByIdOrAlias($varId); if ($objRow === null) { return ''; } } $objRow->typePrefix = 'ce_'; $objRow->form = $objRow->id; $objElement = new \Form($objRow, $strColumn); $strBuffer = $objElement->generate(); // HOOK: add custom logic if (isset($GLOBALS['TL_HOOKS']['getForm']) && is_array($GLOBALS['TL_HOOKS']['getForm'])) { foreach ($GLOBALS['TL_HOOKS']['getForm'] as $callback) { $strBuffer = static::importStatic($callback[0])->{$callback[1]}($objRow, $strBuffer, $objElement); } } return $strBuffer; }
function edit_action($id) { $id = (int) $id; // getting data $data = $this->model->postData_id($id); if (!$data) { SiteRedirect('blog'); } // back to link $backTo = isset($this->params->backTo) ? '?backTo=' . $this->params->backTo : ''; $postURL = '#/' . date('Y/m', $data->published) . '/' . $data->name; switch ($this->params->backTo) { case 'post': $backToLabel = ' lub <a href="' . $postURL . '">powróć do wpisu</a>'; break; case 'site': $backToLabel = ' lub <a href="#/#blogpost-' . $data->id . '">powróć do strony</a>'; // TODO: and what if the post is not on first page? break; default: $backToLabel = ', <a href="$/blog/">powróć do listy wpisów</a> albo <a href="' . $postURL . '">obejrzyj wpis</a>'; break; } // options $this->pageTitle = 'Edytuj wpis'; $form = new Form('wmelon.blog.editPost', 'blog/editSubmit/' . $id . $backTo, 'blog/edit/' . $id . $backTo); $form->displaySubmitButton = false; // label notes $summary_note = 'Jeśli chcesz, napisz krótko wstęp lub streszczenie wpisu - zostanie ono pokazane na stronie głównej i w czytnikach kanałów'; // inputs args $titleArgs = array('value' => $data->title); $contentArgs = array('value' => $data->content, 'style' => 'width: 100%; height:30em'); $summaryArgs = array('value' => $data->summary, 'labelNote' => $summary_note); $allowCommentsArgs = array('value' => $data->allowComments); // adding inputs $form->addInput('text', 'title', 'Tytuł', true, $titleArgs); $form->addInput('textarea', 'content', 'Treść', true, $contentArgs); $form->addInput('textarea', 'summary', 'Streszczenie', false, $summaryArgs); $form->addInput('checkbox', 'allowComments', 'Pozwól na komentarze', false, $allowCommentsArgs); // submit buttons $form->addHTML('<br><label><span></span>'); $form->addHTML('<input type="submit" name="submit_save" value="Zapisz">'); if ($data->status == 'draft') { $form->addHTML('<input type="submit" name="submit_publish" value="Opublikuj">'); } $form->addHTML($backToLabel); $form->addHTML('</label>'); echo $form->generate(); }
/** * @param array $fields_form * @param array $fields_value * @param \Module $module * * @return string * * @author Panagiotis Vagenas <*****@*****.**> * @since ${VERSION} */ public function generateForm($fields_form = array(), $fields_value = array(), \Module $module = null) { if ((empty($fields_form) || empty($fields_value) || empty($module)) && $this->initialized) { return parent::generate(); } else { $form = new Form($module); $form->init($module); $this->setFieldsForm($fields_form)->setFieldsValue($fields_value); return $form->generate(); } }
/** * Generate a form and return it as HTML string * @param integer * @return string */ protected function getForm($varId) { if ($varId == '') { return ''; } $this->import('Database'); $objRow = $this->Database->prepare("SELECT * FROM tl_form WHERE id=? OR alias=?")->limit(1)->execute(is_numeric($varId) ? $varId : 0, $varId); if ($objRow->numRows < 1) { return ''; } $objRow->typePrefix = 'ce_'; $objRow->form = $objRow->id; $objElement = new Form($objRow); $strBuffer = $objElement->generate(); // HOOK: add custom logic if (isset($GLOBALS['TL_HOOKS']['getForm']) && is_array($GLOBALS['TL_HOOKS']['getForm'])) { foreach ($GLOBALS['TL_HOOKS']['getForm'] as $callback) { $this->import($callback[0]); $strBuffer = $this->{$callback}[0]->{$callback}[1]($objRow, $strBuffer); } } return $strBuffer; }
function edit_action($id) { $id = (int) $id; // getting data $data = $this->model->pageData_id($id); if (!$data) { SiteRedirect('pages'); } // back to link if ($this->params->backTo == 'site') { $backTo = '?backTo=site'; $backToLabel = ' lub <a href="#/' . $data->name . '">powróć do strony</a>'; } else { $backToLabel = ', <a href="$/pages/">powróć do listy stron</a> lub <a href="#/' . $data->name . '">obejrzyj stronę</a>'; } // form options $this->pageTitle = 'Edytuj stronę'; $form = new Form('wmelon.pages.editPage', 'pages/editSubmit/' . $id . $backTo, 'pages/edit/' . $id . $backTo); $form->displaySubmitButton = false; // inputs labels $nameLabel = 'Nie zmieniaj, jeśli <em>naprawdę</em> nie wiesz co robisz'; // inputs args $titleArgs = array('value' => $data->title); $contentArgs = array('value' => $data->content, 'style' => 'width: 100%; height:30em'); $nameArgs = array('value' => $data->name, 'labelNote' => $nameLabel); // adding inputs $form->addInput('text', 'title', 'Tytuł', true, $titleArgs); $form->addInput('textarea', 'content', 'Treść', true, $contentArgs); $form->addInput('text', 'name', 'Nazwa', true, $nameArgs); $form->addHTML('<label><span></span><input type="submit" value="Zapisz">' . $backToLabel . '</label>'); echo $form->generate(); }
public static function commentsView($id, $type, $backPage, $open = true) { $id = (int) $id; $type = (string) $type; $backPage = (string) $backPage; $model = new Comments_Model(); // comments $commentsObj = $model->commentsFor($id, $type); $approvedCount = 0; // counter of approved comments $unapprovedCount = 0; // counter of unapproved comments $visibleCount = 0; // counter of comments visible to user // visibilityToken if (!Users::isLogged() && isset($_SESSION['wmelon.comments.visibilityToken'])) { $visibilityToken = $_SESSION['wmelon.comments.visibilityToken']; } // composing comments array foreach ($commentsObj as $comment) { // tools $linkEnding = $comment->id . '/' . base64_encode($backPage . '#comment-' . $comment->id); $comment->editHref = '%/comments/edit/' . $linkEnding; $comment->deleteHref = '%/comments/delete/' . $comment->id . '/' . base64_encode($backPage . '#comments'); $comment->approveHref = '%/comments/approve/' . $linkEnding; $comment->rejectHref = '%/comments/reject/' . $linkEnding; // visibility // (comment is visible if admin or comment is approved or comment visibility token match user's visibility token) $comment->visible = Users::isLogged() || $comment->approved || $comment->visibilityToken == $visibilityToken && !empty($comment->visibilityToken); if ($comment->visible) { $visibleCount++; } // additional information (for admin) if (Users::isLogged() && $comment->authorID === null) { $comment->additionalInfo = $comment->authorEmail . '; IP:' . $comment->authorIP; } // if commented as logged user $authorID = $comment->authorID; if ($authorID !== null) { // author's user data $comment->author = Users::userData(1); // CSS class (for admin comments distinction) $comment->cssClass = 'adminComment'; } // "awaiting moderation" CSS class if (!$comment->approved) { $comment->cssClass .= ' awaitingModerationComment'; } // comments counter if ($comment->approved) { $approvedCount++; } else { $unapprovedCount++; } //-- $comments[] = $comment; } // form $submitPage = 'comments/post/' . $id . '/' . $type . '/' . base64_encode($backPage); $form = new Form('wmelon.comments.addComment', $submitPage, $backPage . '#commentForm-link'); $form->globalMessages = false; $form->submitLabel = 'Zapisz'; // user data inputs (if not logged in) if (!Users::isLogged()) { // remembered user data $name = $_SESSION['wmelon.comments.name']; $email = $_SESSION['wmelon.comments.email']; $website = $_SESSION['wmelon.comments.website']; // inputs args $name = array('value' => $name); $email = array('value' => $email); $website = array('value' => $website, 'labelNote' => '(Opcjonalnie)'); // adding inputs $form->addInput('text', 'name', 'Imię', true, $name); $form->addInput('email', 'email', 'Email', true, $email); $form->addInput('url', 'website', 'Strona', false, $website); } // content input $form->addInput('textarea', 'content', 'Komentarz'); // comments counter $commentsCount = Users::isLogged() ? $commentsObj->rows : $approvedCount; // number of visible (approved) comments - for user and all comments - for admin if ($commentsCount > 0) { $commentsCountStr = $commentsCount . ' ' . pl_inflect($commentsCount, 'komentarzy', 'komentarz', 'komentarze'); } if (Users::isLogged() && $unapprovedCount > 0) { $commentsCountStr .= ' <span class="important">(' . $unapprovedCount . ' do sprawdzenia!)</span>'; } // view $view = Loader::view('/comments/comments'); $view->comments = $comments; $view->areComments = $commentsObj->exists; $view->commentsCount = $commentsCountStr; $view->visibleCount = $visibleCount; $view->visibilityToken = $visibilityToken; $view->id = $id; $view->type = $type; $view->backPage = $backPage; $view->form = $form->generate(); $view->open = $open; return $view->generate(); }
/** * Generate a form and return it as HTML string * @param integer * @param string * @return string */ protected function getForm($varId) { if ($varId == '') { return ''; } $this->import('Database'); $objElement = $this->Database->prepare("SELECT * FROM tl_form WHERE id=? OR alias=?")->limit(1)->execute(is_numeric($varId) ? $varId : 0, $varId); if ($objElement->numRows < 1) { return ''; } $objElement->typePrefix = 'ce_'; $objElement->form = $objElement->id; $objElement = new Form($objElement); $strBuffer = $objElement->generate(); return $strBuffer; }
function page() { global $db, $session; //did we get passed a userid? $user = []; if ($_GET['id']) { //build up a user $userid = intval($_GET['id']); $user = $db->from('users')->where('id', $userid)->fetch_first(); } //build up all the bits we need for dropdowns $departments = $db->select('id,department_name')->from('user_departments')->order_by('department_name')->fetch_as_select_options('department_name'); $positions = $db->select('id,position_name')->from('user_positions')->order_by('position_name')->fetch_as_select_options('position_name'); $permissionGroups = $db->select('id,group_name')->from('core_permission_groups')->order_by('group_name')->fetch_as_select_options('group_name'); $formOptions = array('action' => 'user.php', 'data' => $user, 'files' => true, 'title' => 'User Setup'); $userForm = new Form($formOptions); $userForm->openTab('Basic Information'); $sidebar = array('class' => 'warning', 'title' => 'Be careful!', 'body' => 'Be sure you complete all fields'); $userForm->setSidebar($sidebar); $validation = array('required' => 'true', 'error' => 'First and last names are required'); $options = array('field' => 'firstname', 'label' => "First name", 'description' => '', 'validation' => $validation); $userForm->text($options); $options = array('field' => 'middlename', 'label' => "Middle name", 'description' => '', 'validation' => array()); $userForm->text($options); $validation = array('required' => 'true', 'error' => 'First and last names are required'); $options = array('field' => 'lastname', 'label' => "Last name", 'description' => '', 'validation' => $validation); $userForm->text($options); $validation = array('required' => 'true', 'type' => 'email', 'error' => 'A valid email address is required.'); $options = array('field' => 'email', 'label' => "Email Address", 'description' => '', 'validation' => $validation); $userForm->email($options); $userForm->openFieldSet('Phone numbers'); $options = array('field' => 'business', 'label' => "Office Number", 'description' => 'This is the full number, not just extension'); $userForm->phone($options); $options = array('field' => 'extension', 'label' => "Extension", 'description' => 'This is the full number, not just extension'); $userForm->number($options); $options = array('field' => 'home', 'label' => "Home Number", 'description' => ''); $userForm->phone($options); $options = array('field' => 'cell', 'label' => "Cell Number", 'description' => ''); $userForm->phone($options); $options = array('field' => 'carrier', 'label' => "Cell Carrier", 'description' => '', 'options' => $userForm->arrayToOptions($GLOBALS['carriers'])); $userForm->select($options); $userForm->closeFieldSet(); $userForm->closeTab(); $userForm->openTab('Advanced'); $options = array('field' => 'department_id', 'label' => "Department", 'description' => '', 'options' => $departments); $userForm->select($options); $options = array('field' => 'position_id', 'label' => "Position", 'description' => '', 'options' => $positions); $userForm->select($options); //@TODO need to add field for mugshot -- but that needs to be hooked into a graphics library system $options = array('field' => 'vision_data_sales_id', 'label' => "Vision Data Sales ID", 'description' => ''); $userForm->text($options); $options = array('field' => 'vision_data_sales_name', 'label' => "Vision Data Sales Name", 'description' => ''); $userForm->text($options); $options = array('field' => 'email_password', 'label' => "Email Password", 'description' => '', 'confirm' => false); $userForm->password($options); $options = array('field' => 'network_password', 'label' => "Network Password", 'description' => '', 'confirm' => false); $userForm->password($options); $options = array('field' => 'permission_group', 'label' => "Permission Group", 'description' => '', 'options' => $permissionGroups); $userForm->select($options); $options = array('field' => 'temp_employee', 'label' => "Temp Employee", 'description' => ''); $userForm->checkbox($options); $options = array('field' => 'debug_user', 'label' => "Debug User", 'description' => ''); $userForm->checkbox($options); $options = array('field' => 'super_user', 'label' => "Super User", 'description' => ''); $userForm->checkbox($options); $userForm->closeTab(); $userForm->generate(); }