本文整理汇总了PHP中CActiveForm类的典型用法代码示例。如果您正苦于以下问题:PHP CActiveForm类的具体用法?PHP CActiveForm怎么用?PHP CActiveForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CActiveForm类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: activeJuiAutoComplete
public function activeJuiAutoComplete(CActiveForm $form, CModel $model, $attribute, $acRoute, $acValue, array $acOptions = array(), array $htmlOptions = array(), $loader = '/images/loader.gif')
{
$defaultAcOptions = array('minLength' => '3', 'select' => "js:{$attribute}_fillHidden", 'focus' => "js:{$attribute}_itemFocus", 'search' => "js:{$attribute}_initSearch", 'open' => "js:{$attribute}_finishedSearch");
$acName = "{$attribute}_autocomplete";
$_POST[$acName] = $acValue;
echo $form->hiddenField($model, $attribute);
$this->owner->widget('zii.widgets.jui.CJuiAutoComplete', array('name' => $acName, 'value' => $acValue, 'sourceUrl' => $acRoute, 'options' => array_merge($defaultAcOptions, $acOptions), 'htmlOptions' => $htmlOptions));
Yii::app()->clientScript->registerScript('jui_extras', "\n\t\t\tfunction {$attribute}_initSearch(e, ui) {\n\t\t\t\t\$(e.target).after('<img src=\"{$loader}\" class=\"loader\" alt=\"...\" />')\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tfunction {$attribute}_finishedSearch(e, ui) {\n\t\t\t\t\$(e.target).siblings('img').remove()\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tfunction {$attribute}_fillHidden(e, ui) {\n\t\t\t\t\$('#" . get_class($model) . "_{$attribute}').val(ui.item.value)\n\t\t\t\t\$(e.target).val(ui.item.label)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tfunction {$attribute}_itemFocus(e, ui) {\n\t\t\t\t\$(e.target).val(ui.item.label)\n\t\t\t\treturn false\n\t\t\t}\n\t\t");
}
开发者ID:nurirahmat,项目名称:Yii-Extensions,代码行数:9,代码来源:HtmlEx.php
示例2: formatInputField
/**
* Formats a set of input field that consists of label, input, and error message.
* @param CActiveForm $form the form
* @param string $type the input field method
* @param CModel $model the model
* @param string $attribute the attribute
* @param string $icon the icon
* @param array $htmlOptions the HTML option values
* @param array $otherOptions otherOptions
* @return string the HTML of the set of the input field
*/
public function formatInputField($form, $type, $model, $attribute, $icon, $htmlOptions = array(), $otherOptions = array())
{
return '<tr>
<td>
<div class="control-group attribute-' . $attribute . '">
<i class="icon ' . $icon . '"></i> ' . $form->labelEx($model, $attribute, array('class' => 'control-label')) . '
</div>
</td>
<td>
<div class="control-group attribute-' . $attribute . '">' . @$otherOptions['beforeInput'] . (isset($otherOptions['data']) ? $form->{$type}($model, $attribute, $otherOptions['data'], $htmlOptions) : $form->{$type}($model, $attribute, $htmlOptions)) . @$otherOptions['afterInput'] . (isset($otherOptions['hint']) ? '<span class="hint">' . $otherOptions['hint'] . '</span>' : '') . $form->error($model, $attribute, array('inputContainer' => '.attribute-' . $attribute)) . '
</div>
</td>
</tr>';
}
开发者ID:ekospinach,项目名称:berkuliah,代码行数:25,代码来源:BkFormatter.php
示例3: showGeneralForm
protected function showGeneralForm()
{
$model = new SettingGeneralForm();
settings()->deleteCache();
//Set Value for the Settings
$model->site_name = Yii::app()->settings->get('general', 'site_name');
$model->site_title = Yii::app()->settings->get('general', 'site_title');
$model->site_description = Yii::app()->settings->get('general', 'site_description');
$model->slogan = Yii::app()->settings->get('general', 'slogan');
$model->homepage = Yii::app()->settings->get('general', 'homepage');
// if it is ajax validation request
if (isset($_POST['ajax']) && $_POST['ajax'] === 'settings-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if (isset($_POST['SettingGeneralForm'])) {
$model->attributes = $_POST['SettingGeneralForm'];
if ($model->validate()) {
settings()->deleteCache();
foreach ($model->attributes as $key => $value) {
Yii::app()->settings->set('general', $key, $value);
}
user()->setFlash('success', t('General Settings Updated Successfully!'));
}
}
$this->render('cmswidgets.views.settings.settings_general_widget', array('model' => $model));
}
开发者ID:nganhtuan63,项目名称:gxc-cms,代码行数:28,代码来源:SettingsWidget.php
示例4: actionLogin
/**
* Displays the login page
*/
public function actionLogin()
{
$model = new LoginForm();
// if it is ajax validation request
if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if (isset($_POST['LoginForm'])) {
$model->attributes = $_POST['LoginForm'];
// validate user input and redirect to the previous page if valid
if ($model->validate() && $model->login()) {
/*ELECCION DE LOCAL*/
$session = Yii::app()->getSession();
$tipo_user = $session['_tipo'];
$local_user = $session['_local'];
if ($tipo_user == 'EMPLEADO' and !$local_user) {
$this->redirect(array('user/elegir'));
}
$this->redirect(Yii::app()->user->returnUrl);
}
}
// display the login form
$this->render('ingreso', array('model' => $model));
}
开发者ID:rapbore,项目名称:rch2,代码行数:29,代码来源:SiteController.php
示例5: performAjaxValidation
protected function performAjaxValidation($model)
{
if (isset($_POST['ajax'])) {
echo CActiveForm::validate($model);
Yii::app()->end();
}
}
开发者ID:fobihz,项目名称:cndiesel,代码行数:7,代码来源:DefaultController.php
示例6: performAjaxValidation
/**
* Performs the AJAX validation.
*
* @param CModel the model to be validated
*
* @return void
*/
protected function performAjaxValidation(News $model)
{
if (Yii::app()->getRequest()->getIsAjaxRequest() && Yii::app()->getRequest()->getPost('ajax') === 'news-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
}
开发者ID:porem,项目名称:yupe-ext,代码行数:14,代码来源:MetrikaBackendController.php
示例7: actionRecover
public function actionRecover()
{
$model = new RecoverForm();
if (isset($_POST['ajax']) && $_POST['ajax'] === 'recover-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
if (isset($_POST['RecoverForm'])) {
$model->attributes = $_POST['RecoverForm'];
if ($model->validate()) {
$user = Users::model()->findByAttributes(array("email" => $model->email));
$password = md5(uniqid());
$user->hash = md5($user->email . uniqid());
$user->userkey = sha1($user->email . uniqid());
$user->password = md5($password . $user->hash);
if ($user->save()) {
$message = $this->renderPartial('/messages/recover', array("username" => $user->username, "password" => $password), true);
MyPhpMailer::send($user->email, "Восстановление пароля на FermionAm.ru", $message);
$this->redirect(array('site/index'));
} else {
print CHtml::errorSummary($user);
Yii::app()->end();
}
} else {
print CHtml::errorSummary($model);
Yii::app()->end();
}
}
$this->render('recover', array('model' => $model));
}
开发者ID:postfx,项目名称:fermion,代码行数:30,代码来源:UserController.php
示例8: actionLogin
/**
* Displays the login page
*/
public function actionLogin()
{
$model = new LoginForm();
// if it is ajax validation request
if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if (isset($_POST['LoginForm'])) {
$model->attributes = $_POST['LoginForm'];
$criteria = new EMongoCriteria();
$criteria->login = $model->username;
$criteria->password = $model->password;
$user = User::model()->find($criteria);
// validate user input and redirect to the previous page if valid
if ($model->validate()) {
if (count($user->profil) == 0) {
Yii::app()->user->setFlash('error', Yii::t('common', 'contactAdministrator'));
} elseif ($model->login()) {
$this->redirect(array('site/index'));
}
} else {
Yii::app()->user->setFlash('error', Yii::t('common', 'incorrectLoginPassword'));
}
}
// display the login form
$this->render('login', array('model' => $model));
}
开发者ID:Biobanques,项目名称:cbsd_platform,代码行数:32,代码来源:SiteController.php
示例9: actionLogin
/**
* Displays the login page
*/
public function actionLogin()
{
if (!Helper::BrowserIsChrome()) {
$this->renderPartial('download');
Yii::app()->end();
}
$model = new LoginForm();
// if it is ajax validation request
if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if (isset($_POST['LoginForm'])) {
$model->attributes = $_POST['LoginForm'];
// validate user input and redirect to the previous page if valid
if ($model->validate() && $model->login()) {
if (Yii::app()->user->checkAccess("playtocrmdash") && !Yii::app()->user->checkAccess("cgtz_adminstrator")) {
$this->redirect($this->createUrl("/crm/dashboard"));
} else {
$this->redirect($this->createUrl("/site/index"));
}
}
}
// display the login form
$this->renderPartial('login', array('model' => $model));
}
开发者ID:kl0428,项目名称:admin,代码行数:30,代码来源:SiteController.php
示例10: performAjaxValidation
/**
* Performs the AJAX validation.
* @param CModel the model to be validated
*/
protected function performAjaxValidation($model)
{
if (isset($_POST['ajax']) && $_POST['ajax'] === 'finance-fee-particulars-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
}
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:11,代码来源:FinanceFeeParticularsController.php
示例11: actionLogin
/**
* Displays the login page
*/
public function actionLogin()
{
$this->layout = '//layouts/login';
if (@Yii::app()->user->id) {
$this->redirect(Yii::app()->homeUrl);
}
$model = new LoginFormAdmin();
// if it is ajax validation request
if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if (isset($_POST['LoginFormAdmin'])) {
$model->attributes = $_POST['LoginFormAdmin'];
// validate user input and redirect to the previous page if valid
if ($model->validate() && $model->login()) {
$audit = new AuditTrail();
$audit->user_id = Yii::app()->user->id;
$audit->login_time = new CDbExpression('NOW()');
$audit->user_type = 1;
$audit->save();
Yii::app()->user->setFlash('success', 'Welcome in the <strong>' . CHtml::encode(Yii::app()->name) . ' Admin Panel</strong>. Don\'t forget to <strong>Logout</strong> when finish!');
$this->redirect(Yii::app()->user->returnUrl);
}
}
// display the login form
$this->render('login', array('model' => $model));
}
开发者ID:optimosolution,项目名称:jasorbd,代码行数:32,代码来源:SiteController.php
示例12: actionLogin
/**
* Displays the login page
*/
public function actionLogin()
{
$model = new LoginForm();
// var_dump($_POST);
// die;
// if it is ajax validation request
if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if (isset($_POST['LoginForm'])) {
// var_dump($_POST);
// die;
$model->attributes = $_POST['LoginForm'];
// validate user input and redirect to the previous page if valid
if ($model->validate() && $model->login()) {
// Yii::app()->user->returnUrl = Yii::app()->request->urlReferrer;
// echo Yii::app()->request->urlReferrer;
// die;
// $this->redirect(Yii::app()->user->returnUrl);
$record = Users::model()->findByAttributes(array('username' => $_POST['LoginForm']['username']));
// echo "ssss";
// var_dump($record);
// die;
Yii::app()->session['uid'] = $record['id'];
Yii::app()->session['username'] = $record['username'];
$this->redirect('/index.php?r=posts/index');
}
}
// display the login form
$this->render('login', array('model' => $model));
}
开发者ID:RuiWangGit,项目名称:Blog,代码行数:36,代码来源:SiteController.php
示例13: performAjaxValidation
public function performAjaxValidation(Package $model)
{
if (Yii::app()->getRequest()->getIsAjaxRequest() && Yii::app()->getRequest()->getPost('ajax') === 'package-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
}
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:7,代码来源:PackageBackendController.php
示例14: performAjaxValidation
protected function performAjaxValidation($model, $id = 'comments-form')
{
if (isset($_POST['ajax']) && $_POST['ajax'] === $id) {
echo CActiveForm::validate($model);
Yii::app()->end();
}
}
开发者ID:urichalex,项目名称:CS-Bans,代码行数:7,代码来源:CommentsController.php
示例15: performAjaxValidation
protected function performAjaxValidation($model)
{
if (isset($_POST['ajax']) && $_POST['ajax'] === 'product-attribute-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
}
开发者ID:tierous,项目名称:yiirisma,代码行数:7,代码来源:ProductAttributeController.php
示例16: actionLogin
/**
* Displays the login page
*/
public function actionLogin()
{
$model = new LoginForm();
$usuario = "";
$contrasenia = "";
$error = "";
// if it is ajax validation request
if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if (isset($_POST['LoginForm'])) {
$model->attributes = $_POST['LoginForm'];
//Almacenar datos para ver que esta enviando
$usuario = $model->username;
$contrasenia = $model->password;
//$error=$model->login();
// validate user input and redirect to the previous page if valid
if ($model->validate() && $model->login()) {
$this->redirect(Yii::app()->user->returnUrl);
}
}
// display the login form
$this->render('login', array('model' => $model, 'usuario' => $usuario, 'error' => $error));
}
开发者ID:Edilber,项目名称:ManagerPathFinderSystem,代码行数:29,代码来源:SiteController.php
示例17: actionLogin
/**
* Displays the login page
*/
public function actionLogin()
{
$model = new LoginForm();
// if it is ajax validation request
if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if (isset($_POST['LoginForm'])) {
// echo $a."s"; die();
$model->attributes = $_POST['LoginForm'];
// validate user input and redirect to the previous page if valid
if ($model->validate()) {
if ($model->login()) {
$idUsr = Yii::app()->user->getId();
$criteria = new CDbCriteria();
$profile = TransaksiRegistrasi::model()->get_data_profile($idUsr);
if ($profile['STATUS_FIRST_LOGIN'] == 0) {
$this->redirect(Yii::app()->user->returnUrl . 'profile/changePass');
} else {
$this->redirect(Yii::app()->user->returnUrl . 'timeline');
}
}
}
}
// display the login form
$this->render('login', array('model' => $model));
}
开发者ID:eripahle,项目名称:rock20083,代码行数:32,代码来源:SiteController.php
示例18: performAjaxValidation
/**
* Performs the AJAX validation.
* @param CModel the model to be validated
*/
public function performAjaxValidation($model)
{
if (isset($_POST['ajax']) && $_POST['ajax'] === 'artist-area-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
}
开发者ID:robebeye,项目名称:MusicDream,代码行数:11,代码来源:ArtistAreaController.php
示例19: actionLogin
public function actionLogin()
{
$returnUrl = Yii::app()->user->__returnUrl;
if (!Yii::app()->user->getIsGuest()) {
//$this->redirect(array('/admin/'));
$this->rediretParentUrl($returnUrl);
}
$model = new LoginForm();
$this->layout = false;
$this->pageTitle = Yii::t('admin', 'admin login') . ' - ' . $this->setting_base['site_name'];
// if it is ajax validation request
if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if (isset($_POST['LoginForm'])) {
$model->attributes = $_POST['LoginForm'];
// validate user input and redirect to the previous page if valid
if ($model->validate() && $model->login()) {
$this->message('success', Yii::t('common', 'Login Success'), $returnUrl, 2);
}
}
$this->render('login', array('model' => $model));
}
开发者ID:redtreelchao,项目名称:wander-moon,代码行数:25,代码来源:DefaultController.php
示例20: actionIndex
public function actionIndex()
{
if (isset(Yii::app()->user->adminLogin) == TRUE) {
$this->redirect(array('product/admin'));
}
/* panggil model AdminLoginForm
* dan di tampung oleh $model */
$model = new AdminLoginForm();
// jika ajax maka divalidasi dengan ajax
if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
/* tampilkan hasil validasi form */
echo CActiveForm::validate($model);
/* end/exit/die */
Yii::app()->end();
}
// ambil data yang diinput oleh user
if (isset($_POST['AdminLoginForm'])) {
$model->attributes = $_POST['AdminLoginForm'];
/* validaasi data yang diinput oleh user dan
* jika valid maka ...
*/
if ($model->validate() && $model->login()) {
/* redirect ke halaman yang diinginkan
* (dalam hal ini kita direct ke halaman product/admin)
* */
$this->redirect(array('product/admin'));
}
}
// tampilkan login form
$this->render('index', array('model' => $model));
}
开发者ID:tierous,项目名称:yico-commerce,代码行数:31,代码来源:AdminController.php
注:本文中的CActiveForm类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论