/**
  * Called by the MultiTypeAutocomplete widget to render autocomplete input
  * @param string $modelType
  */
 public function run($modelType, $name = null)
 {
     $htmlOptions = array();
     if ($name) {
         $htmlOptions['name'] = $name;
     }
     X2Model::renderModelAutocomplete($modelType, true, $htmlOptions);
 }
">


    <div class='row'>
        <?php 
    echo CHtml::label(Yii::t('app', 'Link Type:'), 'RelationshipModelName');
    echo CHtml::dropDownList('RelationshipModelName', 'Contacts', $linkableModelsOptions, array('id' => 'relationship-type', 'class' => 'x2-select field'));
    echo CHtml::link('', '#', array('onclick' => 'return false;', 'id' => 'quick-create-record', 'class' => 'fa fa-plus fa-lg pseudo-link', 'style' => 'visibility: hidden; height:16px;'));
    ?>
    </div>

    <div class='row'>
        <?php 
    echo CHtml::label(Yii::t('app', 'Name:'), 'RelationshipName');
    echo "<div id='inline-relationships-autocomplete-container'>";
    X2Model::renderModelAutocomplete('Contacts');
    echo CHtml::hiddenField('RelationshipModelId');
    echo "</div>";
    echo CHtml::textField('myName', $model->name, array('disabled' => 'disabled'));
    ?>
        <!-- <input type="hidden" id='RelationshipModelId' name="RelationshipModelId"> -->
    </div>

    <div class='row'>
        <?php 
    echo X2Html::label(Yii::t('app', 'Label:'), 'RelationshipLabelButton');
    echo X2Html::textField('secondLabel');
    echo X2Html::textField('firstLabel', '', array('title' => Yii::t('app', 'Create a different label for ') . $model->name));
    echo X2Html::hiddenField('mutual', 'true');
    echo X2Html::link('', '', array('id' => 'RelationshipLabelButton', 'class' => 'pseudo-link fa fa-long-arrow-right', 'title' => Yii::t('app', 'Create a different label for ') . $model->name));
    ?>
예제 #3
0
echo CHtml::openTag('div', X2Html::mergeHtmlOptions(array('class' => "multi-type-autocomplete-container", 'id' => $namespacedId), $this->htmlOptions));
if (isset($this->model)) {
    echo CHtml::activeDropDownList($this->model, $this->selectName, $this->options, array('class' => ''));
} else {
    echo CHtml::dropDownList($this->selectName, $this->selectValue, $this->options, array('class' => 'x2-select type-select'));
}
$htmlOptions = array();
if (isset($this->model)) {
    echo CHtml::activeLabel($this->model, $this->autocompleteName, array('style' => $this->selectValue === 'calendar' ? 'display: none;' : ''));
}
if (isset($this->autocompleteName)) {
    $htmlOptions['name'] = isset($this->model) ? CHtml::resolveName($this->model, $this->autocompleteName) : $this->autocompleteName;
}
if ($this->selectValue === 'calendar') {
    $htmlOptions['disabled'] = 'disabled';
    $htmlOptions['style'] = 'display: none;';
    $this->selectValue = 'Contacts';
}
if (!in_array($this->selectValue, $this->staticOptions)) {
    X2Model::renderModelAutocomplete($this->selectValue, false, $htmlOptions, $this->autocompleteValue);
} else {
    ?>
        <input class="record-name-autocomplete" type="hidden"></input>
        <?php 
}
if (isset($this->model)) {
    echo CHtml::activeHiddenField($this->model, $this->hiddenInputName, array('class' => 'hidden-id'));
} else {
    echo CHtml::hiddenField($this->hiddenInputName, $this->hiddenInputValue, array('class' => 'hidden-id'));
}
echo CHtml::closeTag('div');
예제 #4
0
        <div class='cell'>
            <?php 
    echo $form->label($model, 'associationType', array('class' => 'action-associationType-label'));
    echo $form->dropDownList($model, 'associationType', $associationTypeOptions, array('class' => 'action-associationType-dropdown'));
    ?>
            <div id='<?php 
    echo $this->resolveId('association-type-autocomplete-container');
    ?>
' 
             <?php 
    echo $model->associationType === 'calendar' ? 'style="display: none;"' : '';
    ?>
>
            <?php 
    echo CHtml::label(Yii::t('app', 'Association Name'), 'associationName', array('class' => 'action-associationName-label'));
    $autocomplete = X2Model::renderModelAutocomplete(X2Model::getModelName($model->associationType), false, array('name' => 'Actions[associationName]'));
    if ($autocomplete !== 'failure') {
        echo $autocomplete;
    } else {
        // dummy input to be replaced with autocomplete
        echo '<input disabled="disabled">';
    }
    echo $form->hiddenField($model, 'associationId', array('data-default' => ''));
    ?>
            </div>
            <?php 
    echo CHtml::hiddenField('calendarEventTab', true);
    ?>
        </div>
        <?php 
}
예제 #5
0
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * 
 * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
 * California 95067, USA. or at email address contact@x2engine.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * X2Engine" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by X2Engine".
 *****************************************************************************************/
$namespacedId = $this->namespace . "-multi-type-autocomplete-container";
Yii::app()->clientScript->registerScript('multiTypeAutocompleteJS' . $this->namespace, "\n\n\$(function () {\n    var container\$ = \$('#" . $namespacedId . "');\n\n    container\$.find ('select').change (function () {\n        var modelType = container\$.find ('select').val ();\n        var throbber\$ = x2.forms.inputLoading (container\$.find ('.record-name-autocomplete'));\n        \$.ajax ({\n            type: 'GET',\n            url: 'ajaxGetModelAutocomplete',\n            data: {\n                modelType: modelType\n            },\n            success: function (data) {\n                // remove span element used by jQuery widget\n                container\$.find ('input').\n                    first ().next ('span').remove ();\n\n                // replace old autocomplete with the new one\n                container\$.find ('input').first ().replaceWith (data); \n     \n                // remove the loading gif\n                throbber\$.remove ();\n            }\n        });\n    });\n});\n\n", CClientScript::POS_END);
?>
<div id="<?php 
echo $namespacedId;
?>
" 
 class="multi-type-autocomplete-container form2">
<?php 
echo CHtml::dropDownList($this->selectName, $this->value, $this->options, array('class' => 'x2-select type-select'));
X2Model::renderModelAutocomplete($this->value, false, array());
echo CHtml::hiddenField($this->hiddenInputName, '', array('class' => 'hidden-id'));
?>
</div>