public function registerClientScript() { $cs = Yii::app()->clientScript; $id = $this->imageOptions['id']; $url = $this->getController()->createUrl($this->captchaAction, array(CCaptchaAction::REFRESH_GET_VAR => true)); $js = ""; if ($this->showRefreshButton) { // reserve a place in the registered script so that any enclosing button js code appears after the captcha js // $cs->registerScript('Yii.CCaptcha#' . $id, '// dummy'); echo CHtml::script('// dummy'); $label = $this->buttonLabel === null ? Yii::t('yii', 'Get a new code') : $this->buttonLabel; $options = $this->buttonOptions; if (isset($options['id'])) { $buttonID = $options['id']; } else { $buttonID = $options['id'] = $id . '_button'; } if ($this->buttonType === 'button') { $html = CHtml::button($label, $options); } else { $html = CHtml::link($label, $url, $options); } $js = "jQuery('#{$id}').after(" . CJSON::encode($html) . ");"; $selector = "#{$buttonID}"; } if ($this->clickableImage) { $selector = isset($selector) ? "{$selector}, #{$id}" : "#{$id}"; } if (!isset($selector)) { return; } $js .= "\njQuery(document).on('click', '{$selector}', function(){\n\tjQuery.ajax({\n\t\turl: " . CJSON::encode($url) . ",\n\t\tdataType: 'json',\n\t\tcache: false,\n\t\tsuccess: function(data) {\n var url = data['url'].split('?v=');\n var newCode = url[url.length - 1];\n var imgSrc = jQuery('#{$id}').attr('src').split('/');\n var oldCode = imgSrc[imgSrc.length - 1];\n var newUrl = jQuery('#{$id}').attr('src').replace(oldCode, newCode);\n \n\t\t\tjQuery('#{$id}').attr('src', newUrl);\n\t\t\tjQuery('body').data('{$this->captchaAction}.hash', [data['hash1'], data['hash2']]);\n\t\t}\n\t});\n\treturn false;\n});\n"; // $cs->registerScript('Yii.CCaptcha#' . $id, $js); echo CHtml::script($js); }
public function init() { $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . '/assets'); if (!isset($this->htmlOptions['id'])) { $this->htmlOptions['id'] = $this->getId(); } $this->id = $id = $this->htmlOptions['id']; echo CHtml::image($this->url, $this->alt, $this->htmlOptions); if (!empty($this->buttons)) { echo '<div class="jcrop-buttons">' . CHtml::button($this->buttons['start']['label'], $this->getHtmlOptions('start', 'inline')); echo CHtml::button($this->buttons['crop']['label'], $this->getHtmlOptions('crop')); echo CHtml::button($this->buttons['cancel']['label'], $this->getHtmlOptions('cancel')) . '</div>'; } echo CHtml::hiddenField($id . '_x', 0, array('class' => 'coords')); echo CHtml::hiddenField($id . '_y', 0, array('class' => 'coords')); echo CHtml::hiddenField($id . '_w', 0, array('class' => 'coords')); echo CHtml::hiddenField($id . '_h', 0, array('class' => 'coords')); echo CHtml::hiddenField($id . '_x2', 0, array('class' => 'coords')); echo CHtml::hiddenField($id . '_y2', 0, array('class' => 'coords')); $cls = Yii::app()->getClientScript(); $cls->registerScriptFile($assets . '/js/jquery.Jcrop.min.js'); $cls->registerScriptFile($assets . '/js/ejcrop.js', CClientScript::POS_HEAD); $cls->registerCssFile($assets . '/css/jquery.Jcrop.css'); $this->options['onChange'] = "js:function(c) {ejcrop_getCoords(c,'{$id}'); ejcrop_showThumb(c,'{$id}');}"; $this->options['ajaxUrl'] = $this->ajaxUrl; $this->options['ajaxParams'] = $this->ajaxParams; $options = CJavaScript::encode($this->options); if (!empty($this->buttons)) { $js = "ejcrop_initWithButtons('{$id}', {$options});"; } else { $js = "jQuery('#{$id}').Jcrop({$options});"; } $cls->registerScript(__CLASS__ . '#' . $id, $js, CClientScript::POS_READY); }
public function actiongetPreNextId() { $preId = ''; $nextId = ''; $preDisabled = ''; $nextDisabled = ''; $needToConfirmStr = '$needToConfirm = false;'; $id = (int) $_GET['id']; $infoType = $_GET['type']; $productId = (int) $_GET['product_id']; $preNextSql = Yii::app()->user->getState($productId . '_' . $infoType . '_prenextsql'); if (isset($id) && isset($preNextSql)) { $idSearchResult = Yii::app()->db->createCommand($preNextSql)->queryAll(); list($preId, $nextId) = InfoService::getPreNextValue($idSearchResult, $id); } if ('' == $preId) { $preDisabled = 'disabled'; } if ('' == $nextId) { $nextDisabled = 'disabled'; } $listStr = CHtml::button(Yii::t('Common', 'Previous') . '(P)', array('onclick' => $needToConfirmStr . 'location.href="' . Yii::app()->createUrl('info/edit', array('type' => $infoType, 'id' => $preId)) . '"', 'class' => 'btn', 'disabled' => $preDisabled, 'accesskey' => 'P')); $listStr .= CHtml::button(Yii::t('Common', 'Next') . '(N)', array('onclick' => $needToConfirmStr . 'location.href="' . Yii::app()->createUrl('info/edit', array('type' => $infoType, 'id' => $nextId)) . '"', 'class' => 'btn', 'disabled' => $nextDisabled, 'accesskey' => 'N')); echo $listStr; }
public function run() { list($name, $id) = $this->resolveNameID(); if (isset($this->htmlOptions['id'])) { $id = $this->htmlOptions['id']; } else { $this->htmlOptions['id'] = $id; } if (isset($this->htmlOptions['name'])) { $name = $this->htmlOptions['name']; } else { $this->htmlOptions['name'] = $name; } $contHtmlOptions = $this->htmlOptions; $contHtmlOptions['id'] = $id . 'container'; echo CHtml::openTag('div', $contHtmlOptions); $inputOptions = array('id' => $id); if ($this->hasModel()) { echo CHtml::activeHiddenField($this->model, $this->attribute, $inputOptions); $imgPath = $this->model->{$this->attribute}; } else { echo CHtml::hiddenField($name, $this->value, $inputOptions); $imgPath = $this->value; } if (!@getimagesize($imgPath)) { $imgPath = $this->assetsDir . '/images/no-photo.gif'; } echo CHtml::image($imgPath, 'preview', array('id' => 'image-preview-' . $id, 'style' => 'max-width: 120px; max-height: 120px; display: block; margin-bottom: 10px;')); echo CHtml::button('Browse', array('id' => $id . 'browse', 'class' => 'btn')); echo CHtml::closeTag('div'); $settings = array_merge(array('places' => "", 'rememberLastDir' => false), $this->settings); $settings['dialog'] = array('zIndex' => 400001, 'width' => 900, 'modal' => true, 'title' => "Files"); $settings['editorCallback'] = 'js:function(url) { $(\'#\'+aFieldId).attr(\'value\',url); $(\'#image-preview-\'+aFieldId).attr(\'src\',url); }'; $settings['closeOnEditorCallback'] = true; $connectorUrl = CJavaScript::encode($this->settings['url']); $settings = CJavaScript::encode($settings); $script = <<<EOD window.elfinderBrowse = function(field_id, connector) { var aFieldId = field_id, aWin = this; if(\$("#elFinderBrowser").length == 0) { \$("body").append(\$("<div/>").attr("id", "elFinderBrowser")); var settings = {$settings}; settings["url"] = connector; \$("#elFinderBrowser").elfinder(settings); } else { \$("#elFinderBrowser").elfinder("open", connector); } } EOD; $cs = Yii::app()->getClientScript(); $cs->registerScript('ServerFileInput#global', $script); $js = '$("#' . $id . 'browse").click(function(){window.elfinderBrowse("' . $id . '", ' . $connectorUrl . ')});'; $cs->registerScript('ServerFileInput#' . $id, $js); }
public static function ajaxSubmitButton($label, $url, $ajaxOptions = array(), $htmlOptions = array()) { if (self::getJValidateInstance()->isEnabled()) { list($label, $htmlOptions) = self::getJValidateInstance()->ajaxSubmitButton($label, $url, $ajaxOptions, $htmlOptions); return parent::button($label, $htmlOptions); } else { return parent::ajaxSubmitButton($label, $url, $ajaxOptions, $htmlOptions); } }
public function init() { if (Yii::app()->user->isGuest) { return; } Yii::app()->clientScript->registerScriptFile('/scripts/feed.js'); $isFollowing = $this->feed->isFollowing(Yii::app()->user->id); echo CHtml::button(Yii::t('app', 'Follow'), array('class' => 'follow', 'onclick' => new CJavaScriptExpression('app.feed.follow.call(this, ' . $this->feed->id . ')'), 'style' => $isFollowing ? 'display: none;' : '')); echo CHtml::button(Yii::t('app', 'Unfollow'), array('class' => 'unfollow', 'onclick' => new CJavaScriptExpression('app.feed.unfollow.call(this, ' . $this->feed->id . ')'), 'style' => $isFollowing ? '' : 'display: none;')); }
/** * Execute the widget * This method registers necessary javascript and renders the needed HTML code. */ public function run() { $this->registerClientScripts(); if ($this->_calButton == false) { echo CHtml::activeTextField($this->_model, $this->_attribute, array('id' => $this->_inputField, 'onclick' => 'displayCalendar(' . $this->_inputField . ',"' . $this->_daFormat . '",this,false)')); } else { echo CHtml::activeTextField($this->_model, $this->_attribute, array('id' => $this->_inputField, 'readonly' => 'readonly')); echo CHtml::button('Calendar', array('onclick' => 'displayCalendar(' . $this->_inputField . ',"' . $this->_daFormat . '",this,false)')); } }
public function run() { $cmd = CHtml::button($this->cmdLable, array('id' => 'export-button', 'class' => 'span-3 button', 'title' => $this->girdId, 'onclick' => 'CsvExporter.export(this)')); $ddl = ''; if (!empty($this->ddlOptions)) { $ddlOptions = array('name' => 'exportType', 'select' => '', 'data' => array(), 'htmlOptions' => array('for' => 'exportType')); $ddlOptions = CMap::mergeArray($ddlOptions, $this->ddlOptions); $ddl = CHtml::dropDownList($ddlOptions['name'], $ddlOptions['select'], $ddlOptions['data'], $ddlOptions['htmlOptions']); } echo strtr($this->template, array('{cmd}' => $cmd, '{ddl}' => $ddl)); $cs = Yii::app()->getClientScript(); $cs->registerScript(__CLASS__, $this->jsCode(), CClientScript::POS_END); }
public function run() { list($name, $id) = $this->resolveNameID(); if (!isset($this->htmlOptions['name'])) { $this->htmlOptions['name'] = $name; } if (!isset($this->htmlOptions['id'])) { $this->htmlOptions['id'] = $id; } switch ($this->buttonType) { case 'submit': echo CHtml::submitButton($this->caption, $this->htmlOptions); break; case 'button': echo CHtml::button($this->caption, $this->htmlOptions); break; case 'link': echo CHtml::link($this->caption, $this->url, $this->htmlOptions); break; case 'radio': if ($this->hasModel()) { echo CHtml::activeRadioButton($this->model, $this->attribute, $this->htmlOptions); } else { echo CHtml::radioButton($name, $this->value, $this->htmlOptions); } break; case 'checkbox': if ($this->hasModel()) { echo CHtml::activeCheckbox($this->model, $this->attribute, $this->htmlOptions); } else { echo CHtml::checkbox($name, $this->value, $this->htmlOptions); } break; default: throw new CException(Yii::t('zii', 'The button type "{type}" is not supported.', array('{type}' => $this->buttonType))); } $cs = Yii::app()->getClientScript(); $options = empty($this->options) ? '' : CJavaScript::encode($this->options); if (isset($this->onclick)) { if (strpos($this->onclick, 'js:') !== 0) { $this->onclick = 'js:' . $this->onclick; } $click = CJavaScript::encode($this->onclick); $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').button({$options}).click({$click});"); } else { $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').button({$options});"); } }
function approve_buttons($data) { $html = ''; if ($data->approve == Payment::FREE) { $html .= CHtml::button(Yii::t('site', 'Confirm'), array('class' => 'btn btn-primary btn-xs approve_payment', 'href' => $data->id, 'onclick' => 'setApprove($(this).attr("href"),$("#paymentType_"+$(this).attr("href")).val(),$("#payDetailNumber_"+$(this).attr("href")).val());return false;')); } if ($data->approve == Payment::FREE) { $html .= CHtml::button(Yii::t('site', 'Reject'), array('class' => 'btn btn-primary btn-xs reject_payment', 'href' => $data->id, 'onclick' => 'setReject($(this).attr("href"));return false;')); } if ($data->approve == Payment::APPROVED) { $html .= Yii::t('site', 'Confirmed'); } if ($data->approve == Payment::REJECTED) { $html .= Yii::t('site', 'Rejected'); } return $html; }
private function genContentTab($field, $lang) { $isCKEditor = $this->type == 'text-editor' ? 1 : 0; $fieldId = 'id_' . $this->modelName . $this->field . '_' . $lang; $html = ''; if ($this->useTranslate) { $html .= '<div class="translate_button" >'; $html .= '<span class="t_loader_' . $this->modelName . $this->field . '" style="display: none;"><img src="' . Yii::app()->theme->baseUrl . '/images/ajax-loader.gif" alt="Переводим"></span>'; $html .= CHtml::button(tc('Translate'), array('onClick' => "translateField('{$this->field}', '{$lang}', '{$isCKEditor}', '" . $this->modelName . "')")); $html .= '</div>'; } if ($this->useCopyButton) { $html .= '<div class="copylang_button">'; $html .= CHtml::button(tc('Copy to all languages'), array('onClick' => "copyField('{$this->field}', '{$lang}', '{$isCKEditor}', '" . $this->modelName . "')")); $html .= '</div>'; } $html .= '<div class="rowold">'; $html .= CHtml::activeLabel($this->model, $this->field, array('required' => $this->model->isLangAttributeRequired($this->field))); $html .= Apartment::getTip($this->field); if ($this->note) { $html .= CHtml::tag('p', array('class' => 'note'), $this->note); } switch ($this->type) { case 'string': $html .= CHtml::activeTextField($this->model, $field, array('class' => 'width500', 'maxlength' => 255, 'id' => $fieldId)); break; case 'text': $html .= CHtml::activeTextArea($this->model, $field, array('class' => 'width500 height200', 'id' => $fieldId)); break; case 'text-editor': $html .= '<div class="clear"></div>'; $filebrowserImageUploadUrl = ''; $allowedContent = false; if (Yii::app()->user->checkAccess('upload_from_wysiwyg')) { // if admin - enable upload image $filebrowserImageUploadUrl = Yii::app()->createAbsoluteUrl('/site/uploadimage', array('type' => 'imageUpload', Yii::app()->request->csrfTokenName => Yii::app()->request->csrfToken)); $allowedContent = true; } $html .= $this->widget('application.extensions.editMe.widgets.ExtEditMe', array('model' => $this->model, 'attribute' => $field, 'toolbar' => array(array('Source', '-', 'Bold', 'Italic', 'Underline', 'Strike'), array('Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'), array('NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'), array('Styles', 'Format', 'Font', 'FontSize', 'TextColor', 'BGColor'), array('Image', 'Link', 'Unlink', 'SpecialChar')), 'allowedContent' => $allowedContent, 'filebrowserImageUploadUrl' => $filebrowserImageUploadUrl, 'htmlOptions' => array('id' => $fieldId)), true); break; } $html .= CHtml::error($this->model, $field); $html .= '</div>'; $this->fieldIdArr[$lang] = $fieldId; return $html; }
public function run() { Yii::app()->clientScript->registerCoreScript('jquery'); echo CHtml::button($this->uncheckedTitle, array('id' => 'button-' . $this->id, 'class' => 'check-all-btn', 'onclick' => ' switch($(this).val()) { case "' . $this->checkedTitle . '": $(this).val("' . $this->uncheckedTitle . '"); $("input[type=checkbox]").attr("checked", false); break; case "' . $this->uncheckedTitle . '": $(this).val("' . $this->checkedTitle . '"); $("input[type=checkbox]").attr("checked", true); break; } ')); }
public function init() { //gridId is required if (empty($this->ecolumns['gridId'])) { throw new CException('You must provide gridId'); } if ($this->getId(false) === null) { $this->setId($this->ecolumns['gridId'] . '-ecolumns-dlg'); } //prepare EColumns params if (!isset($this->ecolumns['buttonCancel'])) { $this->ecolumns['buttonCancel'] = CHtml::button('Close', array('type' => 'button', 'onclick' => '$("#' . $this->getId() . '").dialog("close"); return false;', 'style' => 'float: right')); } if (!isset($this->ecolumns['buttonApply'])) { $this->ecolumns['buttonApply'] = CHtml::button('Apply', array('type' => 'submit', 'onclick' => '$("#' . $this->getId() . '").dialog("close")', 'style' => 'float: left')); } //create EColumns object $this->_ecolumns = $this->owner->createWidget('ext.ecolumns.EColumns', $this->ecolumns); parent::init(); $this->_ecolumns->run(); //handler for click on link yii::app()->clientScript->registerScript($this->getLinkId(), "\r\n jQuery('#{$this->getLinkId()}').live('click', function() { jQuery('#{$this->getId()}').dialog('open'); return false; })\r\n ", CClientScript::POS_READY); }
public function run() { list($name, $id) = $this->resolveNameID(); if (isset($this->htmlOptions['id'])) { $id = $this->htmlOptions['id']; } else { $this->htmlOptions['id'] = $id; } if (isset($this->htmlOptions['name'])) { $name = $this->htmlOptions['name']; } else { $this->htmlOptions['name'] = $name; } if ($this->size !== null) { $this->htmlOptions['size'] = $this->size; } $this->registerClientScript(); print "<ul><li>" . Yii::t('cms', 'URL') . " "; if ($this->hasModel()) { echo CHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions); } else { echo CHtml::textField($name, $this->value, $this->htmlOptions); } if ($this->showFileManagerButton) { echo "</li><li>" . Yii::t('cms', 'or') . " "; echo CHtml::button(Yii::t('cms', 'Browse uploaded'), array('id' => $this->htmlOptions['id'] . '_button', 'class' => 'cms-button')); } if ($this->showUploadButton) { echo "</li><li>" . Yii::t('cms', 'or') . " <div id='" . $this->htmlOptions['id'] . "_file'></div>"; } if ($this->showPageSelectButton) { echo "</li><li>" . Yii::t('cms', 'or') . " " . Yii::t('cms', 'Select page') . "<br />"; $this->widget('PageSelect', array('textLinkId' => $this->htmlOptions['id'], 'name' => 'PageSelect', 'id' => $this->htmlOptions['id'] . '_PageSelect')); } echo "</li></ul>"; }
public function formInput(&$controller, $tagOptions=array()) { if(!Yii::app()->clientScript->isScriptFileRegistered(AutoAdmin::$assetPath.'/js/text-editor.js')) Yii::app()->clientScript->registerScriptFile(AutoAdmin::$assetPath.'/js/text-editor.js'); ob_start(); $inputName = $this->formInputName(); $inputID = "i_{$inputName}"; echo CHtml::label($this->label, $inputID); echo CHtml::tag('br'); $value = str_replace('<br/>', "\n", $this->value); $value = AAHelperForm::prepareTextForForm($value); $value = str_replace("<p>", "", $value); $value = str_replace("</p>", "", $value); $tagOptions['id'] = $inputID; if($this->isReadonly) $tagOptions['disabled'] = true; else { echo CHtml::button('STRONG'); echo CHtml::button('EM'); echo CHtml::button('H3'); echo CHtml::button('H4'); echo CHtml::button('UL'); echo CHtml::button('OL'); echo CHtml::button('Link'); echo CHtml::button('MailTo'); echo CHtml::button('Img'); echo CHtml::button('<..>'); } echo CHtml::textArea($inputName, $value, $tagOptions); return ob_get_clean(); }
?> </div> <div class="control-group" id="parent_empty"> <div class="controls"> <?php $list = array(0 => 'Select object'); foreach ($objects as $obj) { $list[$obj->id] = $obj->name; } echo CHtml::dropDownList('resource_object', '', $list); ?> <?php echo CHtml::button('Add', array('class' => 'btn btn-success', 'id' => 'btnAdd', 'style' => 'width:70px;')); ?> </div> </div> </fieldset> <div class="form-actions"> <button type="submit" class="btn btn-primary">Save changes</button> <?php echo CHtml::link('Cancel', 'resources?resource=' . $type, array('class' => 'btn')); ?> </div> <?php $this->endWidget(); ?>
<div class="clear"> </div> <div id="osmap"> <?php echo $this->actionOSmap($model->id, $model); ?> </div> <div class="clear"> </div> <?php } ?> <div class="search_by_address"> <?php echo CHtml::textField('address_for_map', '', array('class' => 'width300')); echo CHtml::button(tc('Set a marker by address'), array('onclick' => "findByAddress(); return false;")); ?> </div> <?php } ?> </div> <?php $this->renderPartial('//../modules/apartments/views/backend/__form', array('model' => $model, 'form' => $form)); ?> </div> <?php
echo CHtml::label(Yii::t('admin', 'Include Hidden Records?'), 'includeHidden'); echo CHtml::checkbox('includeHidden', false); echo X2Html::hint2(Yii::t('admin', 'Include records that were hidden by the duplicate checker.')); } ?> </div> <div class="exportOption"> <?php echo CHtml::label(Yii::t('admin', 'Include Tags?'), 'includeTags'); echo CHtml::checkbox('includeTags', false); ?> </div> <?php echo CHtml::button(Yii::t('app', 'Export'), array('class' => 'x2-button', 'id' => 'export-button')); ?> <div id="status-text"> </div> <div style="display:none" id="download-link-box"> <?php echo Yii::t('admin', 'Please click the link below to download {model}.', array('{model}' => $model)); ?> <br><br> <a class="x2-button" id="download-link" href="#"><?php echo Yii::t('app', 'Download'); ?> !</a>
?> <div class="col-md-12"> <?php // echo CHtml::button('Новый счет', array('class' => 'btn btn-success', 'id' => 'add_schet', 'style' => ' display:block-inline;')); ?> </div> <div class="wrapper wrapper-white"> <p class="btn-toolbar btn-toolbar-demo"> <?php echo CHtml::button('+ этап работ', array('class' => 'btn btn-success', 'id' => 'add_etap_rabot', 'style' => ' display:block-inline;')); ?> </p> <div class="col-md-10"> <div class="search-form" style="display:none"> </div> <!-- search-form --> </div> <div class="row row-wider"> <!-- <div class="col-md-12">-->
<?php echo CHtml::button('Ok', array('onclick' => CHtml::ajax(array('url' => Yii::app()->getRequest()->getUrl(), 'update' => '.fancybox-inner', 'type' => 'post', 'data' => array('ok' => true))))); echo CHtml::button('Отмена', array('onclick' => '$.fancybox.close()'));
<div class="row buttons"> <?php echo CHtml::submitButton(Yii::t('common', 'seconnecter')); ?> </div> <?php $this->endWidget(); echo CHtml::link(Yii::t('common', 'forgotedPwd'), array_merge(array("site/recoverPwd"), isset($_GET['layout']) ? array('layout' => $_GET['layout']) : array())); ?> </div><!-- form --> </td> <td> <div align='center'> <?php echo Yii::t('common', 'noAccount'); ?> <br><br> <?php echo CHtml::button(Yii::t('common', 'subscribe'), array('submit' => array_merge(array("site/subscribe"), isset($_GET['layout']) ? array('layout' => $_GET['layout']) : array()))); ?> </div> </td> </tr> </table>
/** *### .createButton() * * Creates the button element. * * @return string the created button. */ protected function createButton() { switch ($this->buttonType) { case self::BUTTON_BUTTON: return CHtml::htmlButton($this->label, $this->htmlOptions); case self::BUTTON_SUBMIT: $this->htmlOptions['type'] = 'submit'; return CHtml::htmlButton($this->label, $this->htmlOptions); case self::BUTTON_RESET: $this->htmlOptions['type'] = 'reset'; return CHtml::htmlButton($this->label, $this->htmlOptions); case self::BUTTON_SUBMITLINK: return CHtml::linkButton($this->label, $this->htmlOptions); case self::BUTTON_AJAXLINK: return CHtml::ajaxLink($this->label, $this->url, $this->ajaxOptions, $this->htmlOptions); case self::BUTTON_AJAXBUTTON: $this->ajaxOptions['url'] = $this->url; $this->htmlOptions['ajax'] = $this->ajaxOptions; return CHtml::htmlButton($this->label, $this->htmlOptions); case self::BUTTON_AJAXSUBMIT: $this->ajaxOptions['type'] = isset($this->ajaxOptions['type']) ? $this->ajaxOptions['type'] : 'POST'; $this->ajaxOptions['url'] = $this->url; $this->htmlOptions['type'] = 'submit'; $this->htmlOptions['ajax'] = $this->ajaxOptions; return CHtml::htmlButton($this->label, $this->htmlOptions); case self::BUTTON_INPUTBUTTON: return CHtml::button($this->label, $this->htmlOptions); case self::BUTTON_INPUTSUBMIT: $this->htmlOptions['type'] = 'submit'; return CHtml::button($this->label, $this->htmlOptions); default: case self::BUTTON_LINK: return CHtml::link($this->label, $this->url, $this->htmlOptions); } }
font-family: Arial; font-size: 24px !important; } </style> </head> <title><?php echo $t = Certificate::model()->findByPk($model->certificatetype)->certificate_title;?> </title> <body> <button style='margin-left:50px;' class='submit' onclick="javascript:window.print()" id="printid1" class="submit">Print</button> <?php $lis = CHtml::listData($studModel,'student_transaction_id','student_transaction_id'); $st_str = implode(',',$lis); if(Yii::app()->controller->action->id!="certiview") { echo CHtml::button('Save',array('id'=>"printid1",'class'=>'submit','submit' => array('certificate/savemultiplecerti','stid'=>$st_str,'ctype'=>$model->certificatetype))); echo CHtml::link('GO BACK', array('certificate/certificategeneration'),array('class'=>'btnback')); } else { if(!empty($_REQUEST['studid'])) echo CHtml::link('GO BACK', array('student/studentTransaction/studentcertificate','id'=>$_REQUEST['studid']),array('class'=>'btnback')); } foreach($studModel as $list) { $stud_info = StudentInfo::model()->findByAttributes(array('student_info_transaction_id'=>$list['student_transaction_id'])); if($stud_info) { $trans = StudentTransaction::model()->findByPk($stud_info->student_info_transaction_id); $titl = "<b>".$stud_info->title."</b>"; $name = "<b>".$stud_info->student_first_name." ".$stud_info->student_middle_name." ".$stud_info->student_last_name."</b>"; $smobile = "<b>".$stud_info->student_mobile_no."</b>"; $pmobile = "<b>".$stud_info->student_guardian_mobile."</b>";
public function run() { list($name, $id) = $this->resolveNameID(); if (isset($this->htmlOptions['id'])) { $id = $this->htmlOptions['id']; } else { $this->htmlOptions['id'] = $id; } if (isset($this->htmlOptions['name'])) { $name = $this->htmlOptions['name']; } else { $this->htmlOptions['name'] = $name; } $contHtmlOptions = $this->htmlOptions; $contHtmlOptions['id'] = $id . 'container'; echo CHtml::openTag('div', $contHtmlOptions); if ($this->hasModel()) { $attribute = $this->attribute; $src = $this->model->{$attribute}; } else { $src = $this->value; } if (!$src) { $class = 'hide'; } echo CHtml::image($src, '', array('id' => $id . '_image', 'width' => 95, 'class' => $class)) . " "; $inputOptions = array('id' => $id, 'style' => 'float:left;'); if ($this->hasModel()) { echo CHtml::activeHiddenField($this->model, $this->attribute, $inputOptions); } else { echo CHtml::hiddenField($name, $this->value, $inputOptions); } echo CHtml::button('Browse', array('id' => $id . 'browse', 'class' => 'btn', 'style' => 'vertical-align: top;')); echo CHtml::closeTag('div'); $settings = array_merge(array('places' => "", 'rememberLastDir' => false), $this->settings); $settings['dialog'] = array('zIndex' => 400001, 'width' => 900, 'modal' => true, 'title' => "Files"); $settings['editorCallback'] = 'js:function(url) { $(\'#\'+aFieldId).attr(\'value\',url); $(\'#\'+aFieldId+\'_image\').attr(\'src\',url).show(); }'; $settings['closeOnEditorCallback'] = true; $connectorUrl = CJavaScript::encode($this->settings['url']); $settings = CJavaScript::encode($settings); $script = <<<EOD window.elfinderBrowse = function(field_id, connector) { var aFieldId = field_id, aWin = this; if(\$("#elFinderBrowser").length == 0) { \$("body").append(\$("<div/>").attr("id", "elFinderBrowser")); var settings = {$settings}; settings["url"] = connector; \$("#elFinderBrowser").elfinder(settings); } else { \$("#elFinderBrowser").elfinder("open", connector); } } EOD; $cs = Yii::app()->getClientScript(); $cs->registerScript('ServerFileInput#global', $script); $js = '$("#' . $id . 'browse").click(function(){window.elfinderBrowse("' . $id . '", ' . $connectorUrl . ')});'; $cs->registerScript('ServerFileInput#' . $id, $js); }
echo l("Buy Now", url("payment/paypal", array("id" => $id, "type" => "large"))); ?> </div> </td> </tr> </table> <br> <hr> <div id="discount_area"> Have a discount coupon? Enter it here: <?php echo CHtml::textField("discountField", "", array("id" => "discountField")); ?> <br/> <?php echo CHtml::button("Redeem", array("id" => "redeem_btn")); ?> </div> <hr/> <br> Need something bigger? Custom Video? total hassle free setup? Feel free to contact us at <b>ss@OptionsM.com </b> for a quote or use the Contact form. </div> --> <br> <script type="text/javascript"> $(document).ready(function(){
?> </td> <td name='organName'><?php echo $dealer->organName; ?> </td> <td name='Phone'><?php echo $dealer->Phone; ?> </td> <td><?php Area::showCity($dealer->province) . Area::showCity($dealer->city) . Area::showCity($dealer->area); ?> </td> <td><?php echo CHtml::button('选择', array('class' => 'btn-small', 'id' => 'opt')); ?> </td> </tr> <?php $i++; ?> <?php } ?> </tbody> <?php } else { ?> <tr><td colspan="5" align="center"> <p>搜索到 <font color=red>0</font> 条数据 <span style="text-decoration: underline"><?php
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)); ?> </div> <?php echo X2Html::csrfToken(); echo CHtml::button(Yii::t('app', 'Create Relationship'), array('id' => 'add-relationship-button', 'class' => 'x2-button')); ?> </form> <?php } ?>
/** * Причины банов * @throws CHttpException */ public function actionReasons() { // Проверка прав if (Yii::app()->user->isGuest) { throw new CHttpException(403, "У Вас недостаточно прав"); } // Задаем лайоут $this->layout = '//layouts/column2'; // Вывод модальки с деталями группы if (isset($_POST['groupid'])) { $gid = intval($_POST['groupid']); // Выбираем все причины $reasons = Reasons::model()->findAll(); // Выбираем группу причин по ID $group = ReasonsSet::model()->findByPk($gid); $js = CHtml::form('', 'post', array('id' => 'form' . $gid)); $js .= "<table class=\"table table-bordered table-condensed\"><thead><tr><th colspan=3 style=\"vertical-align: middle\">Название группы " . CHtml::textField('groupname', $group->setname) . "</th></tr><tr><th>Причина</th><th>Срок бана</th><th>Действия</th></thead><tbody>"; foreach ($reasons as $reason) { $server = ReasonsToSet::model()->findByAttributes(array('setid' => $gid, 'reasonid' => $reason->id)); $js .= "<tr id=\"reason{$reason->id}\">"; $js .= "<td>"; $js .= CHtml::encode($reason->reason); $js .= "</td>"; $js .= "<td>"; $js .= CHtml::encode($reason->static_bantime); $js .= "</td>"; $js .= "<td>"; $js .= CHtml::checkBox('active[]', $server !== NULL ? TRUE : FALSE, array('value' => $reason->id, 'id' => 'active' . $reason->id)); $js .= "</td>"; $js .= "</tr>"; } $js .= "<tr><td colspan=3 style=\"text-align: center\">"; $js .= CHtml::hiddenField('gid', $gid); $js .= CHtml::button('Сохранить', array('class' => 'btn btn-primary save', 'onclick' => '$.post(\'\', $(\'#form' . $gid . '\').serialize(), function(data){eval(data);});')); $js .= "</td></tr>"; $js .= "</tbody></table>"; $js .= CHtml::endForm(); Yii::app()->end("\$('#loading').hide();\$('.modal-header').html('<h2>Причины банов для группы \"{$group->setname}\"</h2>');\$('.modal-body').html('{$js}');\$('#reasons-modal').modal('show');"); } // Сохранение деталей группы if (isset($_POST['active'])) { //Yii::app()->end($_POST['gid']); // Если не выбрали причины if (empty($_POST['active'])) { Yii::app()->end("alert('Выберите причины!');"); } // Если не введено название группы if (empty($_POST['groupname'])) { Yii::app()->end("alert('Введите название группы!');"); } // Ищем группу $set = ReasonsSet::model()->findByPk($_POST['gid']); // Если группы нет, возвращаем ошибку if ($set === NULL) { Yii::app()->end("alert('Ошибка! Группа причин под ID " . intval($_POST['gid']) . " не найдена');"); } // Если изменено название группы, то обновляем в базе и на странице $other = ""; if ($_POST['groupname'] != $set->setname) { $set->setname = CHtml::encode($_POST['groupname']); if ($set->save()) { $other = "\$('#rgroup{$_POST['gid']}').children('td:first').html('" . CHtml::encode($_POST['groupname']) . "');"; } //Yii::app()->end(var_dump($set->errors())); } // Ищем и предварительно удаляем все записи для этой группы причин if (ReasonsToSet::model()->findAllByAttributes(array('setid' => intval($_POST['gid'])))) { ReasonsToSet::model()->deleteAllByAttributes(array('setid' => intval($_POST['gid']))); } // Циклим и записываем в базу новые причины для этой группы foreach ($_POST['active'] as $r) { $rts = new ReasonsToSet(); $rts->setid = intval($_POST['gid']); $rts->reasonid = intval($r); if ($rts->save()) { $rts->unsetAttributes(); } } Yii::app()->end($other . "\$('#reasons-modal').modal('hide');alert('Сохранено!');"); } $this->render('reasons', array('reasons' => new CActiveDataProvider('Reasons', array('criteria' => array('order' => '`static_bantime` DESC'))), 'reasonsset' => new CActiveDataProvider('ReasonsSet'))); }
* @var $this AdminController * @var $model Articles * @var $form CActiveForm * * @author Putra Sudaryanto <*****@*****.**> * @copyright Copyright (c) 2012 Ommu Platform (ommu.co) * @link https://github.com/oMMu/Ommu-Articles * @contact (+62)856-299-4114 * */ $this->breadcrumbs = array('Articles' => array('manage'), 'Delete'); ?> <?php $form = $this->beginWidget('application.components.system.OActiveForm', array('id' => 'articles-form', 'enableAjaxValidation' => true)); ?> <div class="dialog-content"> <?php echo Yii::t('phrase', 'Are you sure you want to delete this item?'); ?> </div> <div class="dialog-submit"> <?php echo CHtml::submitButton(Yii::t('phrase', 'Delete'), array('onclick' => 'setEnableSave()')); ?> <?php echo CHtml::button(Yii::t('phrase', 'Cancel'), array('id' => 'closed')); ?> </div> <?php $this->endWidget();
<div class="form"> <?php $feed=new Social; ?> <?php $form = $this->beginWidget('CActiveForm', array( 'id'=>'feed-form', 'enableAjaxValidation'=>false, 'method'=>'post', 'action'=>array('addPost','id'=>Yii::app()->user->getId(),'redirect'=>'index'), )); ?> <div class="float-row"> <?php $feed->data = Yii::t('app','Enter text here...'); echo $form->textArea($feed,'data',array('onfocus'=>'toggleText(this);','onblur'=>'toggleText(this);','style'=>'width:558px;height:50px;color:#aaa;')); echo $form->dropDownList($feed,'associationId',$users); echo CHtml::submitButton(Yii::t('app','Post'),array('class'=>'x2-button','id'=>'save-button')); echo CHtml::button(Yii::t('app','Attach A File/Photo'),array('class'=>'x2-button','onclick'=>"$('#attachments').toggle();")); ?> </div> <?php $this->endWidget(); ?> </div> <div id="attachments" style="display:none;"> <?php $this->widget('Attachments',array('type'=>'feed','associationId'=>Yii::app()->user->getId())); ?> </div> <?php $this->widget('zii.widgets.CListView', array( 'dataProvider'=>$dataProvider, 'itemView'=>'../social/_viewFull', 'template'=>'{items}' )); ?>