Exemple #1
0
                    </div>
                    </div>
                <?php 
}
?>
                <div class="form-group">
                    <?php 
?>
                    <label class="required col-sm-3 control-label" for="classified_id" style="valign:top;padding-right: 8px;" > Module List <span class="required">*</span></label>
                    <div class="col-sm-9">
                    <div class="row">
                        <?php 
$modulelist = CHtml::listData(SystemModules::model()->findAll(), 'module_id', 'module_name');
if (isset($_GET['id']) && !empty($_GET['id'])) {
    $id = $_GET['id'];
    $data = ModulePermission::model()->findAllByAttributes(array('user_role_type' => $id));
    $selected_keys = array_keys(CHtml::listData($data, 'module_id', 'module_permission_id'));
    echo CHtml::checkBoxList('ModulePermission[module_id]', $selected_keys, $modulelist, array('template' => '<div class="col-sm-6 removeBR checkbox_list">{input} {label}</div>'));
} else {
    echo CHtml::checkBoxList('ModulePermission[module_id]', '', $modulelist, array('template' => '<div class="col-sm-6 removeBR checkbox_list">{input} {label}</div>'));
}
?>
                    </div>
                    <div style="" id="classified_error" class="text-red"></div>
                    </div>
                </div> 

			</div>
            </div>            
        </div>
        <div class="row">
 public function checkPermission($roleType)
 {
     $data = ModulePermission::model()->count('user_role_type=' . $roleType);
     return $data;
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return ModulePermission the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = ModulePermission::model()->findAllByAttributes(array('user_role_type' => $id));
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }