Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
UserRegistrationWidget.php
1 <div class="user-registration-widget">
2  <a name="UserRegistrationWidget"></a>
3 
4  <h2><?php echo UserModule::t("Registration"); ?></h2>
5 
6  <?php if (Yii::app()->user->hasFlash('registration')): ?>
7  <div class="success">
8  <?php echo Yii::app()->user->getFlash('registration'); ?>
9  </div>
10  <?php else: ?>
11 
12  <div class="form">
13  <?php
14  $form = $this->beginWidget('CActiveForm', array(
15  'id' => 'registration-form',
16  'action' => Yii::app()->createUrl('/user/registration', array('return_url' => Yii::app()->request->getRequestUri() . '#UserRegistrationWidget')),
17  'enableAjaxValidation' => true,
18 // 'clientValidation' => true,
19 // 'disableAjaxValidationAttributes' => array('RegistrationForm_verifyCode'),
20  'htmlOptions' => array('enctype' => 'multipart/form-data'),
21  'clientOptions' => array(
22  'validateOnSubmit' => true,
23  'afterValidate' => 'js:jumpToTop'
24  )
25  )); ?>
26  <script type="text/javascript">
27  function jumpToTop(form, data, hasError) {
28  $('body').scrollTop($('#registration-form').offset().top);
29  return !hasError;
30  }
31  </script>
32 
33  <p class="note"><?php echo UserModule::t('Fields with <span class="required">*</span> are required.'); ?></p>
34 
35  <?php echo $form->errorSummary(array($model, $profile)); ?>
36 
37  <?php if (Yii::app()->getModule('user')->usernameRequired): ?>
38  <div class="row">
39  <?php echo $form->labelEx($model, 'username'); ?>
40  <?php echo $form->textField($model, 'username'); ?>
41  <?php echo $form->error($model, 'username'); ?>
42  </div>
43  <div class="nofloat"></div>
44  <?php endif;?>
45 
46  <div class="row">
47  <?php echo $form->labelEx($model, 'email'); ?>
48  <?php echo $form->textField($model, 'email'); ?>
49  <?php echo $form->error($model, 'email'); ?>
50  </div>
51  <div class="nofloat"></div>
52 
53  <div class="row">
54  <?php echo $form->labelEx($model, 'password'); ?>
55  <?php echo $form->passwordField($model, 'password'); ?>
56  <?php echo $form->error($model, 'password'); ?>
57  <p class="hint">
58  <?php echo UserModule::t("Minimal password length 4 symbols."); ?>
59  </p>
60  </div>
61  <div class="nofloat"></div>
62 
63  <div class="row">
64  <?php echo $form->labelEx($model, 'verifyPassword'); ?>
65  <?php echo $form->passwordField($model, 'verifyPassword'); ?>
66  <?php echo $form->error($model, 'verifyPassword'); ?>
67  </div>
68  <div class="nofloat"></div>
69 
70  <?php
71  $profileFields = $profile->getFields();
72  if ($profileFields) {
73  foreach ($profileFields as $field) {
74  ?>
75  <div class="row">
76  <?php echo $form->labelEx($profile, $field->varname); ?>
77  <?php
78  if ($widget = $field->widgetEdit($profile)) {
79  echo $widget;
80  } elseif ($field->range) {
81  $pos = strpos($field->range, '-');
82  if ($pos === false) {
83  /* show as dropdown box */
84  echo $form->dropDownList($profile, $field->varname, Profile::range($field->range));
85  } else {
86  $tag = substr($field->range, 0, $pos);
87  switch ($tag) {
88  case 'checkbox':
89  $field->range = substr($field->range, $pos + 1);
90  /* show as checkbox */
91  echo $form->checkBox($profile, $field->varname, Array('uncheckValue' => ""));
92  break;
93  case 'radio':
94  $field->range = substr($field->range, $pos + 1);
95  echo $form->radioButtonList($profile, $field->varname, Profile::range($field->range), array('labelOptions' => Array('class' => 'inline_label')));
96  break;
97  case 'select':
98  $field->range = substr($field->range, $pos + 1);
99  echo $form->dropDownList($profile, $field->varname, Profile::range($field->range));
100  break;
101  default:
102  echo $form->dropDownList($profile, $field->varname, Profile::range($field->range));
103  }
104  }
105  } elseif ($field->field_type == "TEXT") {
106  echo$form->textArea($profile, $field->varname, array('rows' => 6, 'cols' => 50));
107  } else {
108  echo $form->textField($profile, $field->varname, array('size' => 60, 'maxlength' => (($field->field_size) ? $field->field_size : 255)));
109  }
110  ?>
111  <?php echo $form->error($profile, $field->varname); ?>
112  </div>
113  <div class="nofloat"></div>
114  <?php
115  }
116  }
117  ?>
118  <?php if (UserModule::doCaptcha('registration')): ?>
119  <div class="row">
120  <?php echo $form->labelEx($model, 'verifyCode'); ?>
121 
122  <?php $this->widget('CCaptcha', array('captchaAction' => '/user/registration/captcha')); ?>
123  <?php echo $form->textField($model, 'verifyCode'); ?>
124 
125  <p class="hint"><?php echo UserModule::t("Please enter the letters as they are shown in the image above."); ?>
126  <br/><?php echo UserModule::t("Letters are not case-sensitive."); ?></p>
127  </div>
128  <div class="nofloat"></div>
129  <?php endif; ?>
130 
131  <div class="row submit">
132  <?php echo CHtml::submitButton(UserModule::t("Register")); ?>
133  </div>
134 
135  <?php $this->endWidget(); ?>
136  </div><!-- form -->
137  <?php endif; ?>
138 </div>