/**
  * method onEdit()
  * Executed whenever the user clicks at the edit button da datagrid
  */
 function onEdit($param)
 {
     try {
         if (isset($param['key'])) {
             // get the parameter $key
             $key = $param['key'];
             // open a transaction with database 'permission'
             TTransaction::open('permission');
             // instantiates object System_group
             $object = new SystemGroup($key);
             $object->programs = $object->getSystemPrograms();
             // fill the form with the active record data
             $this->form->setData($object);
             // close the transaction
             TTransaction::close();
         } else {
             $this->form->clear();
         }
     } catch (Exception $e) {
         // in case of exception
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }
Beispiel #2
0
echo $form->label($model, 'phonenumber');
?>
		<?php 
echo $form->textField($model, 'phonenumber');
?>
	</div>
    
	<div class="row">
		<?php 
echo $form->label($model, 'group_id');
?>
		<?php 
//echo $form->textField($model,'group_id');
?>
        <?php 
echo $form->dropDownList($model, 'group_id', CHtml::listData(SystemGroup::model()->findAll(), "id", "group_title"), array('prompt' => '--Chọn nhóm--'));
?>
	</div>

	<div class="row buttons">
		<?php 
echo CHtml::submitButton(Yii::t('adm/app', 'search'), array('class' => 'search'));
?>
        <?php 
echo CHtml::resetButton(Yii::t('adm/app', 'reset'), array('class' => 'back'));
?>
	</div>

<?php 
$this->endWidget();
?>
Beispiel #3
0
?>
        <span class="note">Tick sẽ kích hoạt</span>
		<?php 
echo $form->error($model, 'status');
?>
	</div>
    
	<div class="row">
		<?php 
echo $form->labelEx($model, 'group_id');
?>
		<?php 
//echo $form->textField($model,'group_id');
?>
        <?php 
echo $form->dropDownList($model, 'group_id', CHtml::listData(SystemGroup::model()->findAll(), "id", "group_title"));
?>
		<?php 
echo $form->error($model, 'group_id');
?>
	</div>
    
	<div class="row buttons">
		<?php 
$this->widget('bootstrap.widgets.BootButton', array('buttonType' => 'submit', 'type' => 'primary', 'icon' => 'ok white', 'label' => $model->isNewRecord ? Yii::t('adm/staticpage', 'submit') : Yii::t('adm/staticpage', 'save')));
?>
        <?php 
$this->widget('bootstrap.widgets.BootButton', array('buttonType' => 'reset', 'icon' => 'remove', 'label' => Yii::t('adm/staticpage', 'reset')));
?>
	</div>
 /**
  * method Delete()
  * Delete a record
  */
 function Delete($param)
 {
     try {
         // get the parameter $key
         $key = $param['key'];
         // open a transaction with database 'permission'
         TTransaction::open('permission');
         // instantiates object System_group
         $object = new SystemGroup($key);
         // deletes the object from the database
         $object->delete();
         // close the transaction
         TTransaction::close();
         // reload the listing
         $this->onReload($param);
         // shows the success message
         new TMessage('info', TAdiantiCoreTranslator::translate('Record deleted'));
     } catch (Exception $e) {
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }