本文整理汇总了PHP中X2Widget类的典型用法代码示例。如果您正苦于以下问题:PHP X2Widget类的具体用法?PHP X2Widget怎么用?PHP X2Widget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了X2Widget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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)));
}
示例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();
}
示例5: 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;
}
示例6: 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;
}
示例7: 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();
}
示例8: 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();
}
示例9: 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();
}
示例10: 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'))));
}
示例11: init
public function init()
{
parent::init();
$this->cs = Yii::app()->clientScript;
}
示例12: 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();
}
示例13: 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();
}
示例14: 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;
}
示例15: init
public function init()
{
if (!isset($this->namespace)) {
$this->namespace = $this->getWidgetKey();
}
parent::init();
}