{ if (!isset(static::$instance)) { static::$instance = static::getUserForm()->instanciate(); } return static::$instance; } static function getNewInstance() { $o = static::objects()->one(); static::$instance = $o->instanciate(); return static::$instance; } } Filter::addSupportedMatches('User Data', function () { $matches = array(); foreach (UserForm::getInstance()->getFields() as $f) { if (!$f->hasData()) { continue; } $matches['field.' . $f->get('id')] = 'User / ' . $f->getLabel(); if (($fi = $f->getImpl()) instanceof SelectionField) { foreach ($fi->getList()->getProperties() as $p) { $matches['field.' . $f->get('id') . '.' . $p->get('id')] = 'User / ' . $f->getLabel() . ' / ' . $p->getLabel(); } } } return $matches; }, 20); class TicketForm extends DynamicForm { static $instance;
function getRequestStructure($format, $data = null) { $supported = array("alert", "autorespond", "source", "topicId", "attachments" => array("*" => array("name", "type", "data", "encoding", "size")), "message", "ip", "priorityId"); # Fetch dynamic form field names for the given help topic and add # the names to the supported request structure if (isset($data['topicId']) && ($topic = Topic::lookup($data['topicId'])) && ($form = $topic->getForm())) { foreach ($form->getDynamicFields() as $field) { $supported[] = $field->get('name'); } } # Ticket form fields # TODO: Support userId for existing user if ($form = TicketForm::getInstance()) { foreach ($form->getFields() as $field) { $supported[] = $field->get('name'); } } # User form fields if ($form = UserForm::getInstance()) { foreach ($form->getFields() as $field) { $supported[] = $field->get('name'); } } if (!strcasecmp($format, 'email')) { $supported = array_merge($supported, array('header', 'mid', 'emailId', 'to-email-id', 'ticketId', 'reply-to', 'reply-to-name', 'in-reply-to', 'references', 'thread-type', 'flags' => array('bounce', 'auto-reply', 'spam', 'viral'), 'recipients' => array('*' => array('name', 'email', 'source')))); $supported['attachments']['*'][] = 'cid'; } return $supported; }
public function actionEditUser() { $userId = getParam('id', FALSE); $user = User::model()->findByPk($userId); if (!$user) { throw new CHttpException(404); } $form = UserForm::getInstance($userId); $this->setModel($form); if (isPostOrAjaxRequest()) { $this->processUpdate(); } $this->render('edit-user', array('model' => $this->getModel(), 'pageTitle' => 'Редагуання користувача', 'formId' => $form::FORM_ID, 'formView' => '_user-form', 'formAction' => '', 'innerLinks' => NULL, 'changeUserAvatarHandlerUrl' => $this->createAbsoluteUrl('changeUserAvatarHandler', array('userId' => $user->id)), 'user' => $user)); }
<p class="full-width"> <span class="buttons pull-left"> <input type="button" name="cancel" class="close" value="<?php echo __('Cancel'); ?>"> </span> <span class="buttons pull-right"> <input type="submit" value="<?php echo __('Continue'); ?>"> </span> </p> </form> </div> <div id="new-user-form" style="display:<?php echo $user ? 'none' :'block'; ?>;"> <form method="post" class="user" action="<?php echo $info['action'] ?: '#users/lookup/form'; ?>"> <table width="100%" class="fixed"> <?php if(!$form) $form = UserForm::getInstance(); $form->render(true, __('Create New User')); ?> </table> <hr> <p class="full-width"> <span class="buttons pull-left"> <input type="reset" value="<?php echo __('Reset'); ?>"> <input type="button" name="cancel" class="<?php echo $user ? 'cancel' : 'close' ?>" value="<?php echo __('Cancel'); ?>"> </span> <span class="buttons pull-right"> <input type="submit" value="<?php echo __('Add User'); ?>"> </span> </p> </form> </div> <div class="clear"></div>
<p><?php echo __('Use the forms below to create or update the information we have on file for your account'); ?> </p> <form action="account.php" method="post"> <?php csrf_token(); ?> <input type="hidden" name="do" value="<?php echo Format::htmlchars($_REQUEST['do'] ?: ($info['backend'] ? 'import' : 'create')); ?> " /> <table width="800" class="padded"> <tbody> <?php $cf = $user_form ?: UserForm::getInstance(); $cf->render(false); ?> <tr> <td colspan="2"> <div><hr><h3><?php echo __('Preferences'); ?> </h3> </div> </td> </tr> <td><?php echo __('Time Zone'); ?> :</td>
</span> </p> </form> </div> <div id="new-user-form" style="display:<?php echo $user ? 'none' : 'block'; ?> ;"> <form method="post" class="user" action="<?php echo $info['action'] ?: '#users/lookup/form'; ?> "> <table width="100%" class="fixed"> <?php if (!$form) { $form = UserForm::getInstance(); } $form->render(true, __('Create New User')); ?> </table> <hr> <p class="full-width"> <span class="buttons pull-left"> <input type="reset" value="<?php echo __('Reset'); ?> "> <input type="button" name="cancel" class="<?php echo $user ? 'cancel' : 'close'; ?> " value="<?php