Exemplo n.º 1
1
 /**
  * (non-PHPdoc)
  * @see CPortlet::renderContent()
  */
 protected function renderContent()
 {
     $themesList = array_combine(Yii::app()->themeManager->themeNames, Yii::app()->themeManager->themeNames);
     echo CHtml::form('', 'post', array());
     echo CHtml::dropDownList('themeSelector', Yii::app()->theme->name, $themesList, $this->dropDownOptions);
     echo CHtml::endForm();
 }
Exemplo n.º 2
1
 /**
  * @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;
 }
 /**
  * (non-PHPdoc)
  * @see CPortlet::renderContent()
  */
 protected function renderContent()
 {
     $translations = self::getLanguagesList();
     echo CHtml::form('', 'post', array());
     echo CHtml::dropDownList('languageSelector', Yii::app()->getLanguage(), $translations, $this->dropDownOptions);
     echo CHtml::endForm();
 }
 public function renderCheckoutForm(Payment $payment, Order $order, $return = false)
 {
     $settings = $payment->getPaymentSystemSettings();
     $mrhLogin = $settings['login'];
     $mrhPass1 = $settings['password1'];
     $culture = $settings['language'];
     $invId = $order->id;
     $invDesc = Yii::t('RobokassaModule.robokassa', 'Payment order #{id} on "{site}" website', ['{id}' => $order->id, '{site}' => Yii::app()->getModule('yupe')->siteName]);
     $outSum = Yii::app()->money->convert($order->getTotalPrice(), $payment->currency_id);
     $crc = md5("{$mrhLogin}:{$outSum}:{$invId}:{$mrhPass1}");
     $form = CHtml::form($settings['testmode'] ? "http://test.robokassa.ru/Index.aspx" : "https://merchant.roboxchange.com/Index.aspx");
     $form .= CHtml::hiddenField('MrchLogin', $mrhLogin);
     $form .= CHtml::hiddenField('OutSum', $outSum);
     $form .= CHtml::hiddenField('InvId', $invId);
     $form .= CHtml::hiddenField('Desc', $invDesc);
     $form .= CHtml::hiddenField('SignatureValue', $crc);
     $form .= CHtml::hiddenField('Culture', $culture);
     $form .= CHtml::submitButton(Yii::t('RobokassaModule.robokassa', 'Pay'));
     $form .= CHtml::endForm();
     if ($return) {
         return $form;
     } else {
         echo $form;
     }
 }
Exemplo n.º 5
0
 public function endForm()
 {
     echo CHtml::closeTag('fieldset');
     if ($this->form) {
         echo CHtml::endForm();
     }
 }
Exemplo n.º 6
0
 public function endForm()
 {
     if ($this->form) {
         echo CHtml::endForm();
     } else {
         echo CHtml::closeTag('div');
     }
 }
Exemplo n.º 7
0
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();
}
 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();
 }
Exemplo n.º 9
0
 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 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();
 }
Exemplo n.º 11
0
 public function endAdminTool()
 {
     if (Yii::app()->user->checkAccess('admin')) {
         echo "</div>";
         echo "<div id='dialog_" . $this->id . "' style='display:none;'>";
         echo CHtml::beginform(Yii::app()->createUrl('/core/admin/ajax/saveFile'), 'post', array('id' => "form_" . $this->id));
         $this->widget('ext.elrte.SElrteArea', array('name' => 'FileContent', 'value' => file_get_contents($this->filePath), 'htmlOptions' => array('cols' => 100, 'rows' => 15, 'id' => 'content_' . $this->id)));
         echo CHtml::hiddenField('FileName', $this->filePath);
         echo CHtml::endForm();
         echo "</div>";
     }
 }
Exemplo n.º 12
0
 public function run()
 {
     $currencyActvie = Currency::getActiveCurrencyArray(2);
     $currentCharCode = Currency::getCurrentCurrencyModel()->char_code;
     foreach ($currencyActvie as $char_code => $currencyName) {
         echo CHtml::hiddenField($char_code, $this->getOwner()->createLangUrl(Yii::app()->language, array('currency' => $char_code)), array('id' => 'currency_' . $char_code));
     }
     echo CHtml::form();
     $class = Yii::app()->theme->name != 'classic' ? 'currency' : 'currency-drop';
     echo CHtml::dropDownList('currency', $currentCharCode, $currencyActvie, array('onchange' => 'this.form.action=$("#currency_"+this.value).val(); this.form.submit(); return false;', 'class' => $class));
     echo CHtml::endForm();
 }
 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>';
         }
     }
 }
Exemplo n.º 15
0
 public static function getHTML()
 {
     $profilsList = array();
     foreach (Yii::app()->user->getState('profil') as $profil) {
         $profilsList[$profil] = Yii::t('common', $profil);
         asort($profilsList);
     }
     if (!Yii::app()->user->isAdmin() && array_merge($profilsList, array("administrator" => Yii::t('common', 'administrator'))) != User::model()->getArrayProfil()) {
         $profilsList['newProfil'] = "Demander un nouveau profil";
     }
     $controler = Yii::app()->getController()->getId();
     $action = Yii::app()->getController()->getAction()->getId();
     $html = CHtml::form(Yii::app()->createUrl("{$controler}/{$action}"), "POST", array('class' => "navbar-form pull-left"));
     $html .= CHtml::dropDownList("activeProfil", Yii::app()->user->getState('activeProfil'), $profilsList, array('id' => "profil", "style" => "width:150px; margin-top: -3px; margin-left: -25px;", "onchange" => "this.form.submit()"));
     $html .= CHtml::endForm();
     return $html;
 }
Exemplo n.º 16
0
 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));
     }
 }
Exemplo n.º 17
0
 /**
  * Generate qiwi payment form.
  * @param StorePaymentMethod $method
  * @param Order $order
  * @return string
  */
 public function renderPaymentForm(StorePaymentMethod $method, Order $order)
 {
     $settings = $this->getSettings($method->id);
     $summ = Yii::app()->currency->convert($order->full_price, $method->currency_id);
     $html = '<div class="form">';
     $html .= CHtml::form('http://w.qiwi.ru/setInetBill_utf.do', 'get');
     $html .= CHtml::hiddenField('from', $settings['shop_id']);
     $html .= CHtml::hiddenField('summ', $summ);
     $html .= CHtml::hiddenField('com', $this->getPaymentComment($order));
     $html .= CHtml::hiddenField('txn_id', $order->id);
     $html .= '<div id="qiwi_phone_number">Номер телефона:<br/>';
     $html .= CHtml::textField('to', $order->user_phone);
     $html .= '</div>';
     $html .= $this->renderSubmit();
     $html .= CHtml::endForm();
     $html .= '</div>';
     return $html;
 }
Exemplo n.º 18
0
	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();
        }
	}
Exemplo n.º 19
0
 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>';
 }
 public function renderCheckoutForm($subscription, $return = false)
 {
     $settings = $this->_getSettings();
     $mrhLogin = $settings['login'];
     $mrhPass1 = $settings['password1'];
     $culture = $settings['language'];
     $invId = $subscription->id;
     $invDesc = Yii::t('site', 'Оплата заказа №{id} на сайте "{site}"', ['{id}' => $subscription->order_num, '{site}' => Yii::app()->getModule('yupe')->siteName]);
     $outSum = $subscription->getTotalCost();
     $crc = md5("{$mrhLogin}:{$outSum}:{$invId}:{$mrhPass1}");
     $form = CHtml::form($settings['testmode'] ? "http://test.robokassa.ru/Index.aspx" : "https://merchant.roboxchange.com/Index.aspx", 'POST', array('id' => 'payment-form'));
     $form .= CHtml::hiddenField('MrchLogin', $mrhLogin);
     $form .= CHtml::hiddenField('OutSum', $outSum);
     $form .= CHtml::hiddenField('InvId', $invId);
     $form .= CHtml::hiddenField('Desc', $invDesc);
     $form .= CHtml::hiddenField('SignatureValue', $crc);
     $form .= CHtml::hiddenField('Culture', $culture);
     $form .= CHtml::endForm();
     if ($return) {
         return $form;
     } else {
         echo $form;
     }
 }
Exemplo n.º 21
0
 * defined in the data model, no extra javascript code needs to be written.
 * More importantly, and the validation result is consistent with the server-side validation.
 * And in case when the user turns off javascript in his browser, it automatically
 * falls back to traditional validation via whole page submission.
 *
 * To use CActiveForm with AJAX validation, one needs to write both the view code
 * and the controller action code.
 *
 * The following is a piece of sample view code:
 * <pre>
 * &lt;?php $form = $this->beginWidget('CActiveForm', array(
 *     'id'=>'user-form',
 *     'enableAjaxValidation'=>true,
 * )); ?&gt;
 *
 * &lt;?php echo $form-&gt;errorSummary($model); ?&gt;
 *
 * &lt;div class="row"&gt;
 *     &lt;?php echo $form-&gt;labelEx($model,'firstName'); ?&gt;
 *     &lt;?php echo $form-&gt;textField($model,'firstName'); ?&gt;
 *     &lt;?php echo $form-&gt;error($model,'firstName'); ?&gt;
 * &lt;/div&gt;
 * &lt;div class="row"&gt;
 *     &lt;?php echo $form-&gt;labelEx($model,'lastName'); ?&gt;
 *     &lt;?php echo $form-&gt;textField($model,'lastName'); ?&gt;
Exemplo n.º 22
0
	public function renderFilter() 
	{
		$filter = isset($_GET['filter']) ? $_GET['filter'] : null;
		$details = isset($_GET['filterDetails']) ? $_GET['filterDetails'] : ''; 
		
		if(isset($_GET['filterButton'])) 
			unset($_GET['filterButton']);
			
		$tmpGet = $_GET;
		if (isset($tmpGet['filter'])) {
			if (isset($tmpGet['filterDetails']))
				unset($tmpGet['filterDetails']);
			unset($tmpGet['filter']);
		}
		
		echo CHtml::form( Y::url('site', $tmpGet), 'get');
		echo CHtml::dropDownList('filter',$filter,array(
			'inYear'=>'по годам', 'inWorkType'=>'по видам деятельности','inCity'=>'по городам'
		));
		
		if ($filter) { 
			
			if ($filter == 'inYear')
				$items = Y::years();
			if ($filter == 'inCity') 
				$items = City::model()->allWithHeader;
			if ($filter == 'inWorkType') 
				$items = PortfolioWorkType::model()->allWithHeader;
				
			if (isset($items))
				echo CHtml::dropDownList('filterDetails', $details, $items);
		}
		
		echo CHtml::submitButton('Отфильтровать', array('name'=>'filterButton'));
		echo CHtml::endForm();
	}
Exemplo n.º 23
0
                    </div>
                </div>

            <?php 
    }
    ?>


            <?php 
    $this->endWidget();
    ?>
        </div>
    </div>

    <div class="row">
        <div class="col-sm-12">
            <?php 
    echo CHtml::submitButton(Yii::t('YupeModule.yupe', 'Save "{{name}}" module settings', ['{{name}}' => CHtml::encode($module->name)]), ['class' => 'btn btn-primary', 'id' => 'saveModuleSettings', 'name' => 'saveModuleSettings']);
    ?>
        </div>
    </div>
    <?php 
    echo CHtml::endForm();
} else {
    ?>
    <b><?php 
    echo Yii::t('YupeModule.yupe', 'There is no parameters which you cat change for this module...');
    ?>
</b>
<?php 
}
Exemplo n.º 24
0
 /**
  * Причины банов
  * @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')));
 }
Exemplo n.º 25
0
 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();
     }
 }
Exemplo n.º 26
0
 /**
  * generates a link or button to the page where you translate the missing translations found in this page
  * 
  * @param string $label label of the link
  * @param string $type accepted types are : link and button
  * @return string
  */
 function translateLink($label = 'Translate', $type = 'link')
 {
     $form = CHtml::form(Yii::app()->getController()->createUrl('/translate/translate/index'));
     if (count(self::$messages)) {
         foreach (self::$messages as $index => $message) {
             foreach ($message as $name => $value) {
                 $form .= CHtml::hiddenField(self::ID . "-missing[{$index}][{$name}]", $value);
             }
         }
     }
     if ($type === 'button') {
         $form .= CHtml::submitButton($label);
     } else {
         $form .= CHtml::linkButton($label);
     }
     $form .= CHtml::endForm();
     return $form;
 }
Exemplo n.º 27
0
<?php $this->renderPartial('_menu'); ?>
<?php
$this->breadcrumbs = array(
    'Профиль' => array('/profile'),
    'Мои фото',
);?>
<h1>Мои фото</h1>
<?php $this->renderPartial('_flash'); ?>

<?php echo CHtml::link('Загрузить', array('/profile/photo')); ?>
<br><br>

<?php $mainphoto = $user->mainphoto; ?>
<?php if ($models) { ?>

<?php echo CHtml::form('', 'post'); ?>
<div class="allphotos">
    <?php
    foreach ($models as $model) {
        $this->renderPartial('_photosimple', compact('model', 'mainphoto'));
    } ?>
    <br clear="both"/>
    <?php echo CHtml::submitButton('Удалить отмеченные', array('confirm' => 'Вы уверены?', 'name' => 'deletephotos')); ?>
</div>
<?php echo CHtml::endForm(); ?>

<?
} else {
    echo 'Фотографий не найдено';
}
    <div class="row">
	      <?php 
echo $form->labelEx($photo, 'student_photos_path');
?>
	      <?php 
CHtml::form('', 'post', array('enctype' => 'multipart/form-data'));
?>
	      <?php 
echo CHtml::activeFileField($photo, 'student_photos_path', array('tabindex' => 15));
?>
<span class="status">&nbsp;</span>
		<?php 
if (isset($photo->student_photos_path)) {
    echo CHtml::image(Yii::app()->baseUrl . '/stud_images/' . $photo->student_photos_path, "", array("width" => "50px", "height" => "50px"));
}
?>
	
	      <?php 
CHtml::endForm();
?>
</div>

<div class="row buttons">
		<?php 
echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('class' => 'submit', 'tabindex' => 16));
?>
	
</div>


Exemplo n.º 29
0
 /**
  * Delete token attributes
  */
 function deletetokenattributes($iSurveyId)
 {
     $clang = $this->getController()->lang;
     $iSurveyId = sanitize_int($iSurveyId);
     // CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
     $bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
     if (!$bTokenExists) {
         Yii::app()->session['flashmessage'] = $clang->gT("No token table.");
         $this->getController()->redirect($this->getController()->createUrl("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
     }
     if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update') && !Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'update')) {
         Yii::app()->session['flashmessage'] = $clang->gT("You do not have sufficient rights to access this page.");
         $this->getController()->redirect($this->getController()->createUrl("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
     }
     $aData['thissurvey'] = getSurveyInfo($iSurveyId);
     $aData['surveyid'] = $iSurveyId;
     $confirm = Yii::app()->request->getPost('confirm', '');
     $cancel = Yii::app()->request->getPost('cancel', '');
     $tokenfields = getAttributeFieldNames($iSurveyId);
     $sAttributeToDelete = Yii::app()->request->getPost('deleteattribute', '');
     tracevar($sAttributeToDelete);
     if (!in_array($sAttributeToDelete, $tokenfields)) {
         $sAttributeToDelete = false;
     }
     tracevar($sAttributeToDelete);
     if ($cancel == 'cancel') {
         Yii::app()->getController()->redirect(Yii::app()->getController()->createUrl("/admin/tokens/sa/managetokenattributes/surveyid/{$iSurveyId}"));
     } elseif ($confirm != 'confirm' && $sAttributeToDelete) {
         $this->_renderWrappedTemplate('token', array('tokenbar', 'message' => array('title' => sprintf($clang->gT("Delete token attribute %s"), $sAttributeToDelete), 'message' => "<p>" . $clang->gT("If you remove this attribute, you will lose all information.") . "</p>\n" . CHtml::form(array("admin/tokens/sa/deletetokenattributes/surveyid/{$iSurveyId}"), 'post', array('id' => 'attributenumber')) . CHtml::hiddenField('deleteattribute', $sAttributeToDelete) . CHtml::hiddenField('sid', $iSurveyId) . CHtml::htmlButton($clang->gT('Delete attribute'), array('type' => 'submit', 'value' => 'confirm', 'name' => 'confirm')) . CHtml::htmlButton($clang->gT('Cancel'), array('type' => 'submit', 'value' => 'cancel', 'name' => 'cancel')) . CHtml::endForm())), $aData);
     } elseif ($sAttributeToDelete) {
         $sTableName = "{{tokens_" . intval($iSurveyId) . "}}";
         Yii::app()->db->createCommand(Yii::app()->db->getSchema()->dropColumn($sTableName, $sAttributeToDelete))->execute();
         Yii::app()->db->schema->getTable($sTableName, true);
         // Refresh schema cache just in case the table existed in the past
         LimeExpressionManager::SetDirtyFlag();
         Yii::app()->session['flashmessage'] = sprintf($clang->gT("Attribute %s was deleted."), $sAttributeToDelete);
         Yii::app()->getController()->redirect(Yii::app()->getController()->createUrl("/admin/tokens/sa/managetokenattributes/surveyid/{$iSurveyId}"));
     } else {
         Yii::app()->session['flashmessage'] = $clang->gT("The selected attribute was invalid.");
         Yii::app()->getController()->redirect(Yii::app()->getController()->createUrl("/admin/tokens/sa/managetokenattributes/surveyid/{$iSurveyId}"));
     }
 }
Exemplo n.º 30
0
 /**
  * Runs the widget.
  * This registers the necessary javascript code and renders the form close tag.
  */
 public function run()
 {
     if (is_array($this->focus)) {
         $this->focus = "#" . CHtml::activeId($this->focus[0], $this->focus[1]);
     }
     echo CHtml::endForm();
     $cs = Yii::app()->clientScript;
     if (!$this->enableAjaxValidation && !$this->enableClientValidation || empty($this->attributes)) {
         if ($this->focus !== null) {
             $cs->registerCoreScript('jquery');
             $cs->registerScript('CActiveForm#focus', "\r\n\t\t\t\t\tif(!window.location.hash)\r\n\t\t\t\t\t\t\$('" . $this->focus . "').focus();\r\n\t\t\t\t");
         }
         return;
     }
     $options = $this->clientOptions;
     if (isset($this->clientOptions['validationUrl']) && is_array($this->clientOptions['validationUrl'])) {
         $options['validationUrl'] = CHtml::normalizeUrl($this->clientOptions['validationUrl']);
     }
     $options['attributes'] = array_values($this->attributes);
     if ($this->summaryID !== null) {
         $options['summaryID'] = $this->summaryID;
     }
     if ($this->focus !== null) {
         $options['focus'] = $this->focus;
     }
     $options = CJavaScript::encode($options);
     $cs->registerCoreScript('yiiactiveform');
     $id = $this->id;
     $cs->registerScript(__CLASS__ . '#' . $id, "\$('#{$id}').yiiactiveform({$options});");
 }