本文整理汇总了PHP中X2Widget类的典型用法代码示例。如果您正苦于以下问题:PHP X2Widget类的具体用法?PHP X2Widget怎么用?PHP X2Widget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了X2Widget类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getPackages
public function getPackages()
{
if (!isset($this->_packages)) {
$this->_packages = array_merge(parent::getPackages(), array('X2ModelConversionWidgetJS' => array('baseUrl' => Yii::app()->request->baseUrl, 'js' => array('js/X2ModelConversionWidget.js'), 'depends' => array('X2Widget'))));
}
return $this->_packages;
}
开发者ID:keyeMyria,项目名称:CRM,代码行数:7,代码来源:X2ModelConversionWidget.php
示例2: beforeExecute
public function beforeExecute()
{
if ($this->getFormModel() && !$this->getFormModel()->validate()) {
$that = $this;
self::$responseForm = X2Widget::ajaxRender(function () use($that) {
$that->renderForm(false);
}, true);
return false;
}
return true;
}
开发者ID:tymiles003,项目名称:X2CRM,代码行数:11,代码来源:MassAction.php
示例3: renderInlineForm
/**
* Renders an inline record create/update form
* @param object $model
* @param bool $hasErrors
*/
public function renderInlineForm($model, array $viewParams = array())
{
//@FORMVIEW
$that = $this;
echo CJSON::encode(array('status' => $model->hasErrors() ? 'userError' : 'success', 'page' => X2Widget::ajaxRender(function () use($model, $that, $viewParams) {
echo $that->owner->widget('FormView', array_merge(array('model' => $model, 'suppressQuickCreate' => true, 'formSettings' => array()), $viewParams), true, true);
}, true)));
}
开发者ID:tymiles003,项目名称:X2CRM,代码行数:13,代码来源:QuickCreateRelationshipBehavior.php
示例4: activeDatePicker
/**
* @param CModel $model
* @param string $attribute
* @param array (optional) $htmlOptions
* @return string
*/
public static function activeDatePicker(CModel $model, $attribute, array $htmlOptions = array(), $mode = 'date', array $options = array())
{
$options = array_merge(array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => true, 'changeYear' => true), $options);
ob_start();
ob_implicit_flush(false);
Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$model->{$attribute} = Formatter::formatDateTime($model->{$attribute});
$renderWidget = function () use($model, $attribute, $htmlOptions, $mode, $options) {
Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => $attribute, 'mode' => $mode, 'options' => $options, 'htmlOptions' => $htmlOptions, 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()));
};
if (Yii::app()->controller->isAjaxRequest()) {
// process output if this is an ajax request
X2Widget::ajaxRender($renderWidget);
} else {
$renderWidget();
}
return ob_get_clean();
}
开发者ID:shuvro35,项目名称:X2CRM,代码行数:24,代码来源:X2Html.php
示例5: renderFilterCellContent
public function renderFilterCellContent()
{
switch ($this->fieldType) {
case 'boolean':
echo CHtml::activeDropdownList($this->grid->filter, $this->name, array('' => '- ' . Yii::t('app', 'Select') . ' -', '1' => Yii::t('app', 'Yes'), 'false' => Yii::t('app', "No")), array('class' => 'x2-minimal-select-filtercol'));
break;
case 'dropdown':
$dropdown = Dropdowns::model()->findByPk($this->fieldModel['linkType']);
if ($dropdown instanceof Dropdowns) {
$options = json_decode($dropdown->options, 1);
if (!$dropdown->multi) {
$defaultOption = array('' => '- ' . Yii::t('app', 'Select') . ' -');
$options = is_array($options) ? array_merge($defaultOption, $options) : $defaultOption;
}
//$selected = isset($options[$this->grid->filter->{$this->name}]) ?
//$this->grid->filter->{$this->name} : '';
echo CHtml::activeDropdownList($this->grid->filter, $this->name, $options, array('class' => 'x2-minimal-select-filtercol' . ($dropdown->multi ? ' x2-multiselect-dropdown x2-datacolumn-multiselect' : ''), 'multiple' => $dropdown->multi ? 'multiple' : '', 'data-selected-text' => $dropdown->multi ? 'option(s)' : ''));
} else {
parent::renderFilterCellContent();
}
break;
case 'visibility':
echo CHtml::activeDropDownList($this->grid->filter, $this->name, array('' => '- ' . Yii::t('app', 'Select') . ' -', 1 => Yii::t('app', 'Public'), 0 => Yii::t('app', 'Private'), 2 => Yii::t('app', 'User\'s Groups')), array('class' => 'x2-minimal-select-filtercol'));
break;
case 'dateTime':
case 'date':
Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$that = $this;
$renderWidget = function () use($that) {
echo Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $that->grid->filter, 'attribute' => $that->name, 'mode' => 'date', 'options' => array('dateFormat' => Formatter::formatDatePicker('medium')), 'htmlOptions' => array('id' => 'datePicker' . $that->name, 'class' => 'datePicker x2-gridview-filter-datepicker'), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true);
};
if ($this->grid->ajax) {
X2Widget::ajaxRender($renderWidget);
} else {
$renderWidget();
}
break;
default:
parent::renderFilterCellContent();
}
}
开发者ID:keyeMyria,项目名称:CRM,代码行数:41,代码来源:X2DataColumn.php
示例6: actionQuickView
public function actionQuickView($id)
{
$model = $this->loadModel($id);
if (!FormLayout::model()->findByAttributes(array('model' => get_class($model)))) {
echo Yii::t('app', 'Quick view not supported');
}
if ($this->checkPermissions($model, 'view')) {
$that = $this;
X2Widget::ajaxRender(function () use($model, $that) {
$that->widget('DetailView', array_merge(array('model' => $model, 'scenario' => 'Inline', 'nameLink' => true)));
});
return;
}
throw new CHttpException(403);
}
开发者ID:tymiles003,项目名称:X2CRM,代码行数:15,代码来源:x2base.php
示例7: renderModelAutocomplete
/**
* @param string $modelClass the model class for which the autocomplete should be rendered
* @param bool $ajax if true, registered scripts are processed with ajaxRender
*/
public static function renderModelAutocomplete($modelClass, $ajax = false, $htmlOptions = array(), $value = null)
{
$modelClass = self::getModelName($modelClass);
if (!class_exists($modelClass) || !$modelClass::model()->asa('X2LinkableBehavior')) {
if ($ajax) {
echo 'failure';
return;
} else {
return 'failure';
}
/* throw new CException (
Yii::t('app',
'Error: renderModelAutocomplete: {modelClass} does not have '.
'X2LinkableBehavior', array ('{modelClass}' => $modelClass))); */
}
if ($ajax) {
Yii::app()->clientScript->scriptMap['*.css'] = false;
}
$renderWidget = function () use($modelClass, $htmlOptions, $value) {
Yii::app()->controller->widget('zii.widgets.jui.CJuiAutoComplete', array('name' => isset($htmlOptions['name']) ? $htmlOptions['name'] : 'recordName', 'source' => Yii::app()->controller->createUrl(X2Model::model($modelClass)->autoCompleteSource), 'value' => $value ? $value : Yii::t('app', 'Start typing to suggest...'), 'options' => array('minLength' => '1', 'create' => 'js:function (event, ui) {
// check for callback in parent form
if ($(this).closest ("form").data ("afterAutocompleteCreated")) {
$(this).closest ("form").data ("afterAutocompleteCreated") ();
}
}', 'select' => 'js:function (event, ui) {
$(this).val(ui.item.value);
// expects next input to be a hidden input which will contain the
// record id
$(this).nextAll ("input").val(ui.item.id);
return false;
}'), 'htmlOptions' => array_merge(array('class' => 'record-name-autocomplete x2-default-field', 'data-default-text' => Yii::t('app', 'Start typing to suggest...'), 'style' => $value ? '' : 'color:#aaa'), $htmlOptions)));
Yii::app()->clientScript->registerScript('renderModelAutocomplete', "\n x2.forms.enableDefaultText (\$('.record-name-autocomplete'));\n ", CClientScript::POS_READY);
};
if ($ajax) {
X2Widget::ajaxRender($renderWidget);
} else {
$renderWidget();
}
}
开发者ID:tymiles003,项目名称:X2CRM,代码行数:43,代码来源:X2Model.php
示例8: getPackages
/**
* Magic getter. Returns this widget's packages.
*/
public function getPackages()
{
if (!isset($this->_packages)) {
$this->_packages = array_merge(parent::getPackages(), array('SortableWidgetManagerJS' => array('baseUrl' => Yii::app()->request->baseUrl, 'js' => array('js/sortableWidgets/SortableWidgetManager.js'), 'depends' => array('auxlib'))));
}
return $this->_packages;
}
开发者ID:dsyman2,项目名称:X2CRM,代码行数:10,代码来源:SortableWidgetManager.php
示例9: getJSClassParams
public function getJSClassParams()
{
if (!isset($this->_JSClassParams)) {
$this->_JSClassParams = array_merge(parent::getJSClassParams(), array('startDateAttribute' => $this->startDateAttribute, 'endDateAttribute' => $this->endDateAttribute, 'element' => '#' . $this->resolveId($this->id)), $this->options);
}
return $this->_JSClassParams;
}
开发者ID:dsyman2,项目名称:X2CRM,代码行数:7,代码来源:ActiveDateRangeInput.php
示例10: init
public function init()
{
Yii::app()->clientScript->registerScript('hideActionForm', "\$(document).ready(hideActionForm);\n\t\t\tfunction hideActionForm() {\n\t\t\t\t\$('#action-form').hide();\n\t\t\t}\n\t\t\t", CClientScript::POS_HEAD);
if (!$this->startHidden) {
Yii::app()->clientScript->registerScript('gotoActionForm', "\$('#action-form').ready(gotoActionForm);\n\t\t\t\tfunction gotoActionForm() {\n\t\t\t\t\t\$('#action-form').show();\n\t\t\t\t}\n\t\t\t\t", CClientScript::POS_HEAD);
}
parent::init();
}
开发者ID:dsyman2,项目名称:X2CRM,代码行数:8,代码来源:InlineActionForm.php
示例11: init
public function init()
{
$this->drive = Yii::app()->params->profile->mediaWidgetDrive && Yii::app()->settings->googleIntegration;
if (Yii::app()->settings->googleIntegration) {
$auth = new GoogleAuthenticator();
if (!isset($_SESSION['driveFiles']) && $auth->getAccessToken()) {
Yii::import('application.modules.media.controllers.MediaController');
$mediaController = new MediaController('MediaController');
$_SESSION['driveFiles'] = $mediaController->printFolder('root', $auth);
}
}
parent::init();
}
开发者ID:tymiles003,项目名称:X2CRM,代码行数:13,代码来源:MediaBox.php
示例12: init
public function init()
{
$quotesAssetsUrl = $this->module->assetsUrl;
if (isset($_POST)) {
$startHidden = false;
}
if ($this->startHidden) {
if ($this->startHidden) {
Yii::app()->clientScript->registerScript('startQuotesHidden', "\$('#quotes-form').hide();", CClientScript::POS_READY);
}
// Set up the new create form:
Yii::app()->clientScript->registerScriptFile($quotesAssetsUrl . '/js/inlineQuotes.js', CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($quotesAssetsUrl . '/js/LineItems.js', CClientScript::POS_HEAD);
Yii::app()->clientScript->registerCssFiles('InlineQuotesCss', array($quotesAssetsUrl . '/css/inlineQuotes.css', $quotesAssetsUrl . '/css/lineItemsMain.css', $quotesAssetsUrl . '/css/lineItemsWrite.css'), false);
Yii::app()->clientScript->registerCoreScript('jquery.ui');
$this->contact = X2Model::model('Contacts')->findByPk($this->contactId);
//$this->contact = Contacts::model()->findByPk($this->contactId);
$iqConfig = array('contact' => $this->contact instanceof Contacts ? CHtml::encode($this->contact->name) : '', 'account' => $this->account, 'sendingQuote' => false, 'lockedMessage' => Yii::t('quotes', 'This quote is locked. Are you sure you want to update this quote?'), 'deniedMessage' => Yii::t('quotes', 'This quote is locked.'), 'lockedDialogTitle' => Yii::t('quotes', 'Locked'), 'failMessage' => Yii::t('quotes', 'Could not save quote.'), 'reloadAction' => CHtml::normalizeUrl(array('/quotes/quotes/viewInline', 'recordId' => $this->recordId, 'recordType' => CHtml::encode($this->modelName))), 'createAction' => CHtml::normalizeUrl(array('/quotes/quotes/create', 'quick' => 1, 'recordId' => $this->recordId, 'recordType' => $this->modelName)), 'updateAction' => CHtml::normalizeUrl(array('/quotes/quotes/update', 'quick' => 1)));
Yii::app()->clientScript->registerScript('quickquote-vars', '
;(function () {
if(typeof x2 == "undefined"){
x2 = {};
}
var iqConfig = ' . CJSON::encode($iqConfig) . ';
if(typeof x2.inlineQuotes=="undefined") {
x2.inlineQuotes = iqConfig;
} else {
$.extend(x2.inlineQuotes,iqConfig);
}
}) ();', CClientScript::POS_HEAD);
}
parent::init();
}
开发者ID:dsyman2,项目名称:X2CRM,代码行数:33,代码来源:InlineQuotes.php
示例13: getPackages
public function getPackages()
{
return array_merge(parent::getPackages(), array('RecordAliasesWidget' => array('baseUrl' => Yii::app()->request->baseUrl, 'js' => array('js/RecordAliasesWidget.js'), 'depends' => array('auxlib'))));
}
开发者ID:keyeMyria,项目名称:CRM,代码行数:4,代码来源:RecordAliasesWidget.php
示例14: init
public function init()
{
parent::init();
$this->cs = Yii::app()->clientScript;
}
开发者ID:keyeMyria,项目名称:CRM,代码行数:5,代码来源:MenuList.php
示例15: init
public function init()
{
$this->disableTemplates = $this->disableTemplates || in_array($this->associationType, array_keys(Docs::modelsWhichSupportEmailTemplates()));
// Prepare the model for initially displayed input:
$this->model = new InlineEmail();
if (isset($this->targetModel)) {
$this->model->targetModel = $this->targetModel;
}
if (!$this->associationType) {
$this->associationType = X2Model::getModelName(Yii::app()->controller->module->name);
}
// Bring in attributes set in the configuration:
$this->model->attributes = $this->attributes;
if (empty($this->template)) {
// check for a default template
$defaultTemplateId = Yii::app()->params->profile->getDefaultEmailTemplate(Yii::app()->controller->module->name);
// if there's a default set for this module
if ($defaultTemplateId !== null) {
$defaultTemplateDoc = Docs::model()->findByPk($defaultTemplateId);
// ensure that template is still a valid default
if ($defaultTemplateDoc && ($defaultTemplateDoc->associationType === $this->associationType || $defaultTemplateDoc->type === 'quote' && $this->model->targetModel instanceof Quote)) {
$this->template = $defaultTemplateId;
}
}
}
if (empty($this->template)) {
if (empty($this->model->message)) {
$this->model->message = InlineEmail::emptyBody();
}
$this->model->insertSignature();
} else {
// Fill in the body with a template:
$this->model->scenario = 'template';
if (!empty($this->template)) {
$this->model->template = $this->template;
}
$this->model->prepareBody();
}
// If insertable attributes aren't set, use the inline email model's
// getInsertableAttributes() method to generate them.
if ((bool) $this->model->targetModel && !isset($this->insertableAttributes)) {
$this->insertableAttributes = $this->model->insertableAttributes;
}
$this->registerJSClassInstantiation();
// Load resources:
Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl() . '/js/ckeditor/ckeditor.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl() . '/js/ckeditor/adapters/jquery.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl() . '/js/emailEditor.js');
if (!empty($this->insertableAttributes)) {
Yii::app()->clientScript->registerScript('setInsertableAttributes', 'x2.insertableAttributes = ' . CJSON::encode($this->insertableAttributes) . ';', CClientScript::POS_HEAD);
}
Yii::app()->clientScript->registerScript('storeOriginalInlineEmailMessage', 'x2.inlineEmailOriginalBody = $("#email-message").val();', CClientScript::POS_READY);
//'.CJSON::encode($this->model->message).';',CClientScript::POS_READY);
Yii::app()->clientScript->registerScript('toggleEmailForm', $this->startHidden ? "window.hideInlineEmail = true;\n" : "window.hideInlineEmail = false;\n", CClientScript::POS_HEAD);
$this->registerPackages();
parent::init();
}
开发者ID:keyeMyria,项目名称:CRM,代码行数:57,代码来源:InlineEmailForm.php
示例16: init
public function init()
{
$miscLayoutSettings = Yii::app()->params->profile->miscLayoutSettings;
if (!$this->staticLayout && isset($miscLayoutSettings[$this->miscLayoutSettingsKey])) {
$this->columnWidthPercentage = $miscLayoutSettings[$this->miscLayoutSettingsKey];
}
if (!$this->staticLayout) {
$this->registerPackages();
$this->instantiateJSClass();
}
parent::init();
}
开发者ID:tymiles003,项目名称:X2CRM,代码行数:12,代码来源:RecordViewLayoutManager.php
示例17: getJSClassParams
public function getJSClassParams()
{
$totalEmails = count($this->listItems) + $this->sentCount;
if (!isset($this->_JSClassParams)) {
$this->_JSClassParams = array_merge(parent::getJSClassParams(), array('sentCount' => $this->sentCount, 'totalEmails' => $totalEmails, 'listItems' => $this->listItems, 'sendUrl' => Yii::app()->controller->createUrl('/marketing/marketing/mailIndividual'), 'campaignId' => $this->campaign->id, 'paused' => !(isset($_GET['launch']) && $_GET['launch'])));
}
return $this->_JSClassParams;
}
开发者ID:dsyman2,项目名称:X2CRM,代码行数:8,代码来源:EmailProgressControl.php
示例18: init
public function init()
{
if (!isset($this->namespace)) {
$this->namespace = $this->getWidgetKey();
}
parent::init();
}
开发者ID:tymiles003,项目名称:X2CRM,代码行数:7,代码来源:SortableWidget.php
示例19: init
public function init()
{
parent::init();
}
开发者ID:tymiles003,项目名称:X2CRM,代码行数:4,代码来源:NoteBox.php
示例20: getJSClassParams
public function getJSClassParams()
{
return array_merge(parent::getJSClassParams(), array('modelId' => $this->model->id, 'modelName' => $this->modelName));
}
开发者ID:shuvro35,项目名称:X2CRM,代码行数:4,代码来源:RecordView.php
注:本文中的X2Widget类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论