/** * @param array $options * @return string */ public function formButton($options = array()) { $form = CHtml::beginForm($this->url(), 'get'); $form .= CHtml::hiddenField('business', $this->business); foreach (CMap::mergeArray($this->defaultOptions, $options) as $k => $v) { $form .= CHtml::hiddenField($k, $v); } $form .= CHtml::imageButton($this->image, array('border' => 0, 'alt' => $this->imageAltText)); $form .= CHtml::endForm(); return $form; }
protected function renderContent() { if (Yii::app()->user->getIsGuest()) { return; } // check admin privileges $isAdmin = (bool) Yii::app()->user->getState('isAdmin'); if (!$isAdmin) { return; } // create you own users list $users = array('1' => 'admin', '2' => 'demo1', '4' => 'demo2', '5' => 'demo3', '9' => 'demo4'); echo CHtml::beginForm(); echo '<br>'; echo CHtml::dropDownList("currentUser", $this->userId, $users); echo ' '; echo CHtml::submitButton(Yii::t('CalModule.fullCal', 'OK')); echo CHtml::endForm(); echo '<br>'; }
unsent messages')); } else { ?> <?php echo CHtml::link('Show all messages', $url = CHtml::normalizeUrl(array('message/toggle', 'all' => 'true')), array('submit' => $url, 'title' => 'Show sent and unsent messages')); } ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php echo CHtml::beginForm('', 'post', array('id' => 'message-form')); $this->widget('zii.widgets.grid.CGridView', array('id' => 'message-grid', 'dataProvider' => $model->search(), 'selectableRows' => 2, 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'student', 'subject', array('name' => 'body', 'header' => 'Body (plaintext)', 'type' => 'raw', 'value' => array($this, 'RenderBody')), array('name' => 'html', 'header' => 'Body (html)', 'type' => 'raw', 'value' => array($this, 'RenderHtml')), array('name' => 'confirmed_at', 'header' => 'Confirmed'), array('name' => 'sent_at', 'header' => 'Sent'), array('name' => 'seen_at', 'header' => 'Seen'), array('name' => 'acknowledged_at', 'header' => 'Acknowledged', 'type' => 'raw', 'value' => '$data->getAcknowledgedDescription()'), array('class' => 'CButtonColumn'), array('class' => 'CCheckBoxColumn', 'id' => 'id', 'value' => '$data->id')))); echo CHtml::endForm(); ?> <p> <?php echo 'With the selected messages, do the following:'; $this->widget('ext.widgets.bmenu.XBatchMenu', array('formId' => 'message-form', 'checkBoxId' => 'id', 'emptyText' => 'Please select the messages you would like to perform this action on!', 'items' => array(array('label' => 'confirm', 'url' => array('message/confirm'))), 'htmlOptions' => array('class' => 'actionBar'), 'containerTag' => 'span')); ?> </p> <hr /> <p><?php echo CHtml::link('Send confirmed messages', array('send')); ?>
public function run() { //begin form echo CHtml::beginForm($this->action, $this->method, array('id' => $this->id, 'enctype' => $this->enctype, 'class' => $this->class)); foreach ($this->model as $item) { if ($this->selector) { echo CHtml::checkBox('selector_' . $item['key']); } $name = Awecms::generateFriendlyName($item["key"]); ?> <div class="settings row"> <?php echo $this->getlabel($item['key']); switch ($item['type']) { //add new types here case 'textfield': echo $this->getFullTextField($item); break; case 'boolean': echo CHtml::hiddenField($item['key'], 0); echo CHtml::checkBox($item['key'], $item['value']); break; case 'image_url': echo $this->getFullTextField($item); echo "<a class=\"right\" href=\"{$item["value"]}\" target=\"_blank\"><img src=\"{$item["value"]}\" title=\"{$name}\" alt=\"{$name}\" /></a>"; break; case 'email': echo $this->getFullTextField($item); break; case 'textarea': echo CHtml::textArea($item['key'], $item['value']); case 'NULL': break; default: echo "Unsupported type: " . $item['type'] . " of " . $item['key'] . " with value " . $item['value'] . "<br/>"; break; } if (isset($item['hint'])) { ?> <p class="hint"> <?php echo $item['hint']; ?> </p> <?php } ?> </div> <?php } ?> <div class="row buttons"> <?php echo CHtml::submitButton('Submit!'); ?> </div> <?php echo CHtml::endForm(); }
/** * @dataProvider providerBeginForm * * @param string $action * @param string $method * @param array $htmlOptions * @param string $assertion */ public function testBeginForm($action, $method, $htmlOptions, $assertion) { /* TODO - Steven Wexler - 3/5/11 - Mock out static methods in this function when CHtml leverages late static method binding * because PHPUnit. This is only possible Yii supports only >= PHP 5.3 - */ $this->assertEquals($assertion, CHtml::beginForm($action, $method, $htmlOptions)); $this->assertEquals($assertion, CHtml::form($action, $method, $htmlOptions)); }
function form($name, $label, $action, $dis = array()) { echo CHtml::beginForm('', 'POST'); echo CHtml::submitButton($label, $dis + array('style' => 'float: left')); echo CHtml::hiddenField('action', $action); echo CHtml::hiddenField('name', $name); echo CHtml::endForm(); }
/** * Generates the required HTML and Javascript */ public function run() { //echo 'Chức năng upload file tạm thời Off để bảo trì, liên hệ trangptk@vega.com.vn'; list($name, $id) = $this->resolveNameID(); $model = $this->model; if (!isset($this->options['uploadTable'])) { $uploadTable = "files"; $this->options['uploadTable'] = "#files"; } else { $uploadTable = $this->options['uploadTable']; $this->options['uploadTable'] = "#{$uploadTable}"; } if (!isset($this->options['downloadTable'])) { $downloadTable = "files"; $this->options['downloadTable'] = "#files"; } else { $downloadTable = $this->options['downloadTable']; $this->options['downloadTable'] = "#{$downloadTable}"; } if (!isset($this->options['buildUploadRow'])) { $this->options['buildUploadRow'] = $this->_getBuildUploadRow(); } if (!isset($this->options['buildDownloadRow'])) { $this->options['buildDownloadRow'] = $this->_getBuildDownloadRow(); } if (!isset($this->htmlOptions['enctype'])) { $this->htmlOptions['enctype'] = 'multipart/form-data'; } if (!isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] = 'xupload-form file_upload'; } if (!isset($this->htmlOptions['id'])) { $this->htmlOptions['id'] = get_class($model) . "_form"; } $options = CJavaScript::encode($this->options); CVarDumper::dumpAsString($options, 10, true); Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $this->htmlOptions['id'], "jQuery('#{$this->htmlOptions['id']}').fileUploadUI({$options});", CClientScript::POS_READY); //echo "<pre>";print_r($options);exit(); echo CHtml::beginForm($this->url, 'post', $this->htmlOptions); $htmlOptions = array(); if ($this->multiple) { $htmlOptions["multiple"] = true; } if ($this->hasModel()) { echo CHtml::activeFileField($this->model, $this->attribute, $htmlOptions); } else { echo CHtml::fileField($name, $this->value, $htmlOptions); } echo CHtml::tag("button", array(), "Upload", true); echo CHtml::tag("div", array(), $this->text, true); echo CHtml::endForm(); if ($uploadTable == $downloadTable) { echo CHtml::tag("table", array("id" => $uploadTable), "", true); } else { echo CHtml::tag("table", array("id" => $uploadTable), "", true); echo CHtml::tag("table", array("id" => $downloadTable), "", true); } }
public static function beginForm($action = '', $method = 'post', $htmlOptions = array()) { if (isset($htmlOptions['class'])) { $htmlOptions['class'] = $htmlOptions['class'] . ' uniForm'; } else { $htmlOptions['class'] = 'uniForm'; } return parent::beginForm($action, $method, $htmlOptions); }
* * Besides the wrapper methods, CActiveForm also implements an important feature * known as AJAX validation. This feature may be turned on setting {@link enableAjaxValidation} * to be true. When the user enters some value in an input field, the AJAX validation * feature would trigger an AJAX request to the server to call for validating the model * with the current user inputs. If there are any validation errors, the corresponding * error messages will show up next to the input fields immediately. * * The AJAX validation feature may greatly improve the user experience at entering * data into a form. Because the validation is done on the server side using the rules
public function headEnableAjax() { echo CHtml::beginForm(); echo CHtml::openTag('label', array('class' => 'checkbox pull-right', 'style' => 'margin:5px 10px 0px 0px;', 'for' => 'ajaxUpdate')); echo "Aktifkan mode Ajax "; echo CHtml::Checkbox('ajaxUpdate', Yii::app()->user->getState('ajaxUpdate', true), array('uncheckValue' => 0, 'onclick' => "this.form.submit();")); echo CHtml::closetag("label"); echo CHtml::endForm(); }
public function run() { $placeholder = $this->type ? Yii::t('app', 'Search') . ' ' . ucfirst($this->type) . '...' : Yii::t('app', 'Search') . '...'; echo CHtml::beginForm(array('/search/' . $this->type), 'get', array('class' => 'search-form')); echo CHtml::textField('q', $this->query, array('placeholder' => $placeholder)); if ($this->query != '') { echo CHtml::submitButton('Search!', array('name' => '')); } echo CHtml::endForm(''); }
public function run() { echo CHtml::beginForm('', 'post', array('id' => $this->htmlOptions['id'] . '-form')); echo CHtml::button($this->inputButtonLabel, array('onclick' => "jQuery(\"#{$this->htmlOptions['id']}\").jsoneditor('input')")); echo CHtml::button($this->initButtonLabel, array('onclick' => "jQuery(\"#{$this->htmlOptions['id']}\").jsoneditor('init')")); echo CHtml::submitButton($this->submitButtonLabel, array('name' => $this->htmlOptions['id'] . '-save')); echo CHtml::tag('div', $this->htmlOptions); echo CHtml::hiddenField($this->htmlOptions['id'] . '-json', '', array()); echo CHtml::endForm(); }
public function beginForm() { if ($this->form) { echo CHtml::beginForm($this->action, $this->method, $this->formHtmlOptions); } else { echo CHtml::openTag('div', array('class' => 'settingswidget', 'id' => $this->getId())); } if (isset($this->title)) { echo CHtml::tag('legend', array(), $this->title); } }
public function renderCsvButton() { echo CHtml::beginForm(array('//user/csv/select')); foreach ($this->columns as $column) { if (isset($column->name)) { echo CHtml::hiddenField($column->name, $column->value); } } printf('<td>%s</td>', CHtml::submitButton('CSV')); echo CHtml::endForm(); }
public function beginForm() { if ($this->form) { echo CHtml::beginForm($this->action, $this->method, $this->formHtmlOptions); } else { $this->fieldHtmlOptions = array_replace($this->formHtmlOptions, $this->fieldHtmlOptions); } echo CHtml::openTag('fieldset', array_replace($this->fieldHtmlOptions, array('id' => $this->getId()))); if (isset($this->title)) { echo CHtml::tag('legend', array(), $this->title); } }
public function sortOrder($model, $ID) { $sortModel = $this->loadModelWidget($ID); echo CHtml::beginForm(); $sort = array(); for ($i = 1; $i <= count($model); $i++) { $sort[$i] = $i; } echo CHtml::hiddenField('WidgetSortID', $ID); echo CHtml::dropDownList('WidgetSortOrder', $sortModel->sort, $sort, array('class' => 'span4 pull-right', 'prompt' => '-Sort Order-', 'style' => 'margin-top:-40px;', 'onchange' => "this.form.submit();")); echo CHtml::endForm(); echo "<br>"; }
/** * */ public function run() { /** @var AccountModule $account */ $account = Yii::app()->getModule('account'); $cs = Yii::app()->getClientScript(); $assetsUrl = $account->getAssetsUrl() . '/hybridAuth'; $cs->registerCoreScript('jquery'); $cs->registerCoreScript('jquery.ui'); $cs->registerCssFile($cs->getCoreScriptUrl() . '/jui/css/base/jquery-ui.css'); $cs->registerScriptFile($assetsUrl . '/script.js'); $cs->registerCssFile($assetsUrl . '/styles.css'); $cs->registerCssFile($assetsUrl . '/zocial/css/zocial.css'); $providers = $account->hybridAuthConfig['providers']; echo '<div id="hybridauth-openid-div">'; echo '<p>' . Yii::t('account', 'Enter your OpenID identity or provider:') . '</p>'; echo CHtml::beginForm(Yii::app()->createUrl($this->baseUrl, array('returnUrl' => Yii::app()->returnUrl->getLinkValue(true))), 'get', array('id' => 'hybridauth-openid-form')); echo CHtml::hiddenField('provider', 'openid'); echo CHtml::textField('openid_identifier'); echo CHtml::endForm(); echo '</div>'; echo '<div id="hybridauth-confirm-unlink">'; echo '<p>' . Yii::t('account', 'Are you sure you want to unlink this provider?') . '</p>'; echo CHtml::beginForm(Yii::app()->createUrl($this->baseUrl, array('action' => 'unlink', 'returnUrl' => Yii::app()->returnUrl->getLinkValue(true))), 'post', array('id' => 'hybridauth-unlink-form')); echo CHtml::hiddenField('provider', '', array('id' => 'hybridauth-unlink-provider')); echo CHtml::endForm(); echo '</div>'; echo '<ul id="hybridauth-provider-list">'; foreach ($providers as $provider => $settings) { if ($settings['enabled'] == true) { echo '<li>'; echo CHtml::link(Yii::t('account', isset($settings['name']) ? $settings['name'] : $provider), array($this->baseUrl, 'provider' => $provider, 'returnUrl' => Yii::app()->returnUrl->getLinkValue(true)), array('id' => 'hybridauth-provider-' . strtolower($provider), 'class' => 'zocial ' . strtolower($provider))); echo '</li>'; } } echo '</ul>'; if (!Yii::app()->user->isGuest) { $userHybridAuths = CActiveRecord::model($account->userHybridAuthClass)->findAllByAttributes(array($account->userIdField => Yii::app()->user->id)); if ($userHybridAuths) { echo '<h4>' . Yii::t('account', 'Linked Services') . '</h4>'; echo '<ul id="hybridauth-account-list">'; /** @var AccountUserHybridAuth[] $userHybridAuths */ foreach ($userHybridAuths as $userHybridAuth) { $provider = $userHybridAuth->{$account->providerField}; echo '<li>'; echo CHtml::link($userHybridAuth->{$account->emailField}, 'javascript:void(0);', array('id' => 'hybridauth-account-' . strtolower($provider), 'class' => 'zocial ' . strtolower($provider))); echo '</li>'; } echo '</ul>'; } } }
public function actionIndex($path = '/') { $fsw = new FilesystemWrapper('/home/rosko/WWW/hosts/test/public_html/test/', array('baseUrl' => 'http://test/test/')); $fsw->filter = array('excludeHidden' => true); $fsw->sort = array('directoriesFirst' => true); if ($fsw) { echo CHtml::beginForm('', 'post', array('enctype' => 'multipart/form-data')); echo CHtml::fileField('file'); echo CHtml::submitButton(); echo CHtml::endForm(); if (CUploadedFile::getInstanceByName('file')) { echo $fsw->uploadFile('/', 'file', true, 'upload.jpg'); } //echo $fsw->delete('/mydir.txt'); //print_r ($fsw->createFile('/', 'mydir.txt', 'sdfsdfsвавів')); print_r($fsw->getDirectory($path)); } }
public function actionAdd() { if (isset($_POST['alias']) && isset($_POST['catPk'])) { $model = $this->loadModel(); $model->category_id = $_POST['catPk']; $model->alias = $_POST['alias']; $model->save(); $this->renderPartial('item', array('model'=>$model)); } else { echo CHtml::beginForm(); echo CHtml::hiddenField('catPk', $_GET['catPk']); echo '<p>Название</p>'; echo CHtml::textField('alias'); echo CHtml::submitButton('Готово'); echo CHtml::endForm(); } }
<small><?php echo Yii::t('YupeModule.yupe', 'version'); ?> <?php echo CHtml::encode($module->version); ?> </small> </h1> <br/> <?php if (is_array($groups) && count($groups)) { ?> <?php echo CHtml::beginForm(['/yupe/backend/saveModulesettings'], 'post', ['class' => 'well']); ?> <?php echo CHtml::hiddenField('module_id', $module->getId()); ?> <div class="row"> <div class="col-sm-8"> <?php $collapse = $this->beginWidget('booster.widgets.TbCollapse'); ?> <?php $i = 0; ?> <?php foreach ((array) $groups as $title => $items) { ?>
echo Yii::app()->user->getFlash('loginMessage'); ?> </div> <?php } ?> <p><?php echo Yii::t("UserModule.user", "Please fill out the following form with your login credentials:"); ?> </p> <div class="form"> <?php echo CHtml::beginForm(); ?> <p class="note"><?php echo Yii::t("UserModule.user", 'Fields with <span class="required">*</span> are required.'); ?> </p> <?php echo CHtml::errorSummary($model); ?> <div class="row"> <?php echo CHtml::activeLabelEx($model, 'username'); ?>
public function getStatus($data, $status, $column, $link) { if ($status == 1) { echo CHtml::beginForm(Yii::app()->controller->id . '/' . $link . '/' . $data); echo '<button class="status-btn" type="submit"> <img src="' . Yii::app()->getTemplate('backend') . 'images/accept.png" alt="' . Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'Active') . '" title="' . Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'Active') . '"/></button> <input type="hidden" value="0" name="' . $column . '"/>'; echo CHtml::endForm(); } else { echo CHtml::beginForm(Yii::app()->controller->id . '/' . $link . '/' . $data); echo '<button class="status-btn" type="submit"> <img src="' . Yii::app()->getTemplate('backend') . 'images/exclamation.png" alt="' . Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'Not Active') . '" title="' . Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'Not active') . '"/> </button> <input type="hidden" value="1" name="' . $column . '"/>'; echo CHtml::endForm(); } }
<div class='width998 content'> <?php include 'tabs_active.php'; ?> <div> <!-- 经销商 --> <div id="tab1" class="form-list"> <?php echo CHtml::beginForm('index', 'get', array('id' => "querymake")); ?> <div style="height:80px; margin-top:10px;"> <div class="edf"> <div class="ccc"> <div class="aaa"><label>经营品牌:</label></div> <div style="float:left;"> <?php echo CHtml::textField('keywords', $search['keywords'], array('class' => 'width260 input', 'func' => 's')); ?> </div> <div style="clear:both"></div> </div> <div class="ccc"> <div class="aaa"><label>地区:</label></div> <div style="float:left"> <?php $province_data = Area::model()->findAll("grade=:grade", array(":grade" => 1)); $province = CHtml::listData($province_data, "id", "name"); ?> <?php
</div> <?php if ($result != '') { ?> <div class="row-fluid"> <div class="span12"> <?php echo $result; ?> </div> </div> <?php } else { ?> <?php echo CHtml::beginForm('import', 'post', array('enctype' => 'multipart/form-data')); ?> <div class="row-fluid"> <div class="span5"><?php echo CHtml::label(Yii::t('admin', 'Choose your .csv file (Max size: {max}):', array('{max}' => ini_get('upload_max_filesize'))), 'csv_file'); ?> </div> <div class="span5"><?php echo CHtml::fileField('csv_file', '', array('id' => 'csv_file')); ?> </div> </div> <div class="row-fluid"> <div class="span5"><span>Folder Import<span style="font-size:11px;color:#ff0000"> (import images need to upload into this folder)</span></span></div> <div class="span5"><input type="text" name="dirimg" id="dirimg" value="/images/import/" /></div> </div>
<div class="container_12 mgb"> <div class="grid_12"> <div class="crumb"><a href="<?php echo Yii::app()->theme->baseUrl; ?> "><i class="icon-home"></i>首页</a> <i class="icon-double-angle-right"></i>密码重置 </div> </div> </div> <div class="container_12 mgb"> <div class="grid_9 bg_white"> <div class="p20"> <?php echo CHtml::beginForm('index.php?r=site/resetpassword', null, array('name' => 'form_resetpassword', 'id' => 'form_resetpassword')); ?> <input type="hidden" name="YII_CSRF_TOKEN" value="<?php echo Yii::app()->request->csrfToken; ?> " /> <input type="hidden" name="code" value="<?php echo $code; ?> "/> <table class="form"> <tr> <td class="col1">密码<span class="red">*</span></td> <td><input class="control validate[required]" name="loginpass" id="loginpass" type="password" autocomplete="off" /></td> </tr> <tr>
<div class="checkout_head_general"> <span class="checkout_title">Pay Online</span> <div class="clear"></div> </div> <?php echo CHtml::beginForm('https://www.globalpay.com.ng/Paymentgatewaycapture.aspx', 'POST'); ?> <div class="section_body_general"> <div class="checkout_wrapper"> <?php echo CHtml::image(Yii::app()->request->baseUrl . '/img/globalpay1.png'); ?> <?php $order = Order::model()->findByPk($orderID); if (!empty($order)) { ?> <h5>Transaction ID: <?php echo $ref; ?> </h5> <h5>Name: <?php echo $order->firstname . ' ' . $order->lastname; ?> </h5> <h5>Total Amount Due: <?php echo UtilityHelper::formatPrice($total); ?> </h5>
* @var $this CategoryController * @var $model AlbumCategory * @var $form CActiveForm * version: 0.1.4 * * @author Putra Sudaryanto <*****@*****.**> * @copyright Copyright (c) 2016 Ommu Platform (ommu.co) * @created date 26 August 2016, 23:10 WIB * @link https://github.com/oMMu/Ommu-Photo-Albums * @contect (+62)856-299-4114 * */ ?> <?php echo CHtml::beginForm(Yii::app()->createUrl($this->route), 'get', array('name' => 'gridoption')); $columns = array(); $exception = array('id'); foreach ($model->metaData->columns as $key => $val) { if (!in_array($key, $exception)) { $columns[$key] = $key; } } ?> <ul> <?php foreach ($columns as $val) { ?> <li> <?php echo CHtml::checkBox('GridColumn[' . $val . ']');
<!--<div id="link_hide" style="display: none;"> <?php echo Chtml::link(Yii::t('app', 'Отмена'), 'javascript: void(0)', array('onClick' => 'hidePhoto()', 'class' => 'btn red')); ?> </div>--> </div> </div> </div> </div> <?php } ?> <?php echo CHtml::beginForm(NULL, 'POST', array('enctype' => 'multipart/form-data')); ?> <div class="form-body"> <?php if (Yii::app()->isModuleInstall('Attachment', '1.0.5') && !(bool) $is_attached) { ?> <div class="form-group"> <?php echo CHtml::activeLabelEx($model, 'attachment__id', array('class' => 'col-md-3 control-label')); ?> </td> <div class="col-md-9"> <div class="input-group choose-file input-large"> <input type="text" class="form-control file-path" readonly /> <?php echo CHtml::fileField('slidebar', null, array('class' => 'hidden', 'accept' => 'image/*'));
// find out the dimensions of the user-uploaded logo so the menu can do its layout calculations $logoOptions = array(); if(is_file(Yii::app()->params->logo)){ $logoSize = @getimagesize(Yii::app()->params->logo); if($logoSize) $logoSize = array(min($logoSize[0], 200), min($logoSize[1], 30)); else $logoSize = array(92, 30); $logoOptions['width'] = $logoSize[0]; $logoOptions['height'] = $logoSize[1]; }*/ /* Construction of the user menu */ $notifCount = X2Model::model('Notification')->countByAttributes(array('user' => Yii::app()->user->getName()), 'createDate < ' . time()); $searchbarHtml = CHtml::beginForm(array('/search/search'), 'get') . '<button class="x2-button black" type="submit"><span></span></button>' . CHtml::textField('term', Yii::t('app', 'Search for contact, action, deal...'), array('id' => 'search-bar-box', 'onfocus' => 'x2.forms.toggleTextResponsive(this);', 'onblur' => 'x2.forms.toggleTextResponsive(this);', 'data-short-default-text' => Yii::t('app', 'Search'), 'data-long-default-text' => Yii::t('app', 'Search for contact, action, deal...'), 'autocomplete' => 'off')) . '</form>'; if (!empty($profile->avatar) && file_exists($profile->avatar)) { $avatar = Profile::renderAvatarImage($profile->id, 25, 25); } else { $avatar = X2Html::defaultAvatar(25); } $widgetsImageUrl = $themeUrl . '/images/admin_settings.png'; if (!Yii::app()->user->isGuest) { $widgetMenu = $profile->getWidgetMenu(); } else { $widgetMenu = ""; } $userMenu = array(array('label' => Yii::t('app', 'Admin'), 'url' => array('/admin/index'), 'active' => $module == 'admin' ? true : null, 'visible' => $isAdmin, 'itemOptions' => array('id' => 'admin-user-menu-link', 'class' => 'user-menu-link ' . ($isAdmin ? 'x2-first' : ''))), array('label' => Yii::t('app', 'Profile'), 'url' => array('/profile/view', 'id' => Yii::app()->user->getId()), 'itemOptions' => array('id' => 'profile-user-menu-link', 'class' => 'user-menu-link ' . ($isAdmin ? '' : 'x2-first'))), array('label' => Yii::t('app', 'Users'), 'url' => array('/users/users/admin'), 'visible' => $isAdmin, 'itemOptions' => array('id' => 'admin-users-user-menu-link', 'class' => 'user-menu-link')), array('label' => Yii::t('app', 'Users'), 'url' => array('/profile/profiles'), 'visible' => !$isAdmin, 'itemOptions' => array('id' => 'non-admin-users-user-menu-link', 'class' => 'user-menu-link')), array('label' => $searchbarHtml, 'itemOptions' => array('id' => 'search-bar', 'class' => 'special'))); $userMenuItems = array(array('label' => Yii::t('app', 'Profile'), 'url' => array('/profile/view', 'id' => Yii::app()->user->getId())), array('label' => Yii::t('app', 'Notifications'), 'url' => array('/site/viewNotifications')), array('label' => Yii::t('app', 'Preferences'), 'url' => array('/profile/settings')), array('label' => Yii::t('profile', 'Manage Apps'), 'url' => array('/profile/manageCredentials')), array('label' => Yii::t('help', 'Icon Reference'), 'url' => array('/site/page', 'view' => 'iconreference')), array('label' => Yii::t('help', 'Help'), 'url' => 'http://www.x2crm.com/reference_guide', 'linkOptions' => array('target' => '_blank')), array('label' => Yii::t('app', 'Report A Bug'), 'url' => array('/site/bugReport')), array('label' => Yii::t('app', '---'), 'itemOptions' => array('class' => 'divider')), array('label' => Yii::app()->params->sessionStatus ? Yii::t('app', 'Go Invisible') : Yii::t('app', 'Go Visible'), 'url' => '#', 'linkOptions' => array('submit' => array('/site/toggleVisibility', 'visible' => !Yii::app()->params->sessionStatus, 'redirect' => Yii::app()->request->requestUri), 'csrf' => true, 'confirm' => 'Are you sure you want to toggle your session status?')), array('label' => Yii::t('app', 'Logout'), 'url' => array('/site/logout'))); if (!$isGuest) { $userMenu2 = array(array('label' => CHtml::link('<span>' . $notifCount . '</span>', '#', array('id' => 'main-menu-notif', 'style' => 'z-index:999;')), 'itemOptions' => array('class' => 'special')), array('label' => CHtml::link('<i class="fa fa-lg fa-toggle-right"></i>', '#', array('class' => 'x2-button', 'id' => 'fullscreen-button', 'title' => Yii::t('app', 'toggle widgets'))), 'itemOptions' => array('class' => 'search-bar special')), array('label' => CHtml::link('<div class="widget-icon"><i class="fa fa-lg fa-cog"></i></div>', '#', array('id' => 'widget-button', 'class' => 'x2-button', 'title' => 'hidden widgets')) . $widgetMenu, 'itemOptions' => array('class' => 'search-bar special')), array('label' => $avatar . Yii::app()->suModel->alias, 'itemOptions' => array('id' => 'profile-dropdown', 'class' => 'dropdown'), 'items' => $userMenuItems));
public function run() { // here render procedures echo CHtml::beginForm($this->action, $this->method, array('id' => $this->id, 'enctype' => $this->enctype, 'target' => $this->target)); // you better create a function but // for the sake of the example... foreach ($this->attributes as $attr) { // here we can actually say i // this is very simple but you get the idea echo CHtml::label($attr['label'], $attr['name']); if ($attr['type'] == 'text') { echo CHtml::textField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'textarea') { echo CHtml::textArea($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'password') { echo CHtml::passwordField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'checkbox') { echo CHtml::checkBox($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'checkboxlist') { echo CHtml::checkBoxList($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'date') { echo CHtml::dateField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'dropdownlist') { echo CHtml::dropDownList($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'file') { echo CHtml::fileField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'hidden') { echo CHtml::hiddenField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'radio') { echo CHtml::radioButton($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'radiolist') { echo CHtml::radioButtonList($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } } } } } } } } } } } // do more here } echo "<br/><br/><div class='row-fluid'>"; echo CHtml::submitButton($this->submit['label'], $this->submit['options']); echo "</div>"; echo CHtml::endForm(); }