Esempio n. 1
0
 protected function switchIdentifier($type)
 {
     $this->select("id=PersonIdentifier_type", 'label=' . $type);
     $ident = new PersonIdentifier();
     $type = array_search($type, PersonIdentifier::getTypesCaptions());
     $ident->type = $type;
     $attrs = $ident->getTypeAttributeNames();
     foreach ($attrs as $attrName) {
         $this->waitForPresent('css=#person-identifier-fields #PersonIdentifier_' . $attrName);
     }
 }
Esempio n. 2
0
<?php

$module = Yii::app()->getModule('personIdentifier');
if (empty($form)) {
    $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'person-identifier', 'enableAjaxValidation' => false, 'enableClientValidation' => false, 'type' => 'vertical', 'htmlOptions' => array('enctype' => 'multipart/form-data')));
    $shouldCloseWidget = true;
    echo $form->errorSummary($model);
}
echo $form->dropDownListRow($model, 'type', PersonIdentifier::getTypesCaptions(), array('class' => 'span12'));
Yii::app()->clientScript->registerCss('personIdentifierStyles', "input[type=\"file\"] {" . "margin-bottom: 10px;" . "}" . ".popover {" . "max-width: " . ($module->identifierExampleMaxWidth + 5) . "px;" . "max-height: " . ($module->identifierExampleMaxHeight + 5) . "px;" . "}" . ".popover-content {" . "padding: 2px;" . "}" . ".popover-content img {" . "max-width: {$module->identifierExampleMaxWidth}px;" . "max-height: {$module->identifierExampleMaxHeight}px;" . "}");
?>
<script type="text/javascript">
    $('#PersonIdentifier_type').change(function() {
        $('#identifier-input-container').block({
            message: null,
            overlayCSS:  { 
                backgroundColor: '#f5f5f5', 
                opacity: 0.3, 
                cursor: 'wait'
            }
        });
        $('#identifier-input-container').smartLoad(
            '<?php 
echo $this->owner->createUrl('/personIdentifier/types/getFormAttrs/');
?>
',
            {type: this.value},
            function() {
                $('#identifier-input-container').unblock();
            }
        );