本文整理汇总了PHP中CHtml::htmlButton方法的典型用法代码示例。如果您正苦于以下问题:PHP CHtml::htmlButton方法的具体用法?PHP CHtml::htmlButton怎么用?PHP CHtml::htmlButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHtml
的用法示例。
在下文中一共展示了CHtml::htmlButton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toHtml
public function toHtml()
{
$this->htmlOptions['class'] .= ' ' . $this->options['level'];
$this->htmlOptions['class'] .= ' event-action';
$label = CHtml::encode($this->label);
if ($this->options['level'] === 'save') {
$this->htmlOptions['class'] .= ' button secondary small';
}
if ($this->options['level'] === 'delete') {
$content = '<span class="icon-button-small-trash-can"></span>';
$content .= '<span class="hide-offscreen">' . $label . '</span>';
$label = $content;
$this->htmlOptions['class'] .= ' button button-icon small';
}
if ($this->options['level'] === 'cancel') {
$this->htmlOptions['class'] .= ' button small';
}
if ($this->options['disabled']) {
$this->htmlOptions['class'] .= ' disabled';
$this->htmlOptions['disabled'] = 'disabled';
}
if ($this->type == 'button') {
return CHtml::htmlButton($label, $this->htmlOptions);
} elseif ($this->type == 'link') {
return CHtml::link($label, $this->href, $this->htmlOptions);
}
}
示例2: renderButton
protected function renderButton($label, $metaData)
{
//Button can come from 2 system, by pluginSettings>settings>button ot by by pluginSettings>buttons
if (is_string($metaData)) {
$label = $metaData;
$metaData = array('htmlOptions' => array());
}
$metaData['class'][] = 'btn';
if (isset($metaData['type']) && $metaData['type'] == 'link') {
$metaData['class'][] = 'btn-link';
$metaData['class'][] = 'button';
}
$htmlOptions = $this->htmlOptions($metaData);
if (isset($metaData['type']) && $metaData['type'] == 'link') {
return CHtml::link($label, $metaData['href'], $htmlOptions);
// This allow cancel without js
} elseif (isset($metaData['type'])) {
$htmlOptions['type'] = $metaData['type'];
return CHtml::htmlButton($label, $htmlOptions);
} elseif (isset($htmlOptions['type'])) {
return CHtml::htmlButton($label, $htmlOptions);
} else {
return CHtml::submitButton($label, $htmlOptions);
}
}
示例3: run
public function run()
{
parent::run();
if (!empty($this->value)) {
echo CHtml::htmlButton($this->controller->getActionLabel('cross', false), array('type' => 'submit', 'alt' => 'Remove filter', 'title' => 'Remove filter', 'onclick' => 'jQuery("#' . $this->id . '").val("")'));
}
}
示例4: getButtonMore
/**
* Renvoie le code HTML pour un bouton 'lire la suite' utilisé pour accéder à l'intégralité d'un texte tronqué
* @internal L'accès au texte intégral passe par du javascript qui exploite ce bouton et certains de ces
* attributs (classe CSS, id, etc...)
* @param boolean $appendDiv
* @return string
*/
public static function getButtonMore($appendDiv = true)
{
$out = CHtml::htmlButton('Lire la suite', array('name' => 'more', 'class' => 'buttonMore'));
if ($appendDiv) {
$out .= CHtml::tag('div', array('class' => 'moreHere'));
}
return $out;
}
示例5: 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'] = 'POST';
$this->ajaxOptions['url'] = $this->url;
$this->htmlOptions['type'] = 'submit';
$this->htmlOptions['ajax'] = $this->ajaxOptions;
return CHtml::htmlButton($this->label, $this->htmlOptions);
default:
case self::BUTTON_LINK:
return CHtml::link($this->label, $this->url, $this->htmlOptions);
}
}
示例6:
?>
<div class="row buttons">
<?php
echo CHtml::htmlButton($actionModel->isNewRecord ? Yii::t('app','Submit Contact + Action'):Yii::t('app','Save'),
array('type'=>'submit',
'class'=>'x2-button',
'id'=>'save-button1',
'name'=>'submit',
'value'=>'action',
'tabindex'=>26
)
); ?>
<?php
echo CHtml::htmlButton(Yii::t('app','Submit Contact + Comment'),
array(
'type'=>'submit',
'class'=>'x2-button',
'id'=>'save-button2',
'name'=>'submit',
'value'=>'comment',
'tabindex'=>27
)
); ?>
<?php // echo CHtml::submitButton(Yii::t('app','Submit'),array('class'=>'x2-button','tabindex'=>25)); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
示例7: run
//.........这里部分代码省略.........
if (isset($popup)) {
$aPopup[] = $popup;
}
if (isset($vpopup)) {
$aPopup[] = $vpopup;
}
if (isset($fpopup)) {
$aPopup[] = $fpopup;
}
}
Yii::app()->clientScript->registerScript("showpopup", "showpopup=" . (int) Yii::app()->getConfig('showpopups') . ";", CClientScript::POS_HEAD);
//if(count($aPopup))
Yii::app()->clientScript->registerScript('startPopup', "startPopups=" . json_encode($aPopup) . ";", CClientScript::POS_HEAD);
//ALTER PAGE CLASS TO PROVIDE WHOLE-PAGE ALTERNATION
if ($surveyMode != 'survey' && $_SESSION[$LEMsessid]['step'] != $_SESSION[$LEMsessid]['prevstep'] || isset($_SESSION[$LEMsessid]['stepno']) && $_SESSION[$LEMsessid]['stepno'] % 2) {
if (!isset($_SESSION[$LEMsessid]['stepno'])) {
$_SESSION[$LEMsessid]['stepno'] = 0;
}
if ($_SESSION[$LEMsessid]['step'] != $_SESSION[$LEMsessid]['prevstep']) {
++$_SESSION[$LEMsessid]['stepno'];
}
if ($_SESSION[$LEMsessid]['stepno'] % 2) {
echo "<script type=\"text/javascript\">\n" . " \$(\"body\").addClass(\"page-odd\");\n" . "</script>\n";
}
}
$hiddenfieldnames = implode("|", $inputnames);
if (isset($upload_file) && $upload_file) {
echo CHtml::form(array("/survey/index", "sid" => $surveyid), 'post', array('enctype' => 'multipart/form-data', 'id' => 'limesurvey', 'name' => 'limesurvey', 'autocomplete' => 'off', 'class' => 'survey-form-container surveyRunTimeUploadFile')) . "\n\n <!-- INPUT NAMES -->\n <input type='hidden' name='fieldnames' value='{$hiddenfieldnames}' id='fieldnames' />\n";
} else {
echo CHtml::form(array("/survey/index", "sid" => $surveyid), 'post', array('id' => 'limesurvey', 'name' => 'limesurvey', 'autocomplete' => 'off', 'class' => 'survey-form-container surveyRunTime')) . "\n\n <!-- INPUT NAMES -->\n <input type='hidden' name='fieldnames' value='{$hiddenfieldnames}' id='fieldnames' />\n";
}
// <-- END FEATURE - SAVE
// The default submit button
echo CHtml::htmlButton("default", array('type' => 'submit', 'id' => "defaultbtn", 'value' => "default", 'name' => 'move', 'class' => "submit noview", 'style' => 'display:none'));
if ($surveyMode == 'survey') {
if (isset($thissurvey['showwelcome']) && $thissurvey['showwelcome'] == 'N') {
//Hide the welcome screen if explicitly set
} else {
echo templatereplace(file_get_contents($sTemplateViewPath . "welcome.pstpl"), array(), $redata) . "\n";
}
if ($thissurvey['anonymized'] == "Y") {
echo templatereplace(file_get_contents($sTemplateViewPath . "privacy.pstpl"), array(), $redata) . "\n";
}
}
// <-- START THE SURVEY -->
if ($surveyMode != 'survey') {
echo templatereplace(file_get_contents($sTemplateViewPath . "survey.pstpl"), array(), $redata);
}
// runonce element has been changed from a hidden to a text/display:none one. In order to workaround an not-reproduced issue #4453 (lemeur)
// We don't need runonce actually (140228): the script was updated and replaced by EM see #08783 (grep show no other runonce)
// echo "<input type='text' id='runonce' value='0' style='display: none;'/>";
$showpopups = Yii::app()->getConfig('showpopups');
//Display the "mandatory" message on page if necessary
if (!$showpopups && $stepInfo['mandViolation'] && $okToShowErrors) {
echo "<p class='errormandatory alert alert-danger' role='alert'>" . gT("One or more mandatory questions have not been answered. You cannot proceed until these have been completed.") . "</p>";
}
//Display the "validation" message on page if necessary
if (!$showpopups && !$stepInfo['valid'] && $okToShowErrors) {
echo "<p class='errormandatory alert alert-danger' role='alert'>" . gT("One or more questions have not been answered in a valid manner. You cannot proceed until these answers are valid.") . "</p>";
}
//Display the "file validation" message on page if necessary
if (!$showpopups && isset($filenotvalidated) && $filenotvalidated == true && $okToShowErrors) {
echo "<p class='errormandatory alert alert-danger' role='alert'>" . gT("One or more uploaded files are not in proper format/size. You cannot proceed until these files are valid.") . "</p>";
}
$_gseq = -1;
foreach ($_SESSION[$LEMsessid]['grouplist'] as $gl) {
示例8: array
<div class="mws-panel-toolbar top clearfix">
<ul>
<li><a class="mws-ic-16 ic-add" href="index.php?r=kepegawaian/kabupatenkotaM/create">Tambah Kabupaten / Kota</a></li>
</ul>
</div>
<div class="mws-table">
<?php
$this->widget('zii.widgets.grid.CGridView', array('id' => 'kabupatenkota-m-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'ID Kab / Kota', 'name' => 'kabupatenkota_id', 'value' => '$data->kabupatenkota_id'), array('header' => 'Propinsi', 'name' => 'propinsi_id', 'filter' => CHtml::listData(PropinsiM::model()->findAll(), 'propinsi_id', 'propinsi_nama'), 'value' => 'isset($data->propinsi->propinsi_nama) ? $data->propinsi->propinsi_nama : ""'), array('header' => 'Nama Kab / Kota', 'name' => 'kabupatenkota_nama', 'value' => '$data->kabupatenkota_nama'), array('header' => 'Aktif', 'class' => 'CCheckBoxColumn', 'selectableRows' => 0, 'id' => 'rows', 'checked' => '$data->kabupatenkota_aktif'), array('header' => 'Lihat', 'class' => 'CButtonColumn', 'template' => '{view}'), array('header' => 'Ubah', 'class' => 'CButtonColumn', 'template' => '{update}'), array('header' => 'Delete', 'class' => 'CButtonColumn', 'template' => '{delete}'))));
?>
</div>
<div class="mws-button-row" align="right">
<?php
echo CHtml::htmlButton(Yii::t('mds', '{icon} PDF', array('{icon}' => '<i class="icon-book icon-white"></i>')), array('class' => 'mws-button blue', 'type' => 'button', 'onclick' => 'print(\'PDF\')')) . "  ";
echo CHtml::htmlButton(Yii::t('mds', '{icon} Excel', array('{icon}' => '<i class="icon-pdf icon-white"></i>')), array('class' => 'mws-button green', 'type' => 'button', 'onclick' => 'print(\'EXCEL\')')) . "  ";
echo CHtml::htmlButton(Yii::t('mds', '{icon} Print', array('{icon}' => '<i class="icon-print icon-white"></i>')), array('class' => 'mws-button orange', 'type' => 'button', 'onclick' => 'print(\'PRINT\')')) . "  ";
///echo CHtml::htmlButton(Yii::t('mds','{icon} Petunjuk',array('{icon}'=>'<i class="icon-print icon-white"></i>')),array('class'=>'mws-button yellow', 'type'=>'button','id'=>'clickme'))."  ";
?>
</div><br>
<div id ="ptjk" class="mws-form-message info" style="display: none;">
<p>
You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>
</div>
</div>
</div>
<?php
$controller = Yii::app()->controller->id;
//mengambil Controller yang sedang dipakai
$module = Yii::app()->controller->module->id;
示例9: array
?>
<?php
echo Yii::t('checkout', 'or');
?>
<?php
echo CHtml::ajaxLink(Yii::t('checkout', 'Remove'), Yii::app()->createUrl('myaccount/removeaddress'), array('type' => 'POST', 'data' => array('CustomerAddressId' => $objAddress->id, 'YII_CSRF_TOKEN' => Yii::app()->request->csrfToken), 'success' => 'function(data) {
var addressBlock = $(this).parents(".address-block")[0];
$(addressBlock).remove();
}.bind(this)'), array('class' => 'delete'));
?>
</span>
</p>
<div class="buttons">
<?php
echo CHtml::htmlButton(Yii::t('checkout', $objAddress->id == $model->intShippingAddress ? 'Use shipping address' : 'Use this address'), array('type' => 'submit', 'class' => $objAddress->id == $model->intBillingAddress ? 'small default' : 'small', 'name' => 'BillingAddress', 'id' => 'BillingAddress', 'onclick' => '$("form").removeClass("error").end().find(".required").remove().end().find(".form-error").remove().end()', 'value' => $objAddress->id));
?>
</div>
</li>
<?php
}
?>
<?php
}
?>
<li class="add">
<?php
echo CHtml::link(Yii::t('checkout', 'Add New Address'), Yii::app()->createUrl('/checkout/newaddress', array('type' => 'billing')), array('class' => 'small button'));
?>
</li>
</ol>
示例10: array
?>
<div class="control-group">
<?php
echo $form->labelEx($model, 'type', array('class' => 'control-label'));
?>
<div class="controls">
<?php
$this->widget('zii.widgets.jui.CJuiAutoComplete', array('model' => $model, 'attribute' => 'type', 'value' => $this->createUrl('SParameter/TParameter'), 'source' => $this->createUrl('SParameter/TParameter'), 'options' => array('minLength' => '2'), 'htmlOptions' => array()));
?>
</div>
</div>
<?php
echo $form->textFieldRow($model, 'code');
?>
<?php
echo $form->textFieldRow($model, 'name', array('class' => 'span3'));
?>
<div class="form-actions">
<?php
echo CHtml::htmlButton($model->isNewRecord ? '<i class="icon-ok"></i> Create' : '<i class="icon-ok"></i> Save', array('class' => 'btn', 'type' => 'submit'));
?>
</div>
<?php
$this->endWidget();
示例11: run
/**
* (non-PHPdoc)
* @see framework/CWidget::run()
*/
public function run()
{
$cs = Yii::app()->getClientScript();
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->buttonType == 'buttonset') {
echo CHtml::closeTag($this->htmlTag);
$cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').buttonset();");
} else {
switch ($this->buttonType) {
case 'submit':
echo CHtml::submitButton($this->caption, $this->htmlOptions) . "\n";
break;
case 'button':
echo CHtml::htmlButton($this->caption, $this->htmlOptions) . "\n";
break;
case 'link':
echo CHtml::link($this->caption, $this->url, $this->htmlOptions) . "\n";
break;
case 'radio':
if ($this->hasModel()) {
echo CHtml::activeRadioButton($this->model, $this->attribute, $this->htmlOptions);
echo CHtml::label($this->caption, CHtml::activeId($this->model, $this->attribute)) . "\n";
} else {
echo CHtml::radioButton($name, $this->value, $this->htmlOptions);
echo CHtml::label($this->caption, $id) . "\n";
}
break;
case 'checkbox':
if ($this->hasModel()) {
echo CHtml::activeCheckbox($this->model, $this->attribute, $this->htmlOptions);
echo CHtml::label($this->caption, CHtml::activeId($this->model, $this->attribute)) . "\n";
} else {
echo CHtml::checkbox($name, $this->value, $this->htmlOptions);
echo CHtml::label($this->caption, $id) . "\n";
}
break;
default:
throw new CException(Yii::t('zii', 'The button type "{type}" is not supported.', array('{type}' => $this->buttonType)));
}
$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});");
}
}
}
示例12: checkCompletedQuota
//.........这里部分代码省略.........
}
if ($iMatchedAnswers == count($aQuotaFields)) {
switch ($aQuotaCompleted['action']) {
case '1':
default:
$aMatchedQuotas[] = $aQuotaCompleted;
break;
case '2':
if ($bPostedField) {
// Action 2 allow to correct last answers, then need to be posted
$aMatchedQuotas[] = $aQuotaCompleted;
}
break;
}
}
}
}
if ($return) {
return $aMatchedQuotas;
}
if (empty($aMatchedQuotas)) {
return;
}
// Now we have all the information we need about the quotas and their status.
// We need to construct the page and do all needed action
$aSurveyInfo = getSurveyInfo($surveyid, $_SESSION['survey_' . $surveyid]['s_lang']);
$sTemplatePath = getTemplatePath($aSurveyInfo['templatedir']);
$sClientToken = isset($_SESSION['survey_' . $surveyid]['token']) ? $_SESSION['survey_' . $surveyid]['token'] : "";
// {TOKEN} is take by $redata ...
// $redata for templatereplace
$aDataReplacement = array('thissurvey' => $aSurveyInfo, 'clienttoken' => $sClientToken, 'token' => $sClientToken);
// We take only the first matched quota, no need for each
$aMatchedQuota = $aMatchedQuotas[0];
// If a token is used then mark the token as completed, do it before event : this allow plugin to update token information
$event = new PluginEvent('afterSurveyQuota');
$event->set('surveyId', $surveyid);
$event->set('responseId', $_SESSION['survey_' . $surveyid]['srid']);
// We allways have a responseId
$event->set('aMatchedQuotas', $aMatchedQuotas);
// Give all the matched quota : the first is the active
App()->getPluginManager()->dispatchEvent($event);
$blocks = array();
foreach ($event->getAllContent() as $blockData) {
/* @var $blockData PluginEventContent */
$blocks[] = CHtml::tag('div', array('id' => $blockData->getCssId(), 'class' => $blockData->getCssClass()), $blockData->getContent());
}
// Allow plugin to update message, url, url description and action
$sMessage = $event->get('message', $aMatchedQuota['quotals_message']);
$sUrl = $event->get('url', $aMatchedQuota['quotals_url']);
$sUrlDescription = $event->get('urldescrip', $aMatchedQuota['quotals_urldescrip']);
$sAction = $event->get('action', $aMatchedQuota['action']);
$sAutoloadUrl = $event->get('autoloadurl', $aMatchedQuota['autoload_url']);
// Construct the default message
$sMessage = templatereplace($sMessage, array(), $aDataReplacement, 'QuotaMessage', $aSurveyInfo['anonymized'] != 'N', NULL, array(), true);
$sUrl = passthruReplace($sUrl, $aSurveyInfo);
$sUrl = templatereplace($sUrl, array(), $aDataReplacement, 'QuotaUrl', $aSurveyInfo['anonymized'] != 'N', NULL, array(), true);
$sUrlDescription = templatereplace($sUrlDescription, array(), $aDataReplacement, 'QuotaUrldescription', $aSurveyInfo['anonymized'] != 'N', NULL, array(), true);
// Doing the action and show the page
if ($sAction == "1" && $sClientToken) {
submittokens(true);
}
// Construction of default message inside quotamessage class
$quotaMessage = "<div class='quotamessage limesurveycore'>\n";
$quotaMessage .= "\t" . $sMessage . "\n";
if ($sUrl) {
$quotaMessage .= "<br /><br />\t<a href='" . $sUrl . "'>" . $sUrlDescription . "</a><br />\n";
}
// Add the navigator with Previous button if quota allow modification.
if ($sAction == "2") {
$sQuotaStep = isset($_SESSION['survey_' . $surveyid]['step']) ? $_SESSION['survey_' . $surveyid]['step'] : 0;
// Surely not needed
$sNavigator = CHtml::htmlButton(gT("Previous"), array('type' => 'submit', 'id' => "moveprevbtn", 'value' => $sQuotaStep, 'name' => 'move', 'accesskey' => 'p', 'class' => "submit button"));
$quotaMessage .= CHtml::form(array("/survey/index"), 'post', array('id' => 'limesurvey', 'name' => 'limesurvey'));
$quotaMessage .= templatereplace(file_get_contents($sTemplatePath . "/navigator.pstpl"), array('NAVIGATOR' => $sNavigator, 'SAVE' => ''), $aDataReplacement);
$quotaMessage .= CHtml::hiddenField('sid', $surveyid);
$quotaMessage .= CHtml::hiddenField('token', $sClientToken);
// Did we really need it ?
$quotaMessage .= CHtml::endForm();
}
$quotaMessage .= "</div>\n";
// Add the plugin message before default message
$quotaMessage = implode("\n", $blocks) . "\n" . $quotaMessage;
// Send page to user and end.
sendCacheHeaders();
if ($sAutoloadUrl == 1 && $sUrl != "") {
if ($sAction == "1") {
killSurveySession($surveyid);
}
header("Location: " . $sUrl);
}
doHeader();
echo templatereplace(file_get_contents($sTemplatePath . "/startpage.pstpl"), array(), $aDataReplacement);
echo $quotaMessage;
echo templatereplace(file_get_contents($sTemplatePath . "/endpage.pstpl"), array(), $aDataReplacement);
doFooter();
if ($sAction == "1") {
killSurveySession($surveyid);
}
Yii::app()->end();
}
示例13: checkCompletedQuota
//.........这里部分代码省略.........
}
// Condition to count quota : Answers are the same in quota + an answer is submitted at this time (bPostedField) OR all questions is hidden (bAllHidden)
$bAllHidden = QuestionAttribute::model()->countByAttributes(array('qid' => $aQuotaQid), 'attribute=:attribute', array(':attribute' => 'hidden')) == count($aQuotaQid);
if ($iMatchedAnswers == count($aQuotaFields) && ($bPostedField || $bAllHidden)) {
if ($aQuotaInfo['qlimit'] == 0) {
// Always add the quota if qlimit==0
$aMatchedQuotas[] = $aQuotaInfo;
} else {
$iCompleted = getQuotaCompletedCount($surveyid, $aQuotaInfo['id']);
if (!is_null($iCompleted) && (int) $iCompleted >= (int) $aQuotaInfo['qlimit']) {
// This remove invalid quota and not completed
$aMatchedQuotas[] = $aQuotaInfo;
}
}
}
}
}
if ($return) {
return $aMatchedQuotas;
}
if (empty($aMatchedQuotas)) {
return;
}
// Now we have all the information we need about the quotas and their status.
// We need to construct the page and do all needed action
$aSurveyInfo = getSurveyInfo($surveyid, $_SESSION['survey_' . $surveyid]['s_lang']);
$oTemplate = Template::model()->getInstance('', $surveyid);
$sTemplatePath = $oTemplate->path;
$sTemplateViewPath = $oTemplate->viewPath;
$sClientToken = isset($_SESSION['survey_' . $surveyid]['token']) ? $_SESSION['survey_' . $surveyid]['token'] : "";
// $redata for templatereplace
$aDataReplacement = array('thissurvey' => $aSurveyInfo, 'clienttoken' => $sClientToken, 'token' => $sClientToken);
// We take only the first matched quota, no need for each
$aMatchedQuota = $aMatchedQuotas[0];
// If a token is used then mark the token as completed, do it before event : this allow plugin to update token information
$event = new PluginEvent('afterSurveyQuota');
$event->set('surveyId', $surveyid);
$event->set('responseId', $_SESSION['survey_' . $surveyid]['srid']);
// We allways have a responseId
$event->set('aMatchedQuotas', $aMatchedQuotas);
// Give all the matched quota : the first is the active
App()->getPluginManager()->dispatchEvent($event);
$blocks = array();
foreach ($event->getAllContent() as $blockData) {
/* @var $blockData PluginEventContent */
$blocks[] = CHtml::tag('div', array('id' => $blockData->getCssId(), 'class' => $blockData->getCssClass()), $blockData->getContent());
}
// Allow plugin to update message, url, url description and action
$sMessage = $event->get('message', $aMatchedQuota['quotals_message']);
$sUrl = $event->get('url', $aMatchedQuota['quotals_url']);
$sUrlDescription = $event->get('urldescrip', $aMatchedQuota['quotals_urldescrip']);
$sAction = $event->get('action', $aMatchedQuota['action']);
$sAutoloadUrl = $event->get('autoloadurl', $aMatchedQuota['autoload_url']);
// Doing the action and show the page
if ($sAction == "1" && $sClientToken) {
submittokens(true);
}
// Construct the default message
$sMessage = templatereplace($sMessage, array(), $aDataReplacement, 'QuotaMessage', $aSurveyInfo['anonymized'] != 'N', NULL, array(), true);
$sUrl = passthruReplace($sUrl, $aSurveyInfo);
$sUrl = templatereplace($sUrl, array(), $aDataReplacement, 'QuotaUrl', $aSurveyInfo['anonymized'] != 'N', NULL, array(), true);
$sUrlDescription = templatereplace($sUrlDescription, array(), $aDataReplacement, 'QuotaUrldescription', $aSurveyInfo['anonymized'] != 'N', NULL, array(), true);
// Construction of default message inside quotamessage class
$sHtmlQuotaMessage = "<div class='quotamessage limesurveycore'>\n";
$sHtmlQuotaMessage .= "\t" . $sMessage . "\n";
$sHtmlQuotaUrl = $sUrl ? "<a href='" . $sUrl . "'>" . $sUrlDescription . "</a>" : "";
// Add the navigator with Previous button if quota allow modification.
if ($sAction == "2") {
$sQuotaStep = isset($_SESSION['survey_' . $surveyid]['step']) ? $_SESSION['survey_' . $surveyid]['step'] : 0;
// Surely not needed
$sNavigator = CHtml::htmlButton(gT("Previous"), array('type' => 'submit', 'id' => "moveprevbtn", 'value' => $sQuotaStep, 'name' => 'move', 'accesskey' => 'p', 'class' => "submit button btn btn-default"));
//$sNavigator .= " ".CHtml::htmlButton(gT("Submit"),array('type'=>'submit','id'=>"movesubmit",'value'=>"movesubmit",'name'=>"movesubmit",'accesskey'=>'l','class'=>"submit button"));
$sHtmlQuotaMessage .= CHtml::form(array("/survey/index", "sid" => $surveyid), 'post', array('id' => 'limesurvey', 'name' => 'limesurvey', 'class' => 'survey-form-container QuotaMessage'));
$sHtmlQuotaMessage .= templatereplace(file_get_contents($sTemplateViewPath . "/navigator.pstpl"), array('NAVIGATOR' => $sNavigator, 'SAVE' => ''), $aDataReplacement);
$sHtmlQuotaMessage .= CHtml::hiddenField('sid', $surveyid);
$sHtmlQuotaMessage .= CHtml::hiddenField('token', $sClientToken);
// Did we really need it ?
$sHtmlQuotaMessage .= CHtml::endForm();
}
$sHtmlQuotaMessage .= "</div>\n";
// Add the plugin message before default message
$sHtmlQuotaMessage = implode("\n", $blocks) . "\n" . $sHtmlQuotaMessage;
// Send page to user and end.
sendCacheHeaders();
if ($sAutoloadUrl == 1 && $sUrl != "") {
if ($sAction == "1") {
killSurveySession($surveyid);
}
header("Location: " . $sUrl);
}
doHeader();
echo templatereplace(file_get_contents($sTemplateViewPath . "/startpage.pstpl"), array(), $aDataReplacement);
echo templatereplace(file_get_contents($sTemplateViewPath . "/completed.pstpl"), array("COMPLETED" => $sHtmlQuotaMessage, "URL" => $sHtmlQuotaUrl), $aDataReplacement);
echo templatereplace(file_get_contents($sTemplateViewPath . "/endpage.pstpl"), array(), $aDataReplacement);
doFooter();
if ($sAction == "1") {
killSurveySession($surveyid);
}
Yii::app()->end();
}
示例14: array
<div class="controls <?php
echo $model->isAttributeRequired('repetir_contrasena') ? 'required' : '';
?>
">
<?php
echo $form->passwordField($model, 'repetir_contrasena', array('placeholder' => '••••••••', 'disabled' => true));
?>
<?php
echo $form->error($model, 'repetir_contrasena');
?>
</div>
</div>
<div class="row buttons" style="display:none;">
<?php
echo CHtml::ajaxSubmitButton("Guardar nueva contraseña", array('/usuario/perfil/cambiarclave'), array('success' => 'cambio_clave'), array('id' => 'btn-guardar-contrasena'));
echo CHtml::htmlButton('Cancelar', array('id' => 'btn-cancelar-contrasena'));
?>
</div>
</fieldset>
<fieldset>
<legend>Datos personales</legend>
<div class="control-group">
<?php
echo CHtml::label('Nombre completo', 'nombres', array('class' => 'control-label'));
?>
<div class="controls <?php
echo $model->isAttributeRequired('nombres') ? 'required' : '';
?>
">
<?php
echo $form->textField($model, 'nombres', array('placeholder' => 'Nombres'));
示例15: array
<div class="row">
<?php
echo $form->labelEx($formRelationModel, 'name');
?>
<?php
echo $form->dropDownList($formRelationModel, 'attributeId', $attributesArray, array('id' => 'attributeId', 'selected' => isset($attributesArray['name']) ? $attributesArray['name'] : ""));
?>
<?php
echo $form->error($formRelationModel, 'subFormId');
?>
</div>
<div class="row">
<?php
echo $form->labelEx($formRelationModel, 'inputName');
?>
<?php
echo $form->dropDownList($formRelationModel, 'subFormId', $surformDetailsArray, array('id' => 'subFormId', 'selected' => isset($surformDetailsArray['inputName']) ? $surformDetailsArray['inputName'] : ""));
?>
<?php
echo $form->error($formRelationModel, 'subFormId');
?>
</div>
<div class="row buttons">
<?php
echo CHtml::htmlButton($buttonText, array('id' => 'save', 'type' => 'submit'));
?>
</div>
<?php
$this->endWidget();
?>
</div>