Exemple #1
0
echo $form->labelEx($model, 'tid');
?>
        <?php 
echo $form->dropDownList($model, 'tid', GxHtml::listDataEx(Training::model()->findAllAttributes(null, true)));
?>
        <?php 
echo $form->error($model, 'tid');
?>
    </div>
    <!-- row -->
    <div class="row">
        <?php 
echo $form->labelEx($model, 'cid');
?>
        <?php 
echo $form->dropDownList($model, 'cid', GxHtml::listDataEx(Center::model()->findAllAttributes(null, true)));
?>
        <?php 
echo $form->error($model, 'cid');
?>
    </div>
    <!-- row -->
    <div class="row">
        <?php 
echo $form->labelEx($model, 'start_time');
?>
        <?php 
//echo $form->textField($model, 'start_time');
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'ClassGuitar[start_time]', 'language' => 'vi', 'options' => array('showAnim' => 'fold'), 'value' => date('d/m/Y', $model->start_time ? $model->start_time : time()), 'htmlOptions' => array('style' => 'height:20px;')));
?>
        <?php 
Exemple #2
0
<?php

$this->breadcrumbs = array('Lớp học' => array('admin'), 'Quản lý');
$this->menu = array(array('label' => 'Danh sách', 'url' => array('admin')), array('label' => 'Tạo mới', 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('class-guitar-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Các lớp học</h1>
<?php 
echo GxHtml::link(Yii::t('app', 'Tìm kiếm'), '#', array('class' => 'search-button'));
?>
<div class="search-form">
    <?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'class-guitar-grid', 'dataProvider' => $model->search(), 'columns' => array('sku', 'title', array('name' => 'tid', 'value' => 'GxHtml::valueEx($data->t)', 'filter' => GxHtml::listDataEx(Training::model()->findAllAttributes(null, true))), array('name' => 'cid', 'value' => 'GxHtml::valueEx($data->c)', 'filter' => GxHtml::listDataEx(Center::model()->findAllAttributes(null, true))), array('name' => 'start_time', 'value' => 'date("d/m/Y",$data->start_time)'), array('name' => 'end_time', 'value' => 'date("d/m/Y",$data->end_time)'), array('class' => 'CButtonColumn'))));
 public function actionRegister()
 {
     $arrayAuthRoleItems = Yii::app()->authManager->getAuthItems(2, Yii::app()->user->getId());
     $arrayKeys = array_keys($arrayAuthRoleItems);
     $role = strtolower($arrayKeys[0]);
     if ($role == 'admin' || $role == 'teacher') {
         $this->redirect('/');
     }
     $this->layout = 'dangkyhoc';
     $model = new Student();
     if (isset($_GET['cid']) && (int) $_GET['cid']) {
         $model->class_id = $_GET['cid'];
     }
     $db = Yii::app()->db;
     if (isset($_POST['Student']) && $_POST['Student']) {
         $model->setAttributes($_POST['Student']);
         $gclass = ClassGuitar::model()->findByPk($model->class_id);
         $sql = "SELECT * FROM {{student}} WHERE user_id =" . Yii::app()->user->id . " ORDER BY id DESC";
         $cmd = $db->createCommand($sql);
         $student = $cmd->queryRow();
         if ($student) {
             //                var_dump($studentơclass_id);
             $gclass2 = ClassGuitar::model()->findByPk($student['class_id']);
             if ($student['status'] == 'comp') {
                 //Hoàn thành
                 if ($gclass->tid <= $gclass2->tid) {
                     $training = Training::model()->findByPk($gclass2->tid);
                     Yii::app()->user->setFlash('error', 'Bạn đã hoàn thành một lớp thuộc khóa <b>' . $training->title . '</b>. Vui lòng đăng ký khóa học cao hơn.');
                 }
             } elseif ($student['status'] == 'reg') {
                 // Mới đăng ký
                 Yii::app()->user->setFlash('error', 'Bạn đã đăng ký học tại lớp <b>' . $gclass2->title . '</b>. Vui lòng hủy đơn đăng ký này trước khi đăng ký tham gia lớp học khác!');
             } else {
                 $center = Center::model()->findByPk($gclass2->cid);
                 Yii::app()->user->setFlash('error', 'Bạn đang tham gia lớp học <b>' . $gclass2->title . '</b> tại cơ sở <b>' . $center->title . '</b>!');
             }
         } else {
         }
         if (!Yii::app()->user->hasFlash('error') && $model->save()) {
             if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                 Yii::app()->end();
             } else {
                 Yii::app()->user->setFlash('success', 'Bạn đã đăng ký lớp học thành công. LNT sẽ sớm liên lạc lại với bạn.');
             }
         }
     } else {
         $oldStudent = Student::model()->find('user_id=' . Yii::app()->user->id);
         if ($oldStudent) {
             $model->name = $oldStudent->name;
             $model->email = $oldStudent->email;
             $model->tel = $oldStudent->tel;
             $model->birthday = $oldStudent->birthday;
         }
     }
     $this->render('register', array('model' => $model));
 }
Exemple #4
0
	<div class="row">
		<?php 
echo $form->label($model, 'tid');
?>
		<?php 
echo $form->dropDownList($model, 'tid', GxHtml::listDataEx(Training::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', '--Chọn loại khóa học--')));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'cid');
?>
		<?php 
echo $form->dropDownList($model, 'cid', GxHtml::listDataEx(Center::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', '--Chọn trung tâm--')));
?>
	</div>

	<!--<div class="row">
		<?php 
/*echo $form->label($model, 'start_time'); */
?>
		<?php 
/*echo $form->textField($model, 'start_time'); */
?>
	</div>

	<div class="row">
		<?php 
/*echo $form->label($model, 'create_time'); */