/** * Performs the AJAX validation. * @param CModel the model to be validated */ public function actionManage() { $model = new Coursemanager(); if (isset($_POST['assign'])) { if (isset($_POST['user']) and $_POST['user'] != NULL) { $user = $_POST['user']; } if (isset($_POST['cid']) and $_POST['cid'] != NULL) { // var_dump($_POST['cid']); $no_of_course = count($_POST['cid']); for ($i = 0; $i < $no_of_course; $i++) { $model = new Coursemanager(); //print_r($_POST['cid'][$i]); exit; $model->user_id = $user; $model->course = $_POST['cid'][$i]; $model->save(); } } } $this->render('manage', array('model' => $model, 'id' => $model->id)); }
echo Yii::t('Courses', 'Update Course Manager'); ?> </h1> <div class="formCon"> <div class="formConInner"> <div style="position:relative; width:180px;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> <td width="1000px"><strong><?php echo Yii::t('Courses', 'Select Coursemanager'); ?> </strong></td> <td> </td> <td><?php $cid = Coursemanager::model()->findByAttributes(array('id' => $_REQUEST['id'])); $profile = Profile::model()->findByAttributes(array('user_id' => $cid->user_id)); $name = $profile->firstname . ' ' . $profile->lastname; echo '<span style="font-size:14px; font-weight:bold; color:#666;"></span> '; echo CHtml::dropDownList('user', $profile->user_id, array($profile->user_id => $name), array('id' => 'user')); echo '</td><td style="padding-top:13px;">'; ?> </td> </td></tr> <tr> <td> </td> <td><strong><?php echo Yii::t('Courses', 'Select Course'); ?> </strong></td> <td> </td>
<table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="247" valign="top"> <?php $this->renderPartial('/courses/left_side'); ?> </td> <td valign="top"> <div class="cont_right"> <h1><?php echo Yii::t('Courses', 'Course Managers'); ?> </h1> <?php $course = Coursemanager::model()->findAll('is_deleted=:y', array(':y' => 0)); ?> <div class="pdtab_Con"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr class="pdtab-h"> <td align="center"><?php echo Yii::t('Courses', 'Course Manager Name'); ?> </td> <td align="center"><?php echo Yii::t('Courses', 'Course'); ?> </td> <td align="center"><?php echo Yii::t('Courses', 'Action');
public function actionDeleteall($id) { $course = Coursemanager::model()->findByAttributes(array('id' => $id)); $course->is_deleted = '1'; $course->save(); $this->redirect(array('manage')); }